From c02d6291d79242c809e1dd62d40e6e97d958f6fd Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 12 Apr 2024 19:10:23 +0200 Subject: [PATCH 01/56] depedencies update --- Cargo.lock | 8145 ++++++++++++-------- Cargo.toml | 607 +- integration-tests/Cargo.toml | 7 +- pallets/asset-registry/Cargo.toml | 68 + pallets/asset-registry/README.md | 29 + pallets/asset-registry/src/benchmarking.rs | 133 + pallets/asset-registry/src/lib.rs | 655 ++ pallets/asset-registry/src/migration.rs | 90 + pallets/asset-registry/src/mock.rs | 149 + pallets/asset-registry/src/tests.rs | 865 +++ pallets/asset-registry/src/traits.rs | 72 + pallets/asset-registry/src/types.rs | 88 + pallets/asset-registry/src/weights.rs | 93 + pallets/xyk/Cargo.toml | 70 + pallets/xyk/README.md | 25 + pallets/xyk/src/benchmarking.rs | 207 + pallets/xyk/src/impls.rs | 31 + pallets/xyk/src/lib.rs | 1115 +++ pallets/xyk/src/tests/amm_position.rs | 53 + pallets/xyk/src/tests/creation.rs | 425 + pallets/xyk/src/tests/fees.rs | 498 ++ pallets/xyk/src/tests/invariants.rs | 560 ++ pallets/xyk/src/tests/liquidity.rs | 689 ++ pallets/xyk/src/tests/mock.rs | 288 + pallets/xyk/src/tests/mod.rs | 8 + pallets/xyk/src/tests/spot_price.rs | 83 + pallets/xyk/src/tests/trades.rs | 1085 +++ pallets/xyk/src/trade_execution.rs | 143 + pallets/xyk/src/types.rs | 69 + pallets/xyk/src/weights.rs | 368 + primitives/src/constants.rs | 2 +- runtime/basilisk/Cargo.toml | 13 +- rust-toolchain | 2 +- 33 files changed, 12922 insertions(+), 3813 deletions(-) create mode 100644 pallets/asset-registry/Cargo.toml create mode 100644 pallets/asset-registry/README.md create mode 100644 pallets/asset-registry/src/benchmarking.rs create mode 100644 pallets/asset-registry/src/lib.rs create mode 100644 pallets/asset-registry/src/migration.rs create mode 100644 pallets/asset-registry/src/mock.rs create mode 100644 pallets/asset-registry/src/tests.rs create mode 100644 pallets/asset-registry/src/traits.rs create mode 100644 pallets/asset-registry/src/types.rs create mode 100644 pallets/asset-registry/src/weights.rs create mode 100644 pallets/xyk/Cargo.toml create mode 100644 pallets/xyk/README.md create mode 100644 pallets/xyk/src/benchmarking.rs create mode 100644 pallets/xyk/src/impls.rs create mode 100644 pallets/xyk/src/lib.rs create mode 100644 pallets/xyk/src/tests/amm_position.rs create mode 100644 pallets/xyk/src/tests/creation.rs create mode 100644 pallets/xyk/src/tests/fees.rs create mode 100644 pallets/xyk/src/tests/invariants.rs create mode 100644 pallets/xyk/src/tests/liquidity.rs create mode 100644 pallets/xyk/src/tests/mock.rs create mode 100644 pallets/xyk/src/tests/mod.rs create mode 100644 pallets/xyk/src/tests/spot_price.rs create mode 100644 pallets/xyk/src/tests/trades.rs create mode 100644 pallets/xyk/src/trade_execution.rs create mode 100644 pallets/xyk/src/types.rs create mode 100644 pallets/xyk/src/weights.rs diff --git a/Cargo.lock b/Cargo.lock index b71b1f59ddb..6e254f7923b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -48,12 +48,12 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", - "cipher", + "cipher 0.4.4", "cpufeatures", ] @@ -65,31 +65,31 @@ checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ "aead", "aes", - "cipher", + "cipher 0.4.4", "ctr", "ghash", - "subtle", + "subtle 2.5.0", ] [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.14", "once_cell", "version_check", ] [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", - "getrandom 0.2.11", + "getrandom 0.2.14", "once_cell", "version_check", "zerocopy", @@ -97,18 +97,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "always-assert" @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" dependencies = [ "anstyle", "anstyle-parse", @@ -156,9 +156,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -171,9 +171,9 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3a318f1f38d2418400f8209655bfd825785afd25aa30bb7ba6cc792e4596748" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ "windows-sys 0.52.0", ] @@ -190,9 +190,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" [[package]] name = "approx" @@ -205,16 +205,39 @@ dependencies = [ [[package]] name = "aquamarine" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df752953c49ce90719c7bf1fc587bc8227aed04732ea0c0f85e5397d7fdbd1a1" +checksum = "21cc1548309245035eb18aa7f0967da6bc65587005170c56e6ef2788a4cf3f4e" dependencies = [ "include_dir", "itertools 0.10.5", "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.58", +] + +[[package]] +name = "ark-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb00293ba84f51ce3bd026bd0de55899c4e68f0a39a5728cebae3a73ffdc0a4f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-bls12-377-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c7021f180a0cbea0380eba97c2af3c57074cdaffe0eef7e840e1c9f2841e55" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-models-ext", + "ark-std", ] [[package]] @@ -229,6 +252,45 @@ dependencies = [ "ark-std", ] +[[package]] +name = "ark-bls12-381-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1dc4b3d08f19e8ec06e949712f95b8361e43f1391d94f65e4234df03480631c" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-models-ext", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-bw6-761" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e0605daf0cc5aa2034b78d008aaf159f56901d92a52ee4f6ecdfdac4f426700" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-bw6-761-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccee5fba47266f460067588ee1bf070a9c760bf2050c1c509982c5719aadb4f2" +dependencies = [ + "ark-bw6-761", + "ark-ec", + "ark-ff", + "ark-models-ext", + "ark-std", +] + [[package]] name = "ark-ec" version = "0.4.2" @@ -243,9 +305,35 @@ dependencies = [ "hashbrown 0.13.2", "itertools 0.10.5", "num-traits", + "rayon", "zeroize", ] +[[package]] +name = "ark-ed-on-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b10d901b9ac4b38f9c32beacedfadcdd64e46f8d7f8e88c1ae1060022cf6f6c6" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ed-on-bls12-377-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524a4fb7540df2e1a8c2e67a83ba1d1e6c3947f4f9342cc2359fc2e789ad731d" +dependencies = [ + "ark-ec", + "ark-ed-on-bls12-377", + "ark-ff", + "ark-models-ext", + "ark-std", +] + [[package]] name = "ark-ed-on-bls12-381-bandersnatch" version = "0.4.0" @@ -258,6 +346,19 @@ dependencies = [ "ark-std", ] +[[package]] +name = "ark-ed-on-bls12-381-bandersnatch-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d15185f1acb49a07ff8cbe5f11a1adc5a93b19e211e325d826ae98e98e124346" +dependencies = [ + "ark-ec", + "ark-ed-on-bls12-381-bandersnatch", + "ark-ff", + "ark-models-ext", + "ark-std", +] + [[package]] name = "ark-ff" version = "0.4.2" @@ -302,29 +403,29 @@ dependencies = [ ] [[package]] -name = "ark-poly" -version = "0.4.2" +name = "ark-models-ext" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +checksum = "3e9eab5d4b5ff2f228b763d38442adc9b084b0a465409b059fac5c2308835ec2" dependencies = [ + "ark-ec", "ark-ff", "ark-serialize", "ark-std", "derivative", - "hashbrown 0.13.2", ] [[package]] -name = "ark-scale" -version = "0.0.10" +name = "ark-poly" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b08346a3e38e2be792ef53ee168623c9244d968ff00cd70fb9932f6fe36393" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" dependencies = [ - "ark-ec", "ark-ff", "ark-serialize", "ark-std", - "parity-scale-codec", + "derivative", + "hashbrown 0.13.2", ] [[package]] @@ -344,7 +445,7 @@ dependencies = [ [[package]] name = "ark-secret-scalar" version = "0.0.2" -source = "git+https://github.com/w3f/ring-vrf?rev=3119f51#3119f51b54b69308abfb0671f6176cb125ae1bf1" +source = "git+https://github.com/w3f/ring-vrf?rev=e9782f9#e9782f938629c90f3adb3fff2358bc8d1386af3e" dependencies = [ "ark-ec", "ark-ff", @@ -352,7 +453,7 @@ dependencies = [ "ark-std", "ark-transcript", "digest 0.10.7", - "rand_core 0.6.4", + "getrandom_or_panic", "zeroize", ] @@ -386,13 +487,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ "num-traits", - "rand 0.8.5", + "rand", + "rayon", ] [[package]] name = "ark-transcript" version = "0.0.2" -source = "git+https://github.com/w3f/ring-vrf?rev=3119f51#3119f51b54b69308abfb0671f6176cb125ae1bf1" +source = "git+https://github.com/w3f/ring-vrf?rev=e9782f9#e9782f938629c90f3adb3fff2358bc8d1386af3e" dependencies = [ "ark-ff", "ark-serialize", @@ -402,6 +504,12 @@ dependencies = [ "sha3", ] +[[package]] +name = "array-bytes" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" + [[package]] name = "array-bytes" version = "6.2.2" @@ -423,12 +531,6 @@ dependencies = [ "nodrop", ] -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.4" @@ -493,28 +595,28 @@ dependencies = [ [[package]] name = "async-channel" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" +checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" dependencies = [ "concurrent-queue", - "event-listener 4.0.0", - "event-listener-strategy", + "event-listener 5.3.0", + "event-listener-strategy 0.5.1", "futures-core", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] name = "async-executor" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" +checksum = "5f98c37cf288e302c16ef6c8472aad1e034c6c84ce5ea7b8101c98eb4a802fee" dependencies = [ - "async-lock 3.2.0", + "async-lock 3.3.0", "async-task", "concurrent-queue", - "fastrand 2.0.1", - "futures-lite 2.1.0", + "fastrand 2.0.2", + "futures-lite 2.3.0", "slab", ] @@ -552,18 +654,18 @@ dependencies = [ [[package]] name = "async-io" -version = "2.2.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6d3b15875ba253d1110c740755e246537483f152fa334f91abd7fe84c88b3ff" +checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884" dependencies = [ - "async-lock 3.2.0", + "async-lock 3.3.0", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.1.0", + "futures-lite 2.3.0", "parking", - "polling 3.3.1", - "rustix 0.38.27", + "polling 3.6.0", + "rustix 0.38.32", "slab", "tracing", "windows-sys 0.52.0", @@ -580,13 +682,13 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c" +checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" dependencies = [ - "event-listener 4.0.0", - "event-listener-strategy", - "pin-project-lite 0.2.13", + "event-listener 4.0.3", + "event-listener-strategy 0.4.0", + "pin-project-lite 0.2.14", ] [[package]] @@ -613,34 +715,23 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.27", + "rustix 0.38.32", "windows-sys 0.48.0", ] -[[package]] -name = "async-recursion" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - [[package]] name = "async-signal" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.2.1", + "async-io 2.3.2", "async-lock 2.8.0", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 0.38.27", + "rustix 0.38.32", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -648,19 +739,19 @@ dependencies = [ [[package]] name = "async-task" -version = "4.5.0" +version = "4.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" +checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -673,7 +764,7 @@ dependencies = [ "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] @@ -688,34 +779,22 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "auto_impl" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.58", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "az" @@ -725,38 +804,39 @@ checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line 0.21.0", "cc", "cfg-if", "libc", "miniz_oxide", - "object 0.32.1", + "object 0.32.2", "rustc-demangle", ] [[package]] name = "bandersnatch_vrfs" -version = "0.0.1" -source = "git+https://github.com/w3f/ring-vrf?rev=3119f51#3119f51b54b69308abfb0671f6176cb125ae1bf1" +version = "0.0.4" +source = "git+https://github.com/w3f/ring-vrf?rev=e9782f9#e9782f938629c90f3adb3fff2358bc8d1386af3e" dependencies = [ "ark-bls12-381", "ark-ec", "ark-ed-on-bls12-381-bandersnatch", "ark-ff", - "ark-scale 0.0.12", "ark-serialize", "ark-std", "dleq_vrf", "fflonk", - "merlin 3.0.0", + "merlin", "rand_chacha 0.3.1", "rand_core 0.6.4", "ring 0.1.0", "sha2 0.10.8", + "sp-ark-bls12-381", + "sp-ark-ed-on-bls12-381-bandersnatch", "zeroize", ] @@ -780,9 +860,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -808,14 +888,14 @@ dependencies = [ "cumulus-relay-chain-inprocess-interface", "cumulus-relay-chain-interface", "cumulus-relay-chain-minimal-node", - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-benchmarking-cli", "frame-system-rpc-runtime-api", "frame-try-runtime", "futures", "hex-literal 0.4.1", "hydra-dx-build-script-utils", - "jsonrpsee", + "jsonrpsee 0.16.3", "log", "pallet-transaction-payment-rpc", "pallet-transaction-payment-rpc-runtime-api", @@ -848,28 +928,28 @@ dependencies = [ "sc-transaction-pool-api", "serde", "serde_json", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-authority-discovery", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-aura", - "sp-core", - "sp-inherents", - "sp-io", - "sp-keystore", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-offchain", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-state-machine", - "sp-storage", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", "sp-transaction-pool", - "sp-trie", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-frame-rpc-system", "substrate-prometheus-endpoint", "substrate-state-trie-migration-rpc", - "trie-db 0.28.0", + "trie-db", ] [[package]] @@ -885,10 +965,10 @@ dependencies = [ "cumulus-primitives-parachain-inherent", "cumulus-primitives-timestamp", "cumulus-primitives-utility", - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-executive", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", @@ -905,7 +985,7 @@ dependencies = [ "orml-xcm", "orml-xcm-support", "orml-xtokens", - "pallet-asset-registry", + "pallet-asset-registry 2.3.3", "pallet-aura", "pallet-authorship", "pallet-balances", @@ -913,7 +993,7 @@ dependencies = [ "pallet-collator-selection", "pallet-collective", "pallet-currencies", - "pallet-democracy 4.0.0-dev", + "pallet-democracy 28.0.0", "pallet-duster", "pallet-elections-phragmen", "pallet-ema-oracle", @@ -944,7 +1024,6 @@ dependencies = [ "pallet-xyk", "pallet-xyk-liquidity-mining", "pallet-xyk-liquidity-mining-benchmarking", - "parachain-info", "parity-scale-codec", "polkadot-parachain-primitives", "primitive-types", @@ -952,21 +1031,22 @@ dependencies = [ "scale-info", "serde", "smallvec", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-block-builder", "sp-consensus-aura", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-inherents", - "sp-io", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-offchain", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-staking", - "sp-std", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", - "sp-trie", - "sp-version", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -984,10 +1064,10 @@ dependencies = [ [[package]] name = "binary-merkle-tree" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "hash-db 0.16.0", + "hash-db", "log", ] @@ -1012,13 +1092,13 @@ dependencies = [ "lazy_static", "lazycell", "peeking_take_while", - "prettyplease 0.2.15", + "prettyplease 0.2.17", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -1028,8 +1108,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" dependencies = [ "bitcoin_hashes", + "rand", + "rand_core 0.6.4", + "serde", + "unicode-normalization", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", ] +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitcoin_hashes" version = "0.11.0" @@ -1044,9 +1143,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bitvec" @@ -1056,10 +1155,23 @@ checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", "radium", + "serde", "tap", "wyz", ] +[[package]] +name = "blake2" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" +dependencies = [ + "byte-tools", + "crypto-mac 0.7.0", + "digest 0.8.1", + "opaque-debug 0.2.3", +] + [[package]] name = "blake2" version = "0.10.6" @@ -1103,9 +1215,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" +checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" dependencies = [ "arrayref", "arrayvec 0.7.4", @@ -1114,18 +1226,6 @@ dependencies = [ "constant_time_eq 0.3.0", ] -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - [[package]] name = "block-buffer" version = "0.9.0" @@ -1144,36 +1244,27 @@ dependencies = [ "generic-array 0.14.7", ] -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - [[package]] name = "blocking" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ - "async-channel 2.1.1", - "async-lock 3.2.0", + "async-channel 2.2.0", + "async-lock 3.3.0", "async-task", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", - "futures-lite 2.1.0", + "futures-lite 2.3.0", "piper", "tracing", ] [[package]] name = "bounded-collections" -version = "0.1.9" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca548b6163b872067dc5eb82fd130c56881435e30367d2073594a3d9744120dd" +checksum = "d32385ecb91a31bddaf908e8dcf4a15aef1bcd3913cc03ebfad02ff6d568abc1" dependencies = [ "log", "parity-scale-codec", @@ -1190,6 +1281,17 @@ dependencies = [ "thiserror", ] +[[package]] +name = "bp-xcm-bridge-hub-router" +version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", +] + [[package]] name = "bs58" version = "0.4.0" @@ -1198,18 +1300,18 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bs58" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ "tinyvec", ] [[package]] name = "bstr" -version = "1.8.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" dependencies = [ "memchr", "serde", @@ -1226,9 +1328,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byte-slice-cast" @@ -1244,9 +1346,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" [[package]] name = "byteorder" @@ -1256,9 +1358,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "bzip2-sys" @@ -1271,6 +1373,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "c2-chacha" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27dae93fe7b1e0424dc57179ac396908c26b035a87234809f5c4dfd1b47dc80" +dependencies = [ + "cipher 0.2.5", + "ppv-lite86", +] + [[package]] name = "camino" version = "1.1.6" @@ -1286,7 +1398,7 @@ version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e11c675378efb449ed3ce8de78d75d0d80542fc98487c26aba28eb3b82feac72" dependencies = [ - "semver 1.0.20", + "semver 1.0.22", "serde", "toml 0.7.8", "url", @@ -1294,9 +1406,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" dependencies = [ "serde", ] @@ -1309,7 +1421,7 @@ checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" dependencies = [ "camino", "cargo-platform", - "semver 1.0.20", + "semver 1.0.22", "serde", "serde_json", "thiserror", @@ -1317,9 +1429,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" dependencies = [ "jobserver", "libc", @@ -1336,9 +1448,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.15.5" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" dependencies = [ "smallvec", ] @@ -1355,6 +1467,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddf3c081b5fba1e5615640aae998e0fbd10c24cbd897ee39ed754a77601a4862" +dependencies = [ + "byteorder", + "keystream", +] + [[package]] name = "chacha20" version = "0.9.1" @@ -1362,7 +1484,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if", - "cipher", + "cipher 0.4.4", "cpufeatures", ] @@ -1374,23 +1496,23 @@ checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" dependencies = [ "aead", "chacha20", - "cipher", + "cipher 0.4.4", "poly1305", "zeroize", ] [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.4", ] [[package]] @@ -1401,11 +1523,20 @@ checksum = "b9b68e3193982cd54187d71afdb2a271ad4cf8af157858e9cb911b91321de143" dependencies = [ "core2", "multibase", - "multihash", + "multihash 0.17.0", "serde", "unsigned-varint", ] +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array 0.14.7", +] + [[package]] name = "cipher" version = "0.4.4" @@ -1428,9 +1559,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" dependencies = [ "glob", "libc", @@ -1439,9 +1570,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.11" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ "clap_builder", "clap_derive", @@ -1449,43 +1580,43 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", + "terminal_size", ] [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "coarsetime" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71367d3385c716342014ad17e3d19f7788ae514885a1f4c24f500260fb365e1a" +checksum = "13b3839cf01bb7960114be3ccf2340f541b6d0c81f8690b007b2b39f750f7e5d" dependencies = [ "libc", - "once_cell", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasix", "wasm-bindgen", ] @@ -1507,19 +1638,19 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "comfy-table" -version = "7.1.0" +version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c64043d6c7b7a4c58e39e7efccfdea7b93d885a795d0c054a69dbbf4dd52686" +checksum = "b34115915337defe99b2aff5c2ce6771e5fbc4079f4b506301f5cf394c8452f7" dependencies = [ - "strum 0.25.0", - "strum_macros 0.25.3", + "strum 0.26.2", + "strum_macros 0.26.2", "unicode-width", ] [[package]] name = "common" version = "0.1.0" -source = "git+https://github.com/w3f/ring-proof?rev=0e948f3#0e948f3c28cbacecdd3020403c4841c0eb339213" +source = "git+https://github.com/w3f/ring-proof#b273d33f9981e2bb3375ab45faeb537f7ee35224" dependencies = [ "ark-ec", "ark-ff", @@ -1527,7 +1658,9 @@ dependencies = [ "ark-serialize", "ark-std", "fflonk", - "merlin 3.0.0", + "getrandom_or_panic", + "merlin", + "rand_chacha 0.3.1", ] [[package]] @@ -1547,28 +1680,28 @@ dependencies = [ [[package]] name = "console" -version = "0.15.7" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" dependencies = [ "encode_unicode", "lazy_static", "libc", "unicode-width", - "windows-sys 0.45.0", + "windows-sys 0.52.0", ] [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "const-random" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a" +checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" dependencies = [ "const-random-macro", ] @@ -1579,7 +1712,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.14", "once_cell", "tiny-keccak", ] @@ -1596,6 +1729,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +[[package]] +name = "constcat" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" + [[package]] name = "convert_case" version = "0.4.0" @@ -1648,9 +1787,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -1755,55 +1894,46 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset 0.9.0", - "scopeguard", ] [[package]] name = "crossbeam-queue" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crunchy" @@ -1819,7 +1949,7 @@ checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array 0.14.7", "rand_core 0.6.4", - "subtle", + "subtle 2.5.0", "zeroize", ] @@ -1834,6 +1964,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +dependencies = [ + "generic-array 0.12.4", + "subtle 1.0.0", +] + [[package]] name = "crypto-mac" version = "0.8.0" @@ -1841,17 +1981,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ "generic-array 0.14.7", - "subtle", + "subtle 2.5.0", ] [[package]] name = "crypto-mac" -version = "0.11.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +checksum = "25fab6889090c8133f3deb8f73ba3c65a7f456f66436fc012a1b1e272b1e103e" dependencies = [ "generic-array 0.14.7", - "subtle", + "subtle 2.5.0", ] [[package]] @@ -1860,13 +2000,13 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher", + "cipher 0.4.4", ] [[package]] name = "cumulus-client-cli" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "clap", "parity-scale-codec", @@ -1874,15 +2014,16 @@ dependencies = [ "sc-cli", "sc-client-api", "sc-service", - "sp-core", - "sp-runtime", + "sp-blockchain", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "url", ] [[package]] name = "cumulus-client-collator" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1895,25 +2036,25 @@ dependencies = [ "polkadot-overseer", "polkadot-primitives", "sc-client-api", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus", - "sp-core", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tracing", ] [[package]] name = "cumulus-client-consensus-aura" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "cumulus-client-collator", "cumulus-client-consensus-common", "cumulus-client-consensus-proposer", + "cumulus-client-parachain-inherent", "cumulus-primitives-aura", "cumulus-primitives-core", - "cumulus-primitives-parachain-inherent", "cumulus-relay-chain-interface", "futures", "parity-scale-codec", @@ -1928,17 +2069,17 @@ dependencies = [ "sc-consensus-slots", "sc-telemetry", "schnellru", - "sp-api", - "sp-application-crypto", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-aura", - "sp-core", - "sp-inherents", - "sp-keystore", - "sp-runtime", - "sp-state-machine", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", "substrate-prometheus-endpoint", "tracing", @@ -1946,8 +2087,8 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1965,33 +2106,33 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-consensus-slots", - "sp-core", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", - "sp-trie", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "tracing", ] [[package]] name = "cumulus-client-consensus-proposer" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "anyhow", "async-trait", "cumulus-primitives-parachain-inherent", "sp-consensus", - "sp-inherents", - "sp-runtime", - "sp-state-machine", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "cumulus-client-network" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -2005,16 +2146,40 @@ dependencies = [ "sc-client-api", "sp-blockchain", "sp-consensus", - "sp-core", - "sp-runtime", - "sp-state-machine", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tracing", ] [[package]] -name = "cumulus-client-pov-recovery" +name = "cumulus-client-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "async-trait", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-relay-chain-interface", + "cumulus-test-relay-sproof-builder", + "parity-scale-codec", + "sc-client-api", + "scale-info", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "tracing", +] + +[[package]] +name = "cumulus-client-pov-recovery" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2026,19 +2191,19 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-overseer", "polkadot-primitives", - "rand 0.8.5", + "rand", "sc-client-api", "sc-consensus", "sp-consensus", "sp-maybe-compressed-blob", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tracing", ] [[package]] name = "cumulus-client-service" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -2046,6 +2211,7 @@ dependencies = [ "cumulus-client-network", "cumulus-client-pov-recovery", "cumulus-primitives-core", + "cumulus-primitives-proof-size-hostfunction", "cumulus-relay-chain-inprocess-interface", "cumulus-relay-chain-interface", "cumulus-relay-chain-minimal-node", @@ -2062,208 +2228,220 @@ dependencies = [ "sc-telemetry", "sc-transaction-pool", "sc-utils", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", "sp-consensus", - "sp-core", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", ] [[package]] name = "cumulus-pallet-aura-ext" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-pallet-parachain-system", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "pallet-aura", "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-application-crypto", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus-aura", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "cumulus-pallet-dmp-queue" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-primitives-core", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", ] [[package]] name = "cumulus-pallet-parachain-system" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", + "cumulus-primitives-proof-size-hostfunction", "environmental", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "log", + "pallet-message-queue", "parity-scale-codec", "polkadot-parachain-primitives", + "polkadot-runtime-parachains", "scale-info", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-trie", - "sp-version", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", - "trie-db 0.27.1", + "trie-db", ] [[package]] name = "cumulus-pallet-parachain-system-proc-macro" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "cumulus-pallet-xcm" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-primitives-core", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", ] [[package]] name = "cumulus-pallet-xcmp-queue" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ + "bounded-collections", + "bp-xcm-bridge-hub-router", "cumulus-primitives-core", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", + "pallet-message-queue", "parity-scale-codec", "polkadot-runtime-common", - "rand_chacha 0.3.1", + "polkadot-runtime-parachains", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-executor", ] [[package]] name = "cumulus-primitives-aura" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", "polkadot-primitives", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus-aura", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "cumulus-primitives-core" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "scale-info", - "sp-api", - "sp-runtime", - "sp-std", - "sp-trie", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", ] [[package]] name = "cumulus-primitives-parachain-inherent" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "cumulus-primitives-core", - "cumulus-relay-chain-interface", - "cumulus-test-relay-sproof-builder", "parity-scale-codec", - "sc-client-api", "scale-info", - "sp-api", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-storage", - "sp-trie", - "tracing", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", +] + +[[package]] +name = "cumulus-primitives-proof-size-hostfunction" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "cumulus-primitives-timestamp" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-primitives-core", "futures", "parity-scale-codec", - "sp-inherents", - "sp-std", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", ] [[package]] name = "cumulus-primitives-utility" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-primitives-core", - "frame-support", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", + "pallet-asset-conversion", + "pallet-xcm-benchmarks", "parity-scale-codec", "polkadot-runtime-common", - "sp-io", - "sp-runtime", - "sp-std", + "polkadot-runtime-parachains", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -2271,8 +2449,8 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2286,70 +2464,76 @@ dependencies = [ "sc-sysinfo", "sc-telemetry", "sc-tracing", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus", - "sp-core", - "sp-runtime", - "sp-state-machine", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "cumulus-relay-chain-interface" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "cumulus-primitives-core", "futures", - "jsonrpsee-core", + "jsonrpsee-core 0.20.3", "parity-scale-codec", "polkadot-overseer", "sc-client-api", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", - "sp-state-machine", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "cumulus-relay-chain-minimal-node" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "array-bytes", + "array-bytes 6.2.2", "async-trait", "cumulus-primitives-core", "cumulus-relay-chain-interface", "cumulus-relay-chain-rpc-interface", "futures", + "parking_lot 0.12.1", "polkadot-availability-recovery", "polkadot-collator-protocol", "polkadot-core-primitives", "polkadot-network-bridge", "polkadot-node-collation-generation", + "polkadot-node-core-chain-api", + "polkadot-node-core-prospective-parachains", "polkadot-node-core-runtime-api", "polkadot-node-network-protocol", "polkadot-node-subsystem-util", "polkadot-overseer", "polkadot-primitives", "sc-authority-discovery", + "sc-client-api", "sc-network", "sc-network-common", "sc-service", "sc-tracing", "sc-utils", - "schnellru", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-blockchain", "sp-consensus", "sp-consensus-babe", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "substrate-prometheus-endpoint", + "tokio", "tracing", ] [[package]] name = "cumulus-relay-chain-rpc-interface" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2357,11 +2541,11 @@ dependencies = [ "either", "futures", "futures-timer", - "jsonrpsee", + "jsonrpsee 0.20.3", "parity-scale-codec", "pin-project", "polkadot-overseer", - "rand 0.8.5", + "rand", "sc-client-api", "sc-rpc-api", "sc-service", @@ -2370,13 +2554,14 @@ dependencies = [ "serde_json", "smoldot", "smoldot-light", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-authority-discovery", "sp-consensus-babe", - "sp-core", - "sp-runtime", - "sp-state-machine", - "sp-storage", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tokio", "tokio-util", @@ -2386,29 +2571,16 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", "polkadot-primitives", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-trie", -] - -[[package]] -name = "curve25519-dalek" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" -dependencies = [ - "byteorder", - "digest 0.8.1", - "rand_core 0.5.1", - "subtle", - "zeroize", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] @@ -2420,24 +2592,24 @@ dependencies = [ "byteorder", "digest 0.9.0", "rand_core 0.5.1", - "subtle", + "subtle 2.5.0", "zeroize", ] [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest 0.10.7", "fiat-crypto", - "platforms 3.2.0", + "platforms 3.4.0", "rustc_version", - "subtle", + "subtle 2.5.0", "zeroize", ] @@ -2449,7 +2621,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -2467,9 +2639,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.110" +version = "1.0.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7129e341034ecb940c9072817cd9007974ea696844fc4dd582dc1653a7fbe2e8" +checksum = "21db378d04296a84d8b7d047c36bb3954f0b46529db725d7e62fb02f9ba53ccc" dependencies = [ "cc", "cxxbridge-flags", @@ -2479,9 +2651,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.110" +version = "1.0.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a24f3f5f8eed71936f21e570436f024f5c2e25628f7496aa7ccd03b90109d5" +checksum = "3e5262a7fa3f0bae2a55b767c223ba98032d7c328f5c13fa5cdc980b77fc0658" dependencies = [ "cc", "codespan-reporting", @@ -2489,24 +2661,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "cxxbridge-flags" -version = "1.0.110" +version = "1.0.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06fdd177fc61050d63f67f5bd6351fac6ab5526694ea8e359cd9cd3b75857f44" +checksum = "be8dcadd2e2fb4a501e1d9e93d6e88e6ea494306d8272069c92d5a9edf8855c0" [[package]] name = "cxxbridge-macro" -version = "1.0.110" +version = "1.0.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "587663dd5fb3d10932c8aecfe7c844db1bcf0aee93eeab08fac13dc1212c2e7f" +checksum = "ad08a837629ad949b73d032c637653d069e909cffe4ee7870b02301939ce39cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -2537,9 +2709,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "zeroize", @@ -2561,9 +2733,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", ] @@ -2590,6 +2762,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive-syn-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.58", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -2642,14 +2825,14 @@ dependencies = [ "block-buffer 0.10.4", "const-oid", "crypto-common", - "subtle", + "subtle 2.5.0", ] [[package]] name = "directories" -version = "4.0.1" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210" +checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" dependencies = [ "dirs-sys", ] @@ -2666,13 +2849,14 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.3.7" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" dependencies = [ "libc", + "option-ext", "redox_users", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -2694,50 +2878,49 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "dleq_vrf" version = "0.0.2" -source = "git+https://github.com/w3f/ring-vrf?rev=3119f51#3119f51b54b69308abfb0671f6176cb125ae1bf1" +source = "git+https://github.com/w3f/ring-vrf?rev=e9782f9#e9782f938629c90f3adb3fff2358bc8d1386af3e" dependencies = [ "ark-ec", "ark-ff", - "ark-scale 0.0.10", + "ark-scale", "ark-secret-scalar", "ark-serialize", "ark-std", "ark-transcript", "arrayvec 0.7.4", - "rand_core 0.6.4", "zeroize", ] [[package]] name = "docify" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc4fd38aaa9fb98ac70794c82a00360d1e165a87fbf96a8a91f9dfc602aaee2" +checksum = "43a2f138ad521dc4a2ced1a4576148a6a610b4c5923933b062a263130a6802ce" dependencies = [ "docify_macros", ] [[package]] name = "docify_macros" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63fa215f3a0d40fb2a221b3aa90d8e1fbb8379785a990cb60d62ac71ebdc6460" +checksum = "1a081e51fb188742f5a7a1164ad752121abcb22874b21e2c3b0dd040c515fdad" dependencies = [ "common-path", - "derive-syn-parse", + "derive-syn-parse 0.2.0", "once_cell", "proc-macro2", "quote", "regex", - "syn 2.0.39", + "syn 2.0.58", "termcolor", - "toml 0.8.2", + "toml 0.8.12", "walkdir", ] @@ -2749,9 +2932,9 @@ checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" [[package]] name = "downcast-rs" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "dtoa" @@ -2782,9 +2965,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "ecdsa" @@ -2812,16 +2995,16 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "ed25519", "rand_core 0.6.4", "serde", "sha2 0.10.8", - "subtle", + "subtle 2.5.0", "zeroize", ] @@ -2845,7 +3028,7 @@ version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d9ce6874da5d4415896cd45ffbc4d1cfc0c4f9c079427bd870742c30f2f65a9" dependencies = [ - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "ed25519", "hashbrown 0.14.3", "hex", @@ -2856,9 +3039,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "elliptic-curve" @@ -2875,7 +3058,7 @@ dependencies = [ "pkcs8", "rand_core 0.6.4", "sec1", - "subtle", + "subtle 2.5.0", "zeroize", ] @@ -2891,7 +3074,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 1.0.109", @@ -2899,53 +3082,40 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5998b4f30320c9d93aed72f63af821bfdac50465b75428fce77b48ec482c3939" +checksum = "3278c9d5fb675e0a51dabcf4c0d355f692b064171535ba72361be1528a9d8e8d" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" +checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "enumn" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" +checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "env_logger" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "env_logger" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -2993,20 +3163,20 @@ dependencies = [ [[package]] name = "ethereum" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a89fb87a9e103f71b903b80b670200b54cc67a07578f070681f1fffb7396fb7" +checksum = "2e04d24d20b8ff2235cffbf242d5092de3aa45f77c5270ddbfadd2778ca13fea" dependencies = [ "bytes", "ethereum-types", - "hash-db 0.15.2", + "hash-db", "hash256-std-hasher", "parity-scale-codec", "rlp", "scale-info", "serde", "sha3", - "triehash", + "trie-root", ] [[package]] @@ -3039,18 +3209,29 @@ checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" dependencies = [ "concurrent-queue", "parking", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] name = "event-listener" -version = "4.0.0" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite 0.2.14", +] + +[[package]] +name = "event-listener" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770d968249b5d99410d61f5bf89057f3199a077a04d087092f58e7d10692baae" +checksum = "6d9944b8ca13534cdfb2800775f8dd4902ff3fc75a50101466decadfdf322a24" dependencies = [ "concurrent-queue", "parking", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] @@ -3059,14 +3240,24 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" dependencies = [ - "event-listener 4.0.0", - "pin-project-lite 0.2.13", + "event-listener 4.0.3", + "pin-project-lite 0.2.14", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332f51cb23d20b0de8458b86580878211da09bcd4503cb579c225b3d124cabb3" +dependencies = [ + "event-listener 5.3.0", + "pin-project-lite 0.2.14", ] [[package]] name = "evm" -version = "0.39.1" -source = "git+https://github.com/moonbeam-foundation/evm?rev=a33ac87ad7462b7e7029d12c385492b2a8311d1c#a33ac87ad7462b7e7029d12c385492b2a8311d1c" +version = "0.41.1" +source = "git+https://github.com/moonbeam-foundation/evm?branch=moonbeam-polkadot-v1.7.2#d8991ec727ad0fb64fe9957a3cd307387a6701e4" dependencies = [ "auto_impl", "environmental", @@ -3085,8 +3276,8 @@ dependencies = [ [[package]] name = "evm-core" -version = "0.39.0" -source = "git+https://github.com/moonbeam-foundation/evm?rev=a33ac87ad7462b7e7029d12c385492b2a8311d1c#a33ac87ad7462b7e7029d12c385492b2a8311d1c" +version = "0.41.0" +source = "git+https://github.com/moonbeam-foundation/evm?branch=moonbeam-polkadot-v1.7.2#d8991ec727ad0fb64fe9957a3cd307387a6701e4" dependencies = [ "parity-scale-codec", "primitive-types", @@ -3096,8 +3287,8 @@ dependencies = [ [[package]] name = "evm-gasometer" -version = "0.39.0" -source = "git+https://github.com/moonbeam-foundation/evm?rev=a33ac87ad7462b7e7029d12c385492b2a8311d1c#a33ac87ad7462b7e7029d12c385492b2a8311d1c" +version = "0.41.0" +source = "git+https://github.com/moonbeam-foundation/evm?branch=moonbeam-polkadot-v1.7.2#d8991ec727ad0fb64fe9957a3cd307387a6701e4" dependencies = [ "environmental", "evm-core", @@ -3107,8 +3298,8 @@ dependencies = [ [[package]] name = "evm-runtime" -version = "0.39.0" -source = "git+https://github.com/moonbeam-foundation/evm?rev=a33ac87ad7462b7e7029d12c385492b2a8311d1c#a33ac87ad7462b7e7029d12c385492b2a8311d1c" +version = "0.41.0" +source = "git+https://github.com/moonbeam-foundation/evm?branch=moonbeam-polkadot-v1.7.2#d8991ec727ad0fb64fe9957a3cd307387a6701e4" dependencies = [ "auto_impl", "environmental", @@ -3140,35 +3331,18 @@ dependencies = [ [[package]] name = "expander" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3774182a5df13c3d1690311ad32fbe913feef26baba609fa2dd5f72042bd2ab6" -dependencies = [ - "blake2", - "fs-err", - "proc-macro2", - "quote", -] - -[[package]] -name = "expander" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f86a749cf851891866c10515ef6c299b5c69661465e9c3bbe7e07a2b77fb0f7" +checksum = "00e83c02035136f1592a47964ea60c05a50e4ed8b5892cfac197063850898d4d" dependencies = [ - "blake2", + "blake2 0.10.6", "fs-err", + "prettier-please", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "fallible-iterator" version = "0.2.0" @@ -3186,9 +3360,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fatality" @@ -3217,11 +3391,12 @@ dependencies = [ [[package]] name = "fdlimit" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4c9e43643f5a3be4ca5b67d26b98031ff9db6806c3440ae32e02e3ceac3f1b" +checksum = "e182f7dbc2ef73d9ef67351c5fbbea084729c48362d3ce9dd44c28e32e277fe5" dependencies = [ "libc", + "thiserror", ] [[package]] @@ -3231,7 +3406,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ "rand_core 0.6.4", - "subtle", + "subtle 2.5.0", ] [[package]] @@ -3244,14 +3419,14 @@ dependencies = [ "ark-poly", "ark-serialize", "ark-std", - "merlin 3.0.0", + "merlin", ] [[package]] name = "fiat-crypto" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" +checksum = "c007b1ae3abe1cb6f85a16305acd418b7ca6343b953633fee2b76d8f108b830f" [[package]] name = "file-per-thread-logger" @@ -3259,7 +3434,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" dependencies = [ - "env_logger 0.10.1", + "env_logger", "log", ] @@ -3311,7 +3486,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder", - "rand 0.8.5", + "rand", "rustc-hex", "static_assertions", ] @@ -3350,8 +3525,8 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" -version = "3.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "12.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", ] @@ -3368,7 +3543,7 @@ dependencies = [ [[package]] name = "fp-account" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.1.0#bf5885a982041cc744ecbb62a2afc13d56d464dc" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#5d6bf0c78d1d325d4eea6f9593e9a11da18a1ea8" dependencies = [ "hex", "impl-serde", @@ -3377,26 +3552,27 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-runtime-interface 17.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.1.0)", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", ] [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.1.0#bf5885a982041cc744ecbb62a2afc13d56d464dc" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#5d6bf0c78d1d325d4eea6f9593e9a11da18a1ea8" dependencies = [ "evm", - "frame-support", + "frame-support 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "num_enum", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", ] [[package]] @@ -3407,42 +3583,67 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" +dependencies = [ + "frame-support 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "frame-support-procedural 23.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "linregress", + "log", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "sp-api 26.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "static_assertions", +] + +[[package]] +name = "frame-benchmarking" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-support-procedural", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support-procedural 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "linregress", "log", "parity-scale-codec", "paste", "scale-info", "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-io", - "sp-runtime", - "sp-runtime-interface 17.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-std", - "sp-storage", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "static_assertions", ] [[package]] name = "frame-benchmarking-cli" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "32.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "Inflector", - "array-bytes", + "array-bytes 6.2.2", "chrono", "clap", "comfy-table", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "gethostname", "handlebars", "itertools 0.10.5", @@ -3450,7 +3651,7 @@ dependencies = [ "linked-hash-map", "log", "parity-scale-codec", - "rand 0.8.5", + "rand", "rand_pcg", "sc-block-builder", "sc-cli", @@ -3461,67 +3662,67 @@ dependencies = [ "sc-sysinfo", "serde", "serde_json", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-database", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-inherents", - "sp-io", - "sp-keystore", - "sp-runtime", - "sp-state-machine", - "sp-storage", - "sp-trie", - "sp-wasm-interface 14.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "thousands", ] [[package]] name = "frame-election-provider-solution-type" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "frame-election-provider-support" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "frame-election-provider-solution-type", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", - "sp-arithmetic", - "sp-core", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-npos-elections", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "frame-executive" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-try-runtime", "log", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] @@ -3538,20 +3739,20 @@ dependencies = [ [[package]] name = "frame-remote-externalities" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.35.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "async-recursion", "futures", "indicatif", - "jsonrpsee", + "jsonrpsee 0.20.3", "log", "parity-scale-codec", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-state-machine", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "spinners", "substrate-rpc-client", "tokio", @@ -3560,15 +3761,57 @@ dependencies = [ [[package]] name = "frame-support" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" +dependencies = [ + "aquamarine", + "array-bytes 6.2.2", + "bitflags 1.3.2", + "docify", + "environmental", + "frame-metadata", + "frame-support-procedural 23.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "impl-trait-for-tuples", + "k256", + "log", + "macro_magic", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "serde_json", + "smallvec", + "sp-api 26.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-crypto-hashing-proc-macro 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-debug-derive 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-genesis-builder 0.7.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-metadata-ir 0.6.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "static_assertions", + "tt-call", +] + +[[package]] +name = "frame-support" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "aquamarine", + "array-bytes 6.2.2", "bitflags 1.3.2", "docify", "environmental", "frame-metadata", - "frame-support-procedural", + "frame-support-procedural 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "k256", "log", @@ -3579,118 +3822,181 @@ dependencies = [ "serde", "serde_json", "smallvec", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-core-hashing-proc-macro", - "sp-debug-derive", - "sp-genesis-builder", - "sp-inherents", - "sp-io", - "sp-metadata-ir", - "sp-runtime", - "sp-staking", - "sp-state-machine", - "sp-std", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-weights", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing-proc-macro 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-genesis-builder 0.7.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-metadata-ir 0.6.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "static_assertions", "tt-call", ] [[package]] name = "frame-support-procedural" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "23.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "Inflector", "cfg-expr", - "derive-syn-parse", - "expander 2.0.0", - "frame-support-procedural-tools", + "derive-syn-parse 0.1.5", + "expander 2.1.0", + "frame-support-procedural-tools 10.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", "itertools 0.10.5", "macro_magic", "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.39", + "sp-crypto-hashing 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "syn 2.0.58", ] [[package]] -name = "frame-support-procedural-tools" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +name = "frame-support-procedural" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support-procedural-tools-derive", - "proc-macro-crate 1.3.1", + "Inflector", + "cfg-expr", + "derive-syn-parse 0.1.5", + "expander 2.1.0", + "frame-support-procedural-tools 10.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "itertools 0.10.5", + "macro_magic", + "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.39", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "syn 2.0.58", ] [[package]] -name = "frame-support-procedural-tools-derive" -version = "3.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +name = "frame-support-procedural-tools" +version = "10.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ + "frame-support-procedural-tools-derive 11.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", +] + +[[package]] +name = "frame-support-procedural-tools" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "frame-support-procedural-tools-derive 11.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.58", +] + +[[package]] +name = "frame-support-procedural-tools-derive" +version = "11.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.58", +] + +[[package]] +name = "frame-support-procedural-tools-derive" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.58", +] + +[[package]] +name = "frame-system" +version = "28.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" +dependencies = [ + "cfg-if", + "docify", + "frame-support 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", ] [[package]] name = "frame-system" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cfg-if", - "frame-support", + "docify", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-version", - "sp-weights", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "frame-system-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "frame-system-rpc-runtime-api" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "frame-try-runtime" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", - "sp-api", - "sp-runtime", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] @@ -3714,11 +4020,11 @@ dependencies = [ [[package]] name = "fs4" -version = "0.6.6" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" +checksum = "29f9df8a11882c4e3335eb2d18a0137c505d9ca927470b0cac9c6f0ae07d28f7" dependencies = [ - "rustix 0.38.27", + "rustix 0.38.32", "windows-sys 0.48.0", ] @@ -3730,9 +4036,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -3745,9 +4051,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -3755,15 +4061,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -3773,9 +4079,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" @@ -3788,32 +4094,32 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "waker-fn", ] [[package]] name = "futures-lite" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-core", "futures-io", "parking", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -3829,27 +4135,27 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-timer" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -3858,7 +4164,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "pin-utils", "slab", ] @@ -3915,22 +4221,32 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "libc", "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "getrandom_or_panic" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea1015b5a70616b688dc230cfe50c8af89d972cb132d5a622814d29773b10b9" +dependencies = [ + "rand", + "rand_core 0.6.4", +] + [[package]] name = "ghash" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" dependencies = [ - "opaque-debug 0.3.0", + "opaque-debug 0.3.1", "polyval", ] @@ -3966,8 +4282,8 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", ] [[package]] @@ -3978,14 +4294,14 @@ checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", "rand_core 0.6.4", - "subtle", + "subtle 2.5.0", ] [[package]] name = "h2" -version = "0.3.22" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", @@ -3993,7 +4309,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.1.0", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -4002,9 +4318,9 @@ dependencies = [ [[package]] name = "half" -version = "1.8.2" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" +checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403" [[package]] name = "handlebars" @@ -4020,12 +4336,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "hash-db" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" - [[package]] name = "hash-db" version = "0.16.0" @@ -4047,7 +4357,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", + "ahash 0.7.8", ] [[package]] @@ -4056,7 +4366,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", ] [[package]] @@ -4065,11 +4375,20 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "allocator-api2", "serde", ] +[[package]] +name = "hashlink" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +dependencies = [ + "hashbrown 0.14.3", +] + [[package]] name = "heck" version = "0.4.1" @@ -4077,19 +4396,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] -name = "hermit-abi" -version = "0.1.19" +name = "heck" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -4111,9 +4427,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hkdf" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ "hmac 0.12.1", ] @@ -4134,7 +4450,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ - "crypto-mac 0.11.1", + "crypto-mac 0.11.0", "digest 0.9.0", ] @@ -4160,11 +4476,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -4180,9 +4496,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -4191,13 +4507,13 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] @@ -4227,7 +4543,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hydra-dx-build-script-utils" version = "1.0.3" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ "cargo-lock", "platforms 1.1.0", @@ -4235,8 +4551,8 @@ dependencies = [ [[package]] name = "hydra-dx-math" -version = "7.6.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "8.0.1" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ "fixed", "num-traits", @@ -4244,19 +4560,19 @@ dependencies = [ "primitive-types", "scale-info", "serde", - "sp-arithmetic", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "hydradx-adapters" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "1.3.0" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "hydradx-traits", "log", @@ -4265,17 +4581,21 @@ dependencies = [ "orml-utilities", "orml-vesting", "orml-xcm-support", + "pallet-asset-registry 3.2.1", "pallet-balances", + "pallet-bonds", "pallet-circuit-breaker", "pallet-currencies", "pallet-dynamic-fees", "pallet-ema-oracle", + "pallet-lbp", "pallet-liquidity-mining", "pallet-omnipool", "pallet-omnipool-liquidity-mining", + "pallet-referrals", "pallet-route-executor", "pallet-stableswap", - "pallet-staking 2.1.1", + "pallet-staking 3.0.0", "pallet-transaction-multi-payment", "pallet-uniques", "parity-scale-codec", @@ -4283,10 +4603,10 @@ dependencies = [ "primitive-types", "primitives 6.0.2", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -4294,23 +4614,23 @@ dependencies = [ [[package]] name = "hydradx-traits" -version = "2.8.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "3.2.0" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -4322,8 +4642,8 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project-lite 0.2.13", - "socket2 0.4.10", + "pin-project-lite 0.2.14", + "socket2 0.5.6", "tokio", "tower-service", "tracing", @@ -4344,21 +4664,20 @@ dependencies = [ "rustls-native-certs", "tokio", "tokio-rustls", - "webpki-roots 0.25.3", ] [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -4407,7 +4726,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6b0422c86d7ce0e97169cc42e04ae643caf278874a7a3c87b8150a220dc7e1e" dependencies = [ - "async-io 2.2.1", + "async-io 2.3.2", "core-foundation", "fnv", "futures", @@ -4490,9 +4809,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -4506,9 +4825,9 @@ checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "indicatif" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" +checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" dependencies = [ "console", "instant", @@ -4556,7 +4875,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi", "libc", "windows-sys 0.48.0", ] @@ -4573,7 +4892,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2 0.5.5", + "socket2 0.5.6", "widestring", "windows-sys 0.48.0", "winreg", @@ -4587,13 +4906,13 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ - "hermit-abi 0.3.3", - "rustix 0.38.27", - "windows-sys 0.48.0", + "hermit-abi", + "libc", + "windows-sys 0.52.0", ] [[package]] @@ -4623,26 +4942,35 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "f08474e32172238f2827bd160c67871cdb2801430f65c3979184dc362e3ca118" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -4653,25 +4981,38 @@ version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "367a292944c07385839818bb71c8d76611138e2dedb0677d035b8da21d29c78b" dependencies = [ - "jsonrpsee-core", + "jsonrpsee-core 0.16.3", + "jsonrpsee-proc-macros 0.16.3", + "jsonrpsee-server 0.16.3", + "jsonrpsee-types 0.16.3", + "tracing", +] + +[[package]] +name = "jsonrpsee" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "affdc52f7596ccb2d7645231fc6163bb314630c989b64998f3699a28b4d5d4dc" +dependencies = [ + "jsonrpsee-core 0.20.3", "jsonrpsee-http-client", - "jsonrpsee-proc-macros", - "jsonrpsee-server", - "jsonrpsee-types", + "jsonrpsee-proc-macros 0.20.3", + "jsonrpsee-server 0.20.3", + "jsonrpsee-types 0.20.3", "jsonrpsee-ws-client", + "tokio", "tracing", ] [[package]] name = "jsonrpsee-client-transport" -version = "0.16.3" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8b3815d9f5d5de348e5f162b316dc9cdf4548305ebb15b4eb9328e66cf27d7a" +checksum = "b5b005c793122d03217da09af68ba9383363caa950b90d3436106df8cabce935" dependencies = [ "futures-util", "http", - "jsonrpsee-core", - "jsonrpsee-types", + "jsonrpsee-core 0.20.3", "pin-project", "rustls-native-certs", "soketto", @@ -4680,7 +5021,7 @@ dependencies = [ "tokio-rustls", "tokio-util", "tracing", - "webpki-roots 0.25.3", + "url", ] [[package]] @@ -4691,17 +5032,40 @@ checksum = "2b5dde66c53d6dcdc8caea1874a45632ec0fcf5b437789f1e45766a1512ce803" dependencies = [ "anyhow", "arrayvec 0.7.4", - "async-lock 2.8.0", "async-trait", "beef", "futures-channel", - "futures-timer", "futures-util", "globset", "hyper", - "jsonrpsee-types", + "jsonrpsee-types 0.16.3", + "parking_lot 0.12.1", + "rand", + "rustc-hash", + "serde", + "serde_json", + "soketto", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da2327ba8df2fdbd5e897e2b5ed25ce7f299d345b9736b6828814c3dbd1fd47b" +dependencies = [ + "anyhow", + "async-lock 2.8.0", + "async-trait", + "beef", + "futures-timer", + "futures-util", + "hyper", + "jsonrpsee-types 0.20.3", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "rustc-hash", "serde", "serde_json", @@ -4713,21 +5077,22 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.16.3" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e5f9fabdd5d79344728521bb65e3106b49ec405a78b66fbff073b72b389fa43" +checksum = "5f80c17f62c7653ce767e3d7288b793dfec920f97067ceb189ebdd3570f2bc20" dependencies = [ "async-trait", "hyper", "hyper-rustls", - "jsonrpsee-core", - "jsonrpsee-types", - "rustc-hash", + "jsonrpsee-core 0.20.3", + "jsonrpsee-types 0.20.3", "serde", "serde_json", "thiserror", "tokio", + "tower", "tracing", + "url", ] [[package]] @@ -4736,7 +5101,20 @@ version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44e8ab85614a08792b9bff6c8feee23be78c98d0182d4c622c05256ab553892a" dependencies = [ - "heck", + "heck 0.4.1", + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "jsonrpsee-proc-macros" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29110019693a4fa2dbda04876499d098fa16d70eba06b1e6e2b3f1b251419515" +dependencies = [ + "heck 0.4.1", "proc-macro-crate 1.3.1", "proc-macro2", "quote", @@ -4753,11 +5131,34 @@ dependencies = [ "futures-util", "http", "hyper", - "jsonrpsee-core", - "jsonrpsee-types", + "jsonrpsee-core 0.16.3", + "jsonrpsee-types 0.16.3", + "serde", + "serde_json", + "soketto", + "tokio", + "tokio-stream", + "tokio-util", + "tower", + "tracing", +] + +[[package]] +name = "jsonrpsee-server" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82c39a00449c9ef3f50b84fc00fc4acba20ef8f559f07902244abf4c15c5ab9c" +dependencies = [ + "futures-util", + "http", + "hyper", + "jsonrpsee-core 0.20.3", + "jsonrpsee-types 0.20.3", + "route-recognizer", "serde", "serde_json", "soketto", + "thiserror", "tokio", "tokio-stream", "tokio-util", @@ -4779,23 +5180,38 @@ dependencies = [ "tracing", ] +[[package]] +name = "jsonrpsee-types" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be0be325642e850ed0bdff426674d2e66b2b7117c9be23a7caef68a2902b7d9" +dependencies = [ + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", + "tracing", +] + [[package]] name = "jsonrpsee-ws-client" -version = "0.16.3" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e1b3975ed5d73f456478681a417128597acd6a2487855fdb7b4a3d4d195bf5e" +checksum = "bca9cb3933ccae417eb6b08c3448eb1cb46e39834e5b503e395e5e5bd08546c0" dependencies = [ "http", "jsonrpsee-client-transport", - "jsonrpsee-core", - "jsonrpsee-types", + "jsonrpsee-core 0.20.3", + "jsonrpsee-types 0.20.3", + "url", ] [[package]] name = "k256" -version = "0.13.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ "cfg-if", "ecdsa", @@ -4806,26 +5222,18 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] [[package]] -name = "kusama-runtime-constants" +name = "keystream" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" -dependencies = [ - "frame-support", - "polkadot-primitives", - "polkadot-runtime-common", - "smallvec", - "sp-core", - "sp-runtime", - "sp-weights", -] +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33070833c9ee02266356de0c43f723152bd38bd96ddf52c82b3af10c9138b28" [[package]] name = "kvdb" @@ -4862,9 +5270,9 @@ dependencies = [ [[package]] name = "landlock" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520baa32708c4e957d2fc3a186bc5bd8d26637c33137f399ddfc202adb240068" +checksum = "9baa9eeb6e315942429397e617a190f4fdc696ef1ee0342939d641029cbb4ea7" dependencies = [ "enumflags2", "libc", @@ -4885,18 +5293,18 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libloading" -version = "0.7.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "winapi", + "windows-targets 0.52.4", ] [[package]] @@ -4914,7 +5322,7 @@ dependencies = [ "bytes", "futures", "futures-timer", - "getrandom 0.2.11", + "getrandom 0.2.14", "instant", "libp2p-allow-block-list", "libp2p-connection-limits", @@ -4976,13 +5384,13 @@ dependencies = [ "libp2p-identity", "log", "multiaddr", - "multihash", + "multihash 0.17.0", "multistream-select", "once_cell", "parking_lot 0.12.1", "pin-project", "quick-protobuf", - "rand 0.8.5", + "rand", "rw-stream-sink", "smallvec", "thiserror", @@ -5036,9 +5444,9 @@ dependencies = [ "ed25519-dalek", "log", "multiaddr", - "multihash", + "multihash 0.17.0", "quick-protobuf", - "rand 0.8.5", + "rand", "sha2 0.10.8", "thiserror", "zeroize", @@ -5063,7 +5471,7 @@ dependencies = [ "libp2p-swarm", "log", "quick-protobuf", - "rand 0.8.5", + "rand", "sha2 0.10.8", "smallvec", "thiserror", @@ -5085,7 +5493,7 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "log", - "rand 0.8.5", + "rand", "smallvec", "socket2 0.4.10", "tokio", @@ -5121,7 +5529,7 @@ dependencies = [ "log", "once_cell", "quick-protobuf", - "rand 0.8.5", + "rand", "sha2 0.10.8", "snow", "static_assertions", @@ -5143,7 +5551,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "rand 0.8.5", + "rand", "void", ] @@ -5163,7 +5571,7 @@ dependencies = [ "log", "parking_lot 0.12.1", "quinn-proto", - "rand 0.8.5", + "rand", "rustls 0.20.9", "thiserror", "tokio", @@ -5181,7 +5589,7 @@ dependencies = [ "libp2p-core", "libp2p-identity", "libp2p-swarm", - "rand 0.8.5", + "rand", "smallvec", ] @@ -5200,7 +5608,7 @@ dependencies = [ "libp2p-identity", "libp2p-swarm-derive", "log", - "rand 0.8.5", + "rand", "smallvec", "tokio", "void", @@ -5212,7 +5620,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fba456131824ab6acd4c7bf61e9c0f0a3014b5fc9868ccb8e10d344594cdc4f" dependencies = [ - "heck", + "heck 0.4.1", "quote", "syn 1.0.109", ] @@ -5282,7 +5690,7 @@ dependencies = [ "rw-stream-sink", "soketto", "url", - "webpki-roots 0.22.6", + "webpki-roots", ] [[package]] @@ -5300,13 +5708,12 @@ dependencies = [ [[package]] name = "libredox" -version = "0.0.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "libc", - "redox_syscall 0.4.1", ] [[package]] @@ -5337,7 +5744,7 @@ dependencies = [ "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", - "rand 0.8.5", + "rand", "serde", "sha2 0.9.9", "typenum", @@ -5351,7 +5758,7 @@ checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" dependencies = [ "crunchy", "digest 0.9.0", - "subtle", + "subtle 2.5.0", ] [[package]] @@ -5374,9 +5781,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9" dependencies = [ "cc", "pkg-config", @@ -5430,9 +5837,21 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + +[[package]] +name = "lioness" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "4ae926706ba42c425c9457121178330d75e273df2e82e28b758faf3de3a9acb9" +dependencies = [ + "arrayref", + "blake2 0.8.1", + "chacha", + "keystream", +] [[package]] name = "lock_api" @@ -5446,9 +5865,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lru" @@ -5505,50 +5924,50 @@ dependencies = [ [[package]] name = "macro_magic" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aee866bfee30d2d7e83835a4574aad5b45adba4cc807f2a3bbba974e5d4383c9" +checksum = "e03844fc635e92f3a0067e25fa4bf3e3dbf3f2927bf3aa01bb7bc8f1c428949d" dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "macro_magic_core" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e766a20fd9c72bab3e1e64ed63f36bd08410e75803813df210d1ce297d7ad00" +checksum = "468155613a44cfd825f1fb0ffa532b018253920d404e6fca1e8d43155198a46d" dependencies = [ "const-random", - "derive-syn-parse", + "derive-syn-parse 0.1.5", "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "macro_magic_core_macros" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d710e1214dffbab3b5dacb21475dde7d6ed84c69ff722b3a47a782668d44fbac" +checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "macro_magic_macros" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" +checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -5572,6 +5991,15 @@ dependencies = [ "regex-automata 0.1.10", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "matches" version = "0.1.10" @@ -5590,9 +6018,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memfd" @@ -5600,7 +6028,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.27", + "rustix 0.38.32", ] [[package]] @@ -5613,19 +6041,19 @@ dependencies = [ ] [[package]] -name = "memoffset" -version = "0.8.0" +name = "memmap2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" dependencies = [ - "autocfg", + "libc", ] [[package]] name = "memoffset" -version = "0.9.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ "autocfg", ] @@ -5636,19 +6064,7 @@ version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "808b50db46293432a45e63bc15ea51e0ab4c0a1647b8eb114e31a3e698dd6fbe" dependencies = [ - "hash-db 0.16.0", -] - -[[package]] -name = "merlin" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.5.1", - "zeroize", + "hash-db", ] [[package]] @@ -5670,7 +6086,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69672161530e8aeca1d1400fbf3f1a1747ff60ea604265a4e906c2442df20532" dependencies = [ "futures", - "rand 0.8.5", + "rand", "thrift", ] @@ -5682,18 +6098,18 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", @@ -5701,38 +6117,62 @@ dependencies = [ ] [[package]] -name = "mmr-gadget" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +name = "mixnet" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daa3eb39495d8e2e2947a1d862852c90cc6a4a8845f8b41c8829cb9fcc047f4a" +dependencies = [ + "arrayref", + "arrayvec 0.7.4", + "bitflags 1.3.2", + "blake2 0.10.6", + "c2-chacha", + "curve25519-dalek 4.1.2", + "either", + "hashlink", + "lioness", + "log", + "parking_lot 0.12.1", + "rand", + "rand_chacha 0.3.1", + "rand_distr", + "subtle 2.5.0", + "thiserror", + "zeroize", +] + +[[package]] +name = "mmr-gadget" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", "log", "parity-scale-codec", "sc-client-api", "sc-offchain", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", "sp-consensus", "sp-consensus-beefy", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-mmr-primitives", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "mmr-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "anyhow", - "jsonrpsee", + "jsonrpsee 0.20.3", "parity-scale-codec", "serde", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-mmr-primitives", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] @@ -5773,7 +6213,7 @@ dependencies = [ "data-encoding", "log", "multibase", - "multihash", + "multihash 0.17.0", "percent-encoding", "serde", "static_assertions", @@ -5803,12 +6243,55 @@ dependencies = [ "blake3", "core2", "digest 0.10.7", - "multihash-derive", + "multihash-derive 0.8.0", "sha2 0.10.8", "sha3", "unsigned-varint", ] +[[package]] +name = "multihash" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfd8a792c1694c6da4f68db0a9d707c72bd260994da179e6030a5dcee00bb815" +dependencies = [ + "core2", + "digest 0.10.7", + "multihash-derive 0.8.0", + "sha2 0.10.8", + "unsigned-varint", +] + +[[package]] +name = "multihash" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492" +dependencies = [ + "core2", + "unsigned-varint", +] + +[[package]] +name = "multihash-codetable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d815ecb3c8238d00647f8630ede7060a642c9f704761cd6082cb4028af6935" +dependencies = [ + "blake2b_simd", + "blake2s_simd", + "blake3", + "core2", + "digest 0.10.7", + "multihash-derive 0.9.0", + "ripemd", + "serde", + "sha1", + "sha2 0.10.8", + "sha3", + "strobe-rs", +] + [[package]] name = "multihash-derive" version = "0.8.0" @@ -5823,6 +6306,31 @@ dependencies = [ "synstructure", ] +[[package]] +name = "multihash-derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "890e72cb7396cb99ed98c1246a97b243cc16394470d94e0bc8b0c2c11d84290e" +dependencies = [ + "core2", + "multihash 0.19.1", + "multihash-derive-impl", +] + +[[package]] +name = "multihash-derive-impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38685e08adb338659871ecfc6ee47ba9b22dcc8abcf6975d379cc49145c3040" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure", +] + [[package]] name = "multimap" version = "0.8.3" @@ -5845,9 +6353,9 @@ dependencies = [ [[package]] name = "nalgebra" -version = "0.32.3" +version = "0.32.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307ed9b18cc2423f29e83f84fd23a8e73628727990181f18641a8b5dc2ab1caa" +checksum = "3ea4908d4f23254adda3daa60ffef0f1ac7b8c3e9a864cf3cc154b251908a2ef" dependencies = [ "approx", "matrixmultiply", @@ -5872,11 +6380,11 @@ dependencies = [ [[package]] name = "names" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d66043b25d4a6cccb23619d10c19c25304b355a7dccd4a8e11423dd2382146" +checksum = "7bddcd3bf5144b6392de80e04c347cd7fab2508f6df16a85fc496ecd5cec39bc" dependencies = [ - "rand 0.8.5", + "rand", ] [[package]] @@ -5940,9 +6448,9 @@ dependencies = [ [[package]] name = "netlink-sys" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6471bf08e7ac0135876a9581bf3217ef0333c191c128d34878079f42ee150411" +checksum = "416060d346fbaf1f23f9512963e3e878f1a78e707cb699ba9215761754244307" dependencies = [ "bytes", "futures", @@ -5962,6 +6470,17 @@ dependencies = [ "libc", ] +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.5.0", + "cfg-if", + "libc", +] + [[package]] name = "no-std-net" version = "0.6.0" @@ -5996,6 +6515,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -6009,13 +6538,19 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-format" version = "0.4.4" @@ -6028,11 +6563,10 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] @@ -6050,11 +6584,12 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -6063,10 +6598,31 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi", "libc", ] +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.58", +] + [[package]] name = "number_prefix" version = "0.4.0" @@ -6087,9 +6643,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -6117,9 +6673,9 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl-probe" @@ -6127,11 +6683,17 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "orchestra" -version = "0.0.5" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "227585216d05ba65c7ab0a0450a3cf2cbd81a98862a54c4df8e14d5ac6adb015" +checksum = "2356622ffdfe72362a45a1e5e87bb113b8327e596e39b91f11f0ef4395c8da79" dependencies = [ "async-trait", "dyn-clonable", @@ -6146,12 +6708,13 @@ dependencies = [ [[package]] name = "orchestra-proc-macro" -version = "0.0.5" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2871aadd82a2c216ee68a69837a526dfe788ecbe74c4c5038a6acdbff6653066" +checksum = "eedb646674596266dc9bb2b5c7eea7c36b32ecc7777eba0d510196972d72c4fd" dependencies = [ - "expander 0.0.6", - "itertools 0.10.5", + "expander 2.1.0", + "indexmap 2.2.6", + "itertools 0.11.0", "petgraph", "proc-macro-crate 1.3.1", "proc-macro2", @@ -6170,47 +6733,47 @@ dependencies = [ [[package]] name = "orml-benchmarking" -version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=b3694e631df7f1ca16b1973122937753fcdee9d4#b3694e631df7f1ca16b1973122937753fcdee9d4" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-benchmarking", - "frame-support", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "paste", "scale-info", "serde", - "sp-api", - "sp-io", - "sp-runtime", - "sp-runtime-interface 17.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-std", - "sp-storage", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "orml-tokens" -version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=b3694e631df7f1ca16b1973122937753fcdee9d4#b3694e631df7f1ca16b1973122937753fcdee9d4" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "orml-traits", "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic", - "sp-runtime", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "orml-traits" -version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=b3694e631df7f1ca16b1973122937753fcdee9d4#b3694e631df7f1ca16b1973122937753fcdee9d4" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "num-traits", "orml-utilities", @@ -6218,94 +6781,93 @@ dependencies = [ "paste", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", ] [[package]] name = "orml-unknown-tokens" -version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=b3694e631df7f1ca16b1973122937753fcdee9d4#b3694e631df7f1ca16b1973122937753fcdee9d4" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "orml-xcm-support", "parity-scale-codec", "scale-info", "serde", - "sp-std", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", ] [[package]] name = "orml-utilities" -version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=b3694e631df7f1ca16b1973122937753fcdee9d4#b3694e631df7f1ca16b1973122937753fcdee9d4" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "orml-vesting" -version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=b3694e631df7f1ca16b1973122937753fcdee9d4#b3694e631df7f1ca16b1973122937753fcdee9d4" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", "serde", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "orml-xcm" -version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=b3694e631df7f1ca16b1973122937753fcdee9d4#b3694e631df7f1ca16b1973122937753fcdee9d4" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "pallet-xcm", "parity-scale-codec", "scale-info", - "sp-std", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", ] [[package]] name = "orml-xcm-support" -version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=b3694e631df7f1ca16b1973122937753fcdee9d4#b3694e631df7f1ca16b1973122937753fcdee9d4" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "orml-traits", "parity-scale-codec", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-executor", ] [[package]] name = "orml-xtokens" -version = "0.4.1-dev" -source = "git+https://github.com/open-web3-stack/open-runtime-module-library?rev=b3694e631df7f1ca16b1973122937753fcdee9d4#b3694e631df7f1ca16b1973122937753fcdee9d4" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "cumulus-primitives-core", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "orml-traits", "orml-xcm-support", @@ -6313,21 +6875,85 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-executor", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "pallet-asset-conversion" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "parity-scale-codec", + "scale-info", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", +] + +[[package]] +name = "pallet-asset-rate" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", +] + [[package]] name = "pallet-asset-registry" version = "2.3.3" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "hydradx-traits", + "log", + "orml-traits", + "parity-scale-codec", + "primitive-types", + "scale-info", + "serde", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "staging-xcm", + "substrate-wasm-builder", + "test-utils", +] + +[[package]] +name = "pallet-asset-registry" +version = "3.2.1" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +dependencies = [ + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydradx-traits", "log", "orml-traits", @@ -6335,163 +6961,164 @@ dependencies = [ "primitive-types", "scale-info", "serde", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-runtime", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-wasm-builder", ] [[package]] name = "pallet-asset-tx-payment" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "pallet-transaction-payment", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-assets" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-aura" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-application-crypto", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus-aura", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-authority-discovery" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "pallet-session", "parity-scale-codec", "scale-info", - "sp-application-crypto", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-authority-discovery", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-babe" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-authorship", "pallet-session", "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-application-crypto", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus-babe", - "sp-core", - "sp-io", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-staking", - "sp-std", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-bags-list" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "aquamarine", "docify", - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-balances" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "docify", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-beefy" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-authorship", "pallet-session", @@ -6499,21 +7126,21 @@ dependencies = [ "scale-info", "serde", "sp-consensus-beefy", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-staking", - "sp-std", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-beefy-mmr" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "array-bytes", + "array-bytes 6.2.2", "binary-merkle-tree", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-beefy", "pallet-mmr", @@ -6521,429 +7148,471 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus-beefy", - "sp-core", - "sp-io", - "sp-runtime", - "sp-state-machine", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", +] + +[[package]] +name = "pallet-bonds" +version = "2.2.1" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +dependencies = [ + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "hydradx-traits", + "log", + "orml-traits", + "pallet-timestamp", + "parity-scale-codec", + "primitive-types", + "primitives 6.0.2", + "scale-info", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-bounties" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-treasury", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", +] + +[[package]] +name = "pallet-broker" +version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "bitvec", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "parity-scale-codec", + "scale-info", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-child-bounties" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-bounties", "pallet-treasury", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-circuit-breaker" -version = "1.1.18" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "1.1.21" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydradx-traits", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-collator-rewards" version = "1.0.6" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "orml-traits", "pallet-session", "parity-scale-codec", "scale-info", - "sp-arithmetic", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-wasm-builder", ] [[package]] name = "pallet-collator-selection" -version = "3.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "9.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-authorship", "pallet-session", "parity-scale-codec", - "rand 0.8.5", + "rand", "scale-info", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-collective" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-conviction-voting" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "assert_matches", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", "serde", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-currencies" -version = "2.0.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "2.1.0" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "orml-traits", "orml-utilities", "parity-scale-codec", "scale-info", "serde", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-democracy" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "4.1.0" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-democracy" -version = "4.1.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "serde", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-duster" version = "3.2.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydradx-traits", "log", "orml-traits", "parity-scale-codec", "scale-info", "serde", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-wasm-builder", ] [[package]] name = "pallet-dynamic-fees" version = "1.0.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "orml-traits", "parity-scale-codec", "scale-info", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-election-provider-multi-phase" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-election-provider-support-benchmarking", "parity-scale-codec", - "rand 0.8.5", + "rand", "scale-info", - "sp-arithmetic", - "sp-core", - "sp-io", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-npos-elections", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "strum 0.24.1", ] [[package]] name = "pallet-election-provider-support-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-election-provider-support", - "frame-system", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "sp-npos-elections", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-elections-phragmen" -version = "5.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-npos-elections", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-ema-oracle" -version = "1.1.3" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "1.3.0" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "hydradx-traits", "log", "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic", - "sp-core", - "sp-runtime", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.1.0#bf5885a982041cc744ecbb62a2afc13d56d464dc" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#5d6bf0c78d1d325d4eea6f9593e9a11da18a1ea8" dependencies = [ "environmental", "evm", "fp-account", "fp-evm", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "hash-db", + "hex", "hex-literal 0.4.1", "impl-trait-for-tuples", "log", "parity-scale-codec", "rlp", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", ] [[package]] name = "pallet-fast-unstake" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "docify", - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-grandpa" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-authorship", "pallet-session", "parity-scale-codec", "scale-info", - "sp-application-crypto", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus-grandpa", - "sp-core", - "sp-io", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-staking", - "sp-std", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-identity" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "enumflags2", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "log", "parity-scale-codec", "scale-info", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-im-online" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-authorship", "parity-scale-codec", "scale-info", - "sp-application-crypto", - "sp-core", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-indices" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-keyring", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-lbp" -version = "4.7.3" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "4.7.4" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "hydradx-traits", "orml-tokens", @@ -6952,36 +7621,36 @@ dependencies = [ "primitive-types", "scale-info", "serde", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-wasm-builder", ] [[package]] name = "pallet-liquidity-mining" -version = "4.2.5" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "4.3.1" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "hydradx-traits", "orml-traits", "parity-scale-codec", "scale-info", - "sp-arithmetic", - "sp-runtime", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-marketplace" version = "5.0.17" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "pallet-balances", "pallet-nft", "pallet-uniques", @@ -6990,194 +7659,195 @@ dependencies = [ "primitives 6.6.0", "scale-info", "serde", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-membership" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-message-queue" -version = "7.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "31.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "environmental", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-weights", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-mmr" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-mmr-primitives", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-multisig" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-nft" version = "7.1.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydradx-traits", "log", "pallet-uniques", "parity-scale-codec", "scale-info", "serde", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-nis" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", - "sp-arithmetic", - "sp-core", - "sp-runtime", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-nomination-pools" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "25.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-std", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-nomination-pools-benchmarking" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "pallet-bags-list", "pallet-nomination-pools", - "pallet-staking 4.0.0-dev", + "pallet-staking 28.0.0", "parity-scale-codec", "scale-info", - "sp-runtime", - "sp-runtime-interface 17.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-staking", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-nomination-pools-runtime-api" -version = "1.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", - "sp-api", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-offences" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-offences-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-babe", "pallet-balances", @@ -7185,46 +7855,50 @@ dependencies = [ "pallet-im-online", "pallet-offences", "pallet-session", - "pallet-staking 4.0.0-dev", + "pallet-staking 28.0.0", "parity-scale-codec", "scale-info", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-omnipool" -version = "4.0.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "4.1.5" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ "bitflags 1.3.2", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "hydradx-traits", "impl-trait-for-tuples", "log", "orml-traits", + "pallet-balances", "parity-scale-codec", "primitive-types", "scale-info", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-omnipool-liquidity-mining" -version = "2.0.13" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "2.1.4" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "bitflags 1.3.2", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "hydradx-traits", "log", "orml-traits", + "pallet-balances", "pallet-ema-oracle", "pallet-liquidity-mining", "pallet-omnipool", @@ -7232,248 +7906,284 @@ dependencies = [ "primitive-types", "primitives 6.0.2", "scale-info", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-preimage" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-proxy" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-ranked-collective" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "impl-trait-for-tuples", "log", "parity-scale-codec", "scale-info", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-recovery" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-referenda" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "assert_matches", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic", - "sp-io", - "sp-runtime", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", +] + +[[package]] +name = "pallet-referrals" +version = "1.2.3" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +dependencies = [ + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "hex-literal 0.3.4", + "hydra-dx-math", + "hydradx-traits", + "orml-traits", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-relaychain-info" version = "0.3.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "parity-scale-codec", + "scale-info", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", +] + +[[package]] +name = "pallet-root-testing" +version = "4.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", - "sp-api", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-route-executor" -version = "1.3.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "2.2.1" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydradx-traits", "orml-traits", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-scheduler" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "docify", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-io", - "sp-runtime", - "sp-std", - "sp-weights", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-session" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "log", "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-staking", - "sp-state-machine", - "sp-std", - "sp-trie", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-session-benchmarking" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "pallet-session", - "pallet-staking 4.0.0-dev", + "pallet-staking 28.0.0", "parity-scale-codec", - "rand 0.8.5", - "sp-runtime", + "rand", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-std", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-society" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "rand_chacha 0.2.2", "scale-info", - "sp-arithmetic", - "sp-io", - "sp-runtime", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-stableswap" -version = "3.4.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "3.5.1" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ "bitflags 1.3.2", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "hydradx-traits", "orml-traits", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-staking" -version = "2.1.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "3.0.0" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "log", "orml-traits", "pallet-democracy 4.1.0", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-staking" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-authorship", "pallet-session", @@ -7481,305 +8191,313 @@ dependencies = [ "rand_chacha 0.2.2", "scale-info", "serde", - "sp-application-crypto", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-staking-reward-curve" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "pallet-staking-reward-fn" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "19.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "log", - "sp-arithmetic", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-staking-runtime-api" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-state-trie-migration" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-sudo" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "docify", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-timestamp" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "docify", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-std", - "sp-storage", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", ] [[package]] name = "pallet-tips" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "pallet-treasury", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-transaction-multi-payment" -version = "9.1.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "9.5.0" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "hydradx-traits", "orml-traits", "pallet-evm", "pallet-transaction-payment", + "pallet-utility", "parity-scale-codec", "primitives 6.0.2", "scale-info", - "sp-api", - "sp-core", - "sp-runtime", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-transaction-pause" version = "1.0.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-transaction-payment" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-transaction-payment-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "30.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.20.3", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-rpc", - "sp-runtime", - "sp-weights", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-transaction-payment-rpc-runtime-api" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", - "sp-api", - "sp-runtime", - "sp-weights", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-treasury" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "docify", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-uniques" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-utility" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-vesting" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-whitelist" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "scale-info", - "sp-api", - "sp-runtime", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-xcm" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bounded-collections", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", + "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", + "staging-xcm-builder", "staging-xcm-executor", ] [[package]] name = "pallet-xcm-benchmarks" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", "parity-scale-codec", "scale-info", - "sp-io", - "sp-runtime", - "sp-std", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -7787,13 +8505,13 @@ dependencies = [ [[package]] name = "pallet-xcm-rate-limiter" -version = "0.1.3" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +version = "0.1.6" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ "cumulus-pallet-xcmp-queue", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "hydradx-traits", "orml-traits", @@ -7802,33 +8520,36 @@ dependencies = [ "polkadot-parachain-primitives", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", ] [[package]] name = "pallet-xyk" version = "6.3.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydra-dx-math", "hydradx-traits", "log", "orml-tokens", "orml-traits", + "pallet-asset-registry 2.3.3", "parity-scale-codec", "primitive-types", + "proptest", "scale-info", "serde", - "sp-core", - "sp-runtime", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-wasm-builder", ] @@ -7836,8 +8557,8 @@ dependencies = [ name = "pallet-xyk-liquidity-mining" version = "1.1.10" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydradx-traits", "lazy_static", "log", @@ -7851,24 +8572,24 @@ dependencies = [ "pretty_assertions", "primitives 6.6.0", "scale-info", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "pallet-xyk-liquidity-mining-benchmarking" version = "1.0.16" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hydradx-traits", "orml-tokens", "orml-traits", - "pallet-asset-registry", + "pallet-asset-registry 2.3.3", "pallet-balances", "pallet-duster", "pallet-liquidity-mining", @@ -7879,81 +8600,63 @@ dependencies = [ "parity-scale-codec", "primitives 6.6.0", "scale-info", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "parachain-info" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" -dependencies = [ - "cumulus-primitives-core", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-runtime", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "parachains-common" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-utility", - "frame-support", - "frame-system", - "kusama-runtime-constants", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "log", - "num-traits", "pallet-asset-tx-payment", "pallet-assets", "pallet-authorship", "pallet-balances", "pallet-collator-selection", + "pallet-message-queue", + "pallet-xcm", "parity-scale-codec", - "polkadot-core-primitives", "polkadot-primitives", - "polkadot-runtime-constants", - "rococo-runtime-constants", "scale-info", - "smallvec", "sp-consensus-aura", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "staging-parachain-info", "staging-xcm", - "staging-xcm-builder", "staging-xcm-executor", "substrate-wasm-builder", - "westend-runtime-constants", ] [[package]] name = "parity-db" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e9ab494af9e6e813c72170f0d3c1de1500990d62c97cc05cc7576f91aa402f" +checksum = "592a28a24b09c9dc20ac8afaa6839abc417c720afe42c12e1e4a9d6aa2508d2e" dependencies = [ - "blake2", + "blake2 0.10.6", "crc32fast", "fs2", "hex", "libc", "log", "lz4", - "memmap2", + "memmap2 0.5.10", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "siphasher", "snap", + "winapi", ] [[package]] @@ -7977,7 +8680,7 @@ version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" dependencies = [ - "proc-macro-crate 2.0.1", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", "syn 1.0.109", @@ -8067,16 +8770,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" dependencies = [ - "crypto-mac 0.11.1", -] - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest 0.10.7", + "crypto-mac 0.11.0", ] [[package]] @@ -8111,9 +8805,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.5" +version = "2.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" +checksum = "311fb059dee1a7b802f036316d790138c613a4e8b180c822e3925a662e9f0c95" dependencies = [ "memchr", "thiserror", @@ -8122,9 +8816,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.5" +version = "2.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" +checksum = "f73541b156d32197eecda1a4014d7f868fd2bcb3c550d5386087cfba442bf69c" dependencies = [ "pest", "pest_generator", @@ -8132,22 +8826,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.5" +version = "2.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" +checksum = "c35eeed0a3fab112f75165fdc026b3913f4183133f19b49be773ac9ea966e8bd" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "pest_meta" -version = "2.7.5" +version = "2.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" +checksum = "2adbf29bb9776f28caece835398781ab24435585fe0d4dc1374a61db5accedca" dependencies = [ "once_cell", "pest", @@ -8161,27 +8855,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.1.0", + "indexmap 2.2.6", ] [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -8192,9 +8886,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -8209,7 +8903,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" dependencies = [ "atomic-waker", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", ] @@ -8225,9 +8919,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platforms" @@ -8237,17 +8931,19 @@ checksum = "989d43012e2ca1c4a02507c67282691a0a3207f9dc67cec596b43fe925b3d325" [[package]] name = "platforms" -version = "3.2.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" +checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" [[package]] name = "polkadot-approval-distribution" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ + "bitvec", "futures", "futures-timer", + "itertools 0.10.5", "polkadot-node-jaeger", "polkadot-node-metrics", "polkadot-node-network-protocol", @@ -8255,14 +8951,14 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "rand 0.8.5", + "rand", "tracing-gum", ] [[package]] name = "polkadot-availability-bitfield-distribution" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "always-assert", "futures", @@ -8271,14 +8967,14 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "rand 0.8.5", + "rand", "tracing-gum", ] [[package]] name = "polkadot-availability-distribution" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "derive_more", "fatality", @@ -8290,19 +8986,20 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "rand 0.8.5", + "rand", "schnellru", - "sp-core", - "sp-keystore", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing-gum", ] [[package]] name = "polkadot-availability-recovery" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ + "async-trait", "fatality", "futures", "parity-scale-codec", @@ -8312,24 +9009,26 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "rand 0.8.5", + "rand", "sc-network", "schnellru", "thiserror", + "tokio", "tracing-gum", ] [[package]] name = "polkadot-cli" -version = "1.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ + "cfg-if", "clap", "frame-benchmarking-cli", "futures", "log", "polkadot-node-metrics", - "polkadot-performance-test", + "polkadot-node-primitives", "polkadot-service", "sc-cli", "sc-executor", @@ -8337,8 +9036,8 @@ dependencies = [ "sc-storage-monitor", "sc-sysinfo", "sc-tracing", - "sp-core", - "sp-io", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-keyring", "sp-maybe-compressed-blob", "substrate-build-script-utils", @@ -8348,8 +9047,8 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bitvec", "fatality", @@ -8360,9 +9059,9 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "sp-core", - "sp-keystore", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tokio-util", "tracing-gum", @@ -8370,26 +9069,26 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", "scale-info", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "polkadot-dispute-distribution" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "derive_more", "fatality", "futures", "futures-timer", - "indexmap 1.9.3", + "indexmap 2.2.6", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -8399,30 +9098,30 @@ dependencies = [ "polkadot-primitives", "sc-network", "schnellru", - "sp-application-crypto", - "sp-keystore", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing-gum", ] [[package]] name = "polkadot-erasure-coding" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", "polkadot-primitives", "reed-solomon-novelpoly", - "sp-core", - "sp-trie", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "polkadot-gossip-support" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", "futures-timer", @@ -8430,20 +9129,21 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "rand 0.8.5", + "rand", "rand_chacha 0.3.1", "sc-network", "sc-network-common", - "sp-application-crypto", - "sp-core", - "sp-keystore", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tracing-gum", ] [[package]] name = "polkadot-network-bridge" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "always-assert", "async-trait", @@ -8465,8 +9165,8 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", "parity-scale-codec", @@ -8475,7 +9175,7 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-maybe-compressed-blob", "thiserror", "tracing-gum", @@ -8483,15 +9183,16 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bitvec", "derive_more", "futures", "futures-timer", + "itertools 0.10.5", "kvdb", - "merlin 2.0.1", + "merlin", "parity-scale-codec", "polkadot-node-jaeger", "polkadot-node-primitives", @@ -8499,21 +9200,24 @@ dependencies = [ "polkadot-node-subsystem-util", "polkadot-overseer", "polkadot-primitives", + "rand", + "rand_chacha 0.3.1", + "rand_core 0.6.4", "sc-keystore", "schnellru", - "schnorrkel 0.9.1", - "sp-application-crypto", + "schnorrkel 0.11.4", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus", "sp-consensus-slots", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing-gum", ] [[package]] name = "polkadot-node-core-av-store" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bitvec", "futures", @@ -8534,8 +9238,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bitvec", "fatality", @@ -8546,21 +9250,22 @@ dependencies = [ "polkadot-node-subsystem-util", "polkadot-primitives", "polkadot-statement-table", - "sp-keystore", + "schnellru", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing-gum", ] [[package]] name = "polkadot-node-core-bitfield-signing" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "sp-keystore", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing-gum", "wasm-timer", @@ -8568,8 +9273,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "futures", @@ -8589,23 +9294,22 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", "polkadot-node-metrics", "polkadot-node-subsystem", - "polkadot-primitives", + "polkadot-node-subsystem-types", "sc-client-api", "sc-consensus-babe", - "sp-blockchain", "tracing-gum", ] [[package]] name = "polkadot-node-core-chain-selection" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", "futures-timer", @@ -8621,8 +9325,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "fatality", "futures", @@ -8640,8 +9344,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "futures", @@ -8650,15 +9354,15 @@ dependencies = [ "polkadot-overseer", "polkadot-primitives", "sp-blockchain", - "sp-inherents", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing-gum", ] [[package]] name = "polkadot-node-core-prospective-parachains" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "6.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bitvec", "fatality", @@ -8674,8 +9378,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bitvec", "fatality", @@ -8691,12 +9395,16 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "always-assert", + "array-bytes 6.2.2", + "blake3", + "cfg-if", "futures", "futures-timer", + "is_executable", "libc", "parity-scale-codec", "pin-project", @@ -8704,23 +9412,24 @@ dependencies = [ "polkadot-node-core-pvf-common", "polkadot-node-metrics", "polkadot-node-primitives", + "polkadot-node-subsystem", "polkadot-parachain-primitives", "polkadot-primitives", - "rand 0.8.5", + "rand", "slotmap", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-maybe-compressed-blob", - "sp-wasm-interface 14.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "substrate-build-script-utils", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tempfile", + "thiserror", "tokio", "tracing-gum", ] [[package]] name = "polkadot-node-core-pvf-checker" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", "polkadot-node-primitives", @@ -8728,61 +9437,42 @@ dependencies = [ "polkadot-node-subsystem-util", "polkadot-overseer", "polkadot-primitives", - "sp-keystore", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing-gum", ] [[package]] name = "polkadot-node-core-pvf-common" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ + "cfg-if", "cpu-time", "futures", "landlock", "libc", + "nix 0.27.1", "parity-scale-codec", "polkadot-parachain-primitives", "polkadot-primitives", "sc-executor", "sc-executor-common", "sc-executor-wasmtime", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-io", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "tokio", - "tracing-gum", -] - -[[package]] -name = "polkadot-node-core-pvf-prepare-worker" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" -dependencies = [ - "futures", - "libc", - "parity-scale-codec", - "polkadot-node-core-pvf-common", - "polkadot-parachain-primitives", - "polkadot-primitives", - "rayon", - "sc-executor", - "sc-executor-common", - "sc-executor-wasmtime", - "sp-io", - "sp-maybe-compressed-blob", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "tikv-jemalloc-ctl", - "tokio", + "seccompiler", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "thiserror", "tracing-gum", ] [[package]] name = "polkadot-node-core-runtime-api" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", "polkadot-node-metrics", @@ -8796,8 +9486,8 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "lazy_static", "log", @@ -8807,17 +9497,17 @@ dependencies = [ "polkadot-node-primitives", "polkadot-primitives", "sc-network", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tokio", ] [[package]] name = "polkadot-node-metrics" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "bs58 0.5.0", + "bs58 0.5.1", "futures", "futures-timer", "log", @@ -8833,8 +9523,8 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-channel 1.9.0", "async-trait", @@ -8847,7 +9537,7 @@ dependencies = [ "polkadot-node-jaeger", "polkadot-node-primitives", "polkadot-primitives", - "rand 0.8.5", + "rand", "sc-authority-discovery", "sc-network", "strum 0.24.1", @@ -8857,30 +9547,31 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ + "bitvec", "bounded-vec", "futures", "parity-scale-codec", "polkadot-parachain-primitives", "polkadot-primitives", - "schnorrkel 0.9.1", + "schnorrkel 0.11.4", "serde", - "sp-application-crypto", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus-babe", - "sp-core", - "sp-keystore", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-maybe-compressed-blob", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "zstd 0.12.4", ] [[package]] name = "polkadot-node-subsystem" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -8889,10 +9580,11 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", + "bitvec", "derive_more", "futures", "orchestra", @@ -8901,20 +9593,23 @@ dependencies = [ "polkadot-node-primitives", "polkadot-primitives", "polkadot-statement-table", + "sc-client-api", "sc-network", "sc-transaction-pool-api", "smallvec", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-authority-discovery", + "sp-blockchain", "sp-consensus-babe", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "thiserror", ] [[package]] name = "polkadot-node-subsystem-util" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "derive_more", @@ -8925,29 +9620,31 @@ dependencies = [ "kvdb", "parity-db", "parity-scale-codec", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "pin-project", "polkadot-node-jaeger", "polkadot-node-metrics", "polkadot-node-network-protocol", "polkadot-node-primitives", "polkadot-node-subsystem", + "polkadot-node-subsystem-types", "polkadot-overseer", "polkadot-primitives", "prioritized-metered-channel", - "rand 0.8.5", + "rand", + "sc-client-api", "schnellru", - "sp-application-crypto", - "sp-core", - "sp-keystore", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing-gum", ] [[package]] name = "polkadot-overseer" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "futures", @@ -8960,80 +9657,62 @@ dependencies = [ "polkadot-node-subsystem-types", "polkadot-primitives", "sc-client-api", - "schnellru", - "sp-api", - "sp-core", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tikv-jemalloc-ctl", "tracing-gum", ] [[package]] name = "polkadot-parachain-primitives" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "6.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bounded-collections", "derive_more", - "frame-support", "parity-scale-codec", "polkadot-core-primitives", "scale-info", "serde", - "sp-core", - "sp-runtime", - "sp-std", -] - -[[package]] -name = "polkadot-performance-test" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" -dependencies = [ - "env_logger 0.9.3", - "log", - "polkadot-erasure-coding", - "polkadot-node-core-pvf-prepare-worker", - "polkadot-node-primitives", - "polkadot-primitives", - "quote", - "sc-executor-common", - "sp-maybe-compressed-blob", - "staging-kusama-runtime", - "thiserror", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "polkadot-primitives" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bitvec", "hex-literal 0.4.1", + "log", "parity-scale-codec", "polkadot-core-primitives", "polkadot-parachain-primitives", "scale-info", "serde", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-authority-discovery", "sp-consensus-slots", - "sp-core", - "sp-inherents", - "sp-io", - "sp-keystore", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "polkadot-rpc" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.20.3", "mmr-rpc", "pallet-transaction-payment-rpc", "polkadot-primitives", @@ -9047,141 +9726,49 @@ dependencies = [ "sc-consensus-grandpa", "sc-consensus-grandpa-rpc", "sc-rpc", + "sc-rpc-spec-v2", "sc-sync-state-rpc", "sc-transaction-pool-api", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-babe", - "sp-keystore", - "sp-runtime", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-frame-rpc-system", "substrate-state-trie-migration-rpc", ] -[[package]] -name = "polkadot-runtime" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" -dependencies = [ - "bitvec", - "frame-benchmarking", - "frame-election-provider-support", - "frame-executive", - "frame-support", - "frame-system", - "frame-system-benchmarking", - "frame-system-rpc-runtime-api", - "frame-try-runtime", - "hex-literal 0.4.1", - "log", - "pallet-authority-discovery", - "pallet-authorship", - "pallet-babe", - "pallet-bags-list", - "pallet-balances", - "pallet-bounties", - "pallet-child-bounties", - "pallet-collective", - "pallet-conviction-voting", - "pallet-democracy 4.0.0-dev", - "pallet-election-provider-multi-phase", - "pallet-election-provider-support-benchmarking", - "pallet-elections-phragmen", - "pallet-fast-unstake", - "pallet-grandpa", - "pallet-identity", - "pallet-im-online", - "pallet-indices", - "pallet-membership", - "pallet-message-queue", - "pallet-multisig", - "pallet-nomination-pools", - "pallet-nomination-pools-benchmarking", - "pallet-nomination-pools-runtime-api", - "pallet-offences", - "pallet-offences-benchmarking", - "pallet-preimage", - "pallet-proxy", - "pallet-referenda", - "pallet-scheduler", - "pallet-session", - "pallet-session-benchmarking", - "pallet-staking 4.0.0-dev", - "pallet-staking-reward-curve", - "pallet-staking-runtime-api", - "pallet-timestamp", - "pallet-tips", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", - "pallet-treasury", - "pallet-utility", - "pallet-vesting", - "pallet-whitelist", - "pallet-xcm", - "pallet-xcm-benchmarks", - "parity-scale-codec", - "polkadot-primitives", - "polkadot-runtime-common", - "polkadot-runtime-constants", - "polkadot-runtime-parachains", - "rustc-hex", - "scale-info", - "serde", - "serde_derive", - "smallvec", - "sp-api", - "sp-arithmetic", - "sp-authority-discovery", - "sp-block-builder", - "sp-consensus-babe", - "sp-consensus-beefy", - "sp-core", - "sp-inherents", - "sp-io", - "sp-mmr-primitives", - "sp-npos-elections", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", - "sp-storage", - "sp-transaction-pool", - "sp-version", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", - "static_assertions", - "substrate-wasm-builder", -] - [[package]] name = "polkadot-runtime-common" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bitvec", - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-election-provider-support", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "libsecp256k1", "log", + "pallet-asset-rate", "pallet-authorship", "pallet-babe", "pallet-balances", + "pallet-broker", "pallet-election-provider-multi-phase", "pallet-fast-unstake", + "pallet-identity", "pallet-session", - "pallet-staking 4.0.0-dev", + "pallet-staking 28.0.0", "pallet-staking-reward-fn", "pallet-timestamp", "pallet-transaction-payment", "pallet-treasury", "pallet-vesting", + "pallet-xcm-benchmarks", "parity-scale-codec", "polkadot-primitives", "polkadot-runtime-parachains", @@ -9190,87 +9777,78 @@ dependencies = [ "serde", "serde_derive", "slot-range-helper", - "sp-api", - "sp-core", - "sp-inherents", - "sp-io", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-npos-elections", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-staking", - "sp-std", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", "static_assertions", ] -[[package]] -name = "polkadot-runtime-constants" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" -dependencies = [ - "frame-support", - "polkadot-primitives", - "polkadot-runtime-common", - "smallvec", - "sp-core", - "sp-runtime", - "sp-weights", -] - [[package]] name = "polkadot-runtime-metrics" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "bs58 0.5.0", - "frame-benchmarking", + "bs58 0.5.1", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "polkadot-primitives", - "sp-std", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "polkadot-runtime-parachains" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bitflags 1.3.2", "bitvec", "derive_more", - "frame-benchmarking", - "frame-support", - "frame-system", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "log", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", "pallet-balances", + "pallet-broker", "pallet-message-queue", "pallet-session", - "pallet-staking 4.0.0-dev", + "pallet-staking 28.0.0", "pallet-timestamp", "pallet-vesting", "parity-scale-codec", + "polkadot-core-primitives", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-metrics", - "rand 0.8.5", + "rand", "rand_chacha 0.3.1", "rustc-hex", "scale-info", "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-inherents", - "sp-io", - "sp-keystore", - "sp-runtime", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-staking", - "sp-std", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-executor", "static_assertions", @@ -9278,14 +9856,14 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-benchmarking-cli", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-system-rpc-runtime-api", "futures", "hex-literal 0.4.1", @@ -9296,11 +9874,12 @@ dependencies = [ "mmr-gadget", "pallet-babe", "pallet-im-online", - "pallet-staking 4.0.0-dev", + "pallet-staking 28.0.0", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "parity-db", "parity-scale-codec", + "parking_lot 0.12.1", "polkadot-approval-distribution", "polkadot-availability-bitfield-distribution", "polkadot-availability-distribution", @@ -9334,8 +9913,6 @@ dependencies = [ "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-rpc", - "polkadot-runtime", - "polkadot-runtime-common", "polkadot-runtime-parachains", "polkadot-statement-distribution", "rococo-runtime", @@ -9365,7 +9942,7 @@ dependencies = [ "schnellru", "serde", "serde_json", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-authority-discovery", "sp-block-builder", "sp-blockchain", @@ -9373,22 +9950,21 @@ dependencies = [ "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", - "sp-core", - "sp-inherents", - "sp-io", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-keyring", - "sp-keystore", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-mmr-primitives", "sp-offchain", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-state-machine", - "sp-storage", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", "sp-transaction-pool", - "sp-version", - "sp-weights", - "staging-kusama-runtime", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "thiserror", "tracing-gum", @@ -9397,36 +9973,73 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "arrayvec 0.7.4", "bitvec", "fatality", "futures", "futures-timer", - "indexmap 1.9.3", + "indexmap 2.2.6", "parity-scale-codec", "polkadot-node-network-protocol", "polkadot-node-primitives", "polkadot-node-subsystem", - "polkadot-node-subsystem-types", "polkadot-node-subsystem-util", "polkadot-primitives", - "sp-keystore", - "sp-staking", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing-gum", ] [[package]] name = "polkadot-statement-table" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", "polkadot-primitives", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "tracing-gum", +] + +[[package]] +name = "polkavm-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d9428a5cfcc85c5d7b9fc4b6a18c4b802d0173d768182a51cc7751640f08b92" + +[[package]] +name = "polkavm-derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8c4bea6f3e11cd89bb18bcdddac10bd9a24015399bd1c485ad68a985a19606" +dependencies = [ + "polkavm-derive-impl-macro", +] + +[[package]] +name = "polkavm-derive-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c4fdfc49717fb9a196e74a5d28e0bc764eb394a2c803eb11133a31ac996c60c" +dependencies = [ + "polkavm-common", + "proc-macro2", + "quote", + "syn 2.0.58", +] + +[[package]] +name = "polkavm-derive-impl-macro" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ba81f7b5faac81e528eb6158a6f3c9e0bb1008e0ffa19653bc8dea925ecb429" +dependencies = [ + "polkavm-derive-impl", + "syn 2.0.58", ] [[package]] @@ -9441,20 +10054,21 @@ dependencies = [ "concurrent-queue", "libc", "log", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "windows-sys 0.48.0", ] [[package]] name = "polling" -version = "3.3.1" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e" +checksum = "e0c976a60b2d7e99d6f229e414670a9b85d13ac305cc6d1e9c134de58c5aaaf6" dependencies = [ "cfg-if", "concurrent-queue", - "pin-project-lite 0.2.13", - "rustix 0.38.27", + "hermit-abi", + "pin-project-lite 0.2.14", + "rustix 0.38.32", "tracing", "windows-sys 0.52.0", ] @@ -9466,19 +10080,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ "cpufeatures", - "opaque-debug 0.3.0", + "opaque-debug 0.3.1", "universal-hash", ] [[package]] name = "polyval" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", "cpufeatures", - "opaque-debug 0.3.0", + "opaque-debug 0.3.1", "universal-hash", ] @@ -9531,8 +10145,18 @@ dependencies = [ ] [[package]] -name = "pretty_assertions" -version = "1.4.0" +name = "prettier-please" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22020dfcf177fcc7bf5deaf7440af371400c67c0de14c399938d8ed4fb4645d3" +dependencies = [ + "proc-macro2", + "syn 2.0.58", +] + +[[package]] +name = "pretty_assertions" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" dependencies = [ @@ -9542,9 +10166,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.1.25" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +checksum = "f28f53e8b192565862cf99343194579a022eb9c7dd3a8d03134734803c7b3125" dependencies = [ "proc-macro2", "syn 1.0.109", @@ -9552,12 +10176,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" dependencies = [ "proc-macro2", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -9577,16 +10201,16 @@ dependencies = [ [[package]] name = "primitives" version = "6.0.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?rev=7e997371d7f2110f7719d2f279a153feb973b994#7e997371d7f2110f7719d2f279a153feb973b994" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "hex-literal 0.3.4", "parity-scale-codec", "polkadot-primitives", "scale-info", "serde", - "sp-core", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "static_assertions", ] @@ -9594,25 +10218,25 @@ dependencies = [ name = "primitives" version = "6.6.0" dependencies = [ - "frame-support", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", "polkadot-primitives", "primitive-types", "scale-info", "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "static_assertions", "substrate-wasm-builder", ] [[package]] name = "prioritized-metered-channel" -version = "0.2.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382698e48a268c832d0b181ed438374a6bb708a82a8ca273bb0f61c74cf209c4" +checksum = "a172e6cc603231f2cf004232eabcecccc0da53ba576ab286ef7baa0cfc7927ad" dependencies = [ "coarsetime", "crossbeam-queue", @@ -9636,12 +10260,20 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" dependencies = [ - "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.20.7", +] + +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit 0.21.1", ] [[package]] @@ -9670,20 +10302,20 @@ dependencies = [ [[package]] name = "proc-macro-warning" -version = "0.4.2" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" +checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -9722,7 +10354,27 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", +] + +[[package]] +name = "proptest" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags 2.5.0", + "lazy_static", + "num-traits", + "rand", + "rand_chacha 0.3.1", + "rand_xorshift", + "regex-syntax 0.8.3", + "rusty-fork", + "tempfile", + "unarray", ] [[package]] @@ -9732,7 +10384,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.11.9", +] + +[[package]] +name = "prost" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" +dependencies = [ + "bytes", + "prost-derive 0.12.4", ] [[package]] @@ -9742,14 +10404,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", - "heck", + "heck 0.4.1", "itertools 0.10.5", "lazy_static", "log", "multimap", "petgraph", - "prettyplease 0.1.25", - "prost", + "prettyplease 0.1.11", + "prost 0.11.9", "prost-types", "regex", "syn 1.0.109", @@ -9770,13 +10432,26 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "prost-derive" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.58", +] + [[package]] name = "prost-types" version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "prost", + "prost 0.11.9", ] [[package]] @@ -9834,7 +10509,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94b0b33c13a79f669c85defaf4c275dc86a0c0372807d0ca3d78e0bb87274863" dependencies = [ "bytes", - "rand 0.8.5", + "rand", "ring 0.16.20", "rustc-hash", "rustls 0.20.9", @@ -9847,9 +10522,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -9860,19 +10535,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - [[package]] name = "rand" version = "0.8.5" @@ -9919,16 +10581,17 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.14", ] [[package]] -name = "rand_hc" -version = "0.2.0" +name = "rand_distr" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" dependencies = [ - "rand_core 0.5.1", + "num-traits", + "rand", ] [[package]] @@ -9940,6 +10603,15 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core 0.6.4", +] + [[package]] name = "rawpointer" version = "0.2.1" @@ -9948,9 +10620,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -9958,9 +10630,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -9998,46 +10670,45 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.14", "libredox", "thiserror", ] [[package]] name = "reed-solomon-novelpoly" -version = "1.0.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58130877ca403ab42c864fbac74bb319a0746c07a634a92a5cfc7f54af272582" +checksum = "87413ebb313323d431e85d0afc5a68222aaed972843537cbfe5f061cf1b4bcab" dependencies = [ "derive_more", "fs-err", - "itertools 0.11.0", "static_init", "thiserror", ] [[package]] name = "ref-cast" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" +checksum = "c4846d4c50d1721b1a3bef8af76924eef20d5e723647333798c1b519b3a9473f" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" +checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -10054,14 +10725,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", ] [[package]] @@ -10075,13 +10746,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -10092,9 +10763,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "resolv-conf" @@ -10113,22 +10784,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ "hmac 0.12.1", - "subtle", + "subtle 2.5.0", ] [[package]] name = "ring" version = "0.1.0" -source = "git+https://github.com/w3f/ring-proof?rev=0e948f3#0e948f3c28cbacecdd3020403c4841c0eb339213" +source = "git+https://github.com/w3f/ring-proof#b273d33f9981e2bb3375ab45faeb537f7ee35224" dependencies = [ "ark-ec", "ark-ff", "ark-poly", "ark-serialize", "ark-std", + "blake2 0.10.6", "common", "fflonk", - "merlin 3.0.0", + "merlin", ] [[package]] @@ -10148,16 +10820,26 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", - "getrandom 0.2.11", + "cfg-if", + "getrandom 0.2.14", "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys 0.48.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", ] [[package]] @@ -10194,19 +10876,20 @@ dependencies = [ [[package]] name = "rococo-runtime" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "binary-merkle-tree", - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-executive", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "hex-literal 0.4.1", "log", + "pallet-asset-rate", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", @@ -10216,7 +10899,8 @@ dependencies = [ "pallet-bounties", "pallet-child-bounties", "pallet-collective", - "pallet-democracy 4.0.0-dev", + "pallet-conviction-voting", + "pallet-democracy 28.0.0", "pallet-elections-phragmen", "pallet-grandpa", "pallet-identity", @@ -10230,11 +10914,14 @@ dependencies = [ "pallet-offences", "pallet-preimage", "pallet-proxy", + "pallet-ranked-collective", "pallet-recovery", + "pallet-referenda", + "pallet-root-testing", "pallet-scheduler", "pallet-session", "pallet-society", - "pallet-staking 4.0.0-dev", + "pallet-staking 28.0.0", "pallet-state-trie-migration", "pallet-sudo", "pallet-timestamp", @@ -10244,6 +10931,7 @@ dependencies = [ "pallet-treasury", "pallet-utility", "pallet-vesting", + "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "parity-scale-codec", @@ -10256,23 +10944,25 @@ dependencies = [ "serde", "serde_derive", "smallvec", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-authority-discovery", "sp-block-builder", "sp-consensus-babe", "sp-consensus-beefy", - "sp-core", - "sp-inherents", - "sp-io", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-genesis-builder 0.7.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-mmr-primitives", "sp-offchain", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-staking", - "sp-std", - "sp-storage", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", - "sp-version", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -10282,18 +10972,26 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "polkadot-primitives", "polkadot-runtime-common", "smallvec", - "sp-core", - "sp-runtime", - "sp-weights", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "staging-xcm", + "staging-xcm-builder", ] +[[package]] +name = "route-recognizer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" + [[package]] name = "rpassword" version = "7.3.1" @@ -10315,7 +11013,7 @@ dependencies = [ "log", "netlink-packet-route", "netlink-proto", - "nix", + "nix 0.24.3", "thiserror", "tokio", ] @@ -10345,10 +11043,10 @@ dependencies = [ "cumulus-primitives-timestamp", "cumulus-primitives-utility", "cumulus-test-relay-sproof-builder", - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-executive", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "hex-literal 0.4.1", @@ -10360,14 +11058,14 @@ dependencies = [ "orml-xcm", "orml-xcm-support", "orml-xtokens", - "pallet-asset-registry", + "pallet-asset-registry 2.3.3", "pallet-aura", "pallet-authorship", "pallet-balances", "pallet-collator-selection", "pallet-collective", "pallet-currencies", - "pallet-democracy 4.0.0-dev", + "pallet-democracy 28.0.0", "pallet-duster", "pallet-elections-phragmen", "pallet-ema-oracle", @@ -10389,7 +11087,6 @@ dependencies = [ "pallet-utility", "pallet-xcm", "pallet-xyk", - "parachain-info", "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-parachains", @@ -10397,26 +11094,26 @@ dependencies = [ "pretty_assertions", "primitives 6.6.0", "sc-consensus-grandpa", - "sp-api", - "sp-arithmetic", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-inherents", - "sp-io", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-offchain", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-staking", - "sp-std", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", - "sp-trie", - "sp-version", - "staging-kusama-runtime", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "staging-parachain-info", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -10448,7 +11145,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.20", + "semver 1.0.22", ] [[package]] @@ -10490,14 +11187,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.27" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfeae074e687625746172d639330f1de242a178bf3189b51e35a7a21573513ac" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "errno", "libc", - "linux-raw-sys 0.4.12", + "linux-raw-sys 0.4.13", "windows-sys 0.52.0", ] @@ -10520,7 +11217,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring 0.17.7", + "ring 0.17.8", "rustls-webpki", "sct", ] @@ -10543,7 +11240,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", ] [[package]] @@ -10552,15 +11249,27 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" + +[[package]] +name = "rusty-fork" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] [[package]] name = "ruzstd" @@ -10586,9 +11295,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "safe_arch" @@ -10610,19 +11319,19 @@ dependencies = [ [[package]] name = "sc-allocator" -version = "4.1.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "log", - "sp-core", - "sp-wasm-interface 14.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sc-authority-discovery" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "futures", @@ -10630,67 +11339,71 @@ dependencies = [ "ip_network", "libp2p", "log", - "multihash", + "multihash 0.18.1", + "multihash-codetable", "parity-scale-codec", - "prost", + "prost 0.12.4", "prost-build", - "rand 0.8.5", + "rand", "sc-client-api", "sc-network", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-authority-discovery", "sp-blockchain", - "sp-core", - "sp-keystore", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "thiserror", ] [[package]] name = "sc-basic-authorship" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", "futures-timer", "log", "parity-scale-codec", "sc-block-builder", - "sc-client-api", "sc-proposer-metrics", "sc-telemetry", "sc-transaction-pool-api", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", "sp-consensus", - "sp-core", - "sp-inherents", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", ] [[package]] name = "sc-block-builder" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", - "sc-client-api", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-block-builder", "sp-blockchain", - "sp-core", - "sp-inherents", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sc-chain-spec" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "memmap2", + "array-bytes 6.2.2", + "docify", + "log", + "memmap2 0.9.4", + "parity-scale-codec", "sc-chain-spec-derive", "sc-client-api", "sc-executor", @@ -10699,42 +11412,48 @@ dependencies = [ "serde", "serde_json", "sp-blockchain", - "sp-core", - "sp-runtime", - "sp-state-machine", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-genesis-builder 0.7.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sc-chain-spec-derive" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "sc-cli" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.36.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "array-bytes", + "array-bytes 6.2.2", + "bip39", "chrono", "clap", "fdlimit", "futures", + "itertools 0.10.5", "libp2p-identity", "log", "names", "parity-scale-codec", - "rand 0.8.5", + "rand", "regex", "rpassword", "sc-client-api", "sc-client-db", "sc-keystore", + "sc-mixnet", "sc-network", "sc-service", "sc-telemetry", @@ -10743,21 +11462,20 @@ dependencies = [ "serde", "serde_json", "sp-blockchain", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-keyring", - "sp-keystore", - "sp-panic-handler", - "sp-runtime", - "sp-version", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-panic-handler 13.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", - "tiny-bip39", "tokio", ] [[package]] name = "sc-client-api" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "fnv", "futures", @@ -10767,25 +11485,26 @@ dependencies = [ "sc-executor", "sc-transaction-pool-api", "sc-utils", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", "sp-consensus", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-database", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-runtime", - "sp-state-machine", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-statement-store", - "sp-storage", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", ] [[package]] name = "sc-client-db" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.35.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "hash-db 0.16.0", + "hash-db", "kvdb", "kvdb-memorydb", "kvdb-rocksdb", @@ -10797,19 +11516,19 @@ dependencies = [ "sc-client-api", "sc-state-db", "schnellru", - "sp-arithmetic", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-database", - "sp-runtime", - "sp-state-machine", - "sp-trie", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sc-consensus" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "futures", @@ -10821,20 +11540,20 @@ dependencies = [ "sc-client-api", "sc-utils", "serde", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", "sp-consensus", - "sp-core", - "sp-runtime", - "sp-state-machine", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "thiserror", ] [[package]] name = "sc-consensus-aura" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "futures", @@ -10845,25 +11564,25 @@ dependencies = [ "sc-consensus", "sc-consensus-slots", "sc-telemetry", - "sp-api", - "sp-application-crypto", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-aura", "sp-consensus-slots", - "sp-core", - "sp-inherents", - "sp-keystore", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "thiserror", ] [[package]] name = "sc-consensus-babe" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "fork-tree", @@ -10880,50 +11599,50 @@ dependencies = [ "sc-consensus-slots", "sc-telemetry", "sc-transaction-pool-api", - "scale-info", - "sp-api", - "sp-application-crypto", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-babe", "sp-consensus-slots", - "sp-core", - "sp-inherents", - "sp-keystore", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "thiserror", ] [[package]] name = "sc-consensus-babe-rpc" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", - "jsonrpsee", + "jsonrpsee 0.20.3", "sc-consensus-babe", "sc-consensus-epochs", "sc-rpc-api", "serde", - "sp-api", - "sp-application-crypto", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", "sp-consensus", "sp-consensus-babe", - "sp-core", - "sp-keystore", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sc-consensus-beefy" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "array-bytes", + "array-bytes 6.2.2", "async-channel 1.9.0", "async-trait", "fnv", @@ -10937,28 +11656,30 @@ dependencies = [ "sc-network-gossip", "sc-network-sync", "sc-utils", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", "sp-consensus", "sp-consensus-beefy", - "sp-core", - "sp-keystore", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-mmr-primitives", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "thiserror", + "tokio", "wasm-timer", ] [[package]] name = "sc-consensus-beefy-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", - "jsonrpsee", + "jsonrpsee 0.20.3", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -10966,31 +11687,31 @@ dependencies = [ "sc-rpc", "serde", "sp-consensus-beefy", - "sp-core", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sc-consensus-epochs" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "fork-tree", "parity-scale-codec", "sc-client-api", "sc-consensus", "sp-blockchain", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sc-consensus-grandpa" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.19.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "ahash 0.8.6", - "array-bytes", + "ahash 0.8.11", + "array-bytes 6.2.2", "async-trait", "dyn-clone", "finality-grandpa", @@ -11000,7 +11721,7 @@ dependencies = [ "log", "parity-scale-codec", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "sc-block-builder", "sc-chain-spec", "sc-client-api", @@ -11008,31 +11729,33 @@ dependencies = [ "sc-network", "sc-network-common", "sc-network-gossip", + "sc-network-sync", "sc-telemetry", "sc-transaction-pool-api", "sc-utils", "serde_json", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", "sp-consensus", "sp-consensus-grandpa", - "sp-core", - "sp-keystore", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "thiserror", ] [[package]] name = "sc-consensus-grandpa-rpc" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.19.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "finality-grandpa", "futures", - "jsonrpsee", + "jsonrpsee 0.20.3", "log", "parity-scale-codec", "sc-client-api", @@ -11040,15 +11763,15 @@ dependencies = [ "sc-rpc", "serde", "sp-blockchain", - "sp-core", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sc-consensus-slots" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "futures", @@ -11058,71 +11781,72 @@ dependencies = [ "sc-client-api", "sc-consensus", "sc-telemetry", - "sp-arithmetic", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", "sp-consensus", "sp-consensus-slots", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sc-executor" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", "sc-executor-common", "sc-executor-wasmtime", "schnellru", - "sp-api", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-io", - "sp-panic-handler", - "sp-runtime-interface 17.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-trie", - "sp-version", - "sp-wasm-interface 14.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-panic-handler 13.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tracing", ] [[package]] name = "sc-executor-common" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.29.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", - "sp-wasm-interface 14.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "wasm-instrument", ] [[package]] name = "sc-executor-wasmtime" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.29.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "anyhow", "cfg-if", "libc", "log", + "parking_lot 0.12.1", "rustix 0.36.17", "sc-allocator", "sc-executor-common", - "sp-runtime-interface 17.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-wasm-interface 14.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "wasmtime", ] [[package]] name = "sc-informant" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "ansi_term", "futures", @@ -11131,30 +11855,60 @@ dependencies = [ "sc-client-api", "sc-network", "sc-network-common", + "sc-network-sync", "sp-blockchain", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sc-keystore" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "25.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "array-bytes", + "array-bytes 6.2.2", "parking_lot 0.12.1", "serde_json", - "sp-application-crypto", - "sp-core", - "sp-keystore", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "thiserror", +] + +[[package]] +name = "sc-mixnet" +version = "0.4.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "array-bytes 4.2.0", + "arrayvec 0.7.4", + "blake2 0.10.6", + "bytes", + "futures", + "futures-timer", + "libp2p-identity", + "log", + "mixnet", + "multiaddr", + "parity-scale-codec", + "parking_lot 0.12.1", + "sc-client-api", + "sc-network", + "sc-transaction-pool-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-consensus", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-mixnet", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sc-network" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "array-bytes", + "array-bytes 6.2.2", "async-channel 1.9.0", "async-trait", "asynchronous-codec", @@ -11172,19 +11926,21 @@ dependencies = [ "parking_lot 0.12.1", "partial_sort", "pin-project", - "rand 0.8.5", + "rand", "sc-client-api", "sc-network-common", "sc-utils", "serde", "serde_json", "smallvec", - "sp-arithmetic", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", - "sp-core", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "thiserror", + "tokio", + "tokio-stream", "unsigned-varint", "wasm-timer", "zeroize", @@ -11192,28 +11948,28 @@ dependencies = [ [[package]] name = "sc-network-bitswap" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-channel 1.9.0", "cid", "futures", "libp2p-identity", "log", - "prost", + "prost 0.12.4", "prost-build", "sc-client-api", "sc-network", "sp-blockchain", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "unsigned-varint", ] [[package]] name = "sc-network-common" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "bitflags 1.3.2", @@ -11224,54 +11980,55 @@ dependencies = [ "sc-consensus", "sp-consensus", "sp-consensus-grandpa", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sc-network-gossip" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "futures", "futures-timer", "libp2p", "log", "sc-network", "sc-network-common", + "sc-network-sync", "schnellru", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "tracing", ] [[package]] name = "sc-network-light" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "array-bytes", + "array-bytes 6.2.2", "async-channel 1.9.0", "futures", "libp2p-identity", "log", "parity-scale-codec", - "prost", + "prost 0.12.4", "prost-build", "sc-client-api", "sc-network", "sp-blockchain", - "sp-core", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sc-network-sync" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "array-bytes", + "array-bytes 6.2.2", "async-channel 1.9.0", "async-trait", "fork-tree", @@ -11281,7 +12038,7 @@ dependencies = [ "log", "mockall", "parity-scale-codec", - "prost", + "prost 0.12.4", "prost-build", "sc-client-api", "sc-consensus", @@ -11290,40 +12047,43 @@ dependencies = [ "sc-utils", "schnellru", "smallvec", - "sp-arithmetic", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", "sp-consensus", "sp-consensus-grandpa", - "sp-core", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", "thiserror", + "tokio", + "tokio-stream", ] [[package]] name = "sc-network-transactions" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "array-bytes", + "array-bytes 6.2.2", "futures", "libp2p", "log", "parity-scale-codec", "sc-network", "sc-network-common", + "sc-network-sync", "sc-utils", "sp-consensus", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-prometheus-endpoint", ] [[package]] name = "sc-offchain" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "array-bytes", + "array-bytes 6.2.2", "bytes", "fnv", "futures", @@ -11336,26 +12096,26 @@ dependencies = [ "once_cell", "parity-scale-codec", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "sc-client-api", "sc-network", "sc-network-common", "sc-transaction-pool-api", "sc-utils", - "sp-api", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-keystore", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-offchain", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "threadpool", "tracing", ] [[package]] name = "sc-proposer-metrics" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.17.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -11363,61 +12123,63 @@ dependencies = [ [[package]] name = "sc-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", - "jsonrpsee", + "jsonrpsee 0.20.3", "log", "parity-scale-codec", "parking_lot 0.12.1", "sc-block-builder", "sc-chain-spec", "sc-client-api", + "sc-mixnet", "sc-rpc-api", "sc-tracing", "sc-transaction-pool-api", "sc-utils", "serde_json", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", - "sp-core", - "sp-keystore", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-offchain", "sp-rpc", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", "sp-statement-store", - "sp-version", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tokio", ] [[package]] name = "sc-rpc-api" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.20.3", "parity-scale-codec", "sc-chain-spec", + "sc-mixnet", "sc-transaction-pool-api", "scale-info", "serde", "serde_json", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-rpc", - "sp-runtime", - "sp-version", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sc-rpc-server" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "http", - "jsonrpsee", + "jsonrpsee 0.20.3", "log", "serde_json", "substrate-prometheus-endpoint", @@ -11428,27 +12190,29 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "array-bytes", + "array-bytes 6.2.2", "futures", "futures-util", "hex", - "jsonrpsee", + "jsonrpsee 0.20.3", "log", "parity-scale-codec", "parking_lot 0.12.1", "sc-chain-spec", "sc-client-api", + "sc-rpc", "sc-transaction-pool-api", "sc-utils", "serde", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", - "sp-core", - "sp-runtime", - "sp-version", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-rpc", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tokio", "tokio-stream", @@ -11456,21 +12220,20 @@ dependencies = [ [[package]] name = "sc-service" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.35.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "directories", "exit-future", "futures", "futures-timer", - "jsonrpsee", + "jsonrpsee 0.20.3", "log", "parity-scale-codec", "parking_lot 0.12.1", "pin-project", - "rand 0.8.5", - "sc-block-builder", + "rand", "sc-chain-spec", "sc-client-api", "sc-client-db", @@ -11495,20 +12258,20 @@ dependencies = [ "sc-utils", "serde", "serde_json", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", "sp-consensus", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-keystore", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-state-machine", - "sp-storage", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", "sp-transaction-storage-proof", - "sp-trie", - "sp-version", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "static_init", "substrate-prometheus-endpoint", "tempfile", @@ -11520,35 +12283,34 @@ dependencies = [ [[package]] name = "sc-state-db" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.30.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "log", "parity-scale-codec", "parking_lot 0.12.1", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sc-storage-monitor" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.16.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "clap", "fs4", "log", - "sc-client-db", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tokio", ] [[package]] name = "sc-sync-state-rpc" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.20.3", "parity-scale-codec", "sc-chain-spec", "sc-client-api", @@ -11558,33 +12320,35 @@ dependencies = [ "serde", "serde_json", "sp-blockchain", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sc-sysinfo" -version = "6.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ + "derive_more", "futures", "libc", "log", - "rand 0.8.5", + "rand", "rand_pcg", "regex", "sc-telemetry", "serde", "serde_json", - "sp-core", - "sp-io", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sc-telemetry" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "15.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "chrono", "futures", @@ -11592,7 +12356,7 @@ dependencies = [ "log", "parking_lot 0.12.1", "pin-project", - "rand 0.8.5", + "rand", "sc-utils", "serde", "serde_json", @@ -11602,48 +12366,49 @@ dependencies = [ [[package]] name = "sc-tracing" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "ansi_term", - "atty", "chrono", + "is-terminal", "lazy_static", "libc", "log", + "parity-scale-codec", "parking_lot 0.12.1", "regex", "rustc-hash", "sc-client-api", "sc-tracing-proc-macro", "serde", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-rpc", - "sp-runtime", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing", - "tracing-log", - "tracing-subscriber", + "tracing-log 0.1.4", + "tracing-subscriber 0.2.25", ] [[package]] name = "sc-tracing-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "sc-transaction-pool" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "futures", @@ -11656,11 +12421,12 @@ dependencies = [ "sc-transaction-pool-api", "sc-utils", "serde", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-blockchain", - "sp-core", - "sp-runtime", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", "substrate-prometheus-endpoint", "thiserror", @@ -11668,8 +12434,8 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "futures", @@ -11677,15 +12443,15 @@ dependencies = [ "parity-scale-codec", "serde", "sp-blockchain", - "sp-core", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sc-utils" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-channel 1.9.0", "futures", @@ -11694,14 +12460,14 @@ dependencies = [ "log", "parking_lot 0.12.1", "prometheus", - "sp-arithmetic", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "scale-info" -version = "2.10.0" +version = "2.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" +checksum = "7c453e59a955f81fb62ee5d596b450383d699f152d350e9d23a0db2adb78e4c0" dependencies = [ "bitvec", "cfg-if", @@ -11713,9 +12479,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.10.0" +version = "2.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" +checksum = "18cf6c6447f813ef19eb450e985bcce6705f9ce7660db221b59093d15c79c4b7" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -11725,11 +12491,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -11738,42 +12504,43 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.11", "cfg-if", "hashbrown 0.13.2", ] [[package]] name = "schnorrkel" -version = "0.9.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" +checksum = "844b7645371e6ecdf61ff246ba1958c29e802881a749ae3fb1993675d210d28d" dependencies = [ "arrayref", - "arrayvec 0.5.2", - "curve25519-dalek 2.1.3", - "getrandom 0.1.16", - "merlin 2.0.1", - "rand 0.7.3", - "rand_core 0.5.1", - "sha2 0.8.2", - "subtle", + "arrayvec 0.7.4", + "curve25519-dalek-ng", + "merlin", + "rand_core 0.6.4", + "sha2 0.9.9", + "subtle-ng", "zeroize", ] [[package]] name = "schnorrkel" -version = "0.10.2" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "844b7645371e6ecdf61ff246ba1958c29e802881a749ae3fb1993675d210d28d" +checksum = "8de18f6d8ba0aad7045f5feae07ec29899c1112584a38509a84ad7b04451eaa0" dependencies = [ + "aead", "arrayref", "arrayvec 0.7.4", - "curve25519-dalek-ng", - "merlin 3.0.0", + "curve25519-dalek 4.1.2", + "getrandom_or_panic", + "merlin", "rand_core 0.6.4", - "sha2 0.9.9", - "subtle-ng", + "serde_bytes", + "sha2 0.10.8", + "subtle 2.5.0", "zeroize", ] @@ -11795,7 +12562,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -11809,24 +12576,33 @@ dependencies = [ "der", "generic-array 0.14.7", "pkcs8", - "subtle", + "subtle 2.5.0", "zeroize", ] +[[package]] +name = "seccompiler" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345a3e4dddf721a478089d4697b83c6c0a8f5bf16086f6c13397e4534eb6e2e5" +dependencies = [ + "libc", +] + [[package]] name = "secp256k1" -version = "0.24.3" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.6.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" dependencies = [ "cc", ] @@ -11842,9 +12618,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -11855,9 +12631,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys", "libc", @@ -11874,9 +12650,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" dependencies = [ "serde", ] @@ -11889,29 +12665,38 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] +[[package]] +name = "serde_bytes" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" +dependencies = [ + "serde", +] + [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "itoa", "ryu", @@ -11920,9 +12705,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] @@ -11937,19 +12722,18 @@ dependencies = [ "cfg-if", "cpufeatures", "digest 0.9.0", - "opaque-debug 0.3.0", + "opaque-debug 0.3.1", ] [[package]] -name = "sha2" -version = "0.8.2" +name = "sha1" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", + "cfg-if", + "cpufeatures", + "digest 0.10.7", ] [[package]] @@ -11962,7 +12746,7 @@ dependencies = [ "cfg-if", "cpufeatures", "digest 0.9.0", - "opaque-debug 0.3.0", + "opaque-debug 0.3.1", ] [[package]] @@ -11997,9 +12781,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" @@ -12033,6 +12817,11 @@ dependencies = [ "wide", ] +[[package]] +name = "simple-mermaid" +version = "0.1.0" +source = "git+https://github.com/kianenigma/simple-mermaid.git?rev=e48b187bcfd5cc75111acd9d241f1bd36604344b#e48b187bcfd5cc75111acd9d241f1bd36604344b" + [[package]] name = "siphasher" version = "0.3.11" @@ -12056,14 +12845,14 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "slot-range-helper" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "enumn", "parity-scale-codec", "paste", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] @@ -12077,9 +12866,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smol" @@ -12107,10 +12896,10 @@ dependencies = [ "arrayvec 0.7.4", "async-lock 2.8.0", "atomic-take", - "base64 0.21.5", + "base64 0.21.7", "bip39", "blake2-rfc", - "bs58 0.5.0", + "bs58 0.5.1", "chacha20", "crossbeam-queue", "derive_more", @@ -12125,7 +12914,7 @@ dependencies = [ "hmac 0.12.1", "itertools 0.11.0", "libsecp256k1", - "merlin 3.0.0", + "merlin", "no-std-net", "nom", "num-bigint", @@ -12134,7 +12923,7 @@ dependencies = [ "pbkdf2 0.12.2", "pin-project", "poly1305", - "rand 0.8.5", + "rand", "rand_chacha 0.3.1", "ruzstd", "schnorrkel 0.10.2", @@ -12148,7 +12937,7 @@ dependencies = [ "soketto", "twox-hash", "wasmi", - "x25519-dalek 2.0.0", + "x25519-dalek 2.0.1", "zeroize", ] @@ -12160,7 +12949,7 @@ checksum = "256b5bad1d6b49045e95fe87492ce73d5af81545d8b4d8318a872d2007024c33" dependencies = [ "async-channel 1.9.0", "async-lock 2.8.0", - "base64 0.21.5", + "base64 0.21.7", "blake2-rfc", "derive_more", "either", @@ -12177,7 +12966,7 @@ dependencies = [ "no-std-net", "parking_lot 0.12.1", "pin-project", - "rand 0.8.5", + "rand", "rand_chacha 0.3.1", "serde", "serde_json", @@ -12196,19 +12985,19 @@ checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" [[package]] name = "snow" -version = "0.9.4" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58021967fd0a5eeeb23b08df6cc244a4d4a5b4aec1d27c9e02fad1a58b4cd74e" +checksum = "850948bee068e713b8ab860fe1adc4d109676ab4c3b621fd8147f06b261f2f85" dependencies = [ "aes-gcm", - "blake2", + "blake2 0.10.6", "chacha20poly1305", - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "rand_core 0.6.4", - "ring 0.17.7", + "ring 0.17.8", "rustc_version", "sha2 0.10.8", - "subtle", + "subtle 2.5.0", ] [[package]] @@ -12223,12 +13012,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -12244,265 +13033,411 @@ dependencies = [ "http", "httparse", "log", - "rand 0.8.5", + "rand", "sha-1", ] [[package]] name = "sp-api" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ - "hash-db 0.16.0", + "hash-db", "log", "parity-scale-codec", "scale-info", - "sp-api-proc-macro", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-metadata-ir", - "sp-runtime", - "sp-state-machine", - "sp-std", - "sp-trie", - "sp-version", + "sp-api-proc-macro 15.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-metadata-ir 0.6.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "thiserror", +] + +[[package]] +name = "sp-api" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "scale-info", + "sp-api-proc-macro 15.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-metadata-ir 0.6.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sp-api-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "15.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "Inflector", - "blake2", - "expander 2.0.0", - "proc-macro-crate 1.3.1", + "blake2 0.10.6", + "expander 2.1.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] -name = "sp-application-crypto" -version = "23.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +name = "sp-api-proc-macro" +version = "15.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-std", + "Inflector", + "blake2 0.10.6", + "expander 2.1.0", + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.58", +] + +[[package]] +name = "sp-application-crypto" +version = "30.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", +] + +[[package]] +name = "sp-application-crypto" +version = "30.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-arithmetic" -version = "16.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "23.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-std", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", "static_assertions", ] +[[package]] +name = "sp-arithmetic" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "static_assertions", +] + +[[package]] +name = "sp-ark-bls12-381" +version = "0.4.2" +source = "git+https://github.com/paritytech/arkworks-substrate#caa2eed74beb885dd07c7db5f916f2281dad818f" +dependencies = [ + "ark-bls12-381-ext", + "sp-crypto-ec-utils", +] + +[[package]] +name = "sp-ark-ed-on-bls12-381-bandersnatch" +version = "0.4.2" +source = "git+https://github.com/paritytech/arkworks-substrate#caa2eed74beb885dd07c7db5f916f2281dad818f" +dependencies = [ + "ark-ed-on-bls12-381-bandersnatch-ext", + "sp-crypto-ec-utils", +] + [[package]] name = "sp-authority-discovery" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", "scale-info", - "sp-api", - "sp-application-crypto", - "sp-runtime", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-block-builder" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "sp-api", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-blockchain" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", "log", "parity-scale-codec", "parking_lot 0.12.1", "schnellru", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus", "sp-database", - "sp-runtime", - "sp-state-machine", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sp-consensus" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "futures", "log", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-state-machine", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sp-consensus-aura" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "parity-scale-codec", "scale-info", - "sp-api", - "sp-application-crypto", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus-slots", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", ] [[package]] name = "sp-consensus-babe" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "parity-scale-codec", "scale-info", "serde", - "sp-api", - "sp-application-crypto", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus-slots", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", ] [[package]] name = "sp-consensus-beefy" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "lazy_static", "parity-scale-codec", "scale-info", "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-io", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-mmr-primitives", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "strum 0.24.1", ] [[package]] name = "sp-consensus-grandpa" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "finality-grandpa", "log", "parity-scale-codec", "scale-info", "serde", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-keystore", - "sp-runtime", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-consensus-slots" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-std", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", ] [[package]] name = "sp-core" -version = "21.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ - "array-bytes", - "arrayvec 0.7.4", + "array-bytes 6.2.2", "bandersnatch_vrfs", + "bip39", "bitflags 1.3.2", - "blake2", + "blake2 0.10.6", "bounded-collections", - "bs58 0.5.0", + "bs58 0.5.1", "dyn-clonable", "ed25519-zebra 3.1.0", "futures", - "hash-db 0.16.0", + "hash-db", "hash256-std-hasher", "impl-serde", - "lazy_static", + "itertools 0.10.5", "libsecp256k1", "log", - "merlin 2.0.1", + "merlin", "parity-scale-codec", "parking_lot 0.12.1", "paste", "primitive-types", - "rand 0.8.5", - "regex", + "rand", "scale-info", - "schnorrkel 0.9.1", + "schnorrkel 0.11.4", "secp256k1", "secrecy", "serde", - "sp-core-hashing", - "sp-debug-derive", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-runtime-interface 17.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-std", - "sp-storage", + "sp-crypto-hashing 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-debug-derive 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39", "tracing", + "w3f-bls", "zeroize", ] [[package]] -name = "sp-core-hashing" -version = "9.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +name = "sp-core" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "array-bytes 6.2.2", + "bandersnatch_vrfs", + "bip39", + "bitflags 1.3.2", + "blake2 0.10.6", + "bounded-collections", + "bs58 0.5.1", + "dyn-clonable", + "ed25519-zebra 3.1.0", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde", + "itertools 0.10.5", + "libsecp256k1", + "log", + "merlin", + "parity-scale-codec", + "parking_lot 0.12.1", + "paste", + "primitive-types", + "rand", + "scale-info", + "schnorrkel 0.11.4", + "secp256k1", + "secrecy", + "serde", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tracing", + "w3f-bls", + "zeroize", +] + +[[package]] +name = "sp-crypto-ec-utils" +version = "0.10.0" +source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +dependencies = [ + "ark-bls12-377", + "ark-bls12-377-ext", + "ark-bls12-381", + "ark-bls12-381-ext", + "ark-bw6-761", + "ark-bw6-761-ext", + "ark-ec", + "ark-ed-on-bls12-377", + "ark-ed-on-bls12-377-ext", + "ark-ed-on-bls12-381-bandersnatch", + "ark-ed-on-bls12-381-bandersnatch-ext", + "ark-scale", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk)", +] + +[[package]] +name = "sp-crypto-hashing" +version = "0.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "blake2b_simd", "byteorder", @@ -12513,19 +13448,42 @@ dependencies = [ ] [[package]] -name = "sp-core-hashing-proc-macro" -version = "9.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +name = "sp-crypto-hashing" +version = "0.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "blake2b_simd", + "byteorder", + "digest 0.10.7", + "sha2 0.10.8", + "sha3", + "twox-hash", +] + +[[package]] +name = "sp-crypto-hashing-proc-macro" +version = "0.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "quote", - "sp-core-hashing", - "syn 2.0.39", + "sp-crypto-hashing 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "syn 2.0.58", +] + +[[package]] +name = "sp-crypto-hashing-proc-macro" +version = "0.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "quote", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "syn 2.0.58", ] [[package]] name = "sp-database" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -12533,65 +13491,120 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "8.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "14.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.58", +] + +[[package]] +name = "sp-debug-derive" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", +] + +[[package]] +name = "sp-debug-derive" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.58", ] [[package]] name = "sp-externalities" -version = "0.19.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.1.0#4b7e06d11031f759e2e151eb35a805499a3e284b" +version = "0.25.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "environmental", "parity-scale-codec", - "sp-std", - "sp-storage", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", ] [[package]] name = "sp-externalities" -version = "0.19.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.25.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", +] + +[[package]] +name = "sp-externalities" +version = "0.25.0" +source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" dependencies = [ "environmental", "parity-scale-codec", - "sp-std", - "sp-storage", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk)", ] [[package]] name = "sp-genesis-builder" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.7.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" +dependencies = [ + "serde_json", + "sp-api 26.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", +] + +[[package]] +name = "sp-genesis-builder" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "serde_json", - "sp-api", - "sp-runtime", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-inherents" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-runtime", - "sp-std", + "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "thiserror", +] + +[[package]] +name = "sp-inherents" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "async-trait", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sp-io" -version = "23.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "30.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "bytes", "ed25519-dalek", @@ -12600,45 +13613,82 @@ dependencies = [ "parity-scale-codec", "rustversion", "secp256k1", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-keystore", - "sp-runtime-interface 17.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-state-machine", - "sp-std", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-trie", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-io" +version = "30.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "bytes", + "ed25519-dalek", + "libsecp256k1", + "log", + "parity-scale-codec", + "rustversion", + "secp256k1", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tracing", "tracing-core", ] [[package]] name = "sp-keyring" -version = "24.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "31.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "lazy_static", - "sp-core", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "strum 0.24.1", ] [[package]] name = "sp-keystore" -version = "0.27.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.34.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" +dependencies = [ + "parity-scale-codec", + "parking_lot 0.12.1", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "thiserror", +] + +[[package]] +name = "sp-keystore" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sp-maybe-compressed-blob" -version = "4.1.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "thiserror", "zstd 0.12.4", @@ -12646,61 +13696,94 @@ dependencies = [ [[package]] name = "sp-metadata-ir" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.6.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" +dependencies = [ + "frame-metadata", + "parity-scale-codec", + "scale-info", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", +] + +[[package]] +name = "sp-metadata-ir" +version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "frame-metadata", "parity-scale-codec", "scale-info", - "sp-std", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", +] + +[[package]] +name = "sp-mixnet" +version = "0.4.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-mmr-primitives" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "ckb-merkle-mountain-range", "log", "parity-scale-codec", "scale-info", "serde", - "sp-api", - "sp-core", - "sp-debug-derive", - "sp-runtime", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sp-npos-elections" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic", - "sp-core", - "sp-runtime", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-offchain" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "sp-api", - "sp-core", - "sp-runtime", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-panic-handler" -version = "8.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "13.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" +dependencies = [ + "backtrace", + "lazy_static", + "regex", +] + +[[package]] +name = "sp-panic-handler" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "backtrace", "lazy_static", @@ -12709,339 +13792,559 @@ dependencies = [ [[package]] name = "sp-rpc" -version = "6.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "rustc-hash", "serde", - "sp-core", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-runtime" -version = "24.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "31.0.1" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ + "docify", "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", "parity-scale-codec", "paste", - "rand 0.8.5", + "rand", "scale-info", "serde", - "sp-application-crypto", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-std", - "sp-weights", + "simple-mermaid", + "sp-application-crypto 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", +] + +[[package]] +name = "sp-runtime" +version = "31.0.1" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "docify", + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "paste", + "rand", + "scale-info", + "serde", + "simple-mermaid", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-runtime-interface" -version = "17.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.1.0#4b7e06d11031f759e2e151eb35a805499a3e284b" +version = "24.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.19.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.1.0)", - "sp-runtime-interface-proc-macro 11.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.1.0)", - "sp-std", - "sp-storage", - "sp-tracing 10.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.1.0)", - "sp-wasm-interface 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.1.0)", + "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-wasm-interface 20.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", "static_assertions", ] [[package]] name = "sp-runtime-interface" -version = "17.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "24.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-runtime-interface-proc-macro 11.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-std", - "sp-storage", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-wasm-interface 14.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface" +version = "24.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "polkavm-derive", + "primitive-types", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk)", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "11.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.1.0#4b7e06d11031f759e2e151eb35a805499a3e284b" +version = "17.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "Inflector", - "proc-macro-crate 1.3.1", + "expander 2.1.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "11.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "17.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "Inflector", - "proc-macro-crate 1.3.1", + "expander 2.1.0", + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.58", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "17.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +dependencies = [ + "Inflector", + "expander 2.1.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "sp-session" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", "scale-info", - "sp-api", - "sp-core", - "sp-keystore", - "sp-runtime", - "sp-staking", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-staking" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", "scale-info", "serde", - "sp-core", - "sp-runtime", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", +] + +[[package]] +name = "sp-staking" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-state-machine" -version = "0.28.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.35.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ - "hash-db 0.16.0", + "hash-db", "log", "parity-scale-codec", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "smallvec", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-panic-handler", - "sp-std", - "sp-trie", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-panic-handler 13.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", "thiserror", "tracing", - "trie-db 0.27.1", + "trie-db", +] + +[[package]] +name = "sp-state-machine" +version = "0.35.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "parking_lot 0.12.1", + "rand", + "smallvec", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-panic-handler 13.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "thiserror", + "tracing", + "trie-db", ] [[package]] name = "sp-statement-store" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "aes-gcm", - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "ed25519-dalek", "hkdf", "parity-scale-codec", - "rand 0.8.5", + "rand", "scale-info", "sha2 0.10.8", - "sp-api", - "sp-application-crypto", - "sp-core", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-runtime", - "sp-runtime-interface 17.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-std", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", - "x25519-dalek 2.0.0", + "x25519-dalek 2.0.1", ] [[package]] name = "sp-std" -version = "8.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "14.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" + +[[package]] +name = "sp-std" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" + +[[package]] +name = "sp-std" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" [[package]] name = "sp-storage" -version = "13.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "19.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", +] + +[[package]] +name = "sp-storage" +version = "19.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive", - "sp-std", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", +] + +[[package]] +name = "sp-storage" +version = "19.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk)", ] [[package]] name = "sp-timestamp" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "parity-scale-codec", - "sp-inherents", - "sp-runtime", - "sp-std", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sp-tracing" -version = "10.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.1.0#4b7e06d11031f759e2e151eb35a805499a3e284b" +version = "16.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "parity-scale-codec", - "sp-std", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", "tracing", "tracing-core", - "tracing-subscriber", + "tracing-subscriber 0.2.25", ] [[package]] name = "sp-tracing" -version = "10.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "16.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", - "sp-std", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tracing", "tracing-core", - "tracing-subscriber", + "tracing-subscriber 0.2.25", +] + +[[package]] +name = "sp-tracing" +version = "16.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +dependencies = [ + "parity-scale-codec", + "tracing", + "tracing-core", + "tracing-subscriber 0.3.18", ] [[package]] name = "sp-transaction-pool" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "sp-api", - "sp-runtime", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-transaction-storage-proof" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "parity-scale-codec", "scale-info", - "sp-core", - "sp-inherents", - "sp-runtime", - "sp-std", - "sp-trie", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "sp-trie" -version = "22.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "29.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ - "ahash 0.8.6", - "hash-db 0.16.0", - "hashbrown 0.13.2", + "ahash 0.8.11", + "hash-db", "lazy_static", "memory-db", "nohash-hasher", "parity-scale-codec", "parking_lot 0.12.1", + "rand", "scale-info", "schnellru", - "sp-core", - "sp-std", + "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", "thiserror", "tracing", - "trie-db 0.27.1", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-trie" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "ahash 0.8.11", + "hash-db", + "lazy_static", + "memory-db", + "nohash-hasher", + "parity-scale-codec", + "parking_lot 0.12.1", + "rand", + "scale-info", + "schnellru", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "thiserror", + "tracing", + "trie-db", "trie-root", ] [[package]] name = "sp-version" -version = "22.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "29.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "impl-serde", "parity-scale-codec", "parity-wasm", "scale-info", "serde", - "sp-core-hashing-proc-macro", - "sp-runtime", - "sp-std", - "sp-version-proc-macro", + "sp-crypto-hashing-proc-macro 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-version-proc-macro 13.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "thiserror", +] + +[[package]] +name = "sp-version" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "parity-wasm", + "scale-info", + "serde", + "sp-crypto-hashing-proc-macro 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version-proc-macro 13.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] [[package]] name = "sp-version-proc-macro" -version = "8.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "13.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", +] + +[[package]] +name = "sp-version-proc-macro" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "parity-scale-codec", + "proc-macro2", + "quote", + "syn 2.0.58", ] [[package]] name = "sp-wasm-interface" -version = "14.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.1.0#4b7e06d11031f759e2e151eb35a805499a3e284b" +version = "20.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ "anyhow", "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", "wasmtime", ] [[package]] name = "sp-wasm-interface" -version = "14.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "20.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "anyhow", "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "wasmtime", ] [[package]] -name = "sp-weights" +name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +dependencies = [ + "impl-trait-for-tuples", + "log", + "parity-scale-codec", +] + +[[package]] +name = "sp-weights" +version = "27.0.0" +source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" dependencies = [ + "bounded-collections", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 23.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-debug-derive 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", +] + +[[package]] +name = "sp-weights" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "bounded-collections", "parity-scale-codec", "scale-info", "serde", "smallvec", - "sp-arithmetic", - "sp-core", - "sp-debug-derive", - "sp-std", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] @@ -13071,144 +14374,53 @@ dependencies = [ name = "spki" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "ss58-registry" -version = "1.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35935738370302d5e33963665b77541e4b990a3e919ec904c837a56cfc891de1" -dependencies = [ - "Inflector", - "num-format", - "proc-macro2", - "quote", - "serde", - "serde_json", - "unicode-xid", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "staging-kusama-runtime" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" -dependencies = [ - "binary-merkle-tree", - "bitvec", - "frame-benchmarking", - "frame-election-provider-support", - "frame-executive", - "frame-support", - "frame-system", - "frame-system-benchmarking", - "frame-system-rpc-runtime-api", - "frame-try-runtime", - "hex-literal 0.4.1", - "kusama-runtime-constants", - "log", - "pallet-authority-discovery", - "pallet-authorship", - "pallet-babe", - "pallet-bags-list", - "pallet-balances", - "pallet-beefy", - "pallet-beefy-mmr", - "pallet-bounties", - "pallet-child-bounties", - "pallet-collective", - "pallet-conviction-voting", - "pallet-democracy 4.0.0-dev", - "pallet-election-provider-multi-phase", - "pallet-election-provider-support-benchmarking", - "pallet-elections-phragmen", - "pallet-fast-unstake", - "pallet-grandpa", - "pallet-identity", - "pallet-im-online", - "pallet-indices", - "pallet-membership", - "pallet-message-queue", - "pallet-mmr", - "pallet-multisig", - "pallet-nis", - "pallet-nomination-pools", - "pallet-nomination-pools-benchmarking", - "pallet-nomination-pools-runtime-api", - "pallet-offences", - "pallet-offences-benchmarking", - "pallet-preimage", - "pallet-proxy", - "pallet-ranked-collective", - "pallet-recovery", - "pallet-referenda", - "pallet-scheduler", - "pallet-session", - "pallet-session-benchmarking", - "pallet-society", - "pallet-staking 4.0.0-dev", - "pallet-staking-runtime-api", - "pallet-state-trie-migration", - "pallet-timestamp", - "pallet-tips", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", - "pallet-treasury", - "pallet-utility", - "pallet-vesting", - "pallet-whitelist", - "pallet-xcm", - "pallet-xcm-benchmarks", +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "ss58-registry" +version = "1.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4743ce898933fbff7bbf414f497c459a782d496269644b3d650a398ae6a487ba" +dependencies = [ + "Inflector", + "num-format", + "proc-macro2", + "quote", + "serde", + "serde_json", + "unicode-xid", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "staging-parachain-info" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" +dependencies = [ + "cumulus-primitives-core", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "parity-scale-codec", - "polkadot-primitives", - "polkadot-runtime-common", - "polkadot-runtime-parachains", - "rustc-hex", "scale-info", - "serde", - "serde_derive", - "smallvec", - "sp-api", - "sp-application-crypto", - "sp-arithmetic", - "sp-authority-discovery", - "sp-block-builder", - "sp-consensus-babe", - "sp-consensus-beefy", - "sp-core", - "sp-inherents", - "sp-io", - "sp-mmr-primitives", - "sp-npos-elections", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-staking", - "sp-std", - "sp-storage", - "sp-transaction-pool", - "sp-version", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", - "static_assertions", - "substrate-wasm-builder", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "staging-xcm" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ + "array-bytes 6.2.2", "bounded-collections", "derivative", "environmental", @@ -13217,49 +14429,50 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-weights", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "xcm-procedural", ] [[package]] name = "staging-xcm-builder" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "log", "pallet-transaction-payment", "parity-scale-codec", "polkadot-parachain-primitives", "scale-info", - "sp-arithmetic", - "sp-io", - "sp-runtime", - "sp-std", - "sp-weights", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-executor", ] [[package]] name = "staging-xcm-executor" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "environmental", - "frame-benchmarking", - "frame-support", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-weights", + "scale-info", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", ] @@ -13297,11 +14510,24 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "strobe-rs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabb238a1cccccfa4c4fb703670c0d157e1256c1ba695abf1b93bd2bb14bab2d" +dependencies = [ + "bitflags 1.3.2", + "byteorder", + "keccak", + "subtle 2.5.0", + "zeroize", +] + [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" @@ -13314,9 +14540,9 @@ dependencies = [ [[package]] name = "strum" -version = "0.25.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" [[package]] name = "strum_macros" @@ -13324,7 +14550,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", @@ -13333,58 +14559,58 @@ dependencies = [ [[package]] name = "strum_macros" -version = "0.25.3" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "substrate-bip39" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e620c7098893ba667438b47169c00aacdd9e7c10e042250ce2b60b087ec97328" +checksum = "6a7590dc041b9bc2825e52ce5af8416c73dbe9d0654402bfd4b4941938b94d8f" dependencies = [ "hmac 0.11.0", "pbkdf2 0.8.0", - "schnorrkel 0.9.1", + "schnorrkel 0.11.4", "sha2 0.9.9", "zeroize", ] [[package]] name = "substrate-build-script-utils" -version = "3.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" [[package]] name = "substrate-frame-rpc-system" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "frame-system-rpc-runtime-api", "futures", - "jsonrpsee", + "jsonrpsee 0.20.3", "log", "parity-scale-codec", "sc-rpc-api", "sc-transaction-pool-api", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-block-builder", "sp-blockchain", - "sp-core", - "sp-runtime", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "substrate-prometheus-endpoint" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.17.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "hyper", "log", @@ -13395,57 +14621,63 @@ dependencies = [ [[package]] name = "substrate-rpc-client" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", - "jsonrpsee", + "jsonrpsee 0.20.3", "log", "sc-rpc-api", "serde", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] name = "substrate-state-trie-migration-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "jsonrpsee", + "jsonrpsee 0.20.3", "parity-scale-codec", "sc-client-api", "sc-rpc-api", "serde", - "sp-core", - "sp-runtime", - "sp-state-machine", - "sp-trie", - "trie-db 0.27.1", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "trie-db", ] [[package]] name = "substrate-wasm-builder" -version = "5.0.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "17.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "ansi_term", "build-helper", "cargo_metadata", + "console", "filetime", "parity-wasm", "sp-maybe-compressed-blob", "strum 0.24.1", "tempfile", - "toml 0.7.8", + "toml 0.8.12", "walkdir", "wasm-opt", ] [[package]] name = "subtle" -version = "2.4.1" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" + +[[package]] +name = "subtle" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "subtle-ng" @@ -13466,9 +14698,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" dependencies = [ "proc-macro2", "quote", @@ -13516,32 +14748,41 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.12" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tempfile" -version = "3.8.1" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", - "fastrand 2.0.1", - "redox_syscall 0.4.1", - "rustix 0.38.27", - "windows-sys 0.48.0", + "fastrand 2.0.2", + "rustix 0.38.32", + "windows-sys 0.52.0", ] [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix 0.38.32", + "windows-sys 0.48.0", +] + [[package]] name = "termtree" version = "0.4.1" @@ -13566,7 +14807,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -13577,15 +14818,24 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", "test-case-core", ] +[[package]] +name = "test-utils" +version = "1.1.1" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +dependencies = [ + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "pretty_assertions", +] + [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] @@ -13607,18 +14857,18 @@ checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -13629,9 +14879,9 @@ checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -13682,12 +14932,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -13702,32 +14953,14 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] -[[package]] -name = "tiny-bip39" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" -dependencies = [ - "anyhow", - "hmac 0.12.1", - "once_cell", - "pbkdf2 0.11.0", - "rand 0.8.5", - "rustc-hash", - "sha2 0.10.8", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", -] - [[package]] name = "tiny-keccak" version = "2.0.2" @@ -13754,9 +14987,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.34.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -13764,9 +14997,9 @@ dependencies = [ "mio", "num_cpus", "parking_lot 0.12.1", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "signal-hook-registry", - "socket2 0.5.5", + "socket2 0.5.6", "tokio-macros", "windows-sys 0.48.0", ] @@ -13779,7 +15012,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -13789,7 +15022,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" dependencies = [ "pin-project", - "rand 0.8.5", + "rand", "tokio", ] @@ -13805,12 +15038,12 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "tokio", "tokio-util", ] @@ -13825,7 +15058,7 @@ dependencies = [ "futures-core", "futures-io", "futures-sink", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "tokio", "tracing", ] @@ -13853,21 +15086,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.2" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.22.9", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] @@ -13878,24 +15111,46 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +dependencies = [ + "indexmap 2.2.6", + "toml_datetime", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.6", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" +dependencies = [ + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.6", ] [[package]] @@ -13904,6 +15159,10 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite 0.2.14", "tower-layer", "tower-service", "tracing", @@ -13915,14 +15174,14 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.5.0", "bytes", "futures-core", "futures-util", "http", "http-body", "http-range-header", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "tower-layer", "tower-service", ] @@ -13946,7 +15205,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "log", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "tracing-attributes", "tracing-core", ] @@ -13959,7 +15218,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -13984,11 +15243,10 @@ dependencies = [ [[package]] name = "tracing-gum" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "coarsetime", - "polkadot-node-jaeger", "polkadot-primitives", "tracing", "tracing-gum-proc-macro", @@ -13996,14 +15254,14 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "5.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "expander 2.0.0", - "proc-macro-crate 1.3.1", + "expander 2.1.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -14017,6 +15275,17 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + [[package]] name = "tracing-serde" version = "0.1.3" @@ -14036,7 +15305,7 @@ dependencies = [ "ansi_term", "chrono", "lazy_static", - "matchers", + "matchers 0.0.1", "parking_lot 0.11.2", "regex", "serde", @@ -14046,21 +15315,26 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log", + "tracing-log 0.1.4", "tracing-serde", ] [[package]] -name = "trie-db" -version = "0.27.1" +name = "tracing-subscriber" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "767abe6ffed88a1889671a102c2861ae742726f52e0a5a425b92c9fbfa7e9c85" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ - "hash-db 0.16.0", - "hashbrown 0.13.2", - "log", - "rustc-hex", + "matchers 0.1.0", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log 0.2.0", ] [[package]] @@ -14069,7 +15343,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff28e0f815c2fea41ebddf148e008b077d2faddb026c9555b29696114d602642" dependencies = [ - "hash-db 0.16.0", + "hash-db", "hashbrown 0.13.2", "log", "rustc-hex", @@ -14082,17 +15356,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4ed310ef5ab98f5fa467900ed906cb9232dd5376597e00fd4cba2a449d06c0b" dependencies = [ - "hash-db 0.16.0", -] - -[[package]] -name = "triehash" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1631b201eb031b563d2e85ca18ec8092508e262a3196ce9bd10a67ec87b9f5c" -dependencies = [ - "hash-db 0.15.2", - "rlp", + "hash-db", ] [[package]] @@ -14111,7 +15375,7 @@ dependencies = [ "idna 0.2.3", "ipnet", "lazy_static", - "rand 0.8.5", + "rand", "smallvec", "socket2 0.4.10", "thiserror", @@ -14149,8 +15413,8 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "try-runtime-cli" -version = "0.10.0-dev" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.38.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", "clap", @@ -14162,22 +15426,22 @@ dependencies = [ "sc-executor", "serde", "serde_json", - "sp-api", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-consensus-aura", "sp-consensus-babe", - "sp-core", - "sp-debug-derive", - "sp-externalities 0.19.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", - "sp-inherents", - "sp-io", - "sp-keystore", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-rpc", - "sp-runtime", - "sp-state-machine", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", "sp-transaction-storage-proof", - "sp-version", - "sp-weights", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-rpc-client", "zstd 0.12.4", ] @@ -14196,7 +15460,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", "digest 0.10.7", - "rand 0.8.5", + "rand", "static_assertions", ] @@ -14224,11 +15488,17 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -14264,7 +15534,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" dependencies = [ "crypto-common", - "subtle", + "subtle 2.5.0", ] [[package]] @@ -14332,6 +15602,39 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "w3f-bls" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7335e4c132c28cc43caef6adb339789e599e39adbe78da0c4d547fad48cbc331" +dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-serialize-derive", + "arrayref", + "constcat", + "digest 0.10.7", + "rand", + "rand_chacha 0.3.1", + "rand_core 0.6.4", + "sha2 0.10.8", + "sha3", + "thiserror", + "zeroize", +] + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + [[package]] name = "waker-fn" version = "1.1.1" @@ -14340,9 +15643,9 @@ checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -14369,11 +15672,20 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasix" +version = "0.12.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1fbb4ef9bbca0c1170e0b00dd28abc9e3b68669821600cad1caaed606583c6d" +dependencies = [ + "wasi 0.11.0+wasi-snapshot-preview1", +] + [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -14381,24 +15693,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -14408,9 +15720,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -14418,37 +15730,37 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-instrument" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" +checksum = "2a47ecb37b9734d1085eaa5ae1a81e60801fd8c28d4cabdd8aedb982021918bc" dependencies = [ "parity-wasm", ] [[package]] name = "wasm-opt" -version = "0.114.2" +version = "0.116.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effbef3bd1dde18acb401f73e740a6f3d4a1bc651e9773bddc512fe4d8d68f67" +checksum = "2fd87a4c135535ffed86123b6fb0f0a5a0bc89e50416c942c5f0662c645f679c" dependencies = [ "anyhow", "libc", @@ -14462,9 +15774,9 @@ dependencies = [ [[package]] name = "wasm-opt-cxx-sys" -version = "0.114.2" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c09e24eb283919ace2ed5733bda4842a59ce4c8de110ef5c6d98859513d17047" +checksum = "8c57b28207aa724318fcec6575fe74803c23f6f266fce10cbc9f3f116762f12e" dependencies = [ "anyhow", "cxx", @@ -14474,9 +15786,9 @@ dependencies = [ [[package]] name = "wasm-opt-sys" -version = "0.114.2" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f2f817bed2e8d65eb779fa37317e74de15585751f903c9118342d1970703a4" +checksum = "8a1cce564dc768dacbdb718fc29df2dba80bd21cb47d8f77ae7e3d95ceb98cbe" dependencies = [ "anyhow", "cc", @@ -14501,9 +15813,9 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.31.1" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acfc1e384a36ca532d070a315925887247f3c7e23567e23e0ac9b1c5d6b8bf76" +checksum = "77a8281d1d660cdf54c76a3efa9ddd0c270cada1383a995db3ccb43d166456c7" dependencies = [ "smallvec", "spin 0.9.8", @@ -14514,9 +15826,9 @@ dependencies = [ [[package]] name = "wasmi_arena" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468" +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" [[package]] name = "wasmi_core" @@ -14593,7 +15905,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c86437fa68626fe896e5afc69234bb2b5894949083586535f200385adfd71213" dependencies = [ "anyhow", - "base64 0.21.5", + "base64 0.21.7", "bincode", "directories-next", "file-per-thread-logger", @@ -14722,9 +16034,9 @@ dependencies = [ "log", "mach", "memfd", - "memoffset 0.8.0", + "memoffset", "paste", - "rand 0.8.5", + "rand", "rustix 0.36.17", "wasmtime-asm-macros", "wasmtime-environ", @@ -14746,9 +16058,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -14760,7 +16072,7 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -14773,29 +16085,24 @@ dependencies = [ "webpki", ] -[[package]] -name = "webpki-roots" -version = "0.25.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" - [[package]] name = "westend-runtime" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "binary-merkle-tree", "bitvec", - "frame-benchmarking", + "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-election-provider-support", "frame-executive", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", "hex-literal 0.4.1", "log", + "pallet-asset-rate", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", @@ -14804,7 +16111,8 @@ dependencies = [ "pallet-beefy", "pallet-beefy-mmr", "pallet-collective", - "pallet-democracy 4.0.0-dev", + "pallet-conviction-voting", + "pallet-democracy 28.0.0", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", "pallet-elections-phragmen", @@ -14825,11 +16133,13 @@ dependencies = [ "pallet-preimage", "pallet-proxy", "pallet-recovery", + "pallet-referenda", + "pallet-root-testing", "pallet-scheduler", "pallet-session", "pallet-session-benchmarking", "pallet-society", - "pallet-staking 4.0.0-dev", + "pallet-staking 28.0.0", "pallet-staking-reward-curve", "pallet-staking-runtime-api", "pallet-state-trie-migration", @@ -14840,6 +16150,7 @@ dependencies = [ "pallet-treasury", "pallet-utility", "pallet-vesting", + "pallet-whitelist", "pallet-xcm", "pallet-xcm-benchmarks", "parity-scale-codec", @@ -14852,25 +16163,27 @@ dependencies = [ "serde", "serde_derive", "smallvec", - "sp-api", - "sp-application-crypto", + "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-authority-discovery", "sp-block-builder", "sp-consensus-babe", "sp-consensus-beefy", - "sp-core", - "sp-inherents", - "sp-io", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-genesis-builder 0.7.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", - "sp-runtime", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-session", - "sp-staking", - "sp-std", - "sp-storage", + "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", - "sp-version", + "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -14880,16 +16193,18 @@ dependencies = [ [[package]] name = "westend-runtime-constants" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "polkadot-primitives", "polkadot-runtime-common", "smallvec", - "sp-core", - "sp-runtime", - "sp-weights", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "staging-xcm", + "staging-xcm-builder", ] [[package]] @@ -14901,14 +16216,14 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.27", + "rustix 0.38.32", ] [[package]] name = "wide" -version = "0.7.13" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68938b57b33da363195412cfc5fc37c9ed49aa9cfe2156fde64b8d2c9498242" +checksum = "89beec544f246e679fc25490e3f8e08003bc4bf612068f325120dad4cea02c1c" dependencies = [ "bytemuck", "safe_arch", @@ -14916,9 +16231,9 @@ dependencies = [ [[package]] name = "widestring" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" [[package]] name = "winapi" @@ -14957,7 +16272,7 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" dependencies = [ - "windows-core", + "windows-core 0.51.1", "windows-targets 0.48.5", ] @@ -14970,6 +16285,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows-sys" version = "0.45.0" @@ -14994,7 +16318,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.4", ] [[package]] @@ -15029,17 +16353,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -15056,9 +16380,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" @@ -15074,9 +16398,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" @@ -15092,9 +16416,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" @@ -15110,9 +16434,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" @@ -15128,9 +16452,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" @@ -15146,9 +16470,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" @@ -15164,15 +16488,24 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" + +[[package]] +name = "winnow" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] [[package]] name = "winnow" -version = "0.5.26" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67b5f0a4e7a27a64c651977932b9dc5667ca7fc31ac44b03ed37a0cf42fdfff" +checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352" dependencies = [ "memchr", ] @@ -15209,11 +16542,11 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" dependencies = [ - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "rand_core 0.6.4", "serde", "zeroize", @@ -15239,15 +16572,16 @@ dependencies = [ [[package]] name = "xcm-emulator" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "0.5.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-pallet-parachain-system", + "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-test-relay-sproof-builder", - "frame-support", - "frame-system", + "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "impl-trait-for-tuples", "lazy_static", "log", @@ -15259,25 +16593,26 @@ dependencies = [ "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-parachains", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "sp-tracing 10.0.0 (git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3)", + "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-executor", ] [[package]] name = "xcm-procedural" -version = "1.0.0" -source = "git+https://github.com/galacticcouncil/polkadot-sdk?rev=062d92eae0f3bb9908faf2d4e241eef17368b9d3#062d92eae0f3bb9908faf2d4e241eef17368b9d3" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -15290,7 +16625,7 @@ dependencies = [ "log", "nohash-hasher", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "static_assertions", ] @@ -15311,22 +16646,22 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.29" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d075cf85bbb114e933343e087b92f2146bac0d55b534cbb8188becf0039948e" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.29" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86cd5ca076997b97ef09d3ad65efe811fa68c9e874cb636ccb211223a813b0c2" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -15346,7 +16681,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.58", ] [[package]] @@ -15389,9 +16724,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" +version = "2.0.10+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index d0d34b6bb31..596b2653afa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,10 @@ members = [ 'node', 'runtime/basilisk', 'pallets/marketplace', + 'pallets/xyk', + 'pallets/asset-registry', + 'pallets/xyk-liquidity-mining', + 'pallets/xyk-liquidity-mining/benchmarking', 'integration-tests', ] @@ -13,405 +17,218 @@ members = [ primitive-types = { version = "0.12.0", default-features = false } log = "0.4.20" -hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -hydradx-traits = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -hydradx-adapters = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-relaychain-info = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-asset-registry = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-nft = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-currencies = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-transaction-pause = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-route-executor = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-liquidity-mining = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-ema-oracle = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-duster = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-collator-rewards = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -test-utils = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-xcm-rate-limiter = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-xyk = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -pallet-lbp = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994", default-features = false } -hydra-dx-build-script-utils = { git = "https://github.com/galacticcouncil/HydraDX-node", rev = "7e997371d7f2110f7719d2f279a153feb973b994" } +pallet-marketplace = { path = "pallets/marketplace"} +pallet-xyk = { path = "pallets/xyk"} +pallet-asset-registry = { path = "pallets/asset-registry"} +pallet-xyk-liquidity-mining = { path = "pallets/xyk-liquidity-mining"} +pallet-xyk-liquidity-mining-benchmarking = { path = "pallets/xyk-liquidity-mining/benchmarking"} -frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -frame-election-provider-support = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -frame-support-procedural = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -frame-support-procedural-tools = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -frame-support-procedural-tools-derive = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -frame-system = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-authorship = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-babe = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-bounties = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-collective = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-democracy = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-elections-phragmen = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-identity = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-im-online = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-indices = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-membership = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-offences = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-offences-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-recovery = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-scheduler = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-society = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-staking = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-staking-reward-curve = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-staking-reward-fn = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-state-trie-migration = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-tips = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-treasury = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-vesting = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-cli = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-client-db = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-consensus-babe = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-consensus-babe-rpc = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-consensus-epochs = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-consensus-slots = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-executor-common = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-executor-wasmtime = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-informant = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-keystore = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-network = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-network-common = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-network-gossip = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-rpc-api = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-rpc-server = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-service = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-sync-state-rpc = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-tracing = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-utils = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-api = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-application-crypto = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-arithmetic = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false} -sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-consensus = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-consensus-babe = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-consensus-slots = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-consensus-beefy = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-core = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-debug-derive = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-externalities = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-inherents = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-io = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-keyring = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-maybe-compressed-blob = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-npos-elections = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-offchain = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-rpc = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-runtime-interface = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-runtime-interface-proc-macro = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-session = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-staking = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-std = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-storage = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-tracing = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-trie = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-version = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-wasm-interface = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-mmr = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -sp-mmr-primitives = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -substrate-state-trie-migration-rpc = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901" } +hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +hydradx-adapters = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-relaychain-info = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-nft = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-currencies = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-transaction-pause = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-route-executor = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-liquidity-mining = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-ema-oracle = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-duster = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-collator-rewards = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +test-utils = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-xcm-rate-limiter = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-lbp = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +hydra-dx-build-script-utils = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2" } -kusama-runtime = { package = "staging-kusama-runtime", git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-node-network-protocol = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-node-primitives = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-node-subsystem = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-node-subsystem-util = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-overseer = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-parachain = { package = "polkadot-parachain-primitives", git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false, features = ["wasm-api"] } -polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-runtime = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-statement-table = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -rococo-runtime = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -westend-runtime = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -polkadot-xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -xcm-emulator = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +frame-election-provider-support = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +frame-support-procedural = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +frame-support-procedural-tools = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +frame-support-procedural-tools-derive = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-authorship = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-babe = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-bounties = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-collective = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-democracy = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-elections-phragmen = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-identity = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-im-online = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-indices = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-membership = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-offences = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-offences-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-recovery = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-scheduler = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-society = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-staking = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-staking-reward-curve = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-staking-reward-fn = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-state-trie-migration = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-tips = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-treasury = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-vesting = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-client-db = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-consensus-babe = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-consensus-babe-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-consensus-epochs = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-consensus-slots = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-executor-common = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-executor-wasmtime = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-informant = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-network = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-network-common = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-network-gossip = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-rpc-api = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-rpc-server = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-service = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-sync-state-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-tracing = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-api = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-application-crypto = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-arithmetic = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false} +sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-consensus = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-consensus-babe = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-consensus-slots = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-consensus-beefy = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-debug-derive = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-externalities = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-inherents = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-keyring = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-maybe-compressed-blob = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-npos-elections = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-offchain = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-runtime-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-runtime-interface-proc-macro = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-session = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-staking = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-storage = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-tracing = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-trie = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-version = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-wasm-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-mmr = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-mmr-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +substrate-state-trie-migration-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2" } -pallet-collator-selection = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-client-consensus-proposer = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-client-network = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-primitives-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -parachain-info = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } -cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c8d2251cafadc108ba2f1f8a3208dc547ff38901", default-features = false } +kusama-runtime = { package = "staging-kusama-runtime", git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-node-network-protocol = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-node-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-node-subsystem = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-node-subsystem-util = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-overseer = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-parachain = { package = "polkadot-parachain-primitives", git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false, features = ["wasm-api"] } +polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-statement-table = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +rococo-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +westend-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +polkadot-xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +xcm-emulator = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } + +pallet-collator-selection = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-client-consensus-proposer = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-client-network = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-primitives-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +staging-parachain-info = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } # ORML dependencies -orml-benchmarking = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "b3694e631df7f1ca16b1973122937753fcdee9d4", default-features = false } -orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "b3694e631df7f1ca16b1973122937753fcdee9d4", default-features = false } -orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "b3694e631df7f1ca16b1973122937753fcdee9d4", default-features = false } -orml-utilities = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "b3694e631df7f1ca16b1973122937753fcdee9d4", default-features = false } -orml-vesting = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "b3694e631df7f1ca16b1973122937753fcdee9d4", default-features = false } +orml-benchmarking = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } +orml-tokens = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } +orml-traits = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } +orml-utilities = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } +orml-vesting = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } # orml XCM support -orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "b3694e631df7f1ca16b1973122937753fcdee9d4", default-features = false } -orml-xcm = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "b3694e631df7f1ca16b1973122937753fcdee9d4", default-features = false } -orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "b3694e631df7f1ca16b1973122937753fcdee9d4", default-features = false } -orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "b3694e631df7f1ca16b1973122937753fcdee9d4", default-features = false } - - -[patch."https://github.com/paritytech/polkadot-sdk"] -frame-benchmarking = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-benchmarking-cli = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-election-provider-support = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-executive = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-support = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-support-procedural = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-support-procedural-tools = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-support-procedural-tools-derive = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-system = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-system-benchmarking = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-system-rpc-runtime-api = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-try-runtime = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-aura = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-authority-discovery = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-authorship = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-babe = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-balances = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-bounties = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-collective = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-democracy = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-election-provider-multi-phase = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-elections-phragmen = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-identity = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-im-online = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-indices = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-membership = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-multisig = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-offences = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-offences-benchmarking = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-proxy = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-recovery = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-scheduler = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-session = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-session-benchmarking = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-society = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-staking = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-staking-reward-curve = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-staking-reward-fn = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-state-trie-migration = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-sudo = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-timestamp = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-tips = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-transaction-payment = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-transaction-payment-rpc = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-treasury = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-uniques = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-utility = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-vesting = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-preimage = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-authority-discovery = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-basic-authorship = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-block-builder = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-chain-spec = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-cli = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-client-api = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-client-db = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-consensus = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-consensus-aura = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-consensus-babe = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-consensus-babe-rpc = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-consensus-epochs = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-consensus-slots = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-consensus-grandpa = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-executor = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-executor-common = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-executor-wasmtime = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-informant = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-keystore = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-network = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-network-common = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-network-sync = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-network-gossip = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-offchain = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-rpc = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-rpc-api = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-rpc-server = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-service = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-sync-state-rpc = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-telemetry = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-tracing = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-transaction-pool = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-transaction-pool-api = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-utils = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sc-sysinfo = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-api = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-application-crypto = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-arithmetic = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-authority-discovery = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-block-builder = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-blockchain = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-consensus = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-consensus-aura = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-consensus-babe = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-consensus-slots = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-consensus-beefy = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-core = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-debug-derive = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-externalities = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-inherents = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-io = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-keyring = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-keystore = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-maybe-compressed-blob = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-npos-elections = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-offchain = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-rpc = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-runtime = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-runtime-interface = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-runtime-interface-proc-macro = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-session = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-staking = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-state-machine = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-std = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-storage = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-timestamp = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-tracing = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-transaction-pool = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-trie = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-version = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-wasm-interface = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-weights = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -substrate-build-script-utils = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -substrate-frame-rpc-system = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -substrate-prometheus-endpoint = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -substrate-wasm-builder = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-mmr = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-mmr-primitives = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -substrate-state-trie-migration-rpc = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } - -kusama-runtime = { package = "staging-kusama-runtime", git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -pallet-xcm = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-cli = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-core-primitives = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-node-core-pvf = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-node-network-protocol = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-node-primitives = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-node-subsystem = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-node-subsystem-util = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-overseer = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-parachain = { package = "polkadot-parachain-primitives", git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-primitives = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-runtime = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-runtime-common = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-runtime-parachains = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-service = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-statement-table = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -rococo-runtime = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -westend-runtime = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -polkadot-xcm = { package = "staging-xcm", git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -xcm-emulator = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } - -pallet-collator-selection = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-client-cli = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-client-consensus-aura = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-client-consensus-common = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-client-consensus-proposer = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-client-network = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-client-service = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-client-collator = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-pallet-aura-ext = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-pallet-dmp-queue = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-pallet-parachain-system = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-pallet-xcm = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-pallet-xcmp-queue = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-primitives-core = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-primitives-parachain-inherent = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-primitives-timestamp = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-primitives-utility = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-test-relay-sproof-builder = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -parachain-info = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-relay-chain-interface = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-relay-chain-minimal-node = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -cumulus-relay-chain-inprocess-interface = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } - -# pallet-transaction-multi-payment depends on pallet-evm from moonbeam. Patch dependencies of this pallet. -[patch."https://github.com/moonbeam-foundation/polkadot-sdk"] -frame-benchmarking = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-support = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -frame-system = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-core = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-io = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-keystore = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-runtime = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-storage = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } -sp-std = { git = "https://github.com/galacticcouncil/polkadot-sdk", rev = "062d92eae0f3bb9908faf2d4e241eef17368b9d3" } +orml-unknown-tokens = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } +orml-xcm = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } +orml-xcm-support = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } +orml-xtokens = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 7b9f93d7a2e..dc1b0e25530 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -56,7 +56,7 @@ cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } cumulus-primitives-parachain-inherent = { workspace = true } cumulus-primitives-timestamp = { workspace = true } -parachain-info = { workspace = true } +staging-parachain-info = { workspace = true } # Polkadot dependencies polkadot-parachain = { workspace = true } @@ -107,7 +107,6 @@ polkadot-primitives = { workspace = true } polkadot-runtime-parachains = { workspace = true } basilisk-runtime = { path = "../runtime/basilisk", default-features = false} -kusama-runtime = { workspace = true, features = ["try-runtime"] } cumulus-test-relay-sproof-builder = { workspace = true } [dev-dependencies] @@ -142,7 +141,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "pallet-xcm/std", - "parachain-info/std", + "staging-parachain-info/std", "pallet-xyk/std", "pallet-duster/std", "pallet-asset-registry/std", @@ -183,12 +182,10 @@ std = [ "pallet-tips/std", "pallet-collator-selection/std", "pallet-authorship/std", - "kusama-runtime/std", "basilisk-runtime/std", "hydradx-traits/std", ] runtime-benchmarks = [ "basilisk-runtime/runtime-benchmarks", - "kusama-runtime/runtime-benchmarks", ] \ No newline at end of file diff --git a/pallets/asset-registry/Cargo.toml b/pallets/asset-registry/Cargo.toml new file mode 100644 index 00000000000..13a9788aedd --- /dev/null +++ b/pallets/asset-registry/Cargo.toml @@ -0,0 +1,68 @@ +[package] +name = "pallet-asset-registry" +version = "2.3.3" +description = "Pallet for asset registry management" +authors = ["GalacticCouncil"] +edition = "2021" +license = "Apache 2.0" +repository = "https://github.com/galacticcouncil/warehouse" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[build-dependencies] +substrate-wasm-builder = { workspace = true } + +[dependencies] +codec = { default-features = false, features = ["derive", "max-encoded-len"], package = "parity-scale-codec", version = "3.4.0" } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +primitive-types = { default-features = false, version = "0.12.0" } +serde = { features = ["derive"], optional = true, version = "1.0.137" } +log = { workspace = true } + +# ORML dependencies +orml-traits = { workspace = true } + +# Substrate dependencies +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-core = { workspace = true } +sp-arithmetic = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } + +# HydraDX dependencies +hydradx-traits = { workspace = true } + +# Optionals +frame-benchmarking = { workspace = true, optional = true } +sp-api = { workspace = true, optional = true } + +[dev-dependencies] +sp-io = { workspace = true } +polkadot-xcm = { workspace = true } +test-utils = { workspace = true } + +[features] +default = ["std"] +runtime-benchmarks = [ + "frame-benchmarking", + "frame-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", +] +std = [ + "serde/std", + "codec/std", + "frame-support/std", + "frame-system/std", + "sp-runtime/std", + "sp-core/std", + "sp-std/std", + "hydradx-traits/std", + "sp-api/std", + "frame-benchmarking/std", + "scale-info/std", + "polkadot-xcm/std", +] +try-runtime = ["frame-support/try-runtime"] + diff --git a/pallets/asset-registry/README.md b/pallets/asset-registry/README.md new file mode 100644 index 00000000000..73e676aaa2d --- /dev/null +++ b/pallets/asset-registry/README.md @@ -0,0 +1,29 @@ +### Asset registry + +## Overview +Asset registry provides functionality to create, store and keep tracking of existing assets in a system. + +### Terminology + +- **CoreAssetId** - asset id of native/core asset. Usually 0. +- **NextAssetId** - asset id to be assigned for next asset added to the system. +- **AssetIds** - list of existing asset ids +- **AssetDetail** - details of an asset such as type, name or whether it is locked or not. +- **AssetMetadata** - additional optional metadata of an asset ( symbol, decimals) +- **AssetLocation** - information of native location of an asset. Used in XCM. + +### Implementation detail + +For each newly registered asset, a sequential id is assigned to that asset. This id identifies the asset and can be used directly in transfers or any other operation which works with an asset ( without performing any additioanl asset check or asset retrieval). + +There is a mapping between the name and asset id stored as well, which helps and is used in AMM Implementation where there is a need to register a pool asset and only name is provided ( see `get_or_create_asset` ). + +An asset has additional details stored on chain such as name and type. + +Optional metadata can be also set for an asset. + +The registry pallet supports storing of native location of an asset. This can be used in XCM where it is possible to create mapping between native location and local system asset ids. + +### Interface +- `get_or_create_asset` - creates new asset id for give asset name. If such asset already exists, it returns the corresponding asset id. + diff --git a/pallets/asset-registry/src/benchmarking.rs b/pallets/asset-registry/src/benchmarking.rs new file mode 100644 index 00000000000..4f92be61e39 --- /dev/null +++ b/pallets/asset-registry/src/benchmarking.rs @@ -0,0 +1,133 @@ +// This file is part of pallet-asset-registry. + +// 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(feature = "runtime-benchmarks")] + +use super::*; + +use frame_benchmarking::benchmarks; +use frame_system::RawOrigin; + +use crate::types::Metadata; + +use sp_std::vec; + +benchmarks! { + register{ + let name = vec![1; T::StringLimit::get() as usize]; + let ed = T::Balance::from(1_000_000u32); + + let symbol = vec![1; T::StringLimit::get() as usize]; + + let metadata = Metadata { + symbol, + decimals: 100, + }; + + }: _(RawOrigin::Root, name.clone(), AssetType::Token, ed, None, Some(metadata), Some(Default::default()), None) + verify { + let bname = crate::Pallet::::to_bounded_name(name).unwrap(); + assert!(crate::Pallet::::asset_ids(bname).is_some()); + } + + update{ + let name = b"NAME".to_vec(); + let ed = T::Balance::from(1_000_000u32); + let asset_id = T::AssetId::from(10u8); + let _ = crate::Pallet::::register(RawOrigin::Root.into(), name, AssetType::Token, ed, Some(asset_id), None, None, None); + + let new_name= vec![1; T::StringLimit::get() as usize]; + + let new_ed = T::Balance::from(2_000_000u32); + + let rate_limit = T::Balance::from(10_000_000u32); + + }: _(RawOrigin::Root, asset_id, new_name.clone(), AssetType::PoolShare(T::AssetId::from(10u8),T::AssetId::from(20u8)), Some(new_ed), Some(rate_limit)) + verify { + let bname = crate::Pallet::::to_bounded_name(new_name).unwrap(); + assert_eq!(crate::Pallet::::asset_ids(&bname), Some(asset_id)); + + let stored = crate::Pallet::::assets(asset_id); + + assert!(stored.is_some()); + let stored = stored.unwrap(); + + let expected = AssetDetails{ + asset_type: AssetType::PoolShare(T::AssetId::from(10u8), T::AssetId::from(20u8)), + existential_deposit: new_ed, + name: bname, + xcm_rate_limit: Some(rate_limit), + }; + + assert_eq!(stored.asset_type, expected.asset_type); + assert_eq!(stored.existential_deposit, expected.existential_deposit); + assert_eq!(stored.name.to_vec(), expected.name.to_vec()); + } + + set_metadata{ + let name = b"NAME".to_vec(); + let bname = crate::Pallet::::to_bounded_name(name.clone()).unwrap(); + let ed = T::Balance::from(1_000_000u32); + let _ = crate::Pallet::::register(RawOrigin::Root.into(), name, AssetType::Token, ed, None, None, None, None); + + let asset_id = crate::Pallet::::asset_ids(bname).unwrap(); + + let max_symbol = vec![1; T::StringLimit::get() as usize]; + + }: _(RawOrigin::Root, asset_id, max_symbol.clone(), 10u8) + verify { + let bsymbol= crate::Pallet::::to_bounded_name(max_symbol).unwrap(); + + let stored = crate::Pallet::::asset_metadata(asset_id); + + assert!(stored.is_some()); + + let stored = stored.unwrap(); + + let expected =AssetMetadata{ + symbol: bsymbol, + decimals: 10u8 + }; + + assert_eq!(stored.symbol.to_vec(), expected.symbol.to_vec()); + assert_eq!(stored.decimals, expected.decimals); + } + + set_location{ + let name = b"NAME".to_vec(); + let ed = T::Balance::from(1_000_000u32); + let asset_id = T::AssetId::from(10u8); + let _ = crate::Pallet::::register(RawOrigin::Root.into(), name.clone(), AssetType::Token, ed, Some(asset_id), None, None, None); + + }: _(RawOrigin::Root, asset_id, Default::default()) + verify { + let bname = crate::Pallet::::to_bounded_name(name).unwrap(); + let bsymbol= crate::Pallet::::to_bounded_name(b"SYMBOL".to_vec()).unwrap(); + + assert_eq!(crate::Pallet::::locations(asset_id), Some(Default::default())); + assert_eq!(crate::Pallet::::location_assets(T::AssetNativeLocation::default()), Some(asset_id)); + } +} + +#[cfg(test)] +mod tests { + use super::Pallet; + use crate::mock::*; + use frame_benchmarking::impl_benchmark_test_suite; + + impl_benchmark_test_suite!(Pallet, super::ExtBuilder::default().build(), super::Test); +} diff --git a/pallets/asset-registry/src/lib.rs b/pallets/asset-registry/src/lib.rs new file mode 100644 index 00000000000..84904f81d51 --- /dev/null +++ b/pallets/asset-registry/src/lib.rs @@ -0,0 +1,655 @@ +// This file is part of pallet-asset-registry. + +// 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 frame_support::pallet_prelude::*; +use frame_support::sp_runtime::traits::CheckedAdd; +use frame_system::pallet_prelude::*; +use scale_info::TypeInfo; +use sp_arithmetic::traits::BaseArithmetic; +use sp_runtime::DispatchError; +use sp_std::convert::TryInto; +use sp_std::vec::Vec; + +#[cfg(test)] +mod mock; + +#[cfg(test)] +mod tests; + +mod benchmarking; +pub mod migration; +mod types; +pub mod weights; +pub mod traits; + +use weights::WeightInfo; + +pub use types::AssetType; + +// Re-export pallet items so that they can be accessed from the crate namespace. +pub use pallet::*; + +pub use crate::types::{AssetDetails, AssetMetadata}; +use frame_support::BoundedVec; +use traits::{CreateRegistry, InspectRegistry, Registry, ShareTokenRegistry}; +use hydradx_traits::AssetKind; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use crate::types::Metadata; + use frame_support::sp_runtime::traits::AtLeast32BitUnsigned; + + const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + + pub type AssetDetailsT = + AssetDetails<::AssetId, ::Balance, BoundedVec::StringLimit>>; + + #[pallet::config] + pub trait Config: frame_system::Config { + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + /// The origin which can work with asset-registry. + type RegistryOrigin: EnsureOrigin; + + /// Asset type + type AssetId: Parameter + + Member + + Default + + Copy + + BaseArithmetic + + MaybeSerializeDeserialize + + MaxEncodedLen + + TypeInfo; + + /// Balance type + type Balance: Parameter + + Member + + AtLeast32BitUnsigned + + Default + + Copy + + MaybeSerializeDeserialize + + MaxEncodedLen; + + /// Asset location type + type AssetNativeLocation: Parameter + Member + Default + MaxEncodedLen; + + /// The maximum length of a name or symbol stored on-chain. + type StringLimit: Get; + + #[pallet::constant] + type SequentialIdStartAt: Get; + + /// Native Asset Id + #[pallet::constant] + type NativeAssetId: Get; + + /// Weight information for the extrinsics + type WeightInfo: WeightInfo; + } + + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] + pub struct Pallet(_); + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::error] + pub enum Error { + /// Asset ID is not available. This only happens when it reaches the MAX value of given id type. + NoIdAvailable, + + /// Invalid asset name or symbol. + AssetNotFound, + + /// Invalid asset name or symbol. + TooLong, + + /// Asset ID is not registered in the asset-registry. + AssetNotRegistered, + + /// Asset is already registered. + AssetAlreadyRegistered, + + /// Incorrect number of assets provided to create shared asset. + InvalidSharedAssetLen, + + /// Cannot update asset location + CannotUpdateLocation, + + /// Selected asset id is out of reserved range. + NotInReservedRange, + + /// Location already registered with different asset + LocationAlreadyRegistered, + } + + #[pallet::storage] + #[pallet::getter(fn assets)] + /// Details of an asset. + pub type Assets = StorageMap<_, Twox64Concat, T::AssetId, AssetDetailsT, OptionQuery>; + + #[pallet::storage] + /// Next available asset id. This is sequential id assigned for each new registered asset. + pub type NextAssetId = StorageValue<_, T::AssetId, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn asset_ids)] + /// Mapping between asset name and asset id. + pub type AssetIds = + StorageMap<_, Blake2_128Concat, BoundedVec, T::AssetId, OptionQuery>; + + #[pallet::storage] + #[pallet::getter(fn locations)] + /// Native location of an asset. + pub type AssetLocations = StorageMap<_, Twox64Concat, T::AssetId, T::AssetNativeLocation, OptionQuery>; + + #[pallet::storage] + #[pallet::getter(fn location_assets)] + /// Local asset for native location. + pub type LocationAssets = + StorageMap<_, Blake2_128Concat, T::AssetNativeLocation, T::AssetId, OptionQuery>; + + #[pallet::storage] + #[pallet::getter(fn asset_metadata)] + /// Metadata of an asset. + pub type AssetMetadataMap = + StorageMap<_, Twox64Concat, T::AssetId, AssetMetadata>, OptionQuery>; + + #[allow(clippy::type_complexity)] + #[pallet::genesis_config] + pub struct GenesisConfig { + pub registered_assets: Vec<(Vec, T::Balance, Option)>, + pub native_asset_name: Vec, + pub native_existential_deposit: T::Balance, + } + + impl Default for GenesisConfig { + fn default() -> Self { + GenesisConfig:: { + registered_assets: sp_std::vec![], + native_asset_name: b"HDX".to_vec(), + native_existential_deposit: Default::default(), + } + } + } + #[pallet::genesis_build] + impl BuildGenesisConfig for GenesisConfig { + fn build(&self) { + // Register native asset first + // It is to make sure that native is registered as any other asset + let native_asset_name = Pallet::::to_bounded_name(self.native_asset_name.to_vec()) + .map_err(|_| panic!("Invalid native asset name!")) + .unwrap(); + + AssetIds::::insert(&native_asset_name, T::NativeAssetId::get()); + let details = AssetDetails { + name: native_asset_name, + asset_type: AssetType::Token, + existential_deposit: self.native_existential_deposit, + + xcm_rate_limit: None, + }; + + Assets::::insert(T::NativeAssetId::get(), details); + + self.registered_assets.iter().for_each(|(name, ed, id)| { + let bounded_name = Pallet::::to_bounded_name(name.to_vec()) + .map_err(|_| panic!("Invalid asset name!")) + .unwrap(); + let _ = Pallet::::register_asset(bounded_name, AssetType::Token, *ed, *id, None) + .map_err(|_| panic!("Failed to register asset")); + }) + } + } + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + /// Asset was registered. + Registered { + asset_id: T::AssetId, + asset_name: BoundedVec, + asset_type: AssetType, + }, + + /// Asset was updated. + Updated { + asset_id: T::AssetId, + asset_name: BoundedVec, + asset_type: AssetType, + existential_deposit: T::Balance, + xcm_rate_limit: Option, + }, + + /// Metadata set for an asset. + MetadataSet { + asset_id: T::AssetId, + symbol: BoundedVec, + decimals: u8, + }, + + /// Native location set for an asset. + LocationSet { + asset_id: T::AssetId, + location: T::AssetNativeLocation, + }, + } + + #[pallet::call] + impl Pallet { + /// Register a new asset. + /// + /// Asset is identified by `name` and the name must not be used to register another asset. + /// + /// New asset is given `NextAssetId` - sequential asset id + /// + /// Adds mapping between `name` and assigned `asset_id` so asset id can be retrieved by name too (Note: this approach is used in AMM implementation (xyk)) + /// + /// Emits 'Registered` event when successful. + #[allow(clippy::too_many_arguments)] + #[pallet::call_index(0)] + #[pallet::weight(::WeightInfo::register())] + pub fn register( + origin: OriginFor, + name: Vec, + asset_type: AssetType, + existential_deposit: T::Balance, + asset_id: Option, + metadata: Option, + location: Option, + xcm_rate_limit: Option, + ) -> DispatchResult { + T::RegistryOrigin::ensure_origin(origin)?; + + let bounded_name = Self::to_bounded_name(name)?; + + ensure!( + Self::asset_ids(&bounded_name).is_none(), + Error::::AssetAlreadyRegistered + ); + + let asset_id = + Self::register_asset(bounded_name, asset_type, existential_deposit, asset_id, xcm_rate_limit)?; + + if let Some(meta) = metadata { + let symbol = Self::to_bounded_name(meta.symbol)?; + AssetMetadataMap::::insert( + asset_id, + AssetMetadata { + symbol: symbol.clone(), + decimals: meta.decimals, + }, + ); + + Self::deposit_event(Event::MetadataSet { + asset_id, + symbol, + decimals: meta.decimals, + }); + } + + if let Some(loc) = location { + ensure!(asset_id != T::NativeAssetId::get(), Error::::CannotUpdateLocation); + ensure!( + Self::location_assets(&loc).is_none(), + Error::::LocationAlreadyRegistered + ); + AssetLocations::::insert(asset_id, &loc); + LocationAssets::::insert(&loc, asset_id); + + Self::deposit_event(Event::LocationSet { + asset_id, + location: loc, + }); + } + + Ok(()) + } + + /// Update registered asset. + /// + /// Updates also mapping between name and asset id if provided name is different than currently registered. + /// + /// Emits `Updated` event when successful. + + // TODO: No tests + #[pallet::call_index(1)] + #[pallet::weight(::WeightInfo::update())] + pub fn update( + origin: OriginFor, + asset_id: T::AssetId, + name: Vec, + asset_type: AssetType, + existential_deposit: Option, + xcm_rate_limit: Option, + ) -> DispatchResult { + T::RegistryOrigin::ensure_origin(origin)?; + + Assets::::try_mutate(asset_id, |maybe_detail| -> DispatchResult { + let detail = maybe_detail.as_mut().ok_or(Error::::AssetNotFound)?; + + let bounded_name = Self::to_bounded_name(name)?; + + if bounded_name != detail.name { + // Make sure that there is no such name already registered + ensure!( + Self::asset_ids(&bounded_name).is_none(), + Error::::AssetAlreadyRegistered + ); + + // update also name map - remove old one first + AssetIds::::remove(&detail.name); + AssetIds::::insert(&bounded_name, asset_id); + } + + detail.name = bounded_name.clone(); + detail.asset_type = asset_type; + detail.existential_deposit = existential_deposit.unwrap_or(detail.existential_deposit); + detail.xcm_rate_limit = xcm_rate_limit; + + Self::deposit_event(Event::Updated { + asset_id, + asset_name: bounded_name, + asset_type, + existential_deposit: detail.existential_deposit, + xcm_rate_limit: detail.xcm_rate_limit, + }); + + Ok(()) + }) + } + + /// Set metadata for an asset. + /// + /// - `asset_id`: Asset identifier. + /// - `symbol`: The exchange symbol for this asset. Limited in length by `StringLimit`. + /// - `decimals`: The number of decimals this asset uses to represent one unit. + /// + /// Emits `MetadataSet` event when successful. + #[pallet::call_index(2)] + #[pallet::weight(::WeightInfo::set_metadata())] + pub fn set_metadata( + origin: OriginFor, + asset_id: T::AssetId, + symbol: Vec, + decimals: u8, + ) -> DispatchResult { + T::RegistryOrigin::ensure_origin(origin)?; + + ensure!(Self::assets(asset_id).is_some(), Error::::AssetNotFound); + + let b_symbol = Self::to_bounded_name(symbol)?; + + let metadata = AssetMetadata::> { + symbol: b_symbol.clone(), + decimals, + }; + + AssetMetadataMap::::insert(asset_id, metadata); + + Self::deposit_event(Event::MetadataSet { + asset_id, + symbol: b_symbol, + decimals, + }); + + Ok(()) + } + + /// Set asset native location. + /// + /// Adds mapping between native location and local asset id and vice versa. + /// + /// Mainly used in XCM. + /// + /// Emits `LocationSet` event when successful. + #[pallet::call_index(3)] + #[pallet::weight(::WeightInfo::set_location())] + pub fn set_location( + origin: OriginFor, + asset_id: T::AssetId, + location: T::AssetNativeLocation, + ) -> DispatchResult { + T::RegistryOrigin::ensure_origin(origin)?; + + ensure!(asset_id != T::NativeAssetId::get(), Error::::CannotUpdateLocation); + ensure!(Self::assets(asset_id).is_some(), Error::::AssetNotRegistered); + ensure!( + Self::location_assets(&location).is_none(), + Error::::LocationAlreadyRegistered + ); + + if let Some(old_location) = AssetLocations::::take(asset_id) { + LocationAssets::::remove(&old_location); + } + AssetLocations::::insert(asset_id, &location); + LocationAssets::::insert(&location, asset_id); + + Self::deposit_event(Event::LocationSet { asset_id, location }); + + Ok(()) + } + } +} + +impl Pallet { + pub fn next_asset_id() -> Option { + NextAssetId::::get().checked_add(&T::SequentialIdStartAt::get()) + } + + /// Convert Vec to BoundedVec so it respects the max set limit, otherwise return TooLong error + pub fn to_bounded_name(name: Vec) -> Result, Error> { + name.try_into().map_err(|_| Error::::TooLong) + } + + /// Register new asset. + /// + /// Does not perform any check whether an asset for given name already exists. This has to be prior to calling this function. + pub fn register_asset( + name: BoundedVec, + asset_type: AssetType, + existential_deposit: T::Balance, + selected_asset_id: Option, + xcm_rate_limit: Option, + ) -> Result { + let asset_id = if let Some(selected_id) = selected_asset_id { + ensure!( + selected_id < T::SequentialIdStartAt::get(), + Error::::NotInReservedRange + ); + + ensure!( + !Assets::::contains_key(selected_id), + Error::::AssetAlreadyRegistered + ); + + selected_id + } else { + NextAssetId::::mutate(|value| -> Result { + // Check if current id does not clash with CORE ASSET ID. + // If yes, just skip it and use next one, otherwise use it. + // Note: this way we prevent accidental clashes with native asset id, so no need to set next asset id to be > next asset id + let next_asset_id = if *value == T::NativeAssetId::get() { + value + .checked_add(&T::AssetId::from(1)) + .ok_or(Error::::NoIdAvailable)? + } else { + *value + }; + + *value = next_asset_id + .checked_add(&T::AssetId::from(1)) + .ok_or(Error::::NoIdAvailable)?; + + Ok(next_asset_id + .checked_add(&T::SequentialIdStartAt::get()) + .ok_or(Error::::NoIdAvailable)?) + })? + }; + + AssetIds::::insert(&name, asset_id); + + let details = AssetDetails { + name: name.clone(), + asset_type, + existential_deposit, + xcm_rate_limit, + }; + + // Store the details + Assets::::insert(asset_id, details); + + // Increase asset id to be assigned for following asset. + + Self::deposit_event(Event::Registered { + asset_id, + asset_name: name, + asset_type, + }); + + Ok(asset_id) + } + + /// Create asset for given name or return existing AssetId if such asset already exists. + pub fn get_or_create_asset( + name: Vec, + asset_type: AssetType, + existential_deposit: T::Balance, + asset_id: Option, + ) -> Result { + let bounded_name: BoundedVec = Self::to_bounded_name(name)?; + + if let Some(asset_id) = AssetIds::::get(&bounded_name) { + Ok(asset_id) + } else { + Self::register_asset(bounded_name, asset_type, existential_deposit, asset_id, None) + } + } + + /// Return location for given asset. + pub fn asset_to_location(asset_id: T::AssetId) -> Option { + Self::locations(asset_id) + } + + /// Return asset for given loation. + pub fn location_to_asset(location: T::AssetNativeLocation) -> Option { + Self::location_assets(location) + } +} + +impl Registry, T::Balance, DispatchError> for Pallet { + fn exists(asset_id: T::AssetId) -> bool { + Assets::::contains_key(asset_id) + } + + fn retrieve_asset(name: &Vec) -> Result { + let bounded_name = Self::to_bounded_name(name.clone())?; + if let Some(asset_id) = AssetIds::::get(bounded_name) { + Ok(asset_id) + } else { + Err(Error::::AssetNotFound.into()) + } + } + + fn retrieve_asset_type(asset_id: T::AssetId) -> Result { + let asset_details = + Assets::::get(asset_id).ok_or_else(|| Into::::into(Error::::AssetNotFound))?; + Ok(asset_details.asset_type.into()) + } + + fn create_asset(name: &Vec, existential_deposit: T::Balance) -> Result { + Self::get_or_create_asset(name.clone(), AssetType::Token, existential_deposit, None) + } +} + +impl ShareTokenRegistry, T::Balance, DispatchError> for Pallet { + fn retrieve_shared_asset(name: &Vec, _assets: &[T::AssetId]) -> Result { + Self::retrieve_asset(name) + } + + fn create_shared_asset( + name: &Vec, + assets: &[T::AssetId], + existential_deposit: T::Balance, + ) -> Result { + ensure!(assets.len() == 2, Error::::InvalidSharedAssetLen); + Self::get_or_create_asset( + name.clone(), + AssetType::PoolShare(assets[0], assets[1]), + existential_deposit, + None, + ) + } +} + +use orml_traits::GetByKey; +use sp_arithmetic::traits::Bounded; + +// Return Existential deposit of an asset +impl GetByKey for Pallet { + fn get(k: &T::AssetId) -> T::Balance { + if let Some(details) = Self::assets(k) { + details.existential_deposit + } else { + // Asset does not exist - not supported + T::Balance::max_value() + } + } +} + +/// Allows querying the XCM rate limit for an asset by its id. +pub struct XcmRateLimitsInRegistry(PhantomData); +/// Allows querying the XCM rate limit for an asset by its id. +/// Both a unknown asset and an unset rate limit will return `None`. +impl GetByKey> for XcmRateLimitsInRegistry { + fn get(k: &T::AssetId) -> Option { + Pallet::::assets(k).and_then(|details| details.xcm_rate_limit) + } +} + +impl CreateRegistry for Pallet { + type Error = DispatchError; + + fn create_asset(name: &[u8], kind: AssetKind, existential_deposit: T::Balance) -> Result { + let bounded_name: BoundedVec = Self::to_bounded_name(name.to_vec())?; + Pallet::::register_asset(bounded_name, kind.into(), existential_deposit, None, None) + } +} + +impl InspectRegistry for Pallet { + fn exists(asset_id: T::AssetId) -> bool { + Assets::::contains_key(asset_id) + } + + fn decimals(asset_id: T::AssetId) -> Option { + Some(AssetMetadataMap::::get(asset_id)?.decimals) + } + + fn asset_name(asset_id: T::AssetId) -> Option> { + let asset = Assets::::get(asset_id)?; + Some(asset.name.into_inner()) + } + + fn asset_symbol(asset_id: T::AssetId) -> Option> { + let asset_metadata = AssetMetadataMap::::get(asset_id)?; + Some(asset_metadata.symbol.into_inner()) + } +} diff --git a/pallets/asset-registry/src/migration.rs b/pallets/asset-registry/src/migration.rs new file mode 100644 index 00000000000..26fc5986d50 --- /dev/null +++ b/pallets/asset-registry/src/migration.rs @@ -0,0 +1,90 @@ +// This file is part of pallet-asset-registry + +// Copyright (C) 2020-2023 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::{AssetDetails, AssetType, Assets, Config, Pallet}; +use frame_support::{ + traits::{Get, StorageVersion}, + weights::Weight, +}; + +/// +pub mod v1 { + use super::*; + use codec::{Decode, Encode}; + use scale_info::TypeInfo; + use sp_core::RuntimeDebug; + + #[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug, TypeInfo)] + pub struct OldAssetDetails { + /// The name of this asset. Limited in length by `StringLimit`. + pub(super) name: BoundedString, + + pub(super) asset_type: AssetType, + + pub(super) existential_deposit: Balance, + + pub(super) locked: bool, + } + + pub fn pre_migrate() { + assert_eq!(StorageVersion::get::>(), 0, "Storage version too high."); + + log::info!( + target: "runtime::asset-registry", + "Asset Registry migration: PRE checks successful!" + ); + } + + pub fn migrate() -> Weight { + log::info!( + target: "runtime::asset-registry", + "Running migration to v1 for Asset Registry" + ); + + let mut i = 0; + Assets::::translate( + |_key, + OldAssetDetails { + name, + asset_type, + existential_deposit, + locked: _, + }| { + i += 1; + Some(AssetDetails { + name, + asset_type, + existential_deposit, + xcm_rate_limit: None, + }) + }, + ); + + StorageVersion::new(1).put::>(); + + T::DbWeight::get().reads_writes(i, i) + } + + pub fn post_migrate() { + assert_eq!(StorageVersion::get::>(), 1, "Unexpected storage version."); + + log::info!( + target: "runtime::asset-registry", + "Asset Registry migration: POST checks successful!" + ); + } +} diff --git a/pallets/asset-registry/src/mock.rs b/pallets/asset-registry/src/mock.rs new file mode 100644 index 00000000000..b3cb3693842 --- /dev/null +++ b/pallets/asset-registry/src/mock.rs @@ -0,0 +1,149 @@ +// This file is part of pallet-asset-registry. + +// 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(test)] + +use frame_support::parameter_types; +use frame_system as system; +use sp_core::H256; +use sp_runtime::{ + traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, +}; + +use frame_support::traits::Everything; + +use polkadot_xcm::v3::MultiLocation; + +use crate::{self as asset_registry, Config}; + +pub type AssetId = u32; +pub type Balance = u128; + +pub const UNIT: Balance = 1_000_000_000_000; + +type Block = frame_system::mocking::MockBlock; + +frame_support::construct_runtime!( + pub enum Test + { + System: frame_system, + Registry: asset_registry, + } + +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 63; + pub const NativeAssetId: AssetId = 0; + pub const RegistryStringLimit: u32 = 10; + pub const SequentialIdStart: u32 = 1_000_000; +} + +impl system::Config for Test { + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type Nonce = u64; + type Block = Block; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = BlockHashCount; + type DbWeight = (); + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = SS58Prefix; + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +use codec::{Decode, Encode, MaxEncodedLen}; +use scale_info::TypeInfo; + +#[derive(Debug, Default, Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)] +pub struct AssetLocation(pub MultiLocation); + +impl Config for Test { + type RuntimeEvent = RuntimeEvent; + type RegistryOrigin = frame_system::EnsureRoot; + type AssetId = u32; + type Balance = Balance; + type AssetNativeLocation = AssetLocation; + type StringLimit = RegistryStringLimit; + type SequentialIdStartAt = SequentialIdStart; + type NativeAssetId = NativeAssetId; + type WeightInfo = (); +} +pub type AssetRegistryPallet = crate::Pallet; + +#[derive(Default)] +pub struct ExtBuilder { + registered_assets: Vec<(Vec, Balance, Option)>, + native_asset_name: Option>, +} + +impl ExtBuilder { + pub fn with_assets(mut self, asset_ids: Vec<(Vec, Balance, Option)>) -> Self { + self.registered_assets = asset_ids; + self + } + + pub fn with_native_asset_name(mut self, name: Vec) -> Self { + self.native_asset_name = Some(name); + self + } + + pub fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); + + if let Some(name) = self.native_asset_name { + crate::GenesisConfig:: { + registered_assets: self.registered_assets, + native_asset_name: name, + native_existential_deposit: 1_000_000u128, + } + } else { + crate::GenesisConfig:: { + registered_assets: self.registered_assets, + ..Default::default() + } + } + .assimilate_storage(&mut t) + .unwrap(); + t.into() + } +} + +pub fn new_test_ext() -> sp_io::TestExternalities { + let mut ext = ExtBuilder::default().build(); + ext.execute_with(|| System::set_block_number(1)); + ext +} + +pub fn expect_events(e: Vec) { + test_utils::expect_events::(e); +} diff --git a/pallets/asset-registry/src/tests.rs b/pallets/asset-registry/src/tests.rs new file mode 100644 index 00000000000..ed4f60fcb21 --- /dev/null +++ b/pallets/asset-registry/src/tests.rs @@ -0,0 +1,865 @@ +// This file is part of pallet-asset-registry. + +// 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 super::Error; +use crate::mock::AssetId as RegistryAssetId; +use crate::types::{AssetDetails, AssetMetadata, AssetType, Metadata}; +use crate::Event; +use crate::{mock::*, XcmRateLimitsInRegistry}; +use codec::Encode; +use frame_support::{assert_noop, assert_ok, BoundedVec}; +use orml_traits::GetByKey; +use polkadot_xcm::v3::prelude::*; +use sp_std::convert::TryInto; + +#[test] +fn register_asset_works() { + new_test_ext().execute_with(|| { + let too_long = [1u8; ::StringLimit::get() as usize + 1]; + + let ed = 1_000_000u128; + + assert_noop!( + AssetRegistryPallet::register( + RuntimeOrigin::root(), + too_long.to_vec(), + AssetType::Token, + ed, + None, + None, + None, + None + ), + Error::::TooLong + ); + + let name: Vec = b"BSX".to_vec(); + + assert_ok!(AssetRegistryPallet::register( + RuntimeOrigin::root(), + name.clone(), + AssetType::Token, + ed, + None, + None, + None, + None + )); + + let bn = AssetRegistryPallet::to_bounded_name(name.clone()).unwrap(); + + expect_events(vec![Event::Registered { + asset_id: 1 + SequentialIdStart::get(), + asset_name: bn.clone(), + asset_type: AssetType::Token, + } + .into()]); + + assert_eq!( + AssetRegistryPallet::asset_ids(&bn).unwrap(), + 1u32 + SequentialIdStart::get() + ); + assert_eq!( + AssetRegistryPallet::assets(1u32 + SequentialIdStart::get()).unwrap(), + AssetDetails { + name: bn, + asset_type: AssetType::Token, + existential_deposit: ed, + xcm_rate_limit: None, + } + ); + + assert_noop!( + AssetRegistryPallet::register( + RuntimeOrigin::root(), + name, + AssetType::Token, + ed, + None, + None, + None, + None + ), + Error::::AssetAlreadyRegistered + ); + }); +} + +#[test] +fn create_asset() { + new_test_ext().execute_with(|| { + let ed = 1_000_000u128; + + assert_ok!(AssetRegistryPallet::get_or_create_asset( + b"BSX".to_vec(), + AssetType::Token, + ed, + None, + )); + + let dot_asset = AssetRegistryPallet::get_or_create_asset(b"DOT".to_vec(), AssetType::Token, ed, None); + assert_ok!(dot_asset); + let dot_asset_id = dot_asset.ok().unwrap(); + + assert_ok!(AssetRegistryPallet::get_or_create_asset( + b"BTC".to_vec(), + AssetType::Token, + ed, + None, + )); + + let current_asset_id = AssetRegistryPallet::next_asset_id().unwrap(); + + // Existing asset should return previously created one. + assert_ok!( + AssetRegistryPallet::get_or_create_asset(b"DOT".to_vec(), AssetType::Token, ed, None), + dot_asset_id + ); + + // Retrieving existing asset should not increased the next asset id counter. + assert_eq!(AssetRegistryPallet::next_asset_id().unwrap(), current_asset_id); + + let dot: BoundedVec::StringLimit> = b"DOT".to_vec().try_into().unwrap(); + let aaa: BoundedVec::StringLimit> = b"AAA".to_vec().try_into().unwrap(); + + assert_eq!( + AssetRegistryPallet::asset_ids(dot).unwrap(), + 2u32 + SequentialIdStart::get() + ); + assert!(AssetRegistryPallet::asset_ids(aaa).is_none()); + }); +} + +#[test] +fn location_mapping_works() { + new_test_ext().execute_with(|| { + let bn = AssetRegistryPallet::to_bounded_name(b"BSX".to_vec()).unwrap(); + + let ed = 1_000_000u128; + + assert_ok!(AssetRegistryPallet::get_or_create_asset( + b"BSX".to_vec(), + AssetType::Token, + ed, + None, + )); + let asset_id: RegistryAssetId = + AssetRegistryPallet::get_or_create_asset(b"BSX".to_vec(), AssetType::Token, ed, None).unwrap(); + + crate::Assets::::insert( + asset_id, + AssetDetails::> { + name: bn, + asset_type: AssetType::Token, + existential_deposit: ed, + xcm_rate_limit: None, + }, + ); + + let key = Junction::from(BoundedVec::try_from(asset_id.encode()).unwrap()); + let asset_location = AssetLocation(MultiLocation::new(0, X2(Parachain(200), key))); + + assert_ok!(AssetRegistryPallet::set_location( + RuntimeOrigin::root(), + asset_id, + asset_location.clone() + )); + + expect_events(vec![Event::LocationSet { + asset_id: 1 + SequentialIdStart::get(), + location: asset_location.clone(), + } + .into()]); + + assert_eq!( + AssetRegistryPallet::location_to_asset(asset_location.clone()), + Some(asset_id) + ); + assert_eq!( + AssetRegistryPallet::asset_to_location(asset_id), + Some(asset_location.clone()) + ); + + // asset location for the native asset cannot be changed + assert_noop!( + AssetRegistryPallet::set_location( + RuntimeOrigin::root(), + ::NativeAssetId::get(), + asset_location + ), + Error::::CannotUpdateLocation + ); + }); +} + +#[test] +fn genesis_config_works() { + ExtBuilder::default() + .with_native_asset_name(b"NATIVE".to_vec()) + .build() + .execute_with(|| { + let native: BoundedVec::StringLimit> = b"NATIVE".to_vec().try_into().unwrap(); + assert_eq!(AssetRegistryPallet::asset_ids(native).unwrap(), 0u32); + }); + + let one = b"ONE".to_vec(); + let life = b"LIFE".to_vec(); + + ExtBuilder::default() + .with_assets(vec![ + (one.clone(), 1_000u128, None), + (life.clone(), 1_000u128, Some(42)), + ]) + .build() + .execute_with(|| { + let native: BoundedVec::StringLimit> = b"NATIVE".to_vec().try_into().unwrap(); + assert_eq!(AssetRegistryPallet::asset_ids(native), None); + + let bsx: BoundedVec::StringLimit> = b"HDX".to_vec().try_into().unwrap(); + assert_eq!(AssetRegistryPallet::asset_ids(bsx).unwrap(), 0u32); + + let one: BoundedVec::StringLimit> = one.try_into().unwrap(); + assert_eq!( + AssetRegistryPallet::asset_ids(one.clone()).unwrap(), + 1u32 + SequentialIdStart::get() + ); + assert_eq!( + AssetRegistryPallet::assets(1u32 + SequentialIdStart::get()).unwrap(), + AssetDetails { + name: one, + asset_type: AssetType::Token, + existential_deposit: 1_000u128, + xcm_rate_limit: None, + } + ); + + let life: BoundedVec::StringLimit> = life.try_into().unwrap(); + assert_eq!(AssetRegistryPallet::asset_ids(life.clone()).unwrap(), 42u32); + assert_eq!( + AssetRegistryPallet::assets(42u32).unwrap(), + AssetDetails { + name: life, + asset_type: AssetType::Token, + existential_deposit: 1_000u128, + xcm_rate_limit: None, + } + ); + }); +} + +#[test] +fn set_metadata_works() { + ExtBuilder::default() + .with_assets(vec![(b"DOT".to_vec(), 1_000u128, None)]) + .build() + .execute_with(|| { + System::set_block_number(1); //TO have the ement emitted + + let dot: BoundedVec::StringLimit> = b"DOT".to_vec().try_into().unwrap(); + let dot_id = AssetRegistryPallet::asset_ids(dot).unwrap(); + let b_symbol: BoundedVec::StringLimit> = b"xDOT".to_vec().try_into().unwrap(); + + assert_ok!(AssetRegistryPallet::set_metadata( + RuntimeOrigin::root(), + dot_id, + b"xDOT".to_vec(), + 12u8 + )); + + expect_events(vec![Event::MetadataSet { + asset_id: dot_id, + symbol: b_symbol.clone(), + decimals: 12u8, + } + .into()]); + + assert_eq!( + AssetRegistryPallet::asset_metadata(dot_id).unwrap(), + AssetMetadata { + decimals: 12u8, + symbol: b_symbol.clone(), + } + ); + + assert_ok!(AssetRegistryPallet::set_metadata( + RuntimeOrigin::root(), + dot_id, + b"xDOT".to_vec(), + 30u8 + )); + + assert_eq!( + AssetRegistryPallet::asset_metadata(dot_id).unwrap(), + AssetMetadata { + decimals: 30u8, + symbol: b_symbol, + } + ); + + assert_noop!( + AssetRegistryPallet::set_metadata(RuntimeOrigin::root(), dot_id, b"JUST_TOO_LONG".to_vec(), 30u8), + Error::::TooLong + ); + + assert_noop!( + AssetRegistryPallet::set_metadata(RuntimeOrigin::root(), 100, b"NONE".to_vec(), 30u8), + Error::::AssetNotFound + ); + }); +} + +#[test] +fn update_asset() { + new_test_ext().execute_with(|| { + let ed = 1_000_000u128; + + let btc_asset_id: RegistryAssetId = + AssetRegistryPallet::get_or_create_asset(b"BTC".to_vec(), AssetType::Token, ed, None).unwrap(); + let usd_asset_id: RegistryAssetId = + AssetRegistryPallet::get_or_create_asset(b"USD".to_vec(), AssetType::Token, ed, None).unwrap(); + + let next_asset_id = AssetRegistryPallet::next_asset_id().unwrap(); + + // set a new name and type for an existing asset + assert_ok!(AssetRegistryPallet::update( + RuntimeOrigin::root(), + btc_asset_id, + b"superBTC".to_vec(), + AssetType::Token, + None, + None, + )); + let bn = AssetRegistryPallet::to_bounded_name(b"superBTC".to_vec()).unwrap(); + + expect_events(vec![Event::Updated { + asset_id: btc_asset_id, + asset_name: bn.clone(), + asset_type: AssetType::Token, + existential_deposit: 1_000_000, + xcm_rate_limit: None, + } + .into()]); + + assert_eq!( + AssetRegistryPallet::assets(btc_asset_id).unwrap(), + AssetDetails { + name: bn, + asset_type: AssetType::Token, + existential_deposit: ed, + xcm_rate_limit: None, + } + ); + + let new_btc_name: BoundedVec::StringLimit> = + b"superBTC".to_vec().try_into().unwrap(); + assert_eq!( + AssetRegistryPallet::asset_ids(new_btc_name).unwrap(), + 1u32 + SequentialIdStart::get() + ); + + // cannot set existing name for an existing asset + assert_noop!( + (AssetRegistryPallet::update( + RuntimeOrigin::root(), + usd_asset_id, + b"superBTC".to_vec(), + AssetType::Token, + None, + None, + )), + Error::::AssetAlreadyRegistered + ); + + // cannot set a new name for a non-existent asset + assert_noop!( + (AssetRegistryPallet::update( + RuntimeOrigin::root(), + next_asset_id, + b"VOID".to_vec(), + AssetType::Token, + None, + None, + )), + Error::::AssetNotFound + ); + + // corner case: change the name and also the type for an existing asset (token -> pool share) + assert_ok!(AssetRegistryPallet::update( + RuntimeOrigin::root(), + btc_asset_id, + b"BTCUSD".to_vec(), + AssetType::PoolShare(btc_asset_id, usd_asset_id), + None, + None, + )); + + // Update ED + assert_ok!(AssetRegistryPallet::update( + RuntimeOrigin::root(), + btc_asset_id, + b"BTCUSD".to_vec(), + AssetType::PoolShare(btc_asset_id, usd_asset_id), + Some(1_234_567u128), + None, + )); + + let btcusd = AssetRegistryPallet::to_bounded_name(b"BTCUSD".to_vec()).unwrap(); + + assert_eq!( + AssetRegistryPallet::assets(btc_asset_id).unwrap(), + AssetDetails { + name: btcusd, + asset_type: AssetType::PoolShare(btc_asset_id, usd_asset_id), + existential_deposit: 1_234_567u128, + xcm_rate_limit: None, + } + ); + + // corner case: change the name and also the type for an existing asset (pool share -> token) + assert_ok!(AssetRegistryPallet::update( + RuntimeOrigin::root(), + btc_asset_id, + b"superBTC".to_vec(), + AssetType::Token, + None, + None, + )); + + let superbtc_name: BoundedVec::StringLimit> = + b"superBTC".to_vec().try_into().unwrap(); + + assert_eq!( + AssetRegistryPallet::assets(1u32 + SequentialIdStart::get()).unwrap(), + AssetDetails { + name: superbtc_name, + asset_type: AssetType::Token, + existential_deposit: 1_234_567u128, + xcm_rate_limit: None, + } + ); + }); +} + +#[test] +fn update_should_update_xcm_rate_limit() { + new_test_ext().execute_with(|| { + let ed = 1_000_000u128; + + let btc_asset_id: RegistryAssetId = + AssetRegistryPallet::get_or_create_asset(b"BTC".to_vec(), AssetType::Token, ed, None).unwrap(); + + assert_ok!(AssetRegistryPallet::update( + RuntimeOrigin::root(), + btc_asset_id, + b"superBTC".to_vec(), + AssetType::Token, + None, + Some(1000 * UNIT) + )); + + let bn = AssetRegistryPallet::to_bounded_name(b"superBTC".to_vec()).unwrap(); + + assert_eq!( + AssetRegistryPallet::assets(btc_asset_id).unwrap(), + AssetDetails { + name: bn.clone(), + asset_type: AssetType::Token, + existential_deposit: ed, + xcm_rate_limit: Some(1000 * UNIT), + } + ); + + assert_eq!(XcmRateLimitsInRegistry::::get(&btc_asset_id), Some(1000 * UNIT)); + + expect_events(vec![Event::Updated { + asset_id: btc_asset_id, + asset_name: bn, + asset_type: AssetType::Token, + existential_deposit: ed, + xcm_rate_limit: Some(1000 * UNIT), + } + .into()]); + }); +} + +#[test] +fn get_ed_by_key_works() { + ExtBuilder::default() + .with_native_asset_name(b"NATIVE".to_vec()) + .with_assets(vec![ + (b"ONE".to_vec(), 1_000u128, None), + (b"TWO".to_vec(), 2_000u128, None), + ]) + .build() + .execute_with(|| { + assert_eq!(AssetRegistryPallet::get(&(1u32 + SequentialIdStart::get())), 1_000u128); + assert_eq!(AssetRegistryPallet::get(&(2u32 + SequentialIdStart::get())), 2_000u128); + assert_eq!(AssetRegistryPallet::get(&0u32), 1_000_000u128); + assert_eq!( + AssetRegistryPallet::get(&(1_000u32 + SequentialIdStart::get())), + Balance::MAX + ); // Non-existing assets are not supported + }); +} + +#[test] +fn register_asset_should_work_when_asset_is_provided() { + ExtBuilder::default() + .with_native_asset_name(b"NATIVE".to_vec()) + .build() + .execute_with(|| { + assert_ok!(AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id".to_vec(), + AssetType::Token, + 1_000_000, + Some(1u32), + None, + None, + None + ),); + + let bn = AssetRegistryPallet::to_bounded_name(b"asset_id".to_vec()).unwrap(); + assert_eq!( + AssetRegistryPallet::assets(1u32).unwrap(), + AssetDetails { + name: bn, + asset_type: AssetType::Token, + existential_deposit: 1_000_000, + xcm_rate_limit: None, + } + ); + }); +} + +#[test] +fn register_asset_should_fail_when_provided_asset_is_native_asset() { + ExtBuilder::default().build().execute_with(|| { + assert_noop!( + AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id".to_vec(), + AssetType::Token, + 1_000_000, + Some(NativeAssetId::get()), + None, + None, + None + ), + Error::::AssetAlreadyRegistered + ); + }); +} + +#[test] +fn register_asset_should_fail_when_provided_asset_is_already_registered() { + ExtBuilder::default().build().execute_with(|| { + assert_ok!(AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id".to_vec(), + AssetType::Token, + 1_000_000, + Some(10), + None, + None, + None + )); + assert_noop!( + AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id_2".to_vec(), + AssetType::Token, + 1_000_000, + Some(10), + None, + None, + None + ), + Error::::AssetAlreadyRegistered + ); + }); +} + +#[test] +fn register_asset_should_fail_when_provided_asset_is_outside_reserved_range() { + ExtBuilder::default() + .with_native_asset_name(b"NATIVE".to_vec()) + .build() + .execute_with(|| { + assert_noop!( + AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id".to_vec(), + AssetType::Token, + 1_000_000, + Some(SequentialIdStart::get()), + None, + None, + None + ), + Error::::NotInReservedRange + ); + + assert_noop!( + AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id".to_vec(), + AssetType::Token, + 1_000_000, + Some(SequentialIdStart::get() + 100), + None, + None, + None + ), + Error::::NotInReservedRange + ); + }); +} + +#[test] +fn register_asset_should_work_when_metadata_is_provided() { + new_test_ext().execute_with(|| { + let asset_id: RegistryAssetId = 10; + let decimals = 18; + let symbol = b"SYM".to_vec(); + let asset_name = b"asset_name".to_vec(); + let b_symbol = AssetRegistryPallet::to_bounded_name(symbol.clone()).unwrap(); + let b_asset_name = AssetRegistryPallet::to_bounded_name(asset_name.clone()).unwrap(); + + assert_ok!(AssetRegistryPallet::register( + RuntimeOrigin::root(), + asset_name, + AssetType::Token, + 1_000_000, + Some(asset_id), + Some(Metadata { symbol, decimals }), + None, + None, + )); + + expect_events(vec![ + Event::Registered { + asset_id, + asset_name: b_asset_name.clone(), + asset_type: AssetType::Token, + } + .into(), + Event::MetadataSet { + asset_id, + symbol: b_symbol.clone(), + decimals, + } + .into(), + ]); + + assert_eq!( + AssetRegistryPallet::assets(asset_id).unwrap(), + AssetDetails { + name: b_asset_name, + asset_type: AssetType::Token, + existential_deposit: 1_000_000, + xcm_rate_limit: None, + } + ); + + assert_eq!( + AssetRegistryPallet::asset_metadata(asset_id).unwrap(), + AssetMetadata { + decimals: 18u8, + symbol: b_symbol, + } + ); + }); +} + +#[test] +fn register_asset_should_work_when_location_is_provided() { + ExtBuilder::default().build().execute_with(|| { + let asset_id: RegistryAssetId = 10; + + let key = Junction::from(BoundedVec::try_from(asset_id.encode()).unwrap()); + let asset_location = AssetLocation(MultiLocation::new(0, X2(Parachain(200), key))); + + assert_ok!(AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id".to_vec(), + AssetType::Token, + 1_000_000, + Some(asset_id), + None, + Some(asset_location.clone()), + None + ),); + + let bn = AssetRegistryPallet::to_bounded_name(b"asset_id".to_vec()).unwrap(); + assert_eq!( + AssetRegistryPallet::assets(asset_id).unwrap(), + AssetDetails { + name: bn, + asset_type: AssetType::Token, + existential_deposit: 1_000_000, + xcm_rate_limit: None, + } + ); + assert_eq!( + AssetRegistryPallet::location_to_asset(asset_location.clone()), + Some(asset_id) + ); + assert_eq!(AssetRegistryPallet::asset_to_location(asset_id), Some(asset_location)); + + assert!(AssetRegistryPallet::asset_metadata(asset_id).is_none(),); + }); +} + +#[test] +fn register_asset_should_fail_when_location_is_already_registered() { + ExtBuilder::default().build().execute_with(|| { + // Arrange + let asset_id: RegistryAssetId = 10; + let key = Junction::from(BoundedVec::try_from(asset_id.encode()).unwrap()); + let asset_location = AssetLocation(MultiLocation::new(0, X2(Parachain(2021), key))); + assert_ok!(AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id".to_vec(), + AssetType::Token, + 1_000_000, + Some(asset_id), + None, + Some(asset_location.clone()), + None + ),); + + // Act & Assert + assert_noop!( + AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id_2".to_vec(), + AssetType::Token, + 1_000_000, + Some(asset_id + 1), + None, + Some(asset_location), + None + ), + Error::::LocationAlreadyRegistered + ); + }); +} + +#[test] +fn set_location_should_fail_when_location_is_already_registered() { + ExtBuilder::default().build().execute_with(|| { + // Arrange + let asset_id: RegistryAssetId = 10; + let key = Junction::from(BoundedVec::try_from(asset_id.encode()).unwrap()); + let asset_location = AssetLocation(MultiLocation::new(0, X2(Parachain(2021), key))); + assert_ok!(AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id".to_vec(), + AssetType::Token, + 1_000_000, + Some(asset_id), + None, + Some(asset_location.clone()), + None + ),); + + // Act & Assert + assert_noop!( + AssetRegistryPallet::set_location(RuntimeOrigin::root(), asset_id, asset_location), + Error::::LocationAlreadyRegistered + ); + }); +} + +#[test] +fn set_location_should_remove_old_location() { + ExtBuilder::default().build().execute_with(|| { + // Arrange + let asset_id: RegistryAssetId = 10; + let key = Junction::from(BoundedVec::try_from(asset_id.encode()).unwrap()); + let old_asset_location = AssetLocation(MultiLocation::new(0, X2(Parachain(2021), key))); + assert_ok!(AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id".to_vec(), + AssetType::Token, + 1_000_000, + Some(asset_id), + None, + Some(old_asset_location.clone()), + None + ),); + + // Act + assert_ok!(AssetRegistryPallet::set_location( + RuntimeOrigin::root(), + asset_id, + AssetLocation(MultiLocation::new(0, X2(Parachain(2022), key))) + )); + + // Assert + assert_eq!(AssetRegistryPallet::location_to_asset(old_asset_location), None); + }); +} + +#[test] +fn register_asset_should_work_when_all_optional_are_provided() { + ExtBuilder::default().build().execute_with(|| { + let asset_id: RegistryAssetId = 10; + + let key = Junction::from(BoundedVec::try_from(asset_id.encode()).unwrap()); + let asset_location = AssetLocation(MultiLocation::new(0, X2(Parachain(200), key))); + + assert_ok!(AssetRegistryPallet::register( + RuntimeOrigin::root(), + b"asset_id".to_vec(), + AssetType::Token, + 1_000_000, + Some(asset_id), + Some(Metadata { + symbol: b"SYM".to_vec(), + decimals: 18 + }), + Some(asset_location.clone()), + Some(1000 * UNIT) + ),); + + let bn = AssetRegistryPallet::to_bounded_name(b"asset_id".to_vec()).unwrap(); + assert_eq!( + AssetRegistryPallet::assets(asset_id).unwrap(), + AssetDetails { + name: bn, + asset_type: AssetType::Token, + existential_deposit: 1_000_000, + xcm_rate_limit: Some(1000 * UNIT), + } + ); + assert_eq!( + AssetRegistryPallet::location_to_asset(asset_location.clone()), + Some(asset_id) + ); + assert_eq!(AssetRegistryPallet::asset_to_location(asset_id), Some(asset_location)); + let b_symbol: BoundedVec::StringLimit> = b"SYM".to_vec().try_into().unwrap(); + assert_eq!( + AssetRegistryPallet::asset_metadata(asset_id).unwrap(), + AssetMetadata { + decimals: 18u8, + symbol: b_symbol, + } + ); + }); +} diff --git a/pallets/asset-registry/src/traits.rs b/pallets/asset-registry/src/traits.rs new file mode 100644 index 00000000000..c47be509297 --- /dev/null +++ b/pallets/asset-registry/src/traits.rs @@ -0,0 +1,72 @@ +use sp_std::vec::Vec; +pub trait Registry { + fn exists(name: AssetId) -> bool; + + fn retrieve_asset(name: &AssetName) -> Result; + + fn retrieve_asset_type(asset_id: AssetId) -> Result; + + fn create_asset(name: &AssetName, existential_deposit: Balance) -> Result; + + fn get_or_create_asset(name: AssetName, existential_deposit: Balance) -> Result { + if let Ok(asset_id) = Self::retrieve_asset(&name) { + Ok(asset_id) + } else { + Self::create_asset(&name, existential_deposit) + } + } +} +// Use CreateRegistry if possible +pub trait ShareTokenRegistry: Registry { + fn retrieve_shared_asset(name: &AssetName, assets: &[AssetId]) -> Result; + + fn create_shared_asset( + name: &AssetName, + assets: &[AssetId], + existential_deposit: Balance, + ) -> Result; + + fn get_or_create_shared_asset( + name: AssetName, + assets: Vec, + existential_deposit: Balance, + ) -> Result { + if let Ok(asset_id) = Self::retrieve_shared_asset(&name, &assets) { + Ok(asset_id) + } else { + Self::create_shared_asset(&name, &assets, existential_deposit) + } + } +} + +pub trait InspectRegistry { + fn exists(asset_id: AssetId) -> bool; + fn decimals(asset_id: AssetId) -> Option; + fn asset_name(asset_id: AssetId) -> Option>; + fn asset_symbol(asset_id: AssetId) -> Option>; +} + +use hydradx_traits::AssetKind; + +pub trait CreateRegistry { + type Error; + fn create_asset(name: &[u8], kind: AssetKind, existential_deposit: Balance) -> Result; +} + +// Deprecated. +// TODO: the following macro is commented out for a reason for now - due to failing clippy in CI +// #[deprecated(since = "0.6.0", note = "Please use `AccountIdFor` instead")] +pub trait AssetPairAccountIdFor { + fn from_assets(asset_a: AssetId, asset_b: AssetId, identifier: &str) -> AccountId; +} + +/// Abstraction over account id and account name creation for `Assets` +pub trait AccountIdFor { + type AccountId; + + /// Create account id for given assets and an identifier + fn from_assets(assets: &Assets, identifier: Option<&[u8]>) -> Self::AccountId; + + /// Create a name to uniquely identify a share token for given assets and an identifier. + fn name(assets: &Assets, identifier: Option<&[u8]>) -> Vec; +} diff --git a/pallets/asset-registry/src/types.rs b/pallets/asset-registry/src/types.rs new file mode 100644 index 00000000000..ccbbd0c5b2a --- /dev/null +++ b/pallets/asset-registry/src/types.rs @@ -0,0 +1,88 @@ +// This file is part of pallet-asset-registry. + +// 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 frame_support::pallet_prelude::*; +use scale_info::TypeInfo; +use sp_std::vec::Vec; + +use hydradx_traits::AssetKind; +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; + +#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub enum AssetType { + Token, + PoolShare(AssetId, AssetId), // Use XYX instead + XYK, + StableSwap, + Bond, + External, +} + +impl From for AssetType { + fn from(value: AssetKind) -> Self { + match value { + AssetKind::Token => Self::Token, + AssetKind::XYK => Self::XYK, + AssetKind::StableSwap => Self::StableSwap, + AssetKind::Bond => Self::Bond, + AssetKind::External => Self::External, + } + } +} + +impl From> for AssetKind { + fn from(value: AssetType) -> Self { + match value { + AssetType::Token => Self::Token, + AssetType::PoolShare(_, _) => Self::XYK, + AssetType::XYK => Self::XYK, + AssetType::StableSwap => Self::StableSwap, + AssetType::Bond => Self::Bond, + AssetType::External => Self::External, + } + } +} + +#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct AssetDetails { + /// The name of this asset. Limited in length by `StringLimit`. + pub name: BoundedString, + + pub asset_type: AssetType, + + pub existential_deposit: Balance, + + pub xcm_rate_limit: Option, +} + +#[derive(Clone, Encode, Decode, Eq, PartialEq, Default, RuntimeDebug, TypeInfo, MaxEncodedLen)] +pub struct AssetMetadata { + /// The ticker symbol for this asset. Limited in length by `StringLimit`. + pub(super) symbol: BoundedString, + /// The number of decimals this asset uses to represent one unit. + pub(super) decimals: u8, +} + +#[derive(Clone, Encode, Decode, Eq, PartialEq, RuntimeDebug, TypeInfo)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct Metadata { + pub(super) symbol: Vec, + pub(super) decimals: u8, +} diff --git a/pallets/asset-registry/src/weights.rs b/pallets/asset-registry/src/weights.rs new file mode 100644 index 00000000000..046273ebdc5 --- /dev/null +++ b/pallets/asset-registry/src/weights.rs @@ -0,0 +1,93 @@ +// This file is part of pallet-asset-registry. + +// 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. + +//! Autogenerated weights for asset-registry +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-06-16, STEPS: [5, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/basilisk +// benchmark +// --pallet=asset-registry +// --chain=dev +// --steps=5 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --template=.maintain/pallet-weight-template.hbs +// --output=lbp.rs + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{ + traits::Get, + weights::{constants::RocksDbWeight, Weight}, +}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for lbp. +pub trait WeightInfo { + fn register() -> Weight; + fn update() -> Weight; + fn set_metadata() -> Weight; + fn set_location() -> Weight; +} + +/// Weights for lbp using the hack.hydraDX node and recommended hardware. +pub struct HydraWeight(PhantomData); + +impl WeightInfo for HydraWeight { + fn register() -> Weight { + Weight::zero() + } + + fn update() -> Weight { + Weight::zero() + } + + fn set_metadata() -> Weight { + Weight::zero() + } + + fn set_location() -> Weight { + Weight::zero() + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn register() -> Weight { + Weight::zero() + } + + fn update() -> Weight { + Weight::zero() + } + + fn set_metadata() -> Weight { + Weight::zero() + } + + fn set_location() -> Weight { + Weight::zero() + } +} diff --git a/pallets/xyk/Cargo.toml b/pallets/xyk/Cargo.toml new file mode 100644 index 00000000000..db318e5a369 --- /dev/null +++ b/pallets/xyk/Cargo.toml @@ -0,0 +1,70 @@ +[package] +name = 'pallet-xyk' +version = "6.3.4" +description = 'XYK automated market maker' +authors = ['GalacticCouncil'] +edition = '2021' +homepage = 'https://github.com/galacticcouncil/hydradx-node' +license = 'Apache 2.0' +repository = 'https://github.com/galacticcouncil/hydradx-node' + +[package.metadata.docs.rs] +targets = ['x86_64-unknown-linux-gnu'] + +[build-dependencies] +substrate-wasm-builder = { workspace = true } + +[dependencies] +codec = { default-features = false, features = ["derive"], package = "parity-scale-codec", version = "3.1.5" } +scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } +primitive-types = { default-features = false, version = "0.12.0" } +serde = { features = ['derive'], optional = true, version = '1.0.136' } +log = { version = "0.4.17", default-features = false } + +hydra-dx-math = { workspace = true } + +# ORML dependencies +orml-tokens = { workspace = true } +orml-traits = { workspace = true } + +# HydraDX dependencies +hydradx-traits = { workspace = true } + +# Substrate dependencies +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } + +pallet-asset-registry = { workspace = true } + +[dev-dependencies] +sp-io = { workspace = true } +sp-api = { workspace = true } +proptest = "1.0.0" + +[features] +default = ['std'] +runtime-benchmarks = [ + "frame-benchmarking", + "frame-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", +] +std = [ + 'serde', + 'codec/std', + 'frame-support/std', + 'frame-system/std', + 'sp-runtime/std', + 'sp-core/std', + 'sp-std/std', + 'orml-traits/std', + "hydradx-traits/std", + 'orml-tokens/std', + 'frame-benchmarking/std', + "scale-info/std", + "pallet-asset-registry/std", +] +try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/xyk/README.md b/pallets/xyk/README.md new file mode 100644 index 00000000000..c29db36c790 --- /dev/null +++ b/pallets/xyk/README.md @@ -0,0 +1,25 @@ +### AMM XYK pallet + +## Overview +AMM pallet provides functionality for managing liquidity pool and executing trades. + +This pallet implements AMM Api trait therefore it is possible to plug this pool implementation +into the exchange pallet. + +### Terminology + +- **Currency** - implementation of fungible multi-currency system +- **AssetPairAccount** / **AssetPairAccountId** - support for creating share accounts for asset pairs. +- **NativeAssetId** - asset id native currency +- **ShareToken** - asset id from asset registry for an asset pair +- **TotalLiquidity** - total liquidity in a pool identified by asset pair account id +- **PoolAssets** - asset pair in a pool identified by asset pair account id + +### Interface + +#### Dispatchable functions +- `create_pool` +- `add_liquidity` +- `remove_liquidity` +- `sell` +- `buy` diff --git a/pallets/xyk/src/benchmarking.rs b/pallets/xyk/src/benchmarking.rs new file mode 100644 index 00000000000..f8835aa7ed4 --- /dev/null +++ b/pallets/xyk/src/benchmarking.rs @@ -0,0 +1,207 @@ +// This file is part of HydraDX-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_system::RawOrigin; +use sp_std::prelude::*; + +use crate::Pallet as XYK; + +use crate::types::{AssetId, Balance}; +use hydradx_traits::router::{PoolType, TradeExecution}; + +const SEED: u32 = 1; + +fn funded_account(name: &'static str, index: u32) -> T::AccountId { + let caller: T::AccountId = account(name, index, SEED); + T::Currency::update_balance(1, &caller, 1_000_000_000_000_000).unwrap(); + T::Currency::update_balance(2, &caller, 1_000_000_000_000_000).unwrap(); + caller +} + +benchmarks! { + create_pool { + let caller = funded_account::("caller", 0); + + let asset_a: AssetId = 1; + let asset_b: AssetId = 2; + let amount_a : Balance = 10 * 1_000_000_000; + let amount_b : Balance = 20 * 1_000_000_000; + + }: _(RawOrigin::Signed(caller.clone()), asset_a, amount_a, asset_b, amount_b) + verify { + assert_eq!(T::Currency::free_balance(asset_a, &caller), 999990000000000); + } + + add_liquidity { + let maker = funded_account::("maker", 0); + let caller = funded_account::("caller", 0); + + let asset_a: AssetId = 1; + let asset_b: AssetId = 2; + let amount : Balance = 10 * 1_000_000_000; + let max_limit : Balance = 10 * 1_000_000_000_000; + + XYK::::create_pool(RawOrigin::Signed(maker).into(), asset_a, 1_000_000_000,asset_b, 1_000_000_000)?; + + }: _(RawOrigin::Signed(caller.clone()), asset_a, asset_b, amount, max_limit) + verify { + assert_eq!(T::Currency::free_balance(asset_a, &caller), 999990000000000); + assert_eq!(T::Currency::free_balance(asset_b, &caller), 999990000000000 - 1); // Due to rounding in favor of pool + } + + remove_liquidity { + let maker = funded_account::("maker", 0); + let caller = funded_account::("caller", 0); + + let asset_a: AssetId = 1; + let asset_b: AssetId = 2; + let amount : Balance = 1_000_000_000; + + XYK::::create_pool(RawOrigin::Signed(maker).into(), 1, 10_000_000_000, 2, 20_000_000_000)?; + XYK::::add_liquidity(RawOrigin::Signed(caller.clone()).into(), 1, 2, 5_000_000_000, 10_100_000_000)?; + + assert_eq!(T::Currency::free_balance(asset_a, &caller), 999995000000000); + assert_eq!(T::Currency::free_balance(asset_b, &caller), 999990000000000 - 1);// Due to rounding in favor of pool + + }: _(RawOrigin::Signed(caller.clone()), asset_a, asset_b, amount) + verify { + assert_eq!(T::Currency::free_balance(asset_a, &caller), 999996000000000); + assert_eq!(T::Currency::free_balance(asset_b, &caller), 999992000000000 - 1);// Due to rounding in favor of pool + } + + sell { + let maker = funded_account::("maker", 0); + let caller = funded_account::("caller", 0); + + let asset_a: AssetId = 1; + let asset_b: AssetId = 2; + let amount : Balance = 1_000_000_000; + let discount = false; + + let min_bought: Balance = 10 * 1_000; + + XYK::::create_pool(RawOrigin::Signed(maker).into(), asset_a, 1_000_000_000_000, asset_b, 3_000_000_000_000)?; + + }: _(RawOrigin::Signed(caller.clone()), asset_a, asset_b, amount, min_bought, discount) + verify{ + assert_eq!(T::Currency::free_balance(asset_a, &caller), 999999000000000); + } + + buy { + let maker = funded_account::("maker", 0); + let caller = funded_account::("caller", 0); + + let asset_a: AssetId = 1; + let asset_b: AssetId = 2; + let amount : Balance = 1_000_000_000; + let discount = false; + + let max_sold: Balance = 6_000_000_000; + + XYK::::create_pool(RawOrigin::Signed(maker).into(), asset_a, 1_000_000_000_000, asset_b, 3_000_000_000_000)?; + + }: _(RawOrigin::Signed(caller.clone()), asset_a, asset_b, amount, max_sold, discount) + verify{ + assert_eq!(T::Currency::free_balance(asset_a, &caller), 1000001000000000); + } + + router_execution_sell { + let c in 1..2; // if c == 1, calculate_sell is executed + let e in 0..1; // if e == 1, execute_sell is executed + + let maker = funded_account::("maker", 0); + let caller = funded_account::("caller", 0); + + let asset_a: AssetId = 1; + let asset_b: AssetId = 2; + let amount : Balance = 1_000_000_000; + let discount = false; + + let min_bought: Balance = 10 * 1_000; + + XYK::::create_pool(RawOrigin::Signed(maker).into(), asset_a, 1_000_000_000_000, asset_b, 3_000_000_000_000)?; + + }: { + for _ in 1..c { + assert!( as TradeExecution>::calculate_sell(PoolType::XYK, asset_a, asset_b, amount).is_ok()); + } + if e != 0 { + assert!( as TradeExecution>::execute_sell(RawOrigin::Signed(caller.clone()).into(), PoolType::XYK, asset_a, asset_b, amount, min_bought).is_ok()); + } + } + verify{ + if e != 0 { + assert_eq!(T::Currency::free_balance(asset_a, &caller), 999999000000000); + } + } + + router_execution_buy { + let c in 1..3; // number of times calculate_buy is executed + let e in 0..1; // if e == 1, execute_buy is executed + + let maker = funded_account::("maker", 0); + let caller = funded_account::("caller", 0); + + let asset_a: AssetId = 1; + let asset_b: AssetId = 2; + let amount : Balance = 1_000_000_000; + let discount = false; + + let max_sold: Balance = 6_000_000_000; + + XYK::::create_pool(RawOrigin::Signed(maker).into(), asset_a, 1_000_000_000_000, asset_b, 3_000_000_000_000)?; + + }: { + for _ in 1..c { + assert!( as TradeExecution>::calculate_buy(PoolType::XYK, asset_a, asset_b, amount).is_ok()); + } + if e != 0 { + assert!( as TradeExecution>::execute_buy(RawOrigin::Signed(caller.clone()).into(), PoolType::XYK, asset_a, asset_b, amount, max_sold).is_ok()); + } + } + verify{ + if e != 0 { + assert_eq!(T::Currency::free_balance(asset_b, &caller), 1000001000000000); + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::tests::mock::{ExtBuilder, System, Test}; + use frame_support::assert_ok; + + #[test] + fn test_benchmarks() { + ExtBuilder::default().build().execute_with(|| { + System::set_block_number(1); + assert_ok!(Pallet::::test_benchmark_create_pool()); + assert_ok!(Pallet::::test_benchmark_add_liquidity()); + assert_ok!(Pallet::::test_benchmark_remove_liquidity()); + assert_ok!(Pallet::::test_benchmark_sell()); + assert_ok!(Pallet::::test_benchmark_buy()); + assert_ok!(Pallet::::test_benchmark_router_execution_sell()); + assert_ok!(Pallet::::test_benchmark_router_execution_buy()); + }); + } +} diff --git a/pallets/xyk/src/impls.rs b/pallets/xyk/src/impls.rs new file mode 100644 index 00000000000..41f8a3ca017 --- /dev/null +++ b/pallets/xyk/src/impls.rs @@ -0,0 +1,31 @@ +use crate::types::{AssetId, AssetPair, Price}; +use hydradx_traits::pools::SpotPriceProvider; +use hydradx_traits::AMM; +use orml_traits::MultiCurrency; +use sp_runtime::FixedPointNumber; +use sp_std::marker::PhantomData; + +pub struct XYKSpotPrice(PhantomData); + +impl SpotPriceProvider for XYKSpotPrice { + type Price = Price; + + fn pair_exists(asset_a: AssetId, asset_b: AssetId) -> bool { + >::exists(AssetPair::new(asset_b, asset_a)) + } + + fn spot_price(asset_a: AssetId, asset_b: AssetId) -> Option { + if Self::pair_exists(asset_a, asset_b) { + let pair_account = >::get_pair_id(AssetPair { + asset_out: asset_a, + asset_in: asset_b, + }); + let asset_a_reserve = T::Currency::free_balance(asset_a, &pair_account); + let asset_b_reserve = T::Currency::free_balance(asset_b, &pair_account); + + Price::checked_from_rational(asset_a_reserve, asset_b_reserve) + } else { + None + } + } +} diff --git a/pallets/xyk/src/lib.rs b/pallets/xyk/src/lib.rs new file mode 100644 index 00000000000..a1099cfd981 --- /dev/null +++ b/pallets/xyk/src/lib.rs @@ -0,0 +1,1115 @@ +// This file is part of HydraDX-node. + +// 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. + +//! # XYK Pallet +//! +//! ## Overview +//! +//! XYK pallet provides functionality for managing liquidity pool and executing trades. +//! +//! This pallet implements AMM Api trait therefore it is possible to plug this pool implementation +//! into the exchange pallet. + +#![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::unused_unit)] +#![allow(clippy::upper_case_acronyms)] + +use frame_support::sp_runtime::{traits::Zero, DispatchError}; +use frame_support::{dispatch::DispatchResult, ensure, traits::Get, transactional}; +use frame_system::ensure_signed; +use frame_system::pallet_prelude::BlockNumberFor; +use hydradx_traits::{ + AMMPosition, AMMTransfer, AssetPairAccountIdFor, CanCreatePool, OnCreatePoolHandler, OnLiquidityChangedHandler, + OnTradeHandler, AMM, +}; +use sp_std::{vec, vec::Vec}; + +use crate::types::{Amount, AssetId, AssetPair, Balance}; +use hydra_dx_math::ratio::Ratio; +use orml_traits::{MultiCurrency, MultiCurrencyExtended}; + +#[cfg(test)] +mod tests; + +mod benchmarking; + +mod impls; +mod trade_execution; +pub mod types; +pub mod weights; + +pub use impls::XYKSpotPrice; + +use weights::WeightInfo; + +// Re-export pallet items so that they can be accessed from the crate namespace. +pub use pallet::*; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::OriginFor; + use hydradx_traits::{pools::DustRemovalAccountWhitelist, Source}; + use pallet_asset_registry::traits::ShareTokenRegistry; + + #[pallet::pallet] + pub struct Pallet(_); + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::config] + pub trait Config: frame_system::Config { + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + /// Registry support + type AssetRegistry: ShareTokenRegistry, Balance, DispatchError>; + + /// Share token support + type AssetPairAccountId: AssetPairAccountIdFor; + + /// Multi currency for transfer of currencies + type Currency: MultiCurrencyExtended; + + /// Native Asset Id + #[pallet::constant] + type NativeAssetId: Get; + + /// Weight information for the extrinsics. + type WeightInfo: WeightInfo; + + /// Trading fee rate + #[pallet::constant] + type GetExchangeFee: Get<(u32, u32)>; + + /// Minimum trading limit + #[pallet::constant] + type MinTradingLimit: Get; + + /// Minimum pool liquidity + #[pallet::constant] + type MinPoolLiquidity: Get; + + /// Max fraction of pool to sell in single transaction + #[pallet::constant] + type MaxInRatio: Get; + + /// Max fraction of pool to buy in single transaction + #[pallet::constant] + type MaxOutRatio: Get; + + /// Oracle source identifier for this pallet. + #[pallet::constant] + type OracleSource: Get; + + /// Called to ensure that pool can be created + type CanCreatePool: CanCreatePool; + + /// AMM handlers + type AMMHandler: OnCreatePoolHandler + + OnTradeHandler + + OnLiquidityChangedHandler; + + /// Discounted fee + type DiscountedFee: Get<(u32, u32)>; + + /// Account whitelist manager to exclude pool accounts from dusting mechanism. + type NonDustableWhitelistHandler: DustRemovalAccountWhitelist; + } + + #[pallet::error] + pub enum Error { + /// It is not allowed to create a pool between same assets. + CannotCreatePoolWithSameAssets, + + /// Liquidity has not reached the required minimum. + InsufficientLiquidity, + + /// Amount is less than min trading limit. + InsufficientTradingAmount, + + /// Liquidity is zero. + ZeroLiquidity, + + /// It is not allowed to create a pool with zero initial price. + /// Not used, kept for backward compatibility + ZeroInitialPrice, + + /// Overflow + /// Not used, kept for backward compatibility + CreatePoolAssetAmountInvalid, + + /// Overflow + InvalidMintedLiquidity, // No tests - but it is currently not possible this error to occur due to previous checks in the code. + + /// Overflow + InvalidLiquidityAmount, // no tests - it is currently not possible this error to occur due to previous checks in the code. + + /// Asset amount has exceeded given limit. + AssetAmountExceededLimit, + + /// Asset amount has not reached given limit. + AssetAmountNotReachedLimit, + + /// Asset balance is not sufficient. + InsufficientAssetBalance, + + /// Not enough asset liquidity in the pool. + InsufficientPoolAssetBalance, + + /// Not enough core asset liquidity in the pool. + InsufficientNativeCurrencyBalance, + + /// Liquidity pool for given assets does not exist. + TokenPoolNotFound, + + /// Liquidity pool for given assets already exists. + TokenPoolAlreadyExists, + + /// Overflow + AddAssetAmountInvalid, // no tests + /// Overflow + RemoveAssetAmountInvalid, // no tests + /// Overflow + SellAssetAmountInvalid, // no tests + /// Overflow + BuyAssetAmountInvalid, // no tests + + /// Overflow + FeeAmountInvalid, + + /// Overflow + CannotApplyDiscount, + + /// Max fraction of pool to buy in single transaction has been exceeded. + MaxOutRatioExceeded, + /// Max fraction of pool to sell in single transaction has been exceeded. + MaxInRatioExceeded, + + /// Overflow + Overflow, + + /// Pool cannot be created due to outside factors. + CannotCreatePool, + } + + #[pallet::event] + #[pallet::generate_deposit(pub(crate) fn deposit_event)] + pub enum Event { + /// New liquidity was provided to the pool. + LiquidityAdded { + who: T::AccountId, + asset_a: AssetId, + asset_b: AssetId, + amount_a: Balance, + amount_b: Balance, + }, + + /// Liquidity was removed from the pool. + LiquidityRemoved { + who: T::AccountId, + asset_a: AssetId, + asset_b: AssetId, + shares: Balance, + }, + + /// Pool was created. + PoolCreated { + who: T::AccountId, + asset_a: AssetId, + asset_b: AssetId, + initial_shares_amount: Balance, + share_token: AssetId, + pool: T::AccountId, + }, + + /// Pool was destroyed. + PoolDestroyed { + who: T::AccountId, + asset_a: AssetId, + asset_b: AssetId, + share_token: AssetId, + pool: T::AccountId, + }, + + /// Asset sale executed. + SellExecuted { + who: T::AccountId, + asset_in: AssetId, + asset_out: AssetId, + amount: Balance, + sale_price: Balance, + fee_asset: AssetId, + fee_amount: Balance, + pool: T::AccountId, + }, + + /// Asset purchase executed. + BuyExecuted { + who: T::AccountId, + asset_out: AssetId, + asset_in: AssetId, + amount: Balance, + buy_price: Balance, + fee_asset: AssetId, + fee_amount: Balance, + pool: T::AccountId, + }, + } + + /// Asset id storage for shared pool tokens + #[pallet::storage] + #[pallet::getter(fn share_token)] + pub(crate) type ShareToken = StorageMap<_, Blake2_128Concat, T::AccountId, AssetId, ValueQuery>; + + /// Total liquidity in a pool. + #[pallet::storage] + #[pallet::getter(fn total_liquidity)] + pub(crate) type TotalLiquidity = StorageMap<_, Blake2_128Concat, T::AccountId, Balance, ValueQuery>; + + /// Asset pair in a pool. + #[pallet::storage] + #[pallet::getter(fn pool_assets)] + pub(crate) type PoolAssets = + StorageMap<_, Blake2_128Concat, T::AccountId, (AssetId, AssetId), OptionQuery>; + + #[pallet::call] + impl Pallet { + /// Create new pool for given asset pair. + /// + /// Registers new pool for given asset pair (`asset a` and `asset b`) in asset registry. + /// Asset registry creates new id or returns previously created one if such pool existed before. + /// + /// Pool is created with initial liquidity provided by `origin`. + /// Shares are issued with specified initial price and represents proportion of asset in the pool. + /// + /// Emits `PoolCreated` event when successful. + #[pallet::call_index(0)] + #[pallet::weight(::WeightInfo::create_pool())] + pub fn create_pool( + origin: OriginFor, + asset_a: AssetId, + amount_a: Balance, + asset_b: AssetId, + amount_b: Balance, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + ensure!( + T::CanCreatePool::can_create(asset_a, asset_b), + Error::::CannotCreatePool + ); + + ensure!( + amount_a >= T::MinPoolLiquidity::get() && amount_b >= T::MinPoolLiquidity::get(), + Error::::InsufficientLiquidity + ); + + ensure!(asset_a != asset_b, Error::::CannotCreatePoolWithSameAssets); + + let asset_pair = AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }; + + ensure!(!Self::exists(asset_pair), Error::::TokenPoolAlreadyExists); + + let shares_added = if asset_a < asset_b { amount_a } else { amount_b }; + + ensure!( + T::Currency::free_balance(asset_a, &who) >= amount_a, + Error::::InsufficientAssetBalance + ); + + ensure!( + T::Currency::free_balance(asset_b, &who) >= amount_b, + Error::::InsufficientAssetBalance + ); + + let pair_account = Self::get_pair_id(asset_pair); + + let token_name = asset_pair.name(); + + let share_token = T::AssetRegistry::get_or_create_shared_asset( + token_name, + vec![asset_a, asset_b], + T::MinPoolLiquidity::get(), + )?; + + let _ = T::AMMHandler::on_create_pool(asset_pair.asset_in, asset_pair.asset_out); + + T::NonDustableWhitelistHandler::add_account(&pair_account)?; + + >::insert(&pair_account, share_token); + >::insert(&pair_account, (asset_a, asset_b)); + + Self::deposit_event(Event::PoolCreated { + who: who.clone(), + asset_a, + asset_b, + initial_shares_amount: shares_added, + share_token, + pool: pair_account.clone(), + }); + + T::Currency::transfer(asset_a, &who, &pair_account, amount_a)?; + T::Currency::transfer(asset_b, &who, &pair_account, amount_b)?; + + T::Currency::deposit(share_token, &who, shares_added)?; + + >::insert(&pair_account, shares_added); + + Ok(()) + } + + /// Add liquidity to previously created asset pair pool. + /// + /// Shares are issued with current price. + /// + /// Emits `LiquidityAdded` event when successful. + #[pallet::call_index(1)] + #[pallet::weight( + ::WeightInfo::add_liquidity() + .saturating_add(T::AMMHandler::on_liquidity_changed_weight()) + )] + #[transactional] + pub fn add_liquidity( + origin: OriginFor, + asset_a: AssetId, + asset_b: AssetId, + amount_a: Balance, + amount_b_max_limit: Balance, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + let asset_pair = AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }; + + ensure!(Self::exists(asset_pair), Error::::TokenPoolNotFound); + + ensure!( + amount_a >= T::MinTradingLimit::get(), + Error::::InsufficientTradingAmount + ); + + ensure!(!amount_b_max_limit.is_zero(), Error::::ZeroLiquidity); + + ensure!( + T::Currency::free_balance(asset_a, &who) >= amount_a, + Error::::InsufficientAssetBalance + ); + + let pair_account = Self::get_pair_id(asset_pair); + + let share_token = Self::share_token(&pair_account); + + let account_shares = T::Currency::free_balance(share_token, &who); + + let asset_a_reserve = T::Currency::free_balance(asset_a, &pair_account); + let asset_b_reserve = T::Currency::free_balance(asset_b, &pair_account); + let share_issuance = Self::total_liquidity(&pair_account); + + let amount_b = hydra_dx_math::xyk::calculate_liquidity_in(asset_a_reserve, asset_b_reserve, amount_a) + .map_err(|_| Error::::AddAssetAmountInvalid)?; + + ensure!( + T::Currency::free_balance(asset_b, &who) >= amount_b, + Error::::InsufficientAssetBalance + ); + + ensure!(amount_b <= amount_b_max_limit, Error::::AssetAmountExceededLimit); + + let shares_added = hydra_dx_math::xyk::calculate_shares(asset_a_reserve, amount_a, share_issuance) + .ok_or(Error::::Overflow)?; + + ensure!(!shares_added.is_zero(), Error::::InvalidMintedLiquidity); + + // Make sure that account share liquidity is at least MinPoolLiquidity + ensure!( + account_shares + .checked_add(shares_added) + .ok_or(Error::::InvalidMintedLiquidity)? + >= T::MinPoolLiquidity::get(), + Error::::InsufficientLiquidity + ); + + let liquidity_amount = share_issuance + .checked_add(shares_added) + .ok_or(Error::::InvalidLiquidityAmount)?; + + T::Currency::transfer(asset_a, &who, &pair_account, amount_a)?; + T::Currency::transfer(asset_b, &who, &pair_account, amount_b)?; + + T::Currency::deposit(share_token, &who, shares_added)?; + + >::insert(&pair_account, liquidity_amount); + + let liquidity_a = T::Currency::total_balance(asset_a, &pair_account); + let liquidity_b = T::Currency::total_balance(asset_b, &pair_account); + T::AMMHandler::on_liquidity_changed( + T::OracleSource::get(), + asset_a, + asset_b, + amount_a, + amount_b, + liquidity_a, + liquidity_b, + Ratio::new(liquidity_a, liquidity_b), + ) + .map_err(|(_w, e)| e)?; + + Self::deposit_event(Event::LiquidityAdded { + who, + asset_a, + asset_b, + amount_a, + amount_b, + }); + + Ok(()) + } + + /// Remove liquidity from specific liquidity pool in the form of burning shares. + /// + /// If liquidity in the pool reaches 0, it is destroyed. + /// + /// Emits 'LiquidityRemoved' when successful. + /// Emits 'PoolDestroyed' when pool is destroyed. + #[pallet::call_index(2)] + #[pallet::weight( + ::WeightInfo::remove_liquidity() + .saturating_add(T::AMMHandler::on_liquidity_changed_weight()) + )] + #[transactional] + pub fn remove_liquidity( + origin: OriginFor, + asset_a: AssetId, + asset_b: AssetId, + liquidity_amount: Balance, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + let asset_pair = AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }; + + ensure!(!liquidity_amount.is_zero(), Error::::ZeroLiquidity); + + ensure!(Self::exists(asset_pair), Error::::TokenPoolNotFound); + + let pair_account = Self::get_pair_id(asset_pair); + + let share_token = Self::share_token(&pair_account); + + let total_shares = Self::total_liquidity(&pair_account); + + let account_shares = T::Currency::free_balance(share_token, &who); + + ensure!(total_shares >= liquidity_amount, Error::::InsufficientLiquidity); + + ensure!(account_shares >= liquidity_amount, Error::::InsufficientAssetBalance); + + // Account's liquidity left should be either 0 or at least MinPoolLiquidity + ensure!( + (account_shares.saturating_sub(liquidity_amount)) >= T::MinPoolLiquidity::get() + || (account_shares == liquidity_amount), + Error::::InsufficientLiquidity + ); + + let asset_a_reserve = T::Currency::free_balance(asset_a, &pair_account); + let asset_b_reserve = T::Currency::free_balance(asset_b, &pair_account); + + let liquidity_out = hydra_dx_math::xyk::calculate_liquidity_out( + asset_a_reserve, + asset_b_reserve, + liquidity_amount, + total_shares, + ) + .map_err(|_| Error::::RemoveAssetAmountInvalid)?; + + let (remove_amount_a, remove_amount_b) = liquidity_out; + + ensure!( + T::Currency::free_balance(asset_a, &pair_account) >= remove_amount_a, + Error::::InsufficientPoolAssetBalance + ); + ensure!( + T::Currency::free_balance(asset_b, &pair_account) >= remove_amount_b, + Error::::InsufficientPoolAssetBalance + ); + + let liquidity_left = total_shares + .checked_sub(liquidity_amount) + .ok_or(Error::::InvalidLiquidityAmount)?; + + T::Currency::transfer(asset_a, &pair_account, &who, remove_amount_a)?; + T::Currency::transfer(asset_b, &pair_account, &who, remove_amount_b)?; + + T::Currency::withdraw(share_token, &who, liquidity_amount)?; + + >::insert(&pair_account, liquidity_left); + + let liquidity_a = T::Currency::total_balance(asset_a, &pair_account); + let liquidity_b = T::Currency::total_balance(asset_b, &pair_account); + T::AMMHandler::on_liquidity_changed( + T::OracleSource::get(), + asset_a, + asset_b, + remove_amount_a, + remove_amount_b, + liquidity_a, + liquidity_b, + Ratio::new(liquidity_a, liquidity_b), + ) + .map_err(|(_w, e)| e)?; + + Self::deposit_event(Event::LiquidityRemoved { + who: who.clone(), + asset_a, + asset_b, + shares: liquidity_amount, + }); + + if liquidity_left == 0 { + >::remove(&pair_account); + >::remove(&pair_account); + >::remove(&pair_account); + + // Ignore the failure, this cant stop liquidity removal + let r = T::NonDustableWhitelistHandler::remove_account(&pair_account); + + if r.is_err() { + log::trace!( + target: "xyk::remova_liquidity", "XYK: Failed to remove account {:?} from dust-removal whitelist. Reason {:?}", + pair_account, + r + ); + } + + Self::deposit_event(Event::PoolDestroyed { + who, + asset_a, + asset_b, + share_token, + pool: pair_account, + }); + } + + Ok(()) + } + + /// Trade asset in for asset out. + /// + /// Executes a swap of `asset_in` for `asset_out`. Price is determined by the liquidity pool. + /// + /// `max_limit` - minimum amount of `asset_out` / amount of asset_out to be obtained from the pool in exchange for `asset_in`. + /// + /// Emits `SellExecuted` when successful. + #[pallet::call_index(3)] + #[pallet::weight(::WeightInfo::sell() + ::AMMHandler::on_trade_weight())] + pub fn sell( + origin: OriginFor, + asset_in: AssetId, + asset_out: AssetId, + amount: Balance, + max_limit: Balance, + discount: bool, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + >::sell(&who, AssetPair { asset_in, asset_out }, amount, max_limit, discount)?; + + Ok(()) + } + + /// Trade asset in for asset out. + /// + /// Executes a swap of `asset_in` for `asset_out`. Price is determined by the liquidity pool. + /// + /// `max_limit` - maximum amount of `asset_in` to be sold in exchange for `asset_out`. + /// + /// Emits `BuyExecuted` when successful. + #[pallet::call_index(4)] + #[pallet::weight(::WeightInfo::buy() + ::AMMHandler::on_trade_weight())] + pub fn buy( + origin: OriginFor, + asset_out: AssetId, + asset_in: AssetId, + amount: Balance, + max_limit: Balance, + discount: bool, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + >::buy(&who, AssetPair { asset_in, asset_out }, amount, max_limit, discount)?; + + Ok(()) + } + } +} + +impl Pallet { + /// Return balance of each asset in selected liquidity pool. + pub fn get_pool_balances(pool_address: T::AccountId) -> Option> { + let mut balances = Vec::new(); + + if let Some(assets) = Self::get_pool_assets(&pool_address) { + for item in &assets { + let reserve = T::Currency::free_balance(*item, &pool_address); + balances.push((*item, reserve)); + } + } + Some(balances) + } + /// Calculate discounted trade fee + fn calculate_discounted_fee(amount: Balance) -> Result { + Ok( + hydra_dx_math::fee::calculate_pool_trade_fee(amount, T::DiscountedFee::get()) + .ok_or::>(Error::::FeeAmountInvalid)?, + ) + } + + /// Calculate trade fee + fn calculate_fee(amount: Balance) -> Result { + let fee = T::GetExchangeFee::get(); + Ok(hydra_dx_math::fee::calculate_pool_trade_fee(amount, (fee.0, fee.1)) + .ok_or::>(Error::::FeeAmountInvalid)?) + } + + pub fn pair_account_from_assets(asset_a: AssetId, asset_b: AssetId) -> T::AccountId { + T::AssetPairAccountId::from_assets(asset_a, asset_b, "xyk") + } +} + +// Implementation of AMM API which makes possible to plug the AMM pool into the exchange pallet. +impl AMM for Pallet { + fn exists(assets: AssetPair) -> bool { + >::contains_key(&Self::get_pair_id(assets)) + } + + fn get_pair_id(assets: AssetPair) -> T::AccountId { + Self::pair_account_from_assets(assets.asset_in, assets.asset_out) + } + + fn get_share_token(assets: AssetPair) -> AssetId { + let pair_account = Self::get_pair_id(assets); + Self::share_token(&pair_account) + } + + fn get_pool_assets(pool_account_id: &T::AccountId) -> Option> { + let maybe_assets = >::get(pool_account_id); + maybe_assets.map(|assets| vec![assets.0, assets.1]) + } + + fn get_spot_price_unchecked(asset_a: AssetId, asset_b: AssetId, amount: Balance) -> Balance { + let pair_account = Self::get_pair_id(AssetPair { + asset_out: asset_a, + asset_in: asset_b, + }); + + let asset_a_reserve = T::Currency::free_balance(asset_a, &pair_account); + let asset_b_reserve = T::Currency::free_balance(asset_b, &pair_account); + + hydra_dx_math::xyk::calculate_spot_price(asset_a_reserve, asset_b_reserve, amount) + .unwrap_or_else(|_| Balance::zero()) + } + + /// Validate a sell. Perform all necessary checks and calculations. + /// No storage changes are performed yet. + /// + /// Return `AMMTransfer` with all info needed to execute the transaction. + fn validate_sell( + who: &T::AccountId, + assets: AssetPair, + amount: Balance, + min_bought: Balance, + discount: bool, + ) -> Result, sp_runtime::DispatchError> { + ensure!( + amount >= T::MinTradingLimit::get(), + Error::::InsufficientTradingAmount + ); + + ensure!(Self::exists(assets), Error::::TokenPoolNotFound); + + ensure!( + T::Currency::free_balance(assets.asset_in, who) >= amount, + Error::::InsufficientAssetBalance + ); + + // If discount, pool for Sell asset and native asset must exist + if discount { + ensure!( + Self::exists(AssetPair { + asset_in: assets.asset_in, + asset_out: T::NativeAssetId::get() + }), + Error::::CannotApplyDiscount + ); + } + + let pair_account = Self::get_pair_id(assets); + + let asset_in_reserve = T::Currency::free_balance(assets.asset_in, &pair_account); + let asset_out_reserve = T::Currency::free_balance(assets.asset_out, &pair_account); + + ensure!( + amount + <= asset_in_reserve + .checked_div(T::MaxInRatio::get()) + .ok_or(Error::::Overflow)?, + Error::::MaxInRatioExceeded + ); + + let amount_out = hydra_dx_math::xyk::calculate_out_given_in(asset_in_reserve, asset_out_reserve, amount) + .map_err(|_| Error::::SellAssetAmountInvalid)?; + + ensure!( + amount_out + <= asset_out_reserve + .checked_div(T::MaxOutRatio::get()) + .ok_or(Error::::Overflow)?, + Error::::MaxOutRatioExceeded + ); + + let transfer_fee = if discount { + Self::calculate_discounted_fee(amount_out)? + } else { + Self::calculate_fee(amount_out)? + }; + + let amount_out_without_fee = amount_out + .checked_sub(transfer_fee) + .ok_or(Error::::SellAssetAmountInvalid)?; + + ensure!(asset_out_reserve > amount_out, Error::::InsufficientAssetBalance); + + ensure!( + min_bought <= amount_out_without_fee, + Error::::AssetAmountNotReachedLimit + ); + + let discount_fee = if discount { + let native_asset = T::NativeAssetId::get(); + + let native_pair_account = Self::get_pair_id(AssetPair { + asset_in: assets.asset_in, + asset_out: native_asset, + }); + + let native_reserve = T::Currency::free_balance(native_asset, &native_pair_account); + let asset_reserve = T::Currency::free_balance(assets.asset_in, &native_pair_account); + + let native_fee_spot_price = + hydra_dx_math::xyk::calculate_spot_price(asset_reserve, native_reserve, transfer_fee) + .map_err(|_| Error::::CannotApplyDiscount)?; + + ensure!( + T::Currency::free_balance(native_asset, who) >= native_fee_spot_price, + Error::::InsufficientNativeCurrencyBalance + ); + + native_fee_spot_price + } else { + Balance::zero() + }; + + let transfer = AMMTransfer { + origin: who.clone(), + assets, + amount, + amount_b: amount_out_without_fee, + discount, + discount_amount: discount_fee, + fee: (assets.asset_out, transfer_fee), + }; + + Ok(transfer) + } + + /// Execute sell. validate_sell must be called first. + /// Perform necessary storage/state changes. + /// Note : the execution should not return error as everything was previously verified and validated. + #[transactional] + fn execute_sell(transfer: &AMMTransfer) -> DispatchResult { + let pair_account = Self::get_pair_id(transfer.assets); + + if transfer.discount && transfer.discount_amount > 0u128 { + let native_asset = T::NativeAssetId::get(); + T::Currency::withdraw(native_asset, &transfer.origin, transfer.discount_amount)?; + } + + T::Currency::transfer( + transfer.assets.asset_in, + &transfer.origin, + &pair_account, + transfer.amount, + )?; + T::Currency::transfer( + transfer.assets.asset_out, + &pair_account, + &transfer.origin, + transfer.amount_b, + )?; + + let liquidity_in = T::Currency::total_balance(transfer.assets.asset_in, &pair_account); + let liquidity_out = T::Currency::total_balance(transfer.assets.asset_out, &pair_account); + T::AMMHandler::on_trade( + T::OracleSource::get(), + transfer.assets.asset_in, + transfer.assets.asset_out, + transfer.amount, + transfer.amount_b, + liquidity_in, + liquidity_out, + Ratio::new(liquidity_in, liquidity_out), + ) + .map_err(|(_w, e)| e)?; + + Self::deposit_event(Event::::SellExecuted { + who: transfer.origin.clone(), + asset_in: transfer.assets.asset_in, + asset_out: transfer.assets.asset_out, + amount: transfer.amount, + sale_price: transfer.amount_b, + fee_asset: transfer.fee.0, + fee_amount: transfer.fee.1, + pool: pair_account, + }); + + Ok(()) + } + + /// Validate a buy. Perform all necessary checks and calculations. + /// No storage changes are performed yet. + /// + /// Return `AMMTransfer` with all info needed to execute the transaction. + fn validate_buy( + who: &T::AccountId, + assets: AssetPair, + amount: Balance, + max_limit: Balance, + discount: bool, + ) -> Result, DispatchError> { + ensure!( + amount >= T::MinTradingLimit::get(), + Error::::InsufficientTradingAmount + ); + + ensure!(Self::exists(assets), Error::::TokenPoolNotFound); + + let pair_account = Self::get_pair_id(assets); + + let asset_out_reserve = T::Currency::free_balance(assets.asset_out, &pair_account); + let asset_in_reserve = T::Currency::free_balance(assets.asset_in, &pair_account); + + ensure!(asset_out_reserve > amount, Error::::InsufficientPoolAssetBalance); + + ensure!( + amount + <= asset_out_reserve + .checked_div(T::MaxOutRatio::get()) + .ok_or(Error::::Overflow)?, + Error::::MaxOutRatioExceeded + ); + + // If discount, pool for Sell asset and native asset must exist + if discount { + ensure!( + Self::exists(AssetPair { + asset_in: assets.asset_out, + asset_out: T::NativeAssetId::get() + }), + Error::::CannotApplyDiscount + ); + } + + let buy_price = hydra_dx_math::xyk::calculate_in_given_out(asset_out_reserve, asset_in_reserve, amount) + .map_err(|_| Error::::BuyAssetAmountInvalid)?; + + ensure!( + buy_price + <= asset_in_reserve + .checked_div(T::MaxInRatio::get()) + .ok_or(Error::::Overflow)?, + Error::::MaxInRatioExceeded + ); + + let transfer_fee = if discount { + Self::calculate_discounted_fee(buy_price)? + } else { + Self::calculate_fee(buy_price)? + }; + + let buy_price_with_fee = buy_price + .checked_add(transfer_fee) + .ok_or(Error::::BuyAssetAmountInvalid)?; + + ensure!(max_limit >= buy_price_with_fee, Error::::AssetAmountExceededLimit); + + ensure!( + T::Currency::free_balance(assets.asset_in, who) >= buy_price_with_fee, + Error::::InsufficientAssetBalance + ); + + let discount_fee = if discount { + let native_asset = T::NativeAssetId::get(); + + let native_pair_account = Self::get_pair_id(AssetPair { + asset_in: assets.asset_out, + asset_out: native_asset, + }); + + let native_reserve = T::Currency::free_balance(native_asset, &native_pair_account); + let asset_reserve = T::Currency::free_balance(assets.asset_out, &native_pair_account); + + let native_fee_spot_price = + hydra_dx_math::xyk::calculate_spot_price(asset_reserve, native_reserve, transfer_fee) + .map_err(|_| Error::::CannotApplyDiscount)?; + + ensure!( + T::Currency::free_balance(native_asset, who) >= native_fee_spot_price, + Error::::InsufficientNativeCurrencyBalance + ); + native_fee_spot_price + } else { + Balance::zero() + }; + + let transfer = AMMTransfer { + origin: who.clone(), + assets, + amount, + amount_b: buy_price, + discount, + discount_amount: discount_fee, + fee: (assets.asset_in, transfer_fee), + }; + + Ok(transfer) + } + + /// Execute buy. validate_buy must be called first. + /// Perform necessary storage/state changes. + /// Note : the execution should not return error as everything was previously verified and validated. + #[transactional] + fn execute_buy(transfer: &AMMTransfer) -> DispatchResult { + let pair_account = Self::get_pair_id(transfer.assets); + + if transfer.discount && transfer.discount_amount > 0 { + let native_asset = T::NativeAssetId::get(); + T::Currency::withdraw(native_asset, &transfer.origin, transfer.discount_amount)?; + } + + T::Currency::transfer( + transfer.assets.asset_out, + &pair_account, + &transfer.origin, + transfer.amount, + )?; + T::Currency::transfer( + transfer.assets.asset_in, + &transfer.origin, + &pair_account, + transfer.amount_b + transfer.fee.1, + )?; + + let liquidity_in = T::Currency::total_balance(transfer.assets.asset_in, &pair_account); + let liquidity_out = T::Currency::total_balance(transfer.assets.asset_out, &pair_account); + T::AMMHandler::on_trade( + T::OracleSource::get(), + transfer.assets.asset_in, + transfer.assets.asset_out, + transfer.amount, + transfer.amount_b, + liquidity_in, + liquidity_out, + Ratio::new(liquidity_in, liquidity_out), + ) + .map_err(|(_w, e)| e)?; + + Self::deposit_event(Event::::BuyExecuted { + who: transfer.origin.clone(), + asset_out: transfer.assets.asset_out, + asset_in: transfer.assets.asset_in, + amount: transfer.amount, + buy_price: transfer.amount_b, + fee_asset: transfer.fee.0, + fee_amount: transfer.fee.1, + pool: pair_account, + }); + + Ok(()) + } + + fn get_min_trading_limit() -> Balance { + T::MinTradingLimit::get() + } + + fn get_min_pool_liquidity() -> Balance { + T::MinPoolLiquidity::get() + } + + fn get_max_in_ratio() -> u128 { + T::MaxInRatio::get() + } + + fn get_max_out_ratio() -> u128 { + T::MaxOutRatio::get() + } + + fn get_fee(_pool_account_id: &T::AccountId) -> (u32, u32) { + T::GetExchangeFee::get() + } +} + +pub struct AllowAllPools(); + +impl CanCreatePool for AllowAllPools { + fn can_create(_asset_a: AssetId, _asset_b: AssetId) -> bool { + true + } +} + +impl AMMPosition for Pallet { + type Error = DispatchError; + + fn get_liquidity_behind_shares( + asset_a: AssetId, + asset_b: AssetId, + shares_amount: Balance, + ) -> Result<(Balance, Balance), Self::Error> { + let asset_pair = AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }; + + let pair_account = Self::get_pair_id(asset_pair); + + let total_shares = Self::total_liquidity(&pair_account); + + let asset_a_reserve = T::Currency::free_balance(asset_a, &pair_account); + let asset_b_reserve = T::Currency::free_balance(asset_b, &pair_account); + + hydra_dx_math::xyk::calculate_liquidity_out(asset_a_reserve, asset_b_reserve, shares_amount, total_shares) + .map_err(|_| Error::::RemoveAssetAmountInvalid.into()) + } +} diff --git a/pallets/xyk/src/tests/amm_position.rs b/pallets/xyk/src/tests/amm_position.rs new file mode 100644 index 00000000000..65196d4d306 --- /dev/null +++ b/pallets/xyk/src/tests/amm_position.rs @@ -0,0 +1,53 @@ +use super::mock::*; +use crate::types::AssetPair; +use crate::*; +use frame_support::assert_ok; + +#[test] +fn get_liquidity_behind_shares_should_return_both_assets_value_when_pool_exists() { + let asset_a = ACA; + let asset_b = DOT; + + ExtBuilder::default() + .with_accounts(vec![(ALICE, asset_a, 1_000 * ONE), (ALICE, asset_b, 1_000 * ONE)]) + .build() + .execute_with(|| { + //arange + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 100 * ONE, + asset_b, + 10 * ONE + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + let share_token = XYK::share_token(pair_account); + + let shares_amount = Currency::free_balance(share_token, &ALICE); + + assert_eq!( + XYK::get_liquidity_behind_shares(asset_a, asset_b, shares_amount).unwrap(), + (100 * ONE, 10 * ONE) + ); + + assert_eq!( + XYK::get_liquidity_behind_shares(asset_b, asset_a, shares_amount).unwrap(), + (10 * ONE, 100 * ONE) + ); + + assert_eq!( + XYK::get_liquidity_behind_shares(asset_b, asset_a, shares_amount / 2).unwrap(), + (5 * ONE, 50 * ONE) + ); + + assert_eq!( + XYK::get_liquidity_behind_shares(asset_a, asset_b, shares_amount / 2).unwrap(), + (50 * ONE, 5 * ONE) + ); + }); +} diff --git a/pallets/xyk/src/tests/creation.rs b/pallets/xyk/src/tests/creation.rs new file mode 100644 index 00000000000..e6566ecc9b7 --- /dev/null +++ b/pallets/xyk/src/tests/creation.rs @@ -0,0 +1,425 @@ +pub use super::mock::*; +use crate::{Error, Event}; +use frame_support::{assert_noop, assert_ok, BoundedVec}; +use hydradx_traits::Registry; +use hydradx_traits::AMM as AmmPool; +use orml_traits::MultiCurrency; +use pallet_asset_registry::AssetType; +use sp_std::convert::TryInto; + +use crate::types::AssetPair; + +#[test] +fn create_pool_should_work() { + new_test_ext().execute_with(|| { + let asset_a = HDX; + let asset_b = ACA; + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 100_000_000_000_000, + asset_b, + 10 * 100_000_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(XYK::get_pool_assets(&pair_account), Some(vec![asset_a, asset_b])); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 100000000000000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 1000000000000000); + assert_eq!(Currency::free_balance(asset_a, &ALICE), 900000000000000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 0); + assert_eq!(Currency::free_balance(share_token, &ALICE), 100000000000000); + assert_eq!(XYK::total_liquidity(pair_account), 100000000000000); + + let name: Vec = vec![232, 3, 0, 0, 72, 68, 84, 184, 11, 0, 0]; + let bounded_name: BoundedVec::StringLimit> = + name.try_into().unwrap(); + + expect_events(vec![ + pallet_asset_registry::Event::Registered { + asset_id: share_token, + asset_name: bounded_name, + asset_type: AssetType::PoolShare(HDX, ACA), + } + .into(), + Event::PoolCreated { + who: ALICE, + asset_a, + asset_b, + initial_shares_amount: 100000000000000, + share_token, + pool: pair_account, + } + .into(), + frame_system::Event::NewAccount { account: pair_account }.into(), + orml_tokens::Event::Endowed { + currency_id: asset_a, + who: pair_account, + amount: 100000000000000, + } + .into(), + orml_tokens::Event::Endowed { + currency_id: asset_b, + who: pair_account, + amount: 1000000000000000, + } + .into(), + orml_tokens::Event::Endowed { + currency_id: share_token, + who: ALICE, + amount: 100000000000000, + } + .into(), + ]); + }); +} + +#[test] +fn create_same_pool_should_not_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = HDX; + let asset_b = ACA; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_b, + 1000, + asset_a, + 2000, + )); + assert_noop!( + XYK::create_pool(RuntimeOrigin::signed(user), asset_b, 999, asset_a, 2 * 999), + Error::::InsufficientLiquidity + ); + assert_noop!( + XYK::create_pool(RuntimeOrigin::signed(user), asset_b, 1000, asset_a, 0), + Error::::InsufficientLiquidity + ); + assert_noop!( + XYK::create_pool(RuntimeOrigin::signed(user), asset_a, 1000, asset_a, 2000), + Error::::CannotCreatePoolWithSameAssets + ); + assert_noop!( + XYK::create_pool(RuntimeOrigin::signed(user), asset_b, 1000, asset_a, 2000), + Error::::TokenPoolAlreadyExists + ); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + expect_events(vec![Event::PoolCreated { + who: ALICE, + asset_a: asset_b, + asset_b: asset_a, + initial_shares_amount: 2000, + share_token, + pool: pair_account, + } + .into()]); + }); +} + +#[test] +fn create_pool_with_insufficient_balance_should_not_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = HDX; + + assert_noop!( + XYK::create_pool( + RuntimeOrigin::signed(user), + 4000, + 100_000_000_000_000, + asset_a, + 10 * 100_000_000_000_000, + ), + Error::::InsufficientAssetBalance + ); + + assert_noop!( + XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 100_000_000_000_000, + 4000, + 10 * 100_000_000_000_000, + ), + Error::::InsufficientAssetBalance + ); + }); +} + +#[test] +fn create_pool_with_insufficient_liquidity_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + XYK::create_pool(RuntimeOrigin::signed(ALICE), ACA, 500, HDX, 5000), + Error::::InsufficientLiquidity + ); + + assert_noop!( + XYK::create_pool(RuntimeOrigin::signed(ALICE), ACA, 5000, HDX, 500), + Error::::InsufficientLiquidity + ); + }); +} + +#[test] +fn create_pool_small_fixed_point_amount_should_work() { + new_test_ext().execute_with(|| { + let asset_a = HDX; + let asset_b = ACA; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 100_000_000_000_000, + asset_b, + 1_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 100000000000000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 1000000000); + assert_eq!(Currency::free_balance(asset_a, &ALICE), 900000000000000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 999999000000000); + assert_eq!(Currency::free_balance(share_token, &ALICE), 100000000000000); + assert_eq!(XYK::total_liquidity(pair_account), 100000000000000); + + expect_events(vec![Event::PoolCreated { + who: ALICE, + asset_a, + asset_b, + initial_shares_amount: 100000000000000, + share_token, + pool: pair_account, + } + .into()]); + }); +} + +#[test] +fn destroy_pool_on_remove_liquidity_and_recreate_should_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = HDX; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 100_000_000, + asset_b, + 1_000_000_000_000, + )); + + let asset_pair = AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }; + + let pair_account = XYK::get_pair_id(asset_pair); + let share_token = XYK::share_token(pair_account); + + assert!(XYK::exists(asset_pair)); + + assert_ok!(XYK::remove_liquidity( + RuntimeOrigin::signed(user), + asset_a, + asset_b, + 100_000_000 + )); + + assert_eq!(XYK::total_liquidity(pair_account), 0); + + assert!(!XYK::exists(asset_pair)); + + // It should be possible to recreate the pool again + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 100_000_000, + asset_b, + 1_000_000_000_000 + )); + + expect_events(vec![ + Event::PoolCreated { + who: user, + asset_a, + asset_b, + initial_shares_amount: 100_000_000, + share_token, + pool: pair_account, + } + .into(), + frame_system::Event::KilledAccount { account: pair_account }.into(), + Event::LiquidityRemoved { + who: user, + asset_a, + asset_b, + shares: 100_000_000, + } + .into(), + Event::PoolDestroyed { + who: user, + asset_a, + asset_b, + share_token, + pool: pair_account, + } + .into(), + frame_system::Event::NewAccount { account: pair_account }.into(), + orml_tokens::Event::Endowed { + currency_id: asset_a, + who: pair_account, + amount: 100000000, + } + .into(), + orml_tokens::Event::Endowed { + currency_id: asset_b, + who: pair_account, + amount: 1000000000000, + } + .into(), + orml_tokens::Event::Endowed { + currency_id: share_token, + who: ALICE, + amount: 100000000, + } + .into(), + Event::PoolCreated { + who: user, + asset_a, + asset_b, + initial_shares_amount: 100_000_000, + share_token, + pool: pair_account, + } + .into(), + ]); + }); +} + +#[test] +fn create_pool_with_same_assets_should_not_be_allowed() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = HDX; + + assert_noop!( + XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 100_000_000, + asset_a, + 100_000_000_000_000_000_000 + ), + Error::::CannotCreatePoolWithSameAssets + ); + }) +} + +#[test] +fn can_create_pool_should_work() { + new_test_ext().execute_with(|| { + let asset_a = 10u32; + let asset_b = 10u32; + assert_noop!( + XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 100_000_000_000_000, + asset_b, + 1_000_000_000_000_000, + ), + Error::::CannotCreatePool + ); + }); +} + +#[test] +fn share_asset_id_should_be_offset() { + // Check that pools are created correctly with offset IDs. + new_test_ext().execute_with(|| { + // Arrange + let asset_pair = AssetPair { + asset_in: HDX, + asset_out: ACA, + }; + + // Next available asset id within the range of reserved IDs + let next_asset_id = AssetRegistry::next_asset_id() + .unwrap() + .checked_sub(::SequentialIdStartAt::get()) + .unwrap(); + + // Register the share token within the range of reserved IDs. + // This is how share tokens were registered before the offset was introduced. + assert_ok!(AssetRegistry::register( + RuntimeOrigin::signed(ALICE), + asset_pair.name(), + AssetType::PoolShare(HDX, ACA), + ::MinPoolLiquidity::get(), + Some(next_asset_id), + None, + None, + None, + )); + + // Create_pool doesn't register new share token if it already exists + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + HDX, + 100_000_000_000_000, + ACA, + 10 * 100_000_000_000_000, + )); + + let pair_account = XYK::get_pair_id(asset_pair); + let share_token = XYK::share_token(pair_account); + + assert_eq!(share_token, next_asset_id); + assert_eq!(AssetRegistry::retrieve_asset(&asset_pair.name()).unwrap(), share_token); + + // Act + let next_asset_id = AssetRegistry::next_asset_id().unwrap(); + + // Create new pool. The share token should be created with offset ID. + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + HDX, + 100_000_000_000_000, + DOT, + 10 * 100_000_000_000_000, + )); + + let asset_pair = AssetPair { + asset_in: HDX, + asset_out: DOT, + }; + + let pair_account = XYK::get_pair_id(asset_pair); + let share_token = XYK::share_token(pair_account); + + // Assert + assert_eq!(share_token, next_asset_id); + assert_eq!(AssetRegistry::retrieve_asset(&asset_pair.name()).unwrap(), share_token); + }); +} diff --git a/pallets/xyk/src/tests/fees.rs b/pallets/xyk/src/tests/fees.rs new file mode 100644 index 00000000000..49937e3a8a5 --- /dev/null +++ b/pallets/xyk/src/tests/fees.rs @@ -0,0 +1,498 @@ +pub use super::mock::*; +use crate::{Error, Event}; +use frame_support::{assert_noop, assert_ok}; +use hydradx_traits::AMM as AmmPool; +use orml_traits::MultiCurrency; + +use crate::types::AssetPair; + +#[test] +fn fee_calculation() { + ExtBuilder::default().build().execute_with(|| { + assert_eq!(XYK::calculate_fee(100_000), Ok(200)); + assert_eq!(XYK::calculate_fee(10_000), Ok(20)); + + assert_eq!(XYK::calculate_discounted_fee(9_999), Ok(0)); + assert_eq!(XYK::calculate_discounted_fee(10_000), Ok(7)); + assert_eq!(XYK::calculate_discounted_fee(100_000), Ok(70)); + }); + ExtBuilder::default() + .with_exchange_fee((10, 1000)) + .with_discounted_fee((10, 1000)) + .build() + .execute_with(|| { + assert_eq!(XYK::calculate_fee(100_000), Ok(1_000)); + assert_eq!(XYK::calculate_fee(10_000), Ok(100)); + + assert_eq!(XYK::calculate_discounted_fee(999), Ok(0)); + assert_eq!(XYK::calculate_discounted_fee(1_000), Ok(10)); + assert_eq!(XYK::calculate_discounted_fee(10_000), Ok(100)); + }); + + ExtBuilder::default() + .with_exchange_fee((10, 0)) + .build() + .execute_with(|| { + assert_eq!(XYK::calculate_fee(100000), Ok(0)); + }); + + ExtBuilder::default() + .with_exchange_fee((10, 1)) + .build() + .execute_with(|| { + assert_noop!(XYK::calculate_fee(u128::MAX), Error::::FeeAmountInvalid); + }); +} + +#[test] +fn get_fee_should_work() { + new_test_ext().execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + HDX, + 1_000_000_000, + DOT, + 2_000_000_000, + )); + + // existing pool + let fee = XYK::get_fee(&HDX_DOT_POOL_ID); + assert_eq!(fee, (2, 1_000)); + // non existing pool + let fee = XYK::get_fee(&1_234); + assert_eq!(fee, (2, 1_000)); + }); +} + +#[test] +fn discount_sell_fees_should_work() { + let accounts = vec![ + (ALICE, HDX, 1_000_000_000_000_000u128), + (ALICE, ACA, 1_000_000_000_000_000u128), + (ALICE, DOT, 1_000_000_000_000_000u128), + ]; + + let asset_a = ACA; + let asset_b = DOT; + + let mut ext: sp_io::TestExternalities = ExtBuilder::default().with_accounts(accounts.clone()).build(); + ext.execute_with(|| System::set_block_number(1)); + ext.execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 1_000_000_000_000, + HDX, + 2_000_000_000_000, + )); + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 200_000_000_000_000, + asset_b, + 400_000_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let native_pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: HDX, + }); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); + assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &ALICE), 998_000_000_000_000); + + assert_ok!(XYK::sell( + RuntimeOrigin::signed(ALICE), + asset_a, + asset_b, + 10_000_000, + 1_500, + true, + )); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_010_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 399_999_980_013_994); + assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 798_999_990_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_019_986_006); + assert_eq!(Currency::free_balance(HDX, &ALICE), 997_999_999_972_014); + + expect_events(vec![Event::SellExecuted { + who: ALICE, + asset_in: asset_a, + asset_out: asset_b, + amount: 10_000_000, + sale_price: 19_986_006, + fee_asset: asset_b, + fee_amount: 13_993, + pool: pair_account, + } + .into()]); + }); + + // 0.1% discount fee + let mut ext: sp_io::TestExternalities = ExtBuilder::default() + .with_accounts(accounts.clone()) + .with_discounted_fee((10, 10_000)) + .build(); + ext.execute_with(|| System::set_block_number(1)); + ext.execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 1_000_000_000_000, + HDX, + 2_000_000_000_000, + )); + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 200_000_000_000_000, + asset_b, + 400_000_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let native_pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: HDX, + }); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); + assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &ALICE), 998_000_000_000_000); + + assert_ok!(XYK::sell( + RuntimeOrigin::signed(ALICE), + asset_a, + asset_b, + 10_000_000, + 1_500, + true, + )); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_010_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 399_999_980_019_991); + assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 798_999_990_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_019_980_009); + assert_eq!(Currency::free_balance(HDX, &ALICE), 997_999_999_960_020); + + expect_events(vec![Event::SellExecuted { + who: ALICE, + asset_in: asset_a, + asset_out: asset_b, + amount: 10_000_000, + sale_price: 19_980_009, + fee_asset: asset_b, + fee_amount: 19_990, + pool: pair_account, + } + .into()]); + }); + + // zero discount fee + let mut ext: sp_io::TestExternalities = ExtBuilder::default() + .with_accounts(accounts) + .with_discounted_fee((0, 0)) + .build(); + ext.execute_with(|| System::set_block_number(1)); + ext.execute_with(|| { + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 1_000_000_000_000, + HDX, + 2_000_000_000_000, + )); + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 200_000_000_000_000, + asset_b, + 400_000_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); + + assert_ok!(XYK::sell( + RuntimeOrigin::signed(ALICE), + asset_a, + asset_b, + 10_000_000, + 1_500, + true, + )); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_010_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 399_999_980_000_001); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 798_999_990_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_019_999_999); + + expect_events(vec![Event::SellExecuted { + who: ALICE, + asset_in: asset_a, + asset_out: asset_b, + amount: 10_000_000, + sale_price: 19_999_999, + fee_asset: asset_b, + fee_amount: 0, + pool: pair_account, + } + .into()]); + }); +} + +#[test] +fn discount_buy_fees_should_work() { + let accounts = vec![ + (ALICE, HDX, 1_000_000_000_000_000u128), + (ALICE, ACA, 1_000_000_000_000_000u128), + (ALICE, DOT, 1_000_000_000_000_000u128), + ]; + + let asset_a = ACA; + let asset_b = DOT; + + let mut ext: sp_io::TestExternalities = ExtBuilder::default().with_accounts(accounts.clone()).build(); + ext.execute_with(|| System::set_block_number(1)); + ext.execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 1_000_000_000_000, + HDX, + 2_000_000_000_000, + )); + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 200_000_000_000_000, + asset_b, + 400_000_000_000_000, + )); + + let native_pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: HDX, + }); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); + assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &ALICE), 998_000_000_000_000); + + assert_ok!(XYK::buy( + RuntimeOrigin::signed(ALICE), + asset_a, + asset_b, + 10_000_000, + 1_000_000_000_000, + true, + )); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 199_999_990_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_020_014_002); + assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_010_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 599_999_979_985_998); // compare to values in previous test to see difference! + assert_eq!(Currency::free_balance(HDX, &ALICE), 997_999_999_972_000); + + expect_events(vec![Event::BuyExecuted { + who: ALICE, + asset_out: asset_a, + asset_in: asset_b, + amount: 10_000_000, + buy_price: 20_000_002, + fee_asset: asset_b, + fee_amount: 14_000, + pool: pair_account, + } + .into()]); + }); + + // 0.1% discount fee + let mut ext: sp_io::TestExternalities = ExtBuilder::default() + .with_accounts(accounts.clone()) + .with_discounted_fee((10, 10_000)) + .build(); + ext.execute_with(|| System::set_block_number(1)); + ext.execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 1_000_000_000_000, + HDX, + 2_000_000_000_000, + )); + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 200_000_000_000_000, + asset_b, + 400_000_000_000_000, + )); + + let native_pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: HDX, + }); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); + assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &ALICE), 998_000_000_000_000); + + assert_ok!(XYK::buy( + RuntimeOrigin::signed(ALICE), + asset_a, + asset_b, + 10_000_000, + 1_000_000_000_000, + true, + )); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 199_999_990_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_020_020_002); + assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); + assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_010_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 599_999_979_979_998); // compare to values in previous test to see difference! + assert_eq!(Currency::free_balance(HDX, &ALICE), 997_999_999_960_000); + + expect_events(vec![Event::BuyExecuted { + who: ALICE, + asset_out: asset_a, + asset_in: asset_b, + amount: 10_000_000, + buy_price: 20_000_002, + fee_asset: asset_b, + fee_amount: 20_000, + pool: pair_account, + } + .into()]); + }); + + // zero discount fee + let mut ext: sp_io::TestExternalities = ExtBuilder::default() + .with_accounts(accounts) + .with_discounted_fee((0, 0)) + .build(); + ext.execute_with(|| System::set_block_number(1)); + ext.execute_with(|| { + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 1_000_000_000_000, + HDX, + 2_000_000_000_000, + )); + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 200_000_000_000_000, + asset_b, + 400_000_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); + + assert_ok!(XYK::buy( + RuntimeOrigin::signed(ALICE), + asset_a, + asset_b, + 10_000_000, + 1_000_000_000, + true, + )); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 199_999_990_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_020_000_002); + + assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_010_000_000); + assert_eq!(Currency::free_balance(asset_b, &ALICE), 599_999_979_999_998); + + expect_events(vec![Event::BuyExecuted { + who: ALICE, + asset_out: asset_a, + asset_in: asset_b, + amount: 10_000_000, + buy_price: 20_000_002, + fee_asset: asset_b, + fee_amount: 0, + pool: pair_account, + } + .into()]); + }); +} diff --git a/pallets/xyk/src/tests/invariants.rs b/pallets/xyk/src/tests/invariants.rs new file mode 100644 index 00000000000..f552e7598df --- /dev/null +++ b/pallets/xyk/src/tests/invariants.rs @@ -0,0 +1,560 @@ +use super::mock::*; +use crate::*; + +use proptest::prelude::*; + +use frame_support::assert_ok; +use primitive_types::U256; +use sp_runtime::{FixedPointNumber, FixedU128}; + +const TOLERANCE: Balance = 1_000; + +#[macro_export] +macro_rules! assert_eq_approx { + ( $x:expr, $y:expr, $z:expr, $r:expr) => {{ + let diff = if $x >= $y { $x - $y } else { $y - $x }; + if diff > $z { + panic!("\n{} not equal\n left: {:?}\nright: {:?}\n", $r, $x, $y); + } + }}; +} + +fn asset_reserve() -> impl Strategy { + 1000 * ONE..10_000_000 * ONE +} + +fn trade_amount() -> impl Strategy { + ONE..100 * ONE +} + +fn price() -> impl Strategy { + 0.1f64..2f64 +} + +fn assert_asset_invariant( + old_state: (Balance, Balance), + new_state: (Balance, Balance), + tolerance: FixedU128, + desc: &str, +) { + let new_s = U256::from(new_state.0) * U256::from(new_state.1); + let s1 = new_s.integer_sqrt(); + + let old_s = U256::from(old_state.0) * U256::from(old_state.1); + let s2 = old_s.integer_sqrt(); + + assert!(new_s >= old_s, "Invariant decreased for {desc}"); + + let s1_u128 = Balance::try_from(s1).unwrap(); + let s2_u128 = Balance::try_from(s2).unwrap(); + + let invariant = FixedU128::from((s1_u128, ONE)) / FixedU128::from((s2_u128, ONE)); + assert_eq_approx!(invariant, FixedU128::from(1u128), tolerance, desc); +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(1000))] + #[test] + fn add_liquidity(initial_liquidity in asset_reserve(), + added_liquidity in asset_reserve(), + price in price(), + ) { + let asset_a = HDX; + let asset_b = DOT; + + ExtBuilder::default() + .with_exchange_fee((0, 0)) + .with_accounts(vec![ + (ALICE, asset_a,initial_liquidity), + (ALICE, asset_b,initial_liquidity * 1000), + (BOB, asset_a, added_liquidity), + (BOB, asset_b, added_liquidity * 1_000_000), + ]) + .build() + .execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + initial_liquidity, + asset_b, + FixedU128::from_float(price).saturating_mul_int(initial_liquidity), + )); + + let pool_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pool_account); + + let pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + let bob_balance_a = Currency::free_balance(asset_a, &BOB); + let bob_balance_b = Currency::free_balance(asset_b, &BOB); + + let issuance = XYK::total_liquidity(pool_account); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(BOB), + asset_a, + asset_b, + added_liquidity, + added_liquidity * 1_000_000, // do not care about the limit here + )); + + let new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + let new_bob_balance_a = Currency::free_balance(asset_a, &BOB); + let new_bob_balance_b = Currency::free_balance(asset_b, &BOB); + + let bob_shares = Currency::free_balance(share_token, &BOB); + + let p0 = FixedU128::from((pool_balance_a, pool_balance_b)); + let p1 = FixedU128::from((new_pool_balance_a, new_pool_balance_b)); + + // Price should not change + assert_eq_approx!( + p0, + p1, + FixedU128::from_float(0.0000000001), + "Price has changed after add liquidity" + ); + + // The following must hold when adding liquidity. + // delta_S / S <= delta_X / X + // delta_S / S <= delta_Y / Y + // where S is total share issuance, X is asset a and Y is asset b + + let s = U256::from(issuance); + let delta_s = U256::from(bob_shares); + let delta_x = U256::from(bob_balance_a - new_bob_balance_a); + let delta_y = U256::from(bob_balance_b - new_bob_balance_b); + let x = U256::from(pool_balance_a); + let y = U256::from(pool_balance_b); + + let left = delta_s * x; + let right = s * delta_x; + + assert!(left <= right); + + let l = FixedU128::from((bob_shares, issuance)); + let r = FixedU128::from((bob_balance_a - new_bob_balance_a, pool_balance_a)); + + let diff = r - l; + + assert!(diff <= FixedU128::from_float(0.000000001)); + + let left = delta_s * y; + let right = s * delta_y; + + assert!(left <= right); + + let l = FixedU128::from((bob_shares, issuance)); + let r = FixedU128::from((bob_balance_b - new_bob_balance_b, pool_balance_b)); + + let diff = r - l; + + assert!(diff <= FixedU128::from_float(0.000000001)); + }); + } +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(1000))] + #[test] + fn remove_liquidity(initial_liquidity in asset_reserve(), + added_liquidity in asset_reserve(), + price in price(), + ) { + let asset_a = HDX; + let asset_b = DOT; + + ExtBuilder::default() + .with_exchange_fee((0, 0)) + .with_accounts(vec![ + (ALICE, asset_a,initial_liquidity), + (ALICE, asset_b,initial_liquidity * 1000), + (BOB, asset_a, added_liquidity), + (BOB, asset_b, added_liquidity * 1_000_000), + ]) + .build() + .execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + initial_liquidity, + asset_b, + FixedU128::from_float(price).saturating_mul_int(initial_liquidity), + )); + + let pool_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pool_account); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(BOB), + asset_a, + asset_b, + added_liquidity, + added_liquidity * 1_000_000, // do not care about the limit here + )); + let pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + let bob_balance_a = Currency::free_balance(asset_a, &BOB); + let bob_balance_b = Currency::free_balance(asset_b, &BOB); + + let bob_shares = Currency::free_balance(share_token, &BOB); + + let issuance = XYK::total_liquidity(pool_account); + + assert_ok!(XYK::remove_liquidity( + RuntimeOrigin::signed(BOB), + asset_a, + asset_b, + bob_shares, + )); + + let new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + let new_bob_balance_a = Currency::free_balance(asset_a, &BOB); + let new_bob_balance_b = Currency::free_balance(asset_b, &BOB); + + let p0 = FixedU128::from((pool_balance_a, pool_balance_b)); + let p1 = FixedU128::from((new_pool_balance_a, new_pool_balance_b)); + + // Price should not change + assert_eq_approx!( + p0, + p1, + FixedU128::from_float(0.0000000001), + "Price has changed after remove liquidity" + ); + + let s = U256::from(issuance); + let delta_s = U256::from(bob_shares); + let delta_x = U256::from(new_bob_balance_a - bob_balance_a); + let delta_y = U256::from(new_bob_balance_b - bob_balance_b); + let x = U256::from(pool_balance_a); + let y = U256::from(pool_balance_b); + + let left = delta_s * x; + let right = s * delta_x; + + assert!(left >= right); + + let l = FixedU128::from((bob_shares, issuance)); + let r = FixedU128::from((new_bob_balance_a - bob_balance_a, pool_balance_a)); + + let diff = l - r; + + assert!(diff <= FixedU128::from_float(0.000000001)); + + let left = delta_s * y; + let right = s * delta_y; + + assert!(left >= right); + + let l = FixedU128::from((bob_shares, issuance)); + let r = FixedU128::from((new_bob_balance_b - bob_balance_b, pool_balance_b)); + + let diff = l - r; + + assert!(diff <= FixedU128::from_float(0.000000001)) + }); + } +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(1000))] + #[test] + fn sell_invariant(initial_liquidity in asset_reserve(), + added_liquidity in asset_reserve(), + amount in trade_amount(), + price in price(), + ) { + let asset_a = HDX; + let asset_b = DOT; + + ExtBuilder::default() + .with_exchange_fee((0, 0)) + .with_accounts(vec![ + (ALICE, asset_a,initial_liquidity), + (ALICE, asset_b,initial_liquidity * 1000), + (BOB, asset_a, added_liquidity), + (BOB, asset_b, added_liquidity * 1_000_000), + (CHARLIE, asset_a, amount), + ]) + .build() + .execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + initial_liquidity, + asset_b, + FixedU128::from_float(price).saturating_mul_int(initial_liquidity), + )); + + let pool_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(BOB), + asset_a, + asset_b, + added_liquidity, + added_liquidity * 1_000_000, // do not care about the limit here + )); + let pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + assert_ok!(XYK::sell( + RuntimeOrigin::signed(CHARLIE), + asset_a, + asset_b, + amount, + 0u128, // limit not interesting here, + false, + )); + + let new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + assert_asset_invariant((pool_balance_a, pool_balance_b), + (new_pool_balance_a, new_pool_balance_b), + FixedU128::from((TOLERANCE,ONE)), + "sell" + ); + + }); + } +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(1000))] + #[test] + fn buy_invariant(initial_liquidity in asset_reserve(), + added_liquidity in asset_reserve(), + amount in trade_amount(), + price in price(), + ) { + let asset_a = ACA; + let asset_b = DOT; + + ExtBuilder::default() + .with_exchange_fee((0, 0)) + .with_accounts(vec![ + (ALICE, asset_a,initial_liquidity * 1000), + (ALICE, HDX,initial_liquidity), + (ALICE, asset_b,initial_liquidity * 1000), + (BOB, asset_a, added_liquidity), + (BOB, asset_b, added_liquidity * 1_000_000), + (CHARLIE, asset_a, amount * 1_000), + (CHARLIE, HDX, amount * 1_000), + ]) + .build() + .execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + initial_liquidity, + asset_b, + FixedU128::from_float(price).saturating_mul_int(initial_liquidity), + )); + + let pool_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(BOB), + asset_a, + asset_b, + added_liquidity, + added_liquidity * 1_000_000, // do not care about the limit here + )); + let pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + assert_ok!(XYK::buy( + RuntimeOrigin::signed(CHARLIE), + asset_b, + asset_a, + amount, + u128::MAX, // limit not interesting here, + false, + )); + + let new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + assert_asset_invariant((pool_balance_a, pool_balance_b), + (new_pool_balance_a, new_pool_balance_b), + FixedU128::from((TOLERANCE,ONE)), + "buy" + ); + + }); + } +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(1000))] + #[test] + fn buy_invariant_with_discount(initial_liquidity in asset_reserve(), + added_liquidity in asset_reserve(), + amount in trade_amount(), + price in price(), + ) { + let asset_a = ACA; + let asset_b = DOT; + + ExtBuilder::default() + .with_exchange_fee((0, 0)) + .with_discounted_fee((0,0)) + .with_accounts(vec![ + (ALICE, asset_a,initial_liquidity * 1000), + (ALICE, HDX,initial_liquidity), + (ALICE, asset_b,initial_liquidity * 1000), + (BOB, asset_a, added_liquidity), + (BOB, asset_b, added_liquidity * 1_000_000), + (CHARLIE, asset_a, amount * 1_000), + (CHARLIE, HDX, amount * 1_000), + ]) + .build() + .execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + initial_liquidity, + asset_b, + FixedU128::from_float(price).saturating_mul_int(initial_liquidity), + )); + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_b, + 10 * ONE, + HDX, + 10 * ONE, + )); + + let pool_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(BOB), + asset_a, + asset_b, + added_liquidity, + added_liquidity * 1_000_000, // do not care about the limit here + )); + let _pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let _pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + assert_ok!(XYK::buy( + RuntimeOrigin::signed(CHARLIE), + asset_b, + asset_a, + amount, + u128::MAX, // limit not interesting here, + true, + )); + + let _new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let _new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + assert_asset_invariant((_pool_balance_a, _pool_balance_b), + (_new_pool_balance_a, _new_pool_balance_b), + FixedU128::from((TOLERANCE,ONE)), + "buy with discount" + ); + }); + } +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(1000))] + #[test] + fn sell_invariant_with_discount(initial_liquidity in asset_reserve(), + added_liquidity in asset_reserve(), + amount in trade_amount(), + price in price(), + ) { + let asset_a = ACA; + let asset_b = DOT; + + ExtBuilder::default() + .with_exchange_fee((0, 0)) + .with_discounted_fee((0,0)) + .with_accounts(vec![ + (ALICE, asset_a,initial_liquidity * 1000), + (ALICE, HDX,initial_liquidity), + (ALICE, asset_b,initial_liquidity * 1000), + (BOB, asset_a, added_liquidity), + (BOB, asset_b, added_liquidity * 1_000_000), + (CHARLIE, asset_a, amount * 1_000), + (CHARLIE, HDX, amount * 1_000), + ]) + .build() + .execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + initial_liquidity, + asset_b, + FixedU128::from_float(price).saturating_mul_int(initial_liquidity), + )); + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 10 * ONE, + HDX, + 10 * ONE, + )); + + let pool_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(BOB), + asset_a, + asset_b, + added_liquidity, + added_liquidity * 1_000_000, // do not care about the limit here + )); + let _pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let _pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + assert_ok!(XYK::sell( + RuntimeOrigin::signed(CHARLIE), + asset_a, + asset_b, + amount, + 0u128, // limit not interesting here, + true, + )); + + let _new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); + let _new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); + + assert_asset_invariant((_pool_balance_a, _pool_balance_b), + (_new_pool_balance_a, _new_pool_balance_b), + FixedU128::from((TOLERANCE,ONE)), + "sell with discount" + ); + }); + } +} diff --git a/pallets/xyk/src/tests/liquidity.rs b/pallets/xyk/src/tests/liquidity.rs new file mode 100644 index 00000000000..efe0f7833ce --- /dev/null +++ b/pallets/xyk/src/tests/liquidity.rs @@ -0,0 +1,689 @@ +pub use super::mock::*; +use crate::types::{AssetPair, Balance}; +use crate::{Error, Event}; +use frame_support::{assert_noop, assert_ok}; +use hydradx_traits::AMM as AmmPool; +use orml_traits::MultiCurrency; + +#[test] +fn add_liquidity_should_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = DOT; + let asset_b = HDX; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 100_000_000, + asset_b, + 65_400_000 + )); + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(asset_b, &pair_account), 65_400_000); + assert_eq!(XYK::total_liquidity(pair_account), 65400000); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(user), + asset_a, + asset_b, + 400_000, + 1_000_000_000_000 + )); + + assert_eq!(Currency::free_balance(share_token, &user), 65661600); + + assert_eq!(Currency::free_balance(asset_b, &pair_account), 65_661_601); + assert_eq!(Currency::free_balance(asset_a, &pair_account), 100400000); + assert_eq!(Currency::free_balance(asset_a, &user), 999999899600000); + assert_eq!(XYK::total_liquidity(pair_account), 65661600); + + expect_events(vec![ + Event::PoolCreated { + who: ALICE, + asset_a, + asset_b, + initial_shares_amount: 65400000, + share_token, + pool: pair_account, + } + .into(), + Event::LiquidityAdded { + who: ALICE, + asset_a, + asset_b, + amount_a: 400000, + amount_b: 261601, + } + .into(), + ]); + }); +} + +#[test] +fn add_liquidity_mints_correct_shares() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = DOT; + let asset_b = HDX; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 100_000_000, + asset_b, + 65_400_000 + )); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(user), + asset_b, + asset_a, + 261600, + 1_000_000_000_000 + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(share_token, &user), 65661600); + }); +} + +#[test] +fn add_liquidity_as_another_user_should_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = HDX; + let asset_b = ACA; + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_b, + 100_000_000, + asset_a, + 1_000_000_000_000 + )); + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(user), + asset_b, + asset_a, + 400_000, + 1_000_000_000_000 + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 1004000000001); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 100400000); + assert_eq!(Currency::free_balance(asset_b, &user), 999999899600000); + assert_eq!(Currency::free_balance(share_token, &user), 1004000000000); + assert_eq!(XYK::total_liquidity(pair_account), 1004000000000); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(BOB), + asset_b, + asset_a, + 1_000_000, + 1_000_000_000_000 + )); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 1014000000002); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 101400000); + assert_eq!(Currency::free_balance(asset_b, &user), 999999899600000); + assert_eq!(Currency::free_balance(asset_b, &BOB), 999999999000000); + assert_eq!(Currency::free_balance(share_token, &user), 1004000000000); + assert_eq!(Currency::free_balance(share_token, &BOB), 10000000000); + assert_eq!(XYK::total_liquidity(pair_account), 1014000000000); + + expect_events(vec![ + Event::PoolCreated { + who: ALICE, + asset_a: asset_b, + asset_b: asset_a, + initial_shares_amount: 1000000000000, + share_token, + pool: pair_account, + } + .into(), + Event::LiquidityAdded { + who: ALICE, + asset_a: asset_b, + asset_b: asset_a, + amount_a: 400000, + amount_b: 4000000001, + } + .into(), + orml_tokens::Event::Endowed { + currency_id: share_token, + who: 2, + amount: 10000000000, + } + .into(), + Event::LiquidityAdded { + who: BOB, + asset_a: asset_b, + asset_b: asset_a, + amount_a: 1000000, + amount_b: 10000000001, + } + .into(), + ]); + }); +} + +#[test] +fn add_liquidity_should_work_when_limit_is_set_above_account_balance() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = DOT; + let asset_b = HDX; + let amount_b_max_limit = 2_000_000_000_000_000; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 100_000_000, + asset_b, + 100_000_000, + )); + + assert!(Currency::free_balance(asset_b, &user) < amount_b_max_limit); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(user), + asset_a, + asset_b, + 400_000, + amount_b_max_limit, + )); + }); +} + +#[test] +fn remove_liquidity_should_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = HDX; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 100_000_000, + asset_b, + 1_000_000_000_000 + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(share_token, &user), 100000000); + assert_eq!(Currency::free_balance(asset_a, &user), 999999900000000); + assert_eq!(Currency::free_balance(asset_a, &pair_account), 100000000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 1000000000000); + + assert_ok!(XYK::remove_liquidity( + RuntimeOrigin::signed(user), + asset_a, + asset_b, + 355_000 + )); + + assert_eq!(Currency::free_balance(asset_b, &pair_account), 996450000000); + assert_eq!(Currency::free_balance(asset_a, &user), 999999900355000); + + assert_eq!(Currency::free_balance(share_token, &user), 99645000); + assert_eq!(XYK::total_liquidity(pair_account), 99645000); + + expect_events(vec![ + Event::PoolCreated { + who: ALICE, + asset_a, + asset_b, + initial_shares_amount: 100000000, + share_token, + pool: pair_account, + } + .into(), + Event::LiquidityRemoved { + who: ALICE, + asset_a, + asset_b, + shares: 355_000, + } + .into(), + ]); + }); +} + +#[test] +fn remove_liquidity_without_shares_should_not_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = HDX; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 100_000_000, + asset_b, + 100_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + let shares = Currency::free_balance(share_token, &user); + + assert_ok!(Currency::transfer( + RuntimeOrigin::signed(ALICE), + BOB, + share_token, + shares + )); + + assert_noop!( + XYK::remove_liquidity(RuntimeOrigin::signed(user), asset_a, asset_b, 355_000), + Error::::InsufficientAssetBalance + ); + + expect_events(vec![ + Event::PoolCreated { + who: ALICE, + asset_a, + asset_b, + initial_shares_amount: 100000000, + share_token, + pool: pair_account, + } + .into(), + orml_tokens::Event::Endowed { + currency_id: share_token, + who: BOB, + amount: shares, + } + .into(), + orml_tokens::Event::Transfer { + currency_id: share_token, + from: ALICE, + to: BOB, + amount: shares, + } + .into(), + ]); + }); +} + +// events in the following test do not occur during standard chain operation +#[test] +fn remove_liquidity_from_reduced_pool_should_not_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = HDX; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 100_000_000, + asset_b, + 100_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + // remove some amount from the pool + assert_ok!(Currency::transfer( + RuntimeOrigin::signed(pair_account), + BOB, + asset_a, + 90_000_000 + )); + + assert_noop!( + XYK::remove_liquidity(RuntimeOrigin::signed(user), asset_a, asset_b, 200_000_000), + Error::::InsufficientLiquidity + ); + + // return it back to the pool + assert_ok!(Currency::transfer( + RuntimeOrigin::signed(BOB), + pair_account, + asset_a, + 90_000_000 + )); + // do it again with asset_b + assert_ok!(Currency::transfer( + RuntimeOrigin::signed(pair_account), + BOB, + asset_b, + 90_000_000 + )); + + assert_noop!( + XYK::remove_liquidity(RuntimeOrigin::signed(user), asset_a, asset_b, 200_000_000), + Error::::InsufficientLiquidity + ); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + expect_events(vec![ + Event::PoolCreated { + who: ALICE, + asset_a, + asset_b, + initial_shares_amount: 100000000, + share_token, + pool: pair_account, + } + .into(), + orml_tokens::Event::Transfer { + currency_id: asset_a, + from: pair_account, + to: BOB, + amount: 90_000_000, + } + .into(), + orml_tokens::Event::Transfer { + currency_id: asset_a, + from: BOB, + to: pair_account, + amount: 90_000_000, + } + .into(), + orml_tokens::Event::Transfer { + currency_id: asset_b, + from: pair_account, + to: BOB, + amount: 90_000_000, + } + .into(), + ]); + }); +} + +#[test] +fn add_liquidity_more_than_owner_should_not_work() { + new_test_ext().execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + HDX, + 200_000_000, + ACA, + 600_000_000_000_000, + )); + + assert_eq!(Currency::free_balance(ACA, &ALICE), 400_000_000_000_000); + + assert_noop!( + XYK::add_liquidity( + RuntimeOrigin::signed(ALICE), + HDX, + ACA, + 200_000_000_000_000_000, + 600_000_000 + ), + Error::::InsufficientAssetBalance + ); + + assert_noop!( + XYK::add_liquidity( + RuntimeOrigin::signed(ALICE), + HDX, + ACA, + 600_000_000, + 200_000_000_000_000_000 + ), + Error::::InsufficientAssetBalance + ); + }); +} + +#[test] +fn add_insufficient_liquidity_should_not_work() { + new_test_ext().execute_with(|| { + assert_ok!(XYK::create_pool(RuntimeOrigin::signed(ALICE), HDX, 1000, ACA, 1500,)); + + assert_noop!( + XYK::add_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 0, 0), + Error::::InsufficientTradingAmount + ); + + assert_noop!( + XYK::add_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 1000, 0), + Error::::ZeroLiquidity + ); + + assert_noop!( + XYK::add_liquidity(RuntimeOrigin::signed(BOB), ACA, HDX, 1000, 2000), + Error::::InsufficientLiquidity + ); + }); +} + +#[test] +fn add_liquidity_exceeding_max_limit_should_not_work() { + new_test_ext().execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + HDX, + 100_000_000_000_000, + ACA, + 100_000_000_000_000, + )); + + assert_noop!( + XYK::add_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 10_000_000, 1_000_000), + Error::::AssetAmountExceededLimit + ); + }); +} +#[test] +fn remove_liquidity_should_respect_min_pool_limit() { + new_test_ext().execute_with(|| { + assert_ok!(XYK::create_pool(RuntimeOrigin::signed(ALICE), HDX, 1000, ACA, 1500,)); + + assert_ok!(XYK::add_liquidity(RuntimeOrigin::signed(BOB), ACA, HDX, 2000, 2000)); + + assert_noop!( + XYK::remove_liquidity(RuntimeOrigin::signed(BOB), ACA, HDX, 500), + Error::::InsufficientLiquidity + ); + }); +} + +#[test] +fn remove_zero_liquidity_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + XYK::remove_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 0), + Error::::ZeroLiquidity + ); + }); +} + +#[test] +fn add_liquidity_to_non_existing_pool_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + XYK::add_liquidity( + RuntimeOrigin::signed(ALICE), + HDX, + ACA, + 200_000_000_000_000_000, + 600_000_000 + ), + Error::::TokenPoolNotFound + ); + }); +} + +#[test] +fn remove_zero_liquidity_from_non_existing_pool_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + XYK::remove_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 100), + Error::::TokenPoolNotFound + ); + }); +} + +#[test] +fn add_liquidity_overflow_work() { + let user = ALICE; + let asset_a = DOT; + let asset_b = HDX; + ExtBuilder::default() + .with_accounts(vec![(ALICE, DOT, Balance::MAX), (ALICE, HDX, Balance::MAX)]) + .build() + .execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 100_000, + asset_b, + 10_u128.pow(38) + )); + + assert_noop!( + XYK::add_liquidity( + RuntimeOrigin::signed(user), + asset_a, + asset_b, + 10_u128.pow(33), + 1_000_000_000_000 + ), + Error::::AddAssetAmountInvalid + ); + }); +} + +#[test] +fn share_ratio_calculations_are_correct() { + ExtBuilder::default() + .with_exchange_fee((0, 0)) + .build() + .execute_with(|| { + let asset_a = HDX; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + 100 * ONE, + asset_b, + 65_440_000_000_000, + )); + + assert_eq!(Currency::free_balance(asset_a, &BOB), 1_000 * ONE); + assert_eq!(Currency::free_balance(asset_b, &BOB), 1_000 * ONE); + + let balance_a = Currency::free_balance(asset_a, &BOB); + let balance_b = Currency::free_balance(asset_b, &BOB); + + let bob_initial_balance = balance_a + balance_b; + + assert_eq!(bob_initial_balance, 2000 * ONE); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(BOB), + asset_b, + asset_a, + 10 * ONE, + 200 * ONE + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + let expected_shares = 15_281_173_594_132u128; + + assert_eq!(Currency::free_balance(share_token, &BOB), expected_shares); + + assert_ok!(XYK::sell( + RuntimeOrigin::signed(CHARLIE), + asset_a, + asset_b, + 10 * ONE, + 0u128, + false, + )); + + assert_ok!(XYK::remove_liquidity( + RuntimeOrigin::signed(BOB), + asset_a, + asset_b, + expected_shares + )); + + assert_eq!(Currency::free_balance(share_token, &BOB), 0); + + for _ in 0..10 { + let balance_a = Currency::free_balance(asset_a, &BOB); + let balance_b = Currency::free_balance(asset_b, &BOB); + + let bob_previous_balance = balance_a + balance_b; + + let balance_pool_a = Currency::free_balance(asset_a, &pair_account); + let balance_pool_b = Currency::free_balance(asset_a, &pair_account); + + let initial_pool_liquidity = balance_pool_a + balance_pool_b; + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(BOB), + asset_b, + asset_a, + 10 * ONE, + 200 * ONE + )); + + let shares = Currency::free_balance(share_token, &BOB); + + assert_ok!(XYK::remove_liquidity( + RuntimeOrigin::signed(BOB), + asset_a, + asset_b, + shares + )); + let balance_a = Currency::free_balance(asset_a, &BOB); + let balance_b = Currency::free_balance(asset_b, &BOB); + let bob_new_balance = balance_a + balance_b; + + let balance_pool_a = Currency::free_balance(asset_a, &pair_account); + let balance_pool_b = Currency::free_balance(asset_a, &pair_account); + + let total_pool_liquidity = balance_pool_a + balance_pool_b; + + assert!(bob_new_balance <= bob_previous_balance); + assert!(initial_pool_liquidity <= total_pool_liquidity); + } + }); +} diff --git a/pallets/xyk/src/tests/mock.rs b/pallets/xyk/src/tests/mock.rs new file mode 100644 index 00000000000..eca5ebc1b3b --- /dev/null +++ b/pallets/xyk/src/tests/mock.rs @@ -0,0 +1,288 @@ +// This file is part of HydraDX-node. + +// 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 as xyk; +use crate::Config; +use crate::*; +use frame_support::parameter_types; +use frame_system as system; +use orml_traits::parameter_type_with_key; +use sp_core::H256; +use sp_runtime::{ + traits::{BlakeTwo256, IdentityLookup, One}, + BuildStorage, +}; + +use crate::types::{AssetId, Balance}; +use frame_support::traits::{Everything, Get, Nothing}; +use hydradx_traits::{AssetPairAccountIdFor, CanCreatePool, Source}; + +use frame_system::EnsureSigned; +use hydradx_traits::pools::DustRemovalAccountWhitelist; +use std::cell::RefCell; + +pub type Amount = i128; +pub type AccountId = u64; + +pub const ALICE: AccountId = 1; +pub const BOB: AccountId = 2; +pub const CHARLIE: AccountId = 3; + +pub const HDX: AssetId = 1000; +pub const DOT: AssetId = 2000; +pub const ACA: AssetId = 3000; + +pub const HDX_DOT_POOL_ID: AccountId = 1_002_000; + +pub const ONE: Balance = 1_000_000_000_000; + +type Block = frame_system::mocking::MockBlock; + +frame_support::construct_runtime!( + pub enum Test + { + System: frame_system, + XYK: xyk, + Currency: orml_tokens, + AssetRegistry: pallet_asset_registry, + } + +); + +thread_local! { + static EXCHANGE_FEE: RefCell<(u32, u32)> = RefCell::new((2, 1_000)); + static DISCOUNTED_FEE: RefCell<(u32, u32)> = RefCell::new((7, 10_000)); + static MAX_OUT_RATIO: RefCell = RefCell::new(3); +} + +struct ExchangeFee; +impl Get<(u32, u32)> for ExchangeFee { + fn get() -> (u32, u32) { + EXCHANGE_FEE.with(|v| *v.borrow()) + } +} + +struct DiscountedFee; +impl Get<(u32, u32)> for DiscountedFee { + fn get() -> (u32, u32) { + DISCOUNTED_FEE.with(|v| *v.borrow()) + } +} + +struct MaximumOutRatio; +impl Get for MaximumOutRatio { + fn get() -> u128 { + MAX_OUT_RATIO.with(|v| *v.borrow()) + } +} + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 63; + pub const NativeAssetId: AssetId = HDX; + pub RegistryStringLimit: u32 = 100; + pub const SequentialIdOffset: u32 = 1_000_000; +} + +impl pallet_asset_registry::Config for Test { + type RuntimeEvent = RuntimeEvent; + type RegistryOrigin = EnsureSigned; + type AssetId = AssetId; + type Balance = Balance; + type AssetNativeLocation = u8; + type StringLimit = RegistryStringLimit; + type SequentialIdStartAt = SequentialIdOffset; + type NativeAssetId = NativeAssetId; + type WeightInfo = (); +} + +impl system::Config for Test { + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type Nonce = u64; + type Block = Block; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = BlockHashCount; + type DbWeight = (); + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +parameter_type_with_key! { + pub ExistentialDeposits: |_currency_id: AssetId| -> Balance { + One::one() + }; +} + +impl orml_tokens::Config for Test { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type Amount = Amount; + type CurrencyId = AssetId; + type WeightInfo = (); + type ExistentialDeposits = ExistentialDeposits; + type MaxLocks = (); + type DustRemovalWhitelist = Nothing; + type ReserveIdentifier = (); + type MaxReserves = (); + type CurrencyHooks = (); +} + +pub struct AssetPairAccountIdTest(); + +impl AssetPairAccountIdFor for AssetPairAccountIdTest { + fn from_assets(asset_a: AssetId, asset_b: AssetId, _: &str) -> u64 { + let mut a = asset_a as u128; + let mut b = asset_b as u128; + if a > b { + std::mem::swap(&mut a, &mut b) + } + (a * 1000 + b) as u64 + } +} + +parameter_types! { + pub const MinTradingLimit: Balance = 1_000; + pub const MinPoolLiquidity: Balance = 1_000; + pub const MaxInRatio: u128 = 3; + pub MaxOutRatio: u128 = MaximumOutRatio::get(); + pub ExchangeFeeRate: (u32, u32) = ExchangeFee::get(); + pub DiscountedFeeRate: (u32, u32) = DiscountedFee::get(); + pub const OracleSourceIdentifier: Source = *b"hydraxyk"; +} + +pub struct Disallow10_10Pool(); + +impl CanCreatePool for Disallow10_10Pool { + fn can_create(asset_a: AssetId, asset_b: AssetId) -> bool { + !matches!((asset_a, asset_b), (10u32, 10u32)) + } +} + +impl Config for Test { + type RuntimeEvent = RuntimeEvent; + type AssetRegistry = AssetRegistry; + type AssetPairAccountId = AssetPairAccountIdTest; + type Currency = Currency; + type NativeAssetId = NativeAssetId; + type WeightInfo = (); + type GetExchangeFee = ExchangeFeeRate; + type MinTradingLimit = MinTradingLimit; + type MinPoolLiquidity = MinPoolLiquidity; + type MaxInRatio = MaxInRatio; + type MaxOutRatio = MaxOutRatio; + type CanCreatePool = Disallow10_10Pool; + type AMMHandler = (); + type DiscountedFee = DiscountedFeeRate; + type NonDustableWhitelistHandler = Whitelist; + type OracleSource = OracleSourceIdentifier; +} + +pub struct ExtBuilder { + endowed_accounts: Vec<(AccountId, AssetId, Balance)>, +} + +// Returns default values for genesis config +impl Default for ExtBuilder { + fn default() -> Self { + Self { + endowed_accounts: vec![ + (ALICE, HDX, 1_000_000_000_000_000u128), + (BOB, HDX, 1_000_000_000_000_000u128), + (ALICE, ACA, 1_000_000_000_000_000u128), + (BOB, ACA, 1_000_000_000_000_000u128), + (ALICE, DOT, 1_000_000_000_000_000u128), + (BOB, DOT, 1_000_000_000_000_000u128), + (CHARLIE, HDX, 1_000_000_000_000_000u128), + ], + } + } +} + +impl ExtBuilder { + // builds genesis config + + pub fn with_accounts(mut self, accounts: Vec<(AccountId, AssetId, Balance)>) -> Self { + self.endowed_accounts = accounts; + self + } + + pub fn with_exchange_fee(self, f: (u32, u32)) -> Self { + EXCHANGE_FEE.with(|v| *v.borrow_mut() = f); + self + } + + pub fn with_discounted_fee(self, f: (u32, u32)) -> Self { + DISCOUNTED_FEE.with(|v| *v.borrow_mut() = f); + self + } + + pub fn with_max_out_ratio(self, f: u128) -> Self { + MAX_OUT_RATIO.with(|v| *v.borrow_mut() = f); + self + } + + pub fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); + + orml_tokens::GenesisConfig:: { + balances: self.endowed_accounts, + } + .assimilate_storage(&mut t) + .unwrap(); + + t.into() + } +} + +pub fn new_test_ext() -> sp_io::TestExternalities { + let mut ext = ExtBuilder::default().build(); + ext.execute_with(|| System::set_block_number(1)); + ext +} + +pub fn expect_events(e: Vec) { + e.into_iter().for_each(frame_system::Pallet::::assert_has_event); +} + +pub struct Whitelist; + +impl DustRemovalAccountWhitelist for Whitelist { + type Error = DispatchError; + + fn add_account(_account: &AccountId) -> Result<(), Self::Error> { + Ok(()) + } + + fn remove_account(_account: &AccountId) -> Result<(), Self::Error> { + Ok(()) + } +} diff --git a/pallets/xyk/src/tests/mod.rs b/pallets/xyk/src/tests/mod.rs new file mode 100644 index 00000000000..1bc9a4421b9 --- /dev/null +++ b/pallets/xyk/src/tests/mod.rs @@ -0,0 +1,8 @@ +mod amm_position; +mod creation; +mod fees; +mod invariants; +mod liquidity; +pub(crate) mod mock; +mod spot_price; +mod trades; diff --git a/pallets/xyk/src/tests/spot_price.rs b/pallets/xyk/src/tests/spot_price.rs new file mode 100644 index 00000000000..b24eea24e84 --- /dev/null +++ b/pallets/xyk/src/tests/spot_price.rs @@ -0,0 +1,83 @@ +use super::mock::*; +use crate::types::{AssetPair, Price}; +use crate::XYKSpotPrice; +use crate::*; +use frame_support::assert_ok; +use frame_support::dispatch::RawOrigin; +use hydradx_traits::pools::SpotPriceProvider; + +#[test] +fn spot_price_provider_should_return_correct_price_when_pool_exists() { + let asset_a = ACA; + let asset_b = DOT; + + let initial = 99_000_000_000_000u128; + + ExtBuilder::default() + .with_accounts(vec![(ALICE, asset_a, initial), (ALICE, asset_b, initial)]) + .build() + .execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + initial, + asset_b, + 39_600_000_000_000 + )); + + let price = XYKSpotPrice::::spot_price(asset_a, asset_b); + + assert_eq!(price, Some(Price::from_float(2.5))); // 99_000 / 39_600 = 2.5 + }); +} + +#[test] +fn spot_price_provider_should_return_none_when_pool_does_not_exist() { + let asset_a = ACA; + let asset_b = DOT; + + ExtBuilder::default().build().execute_with(|| { + let price = XYKSpotPrice::::spot_price(asset_a, asset_b); + + assert_eq!(price, None); + }); +} + +#[test] +fn spot_price_provider_should_return_none_when_asset_reserve_is_zero() { + let asset_a = ACA; + let asset_b = DOT; + + let initial = 99_000_000_000_000u128; + + ExtBuilder::default() + .with_accounts(vec![(ALICE, asset_a, initial), (ALICE, asset_b, initial)]) + .build() + .execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + asset_a, + initial, + asset_b, + 39_600_000_000_000 + )); + + let pool_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + // Force the pool balance to be zero in this test + assert_ok!(Currency::set_balance( + RawOrigin::Root.into(), + pool_account, + asset_b, + 0u128, + 0u128 + )); + + let price = XYKSpotPrice::::spot_price(asset_a, asset_b); + + assert_eq!(price, None); + }); +} diff --git a/pallets/xyk/src/tests/trades.rs b/pallets/xyk/src/tests/trades.rs new file mode 100644 index 00000000000..5369bb9ea4c --- /dev/null +++ b/pallets/xyk/src/tests/trades.rs @@ -0,0 +1,1085 @@ +pub use super::mock::*; +use crate::{Error, Event}; +use frame_support::{assert_noop, assert_ok}; +use hydradx_traits::AMM as AmmPool; +use orml_traits::MultiCurrency; + +use crate::types::AssetPair; + +#[test] +fn sell_test() { + new_test_ext().execute_with(|| { + let user_1 = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 200_000_000_000, + asset_b, + 600_000_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); + assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); + + assert_ok!(XYK::sell( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 456_444_678, + 1000000000000, + false, + )); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999799543555322); + assert_eq!(Currency::free_balance(asset_b, &user_1), 401363483591788); + assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200456444678); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 598636516408212); + + expect_events(vec![ + Event::PoolCreated { + who: ALICE, + asset_a, + asset_b, + initial_shares_amount: 600000000000000, + share_token, + pool: pair_account, + } + .into(), + Event::SellExecuted { + who: ALICE, + asset_in: asset_a, + asset_out: asset_b, + amount: 456444678, + sale_price: 1363483591788, + fee_asset: asset_b, + fee_amount: 2732432046, + pool: pair_account, + } + .into(), + ]); + }); +} + +#[test] +fn work_flow_happy_path_should_work() { + new_test_ext().execute_with(|| { + let user_1 = ALICE; + let user_2 = BOB; + let asset_a = HDX; + let asset_b = ACA; + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + // Check initial balances + + assert_eq!(Currency::free_balance(asset_a, &user_1), 1000000000000000); + assert_eq!(Currency::free_balance(asset_b, &user_2), 1000000000000000); + assert_eq!(Currency::free_balance(asset_a, &pair_account), 0); + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 350_000_000_000, + asset_b, + 14_000_000_000_000, + )); + + // User 1 really tries! + assert_noop!( + XYK::add_liquidity( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 800_000_000_000_000_000, + 100 + ), + Error::::InsufficientAssetBalance + ); + + // Total liquidity + assert_eq!(XYK::total_liquidity(pair_account), 350_000_000_000); + + let share_token = XYK::share_token(pair_account); + + // Check balance after add liquidity for user 1 and user 2 + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999_650_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 986_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &user_2), 1_000_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &user_2), 1_000_000_000_000_000); + + assert_eq!(Currency::free_balance(share_token, &user_1), 350_000_000_000); + assert_eq!(Currency::free_balance(share_token, &user_2), 0); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 350_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 14_000_000_000_000); + + // User 2 adds liquidity + let current_b_balance = Currency::free_balance(asset_b, &user_2); + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(user_2), + asset_a, + asset_b, + 300_000_000_000, + current_b_balance + )); + + assert_eq!(XYK::total_liquidity(pair_account), 650_000_000_000); + + // Check balance after add liquidity for user 1 and user 2 + assert_eq!(Currency::free_balance(asset_a, &user_1), 999_650_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 986_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &user_2), 999_700_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &user_2), 988_000_000_000_000 - 1); // - 1 because of liquidity_in rounds up in favor of pool + + assert_eq!(Currency::free_balance(share_token, &user_1), 350_000_000_000); + assert_eq!(Currency::free_balance(share_token, &user_2), 300_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 650_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 26_000_000_000_001); + + // User 2 SELLs + assert_ok!(XYK::sell( + RuntimeOrigin::signed(user_2), + asset_a, + asset_b, + 216_666_666_666, + 100_000_000_000, + false, + )); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999_650_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 986_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &user_2), 999_483_333_333_334); + assert_eq!(Currency::free_balance(asset_b, &user_2), 994_486_999_999_986); + + assert_eq!(Currency::free_balance(share_token, &user_1), 350_000_000_000); + assert_eq!(Currency::free_balance(share_token, &user_2), 300_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 866_666_666_666); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 19_513_000_000_014); + + // User 1 SELLs + assert_ok!(XYK::sell( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 288_888_888_888, + 100_000_000_000, + false, + )); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999_361_111_111_112); + assert_eq!(Currency::free_balance(asset_b, &user_1), 990_868_493_499_997); + + let user_2_original_balance_1 = Currency::free_balance(asset_a, &user_2); + let user_2_original_balance_2 = Currency::free_balance(asset_b, &user_2); + + assert_eq!(user_2_original_balance_1, 999_483_333_333_334); + assert_eq!(user_2_original_balance_2, 994_486_999_999_986); + + assert_eq!(Currency::free_balance(share_token, &user_1), 350_000_000_000); + assert_eq!(Currency::free_balance(share_token, &user_2), 300_000_000_000); + + // User 2 removes liquidity + + assert_ok!(XYK::remove_liquidity( + RuntimeOrigin::signed(user_2), + asset_a, + asset_b, + 10_000 + )); + + let user_2_remove_1_balance_1 = Currency::free_balance(asset_a, &user_2); + let user_2_remove_1_balance_2 = Currency::free_balance(asset_b, &user_2); + + assert_eq!(user_2_remove_1_balance_1, 999_483_333_351_111); + assert_eq!(user_2_remove_1_balance_2, 994_487_000_225_286); + assert_eq!(Currency::free_balance(share_token, &user_2), 299_999_990_000); + + assert_ok!(XYK::remove_liquidity( + RuntimeOrigin::signed(user_2), + asset_b, + asset_a, + 10_000 + )); + + let user_2_remove_2_balance_1 = Currency::free_balance(asset_a, &user_2); + let user_2_remove_2_balance_2 = Currency::free_balance(asset_b, &user_2); + + assert_eq!(user_2_remove_2_balance_1, 999_483_333_368_888); + assert_eq!(user_2_remove_2_balance_2, 994_487_000_450_586); + assert_eq!(Currency::free_balance(share_token, &user_2), 299_999_980_000); + + // The two removes should be equal (this could slip by 1 because of rounding error) + + assert_eq!( + user_2_remove_1_balance_1 - user_2_original_balance_1, + user_2_remove_2_balance_1 - user_2_remove_1_balance_1 + ); + + assert_eq!( + user_2_remove_1_balance_2 - user_2_original_balance_2, + user_2_remove_2_balance_2 - user_2_remove_1_balance_2 + ); + + assert_eq!(XYK::total_liquidity(pair_account), 649_999_980_000); + + assert_ok!(XYK::remove_liquidity( + RuntimeOrigin::signed(user_2), + asset_a, + asset_b, + 18_000 + )); + assert_eq!(Currency::free_balance(share_token, &user_2), 299_999_962_000); + + assert_eq!(XYK::total_liquidity(pair_account), 649_999_962_000); + + expect_events(vec![ + Event::PoolCreated { + who: user_1, + asset_a, + asset_b, + initial_shares_amount: 350_000_000_000, + share_token, + pool: pair_account, + } + .into(), + orml_tokens::Event::Endowed { + currency_id: share_token, + who: 2, + amount: 300000000000, + } + .into(), + Event::LiquidityAdded { + who: user_2, + asset_a, + asset_b, + amount_a: 300_000_000_000, + amount_b: 12_000_000_000_001, + } + .into(), + ]); + }); +} + +#[test] +fn sell_with_correct_fees_should_work() { + let accounts = vec![ + (ALICE, HDX, 1_000_000_000_000_000u128), + (BOB, HDX, 1_000_000_000_000_000u128), + (ALICE, ACA, 1_000_000_000_000_000u128), + (BOB, ACA, 1_000_000_000_000_000u128), + (ALICE, DOT, 1_000_000_000_000_000u128), + (BOB, DOT, 1_000_000_000_000_000u128), + ]; + + let mut ext: sp_io::TestExternalities = ExtBuilder::default().with_accounts(accounts).build(); + ext.execute_with(|| System::set_block_number(1)); + ext.execute_with(|| { + let user_1 = ALICE; + let user_2 = BOB; + let asset_a = ACA; + let asset_b = HDX; + + // Verify initial balances + assert_eq!(Currency::free_balance(asset_a, &user_1), 1_000_000_000_000_000); + assert_eq!(Currency::free_balance(asset_a, &user_2), 1_000_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_b, &user_1), 1_000_000_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &user_2), 1_000_000_000_000_000); + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 10_000_000, + asset_b, + 2_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999999990000000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 999998000000000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 10000000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 2000000000); + + assert_eq!(Currency::free_balance(share_token, &user_1), 2000000000); + + assert_ok!(XYK::sell( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 100_000, + 1_000_000, + false, + )); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 10100000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 1980237622); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999999989900000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 999998019762378); + expect_events(vec![ + Event::PoolCreated { + who: user_1, + asset_a, + asset_b, + initial_shares_amount: 2000000000, + share_token, + pool: pair_account, + } + .into(), + Event::SellExecuted { + who: user_1, + asset_in: asset_a, + asset_out: asset_b, + amount: 100_000, + sale_price: 19_762_378, + fee_asset: asset_b, + fee_amount: 39_602, + pool: pair_account, + } + .into(), + ]); + }); +} + +#[test] +fn sell_without_sufficient_balance_should_not_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 1_000_000_000, + asset_b, + 1_000_000_000, + )); + + assert_ok!(Currency::transfer( + RuntimeOrigin::signed(user), + BOB, + ACA, + 999_998_999_999_999 + )); + + assert_noop!( + XYK::sell(RuntimeOrigin::signed(user), ACA, DOT, 1_000, 100, false), + Error::::InsufficientAssetBalance + ); + }); +} + +#[test] +fn sell_without_sufficient_discount_balance_should_not_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 1_000_000_000_000, + asset_b, + 1_000_000_000_000, + )); + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 1_000_000_000_000, + HDX, + 1_000_000_000_000, + )); + + assert_ok!(Currency::transfer( + RuntimeOrigin::signed(user), + BOB, + HDX, + 998_999_999_999_999 + )); + + assert_noop!( + XYK::sell(RuntimeOrigin::signed(user), ACA, DOT, 1_000_000_000, 100, true), + Error::::InsufficientNativeCurrencyBalance + ); + }); +} + +#[test] +fn buy_without_sufficient_balance_should_not_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 1_000_000_000, + asset_b, + 1_000_000_000, + )); + + assert_ok!(Currency::transfer( + RuntimeOrigin::signed(user), + BOB, + ACA, + 999_998_999_999_999 + )); + + assert_noop!( + XYK::buy(RuntimeOrigin::signed(user), DOT, ACA, 1_000, 10_000, false), + Error::::InsufficientAssetBalance + ); + }); +} + +#[test] +fn buy_without_sufficient_discount_balance_should_not_work() { + new_test_ext().execute_with(|| { + let user = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_a, + 1_000_000_000_000, + asset_b, + 1_000_000_000_000, + )); + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user), + asset_b, + 1_000_000_000_000, + HDX, + 1_000_000_000_000, + )); + + assert_ok!(Currency::transfer( + RuntimeOrigin::signed(user), + BOB, + HDX, + 998_999_999_999_999 + )); + + assert_noop!( + XYK::buy( + RuntimeOrigin::signed(user), + DOT, + ACA, + 1_000_000_000, + 10_000_000_000, + true + ), + Error::::InsufficientNativeCurrencyBalance + ); + }); +} + +#[test] +fn single_buy_should_work() { + new_test_ext().execute_with(|| { + let user_1 = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 200_000_000, + asset_b, + 640_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999_999_800_000_000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 999_360_000_000_000); + assert_eq!(Currency::free_balance(share_token, &user_1), 640_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 640_000_000_000); + + assert_ok!(XYK::buy( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 6_666_666, + 1_000_000_000_000, + false, + )); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999_999_806_666_666); + assert_eq!(Currency::free_balance(asset_b, &user_1), 999_337_886_898_839); + assert_eq!(Currency::free_balance(share_token, &user_1), 640_000_000_000); + assert_eq!(Currency::free_balance(asset_a, &pair_account), 193_333_334); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 662_113_101_161); + + expect_events(vec![ + Event::PoolCreated { + who: user_1, + asset_a, + asset_b, + initial_shares_amount: 640_000_000_000, + share_token, + pool: pair_account, + } + .into(), + Event::BuyExecuted { + who: user_1, + asset_out: asset_a, + asset_in: asset_b, + amount: 6_666_666, + buy_price: 22_068_963_235, + fee_asset: asset_b, + fee_amount: 44_137_926, + pool: pair_account, + } + .into(), + ]); + }); +} + +#[test] +fn create_pool_with_insufficient_liquidity_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + XYK::create_pool(RuntimeOrigin::signed(ALICE), ACA, 500, HDX, 1_600_000), + Error::::InsufficientLiquidity + ); + + assert_noop!( + XYK::create_pool(RuntimeOrigin::signed(ALICE), ACA, 5000, HDX, 500), + Error::::InsufficientLiquidity + ); + }); +} + +#[test] +fn add_liquidity_to_non_existing_pool_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + XYK::add_liquidity( + RuntimeOrigin::signed(ALICE), + HDX, + ACA, + 200_000_000_000_000_000, + 600_000_000 + ), + Error::::TokenPoolNotFound + ); + }); +} + +#[test] +fn remove_zero_liquidity_from_non_existing_pool_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + XYK::remove_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 100), + Error::::TokenPoolNotFound + ); + }); +} + +#[test] +fn sell_with_non_existing_pool_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + XYK::sell(RuntimeOrigin::signed(ALICE), HDX, DOT, 456_444_678, 1_000_000, false), + Error::::TokenPoolNotFound + ); + }); +} + +#[test] +fn discount_sell_with_no_native_pool_should_not_work() { + new_test_ext().execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + ACA, + 1000, + DOT, + 3_200_000 + )); + + assert_noop!( + XYK::sell(RuntimeOrigin::signed(ALICE), ACA, DOT, 456_444_678, 1_000_000, true), + Error::::CannotApplyDiscount + ); + }); +} + +#[test] +fn buy_with_non_existing_pool_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + XYK::buy( + RuntimeOrigin::signed(ALICE), + HDX, + DOT, + 456_444_678, + 1_000_000_000, + false + ), + Error::::TokenPoolNotFound + ); + }); +} + +#[test] +fn discount_buy_with_no_native_pool_should_not_work() { + new_test_ext().execute_with(|| { + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE), + ACA, + 10_000, + DOT, + 32_000_000 + )); + + assert_noop!( + XYK::buy(RuntimeOrigin::signed(ALICE), ACA, DOT, 1000, 1_000_000_000, true), + Error::::CannotApplyDiscount + ); + }); +} + +#[test] +fn money_in_sell_money_out_should_leave_the_same_balance() { + new_test_ext().execute_with(|| { + let user_1 = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + let user_1_balance_a_before = Currency::free_balance(asset_a, &user_1); + let user_1_balance_b_before = Currency::free_balance(asset_b, &user_1); + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 200_000_000_000, + asset_b, + 600_000_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); + assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); + + assert_ok!(XYK::sell( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 456_444_678, + 1000000000000, + false, + )); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999799543555322); + assert_eq!(Currency::free_balance(asset_b, &user_1), 401363483591788); + assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200456444678); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 598636516408212); + + assert_ok!(XYK::remove_liquidity( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 600000000000000 + )); + + let user_1_balance_a_after = Currency::free_balance(asset_a, &user_1); + let user_1_balance_b_after = Currency::free_balance(asset_b, &user_1); + + assert_eq!(user_1_balance_a_before, user_1_balance_a_after); + assert_eq!(user_1_balance_b_before, user_1_balance_b_after); + }); +} + +#[test] +fn money_in_money_out_should_leave_the_same_balance_for_both_accounts() { + new_test_ext().execute_with(|| { + let user_1 = ALICE; + let user_2 = BOB; + let asset_a = HDX; + let asset_b = DOT; + + let user_1_balance_a_before = Currency::free_balance(asset_a, &user_1); + let user_1_balance_b_before = Currency::free_balance(asset_b, &user_1); + let user_2_balance_a_before = Currency::free_balance(asset_a, &user_2); + let user_2_balance_b_before = Currency::free_balance(asset_b, &user_2); + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 100_000_000, + asset_b, + 1_000_000_000_000, + )); + + let asset_pair = AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }; + + let pair_account = XYK::get_pair_id(asset_pair); + let share_token = XYK::share_token(pair_account); + + assert!(XYK::exists(asset_pair)); + + assert_ok!(XYK::add_liquidity( + RuntimeOrigin::signed(user_2), + asset_a, + asset_b, + 100_000_000, + 1_100_000_000_000 + )); + + assert_eq!(Currency::free_balance(share_token, &user_1), 100_000_000); + assert_eq!(Currency::free_balance(share_token, &user_2), 100_000_000); + + assert_ok!(XYK::remove_liquidity( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 100_000_000 + )); + + assert_ok!(XYK::remove_liquidity( + RuntimeOrigin::signed(user_2), + asset_a, + asset_b, + 100_000_000 + )); + + assert_eq!(XYK::total_liquidity(pair_account), 0); + + let user_1_balance_a_after = Currency::free_balance(asset_a, &user_1); + let user_1_balance_b_after = Currency::free_balance(asset_b, &user_1); + let user_2_balance_a_after = Currency::free_balance(asset_a, &user_2); + let user_2_balance_b_after = Currency::free_balance(asset_b, &user_2); + + assert_eq!(user_1_balance_a_before, user_1_balance_a_after); + assert_eq!(user_1_balance_b_before, user_1_balance_b_after); + assert_eq!(user_2_balance_a_before, user_2_balance_a_after); + assert_eq!(user_2_balance_b_before, user_2_balance_b_after); + + assert!(!XYK::exists(asset_pair)); + }); +} + +#[test] +fn sell_test_not_reaching_limit() { + ExtBuilder::default().build().execute_with(|| { + let user_1 = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 200_000_000_000, + asset_b, + 600_000_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); + assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); + + assert_noop!( + XYK::sell( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 456_444_678, + 1_000_000_000_000_000, + false, + ), + Error::::AssetAmountNotReachedLimit + ); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); + }); +} + +#[test] +fn buy_test_exceeding_max_limit() { + ExtBuilder::default().build().execute_with(|| { + let user_1 = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 200_000_000_000, + asset_b, + 600_000_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); + assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); + + assert_noop!( + XYK::buy( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 456_444_678, + 1_000_000_000, + false, + ), + Error::::AssetAmountExceededLimit + ); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); + }); +} + +#[test] +fn single_buy_more_than_ratio_out_should_not_work() { + new_test_ext().execute_with(|| { + let user_1 = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 200_000_000, + asset_b, + 640_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999_999_800_000_000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 999_360_000_000_000); + assert_eq!(Currency::free_balance(share_token, &user_1), 640_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 640_000_000_000); + + assert_noop!( + XYK::buy( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 66_666_667, + 1_000_000_000_000, + false, + ), + Error::::MaxOutRatioExceeded + ); + }); +} + +#[test] +fn single_buy_more_than_ratio_in_should_not_work() { + new_test_ext().execute_with(|| { + let user_1 = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 100_000_000_000, + asset_b, + 100_000_000_000 + )); + + assert_noop!( + XYK::buy( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 33_333_333_333, + 1_000_000_000_000, + false, + ), + Error::::MaxInRatioExceeded + ); + }); +} + +#[test] +fn single_sell_more_than_ratio_in_should_not_work() { + new_test_ext().execute_with(|| { + let user_1 = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 200_000_000_000, + asset_b, + 600_000_000_000_000, + )); + + let pair_account = XYK::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + let share_token = XYK::share_token(pair_account); + + assert_eq!(Currency::free_balance(asset_a, &user_1), 999_800_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &user_1), 400_000_000_000_000); + assert_eq!(Currency::free_balance(share_token, &user_1), 600_000_000_000_000); + + assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000); + assert_eq!(Currency::free_balance(asset_b, &pair_account), 600_000_000_000_000); + + assert_noop!( + XYK::sell( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 66_666_666_667, + 10_000_000, + false, + ), + Error::::MaxInRatioExceeded + ); + }); +} + +#[test] +fn single_sell_more_than_ratio_out_should_not_work() { + ExtBuilder::default().with_max_out_ratio(5).build().execute_with(|| { + let user_1 = ALICE; + let asset_a = ACA; + let asset_b = DOT; + + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(user_1), + asset_a, + 100_000_000_000, + asset_b, + 100_000_000_000 + )); + + assert_noop!( + XYK::sell( + RuntimeOrigin::signed(user_1), + asset_a, + asset_b, + 33_333_333_333, + 10_000_000, + false, + ), + Error::::MaxOutRatioExceeded + ); + }); +} + +#[test] +fn sell_with_low_amount_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + XYK::sell(RuntimeOrigin::signed(ALICE), HDX, DOT, 1, 1_000_000, false), + Error::::InsufficientTradingAmount + ); + }); +} + +#[test] +fn buy_with_low_amount_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + XYK::buy(RuntimeOrigin::signed(ALICE), HDX, DOT, 1, 1_000_000, false), + Error::::InsufficientTradingAmount + ); + }); +} + +#[test] +fn buy_with_excesive_amount_should_not_work() { + new_test_ext().execute_with(|| { + assert_ok!(XYK::create_pool(RuntimeOrigin::signed(ALICE), HDX, 10_000, DOT, 10_000,)); + + assert_noop!( + XYK::buy(RuntimeOrigin::signed(ALICE), HDX, DOT, 20_000, 1_000_000, false), + Error::::InsufficientPoolAssetBalance + ); + }); +} diff --git a/pallets/xyk/src/trade_execution.rs b/pallets/xyk/src/trade_execution.rs new file mode 100644 index 00000000000..ae405227091 --- /dev/null +++ b/pallets/xyk/src/trade_execution.rs @@ -0,0 +1,143 @@ +use crate::types::{AssetId, AssetPair, Balance}; +use crate::{Config, Error, Pallet}; +use frame_support::ensure; +use frame_support::traits::Get; +use hydradx_traits::router::{ExecutorError, PoolType, TradeExecution}; +use hydradx_traits::AMM; +use orml_traits::MultiCurrency; +use sp_runtime::DispatchError; + +impl TradeExecution for Pallet { + type Error = DispatchError; + + fn calculate_sell( + pool_type: PoolType, + asset_in: AssetId, + asset_out: AssetId, + amount_in: Balance, + ) -> Result> { + if pool_type != PoolType::XYK { + return Err(ExecutorError::NotSupported); + } + + let assets = AssetPair { asset_in, asset_out }; + + if !Self::exists(assets) { + return Err(ExecutorError::Error(Error::::TokenPoolNotFound.into())); + } + + let pair_account = Self::get_pair_id(assets); + + let asset_in_reserve = T::Currency::free_balance(assets.asset_in, &pair_account); + let asset_out_reserve = T::Currency::free_balance(assets.asset_out, &pair_account); + + let amount_out = hydra_dx_math::xyk::calculate_out_given_in(asset_in_reserve, asset_out_reserve, amount_in) + .map_err(|_| ExecutorError::Error(Error::::SellAssetAmountInvalid.into()))?; + + ensure!( + asset_out_reserve > amount_out, + ExecutorError::Error(Error::::InsufficientPoolAssetBalance.into()) + ); + + let transfer_fee = Self::calculate_fee(amount_out).map_err(ExecutorError::Error)?; + + let amount_out_without_fee = amount_out + .checked_sub(transfer_fee) + .ok_or_else(|| ExecutorError::Error(Error::::SellAssetAmountInvalid.into()))?; + + Ok(amount_out_without_fee) + } + + fn calculate_buy( + pool_type: PoolType, + asset_in: AssetId, + asset_out: AssetId, + amount_out: Balance, + ) -> Result> { + if pool_type != PoolType::XYK { + return Err(ExecutorError::NotSupported); + } + + let assets = AssetPair { asset_in, asset_out }; + + ensure!( + Self::exists(assets), + ExecutorError::Error(Error::::TokenPoolNotFound.into()) + ); + + let pair_account = Self::get_pair_id(assets); + + let asset_out_reserve = T::Currency::free_balance(assets.asset_out, &pair_account); + let asset_in_reserve = T::Currency::free_balance(assets.asset_in, &pair_account); + + ensure!( + asset_out_reserve > amount_out, + ExecutorError::Error(Error::::InsufficientPoolAssetBalance.into()) + ); + + ensure!( + amount_out >= T::MinTradingLimit::get(), + ExecutorError::Error(Error::::InsufficientTradingAmount.into()) + ); + + let amount_in = hydra_dx_math::xyk::calculate_in_given_out(asset_out_reserve, asset_in_reserve, amount_out) + .map_err(|_| ExecutorError::Error(Error::::BuyAssetAmountInvalid.into()))?; + + let transfer_fee = Self::calculate_fee(amount_in).map_err(ExecutorError::Error)?; + + let amount_in_with_fee = amount_in + .checked_add(transfer_fee) + .ok_or_else(|| ExecutorError::Error(Error::::BuyAssetAmountInvalid.into()))?; + + Ok(amount_in_with_fee) + } + + fn execute_sell( + who: T::RuntimeOrigin, + pool_type: PoolType, + asset_in: AssetId, + asset_out: AssetId, + amount_in: Balance, + min_limit: Balance, + ) -> Result<(), ExecutorError> { + if pool_type != PoolType::XYK { + return Err(ExecutorError::NotSupported); + } + + Self::sell(who, asset_in, asset_out, amount_in, min_limit, false).map_err(ExecutorError::Error) + } + + fn execute_buy( + who: T::RuntimeOrigin, + pool_type: PoolType, + asset_in: AssetId, + asset_out: AssetId, + amount_out: Balance, + max_limit: Balance, + ) -> Result<(), ExecutorError> { + if pool_type != PoolType::XYK { + return Err(ExecutorError::NotSupported); + } + + Self::buy(who, asset_out, asset_in, amount_out, max_limit, false).map_err(ExecutorError::Error) + } + + fn get_liquidity_depth( + pool_type: PoolType, + asset_a: AssetId, + asset_b: AssetId, + ) -> Result> { + if pool_type != PoolType::XYK { + return Err(ExecutorError::NotSupported); + } + + let pair_account = Self::get_pair_id(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + + let liquidty = T::Currency::free_balance(asset_a, &pair_account); + + Ok(liquidty) + } +} diff --git a/pallets/xyk/src/types.rs b/pallets/xyk/src/types.rs new file mode 100644 index 00000000000..ce20f6aa35d --- /dev/null +++ b/pallets/xyk/src/types.rs @@ -0,0 +1,69 @@ +// This file is part of Basilisk-node. + +// 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 type AssetId = u32; +pub type Amount = i128; +pub type Balance = u128; +pub type Price = FixedU128; + +use codec::{Decode, Encode}; +use scale_info::TypeInfo; +use sp_runtime::FixedU128; +use sp_std::vec::Vec; + +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; + +/// Asset Pair representation for AMM trades +/// ( asset_a, asset_b ) combination where asset_a is meant to be exchanged for asset_b +/// +/// asset_in represents asset coming into the pool +/// asset_out represents asset coming out of the pool +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +#[derive(Debug, Encode, Decode, Copy, Clone, PartialEq, Eq, Default, TypeInfo)] +pub struct AssetPair { + pub asset_in: AssetId, + pub asset_out: AssetId, +} + +impl AssetPair { + pub fn new(asset_in: AssetId, asset_out: AssetId) -> Self { + Self { asset_in, asset_out } + } + + /// Return ordered asset tuple (A,B) where A < B + /// Used in storage + pub fn ordered_pair(&self) -> (AssetId, AssetId) { + match self.asset_in <= self.asset_out { + true => (self.asset_in, self.asset_out), + false => (self.asset_out, self.asset_in), + } + } + + /// Return share token name + pub fn name(&self) -> Vec { + let mut buf: Vec = Vec::new(); + + let (asset_a, asset_b) = self.ordered_pair(); + + buf.extend_from_slice(&asset_a.to_le_bytes()); + buf.extend_from_slice(b"HDT"); + buf.extend_from_slice(&asset_b.to_le_bytes()); + + buf + } +} diff --git a/pallets/xyk/src/weights.rs b/pallets/xyk/src/weights.rs new file mode 100644 index 00000000000..1eb9c21a156 --- /dev/null +++ b/pallets/xyk/src/weights.rs @@ -0,0 +1,368 @@ +// This file is part of HydraDX. + +// Copyright (C) 2020-2023 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_xyk +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-10-06, STEPS: 10, REPEAT: 30, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 + +// Executed Command: +// target/release/hydradx +// benchmark +// pallet +// --chain=dev +// --steps=10 +// --repeat=30 +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --template=.maintain/pallet-weight-template-no-back.hbs +// --pallet=pallet-xyk +// --output=xyk.rs +// --extrinsic=* + +#![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_xyk. +pub trait WeightInfo { + fn create_pool() -> Weight; + fn add_liquidity() -> Weight; + fn remove_liquidity() -> Weight; + fn sell() -> Weight; + fn buy() -> Weight; + fn router_execution_sell(c: u32, e: u32) -> Weight; + fn router_execution_buy(c: u32, e: u32) -> Weight; +} + +/// Weights for amm using the hydraDX node and recommended hardware. +pub struct HydraWeight(PhantomData); + +impl WeightInfo for HydraWeight { + // Storage: LBP PoolData (r:1 w:0) + // Proof: LBP PoolData (max_values: None, max_size: Some(163), added: 2638, mode: MaxEncodedLen) + // Storage: XYK ShareToken (r:1 w:1) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:5 w:5) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry AssetIds (r:1 w:1) + // Proof: AssetRegistry AssetIds (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) + // Storage: AssetRegistry NextAssetId (r:1 w:1) + // Proof: AssetRegistry NextAssetId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:2 w:1) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:2 w:2) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: MultiTransactionPayment AccountCurrencyMap (r:2 w:1) + // Proof: MultiTransactionPayment AccountCurrencyMap (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: MultiTransactionPayment AcceptedCurrencies (r:1 w:0) + // Proof: MultiTransactionPayment AcceptedCurrencies (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) + // Storage: Tokens TotalIssuance (r:1 w:1) + // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) + // Storage: Duster AccountBlacklist (r:0 w:1) + // Proof: Duster AccountBlacklist (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + // Storage: XYK TotalLiquidity (r:0 w:1) + // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) + // Storage: XYK PoolAssets (r:0 w:1) + // Proof: XYK PoolAssets (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) + fn create_pool() -> Weight { + // Minimum execution time: 190_185 nanoseconds. + Weight::from_parts(192_567_000, 0) + .saturating_add(T::DbWeight::get().reads(17 as u64)) + .saturating_add(T::DbWeight::get().writes(16 as u64)) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:5 w:5) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: XYK TotalLiquidity (r:1 w:1) + // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:3 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:1 w:1) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: Tokens TotalIssuance (r:1 w:1) + // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) + // Storage: MultiTransactionPayment AccountCurrencyMap (r:1 w:0) + // Proof: MultiTransactionPayment AccountCurrencyMap (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + fn add_liquidity() -> Weight { + // Minimum execution time: 164_323 nanoseconds. + Weight::from_parts(165_841_000, 0) + .saturating_add(T::DbWeight::get().reads(14 as u64)) + .saturating_add(T::DbWeight::get().writes(9 as u64)) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: XYK TotalLiquidity (r:1 w:1) + // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:5 w:5) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:3 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:1 w:0) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: Tokens TotalIssuance (r:1 w:1) + // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + fn remove_liquidity() -> Weight { + // Minimum execution time: 155_404 nanoseconds. + Weight::from_parts(156_560_000, 0) + .saturating_add(T::DbWeight::get().reads(13 as u64)) + .saturating_add(T::DbWeight::get().writes(8 as u64)) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:4 w:4) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:2 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:2 w:0) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + fn sell() -> Weight { + // Minimum execution time: 119_610 nanoseconds. + Weight::from_parts(120_418_000, 0) + .saturating_add(T::DbWeight::get().reads(10 as u64)) + .saturating_add(T::DbWeight::get().writes(5 as u64)) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:4 w:4) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:2 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:2 w:0) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + fn buy() -> Weight { + // Minimum execution time: 119_865 nanoseconds. + Weight::from_parts(120_541_000, 0) + .saturating_add(T::DbWeight::get().reads(10 as u64)) + .saturating_add(T::DbWeight::get().writes(5 as u64)) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:4 w:4) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:2 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:2 w:0) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + /// The range of component `c` is `[1, 2]`. + /// The range of component `e` is `[0, 1]`. + fn router_execution_sell(c: u32, e: u32) -> Weight { + // Minimum execution time: 20_906 nanoseconds. + Weight::from_parts(8_365_948, 0) // Standard Error: 43_229 + .saturating_add(Weight::from_parts(6_554_981, 0).saturating_mul(c as u64)) + // Standard Error: 43_229 + .saturating_add(Weight::from_parts(105_218_621, 0).saturating_mul(e as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().reads((7 as u64).saturating_mul(e as u64))) + .saturating_add(T::DbWeight::get().writes((5 as u64).saturating_mul(e as u64))) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:4 w:4) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:2 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:2 w:0) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + /// The range of component `c` is `[1, 3]`. + /// The range of component `e` is `[0, 1]`. + fn router_execution_buy(c: u32, e: u32) -> Weight { + // Minimum execution time: 27_261 nanoseconds. + Weight::from_parts(7_044_054, 0) // Standard Error: 46_197 + .saturating_add(Weight::from_parts(7_022_106, 0).saturating_mul(c as u64)) + // Standard Error: 78_379 + .saturating_add(Weight::from_parts(105_927_586, 0).saturating_mul(e as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().reads((7 as u64).saturating_mul(e as u64))) + .saturating_add(T::DbWeight::get().writes((5 as u64).saturating_mul(e as u64))) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + // Storage: LBP PoolData (r:1 w:0) + // Proof: LBP PoolData (max_values: None, max_size: Some(163), added: 2638, mode: MaxEncodedLen) + // Storage: XYK ShareToken (r:1 w:1) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:5 w:5) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry AssetIds (r:1 w:1) + // Proof: AssetRegistry AssetIds (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) + // Storage: AssetRegistry NextAssetId (r:1 w:1) + // Proof: AssetRegistry NextAssetId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:2 w:1) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:2 w:2) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: MultiTransactionPayment AccountCurrencyMap (r:2 w:1) + // Proof: MultiTransactionPayment AccountCurrencyMap (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: MultiTransactionPayment AcceptedCurrencies (r:1 w:0) + // Proof: MultiTransactionPayment AcceptedCurrencies (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) + // Storage: Tokens TotalIssuance (r:1 w:1) + // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) + // Storage: Duster AccountBlacklist (r:0 w:1) + // Proof: Duster AccountBlacklist (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + // Storage: XYK TotalLiquidity (r:0 w:1) + // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) + // Storage: XYK PoolAssets (r:0 w:1) + // Proof: XYK PoolAssets (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) + fn create_pool() -> Weight { + // Minimum execution time: 190_185 nanoseconds. + Weight::from_parts(192_567_000, 0) + .saturating_add(RocksDbWeight::get().reads(17 as u64)) + .saturating_add(RocksDbWeight::get().writes(16 as u64)) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:5 w:5) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: XYK TotalLiquidity (r:1 w:1) + // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:3 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:1 w:1) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: Tokens TotalIssuance (r:1 w:1) + // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) + // Storage: MultiTransactionPayment AccountCurrencyMap (r:1 w:0) + // Proof: MultiTransactionPayment AccountCurrencyMap (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + fn add_liquidity() -> Weight { + // Minimum execution time: 164_323 nanoseconds. + Weight::from_parts(165_841_000, 0) + .saturating_add(RocksDbWeight::get().reads(14 as u64)) + .saturating_add(RocksDbWeight::get().writes(9 as u64)) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: XYK TotalLiquidity (r:1 w:1) + // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:5 w:5) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:3 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:1 w:0) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: Tokens TotalIssuance (r:1 w:1) + // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + fn remove_liquidity() -> Weight { + // Minimum execution time: 155_404 nanoseconds. + Weight::from_parts(156_560_000, 0) + .saturating_add(RocksDbWeight::get().reads(13 as u64)) + .saturating_add(RocksDbWeight::get().writes(8 as u64)) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:4 w:4) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:2 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:2 w:0) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + fn sell() -> Weight { + // Minimum execution time: 119_610 nanoseconds. + Weight::from_parts(120_418_000, 0) + .saturating_add(RocksDbWeight::get().reads(10 as u64)) + .saturating_add(RocksDbWeight::get().writes(5 as u64)) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:4 w:4) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:2 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:2 w:0) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + fn buy() -> Weight { + // Minimum execution time: 119_865 nanoseconds. + Weight::from_parts(120_541_000, 0) + .saturating_add(RocksDbWeight::get().reads(10 as u64)) + .saturating_add(RocksDbWeight::get().writes(5 as u64)) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:4 w:4) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:2 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:2 w:0) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + /// The range of component `c` is `[1, 2]`. + /// The range of component `e` is `[0, 1]`. + fn router_execution_sell(c: u32, e: u32) -> Weight { + // Minimum execution time: 20_906 nanoseconds. + Weight::from_parts(8_365_948, 0) // Standard Error: 43_229 + .saturating_add(Weight::from_parts(6_554_981, 0).saturating_mul(c as u64)) + // Standard Error: 43_229 + .saturating_add(Weight::from_parts(105_218_621, 0).saturating_mul(e as u64)) + .saturating_add(RocksDbWeight::get().reads(3 as u64)) + .saturating_add(RocksDbWeight::get().reads((7 as u64).saturating_mul(e as u64))) + .saturating_add(RocksDbWeight::get().writes((5 as u64).saturating_mul(e as u64))) + } + // Storage: XYK ShareToken (r:1 w:0) + // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) + // Storage: Tokens Accounts (r:4 w:4) + // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) + // Storage: AssetRegistry Assets (r:2 w:0) + // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) + // Storage: System Account (r:2 w:0) + // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + // Storage: EmaOracle Accumulator (r:1 w:1) + // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) + /// The range of component `c` is `[1, 3]`. + /// The range of component `e` is `[0, 1]`. + fn router_execution_buy(c: u32, e: u32) -> Weight { + // Minimum execution time: 27_261 nanoseconds. + Weight::from_parts(7_044_054, 0) // Standard Error: 46_197 + .saturating_add(Weight::from_parts(7_022_106, 0).saturating_mul(c as u64)) + // Standard Error: 78_379 + .saturating_add(Weight::from_parts(105_927_586, 0).saturating_mul(e as u64)) + .saturating_add(RocksDbWeight::get().reads(3 as u64)) + .saturating_add(RocksDbWeight::get().reads((7 as u64).saturating_mul(e as u64))) + .saturating_add(RocksDbWeight::get().writes((5 as u64).saturating_mul(e as u64))) + } +} diff --git a/primitives/src/constants.rs b/primitives/src/constants.rs index 78deede9cee..2334bb795e4 100644 --- a/primitives/src/constants.rs +++ b/primitives/src/constants.rs @@ -91,7 +91,7 @@ pub mod chain { /// We allow for pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( WEIGHT_REF_TIME_PER_SECOND.saturating_div(2), - polkadot_primitives::v5::MAX_POV_SIZE as u64, + polkadot_primitives::v6::MAX_POV_SIZE as u64, ); /// Discounted XYK fee diff --git a/runtime/basilisk/Cargo.toml b/runtime/basilisk/Cargo.toml index 625b84cd2c8..7c0b50933cb 100644 --- a/runtime/basilisk/Cargo.toml +++ b/runtime/basilisk/Cargo.toml @@ -23,9 +23,9 @@ log = { workspace = true } # local dependencies primitives = { default-features = false, path = "../../primitives" } -pallet-marketplace = { path = '../../pallets/marketplace', default-features = false } -pallet-xyk-liquidity-mining = { path = "../../pallets/xyk-liquidity-mining", default-features = false } -pallet-xyk-liquidity-mining-benchmarking = { path = "../../pallets/xyk-liquidity-mining/benchmarking", optional = true, default-features = false } +pallet-marketplace = { workspace = true, default-features = false } +pallet-xyk-liquidity-mining = { workspace = true , default-features = false } +pallet-xyk-liquidity-mining-benchmarking = { workspace = true, optional = true, default-features = false } pallet-treasury = { workspace = true } pallet-democracy = { workspace = true } @@ -80,7 +80,7 @@ cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } cumulus-primitives-parachain-inherent = { workspace = true } cumulus-primitives-timestamp = { workspace = true } -parachain-info = { workspace = true } +staging-parachain-info = { workspace = true } # Polkadot dependencies polkadot-parachain = { workspace = true } @@ -192,7 +192,7 @@ std = [ "xcm-builder/std", "xcm-executor/std", "pallet-xcm/std", - "parachain-info/std", + "staging-parachain-info/std", "pallet-xyk/std", "pallet-duster/std", "pallet-asset-registry/std", @@ -241,6 +241,7 @@ std = [ "pallet-ema-oracle/std", "pallet-xcm-rate-limiter/std", "pallet-state-trie-migration/std", + "cumulus-primitives-utility/std", ] try-runtime= [ "frame-try-runtime", @@ -256,7 +257,7 @@ try-runtime= [ "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-xcm/try-runtime", "cumulus-pallet-xcmp-queue/try-runtime", - "parachain-info/try-runtime", + "staging-parachain-info/try-runtime", "pallet-aura/try-runtime", "pallet-balances/try-runtime", "pallet-elections-phragmen/try-runtime", diff --git a/rust-toolchain b/rust-toolchain index 4657c24c6ec..dacd22ff583 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2023-05-22" +channel = "1.75.0" components = [ "rustfmt", "clippy" ] targets = [ "wasm32-unknown-unknown" ] profile = "minimal" From 8fa3d2687d5892a8ad5f62639658e0e6adb6cd6b Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 12 Apr 2024 22:56:45 +0200 Subject: [PATCH 02/56] pallets configs --- Cargo.lock | 2993 +++++++---------- Cargo.toml | 190 +- integration-tests/Cargo.toml | 2 +- runtime/basilisk/Cargo.toml | 11 +- runtime/basilisk/src/assets.rs | 13 +- runtime/basilisk/src/lib.rs | 5 +- runtime/basilisk/src/system.rs | 74 +- .../basilisk/src/weights/route_executor.rs | 4 + runtime/basilisk/src/weights/xcmp_queue.rs | 103 +- runtime/basilisk/src/xcm.rs | 29 +- 10 files changed, 1531 insertions(+), 1893 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e254f7923b..3452083b153 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -888,7 +888,7 @@ dependencies = [ "cumulus-relay-chain-inprocess-interface", "cumulus-relay-chain-interface", "cumulus-relay-chain-minimal-node", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-benchmarking-cli", "frame-system-rpc-runtime-api", "frame-try-runtime", @@ -928,24 +928,24 @@ dependencies = [ "sc-transaction-pool-api", "serde", "serde_json", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-authority-discovery", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-aura", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keystore", "sp-offchain", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-session", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", "sp-transaction-pool", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", "substrate-frame-rpc-system", "substrate-prometheus-endpoint", "substrate-state-trie-migration-rpc", @@ -965,10 +965,10 @@ dependencies = [ "cumulus-primitives-parachain-inherent", "cumulus-primitives-timestamp", "cumulus-primitives-utility", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-executive", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", @@ -1001,6 +1001,7 @@ dependencies = [ "pallet-lbp", "pallet-liquidity-mining", "pallet-marketplace", + "pallet-message-queue", "pallet-multisig", "pallet-nft", "pallet-preimage", @@ -1020,10 +1021,10 @@ dependencies = [ "pallet-uniques", "pallet-utility", "pallet-xcm", - "pallet-xcm-rate-limiter", "pallet-xyk", "pallet-xyk-liquidity-mining", "pallet-xyk-liquidity-mining-benchmarking", + "parachains-common", "parity-scale-codec", "polkadot-parachain-primitives", "primitive-types", @@ -1031,21 +1032,21 @@ dependencies = [ "scale-info", "serde", "smallvec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-block-builder", "sp-consensus-aura", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents", + "sp-io", "sp-offchain", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-session", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", + "sp-version", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", @@ -1288,8 +1289,8 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", ] [[package]] @@ -1512,7 +1513,7 @@ dependencies = [ "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -2015,8 +2016,8 @@ dependencies = [ "sc-client-api", "sc-service", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "url", ] @@ -2036,10 +2037,10 @@ dependencies = [ "polkadot-overseer", "polkadot-primitives", "sc-client-api", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-consensus", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "tracing", ] @@ -2069,17 +2070,17 @@ dependencies = [ "sc-consensus-slots", "sc-telemetry", "schnellru", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-aura", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", + "sp-keystore", + "sp-runtime", + "sp-state-machine", "sp-timestamp", "substrate-prometheus-endpoint", "tracing", @@ -2106,10 +2107,10 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-consensus-slots", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-timestamp", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", "substrate-prometheus-endpoint", "tracing", ] @@ -2123,9 +2124,9 @@ dependencies = [ "async-trait", "cumulus-primitives-parachain-inherent", "sp-consensus", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents", + "sp-runtime", + "sp-state-machine", "thiserror", ] @@ -2146,9 +2147,9 @@ dependencies = [ "sc-client-api", "sp-blockchain", "sp-consensus", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", + "sp-state-machine", "tracing", ] @@ -2165,14 +2166,14 @@ dependencies = [ "parity-scale-codec", "sc-client-api", "scale-info", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-crypto-hashing", + "sp-inherents", + "sp-runtime", + "sp-state-machine", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", "tracing", ] @@ -2196,7 +2197,7 @@ dependencies = [ "sc-consensus", "sp-consensus", "sp-maybe-compressed-blob", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "tracing", ] @@ -2228,11 +2229,11 @@ dependencies = [ "sc-telemetry", "sc-transaction-pool", "sc-utils", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", "sp-consensus", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-transaction-pool", ] @@ -2242,15 +2243,15 @@ version = "0.7.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-pallet-parachain-system", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "pallet-aura", "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", "sp-consensus-aura", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -2260,13 +2261,13 @@ version = "0.7.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-primitives-core", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", ] @@ -2282,9 +2283,9 @@ dependencies = [ "cumulus-primitives-parachain-inherent", "cumulus-primitives-proof-size-hostfunction", "environmental", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "impl-trait-for-tuples", "log", "pallet-message-queue", @@ -2292,15 +2293,15 @@ dependencies = [ "polkadot-parachain-primitives", "polkadot-runtime-parachains", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-state-machine", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", + "sp-version", "staging-xcm", "trie-db", ] @@ -2322,12 +2323,12 @@ version = "0.7.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-primitives-core", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", ] @@ -2340,18 +2341,18 @@ dependencies = [ "bounded-collections", "bp-xcm-bridge-hub-router", "cumulus-primitives-core", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "pallet-message-queue", "parity-scale-codec", "polkadot-runtime-common", "polkadot-runtime-parachains", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-executor", @@ -2365,9 +2366,9 @@ dependencies = [ "parity-scale-codec", "polkadot-core-primitives", "polkadot-primitives", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-consensus-aura", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -2381,10 +2382,10 @@ dependencies = [ "polkadot-parachain-primitives", "polkadot-primitives", "scale-info", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", "staging-xcm", ] @@ -2397,10 +2398,10 @@ dependencies = [ "cumulus-primitives-core", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", ] [[package]] @@ -2410,7 +2411,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", ] [[package]] @@ -2421,7 +2422,7 @@ dependencies = [ "cumulus-primitives-core", "futures", "parity-scale-codec", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", ] @@ -2432,15 +2433,15 @@ version = "0.7.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-primitives-core", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", "log", "pallet-asset-conversion", "pallet-xcm-benchmarks", "parity-scale-codec", "polkadot-runtime-common", "polkadot-runtime-parachains", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-builder", @@ -2464,11 +2465,11 @@ dependencies = [ "sc-sysinfo", "sc-telemetry", "sc-tracing", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-consensus", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", + "sp-state-machine", ] [[package]] @@ -2483,9 +2484,9 @@ dependencies = [ "parity-scale-codec", "polkadot-overseer", "sc-client-api", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine", "thiserror", ] @@ -2520,11 +2521,11 @@ dependencies = [ "sc-service", "sc-tracing", "sc-utils", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", "sp-consensus", "sp-consensus-babe", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "substrate-prometheus-endpoint", "tokio", "tracing", @@ -2554,14 +2555,14 @@ dependencies = [ "serde_json", "smoldot", "smoldot-light", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-authority-discovery", "sp-consensus-babe", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", + "sp-state-machine", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version", "thiserror", "tokio", "tokio-util", @@ -2577,10 +2578,10 @@ dependencies = [ "cumulus-primitives-core", "parity-scale-codec", "polkadot-primitives", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-state-machine", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", ] [[package]] @@ -3552,11 +3553,11 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime-interface 24.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] @@ -3565,14 +3566,14 @@ version = "3.0.0-dev" source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#5d6bf0c78d1d325d4eea6f9593e9a11da18a1ea8" dependencies = [ "evm", - "frame-support 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "frame-support", "num_enum", "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] @@ -3581,50 +3582,25 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" -[[package]] -name = "frame-benchmarking" -version = "28.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "frame-support 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "frame-support-procedural 23.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "linregress", - "log", - "parity-scale-codec", - "paste", - "scale-info", - "serde", - "sp-api 26.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime-interface 24.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-storage 19.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "static_assertions", -] - [[package]] name = "frame-benchmarking" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support-procedural 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-support-procedural", + "frame-system", "linregress", "log", "parity-scale-codec", "paste", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-runtime", "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", @@ -3641,9 +3617,9 @@ dependencies = [ "chrono", "clap", "comfy-table", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "gethostname", "handlebars", "itertools 0.10.5", @@ -3662,18 +3638,18 @@ dependencies = [ "sc-sysinfo", "serde", "serde_json", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-database", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-state-machine", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "thousands", @@ -3696,14 +3672,14 @@ version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "frame-election-provider-solution-type", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", "sp-npos-elections", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -3712,15 +3688,15 @@ name = "frame-executive" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "frame-try-runtime", "log", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -3748,58 +3724,17 @@ dependencies = [ "log", "parity-scale-codec", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-crypto-hashing", + "sp-io", + "sp-runtime", + "sp-state-machine", "spinners", "substrate-rpc-client", "tokio", "tokio-retry", ] -[[package]] -name = "frame-support" -version = "28.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "aquamarine", - "array-bytes 6.2.2", - "bitflags 1.3.2", - "docify", - "environmental", - "frame-metadata", - "frame-support-procedural 23.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "impl-trait-for-tuples", - "k256", - "log", - "macro_magic", - "parity-scale-codec", - "paste", - "scale-info", - "serde", - "serde_json", - "smallvec", - "sp-api 26.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-crypto-hashing-proc-macro 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-debug-derive 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-genesis-builder 0.7.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-metadata-ir 0.6.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-tracing 16.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "static_assertions", - "tt-call", -] - [[package]] name = "frame-support" version = "28.0.0" @@ -3811,7 +3746,7 @@ dependencies = [ "docify", "environmental", "frame-metadata", - "frame-support-procedural 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support-procedural", "impl-trait-for-tuples", "k256", "log", @@ -3822,44 +3757,25 @@ dependencies = [ "serde", "serde_json", "smallvec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing-proc-macro 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-crypto-hashing-proc-macro", "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-genesis-builder 0.7.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-metadata-ir 0.6.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-genesis-builder", + "sp-inherents", + "sp-io", + "sp-metadata-ir", + "sp-runtime", + "sp-staking", + "sp-state-machine", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights", "static_assertions", "tt-call", ] -[[package]] -name = "frame-support-procedural" -version = "23.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "Inflector", - "cfg-expr", - "derive-syn-parse 0.1.5", - "expander 2.1.0", - "frame-support-procedural-tools 10.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "itertools 0.10.5", - "macro_magic", - "proc-macro-warning", - "proc-macro2", - "quote", - "sp-crypto-hashing 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "syn 2.0.58", -] - [[package]] name = "frame-support-procedural" version = "23.0.0" @@ -3869,25 +3785,13 @@ dependencies = [ "cfg-expr", "derive-syn-parse 0.1.5", "expander 2.1.0", - "frame-support-procedural-tools 10.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support-procedural-tools", "itertools 0.10.5", "macro_magic", "proc-macro-warning", "proc-macro2", "quote", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "syn 2.0.58", -] - -[[package]] -name = "frame-support-procedural-tools" -version = "10.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "frame-support-procedural-tools-derive 11.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "proc-macro-crate 3.1.0", - "proc-macro2", - "quote", + "sp-crypto-hashing", "syn 2.0.58", ] @@ -3896,23 +3800,13 @@ name = "frame-support-procedural-tools" version = "10.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support-procedural-tools-derive 11.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support-procedural-tools-derive", "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 2.0.58", ] -[[package]] -name = "frame-support-procedural-tools-derive" -version = "11.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.58", -] - [[package]] name = "frame-support-procedural-tools-derive" version = "11.0.0" @@ -3923,26 +3817,6 @@ dependencies = [ "syn 2.0.58", ] -[[package]] -name = "frame-system" -version = "28.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "cfg-if", - "docify", - "frame-support 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", -] - [[package]] name = "frame-system" version = "28.0.0" @@ -3950,17 +3824,17 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "cfg-if", "docify", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", "log", "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version", + "sp-weights", ] [[package]] @@ -3968,13 +3842,13 @@ name = "frame-system-benchmarking" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -3984,7 +3858,7 @@ version = "26.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", ] [[package]] @@ -3992,10 +3866,10 @@ name = "frame-try-runtime" version = "0.34.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", "parity-scale-codec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -4560,7 +4434,7 @@ dependencies = [ "primitive-types", "scale-info", "serde", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -4571,8 +4445,8 @@ source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1 dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "hydra-dx-math", "hydradx-traits", "log", @@ -4603,9 +4477,9 @@ dependencies = [ "primitive-types", "primitives 6.0.2", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-builder", @@ -4617,12 +4491,12 @@ name = "hydradx-traits" version = "3.2.0" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -4959,9 +4833,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f08474e32172238f2827bd160c67871cdb2801430f65c3979184dc362e3ca118" +checksum = "685a7d121ee3f65ae4fddd72b25a04bb36b6af81bc0828f7d5434c0fe60fa3a2" dependencies = [ "libc", ] @@ -5304,7 +5178,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -6151,13 +6025,13 @@ dependencies = [ "parity-scale-codec", "sc-client-api", "sc-offchain", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", "sp-consensus", "sp-consensus-beefy", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-mmr-primitives", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", ] [[package]] @@ -6168,11 +6042,11 @@ dependencies = [ "jsonrpsee 0.20.3", "parity-scale-codec", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-mmr-primitives", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", ] [[package]] @@ -6736,16 +6610,16 @@ name = "orml-benchmarking" version = "0.8.0" source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", "log", "parity-scale-codec", "paste", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-io", + "sp-runtime", "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", @@ -6756,15 +6630,15 @@ name = "orml-tokens" version = "0.8.0" source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "orml-traits", "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -6773,7 +6647,7 @@ name = "orml-traits" version = "0.8.0" source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", "impl-trait-for-tuples", "num-traits", "orml-utilities", @@ -6781,9 +6655,9 @@ dependencies = [ "paste", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", ] @@ -6793,8 +6667,8 @@ name = "orml-unknown-tokens" version = "0.8.0" source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "orml-xcm-support", "parity-scale-codec", "scale-info", @@ -6808,13 +6682,13 @@ name = "orml-utilities" version = "0.8.0" source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -6823,13 +6697,13 @@ name = "orml-vesting" version = "0.8.0" source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", "serde", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -6838,8 +6712,8 @@ name = "orml-xcm" version = "0.8.0" source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "pallet-xcm", "parity-scale-codec", "scale-info", @@ -6852,10 +6726,10 @@ name = "orml-xcm-support" version = "0.8.0" source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", "orml-traits", "parity-scale-codec", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-executor", @@ -6866,8 +6740,8 @@ name = "orml-xtokens" version = "0.8.0" source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "orml-traits", "orml-xcm-support", @@ -6875,8 +6749,8 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-executor", @@ -6893,16 +6767,16 @@ name = "pallet-asset-conversion" version = "10.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -6911,13 +6785,13 @@ name = "pallet-asset-rate" version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -6925,9 +6799,9 @@ dependencies = [ name = "pallet-asset-registry" version = "2.3.3" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "hydradx-traits", "log", "orml-traits", @@ -6935,11 +6809,11 @@ dependencies = [ "primitive-types", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "substrate-wasm-builder", @@ -6951,9 +6825,9 @@ name = "pallet-asset-registry" version = "3.2.1" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "hydradx-traits", "log", "orml-traits", @@ -6961,10 +6835,10 @@ dependencies = [ "primitive-types", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-wasm-builder", ] @@ -6974,16 +6848,16 @@ name = "pallet-asset-tx-payment" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-transaction-payment", "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -6992,14 +6866,14 @@ name = "pallet-assets" version = "29.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7008,15 +6882,15 @@ name = "pallet-aura" version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", "sp-consensus-aura", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7025,14 +6899,14 @@ name = "pallet-authority-discovery" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "pallet-session", "parity-scale-codec", "scale-info", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", "sp-authority-discovery", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7041,12 +6915,12 @@ name = "pallet-authorship" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7055,22 +6929,22 @@ name = "pallet-babe" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "pallet-authorship", "pallet-session", "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", "sp-consensus-babe", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-session", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7081,17 +6955,17 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "aquamarine", "docify", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7102,13 +6976,13 @@ version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "docify", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7117,8 +6991,8 @@ name = "pallet-beefy" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "pallet-authorship", "pallet-session", @@ -7126,9 +7000,9 @@ dependencies = [ "scale-info", "serde", "sp-consensus-beefy", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-session", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7139,8 +7013,8 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "array-bytes 6.2.2", "binary-merkle-tree", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "pallet-beefy", "pallet-mmr", @@ -7148,12 +7022,12 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-consensus-beefy", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", + "sp-state-machine", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7162,9 +7036,9 @@ name = "pallet-bonds" version = "2.2.1" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "hydradx-traits", "log", "orml-traits", @@ -7173,9 +7047,9 @@ dependencies = [ "primitive-types", "primitives 6.0.2", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7184,16 +7058,16 @@ name = "pallet-bounties" version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "pallet-treasury", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7203,14 +7077,14 @@ version = "0.6.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bitvec", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7219,17 +7093,17 @@ name = "pallet-child-bounties" version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "pallet-bounties", "pallet-treasury", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7238,14 +7112,14 @@ name = "pallet-circuit-breaker" version = "1.1.21" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "hydradx-traits", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7254,16 +7128,16 @@ name = "pallet-collator-rewards" version = "1.0.6" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "orml-traits", "pallet-session", "parity-scale-codec", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-runtime", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-wasm-builder", ] @@ -7273,17 +7147,17 @@ name = "pallet-collator-selection" version = "9.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "pallet-authorship", "pallet-session", "parity-scale-codec", "rand", "scale-info", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7292,15 +7166,15 @@ name = "pallet-collective" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7310,14 +7184,14 @@ version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "assert_matches", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", "serde", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7326,15 +7200,15 @@ name = "pallet-currencies" version = "2.1.0" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "orml-traits", "orml-utilities", "parity-scale-codec", "scale-info", "serde", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7343,14 +7217,14 @@ name = "pallet-democracy" version = "4.1.0" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7359,16 +7233,16 @@ name = "pallet-democracy" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7377,16 +7251,16 @@ name = "pallet-duster" version = "3.2.4" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "hydradx-traits", "log", "orml-traits", "parity-scale-codec", "scale-info", "serde", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-wasm-builder", ] @@ -7396,14 +7270,14 @@ name = "pallet-dynamic-fees" version = "1.0.2" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "hydra-dx-math", "orml-traits", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7412,20 +7286,20 @@ name = "pallet-election-provider-multi-phase" version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "pallet-election-provider-support-benchmarking", "parity-scale-codec", "rand", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-io", "sp-npos-elections", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "strum 0.24.1", ] @@ -7435,12 +7309,12 @@ name = "pallet-election-provider-support-benchmarking" version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-election-provider-support", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system", "parity-scale-codec", "sp-npos-elections", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7449,17 +7323,17 @@ name = "pallet-elections-phragmen" version = "29.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", "sp-npos-elections", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7468,18 +7342,18 @@ name = "pallet-ema-oracle" version = "1.3.0" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "hydra-dx-math", "hydradx-traits", "log", "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7492,9 +7366,9 @@ dependencies = [ "evm", "fp-account", "fp-evm", - "frame-benchmarking 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "hash-db", "hex", "hex-literal 0.4.1", @@ -7503,10 +7377,10 @@ dependencies = [ "parity-scale-codec", "rlp", "scale-info", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] [[package]] @@ -7515,16 +7389,16 @@ version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "docify", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7533,21 +7407,21 @@ name = "pallet-grandpa" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "pallet-authorship", "pallet-session", "parity-scale-codec", "scale-info", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", "sp-consensus-grandpa", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-session", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7557,14 +7431,14 @@ version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "enumflags2", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7573,18 +7447,18 @@ name = "pallet-im-online" version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "pallet-authorship", "parity-scale-codec", "scale-info", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7593,15 +7467,15 @@ name = "pallet-indices" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", "sp-keyring", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7610,9 +7484,9 @@ name = "pallet-lbp" version = "4.7.4" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "hydra-dx-math", "hydradx-traits", "orml-tokens", @@ -7621,8 +7495,8 @@ dependencies = [ "primitive-types", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-wasm-builder", ] @@ -7632,15 +7506,15 @@ name = "pallet-liquidity-mining" version = "4.3.1" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "hydra-dx-math", "hydradx-traits", "orml-traits", "parity-scale-codec", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7648,9 +7522,9 @@ dependencies = [ name = "pallet-marketplace" version = "5.0.17" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-balances", "pallet-nft", "pallet-uniques", @@ -7659,10 +7533,10 @@ dependencies = [ "primitives 6.6.0", "scale-info", "serde", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7671,15 +7545,15 @@ name = "pallet-membership" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7689,18 +7563,18 @@ version = "31.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "environmental", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights", ] [[package]] @@ -7708,16 +7582,16 @@ name = "pallet-mmr" version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", "sp-mmr-primitives", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7726,14 +7600,14 @@ name = "pallet-multisig" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7742,17 +7616,17 @@ name = "pallet-nft" version = "7.1.2" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "hydradx-traits", "log", "pallet-uniques", "parity-scale-codec", "scale-info", "serde", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7761,14 +7635,14 @@ name = "pallet-nis" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7777,16 +7651,16 @@ name = "pallet-nomination-pools" version = "25.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7796,18 +7670,18 @@ name = "pallet-nomination-pools-benchmarking" version = "26.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "pallet-bags-list", "pallet-nomination-pools", "pallet-staking 28.0.0", "parity-scale-codec", "scale-info", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7818,7 +7692,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "pallet-nomination-pools", "parity-scale-codec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7827,15 +7701,15 @@ name = "pallet-offences" version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7844,10 +7718,10 @@ name = "pallet-offences-benchmarking" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "pallet-babe", "pallet-balances", @@ -7858,8 +7732,8 @@ dependencies = [ "pallet-staking 28.0.0", "parity-scale-codec", "scale-info", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7869,9 +7743,9 @@ version = "4.1.5" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ "bitflags 1.3.2", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "hydra-dx-math", "hydradx-traits", "impl-trait-for-tuples", @@ -7881,9 +7755,9 @@ dependencies = [ "parity-scale-codec", "primitive-types", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7892,8 +7766,8 @@ name = "pallet-omnipool-liquidity-mining" version = "2.1.4" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "hydra-dx-math", "hydradx-traits", "log", @@ -7906,9 +7780,9 @@ dependencies = [ "primitive-types", "primitives 6.0.2", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7917,15 +7791,15 @@ name = "pallet-preimage" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7934,13 +7808,13 @@ name = "pallet-proxy" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7949,17 +7823,17 @@ name = "pallet-ranked-collective" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "impl-trait-for-tuples", "log", "parity-scale-codec", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7968,13 +7842,13 @@ name = "pallet-recovery" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -7984,16 +7858,16 @@ version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "assert_matches", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8002,16 +7876,16 @@ name = "pallet-referrals" version = "1.2.3" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "hex-literal 0.3.4", "hydra-dx-math", "hydradx-traits", "orml-traits", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8022,11 +7896,11 @@ source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1 dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8035,13 +7909,13 @@ name = "pallet-root-testing" version = "4.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8050,15 +7924,15 @@ name = "pallet-route-executor" version = "2.2.1" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "hydradx-traits", "orml-traits", "pallet-balances", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8068,16 +7942,16 @@ version = "29.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "docify", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights", ] [[package]] @@ -8085,21 +7959,21 @@ name = "pallet-session" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "impl-trait-for-tuples", "log", "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-session", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking", + "sp-state-machine", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", ] [[package]] @@ -8107,14 +7981,14 @@ name = "pallet-session-benchmarking" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "pallet-session", "pallet-staking 28.0.0", "parity-scale-codec", "rand", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-session", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8124,16 +7998,16 @@ name = "pallet-society" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "rand_chacha 0.2.2", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8143,16 +8017,16 @@ version = "3.5.1" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ "bitflags 1.3.2", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "hydra-dx-math", "hydradx-traits", "orml-traits", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8161,17 +8035,17 @@ name = "pallet-staking" version = "3.0.0" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "hydra-dx-math", "log", "orml-traits", "pallet-democracy 4.1.0", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8180,10 +8054,10 @@ name = "pallet-staking" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "pallet-authorship", "pallet-session", @@ -8191,10 +8065,10 @@ dependencies = [ "rand_chacha 0.2.2", "scale-info", "serde", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", + "sp-io", + "sp-runtime", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8215,7 +8089,7 @@ version = "19.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "log", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", ] [[package]] @@ -8224,8 +8098,8 @@ version = "14.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-staking", ] [[package]] @@ -8233,15 +8107,15 @@ name = "pallet-state-trie-migration" version = "29.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8251,13 +8125,13 @@ version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "docify", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8267,15 +8141,15 @@ version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "docify", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", @@ -8286,17 +8160,17 @@ name = "pallet-tips" version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "pallet-treasury", "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8305,8 +8179,8 @@ name = "pallet-transaction-multi-payment" version = "9.5.0" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "hydra-dx-math", "hydradx-traits", "orml-traits", @@ -8316,9 +8190,9 @@ dependencies = [ "parity-scale-codec", "primitives 6.0.2", "scale-info", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8327,13 +8201,13 @@ name = "pallet-transaction-pause" version = "1.0.1" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8342,14 +8216,14 @@ name = "pallet-transaction-payment" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8361,12 +8235,12 @@ dependencies = [ "jsonrpsee 0.20.3", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-rpc", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-weights", ] [[package]] @@ -8376,9 +8250,9 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "pallet-transaction-payment", "parity-scale-codec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-runtime", + "sp-weights", ] [[package]] @@ -8387,16 +8261,16 @@ version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "docify", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "impl-trait-for-tuples", "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8405,13 +8279,13 @@ name = "pallet-uniques" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8420,14 +8294,14 @@ name = "pallet-utility" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8436,13 +8310,13 @@ name = "pallet-vesting" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8451,13 +8325,13 @@ name = "pallet-whitelist" version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8467,17 +8341,17 @@ version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bounded-collections", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "pallet-balances", "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-builder", @@ -8489,51 +8363,27 @@ name = "pallet-xcm-benchmarks" version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "log", "parity-scale-codec", "scale-info", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", ] -[[package]] -name = "pallet-xcm-rate-limiter" -version = "0.1.6" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" -dependencies = [ - "cumulus-pallet-xcmp-queue", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "hydra-dx-math", - "hydradx-traits", - "orml-traits", - "parity-scale-codec", - "polkadot-core-primitives", - "polkadot-parachain-primitives", - "scale-info", - "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "staging-xcm", -] - [[package]] name = "pallet-xyk" version = "6.3.4" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "hydra-dx-math", "hydradx-traits", "log", @@ -8545,10 +8395,10 @@ dependencies = [ "proptest", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-wasm-builder", ] @@ -8557,8 +8407,8 @@ dependencies = [ name = "pallet-xyk-liquidity-mining" version = "1.1.10" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "hydradx-traits", "lazy_static", "log", @@ -8572,10 +8422,10 @@ dependencies = [ "pretty_assertions", "primitives 6.6.0", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8583,9 +8433,9 @@ dependencies = [ name = "pallet-xyk-liquidity-mining-benchmarking" version = "1.0.16" dependencies = [ - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "hydradx-traits", "orml-tokens", "orml-traits", @@ -8600,10 +8450,10 @@ dependencies = [ "parity-scale-codec", "primitives 6.6.0", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -8614,8 +8464,8 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "cumulus-primitives-core", "cumulus-primitives-utility", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "log", "pallet-asset-tx-payment", "pallet-assets", @@ -8628,9 +8478,9 @@ dependencies = [ "polkadot-primitives", "scale-info", "sp-consensus-aura", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-parachain-info", "staging-xcm", @@ -8988,8 +8838,8 @@ dependencies = [ "polkadot-primitives", "rand", "schnellru", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-keystore", "thiserror", "tracing-gum", ] @@ -9036,8 +8886,8 @@ dependencies = [ "sc-storage-monitor", "sc-sysinfo", "sc-tracing", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", "sp-keyring", "sp-maybe-compressed-blob", "substrate-build-script-utils", @@ -9059,9 +8909,9 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-keystore", + "sp-runtime", "thiserror", "tokio-util", "tracing-gum", @@ -9074,8 +8924,8 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -9098,8 +8948,8 @@ dependencies = [ "polkadot-primitives", "sc-network", "schnellru", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", + "sp-keystore", "thiserror", "tracing-gum", ] @@ -9113,8 +8963,8 @@ dependencies = [ "polkadot-node-primitives", "polkadot-primitives", "reed-solomon-novelpoly", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-trie", "thiserror", ] @@ -9133,10 +8983,10 @@ dependencies = [ "rand_chacha 0.3.1", "sc-network", "sc-network-common", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", + "sp-core", + "sp-crypto-hashing", + "sp-keystore", "tracing-gum", ] @@ -9175,7 +9025,7 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-maybe-compressed-blob", "thiserror", "tracing-gum", @@ -9206,10 +9056,10 @@ dependencies = [ "sc-keystore", "schnellru", "schnorrkel 0.11.4", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", "sp-consensus", "sp-consensus-slots", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "thiserror", "tracing-gum", ] @@ -9251,7 +9101,7 @@ dependencies = [ "polkadot-primitives", "polkadot-statement-table", "schnellru", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore", "thiserror", "tracing-gum", ] @@ -9265,7 +9115,7 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore", "thiserror", "tracing-gum", "wasm-timer", @@ -9354,7 +9204,7 @@ dependencies = [ "polkadot-overseer", "polkadot-primitives", "sp-blockchain", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents", "thiserror", "tracing-gum", ] @@ -9417,7 +9267,7 @@ dependencies = [ "polkadot-primitives", "rand", "slotmap", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-maybe-compressed-blob", "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tempfile", @@ -9437,7 +9287,7 @@ dependencies = [ "polkadot-node-subsystem-util", "polkadot-overseer", "polkadot-primitives", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore", "thiserror", "tracing-gum", ] @@ -9460,10 +9310,10 @@ dependencies = [ "sc-executor-common", "sc-executor-wasmtime", "seccompiler", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-crypto-hashing", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing-gum", @@ -9497,7 +9347,7 @@ dependencies = [ "polkadot-node-primitives", "polkadot-primitives", "sc-network", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "thiserror", "tokio", ] @@ -9558,12 +9408,12 @@ dependencies = [ "polkadot-primitives", "schnorrkel 0.11.4", "serde", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", "sp-consensus-babe", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-keystore", "sp-maybe-compressed-blob", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "thiserror", "zstd 0.12.4", ] @@ -9597,11 +9447,11 @@ dependencies = [ "sc-network", "sc-transaction-pool-api", "smallvec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-authority-discovery", "sp-blockchain", "sp-consensus-babe", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "substrate-prometheus-endpoint", "thiserror", ] @@ -9634,9 +9484,9 @@ dependencies = [ "rand", "sc-client-api", "schnellru", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", + "sp-core", + "sp-keystore", "thiserror", "tracing-gum", ] @@ -9657,8 +9507,8 @@ dependencies = [ "polkadot-node-subsystem-types", "polkadot-primitives", "sc-client-api", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-core", "tikv-jemalloc-ctl", "tracing-gum", ] @@ -9674,10 +9524,10 @@ dependencies = [ "polkadot-core-primitives", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights", ] [[package]] @@ -9693,17 +9543,17 @@ dependencies = [ "polkadot-parachain-primitives", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", "sp-authority-discovery", "sp-consensus-slots", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -9729,13 +9579,13 @@ dependencies = [ "sc-rpc-spec-v2", "sc-sync-state-rpc", "sc-transaction-pool-api", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-babe", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore", + "sp-runtime", "substrate-frame-rpc-system", "substrate-state-trie-migration-rpc", ] @@ -9746,10 +9596,10 @@ version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bitvec", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-election-provider-support", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "impl-trait-for-tuples", "libsecp256k1", "log", @@ -9777,14 +9627,14 @@ dependencies = [ "serde", "serde_derive", "slot-range-helper", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-core", + "sp-inherents", + "sp-io", "sp-npos-elections", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-session", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-builder", @@ -9798,7 +9648,7 @@ version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "bs58 0.5.1", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "parity-scale-codec", "polkadot-primitives", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", @@ -9813,9 +9663,9 @@ dependencies = [ "bitflags 1.3.2", "bitvec", "derive_more", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", + "frame-system", "impl-trait-for-tuples", "log", "pallet-authority-discovery", @@ -9838,16 +9688,16 @@ dependencies = [ "rustc-hex", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keystore", + "sp-runtime", "sp-session", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", "staging-xcm-executor", @@ -9860,10 +9710,10 @@ version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-benchmarking-cli", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "frame-system-rpc-runtime-api", "futures", "hex-literal 0.4.1", @@ -9942,7 +9792,7 @@ dependencies = [ "schnellru", "serde", "serde_json", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-authority-discovery", "sp-block-builder", "sp-blockchain", @@ -9950,21 +9800,21 @@ dependencies = [ "sp-consensus-babe", "sp-consensus-beefy", "sp-consensus-grandpa", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", + "sp-io", "sp-keyring", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore", "sp-mmr-primitives", "sp-offchain", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-session", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", "sp-transaction-pool", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version", + "sp-weights", "substrate-prometheus-endpoint", "thiserror", "tracing-gum", @@ -9988,8 +9838,8 @@ dependencies = [ "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore", + "sp-staking", "thiserror", "tracing-gum", ] @@ -10001,7 +9851,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "parity-scale-codec", "polkadot-primitives", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "tracing-gum", ] @@ -10203,13 +10053,13 @@ name = "primitives" version = "6.0.2" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", "hex-literal 0.3.4", "parity-scale-codec", "polkadot-primitives", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "static_assertions", ] @@ -10218,15 +10068,15 @@ dependencies = [ name = "primitives" version = "6.6.0" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", "parity-scale-codec", "polkadot-primitives", "primitive-types", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "static_assertions", "substrate-wasm-builder", @@ -10880,10 +10730,10 @@ version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "binary-merkle-tree", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-executive", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", @@ -10944,25 +10794,25 @@ dependencies = [ "serde", "serde_derive", "smallvec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-babe", "sp-consensus-beefy", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-genesis-builder 0.7.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-genesis-builder", + "sp-inherents", + "sp-io", "sp-mmr-primitives", "sp-offchain", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-session", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -10975,13 +10825,13 @@ name = "rococo-runtime-constants" version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", "polkadot-primitives", "polkadot-runtime-common", "smallvec", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", + "sp-weights", "staging-xcm", "staging-xcm-builder", ] @@ -11043,10 +10893,10 @@ dependencies = [ "cumulus-primitives-timestamp", "cumulus-primitives-utility", "cumulus-test-relay-sproof-builder", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-executive", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "hex-literal 0.4.1", @@ -11094,25 +10944,25 @@ dependencies = [ "pretty_assertions", "primitives 6.6.0", "sc-consensus-grandpa", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-aura", "sp-consensus-babe", "sp-consensus-beefy", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents", + "sp-io", "sp-offchain", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-session", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", + "sp-version", "staging-parachain-info", "staging-xcm", "staging-xcm-builder", @@ -11323,7 +11173,7 @@ version = "23.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "log", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] @@ -11347,12 +11197,12 @@ dependencies = [ "rand", "sc-client-api", "sc-network", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-authority-discovery", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-keystore", + "sp-runtime", "substrate-prometheus-endpoint", "thiserror", ] @@ -11370,12 +11220,12 @@ dependencies = [ "sc-proposer-metrics", "sc-telemetry", "sc-transaction-pool-api", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", "sp-consensus", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", + "sp-runtime", "substrate-prometheus-endpoint", ] @@ -11385,13 +11235,13 @@ version = "0.33.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "parity-scale-codec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-block-builder", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-trie", ] [[package]] @@ -11412,12 +11262,12 @@ dependencies = [ "serde", "serde_json", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-genesis-builder 0.7.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-crypto-hashing", + "sp-genesis-builder", + "sp-io", + "sp-runtime", + "sp-state-machine", ] [[package]] @@ -11462,12 +11312,12 @@ dependencies = [ "serde", "serde_json", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-keyring", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-panic-handler 13.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore", + "sp-panic-handler", + "sp-runtime", + "sp-version", "thiserror", "tokio", ] @@ -11485,17 +11335,17 @@ dependencies = [ "sc-executor", "sc-transaction-pool-api", "sc-utils", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", "sp-consensus", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-database", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-state-machine", "sp-statement-store", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", "substrate-prometheus-endpoint", ] @@ -11516,13 +11366,13 @@ dependencies = [ "sc-client-api", "sc-state-db", "schnellru", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-database", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-state-machine", + "sp-trie", ] [[package]] @@ -11540,12 +11390,12 @@ dependencies = [ "sc-client-api", "sc-utils", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", "sp-consensus", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", + "sp-state-machine", "substrate-prometheus-endpoint", "thiserror", ] @@ -11564,17 +11414,17 @@ dependencies = [ "sc-consensus", "sc-consensus-slots", "sc-telemetry", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-aura", "sp-consensus-slots", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", + "sp-keystore", + "sp-runtime", "substrate-prometheus-endpoint", "thiserror", ] @@ -11599,18 +11449,18 @@ dependencies = [ "sc-consensus-slots", "sc-telemetry", "sc-transaction-pool-api", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", "sp-block-builder", "sp-blockchain", "sp-consensus", "sp-consensus-babe", "sp-consensus-slots", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-crypto-hashing", + "sp-inherents", + "sp-keystore", + "sp-runtime", "substrate-prometheus-endpoint", "thiserror", ] @@ -11626,14 +11476,14 @@ dependencies = [ "sc-consensus-epochs", "sc-rpc-api", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", "sp-blockchain", "sp-consensus", "sp-consensus-babe", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-keystore", + "sp-runtime", "thiserror", ] @@ -11656,17 +11506,17 @@ dependencies = [ "sc-network-gossip", "sc-network-sync", "sc-utils", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", "sp-blockchain", "sp-consensus", "sp-consensus-beefy", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-crypto-hashing", + "sp-keystore", "sp-mmr-primitives", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "substrate-prometheus-endpoint", "thiserror", "tokio", @@ -11687,8 +11537,8 @@ dependencies = [ "sc-rpc", "serde", "sp-consensus-beefy", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "thiserror", ] @@ -11702,7 +11552,7 @@ dependencies = [ "sc-client-api", "sc-consensus", "sp-blockchain", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", ] [[package]] @@ -11734,16 +11584,16 @@ dependencies = [ "sc-transaction-pool-api", "sc-utils", "serde_json", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", "sp-blockchain", "sp-consensus", "sp-consensus-grandpa", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-crypto-hashing", + "sp-keystore", + "sp-runtime", "substrate-prometheus-endpoint", "thiserror", ] @@ -11763,8 +11613,8 @@ dependencies = [ "sc-rpc", "serde", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "thiserror", ] @@ -11781,14 +11631,14 @@ dependencies = [ "sc-client-api", "sc-consensus", "sc-telemetry", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", "sp-blockchain", "sp-consensus", "sp-consensus-slots", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", ] [[package]] @@ -11801,14 +11651,14 @@ dependencies = [ "sc-executor-common", "sc-executor-wasmtime", "schnellru", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-core", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-panic-handler 13.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-io", + "sp-panic-handler", "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", + "sp-version", "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "tracing", ] @@ -11857,7 +11707,7 @@ dependencies = [ "sc-network-common", "sc-network-sync", "sp-blockchain", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", ] [[package]] @@ -11868,9 +11718,9 @@ dependencies = [ "array-bytes 6.2.2", "parking_lot 0.12.1", "serde_json", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", + "sp-core", + "sp-keystore", "thiserror", ] @@ -11894,12 +11744,12 @@ dependencies = [ "sc-client-api", "sc-network", "sc-transaction-pool-api", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-consensus", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-keystore", "sp-mixnet", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "thiserror", ] @@ -11933,10 +11783,10 @@ dependencies = [ "serde", "serde_json", "smallvec", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "substrate-prometheus-endpoint", "thiserror", "tokio", @@ -11961,7 +11811,7 @@ dependencies = [ "sc-client-api", "sc-network", "sp-blockchain", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "thiserror", "unsigned-varint", ] @@ -11980,7 +11830,7 @@ dependencies = [ "sc-consensus", "sp-consensus", "sp-consensus-grandpa", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", ] [[package]] @@ -11997,7 +11847,7 @@ dependencies = [ "sc-network-common", "sc-network-sync", "schnellru", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "substrate-prometheus-endpoint", "tracing", ] @@ -12018,8 +11868,8 @@ dependencies = [ "sc-client-api", "sc-network", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "thiserror", ] @@ -12047,12 +11897,12 @@ dependencies = [ "sc-utils", "schnellru", "smallvec", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", "sp-blockchain", "sp-consensus", "sp-consensus-grandpa", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "substrate-prometheus-endpoint", "thiserror", "tokio", @@ -12074,7 +11924,7 @@ dependencies = [ "sc-network-sync", "sc-utils", "sp-consensus", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "substrate-prometheus-endpoint", ] @@ -12102,12 +11952,12 @@ dependencies = [ "sc-network-common", "sc-transaction-pool-api", "sc-utils", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-core", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore", "sp-offchain", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "threadpool", "tracing", ] @@ -12140,16 +11990,16 @@ dependencies = [ "sc-transaction-pool-api", "sc-utils", "serde_json", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-keystore", "sp-offchain", "sp-rpc", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-session", "sp-statement-store", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version", "tokio", ] @@ -12166,10 +12016,10 @@ dependencies = [ "scale-info", "serde", "serde_json", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-rpc", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-version", "thiserror", ] @@ -12207,12 +12057,12 @@ dependencies = [ "sc-transaction-pool-api", "sc-utils", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-rpc", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-version", "thiserror", "tokio", "tokio-stream", @@ -12258,20 +12108,20 @@ dependencies = [ "sc-utils", "serde", "serde_json", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", "sp-consensus", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore", + "sp-runtime", "sp-session", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", "sp-transaction-storage-proof", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", + "sp-version", "static_init", "substrate-prometheus-endpoint", "tempfile", @@ -12289,7 +12139,7 @@ dependencies = [ "log", "parity-scale-codec", "parking_lot 0.12.1", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", ] [[package]] @@ -12300,7 +12150,7 @@ dependencies = [ "clap", "fs4", "log", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "thiserror", "tokio", ] @@ -12320,7 +12170,7 @@ dependencies = [ "serde", "serde_json", "sp-blockchain", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "thiserror", ] @@ -12339,9 +12189,9 @@ dependencies = [ "sc-telemetry", "serde", "serde_json", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-crypto-hashing", + "sp-io", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -12382,11 +12232,11 @@ dependencies = [ "sc-client-api", "sc-tracing-proc-macro", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-rpc", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "tracing", @@ -12421,11 +12271,11 @@ dependencies = [ "sc-transaction-pool-api", "sc-utils", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-crypto-hashing", + "sp-runtime", "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", "substrate-prometheus-endpoint", @@ -12443,8 +12293,8 @@ dependencies = [ "parity-scale-codec", "serde", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "thiserror", ] @@ -12460,7 +12310,7 @@ dependencies = [ "log", "parking_lot 0.12.1", "prometheus", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", ] [[package]] @@ -12851,7 +12701,7 @@ dependencies = [ "enumn", "parity-scale-codec", "paste", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -13037,27 +12887,6 @@ dependencies = [ "sha-1", ] -[[package]] -name = "sp-api" -version = "26.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "hash-db", - "log", - "parity-scale-codec", - "scale-info", - "sp-api-proc-macro 15.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-metadata-ir 0.6.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "thiserror", -] - [[package]] name = "sp-api" version = "26.0.0" @@ -13067,32 +12896,18 @@ dependencies = [ "log", "parity-scale-codec", "scale-info", - "sp-api-proc-macro 15.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api-proc-macro", + "sp-core", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-metadata-ir 0.6.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-metadata-ir", + "sp-runtime", + "sp-state-machine", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", + "sp-version", "thiserror", ] -[[package]] -name = "sp-api-proc-macro" -version = "15.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "Inflector", - "blake2 0.10.6", - "expander 2.1.0", - "proc-macro-crate 3.1.0", - "proc-macro2", - "quote", - "syn 2.0.58", -] - [[package]] name = "sp-api-proc-macro" version = "15.0.0" @@ -13107,19 +12922,6 @@ dependencies = [ "syn 2.0.58", ] -[[package]] -name = "sp-application-crypto" -version = "30.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", -] - [[package]] name = "sp-application-crypto" version = "30.0.0" @@ -13128,25 +12930,11 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-io", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] -[[package]] -name = "sp-arithmetic" -version = "23.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "integer-sqrt", - "num-traits", - "parity-scale-codec", - "scale-info", - "serde", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "static_assertions", -] - [[package]] name = "sp-arithmetic" version = "23.0.0" @@ -13186,9 +12974,9 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "parity-scale-codec", "scale-info", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -13197,9 +12985,9 @@ name = "sp-block-builder" version = "26.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-inherents", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -13213,11 +13001,11 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", "schnellru", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-consensus", "sp-database", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-state-machine", "thiserror", ] @@ -13229,10 +13017,10 @@ dependencies = [ "async-trait", "futures", "log", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-state-machine", "thiserror", ] @@ -13244,11 +13032,11 @@ dependencies = [ "async-trait", "parity-scale-codec", "scale-info", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", "sp-consensus-slots", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", ] @@ -13262,12 +13050,12 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", "sp-consensus-slots", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-timestamp", ] @@ -13281,13 +13069,13 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-crypto-hashing", + "sp-io", "sp-mmr-primitives", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "strum 0.24.1", ] @@ -13302,11 +13090,11 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-keystore", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -13322,52 +13110,6 @@ dependencies = [ "sp-timestamp", ] -[[package]] -name = "sp-core" -version = "28.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "array-bytes 6.2.2", - "bandersnatch_vrfs", - "bip39", - "bitflags 1.3.2", - "blake2 0.10.6", - "bounded-collections", - "bs58 0.5.1", - "dyn-clonable", - "ed25519-zebra 3.1.0", - "futures", - "hash-db", - "hash256-std-hasher", - "impl-serde", - "itertools 0.10.5", - "libsecp256k1", - "log", - "merlin", - "parity-scale-codec", - "parking_lot 0.12.1", - "paste", - "primitive-types", - "rand", - "scale-info", - "schnorrkel 0.11.4", - "secp256k1", - "secrecy", - "serde", - "sp-crypto-hashing 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-debug-derive 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime-interface 24.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-storage 19.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "ss58-registry", - "substrate-bip39", - "thiserror", - "tracing", - "w3f-bls", - "zeroize", -] - [[package]] name = "sp-core" version = "28.0.0" @@ -13400,7 +13142,7 @@ dependencies = [ "secp256k1", "secrecy", "serde", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing", "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", @@ -13417,7 +13159,7 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -13434,19 +13176,6 @@ dependencies = [ "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk)", ] -[[package]] -name = "sp-crypto-hashing" -version = "0.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "blake2b_simd", - "byteorder", - "digest 0.10.7", - "sha2 0.10.8", - "sha3", - "twox-hash", -] - [[package]] name = "sp-crypto-hashing" version = "0.0.0" @@ -13460,23 +13189,13 @@ dependencies = [ "twox-hash", ] -[[package]] -name = "sp-crypto-hashing-proc-macro" -version = "0.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "quote", - "sp-crypto-hashing 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "syn 2.0.58", -] - [[package]] name = "sp-crypto-hashing-proc-macro" version = "0.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "quote", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing", "syn 2.0.58", ] @@ -13489,16 +13208,6 @@ dependencies = [ "parking_lot 0.12.1", ] -[[package]] -name = "sp-debug-derive" -version = "14.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.58", -] - [[package]] name = "sp-debug-derive" version = "14.0.0" @@ -13512,24 +13221,13 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" dependencies = [ "proc-macro2", "quote", "syn 2.0.58", ] -[[package]] -name = "sp-externalities" -version = "0.25.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "environmental", - "parity-scale-codec", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-storage 19.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", -] - [[package]] name = "sp-externalities" version = "0.25.0" @@ -13544,49 +13242,24 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" dependencies = [ "environmental", "parity-scale-codec", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk)", ] -[[package]] -name = "sp-genesis-builder" -version = "0.7.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "serde_json", - "sp-api 26.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", -] - [[package]] name = "sp-genesis-builder" version = "0.7.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "serde_json", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] -[[package]] -name = "sp-inherents" -version = "26.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "async-trait", - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "thiserror", -] - [[package]] name = "sp-inherents" version = "26.0.0" @@ -13596,36 +13269,11 @@ dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] -[[package]] -name = "sp-io" -version = "30.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "bytes", - "ed25519-dalek", - "libsecp256k1", - "log", - "parity-scale-codec", - "rustversion", - "secp256k1", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime-interface 24.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-tracing 16.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "tracing", - "tracing-core", -] - [[package]] name = "sp-io" version = "30.0.0" @@ -13638,15 +13286,15 @@ dependencies = [ "parity-scale-codec", "rustversion", "secp256k1", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-crypto-hashing", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-keystore", "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-state-machine", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", "tracing", "tracing-core", ] @@ -13656,23 +13304,11 @@ name = "sp-keyring" version = "31.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "strum 0.24.1", ] -[[package]] -name = "sp-keystore" -version = "0.34.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "parity-scale-codec", - "parking_lot 0.12.1", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "thiserror", -] - [[package]] name = "sp-keystore" version = "0.34.0" @@ -13680,7 +13316,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] @@ -13694,17 +13330,6 @@ dependencies = [ "zstd 0.12.4", ] -[[package]] -name = "sp-metadata-ir" -version = "0.6.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "frame-metadata", - "parity-scale-codec", - "scale-info", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", -] - [[package]] name = "sp-metadata-ir" version = "0.6.0" @@ -13723,8 +13348,8 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "parity-scale-codec", "scale-info", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -13738,10 +13363,10 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-core", "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] @@ -13754,9 +13379,9 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -13765,19 +13390,9 @@ name = "sp-offchain" version = "26.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", -] - -[[package]] -name = "sp-panic-handler" -version = "13.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "backtrace", - "lazy_static", - "regex", + "sp-api", + "sp-core", + "sp-runtime", ] [[package]] @@ -13797,31 +13412,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "rustc-hash", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", -] - -[[package]] -name = "sp-runtime" -version = "31.0.1" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "docify", - "either", - "hash256-std-hasher", - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "paste", - "rand", - "scale-info", - "serde", - "simple-mermaid", - "sp-application-crypto 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", + "sp-core", ] [[package]] @@ -13840,30 +13431,12 @@ dependencies = [ "scale-info", "serde", "simple-mermaid", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-io", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", -] - -[[package]] -name = "sp-runtime-interface" -version = "24.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "bytes", - "impl-trait-for-tuples", - "parity-scale-codec", - "primitive-types", - "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-storage 19.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-tracing 16.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-wasm-interface 20.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "static_assertions", + "sp-weights", ] [[package]] @@ -13887,7 +13460,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -13903,19 +13476,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "sp-runtime-interface-proc-macro" -version = "17.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "Inflector", - "expander 2.1.0", - "proc-macro-crate 3.1.0", - "proc-macro2", - "quote", - "syn 2.0.58", -] - [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" @@ -13932,7 +13492,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" dependencies = [ "Inflector", "expander 2.1.0", @@ -13949,28 +13509,14 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "parity-scale-codec", "scale-info", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-core", + "sp-keystore", + "sp-runtime", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] -[[package]] -name = "sp-staking" -version = "26.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", -] - [[package]] name = "sp-staking" version = "26.0.0" @@ -13980,32 +13526,11 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] -[[package]] -name = "sp-state-machine" -version = "0.35.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "hash-db", - "log", - "parity-scale-codec", - "parking_lot 0.12.1", - "rand", - "smallvec", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-panic-handler 13.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "thiserror", - "tracing", - "trie-db", -] - [[package]] name = "sp-state-machine" version = "0.35.0" @@ -14017,11 +13542,11 @@ dependencies = [ "parking_lot 0.12.1", "rand", "smallvec", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-panic-handler 13.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-panic-handler", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-trie", "thiserror", "tracing", "trie-db", @@ -14040,23 +13565,18 @@ dependencies = [ "rand", "scale-info", "sha2 0.10.8", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-crypto-hashing", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", "x25519-dalek 2.0.1", ] -[[package]] -name = "sp-std" -version = "14.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" - [[package]] name = "sp-std" version = "14.0.0" @@ -14065,20 +13585,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" - -[[package]] -name = "sp-storage" -version = "19.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "ref-cast", - "serde", - "sp-debug-derive 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", -] +source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" [[package]] name = "sp-storage" @@ -14096,7 +13603,7 @@ dependencies = [ [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" dependencies = [ "impl-serde", "parity-scale-codec", @@ -14112,24 +13619,12 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "async-trait", "parity-scale-codec", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", ] -[[package]] -name = "sp-tracing" -version = "16.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "parity-scale-codec", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "tracing", - "tracing-core", - "tracing-subscriber 0.2.25", -] - [[package]] name = "sp-tracing" version = "16.0.0" @@ -14145,7 +13640,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" dependencies = [ "parity-scale-codec", "tracing", @@ -14158,8 +13653,8 @@ name = "sp-transaction-pool" version = "26.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-runtime", ] [[package]] @@ -14170,35 +13665,11 @@ dependencies = [ "async-trait", "parity-scale-codec", "scale-info", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-inherents", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", -] - -[[package]] -name = "sp-trie" -version = "29.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "ahash 0.8.11", - "hash-db", - "lazy_static", - "memory-db", - "nohash-hasher", - "parity-scale-codec", - "parking_lot 0.12.1", - "rand", - "scale-info", - "schnellru", - "sp-core 28.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-externalities 0.25.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "thiserror", - "tracing", - "trie-db", - "trie-root", + "sp-trie", ] [[package]] @@ -14216,7 +13687,7 @@ dependencies = [ "rand", "scale-info", "schnellru", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "thiserror", @@ -14225,23 +13696,6 @@ dependencies = [ "trie-root", ] -[[package]] -name = "sp-version" -version = "29.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "parity-wasm", - "scale-info", - "serde", - "sp-crypto-hashing-proc-macro 0.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-version-proc-macro 13.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "thiserror", -] - [[package]] name = "sp-version" version = "29.0.0" @@ -14252,24 +13706,13 @@ dependencies = [ "parity-wasm", "scale-info", "serde", - "sp-crypto-hashing-proc-macro 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-crypto-hashing-proc-macro", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-version-proc-macro 13.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version-proc-macro", "thiserror", ] -[[package]] -name = "sp-version-proc-macro" -version = "13.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "parity-scale-codec", - "proc-macro2", - "quote", - "syn 2.0.58", -] - [[package]] name = "sp-version-proc-macro" version = "13.0.0" @@ -14281,19 +13724,6 @@ dependencies = [ "syn 2.0.58", ] -[[package]] -name = "sp-wasm-interface" -version = "20.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "anyhow", - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "wasmtime", -] - [[package]] name = "sp-wasm-interface" version = "20.0.0" @@ -14310,28 +13740,13 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#39b1f50f1c251def87c1625d68567ed252dc6272" +source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", ] -[[package]] -name = "sp-weights" -version = "27.0.0" -source = "git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2#2073906e7994ca069f7f68120b05474f7565b8d2" -dependencies = [ - "bounded-collections", - "parity-scale-codec", - "scale-info", - "serde", - "smallvec", - "sp-arithmetic 23.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-debug-derive 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", - "sp-std 14.0.0 (git+https://github.com/moonbeam-foundation/polkadot-sdk?branch=moonbeam-polkadot-v1.7.2)", -] - [[package]] name = "sp-weights" version = "27.0.0" @@ -14342,7 +13757,7 @@ dependencies = [ "scale-info", "serde", "smallvec", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -14407,11 +13822,11 @@ version = "0.7.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "cumulus-primitives-core", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "parity-scale-codec", "scale-info", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", ] @@ -14429,7 +13844,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights", "xcm-procedural", ] @@ -14438,19 +13853,19 @@ name = "staging-xcm-builder" version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "impl-trait-for-tuples", "log", "pallet-transaction-payment", "parity-scale-codec", "polkadot-parachain-primitives", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights", "staging-xcm", "staging-xcm-executor", ] @@ -14461,18 +13876,18 @@ version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "environmental", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", + "frame-support", "impl-trait-for-tuples", "log", "parity-scale-codec", "scale-info", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-weights", "staging-xcm", ] @@ -14600,11 +14015,11 @@ dependencies = [ "parity-scale-codec", "sc-rpc-api", "sc-transaction-pool-api", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-block-builder", "sp-blockchain", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", ] [[package]] @@ -14629,7 +14044,7 @@ dependencies = [ "log", "sc-rpc-api", "serde", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", ] [[package]] @@ -14642,10 +14057,10 @@ dependencies = [ "sc-client-api", "sc-rpc-api", "serde", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-trie 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", + "sp-state-machine", + "sp-trie", "trie-db", ] @@ -14827,7 +14242,7 @@ name = "test-utils" version = "1.1.1" source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" dependencies = [ - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-system", "pretty_assertions", ] @@ -15426,22 +14841,22 @@ dependencies = [ "sc-executor", "serde", "serde_json", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", "sp-consensus-aura", "sp-consensus-babe", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-keystore 0.34.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-inherents", + "sp-io", + "sp-keystore", "sp-rpc", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-state-machine 0.35.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", + "sp-state-machine", "sp-timestamp", "sp-transaction-storage-proof", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version", + "sp-weights", "substrate-rpc-client", "zstd 0.12.4", ] @@ -16092,11 +15507,11 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "binary-merkle-tree", "bitvec", - "frame-benchmarking 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-benchmarking", "frame-election-provider-support", "frame-executive", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", @@ -16163,27 +15578,27 @@ dependencies = [ "serde", "serde_derive", "smallvec", - "sp-api 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-application-crypto 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", "sp-authority-discovery", "sp-block-builder", "sp-consensus-babe", "sp-consensus-beefy", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-genesis-builder 0.7.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-inherents 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-genesis-builder", + "sp-inherents", + "sp-io", "sp-mmr-primitives", "sp-npos-elections", "sp-offchain", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-runtime", "sp-session", - "sp-staking 26.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-staking", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-transaction-pool", - "sp-version 29.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-version", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -16196,13 +15611,13 @@ name = "westend-runtime-constants" version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", "polkadot-primitives", "polkadot-runtime-common", "smallvec", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-weights 27.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-core", + "sp-runtime", + "sp-weights", "staging-xcm", "staging-xcm-builder", ] @@ -16291,7 +15706,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -16318,7 +15733,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -16353,17 +15768,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.4", - "windows_aarch64_msvc 0.52.4", - "windows_i686_gnu 0.52.4", - "windows_i686_msvc 0.52.4", - "windows_x86_64_gnu 0.52.4", - "windows_x86_64_gnullvm 0.52.4", - "windows_x86_64_msvc 0.52.4", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -16380,9 +15796,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -16398,9 +15814,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -16416,9 +15832,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.4" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -16434,9 +15856,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -16452,9 +15874,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -16470,9 +15892,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -16488,9 +15910,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" @@ -16580,8 +16002,8 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-test-relay-sproof-builder", - "frame-support 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "frame-system 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "frame-support", + "frame-system", "impl-trait-for-tuples", "lazy_static", "log", @@ -16593,11 +16015,11 @@ dependencies = [ "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-runtime-parachains", - "sp-arithmetic 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-core 28.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-crypto-hashing 0.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-io 30.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "sp-runtime 31.0.1 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "sp-arithmetic", + "sp-core", + "sp-crypto-hashing", + "sp-io", + "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "staging-xcm", @@ -16731,3 +16153,18 @@ dependencies = [ "cc", "pkg-config", ] + +[[patch.unused]] +name = "sp-core-hashing" +version = "15.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" + +[[patch.unused]] +name = "sp-crypto-ec-utils" +version = "0.10.0" +source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" + +[[patch.unused]] +name = "orml-currencies" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/Cargo.toml b/Cargo.toml index 596b2653afa..99e613617dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,15 +13,19 @@ members = [ 'integration-tests', ] +resolver = '2' + [workspace.dependencies] primitive-types = { version = "0.12.0", default-features = false } log = "0.4.20" -pallet-marketplace = { path = "pallets/marketplace"} -pallet-xyk = { path = "pallets/xyk"} -pallet-asset-registry = { path = "pallets/asset-registry"} -pallet-xyk-liquidity-mining = { path = "pallets/xyk-liquidity-mining"} -pallet-xyk-liquidity-mining-benchmarking = { path = "pallets/xyk-liquidity-mining/benchmarking"} +basilisk-runtime = { path = "runtime/basilisk", default-features = false } + +pallet-marketplace = { path = "pallets/marketplace", default-features = false} +pallet-xyk = { path = "pallets/xyk", default-features = false} +pallet-asset-registry = { path = "pallets/asset-registry", default-features = false} +pallet-xyk-liquidity-mining = { path = "pallets/xyk-liquidity-mining", default-features = false} +pallet-xyk-liquidity-mining-benchmarking = { path = "pallets/xyk-liquidity-mining/benchmarking", default-features = false} hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } hydradx-traits = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } @@ -38,7 +42,6 @@ pallet-ema-oracle = { git = "https://github.com/galacticcouncil/HydraDX-node", b pallet-duster = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } pallet-collator-rewards = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } test-utils = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } -pallet-xcm-rate-limiter = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } pallet-lbp = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } hydra-dx-build-script-utils = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2" } @@ -92,6 +95,8 @@ pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch =" pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } pallet-vesting = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +pallet-message-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2", default-features = false } + sc-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } sc-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } @@ -164,6 +169,10 @@ sp-trie = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release sp-version = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } sp-wasm-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +sp-crypto-hashing= { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2", default-features = false} +sp-crypto-ec-utils= { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2", default-features = false} +sp-core-hashing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2", default-features = false} + substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } @@ -196,6 +205,7 @@ polkadot-xcm = { package = "staging-xcm", git = "https://github.com/paritytech/p xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } xcm-emulator = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2", default-features = false } pallet-collator-selection = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } @@ -232,3 +242,171 @@ orml-unknown-tokens = { git = "https://github.com/galacticcouncil/open-runtime-m orml-xcm = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } orml-xcm-support = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } orml-xtokens = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2", default-features = false } + +[patch."https://github.com/moonbeam-foundation/open-runtime-module-library"] +# ORML dependencies +orml-benchmarking = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} +orml-currencies = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} +orml-tokens = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} +orml-traits = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} +orml-utilities = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} +orml-vesting = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} +orml-unknown-tokens = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} +orml-xcm = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} +orml-xcm-support = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} +orml-xtokens = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} + +[patch."https://github.com/moonbeam-foundation/polkadot-sdk"] +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +frame-remote-externalities = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-arithmetic = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-consensus = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-consensus-babe = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-externalities = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-inherents = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-npos-elections = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-offchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-runtime-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-runtime-interface-proc-macro = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-wasm-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-panic-handler = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-database = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-session = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-staking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-storage = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-tracing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-trie = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-version = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-client-db = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-network = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-network-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-rpc-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-tracing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sc-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} +sp-crypto-hashing= { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} +sp-crypto-ec-utils= { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} +sp-core-hashing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} + +# Substrate Pallets +pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-authorship = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-collective = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-elections-phragmen = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-identity = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-scheduler = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-tips = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-treasury = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-im-online = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-message-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} + +substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +substrate-rpc-client = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } + +# Cumulus dependencies +cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-client-consensus-proposer = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-client-network = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-primitives-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +pallet-collator-selection = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +staging-parachain-info = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +xcm-emulator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} + +# Polkadot dependencies +pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-parachain = { package = "polkadot-parachain-primitives", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} +polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +#polkadot-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } + +#kusama-runtime = { package = "staging-kusama-runtime", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-node-network-protocol = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-node-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-node-subsystem = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-node-subsystem-util = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-overseer = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} +polkadot-statement-table = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +rococo-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +westend-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } + +cumulus-client-pov-recovery = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-pallet-parachain-system-proc-macro = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } +cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index dc1b0e25530..3c4214742e3 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -21,7 +21,7 @@ pallet-duster = { workspace = true } pallet-xyk = { workspace = true } pallet-lbp = { workspace = true } -pallet-marketplace = { path = '../pallets/marketplace', default-features = false } +pallet-marketplace = { workspace = true} primitives = { default-features = false, path = "../primitives" } diff --git a/runtime/basilisk/Cargo.toml b/runtime/basilisk/Cargo.toml index 7c0b50933cb..c2b07628f6e 100644 --- a/runtime/basilisk/Cargo.toml +++ b/runtime/basilisk/Cargo.toml @@ -50,7 +50,6 @@ warehouse-liquidity-mining = { workspace = true } pallet-ema-oracle = { workspace = true } pallet-duster = { workspace = true } pallet-collator-rewards = { workspace = true } -pallet-xcm-rate-limiter = { workspace = true } pallet-xyk = { workspace = true } pallet-lbp = { workspace = true } @@ -81,6 +80,7 @@ cumulus-primitives-utility = { workspace = true } cumulus-primitives-parachain-inherent = { workspace = true } cumulus-primitives-timestamp = { workspace = true } staging-parachain-info = { workspace = true } +parachains-common = { workspace = true } # Polkadot dependencies polkadot-parachain = { workspace = true } @@ -110,6 +110,8 @@ pallet-transaction-payment = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } pallet-uniques = { workspace = true } pallet-utility = { workspace = true } +pallet-message-queue = { workspace = true } + sp-api = { workspace = true } sp-block-builder = { workspace = true } sp-consensus-aura = { workspace = true } @@ -160,9 +162,9 @@ runtime-benchmarks = [ "pallet-ema-oracle/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", - "pallet-xcm-rate-limiter/runtime-benchmarks", "pallet-elections-phragmen/runtime-benchmarks", "pallet-state-trie-migration/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", ] std = [ "codec/std", @@ -239,9 +241,10 @@ std = [ "pallet-preimage/std", "pallet-identity/std", "pallet-ema-oracle/std", - "pallet-xcm-rate-limiter/std", "pallet-state-trie-migration/std", "cumulus-primitives-utility/std", + "parachains-common/std", + "pallet-message-queue/std", ] try-runtime= [ "frame-try-runtime", @@ -293,6 +296,6 @@ try-runtime= [ "warehouse-liquidity-mining/try-runtime", "pallet-ema-oracle/try-runtime", "pallet-collator-rewards/try-runtime", - "pallet-xcm-rate-limiter/try-runtime", "pallet-state-trie-migration/try-runtime", + "pallet-message-queue/try-runtime", ] diff --git a/runtime/basilisk/src/assets.rs b/runtime/basilisk/src/assets.rs index 1e4177794f2..c3413dd6802 100644 --- a/runtime/basilisk/src/assets.rs +++ b/runtime/basilisk/src/assets.rs @@ -92,8 +92,8 @@ impl pallet_balances::Config for Runtime { type ReserveIdentifier = (); type FreezeIdentifier = (); type MaxFreezes = (); - type MaxHolds = (); type RuntimeHoldReason = (); + type RuntimeFreezeReason = (); } pub struct CurrencyHooks; @@ -620,6 +620,11 @@ impl AmmTradeWeights> for RouterWeightInfo { weight } + + fn force_insert_route_weight() -> Weight { + //Since we don't have any AMM specific thing in the extrinsic, we just return the plain weight + weights::route_executor::BasiliskWeight::::force_insert_route() + } } parameter_types! { @@ -634,6 +639,8 @@ impl pallet_route_executor::Config for Runtime { type NativeAssetId = NativeAssetId; type DefaultRoutePoolType = DefaultRoutePoolType; type WeightInfo = RouterWeightInfo; + type InspectRegistry = AssetRegistry; + type TechnicalOrigin = SuperMajorityTechCommitteeOrRoot; } parameter_types! { @@ -648,9 +655,13 @@ parameter_types! { impl pallet_ema_oracle::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = weights::ema_oracle::BasiliskWeight; + type AuthorityOrigin = SuperMajorityTechCommitteeOrRoot; type BlockNumberProvider = RelayChainBlockNumberProvider; type SupportedPeriods = SupportedPeriods; + type OracleWhitelist = (); // TODO: What do here ? type MaxUniqueEntries = MaxUniqueOracleEntries; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); //TODO: implement helper } parameter_types! { diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 4069ba9b17a..22d8ce065f5 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -192,7 +192,7 @@ construct_runtime!( // Parachain and XCM - starts at index 50 ParachainSystem: cumulus_pallet_parachain_system exclude_parts { Config } = 50, - ParachainInfo: parachain_info = 51, + ParachainInfo: staging_parachain_info = 51, //NOTE: Scheduler must be after ParachainSystem otherwise RelayChainBlockNumberProvider //will return 0 as current block number when used with Scheduler(democracy). @@ -202,6 +202,7 @@ construct_runtime!( CumulusXcm: cumulus_pallet_xcm = 53, XcmpQueue: cumulus_pallet_xcmp_queue exclude_parts { Call } = 54, DmpQueue: cumulus_pallet_dmp_queue = 55, + MessageQueue: pallet_message_queue = 56, // Basilisk - runtime module index for basilisk's pallets starts at 100 AssetRegistry: pallet_asset_registry = 100, @@ -217,7 +218,7 @@ construct_runtime!( XYKLiquidityMining: pallet_xyk_liquidity_mining = 112, XYKWarehouseLM: warehouse_liquidity_mining:: = 113, CollatorRewards: pallet_collator_rewards = 114, - XcmRateLimiter: pallet_xcm_rate_limiter = 115, + // Note: 115 was used by rate limiter which is now removed EmaOracle: pallet_ema_oracle = 120, diff --git a/runtime/basilisk/src/system.rs b/runtime/basilisk/src/system.rs index 0f6cc4bac86..f4e43749142 100644 --- a/runtime/basilisk/src/system.rs +++ b/runtime/basilisk/src/system.rs @@ -38,9 +38,13 @@ use frame_support::{ }, PalletId, }; -use frame_system::EnsureSignedBy; +use frame_support::pallet_prelude::Get; +use frame_support::traits::Defensive; +use frame_system::{EnsureRoot, EnsureSignedBy}; use hydradx_adapters::RelayChainBlockNumberProvider; +use hydradx_traits::evm::InspectEvmAccounts; use scale_info::TypeInfo; +use primitives::constants::time::DAYS; /// We assume that an on-initialize consumes 2.5% of the weight on average, hence a single extrinsic /// will not be allowed to consume more than `AvailableBlockRatio - 2.5%`. @@ -109,6 +113,8 @@ parameter_types! { } impl frame_system::Config for Runtime { + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; /// The basic call filter to use in dispatchable. type BaseCallFilter = BaseFilter; type BlockWeights = BlockWeights; @@ -117,10 +123,9 @@ impl frame_system::Config for Runtime { type RuntimeOrigin = RuntimeOrigin; /// The aggregated dispatch type that is available for extrinsics. type RuntimeCall = RuntimeCall; + type RuntimeTask = RuntimeTask; /// The index type for storing how many extrinsics an account has signed. type Nonce = Index; - /// The index type for blocks. - type Block = Block; /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. @@ -129,8 +134,8 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = IdentityLookup; - /// The ubiquitous event type. - type RuntimeEvent = RuntimeEvent; + /// The index type for blocks. + type Block = Block; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). type BlockHashCount = BlockHashCount; /// The weight of database operations that the runtime can invoke. @@ -224,6 +229,44 @@ impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; } +pub struct WethAssetId; +impl Get for WethAssetId { + fn get() -> AssetId { + let invalid_id = + pallet_asset_registry::Pallet::::next_asset_id().defensive_unwrap_or(AssetId::MAX); + + invalid_id + } +} + + +pub struct EvmAccounts; +impl InspectEvmAccounts for EvmAccounts{ + fn is_evm_account(_account_id: AccountId) -> bool { + false + } + + fn evm_address(_account_id: &impl AsRef<[u8; 32]>) -> sp_core::H160{ + sp_core::H160::default() + } + + fn truncated_account_id(_evm_address: sp_core::H160) -> AccountId { + AccountId::new([0u8; 32]) + } + + fn bound_account_id(_evm_address: sp_core::H160) -> Option { + None + } + + fn account_id(_evm_address: sp_core::H160) -> AccountId { + AccountId::new([0u8; 32]) + } + + fn can_deploy_contracts(_evm_address: sp_core::H160) -> bool { + false + } +} + impl pallet_transaction_multi_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; type AcceptedCurrencyOrigin = MajorityTechCommitteeOrRoot; @@ -233,6 +276,8 @@ impl pallet_transaction_multi_payment::Config for Runtime { type WeightInfo = weights::payment::BasiliskWeight; type WeightToFee = WeightToFee; type NativeAssetId = NativeAssetId; + type EvmAssetId = WethAssetId; + type InspectEvmAccounts = EvmAccounts; //TODO: this does not really work here but needed to set it to something } /// The type used to represent the kinds of proxying allowed. @@ -317,11 +362,12 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type OnSystemEvent = pallet_relaychain_info::OnValidationDataHandler; type SelfParaId = ParachainInfo; type OutboundXcmpMessageSource = XcmpQueue; - type DmpMessageHandler = DmpQueue; type ReservedDmpWeight = ReservedDmpWeight; type XcmpMessageHandler = XcmpQueue; type ReservedXcmpWeight = ReservedXcmpWeight; type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; + type DmpQueue = frame_support::traits::EnqueueWithOrigin; // TODO: what to set here ?! + type WeightInfo = (); } parameter_types! { @@ -392,7 +438,7 @@ impl pallet_session::Config for Runtime { type WeightInfo = (); } -impl parachain_info::Config for Runtime {} +impl staging_parachain_info::Config for Runtime {} impl cumulus_pallet_aura_ext::Config for Runtime {} @@ -437,20 +483,29 @@ parameter_types! { pub const MaxSubAccounts: u32 = 100; pub const MaxAdditionalFields: u32 = 100; pub const MaxRegistrars: u32 = 20; + pub const PendingUserNameExpiration: u32 = 7 * DAYS; + pub const MaxSuffixLength: u32 = 7; + pub const MaxUsernameLength: u32 = 32; } impl pallet_identity::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Currency = Balances; type BasicDeposit = BasicDeposit; - type FieldDeposit = FieldDeposit; + type ByteDeposit = FieldDeposit; //TODO: correct ?! type SubAccountDeposit = SubAccountDeposit; type MaxSubAccounts = MaxSubAccounts; - type MaxAdditionalFields = MaxAdditionalFields; + type IdentityInformation = pallet_identity::legacy::IdentityInfo; type MaxRegistrars = MaxRegistrars; type Slashed = Treasury; type ForceOrigin = MajorityCouncilOrRoot; type RegistrarOrigin = MajorityCouncilOrRoot; + type OffchainSignature = Signature; + type SigningPublicKey = ::Signer; + type UsernameAuthorityOrigin = EnsureRoot; + type PendingUsernameExpiration = PendingUserNameExpiration; + type MaxSuffixLength = MaxSuffixLength; + type MaxUsernameLength = MaxUsernameLength; type WeightInfo = (); } @@ -489,6 +544,7 @@ impl pallet_state_trie_migration::Config for Runtime { type SignedFilter = EnsureSignedBy; type RuntimeEvent = RuntimeEvent; type Currency = Balances; + type RuntimeHoldReason = RuntimeHoldReason; type MaxKeyLen = MaxKeyLen; type SignedDepositPerItem = MigrationSignedDepositPerItem; type SignedDepositBase = MigrationSignedDepositBase; diff --git a/runtime/basilisk/src/weights/route_executor.rs b/runtime/basilisk/src/weights/route_executor.rs index 5e2f7b8a1f7..192a4a77c0d 100644 --- a/runtime/basilisk/src/weights/route_executor.rs +++ b/runtime/basilisk/src/weights/route_executor.rs @@ -128,4 +128,8 @@ impl WeightInfo for BasiliskWeight { .saturating_add(T::DbWeight::get().reads(34_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } + + fn force_insert_route() -> Weight { + todo!() + } } diff --git a/runtime/basilisk/src/weights/xcmp_queue.rs b/runtime/basilisk/src/weights/xcmp_queue.rs index d7a7740c2c4..d52118f4848 100644 --- a/runtime/basilisk/src/weights/xcmp_queue.rs +++ b/runtime/basilisk/src/weights/xcmp_queue.rs @@ -63,93 +63,28 @@ impl WeightInfo for BasiliskWeight { .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: `XcmpQueue::QueueConfig` (r:1 w:1) - /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn set_config_with_weight() -> Weight { - // Proof Size summary in bytes: - // Measured: `109` - // Estimated: `1594` - // Minimum execution time: 8_896_000 picoseconds. - Weight::from_parts(9_059_000, 1594) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + + fn enqueue_xcmp_message() -> Weight { + todo!() } - /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) - /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `XcmpQueue::QueueSuspended` (r:1 w:0) - /// Proof: `XcmpQueue::QueueSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `XcmpQueue::DeferredQueueSuspended` (r:1 w:0) - /// Proof: `XcmpQueue::DeferredQueueSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `XcmpQueue::DeferredIndices` (r:1 w:1) - /// Proof: `XcmpQueue::DeferredIndices` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmpQueue::DeferredMessageBuckets` (r:3 w:3) - /// Proof: `XcmpQueue::DeferredMessageBuckets` (`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: `XcmpQueue::OverweightCount` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `XcmpQueue::Overweight` (r:60 w:60) - /// Proof: `XcmpQueue::Overweight` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `b` is `[1, 3]`. - fn service_deferred(b: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `6242 + b * (324357 ±0)` - // Estimated: `9707 + b * (373857 ±0)` - // Minimum execution time: 33_142_672_000 picoseconds. - Weight::from_parts(33_268_386_000, 9707) - // Standard Error: 602_125_184 - .saturating_add(Weight::from_parts(15_702_864_393, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(6_u64)) - .saturating_add(T::DbWeight::get().reads((21_u64).saturating_mul(b.into()))) - .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(T::DbWeight::get().writes((21_u64).saturating_mul(b.into()))) - .saturating_add(Weight::from_parts(0, 373857).saturating_mul(b.into())) + + fn suspend_channel() -> Weight { + todo!() } - /// Storage: `XcmpQueue::DeferredMessageBuckets` (r:1 w:1) - /// Proof: `XcmpQueue::DeferredMessageBuckets` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `m` is `[1, 20]`. - fn discard_deferred_bucket(m: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `219 + m * (16216 ±0)` - // Estimated: `3683 + m * (16216 ±0)` - // Minimum execution time: 1_281_948_000 picoseconds. - Weight::from_parts(243_099_051, 3683) - // Standard Error: 419_944 - .saturating_add(Weight::from_parts(1_090_047_884, 0).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 16216).saturating_mul(m.into())) + + fn resume_channel() -> Weight { + todo!() } - /// Storage: `XcmpQueue::DeferredMessageBuckets` (r:1 w:1) - /// Proof: `XcmpQueue::DeferredMessageBuckets` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `m` is `[1, 20]`. - fn discard_deferred_individual(m: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `219 + m * (16216 ±0)` - // Estimated: `3683 + m * (16216 ±0)` - // Minimum execution time: 1_341_620_000 picoseconds. - Weight::from_parts(105_527_197, 3683) - // Standard Error: 366_172 - .saturating_add(Weight::from_parts(1_214_179_345, 0).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 16216).saturating_mul(m.into())) + + fn take_first_concatenated_xcm() -> Weight { + todo!() } - /// Storage: `XcmpQueue::DeferredIndices` (r:1 w:1) - /// Proof: `XcmpQueue::DeferredIndices` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmpQueue::DeferredMessageBuckets` (r:1 w:1) - /// Proof: `XcmpQueue::DeferredMessageBuckets` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `m` is `[1, 20]`. - fn try_place_in_deferred_queue(m: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0 + m * (16216 ±0)` - // Estimated: `9691 + m * (15020 ±55)` - // Minimum execution time: 107_001_000 picoseconds. - Weight::from_parts(123_947_871, 9691) - // Standard Error: 202_249 - .saturating_add(Weight::from_parts(6_781_886, 0).saturating_mul(m.into())) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 15020).saturating_mul(m.into())) + + fn on_idle_good_msg() -> Weight { + todo!() + } + + fn on_idle_large_msg() -> Weight { + todo!() } } diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index 6defe9fb96f..f2b72f67c71 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -20,7 +20,7 @@ use crate::governance::{MajorityTechCommitteeOrRoot, SuperMajorityCouncilOrRoot, use crate::system::WeightToFee; use codec::{Decode, Encode, MaxEncodedLen}; -use cumulus_primitives_core::ParaId; +use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::{ parameter_types, sp_runtime::traits::Convert, @@ -47,6 +47,8 @@ use xcm_builder::{ SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, WithComputedOrigin, }; use xcm_executor::{Config, XcmExecutor}; +use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; +use sp_runtime::Perbill; #[derive(Debug, Default, Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)] pub struct AssetLocation(pub MultiLocation); @@ -56,6 +58,10 @@ pub const RELAY_CHAIN_ASSET_LOCATION: AssetLocation = AssetLocation(MultiLocatio interior: Here, }); +parameter_types! { + pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent; +} + pub type LocalOriginToLocation = SignedToAccountId32; pub type Barrier = ( @@ -284,19 +290,26 @@ fn defer_duration_configuration() { DeferDuration::get() ); } + parameter_types! { pub DeferDuration: RelayChainBlockNumber = 600 * 36; // 36 hours pub MaxDeferDuration: RelayChainBlockNumber = 600 * 24 * 10; // 10 days + + pub MessageQueueServiceWeight: Weight = Perbill::from_percent(25) * BlockWeights::get().max_block; + pub const MessageQueueMaxStale: u32 = 8; + pub const MessageQueueHeapSize: u32 = 128 * 1048; } -impl pallet_xcm_rate_limiter::Config for Runtime { +impl pallet_message_queue::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 = (); + type MessageProcessor = xcm_builder::ProcessXcmMessage, RuntimeCall>; + type Size = u32; + type QueueChangeHandler = NarrowOriginToSibling; + type QueuePausedQuery = NarrowOriginToSibling; + type HeapSize = MessageQueueHeapSize; + type MaxStale = MessageQueueMaxStale; + type ServiceWeight = MessageQueueServiceWeight; } pub struct CurrencyIdConvert; From eddfa4c40be99f867db3d171f0005c608486bc43 Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Sun, 14 Apr 2024 10:35:09 +0200 Subject: [PATCH 03/56] xcm configs --- Cargo.lock | 10 +++---- runtime/basilisk/src/governance.rs | 24 +++++++++++++++-- runtime/basilisk/src/lib.rs | 2 +- runtime/basilisk/src/migrations.rs | 9 +++++++ runtime/basilisk/src/system.rs | 11 ++++---- runtime/basilisk/src/xcm.rs | 43 +++++++++--------------------- 6 files changed, 55 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3452083b153..199d5c40419 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16154,6 +16154,11 @@ dependencies = [ "pkg-config", ] +[[patch.unused]] +name = "orml-currencies" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" + [[patch.unused]] name = "sp-core-hashing" version = "15.0.0" @@ -16163,8 +16168,3 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot name = "sp-crypto-ec-utils" version = "0.10.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" - -[[patch.unused]] -name = "orml-currencies" -version = "0.8.0" -source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/runtime/basilisk/src/governance.rs b/runtime/basilisk/src/governance.rs index be48ba60147..5cf4ec1a7dc 100644 --- a/runtime/basilisk/src/governance.rs +++ b/runtime/basilisk/src/governance.rs @@ -21,6 +21,9 @@ use primitives::constants::{ time::{DAYS, HOURS}, }; +use frame_support::traits::fungible::HoldConsideration; +use frame_support::traits::tokens::{PayFromAccount, UnityAssetBalanceConversion}; +use frame_support::traits::LinearStoragePrice; use frame_support::{ parameter_types, sp_runtime::{Perbill, Percent, Permill}, @@ -29,6 +32,7 @@ use frame_support::{ }; use frame_system::{EnsureRoot, EnsureSigned}; use pallet_collective::EnsureProportionAtLeast; +use sp_runtime::traits::IdentityLookup; use sp_staking::currency_to_vote::U128CurrencyToVote; pub type MajorityCouncilOrRoot = @@ -186,6 +190,7 @@ parameter_types! { pub const TipReportDepositBase: Balance = 10 * DOLLARS; pub const TipReportDepositPerByte: Balance = CENTS; pub const MaximumReasonLength: u32 = 1024; + pub const MaxTipAmount: u128 = 1_000 * DOLLARS; // TODO: check this } impl pallet_tips::Config for Runtime { @@ -195,6 +200,7 @@ impl pallet_tips::Config for Runtime { type TipCountdown = TipCountdown; type TipFindersFee = TipFindersFee; type TipReportDepositBase = TipReportDepositBase; + type MaxTipAmount = MaxTipAmount; type Tippers = Elections; type WeightInfo = weights::tips::BasiliskWeight; } @@ -203,6 +209,7 @@ parameter_types! { pub const PreimageMaxSize: u32 = 4096 * 1024; pub PreimageBaseDeposit: Balance = deposit(2, 64); pub PreimageByteDeposit: Balance = deposit(0, 1); + pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage); } impl pallet_preimage::Config for Runtime { @@ -210,8 +217,12 @@ impl pallet_preimage::Config for Runtime { type WeightInfo = (); type Currency = Balances; type ManagerOrigin = EnsureRoot; - type BaseDeposit = PreimageBaseDeposit; - type ByteDeposit = PreimageByteDeposit; + type Consideration = HoldConsideration< + AccountId, + Balances, + PreimageHoldReason, + LinearStoragePrice, + >; } parameter_types! { @@ -241,6 +252,7 @@ parameter_types! { pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); pub const MaxApprovals: u32 = 100; pub TreasuryAccount: AccountId = Treasury::account_id(); + pub const TreasuryPayoutPeriod: u32 = 30 * DAYS; } impl pallet_treasury::Config for Runtime { @@ -260,4 +272,12 @@ impl pallet_treasury::Config for Runtime { type SpendFunds = (); type MaxApprovals = MaxApprovals; type SpendOrigin = NeverEnsureOrigin; + type AssetKind = (); + type Beneficiary = AccountId; + type BeneficiaryLookup = IdentityLookup; + type Paymaster = PayFromAccount; // TODO: check what this means + type BalanceConverter = UnityAssetBalanceConversion; //TODO: check this + type PayoutPeriod = TreasuryPayoutPeriod; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); //TODO: implement helper! } diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 22d8ce065f5..a47cf06d09e 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -263,7 +263,7 @@ pub type Executive = frame_executive::Executive< Block, frame_system::ChainContext, Runtime, - AllPalletsReversedWithSystemFirst, + AllPalletsWithSystem, ( migrations::OnRuntimeUpgradeMigration, pallet_transaction_pause::migration::v1::Migration, diff --git a/runtime/basilisk/src/migrations.rs b/runtime/basilisk/src/migrations.rs index 73fcb8e3e2e..b1a506638f2 100644 --- a/runtime/basilisk/src/migrations.rs +++ b/runtime/basilisk/src/migrations.rs @@ -7,6 +7,7 @@ pub struct OnRuntimeUpgradeMigration; impl OnRuntimeUpgrade for OnRuntimeUpgradeMigration { #[cfg(feature = "try-runtime")] fn pre_upgrade() -> Result, sp_runtime::DispatchError> { + /* log::info!("PreMigrate Collator Selection Pallet start"); let number_of_invulnerables = pallet_collator_selection::migration::v1::MigrateToV1::::pre_upgrade()?; log::info!("PreMigrate Collator Selection Pallet end"); @@ -16,11 +17,14 @@ impl OnRuntimeUpgrade for OnRuntimeUpgradeMigration { log::info!("PreMigrate Collator Rewards Pallet end"); Ok(number_of_invulnerables) + */ + Ok(vec![]) } fn on_runtime_upgrade() -> Weight { let mut weight: Weight = Weight::zero(); + /* log::info!("Migrate Collator Selection Pallet to v1 start"); weight = weight .saturating_add(pallet_collator_selection::migration::v1::MigrateToV1::::on_runtime_upgrade()); @@ -34,11 +38,14 @@ impl OnRuntimeUpgrade for OnRuntimeUpgradeMigration { weight = weight.saturating_add(orml_unknown_tokens::Migration::::on_runtime_upgrade()); log::info!("Migrate Unknown Tokens Pallet to v2 end"); + */ + weight } #[cfg(feature = "try-runtime")] fn post_upgrade(state: Vec) -> Result<(), sp_runtime::DispatchError> { + /* log::info!("PostMigrate Collator Selection Pallet start"); let migration_result = pallet_collator_selection::migration::v1::MigrateToV1::::post_upgrade(state); log::info!("PostMigrate Collator Selection Pallet end"); @@ -48,5 +55,7 @@ impl OnRuntimeUpgrade for OnRuntimeUpgradeMigration { log::info!("PostMigrate Collator Rewards Pallet end"); migration_result + */ + Ok(()) } } diff --git a/runtime/basilisk/src/system.rs b/runtime/basilisk/src/system.rs index f4e43749142..b2ab4f24143 100644 --- a/runtime/basilisk/src/system.rs +++ b/runtime/basilisk/src/system.rs @@ -27,6 +27,8 @@ use primitives::constants::{ }; use codec::{Decode, Encode, MaxEncodedLen}; +use frame_support::pallet_prelude::Get; +use frame_support::traits::Defensive; use frame_support::{ dispatch::DispatchClass, parameter_types, @@ -38,13 +40,11 @@ use frame_support::{ }, PalletId, }; -use frame_support::pallet_prelude::Get; -use frame_support::traits::Defensive; use frame_system::{EnsureRoot, EnsureSignedBy}; use hydradx_adapters::RelayChainBlockNumberProvider; use hydradx_traits::evm::InspectEvmAccounts; -use scale_info::TypeInfo; use primitives::constants::time::DAYS; +use scale_info::TypeInfo; /// We assume that an on-initialize consumes 2.5% of the weight on average, hence a single extrinsic /// will not be allowed to consume more than `AvailableBlockRatio - 2.5%`. @@ -239,14 +239,13 @@ impl Get for WethAssetId { } } - pub struct EvmAccounts; -impl InspectEvmAccounts for EvmAccounts{ +impl InspectEvmAccounts for EvmAccounts { fn is_evm_account(_account_id: AccountId) -> bool { false } - fn evm_address(_account_id: &impl AsRef<[u8; 32]>) -> sp_core::H160{ + fn evm_address(_account_id: &impl AsRef<[u8; 32]>) -> sp_core::H160 { sp_core::H160::default() } diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index f2b72f67c71..c33312adcb3 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -21,6 +21,7 @@ use crate::system::WeightToFee; use codec::{Decode, Encode, MaxEncodedLen}; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; +use frame_support::traits::TransformOrigin; use frame_support::{ parameter_types, sp_runtime::traits::Convert, @@ -36,10 +37,12 @@ use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key}; pub use orml_xcm_support::{DepositToAlternative, IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; use pallet_transaction_multi_payment::DepositAll; use pallet_xcm::XcmPassthrough; +use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; use polkadot_parachain::primitives::{RelayChainBlockNumber, Sibling}; use polkadot_xcm::v3::{prelude::*, MultiLocation, Weight as XcmWeight}; use primitives::AssetId; use scale_info::TypeInfo; +use sp_runtime::Perbill; use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DescribeAllTerminal, DescribeFamily, EnsureXcmOrigin, FixedWeightBounds, HashedDescription, ParentIsPreset, @@ -47,8 +50,6 @@ use xcm_builder::{ SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, WithComputedOrigin, }; use xcm_executor::{Config, XcmExecutor}; -use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; -use sp_runtime::Perbill; #[derive(Debug, Default, Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)] pub struct AssetLocation(pub MultiLocation); @@ -172,30 +173,25 @@ parameter_types! { pub const MaxDeferredMessages: u32 = 20; pub const MaxDeferredBuckets: u32 = 1_000; pub const MaxBucketsProcessed: u32 = 3; + pub const MaxInboundSuspended: u32 = 1_000; } impl cumulus_pallet_xcmp_queue::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; type ChannelInfo = ParachainSystem; type VersionWrapper = PolkadotXcm; - type ExecuteOverweightOrigin = MajorityTechCommitteeOrRoot; type ControllerOrigin = MajorityTechCommitteeOrRoot; type ControllerOriginConverter = XcmOriginToCallOrigin; type PriceForSiblingDelivery = (); type WeightInfo = weights::xcmp_queue::BasiliskWeight; - type ExecuteDeferredOrigin = EnsureRoot; - type MaxDeferredMessages = MaxDeferredMessages; - type MaxDeferredBuckets = MaxDeferredBuckets; - type MaxBucketsProcessed = MaxBucketsProcessed; - type RelayChainBlockNumberProvider = RelayChainBlockNumberProvider; - type XcmDeferFilter = XcmRateLimiter; + type XcmpQueue = TransformOrigin; + type MaxInboundSuspended = MaxInboundSuspended; } impl cumulus_pallet_dmp_queue::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; - type ExecuteOverweightOrigin = MajorityTechCommitteeOrRoot; + type DmpSink = frame_support::traits::EnqueueWithOrigin; + type WeightInfo = (); } parameter_type_with_key! { @@ -209,16 +205,18 @@ impl orml_xtokens::Config for Runtime { type Balance = Balance; type CurrencyId = AssetId; type CurrencyIdConvert = CurrencyIdConvert; - type AccountIdToMultiLocation = AccountIdToMultiLocation; + type AccountIdToLocation = AccountIdToMultiLocation; type SelfLocation = SelfLocation; type MinXcmFee = ParachainMinFee; type XcmExecutor = XcmExecutor; - type MultiLocationsFilter = Everything; + type LocationsFilter = Everything; type Weigher = FixedWeightBounds; type BaseXcmWeight = BaseXcmWeight; type UniversalLocation = UniversalLocation; type MaxAssetsForTransfer = MaxAssetsForTransfer; type ReserveProvider = AbsoluteReserveProvider; + type RateLimiter = (); //TODO: what do ? + type RateLimiterId = (); //TODO: what do ? } impl orml_unknown_tokens::Config for Runtime { @@ -266,8 +264,6 @@ impl pallet_xcm::Config for Runtime { type SovereignAccountOf = (); type MaxLockers = ConstU32<8>; type WeightInfo = weights::xcm::BasiliskWeight; - #[cfg(feature = "runtime-benchmarks")] - type ReachableDest = ReachableDest; type AdminOrigin = SuperMajorityTechCommitteeOrRoot; type MaxRemoteLockConsumers = ConstU32<0>; type RemoteLockConsumerIdentifier = (); @@ -381,18 +377,6 @@ pub type XcmRouter = ( XcmpQueue, ); -// TODO: Remove after upgrading to `polkadot-v1.2.0` and replace types from xcm-builder. -pub struct DescribeBodyTerminal; -impl xcm_builder::DescribeLocation for DescribeBodyTerminal { - fn describe_location(l: &MultiLocation) -> Option> { - match (l.parents, &l.interior) { - (0, X1(Plurality { id, part })) => Some((b"Body", id, part).encode()), - _ => None, - } - } -} -pub type DescribeAllTerminalAndBody = (DescribeAllTerminal, DescribeBodyTerminal); - /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used /// when determining ownership of accounts for asset transacting and when attempting to use XCM /// `Transact` in order to determine the dispatch Origin. @@ -403,9 +387,8 @@ pub type LocationToAccountId = ( SiblingParachainConvertsVia, // Straight up local `AccountId32` origins just alias directly to `AccountId`. AccountId32Aliases, - // TODO: Replace DescribeAllTerminalAndBody with DescribeAllTerminal after upgrading to `polkadot-v1.2.0`. // Foreign locations alias into accounts according to a hash of their standard description. - HashedDescription>, + HashedDescription>, ); parameter_types! { From f67fc9fdfb4dafa86e6af232aefcfdc180960a74 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 15 Apr 2024 09:15:37 +0200 Subject: [PATCH 04/56] weights api --- runtime/basilisk/src/weights/balances.rs | 4 ++ .../src/weights/collator_selection.rs | 11 +++- runtime/basilisk/src/weights/ema_oracle.rs | 8 +++ runtime/basilisk/src/weights/payment.rs | 4 ++ runtime/basilisk/src/weights/system.rs | 8 +++ runtime/basilisk/src/weights/treasury.rs | 16 ++++++ runtime/basilisk/src/weights/xcm.rs | 13 +++++ runtime/basilisk/src/xcm.rs | 51 +++++++++++++++++++ 8 files changed, 114 insertions(+), 1 deletion(-) diff --git a/runtime/basilisk/src/weights/balances.rs b/runtime/basilisk/src/weights/balances.rs index 5589ea246f9..c772c975fe0 100644 --- a/runtime/basilisk/src/weights/balances.rs +++ b/runtime/basilisk/src/weights/balances.rs @@ -144,4 +144,8 @@ impl WeightInfo for BasiliskWeight { .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) } + + fn force_adjust_total_issuance() -> Weight { + todo!() + } } diff --git a/runtime/basilisk/src/weights/collator_selection.rs b/runtime/basilisk/src/weights/collator_selection.rs index f72f3da12ab..d0afd54b857 100644 --- a/runtime/basilisk/src/weights/collator_selection.rs +++ b/runtime/basilisk/src/weights/collator_selection.rs @@ -121,7 +121,7 @@ impl WeightInfo for BasiliskWeight { } /// Storage: `CollatorSelection::CandidacyBond` (r:0 w:1) /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_candidacy_bond() -> Weight { + fn set_candidacy_bond(_: u32, _:u32) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` @@ -171,6 +171,15 @@ impl WeightInfo for BasiliskWeight { .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + + fn update_bond(_c: u32) -> Weight { + todo!() + } + + fn take_candidate_slot(_c: u32) -> Weight { + todo!() + } + /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `System::BlockWeight` (r:1 w:1) diff --git a/runtime/basilisk/src/weights/ema_oracle.rs b/runtime/basilisk/src/weights/ema_oracle.rs index 311c9d40924..76f97cb461b 100644 --- a/runtime/basilisk/src/weights/ema_oracle.rs +++ b/runtime/basilisk/src/weights/ema_oracle.rs @@ -52,6 +52,14 @@ use pallet_ema_oracle::weights::WeightInfo; pub struct BasiliskWeight(PhantomData); impl WeightInfo for BasiliskWeight { + fn add_oracle() -> Weight { + todo!() + } + + fn remove_oracle() -> Weight { + todo!() + } + /// Storage: `EmaOracle::Accumulator` (r:1 w:0) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) fn on_finalize_no_entry() -> Weight { diff --git a/runtime/basilisk/src/weights/payment.rs b/runtime/basilisk/src/weights/payment.rs index 8b5dbc7b87a..ad0a6112f7e 100644 --- a/runtime/basilisk/src/weights/payment.rs +++ b/runtime/basilisk/src/weights/payment.rs @@ -98,4 +98,8 @@ impl WeightInfo for BasiliskWeight { // Minimum execution time: 96_786_000 picoseconds. Weight::from_parts(97_647_000, 27510).saturating_add(T::DbWeight::get().reads(11_u64)) } + + fn reset_payment_currency() -> Weight { + todo!() + } } diff --git a/runtime/basilisk/src/weights/system.rs b/runtime/basilisk/src/weights/system.rs index 6b444748f33..c34a05f4ee2 100644 --- a/runtime/basilisk/src/weights/system.rs +++ b/runtime/basilisk/src/weights/system.rs @@ -147,4 +147,12 @@ impl WeightInfo for BasiliskWeight { .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) } + + fn authorize_upgrade() -> Weight { + todo!() + } + + fn apply_authorized_upgrade() -> Weight { + todo!() + } } diff --git a/runtime/basilisk/src/weights/treasury.rs b/runtime/basilisk/src/weights/treasury.rs index 5da71744110..7ec59b05d09 100644 --- a/runtime/basilisk/src/weights/treasury.rs +++ b/runtime/basilisk/src/weights/treasury.rs @@ -137,4 +137,20 @@ impl WeightInfo for BasiliskWeight { .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 5206).saturating_mul(p.into())) } + + fn spend_local() -> Weight { + todo!() + } + + fn payout() -> Weight { + todo!() + } + + fn check_status() -> Weight { + todo!() + } + + fn void_spend() -> Weight { + todo!() + } } diff --git a/runtime/basilisk/src/weights/xcm.rs b/runtime/basilisk/src/weights/xcm.rs index 22613b8ee0a..24e8a90d0e3 100644 --- a/runtime/basilisk/src/weights/xcm.rs +++ b/runtime/basilisk/src/weights/xcm.rs @@ -89,6 +89,11 @@ impl WeightInfo for BasiliskWeight { // Minimum execution time: 32_094_000 picoseconds. Weight::from_parts(32_796_000, 1489).saturating_add(T::DbWeight::get().reads(1_u64)) } + + fn transfer_assets() -> Weight { + todo!() + } + fn execute() -> Weight { // Proof Size summary in bytes: // Measured: `0` @@ -264,4 +269,12 @@ impl WeightInfo for BasiliskWeight { .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } + + fn new_query() -> Weight { + todo!() + } + + fn take_response() -> Weight { + todo!() + } } diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index c33312adcb3..abcdc7b1214 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -39,6 +39,7 @@ use pallet_transaction_multi_payment::DepositAll; use pallet_xcm::XcmPassthrough; use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; use polkadot_parachain::primitives::{RelayChainBlockNumber, Sibling}; +use polkadot_xcm::latest::Asset; use polkadot_xcm::v3::{prelude::*, MultiLocation, Weight as XcmWeight}; use primitives::AssetId; use scale_info::TypeInfo; @@ -368,6 +369,56 @@ impl Convert for AccountIdToMultiLocation { } } + +impl Convert> for CurrencyIdConvert { + fn convert(location: polkadot_xcm::latest::Location) -> Option { + let polkadot_xcm::latest::Location { parents, interior } = location.clone(); + + match interior { + polkadot_xcm::latest::Junctions::X2(a) + if parents == 1 + && a.contains(&polkadot_xcm::prelude::GeneralIndex(CORE_ASSET_ID.into())) + && a.contains(&polkadot_xcm::prelude::Parachain(ParachainInfo::get().into())) => + { + Some(CORE_ASSET_ID) + } + polkadot_xcm::latest::Junctions::X1(a) if parents == 0 && a.contains(&polkadot_xcm::prelude::GeneralIndex(CORE_ASSET_ID.into())) => Some(CORE_ASSET_ID), + _ => AssetRegistry::location_to_asset(AssetLocation(location)), + } + + // Note: keeping the original code for reference until tests are successful + /* + match location { + Location { + parents: p, + interior: [Parachain(id), GeneralIndex(index)].into(), + } if p == 1 && ParaId::from(id) == ParachainInfo::get() && (index as u32) == CORE_ASSET_ID => { + // Handling native asset for this parachain + Some(CORE_ASSET_ID) + } + // handle reanchor canonical location: https://github.com/paritytech/polkadot/pull/4470 + Location { + parents: 0, + interior: [GeneralIndex(index)].into(), + } if (index as u32) == CORE_ASSET_ID => Some(CORE_ASSET_ID), + // delegate to asset-registry + _ => AssetRegistry::location_to_asset(AssetLocation(location)), + } + + */ + } +} + +impl Convert> for CurrencyIdConvert { + fn convert(asset: Asset) -> Option { + if let Asset { id: asset_id, .. } = asset { + Self::convert(asset_id.0) + } else { + None + } + } +} + /// The means for routing XCM messages which are not for local execution into the right message /// queues. pub type XcmRouter = ( From 40c9cdbd647772a059cf7052541ee6731ee1865c Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 15 Apr 2024 10:05:30 +0200 Subject: [PATCH 05/56] pallets congifs --- Cargo.lock | 37 +- Cargo.toml | 5 +- pallets/asset-registry/src/lib.rs | 39 +- pallets/liquidity-mining/Cargo.toml | 62 + pallets/liquidity-mining/src/lib.rs | 1914 +++++++++++++++ .../src/tests/claim_rewards.rs | 1265 ++++++++++ .../src/tests/create_global_farm.rs | 276 +++ .../src/tests/create_yield_farm.rs | 485 ++++ .../src/tests/deposit_lp_shares.rs | 651 +++++ .../liquidity-mining/src/tests/full_run.rs | 789 ++++++ .../liquidity-mining/src/tests/invariants.rs | 888 +++++++ .../src/tests/lm_with_oracle.rs | 298 +++ pallets/liquidity-mining/src/tests/mock.rs | 536 +++++ pallets/liquidity-mining/src/tests/mod.rs | 269 +++ .../src/tests/redeposit_lp_shares.rs | 289 +++ .../src/tests/resume_yield_farm.rs | 233 ++ .../src/tests/stop_yield_farm.rs | 188 ++ .../src/tests/terminate_global_farm.rs | 254 ++ .../src/tests/terminate_yield_farm.rs | 228 ++ .../liquidity-mining/src/tests/test_ext.rs | 411 ++++ pallets/liquidity-mining/src/tests/tests.rs | 2132 +++++++++++++++++ .../src/tests/update_global_farm.rs | 184 ++ .../src/tests/update_yield_farm.rs | 223 ++ .../src/tests/withdraw_lp_shares.rs | 1377 +++++++++++ pallets/liquidity-mining/src/types.rs | 429 ++++ runtime/basilisk/Cargo.toml | 2 + runtime/basilisk/src/assets.rs | 4 +- runtime/basilisk/src/xcm.rs | 37 +- 28 files changed, 13488 insertions(+), 17 deletions(-) create mode 100644 pallets/liquidity-mining/Cargo.toml create mode 100644 pallets/liquidity-mining/src/lib.rs create mode 100644 pallets/liquidity-mining/src/tests/claim_rewards.rs create mode 100644 pallets/liquidity-mining/src/tests/create_global_farm.rs create mode 100644 pallets/liquidity-mining/src/tests/create_yield_farm.rs create mode 100644 pallets/liquidity-mining/src/tests/deposit_lp_shares.rs create mode 100644 pallets/liquidity-mining/src/tests/full_run.rs create mode 100644 pallets/liquidity-mining/src/tests/invariants.rs create mode 100644 pallets/liquidity-mining/src/tests/lm_with_oracle.rs create mode 100644 pallets/liquidity-mining/src/tests/mock.rs create mode 100644 pallets/liquidity-mining/src/tests/mod.rs create mode 100644 pallets/liquidity-mining/src/tests/redeposit_lp_shares.rs create mode 100644 pallets/liquidity-mining/src/tests/resume_yield_farm.rs create mode 100644 pallets/liquidity-mining/src/tests/stop_yield_farm.rs create mode 100644 pallets/liquidity-mining/src/tests/terminate_global_farm.rs create mode 100644 pallets/liquidity-mining/src/tests/terminate_yield_farm.rs create mode 100644 pallets/liquidity-mining/src/tests/test_ext.rs create mode 100644 pallets/liquidity-mining/src/tests/tests.rs create mode 100644 pallets/liquidity-mining/src/tests/update_global_farm.rs create mode 100644 pallets/liquidity-mining/src/tests/update_yield_farm.rs create mode 100644 pallets/liquidity-mining/src/tests/withdraw_lp_shares.rs create mode 100644 pallets/liquidity-mining/src/types.rs diff --git a/Cargo.lock b/Cargo.lock index 199d5c40419..71d55c8f996 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -999,7 +999,7 @@ dependencies = [ "pallet-ema-oracle", "pallet-identity", "pallet-lbp", - "pallet-liquidity-mining", + "pallet-liquidity-mining 4.2.5", "pallet-marketplace", "pallet-message-queue", "pallet-multisig", @@ -1027,6 +1027,7 @@ dependencies = [ "parachains-common", "parity-scale-codec", "polkadot-parachain-primitives", + "polkadot-runtime-common", "primitive-types", "primitives 6.6.0", "scale-info", @@ -4463,7 +4464,7 @@ dependencies = [ "pallet-dynamic-fees", "pallet-ema-oracle", "pallet-lbp", - "pallet-liquidity-mining", + "pallet-liquidity-mining 4.3.1", "pallet-omnipool", "pallet-omnipool-liquidity-mining", "pallet-referrals", @@ -7501,6 +7502,32 @@ dependencies = [ "substrate-wasm-builder", ] +[[package]] +name = "pallet-liquidity-mining" +version = "4.2.5" +dependencies = [ + "fixed", + "frame-support", + "frame-system", + "hydra-dx-math", + "hydradx-traits", + "orml-tokens", + "orml-traits", + "pallet-asset-registry 2.3.3", + "pallet-balances", + "parity-scale-codec", + "pretty_assertions", + "proptest", + "rand", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", + "test-utils", +] + [[package]] name = "pallet-liquidity-mining" version = "4.3.1" @@ -7774,7 +7801,7 @@ dependencies = [ "orml-traits", "pallet-balances", "pallet-ema-oracle", - "pallet-liquidity-mining", + "pallet-liquidity-mining 4.3.1", "pallet-omnipool", "parity-scale-codec", "primitive-types", @@ -8415,7 +8442,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", - "pallet-liquidity-mining", + "pallet-liquidity-mining 4.2.5", "pallet-nft", "pallet-xyk", "parity-scale-codec", @@ -8442,7 +8469,7 @@ dependencies = [ "pallet-asset-registry 2.3.3", "pallet-balances", "pallet-duster", - "pallet-liquidity-mining", + "pallet-liquidity-mining 4.2.5", "pallet-nft", "pallet-uniques", "pallet-xyk", diff --git a/Cargo.toml b/Cargo.toml index 99e613617dc..1da4696a13b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ members = [ 'pallets/marketplace', 'pallets/xyk', 'pallets/asset-registry', + 'pallets/liquidity-mining', 'pallets/xyk-liquidity-mining', 'pallets/xyk-liquidity-mining/benchmarking', 'integration-tests', @@ -25,6 +26,8 @@ pallet-marketplace = { path = "pallets/marketplace", default-features = false} pallet-xyk = { path = "pallets/xyk", default-features = false} pallet-asset-registry = { path = "pallets/asset-registry", default-features = false} pallet-xyk-liquidity-mining = { path = "pallets/xyk-liquidity-mining", default-features = false} +warehouse-liquidity-mining = { package = "pallet-liquidity-mining", path = "pallets/liquidity-mining", default-features = false} +pallet-liquidity-mining = { path = "pallets/liquidity-mining", default-features = false} pallet-xyk-liquidity-mining-benchmarking = { path = "pallets/xyk-liquidity-mining/benchmarking", default-features = false} hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } @@ -36,8 +39,6 @@ pallet-nft = { git = "https://github.com/galacticcouncil/HydraDX-node", branch = pallet-currencies = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } pallet-transaction-pause = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } pallet-route-executor = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } -pallet-liquidity-mining = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } -warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } pallet-ema-oracle = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } pallet-duster = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } pallet-collator-rewards = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } diff --git a/pallets/asset-registry/src/lib.rs b/pallets/asset-registry/src/lib.rs index 84904f81d51..fdfddceb43b 100644 --- a/pallets/asset-registry/src/lib.rs +++ b/pallets/asset-registry/src/lib.rs @@ -48,7 +48,7 @@ pub use pallet::*; pub use crate::types::{AssetDetails, AssetMetadata}; use frame_support::BoundedVec; use traits::{CreateRegistry, InspectRegistry, Registry, ShareTokenRegistry}; -use hydradx_traits::AssetKind; +use hydradx_traits::{AssetKind, Inspect}; #[frame_support::pallet] pub mod pallet { @@ -653,3 +653,40 @@ impl InspectRegistry for Pallet { Some(asset_metadata.symbol.into_inner()) } } + +impl> Inspect for Pallet { + type AssetId = T::AssetId; + type Location = T::AssetNativeLocation; + + fn is_sufficient(id: Self::AssetId) -> bool { + true + } + + fn exists(id: Self::AssetId) -> bool { + Assets::::contains_key(id) + } + + fn decimals(id: Self::AssetId) -> Option { + Self::asset_metadata(id).and_then(|a| Some(a.decimals)) + } + + fn asset_type(id: Self::AssetId) -> Option { + Self::assets(id).map(|a| a.asset_type.into()) + } + + fn is_banned(id: Self::AssetId) -> bool { + false + } + + fn asset_name(id: Self::AssetId) -> Option> { + Self::assets(id).and_then(|a| Some(a.name.to_vec())) + } + + fn asset_symbol(id: Self::AssetId) -> Option> { + Self::asset_metadata(id).and_then(|a| Some(a.symbol.to_vec())) + } + + fn existential_deposit(id: Self::AssetId) -> Option { + Self::assets(id).map(|a| a.existential_deposit) + } +} \ No newline at end of file diff --git a/pallets/liquidity-mining/Cargo.toml b/pallets/liquidity-mining/Cargo.toml new file mode 100644 index 00000000000..740d141971d --- /dev/null +++ b/pallets/liquidity-mining/Cargo.toml @@ -0,0 +1,62 @@ +[package] +name = "pallet-liquidity-mining" +version = "4.2.5" +description = "Liquidity mining" +authors = ["GalacticCouncil"] +edition = "2021" +homepage = "https://github.com/galacticcouncil/warehouse" +license = "Apache 2.0" +repository = "https://github.com/galacticcouncil/warehouse" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.4.0", features = ["derive", "max-encoded-len"], default-features = false } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +sp-arithmetic = { workspace = true } + +pallet-asset-registry = { workspace = true } + +# ORML dependencies +orml-traits = { workspace = true } + +# HydraDX dependencies +hydradx-traits = { workspace = true } +hydra-dx-math = { workspace = true } + +# Substrate dependencies +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } + +[dev-dependencies] +test-utils = { workspace = true } +sp-io = { workspace = true } +sp-core = { workspace = true } +orml-tokens = { workspace = true } +pallet-balances = { workspace = true } +# This can be updated to lates after rust update(>=1.61) +fixed = { version = "=1.15.0", default-features = false } +proptest = "1.0.0" +pretty_assertions = "1.2.1" +rand = "0.8.5" + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-support/std", + "frame-system/std", + "sp-std/std", + "orml-traits/std", + "orml-tokens/std", + "pallet-balances/std", + "hydradx-traits/std", + "sp-arithmetic/std", + "sp-runtime/std", + "scale-info/std", + "hydra-dx-math/std", +] +try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/liquidity-mining/src/lib.rs b/pallets/liquidity-mining/src/lib.rs new file mode 100644 index 00000000000..34120ea4c06 --- /dev/null +++ b/pallets/liquidity-mining/src/lib.rs @@ -0,0 +1,1914 @@ +// This file is part of galacticcouncil/warehouse. +// 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. +// +// Abbr: +// rpvs - reward per valued share +// rpz - reward per share in global farm + +// Notion spec naming map: +// * shares -> s +// * total_shares -> S +// * valued_shares -> s' +// * total_valued_shares -> S' +// * stake_in_global_pool -> z +// * total_shares_z -> Z +// * multiplier -> m + +//! # Liquidity mining pallet +//! +//! ## Overview +//! +//! This pallet provides functionality for a liquidity mining program with a time incentive (loyalty +//! factor) and multiple incentives scheme. +//! Users are rewarded for each period they stay in the liq. mining program. +//! +//! Reward per one period is derived from the user's loyalty factor which grows with time (periods) +//! the user is in the liq. mining program and the amount of LP shares the user locked into deposit. +//! User's loyalty factor is reset if the user exits and reenters liquidity mining. +//! User can claim rewards without resetting loyalty factor, only withdrawing shares +//! is penalized by loyalty factor reset. +//! The user is rewarded from the next period after they enters. +//! +//! Multiple Incentives +//! +//! This feature allows users to redeposit already deposited LP shares to multiple yield farms and +//! receive incentives from these farms. +//! Deposit in yield farm is called "farm entry". +//! Maximal number of redepositing same LP shares is configured by variable: `MaxFarmEntriesPerDeposit`. +//! Set `MaxFarmEntriesPerDeposit` to `1` to disable multiple incentives scheme. !!!NEVER set this +//! variable to `0`. +//! LP shares can be redeposited only to different yield farms running liquidity mining for same +//! pair of assets. +//! +//! Notes: +//! * LP shares are returned ONLY if deposit is destroyed - withdrawing LP shares can +//! be used to "free slot" for re-lock LP shares to different yield farm. Withdrawing LP shares result in +//! resetting loyalty factor for yield farm user is withdrawing from(other farm entries in the +//! deposit are not affected). If deposit has no more farm entries, deposit is destroyed and LP +//! shares are returned back to user. +//! * `YieldFarm` - can be in the 3 states: [`Active`, `Stopped`, `Terminated`] +//! * `Active` - liquidity mining is running, users are able to deposit, claim and withdraw LP +//! shares. `YieldFarm` is rewarded from `GlobalFarm` in this state. +//! * `Stopped` - liquidity mining is stopped. Users can claim and withdraw LP shares from the +//! farm. Users CAN'T deposit new LP shares to stopped farm. Stopped farm is not rewarded from the +//! `GlobalFarm`. +//! Note: stopped farm can be resumed or destroyed. +//! * `Terminated` - liquidity mining is ended. User's CAN'T deposit or claim rewards from +//! stopped farm. Users CAN only withdraw LP shares(without rewards). +//! `YieldFarm` must be stopped before it can be terminated. Terminated farm stays in the storage +//! until last farm's entry is withdrawn. Last withdrawn from yield farm will remove terminated +//! farm from the storage. +//! Note: Terminated farm CAN'T be resumed. +//! * `GlobalFarm` - can be in the 2 states: [`Active`, `Terminated`] +//! * `Active` - liquidity mining program is running, new yield farms can be added to the +//! global farm. +//! * `Terminated` - liquidity mining program is ended. Yield farms can't be added to the global +//! farm. Global farm MUST be empty(all yield farms in the global farm must be destroyed) +//! before it can be destroyed. Destroying global farm transfer undistributed rewards to farm's +//! owner. Terminated global farm stay in the storage until all yield farms are removed from +//! the storage. Last yield farm removal from storage triggers global farm removal from +//! storage. +//! Note: Terminated global farm CAN'T be resumed. +//! * Pot - account holding all rewards allocated for all `YieldFarm`s from all `GlobalFarm`s. +//! User's rewards are transferred from `pot`'s account to user's accounts. +//! + +#![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::derive_partial_eq_without_eq)] + +#[cfg(test)] +mod tests; +mod types; + +pub use pallet::*; + +pub use crate::types::{ + Balance, DefaultPriceAdjustment, DepositData, DepositId, FarmId, FarmMultiplier, FarmState, GlobalFarmData, + GlobalFarmId, LoyaltyCurve, YieldFarmData, YieldFarmEntry, YieldFarmId, +}; +use codec::{Decode, Encode, FullCodec}; +use frame_support::{ + defensive, + pallet_prelude::*, + require_transactional, + sp_runtime::{ + traits::{AccountIdConversion, BlockNumberProvider, MaybeSerializeDeserialize, One, Zero}, + RuntimeDebug, + }, + traits::{Defensive, DefensiveOption}, + PalletId, +}; + +use frame_system::pallet_prelude::BlockNumberFor; +use sp_runtime::ArithmeticError; + +use hydra_dx_math::liquidity_mining as math; +use hydradx_traits::{liquidity_mining::PriceAdjustment, pools::DustRemovalAccountWhitelist}; +use pallet_asset_registry::traits::Registry; +use orml_traits::{GetByKey, MultiCurrency}; +use scale_info::TypeInfo; +use sp_arithmetic::{ + fixed_point::FixedU128, + traits::{CheckedAdd, CheckedDiv, CheckedSub}, + Perquintill, +}; +use sp_std::{ + convert::{From, Into, TryInto}, + vec::Vec, +}; + +type PeriodOf = BlockNumberFor; + +//WARN: MIN_YIELD_FARM_MULTIPLIER.check_mul_int(MIN_DEPOSIT) >= 1. This rule is important otherwise +//non-zero deposit can result in a zero stake in global-farm and farm can be falsely identified as +//empty. https://github.com/galacticcouncil/warehouse/issues/127 +/// Min value farm's owner can set as `min_deposit` +pub(crate) const MIN_DEPOSIT: Balance = 1_000; +/// Min value farm's owner can set as yield-farm's `multiplier` +pub(crate) const MIN_YIELD_FARM_MULTIPLIER: FixedU128 = FixedU128::from_inner(1_000_000_000_000_000); + +#[frame_support::pallet] +pub mod pallet { + use super::*; + + #[pallet::pallet] + pub struct Pallet(PhantomData<(T, I)>); + + #[pallet::hooks] + impl, I: 'static> Hooks> for Pallet { + fn integrity_test() { + assert!( + T::MaxFarmEntriesPerDeposit::get().ge(&1_u32), + "`T::MaxFarmEntriesPerDeposit` must be greater or equal to 1" + ); + } + } + + #[pallet::genesis_config] + #[derive(frame_support::DefaultNoBound)] + pub struct GenesisConfig, I: 'static = ()> { + #[serde(skip)] + pub _phantom: PhantomData<(T, I)>, + } + + #[pallet::genesis_build] + impl, I: 'static> BuildGenesisConfig for GenesisConfig { + fn build(&self) { + let pot = >::pot_account_id().unwrap(); + + T::NonDustableWhitelistHandler::add_account(&pot).unwrap(); + } + } + + #[pallet::config] + pub trait Config: frame_system::Config + TypeInfo { + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + /// Asset type. + type AssetId: Parameter + Member + Copy + MaybeSerializeDeserialize + MaxEncodedLen + Into; + + /// Currency for transfers. + type MultiCurrency: MultiCurrency; + + /// Pallet id. + #[pallet::constant] + type PalletId: Get; + + /// Minimum total rewards to distribute from global farm during liquidity mining. + #[pallet::constant] + type MinTotalFarmRewards: Get; + + /// Minimum number of periods to run liquidity mining program. + #[pallet::constant] + type MinPlannedYieldingPeriods: Get>; + + /// The block number provider + type BlockNumberProvider: BlockNumberProvider>; + + /// Id used to identify amm pool in liquidity mining pallet. + type AmmPoolId: Parameter + Member + Clone + FullCodec + MaxEncodedLen; + + /// Maximum number of yield farms same LP shares can be re/deposited into. This value always + /// MUST BE >= 1. + #[pallet::constant] + type MaxFarmEntriesPerDeposit: Get; + + /// Max number of yield farms can exist in global farm. This includes all farms in the + /// storage(active, stopped, terminated). + #[pallet::constant] + type MaxYieldFarmsPerGlobalFarm: Get; + + /// Asset Registry - used to check if asset is correctly registered in asset registry and + /// provides information about existential deposit of the asset. + type AssetRegistry: Registry, Balance, DispatchError> + GetByKey; + + /// Account whitelist manager to exclude pool accounts from dusting mechanism. + type NonDustableWhitelistHandler: DustRemovalAccountWhitelist; + + type PriceAdjustment: PriceAdjustment< + GlobalFarmData, + Error = DispatchError, + PriceAdjustment = FixedU128, + >; + } + + #[pallet::error] + #[cfg_attr(test, derive(Eq, PartialEq))] + pub enum Error { + /// Global farm does not exist. + GlobalFarmNotFound, + + /// Yield farm does not exist. + YieldFarmNotFound, + + /// Multiple claims in the same period is not allowed. + DoubleClaimInPeriod, + + /// Liquidity mining is canceled. + LiquidityMiningCanceled, + + /// Liquidity mining is not canceled. + LiquidityMiningIsActive, + + /// Liquidity mining is in `active` or `terminated` state and action cannot be completed. + LiquidityMiningIsNotStopped, + + /// LP shares amount is not valid. + InvalidDepositAmount, + + /// Account is not allowed to perform action. + Forbidden, + + /// Yield farm multiplier can't be 0. + InvalidMultiplier, + + /// Yield farm with given `amm_pool_id` already exists in global farm. + YieldFarmAlreadyExists, + + /// Loyalty curve's initial reward percentage is not valid. Valid range is: [0, 1). + InvalidInitialRewardPercentage, + + /// One or more yield farms exist in global farm. + GlobalFarmIsNotEmpty, + + /// Farm's `incentivized_asset` is missing in provided asset pair. + MissingIncentivizedAsset, + + /// Reward currency balance is not sufficient. + InsufficientRewardCurrencyBalance, + + /// Blocks per period can't be 0. + InvalidBlocksPerPeriod, + + /// Yield per period can't be 0. + InvalidYieldPerPeriod, + + /// Total rewards is less than `MinTotalFarmRewards`. + InvalidTotalRewards, + + /// Planned yielding periods is less than `MinPlannedYieldingPeriods`. + InvalidPlannedYieldingPeriods, + + /// Maximum number of locks reached for deposit. + MaxEntriesPerDeposit, + + /// Trying to lock LP shares into already locked yield farm. + DoubleLock, + + /// Yield farm entry doesn't exist for given deposit. + YieldFarmEntryNotFound, + + /// Max number of yield farms in global farm was reached. Global farm can't accept new + /// yield farms until some yield farm is not removed from storage. + GlobalFarmIsFull, + + /// Invalid min. deposit was set for global farm. + InvalidMinDeposit, + + /// Price adjustment multiplier can't be 0. + InvalidPriceAdjustment, + + /// Account creation from id failed. + ErrorGetAccountId, + + /// Value of deposited shares amount in reward currency is bellow min. limit. + IncorrectValuedShares, + + /// `reward_currency` is not registered in asset registry. + RewardCurrencyNotRegistered, + + /// `incentivized_asset` is not registered in asset registry. + IncentivizedAssetNotRegistered, + + /// Action cannot be completed because unexpected error has occurred. This should be reported + /// to protocol maintainers. + InconsistentState(InconsistentStateError), + } + + //NOTE: these errors should never happen. + #[derive(Encode, Decode, Eq, PartialEq, TypeInfo, frame_support::PalletError, RuntimeDebug)] + pub enum InconsistentStateError { + /// Yield farm does not exist. + YieldFarmNotFound, + + /// Global farm does not exist. + GlobalFarmNotFound, + + /// Liquidity mining is `stopped` or `terminated`. + LiquidityIsNotActive, + + /// Global farm is terminated. + GlobalFarmIsNotActive, + + /// Deposit does not exist. + DepositNotFound, + + /// Period calculation overflow. + InvalidPeriod, + + /// Rewards allocated for yield-farm are lower then calculated rewards. + NotEnoughRewardsInYieldFarm, + + /// Global-farm's `live_yield_farms_count` calculation overflow. + InvalidLiveYielFarmsCount, + + /// Global-farm's `total_yield_farms_count` calculation overflow. + InvalidTotalYieldFarmsCount, + + /// Yield-farm's entries count calculation overflow. + InvalidYieldFarmEntriesCount, + + /// Yield-farm's `total_shares` calculation overflow. + InvalidTotalShares, + + /// Yield-farm's `valued_shares` calculation overflow. + InvalidValuedShares, + + /// Global-farm's `total_shares_z` calculation overflow. + InvalidTotalSharesZ, + + /// Global-farm's `paid_accumulated_rewards` calculation overflow. + InvalidPaidAccumulatedRewards, + + /// `FarmId` can't be 0. + InvalidFarmId, + + /// Loyalty multiplier can't be greater than one. + InvalidLoyaltyMultiplier, + } + + impl From for Error { + fn from(e: InconsistentStateError) -> Error { + Error::::InconsistentState(e) + } + } + + /// Id sequencer for `GlobalFarm` and `YieldFarm`. + #[pallet::storage] + #[pallet::getter(fn last_farm_id)] + pub type FarmSequencer, I: 'static = ()> = StorageValue<_, FarmId, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn deposit_id)] + pub type DepositSequencer, I: 'static = ()> = StorageValue<_, DepositId, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn global_farm)] + pub type GlobalFarm, I: 'static = ()> = + StorageMap<_, Blake2_128Concat, GlobalFarmId, GlobalFarmData, OptionQuery>; + + /// Yield farm details. + #[pallet::storage] + #[pallet::getter(fn yield_farm)] + pub type YieldFarm, I: 'static = ()> = StorageNMap< + _, + ( + NMapKey, + NMapKey, + NMapKey, + ), + YieldFarmData, + OptionQuery, + >; + + /// Deposit details. + #[pallet::storage] + #[pallet::getter(fn deposit)] + pub type Deposit, I: 'static = ()> = + StorageMap<_, Twox64Concat, DepositId, DepositData, OptionQuery>; + + /// Active(farms able to receive LP shares deposits) yield farms. + #[pallet::storage] + #[pallet::getter(fn active_yield_farm)] + pub type ActiveYieldFarm, I: 'static = ()> = + StorageDoubleMap<_, Blake2_128Concat, T::AmmPoolId, Blake2_128Concat, GlobalFarmId, YieldFarmId>; + + #[pallet::event] + #[pallet::generate_deposit(pub(crate) fn deposit_event)] + pub enum Event, I: 'static = ()> { + /// Global farm accumulated reward per share was updated. + GlobalFarmAccRPZUpdated { + global_farm_id: GlobalFarmId, + accumulated_rpz: FixedU128, + total_shares_z: Balance, + }, + + /// Yield farm accumulated reward per valued share was updated. + YieldFarmAccRPVSUpdated { + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + accumulated_rpvs: FixedU128, + total_valued_shares: Balance, + }, + + /// Global farm has no more rewards to distribute in the moment. + AllRewardsDistributed { global_farm_id: GlobalFarmId }, + } + + #[pallet::call] + impl, I: 'static> Pallet {} +} + +impl, I: 'static> Pallet { + /// Create a new liquidity mining program with provided parameters. + /// + /// `owner` account has to have at least `total_rewards` balance. These funds will be + /// transferred from `owner` to farm account. + /// + /// Returns: `(GlobalFarmId, max reward per period)` + /// + /// Parameters: + /// - `total_rewards`: total rewards planned to distribute. These rewards will be + /// distributed between all yield farms in the global farm. + /// - `planned_yielding_periods`: planned number of periods to distribute `total_rewards`. + /// WARN: THIS IS NOT HARD DEADLINE. Not all rewards have to be distributed in + /// `planned_yielding_periods`. Rewards are distributed based on the situation in the yield + /// farm and can be distributed in a longer, though never in a shorter, time frame. + /// - `blocks_per_period`: number of blocks in a single period. Min. number of blocks per + /// period is 1. + /// - `incentivized_asset`: asset to be incentivized in AMM pools. All yield farms added into + /// global farm must to have `incentivized_asset` in their pair. + /// - `reward_currency`: payoff currency of rewards. + /// - `owner`: liq. mining farm owner. + /// - `yield_per_period`: percentage return on `reward_currency` of all pools. + /// - `min_deposit`: minimum amount of LP shares to be deposited into liquidity mining by each user. + /// - `price_adjustment`: price adjustment between `incentivized_asset` and `reward_currency`. + /// This value should be `1` if `incentivized_asset` and `reward_currency` are the same. + #[allow(clippy::too_many_arguments)] + #[require_transactional] + fn create_global_farm( + total_rewards: Balance, + planned_yielding_periods: PeriodOf, + blocks_per_period: BlockNumberFor, + incentivized_asset: T::AssetId, + reward_currency: T::AssetId, + owner: T::AccountId, + yield_per_period: Perquintill, + min_deposit: Balance, + price_adjustment: FixedU128, + ) -> Result<(GlobalFarmId, Balance), DispatchError> { + Self::validate_create_global_farm_data( + total_rewards, + planned_yielding_periods, + blocks_per_period, + yield_per_period, + min_deposit, + price_adjustment, + )?; + + ensure!( + T::AssetRegistry::exists(reward_currency), + Error::::RewardCurrencyNotRegistered + ); + ensure!( + T::AssetRegistry::exists(incentivized_asset), + Error::::IncentivizedAssetNotRegistered + ); + + T::MultiCurrency::ensure_can_withdraw(reward_currency, &owner, total_rewards) + .map_err(|_| Error::::InsufficientRewardCurrencyBalance)?; + + let planned_periods = + TryInto::::try_into(planned_yielding_periods).map_err(|_| ArithmeticError::Overflow)?; + let max_reward_per_period = total_rewards + .checked_div(planned_periods) + .ok_or(ArithmeticError::DivisionByZero)?; + let current_period = Self::get_current_period(blocks_per_period)?; + let farm_id = Self::get_next_farm_id()?; + + let global_farm = GlobalFarmData::new( + farm_id, + current_period, + reward_currency, + yield_per_period, + planned_yielding_periods, + blocks_per_period, + owner, + incentivized_asset, + max_reward_per_period, + min_deposit, + price_adjustment, + ); + + >::insert(global_farm.id, &global_farm); + + let global_farm_account = Self::farm_account_id(global_farm.id)?; + + T::NonDustableWhitelistHandler::add_account(&global_farm_account)?; + T::MultiCurrency::transfer(reward_currency, &global_farm.owner, &global_farm_account, total_rewards)?; + + Ok((farm_id, max_reward_per_period)) + } + + /// Update global farm's price adjustment. + /// + /// Only farm's owner can perform this action. + /// + /// Parameters: + /// - `who`: farm's owner + /// - `global_farm_id`: global farm id. + /// - `price_adjustment`: new price adjustment value. + fn update_global_farm_price_adjustment( + who: T::AccountId, + global_farm_id: GlobalFarmId, + price_adjustment: FixedU128, + ) -> Result<(), DispatchError> { + ensure!(!price_adjustment.is_zero(), Error::::InvalidPriceAdjustment); + + >::try_mutate(global_farm_id, |maybe_global_farm| { + let global_farm = maybe_global_farm.as_mut().ok_or(Error::::GlobalFarmNotFound)?; + + ensure!(global_farm.state.is_active(), Error::::GlobalFarmNotFound); + + ensure!(who == global_farm.owner, Error::::Forbidden); + + let current_period = Self::get_current_period(global_farm.blocks_per_period)?; + Self::sync_global_farm(global_farm, current_period)?; + + global_farm.price_adjustment = price_adjustment; + + Ok(()) + }) + } + + /// Terminate existing liquidity mining program. Undistributed rewards are transferred to + /// owner(`who`). + /// + /// Only farm's owner can perform this action. + /// + /// WARN: To successfully terminate a global farm, farm have to be empty(all yield farms in the + /// global farm must be terminated) + /// + /// Returns: `(reward currency, undistributed rewards, destination account)` + /// + /// Parameters: + /// - `who`: farm's owner. + /// - `farm_id`: id of farm to be terminated. + #[require_transactional] + fn terminate_global_farm( + who: T::AccountId, + farm_id: GlobalFarmId, + ) -> Result<(T::AssetId, Balance, T::AccountId), DispatchError> { + >::try_mutate_exists(farm_id, |maybe_global_farm| { + let global_farm = maybe_global_farm.as_mut().ok_or(Error::::GlobalFarmNotFound)?; + + ensure!(who == global_farm.owner, Error::::Forbidden); + + ensure!(global_farm.state.is_active(), Error::::GlobalFarmNotFound); + + ensure!(!global_farm.has_live_farms(), Error::::GlobalFarmIsNotEmpty); + + let global_farm_account = Self::farm_account_id(global_farm.id)?; + let undistributed_rewards = + T::MultiCurrency::free_balance(global_farm.reward_currency, &global_farm_account); + + T::MultiCurrency::transfer( + global_farm.reward_currency, + &global_farm_account, + &who, + undistributed_rewards, + )?; + + //Mark for removal from storage on last `YieldFarm` in the farm removed. + global_farm.state = FarmState::Terminated; + + //NOTE: Nothing can be send to this account because `YieldFarm`'s has to be terminated + //first so it can be dusted. + T::NonDustableWhitelistHandler::remove_account(&global_farm_account)?; + + let reward_currency = global_farm.reward_currency; + if global_farm.can_be_removed() { + *maybe_global_farm = None; + } + + Ok((reward_currency, undistributed_rewards, who)) + }) + } + + /// Add yield farm to global farm and start liquidity mining for given assets pair. + /// + /// Only farm owner can perform this action. + /// + /// One of the AMM assets has to be `incentivized_token`. Same AMM can be + /// in the same farm only once. + /// + /// Returns: `(YieldFarmId)` + /// + /// Parameters: + /// - `who`: farm's owner + /// - `global_farm_id`: farm id to which a yield farm will be added. + /// - `multiplier`: yield farm multiplier. + /// - `loyalty_curve`: curve to calculate loyalty multiplier to distribute rewards to users + /// with time incentive. `None` means no loyalty multiplier. + /// - `amm_pool_id`: identifier of the AMM pool. + /// - `assets`: list of assets in the AMM pool. One of this assets must be incentivized asset + #[require_transactional] + fn create_yield_farm( + who: T::AccountId, + global_farm_id: GlobalFarmId, + multiplier: FarmMultiplier, + loyalty_curve: Option, + amm_pool_id: T::AmmPoolId, + assets: Vec, + ) -> Result { + ensure!( + multiplier >= MIN_YIELD_FARM_MULTIPLIER, + Error::::InvalidMultiplier + ); + + if let Some(ref curve) = loyalty_curve { + ensure!( + curve.initial_reward_percentage.lt(&FixedU128::one()), + Error::::InvalidInitialRewardPercentage + ); + } + + >::try_mutate( + global_farm_id, + |maybe_global_farm| -> Result { + let global_farm = maybe_global_farm.as_mut().ok_or(Error::::GlobalFarmNotFound)?; + + //This is basically same as farm not found. + ensure!(global_farm.state.is_active(), Error::::GlobalFarmNotFound); + + ensure!(who == global_farm.owner, Error::::Forbidden); + + ensure!(!global_farm.is_full(), Error::::GlobalFarmIsFull); + + ensure!( + assets.contains(&global_farm.incentivized_asset), + Error::::MissingIncentivizedAsset + ); + + >::try_mutate(amm_pool_id.clone(), global_farm_id, |maybe_active_yield_farm| { + ensure!(maybe_active_yield_farm.is_none(), Error::::YieldFarmAlreadyExists); + + let current_period = Self::get_current_period(global_farm.blocks_per_period)?; + Self::sync_global_farm(global_farm, current_period)?; + + let yield_farm_id = Self::get_next_farm_id()?; + + let yield_farm = + YieldFarmData::new(yield_farm_id, current_period, loyalty_curve.clone(), multiplier); + + >::insert((amm_pool_id, global_farm_id, yield_farm_id), yield_farm); + global_farm.increase_yield_farm_counts()?; + + *maybe_active_yield_farm = Some(yield_farm_id); + + Ok(yield_farm_id) + }) + }, + ) + } + + /// Update yield farm's multiplier. + /// + /// Only farm's owner can perform this action. + /// + /// Returns: `(YieldFarmId)` + /// + /// Parameters: + /// - `who`: farm's owner + /// - `global_farm_id`: global farm id in which yield farm will be updated. + /// - `multiplier`: new yield farm multiplier. + /// - `amm_pool_id`: identifier of the AMM pool. + #[require_transactional] + fn update_yield_farm_multiplier( + who: T::AccountId, + global_farm_id: GlobalFarmId, + amm_pool_id: T::AmmPoolId, + multiplier: FarmMultiplier, + ) -> Result { + ensure!( + multiplier >= MIN_YIELD_FARM_MULTIPLIER, + Error::::InvalidMultiplier + ); + + let yield_farm_id = + Self::active_yield_farm(amm_pool_id.clone(), global_farm_id).ok_or(Error::::YieldFarmNotFound)?; + + >::try_mutate((amm_pool_id, global_farm_id, yield_farm_id), |maybe_yield_farm| { + //NOTE: yield-farm must exist if it's in the active_yield_farm storage. + let yield_farm = maybe_yield_farm + .as_mut() + .defensive_ok_or::>(InconsistentStateError::YieldFarmNotFound.into())?; + + ensure!(yield_farm.state.is_active(), Error::::LiquidityMiningCanceled); + + >::try_mutate(global_farm_id, |maybe_global_farm| { + //NOTE: global-farm must exist if yield-farm exists. + let global_farm = maybe_global_farm + .as_mut() + .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; + + ensure!(who == global_farm.owner, Error::::Forbidden); + + let old_stake_in_global_farm = + math::calculate_global_farm_shares(yield_farm.total_valued_shares, yield_farm.multiplier) + .map_err(|_| ArithmeticError::Overflow)?; + + let current_period = Self::get_current_period(global_farm.blocks_per_period)?; + Self::sync_global_farm(global_farm, current_period)?; + Self::sync_yield_farm(yield_farm, global_farm, current_period)?; + + let new_stake_in_global_farm = + math::calculate_global_farm_shares(yield_farm.total_valued_shares, multiplier) + .map_err(|_| ArithmeticError::Overflow)?; + + global_farm.remove_stake(old_stake_in_global_farm)?; + global_farm.add_stake(new_stake_in_global_farm)?; + + yield_farm.multiplier = multiplier; + + Ok(yield_farm.id) + }) + }) + } + + /// Stop liquidity mining for specific yield farm. + /// + /// This function claims rewards from `GlobalFarm` for the last time and stops yield farm + /// incentivization from a `GlobalFarm`. Users will be able to only claim and withdraw LP + /// shares after calling this function. + /// `deposit_lp_shares()` is not allowed on stopped yield farm. + /// + /// Returns: `(YieldFarmId)` + /// + /// Only farm owner can perform this action. + /// + /// Parameters: + /// - `who`: farm's owner. + /// - `global_farm_id`: farm id in which yield farm will be stopped. + /// - `amm_pool_id`: identifier of the AMM pool. + #[require_transactional] + fn stop_yield_farm( + who: T::AccountId, + global_farm_id: GlobalFarmId, + amm_pool_id: T::AmmPoolId, + ) -> Result { + >::try_mutate_exists( + amm_pool_id.clone(), + global_farm_id, + |maybe_active_yield_farm_id| -> Result { + let yield_farm_id = maybe_active_yield_farm_id + .as_ref() + .ok_or(Error::::YieldFarmNotFound)?; + + >::try_mutate( + (amm_pool_id, global_farm_id, yield_farm_id), + |maybe_yield_farm| -> Result<(), DispatchError> { + //NOTE: yield-farm must exist if it's in the active_yield_farm storage. + let yield_farm = maybe_yield_farm + .as_mut() + .defensive_ok_or::>(InconsistentStateError::YieldFarmNotFound.into())?; + + //NOTE: inactive yield-farm can't be in the active_yield_farm storage. + ensure!( + yield_farm.state.is_active(), + Self::defensive_err(Error::::InconsistentState( + InconsistentStateError::LiquidityIsNotActive + )) + ); + + >::try_mutate(global_farm_id, |maybe_global_farm| { + //NOTE: global-farm must exist when yield-farm exists. + let global_farm = maybe_global_farm + .as_mut() + .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; + + ensure!(global_farm.owner == who, Error::::Forbidden); + + let current_period = Self::get_current_period(global_farm.blocks_per_period)?; + Self::sync_global_farm(global_farm, current_period)?; + Self::sync_yield_farm(yield_farm, global_farm, current_period)?; + + let old_stake_in_global_farm = math::calculate_global_farm_shares( + yield_farm.total_valued_shares, + yield_farm.multiplier, + ) + .map_err(|_| ArithmeticError::Overflow)?; + + global_farm.remove_stake(old_stake_in_global_farm)?; + + yield_farm.state = FarmState::Stopped; + yield_farm.multiplier = FarmMultiplier::default(); + + Ok(()) + }) + }, + )?; + + let yield_farm_id = *yield_farm_id; + //Remove yield farm from active farms storage. + *maybe_active_yield_farm_id = None; + + Ok(yield_farm_id) + }, + ) + } + + /// Resume liquidity mining for stopped yield farm. + /// + /// This function resume incentivization from `GlobalPool` and restore full functionality + /// for yield farm. Users will be able to deposit, claim and withdraw again. + /// + /// Yield farm is not rewarded for the time it was stopped. + /// + /// Only farm's owner can perform this action. + /// + /// Parameters: + /// - `who`: farm's owner + /// - `global_farm_id`: farm id in which yield farm will be resumed. + /// - `yield_farm_id`: id of yield farm to resume. + /// - `amm_pool_id`: identifier of the AMM pool. + /// - `multiplier`: yield farm's multiplier. + #[require_transactional] + fn resume_yield_farm( + who: T::AccountId, + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + amm_pool_id: T::AmmPoolId, + multiplier: FarmMultiplier, + ) -> Result<(), DispatchError> { + ensure!( + multiplier >= MIN_YIELD_FARM_MULTIPLIER, + Error::::InvalidMultiplier + ); + + >::try_mutate(amm_pool_id.clone(), global_farm_id, |maybe_active_yield_farm_id| { + ensure!( + maybe_active_yield_farm_id.is_none(), + Error::::YieldFarmAlreadyExists + ); + + >::try_mutate((amm_pool_id, global_farm_id, yield_farm_id), |maybe_yield_farm| { + let yield_farm = maybe_yield_farm.as_mut().ok_or(Error::::YieldFarmNotFound)?; + + //Active or terminated yield farms can't be resumed. + ensure!( + yield_farm.state.is_stopped(), + Error::::LiquidityMiningIsNotStopped + ); + + >::try_mutate(global_farm_id, |maybe_global_farm| { + //NOTE: global-farm must exist if yield-farm exists. + let global_farm = maybe_global_farm + .as_mut() + .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; + + ensure!(global_farm.owner == who, Error::::Forbidden); + + let current_period = Self::get_current_period(global_farm.blocks_per_period)?; + Self::sync_global_farm(global_farm, current_period)?; + + //NOTE: this should never fail. + let stopped_periods = current_period + .checked_sub(&yield_farm.updated_at) + .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into())?; + + let new_stake_in_global_farm = + math::calculate_global_farm_shares(yield_farm.total_valued_shares, multiplier) + .map_err(|_| ArithmeticError::Overflow)?; + + global_farm.add_stake(new_stake_in_global_farm)?; + + yield_farm.accumulated_rpz = global_farm.accumulated_rpz; + yield_farm.updated_at = current_period; + yield_farm.state = FarmState::Active; + yield_farm.multiplier = multiplier; + yield_farm.total_stopped = yield_farm + .total_stopped + .checked_add(&stopped_periods) + .ok_or(ArithmeticError::Overflow)?; + + //add yield farm to active farms. + *maybe_active_yield_farm_id = Some(yield_farm.id); + + Ok(()) + }) + }) + }) + } + + /// This function marks an yield farm ready for removal from storage when it's empty. Users will + /// be able to only withdraw shares(without claiming rewards from yield farm). Unpaid rewards + /// will be transferred back to global farm and will be used to distribute to other yield farms. + /// + /// Yield farm must be stopped before calling this function. + /// + /// Only farm's owner can perform this action. Yield farm stays in the storage until it's + /// empty(all farm entries are withdrawn). Last withdrawn from yield farm trigger removing from + /// the storage. + /// + /// Parameters: + /// - `who`: farm's owner. + /// - `global_farm_id`: farm id from which yield farm will be removed. + /// - `yield_farm_id`: yield farm id of farm to terminate. + /// - `amm_pool_id`: identifier of the AMM pool. + #[require_transactional] + fn terminate_yield_farm( + who: T::AccountId, + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + amm_pool_id: T::AmmPoolId, + ) -> Result<(), DispatchError> { + ensure!( + >::get(amm_pool_id.clone(), global_farm_id) != Some(yield_farm_id), + Error::::LiquidityMiningIsActive + ); + + >::try_mutate_exists(global_farm_id, |maybe_global_farm| { + let global_farm = maybe_global_farm.as_mut().ok_or(Error::::GlobalFarmNotFound)?; + + ensure!(global_farm.owner == who, Error::::Forbidden); + + >::try_mutate_exists( + (amm_pool_id, global_farm_id, yield_farm_id), + |maybe_yield_farm| -> Result<(), DispatchError> { + let yield_farm = maybe_yield_farm.as_mut().ok_or(Error::::YieldFarmNotFound)?; + + //Only stopped farms can be resumed. + ensure!( + yield_farm.state.is_stopped(), + Error::::LiquidityMiningIsNotStopped + ); + + //Transfer yield-farm's unpaid rewards back to global farm. + let global_farm_account = Self::farm_account_id(global_farm.id)?; + let pot = Self::pot_account_id().ok_or(Error::::ErrorGetAccountId)?; + + global_farm.accumulated_paid_rewards = global_farm + .accumulated_paid_rewards + .checked_sub(yield_farm.left_to_distribute) + .ok_or(ArithmeticError::Overflow)?; + + T::MultiCurrency::transfer( + global_farm.reward_currency, + &pot, + &global_farm_account, + yield_farm.left_to_distribute, + )?; + + yield_farm.left_to_distribute = Zero::zero(); + //Delete yield farm. + yield_farm.state = FarmState::Terminated; + global_farm.decrease_live_yield_farm_count()?; + + //Cleanup if it's possible + if yield_farm.can_be_removed() { + global_farm.decrease_total_yield_farm_count()?; + + *maybe_yield_farm = None; + } + + Ok(()) + }, + )?; + + Ok(()) + }) + } + + /// Deposit LP shares to a yield farm. + /// + /// This function creates new deposit farm entry in the yield farm. + /// + /// Returns: `(DepositId)` + /// + /// Parameters: + /// - `global_farm_id`: global farm identifier. + /// - `yield_farm_id`: yield farm identifier depositing to. + /// - `amm_pool_id`: identifier of the AMM pool. + /// - `shares_amount`: amount of LP shares user want to deposit. + /// - `get_token_value_of_lp_shares`: callback function returning amount of + /// `incentivized_asset` behind `lp_shares`. + #[require_transactional] + fn deposit_lp_shares( + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + amm_pool_id: T::AmmPoolId, + shares_amount: Balance, + get_token_value_of_lp_shares: impl Fn(T::AssetId, T::AmmPoolId, Balance) -> Result, + ) -> Result { + let mut deposit = DepositData::new(shares_amount, amm_pool_id); + + Self::do_deposit_lp_shares( + &mut deposit, + global_farm_id, + yield_farm_id, + get_token_value_of_lp_shares, + )?; + + //Save deposit to storage. + let deposit_id = Self::get_next_deposit_id()?; + >::insert(deposit_id, deposit); + + Ok(deposit_id) + } + + /// This function create yield farm entry for existing deposit. LP shares are not transferred + /// and amount of LP shares is based on existing deposit. + /// + /// This function DOESN'T create new deposit. + /// + /// Returns: `(redeposited shares amount, amm pool id)` + /// + /// Parameters: + /// - `global_farm_id`: global farm identifier. + /// - `yield_farm_id`: yield farm identifier redepositing to. + /// - `deposit_id`: identifier of the AMM pool. + /// - `get_token_value_of_lp_shares`: callback function returning amount of + /// `incentivized_asset` behind `lp_shares`. + fn redeposit_lp_shares( + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + deposit_id: DepositId, + get_token_value_of_lp_shares: impl Fn(T::AssetId, T::AmmPoolId, Balance) -> Result, + ) -> Result<(Balance, T::AmmPoolId), DispatchError> { + >::try_mutate(deposit_id, |maybe_deposit| { + //NOTE: At this point deposit existence and owner must be checked by pallet calling this + //function so this should never happen. + let deposit = maybe_deposit + .as_mut() + .defensive_ok_or::>(InconsistentStateError::DepositNotFound.into())?; + + Self::do_deposit_lp_shares(deposit, global_farm_id, yield_farm_id, get_token_value_of_lp_shares)?; + + Ok((deposit.shares, deposit.amm_pool_id.clone())) + }) + } + + /// Claim rewards from yield farm for given deposit. + /// + /// This function calculate user rewards from yield farm and transfer rewards to `who` + /// account. Claiming in the same period is configured by `check_double_claim` parameter. + /// Second claim in the same period result in `0` claims. This is desirable for in case we need + /// `unclaimable_rewards` e.g. for `withdraw_lp_shares()` + /// + /// WARN: User have to use `withdraw_shares()` if yield farm is terminated. + /// + /// Returns: `(GlobalFarmId, reward currency, claimed amount, unclaimable amount)` + /// + /// Parameters: + /// - `who`: destination account to receive rewards. + /// - `deposit_id`: id representing deposit in the yield farm. + /// - `yield_farm_id`: identifier of yield farm to withdrawn from. + /// - `check_double_claim`: fn failed on second claim in the same period if set to `true`. + #[require_transactional] + fn claim_rewards( + who: T::AccountId, + deposit_id: DepositId, + yield_farm_id: YieldFarmId, + fail_on_doubleclaim: bool, + ) -> Result<(GlobalFarmId, T::AssetId, Balance, Balance), DispatchError> { + >::try_mutate(deposit_id, |maybe_deposit| { + //NOTE: At this point deposit existence and owner must be checked by pallet calling this + //function so this should never happen. + let deposit = maybe_deposit + .as_mut() + .defensive_ok_or::>(InconsistentStateError::DepositNotFound.into())?; + + let amm_pool_id = deposit.amm_pool_id.clone(); + let farm_entry = deposit + .get_yield_farm_entry(yield_farm_id) + .ok_or(Error::::YieldFarmEntryNotFound)?; + + >::try_mutate( + (amm_pool_id, farm_entry.global_farm_id, yield_farm_id), + |maybe_yield_farm| { + //NOTE: yield-farm must exist if yield-farm-entry exists. + let yield_farm = maybe_yield_farm + .as_mut() + .defensive_ok_or::>(InconsistentStateError::YieldFarmNotFound.into())?; + + ensure!( + !yield_farm.state.is_terminated(), + Error::::LiquidityMiningCanceled + ); + + >::try_mutate(farm_entry.global_farm_id, |maybe_global_farm| { + //NOTE: global-farm must exist if yield-farm exists. + let global_farm = maybe_global_farm + .as_mut() + .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; + + let current_period = Self::get_current_period(global_farm.blocks_per_period)?; + //Double claim should be allowed in some case e.g withdraw_lp_shares need + //`unclaimable_rewards` returned by this function. + if fail_on_doubleclaim { + ensure!( + farm_entry.updated_at != current_period, + Error::::DoubleClaimInPeriod + ); + } + + Self::sync_global_farm(global_farm, current_period)?; + Self::sync_yield_farm(yield_farm, global_farm, current_period)?; + + //NOTE: this should never fail yield-farm's stopped must be >= entry's + //stopped + let delta_stopped = + yield_farm + .total_stopped + .checked_sub(&farm_entry.stopped_at_creation) + .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into())?; + + //NOTE: yield-farm's `updated_at` is updated to current period if it's + //possible so this should be ok. + let periods = yield_farm + .updated_at + .checked_sub(&farm_entry.entered_at) + .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into())? + .checked_sub(&delta_stopped) + .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into())?; + + let loyalty_multiplier = + Self::get_loyalty_multiplier(periods, yield_farm.loyalty_curve.clone())?; + + let (rewards, unclaimable_rewards) = math::calculate_user_reward( + farm_entry.accumulated_rpvs, + farm_entry.valued_shares, + farm_entry.accumulated_claimed_rewards, + yield_farm.accumulated_rpvs, + loyalty_multiplier, + ) + .map_err(|_| ArithmeticError::Overflow)?; + + if !rewards.is_zero() { + yield_farm.left_to_distribute = yield_farm + .left_to_distribute + .checked_sub(rewards) + .defensive_ok_or::>( + InconsistentStateError::NotEnoughRewardsInYieldFarm.into(), + )?; + + farm_entry.accumulated_claimed_rewards = farm_entry + .accumulated_claimed_rewards + .checked_add(rewards) + .ok_or(ArithmeticError::Overflow)?; + + farm_entry.updated_at = current_period; + + let pot = Self::pot_account_id().ok_or(Error::::ErrorGetAccountId)?; + T::MultiCurrency::transfer(global_farm.reward_currency, &pot, &who, rewards)?; + } + + Ok(( + global_farm.id, + global_farm.reward_currency, + rewards, + unclaimable_rewards, + )) + }) + }, + ) + }) + } + + /// Withdraw LP shares from yield farm. This function can be used to free slot for yield + /// farm entry in the deposit or to destroy deposit and return LP shares if deposit has no more + /// farm entries. + /// + /// WARNING: This function doesn't automatically claim rewards for user. Caller of this + /// function must call `claim_rewards()` first if claiming is desirable. + /// + /// !!!LP shares are transferred back to user only when deposit is destroyed. + /// + /// This function transfer user's unclaimable rewards back to global farm. + /// + /// Returns: `(GlobalFarmId, withdrawn amount, true if deposit was destroyed)` + /// + /// Parameters: + /// - `deposit_id`: id representing deposit in the yield farm. + /// - `yield_farm_id`: identifier yield farm to withdrawn from. + /// - `unclaimable_rewards`: amount of rewards user will not be able to claim because of early + /// exit from liquidity mining program. + #[require_transactional] + fn withdraw_lp_shares( + deposit_id: DepositId, + yield_farm_id: YieldFarmId, + unclaimable_rewards: Balance, + ) -> Result<(GlobalFarmId, Balance, bool), DispatchError> { + >::try_mutate_exists(deposit_id, |maybe_deposit| { + //NOTE: At this point deposit existence and owner must be checked by pallet calling this + //function so this should never fail. + let deposit = maybe_deposit + .as_mut() + .defensive_ok_or::>(InconsistentStateError::DepositNotFound.into())?; + + let farm_entry = deposit.remove_yield_farm_entry(yield_farm_id)?; + let amm_pool_id = deposit.amm_pool_id.clone(); + + >::try_mutate_exists( + farm_entry.global_farm_id, + |maybe_global_farm| -> Result<(), DispatchError> { + //NOTE: global-farm must exist if yield-farm-entry exists. + let global_farm = maybe_global_farm + .as_mut() + .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; + + >::try_mutate_exists( + (&amm_pool_id, farm_entry.global_farm_id, yield_farm_id), + |maybe_yield_farm| -> Result<(), DispatchError> { + //NOTE: yield-farm must exist if yield-farm-entry exists. + let yield_farm = maybe_yield_farm + .as_mut() + .defensive_ok_or::>(InconsistentStateError::YieldFarmNotFound.into())?; + + yield_farm.total_shares = yield_farm + .total_shares + .checked_sub(deposit.shares) + .defensive_ok_or::>(InconsistentStateError::InvalidTotalShares.into())?; + + yield_farm.total_valued_shares = yield_farm + .total_valued_shares + .checked_sub(farm_entry.valued_shares) + .defensive_ok_or::>(InconsistentStateError::InvalidValuedShares.into())?; + + // yield farm's stake in global farm is set to `0` when farm is + // stopped and yield farm have to be stopped before it's terminated so + // this update is only required for active farms. + if yield_farm.state.is_active() { + let deposit_stake_in_global_farm = + math::calculate_global_farm_shares(farm_entry.valued_shares, yield_farm.multiplier) + .map_err(|_| ArithmeticError::Overflow)?; + + global_farm.remove_stake(deposit_stake_in_global_farm)?; + } + + //NOTE: this should never happen. It's the responsibility of a pallet + //which is using this function to provide `unclaimable_rewards == 0` + //if yield-farm is not claimable. + ensure!( + unclaimable_rewards.is_zero() || !yield_farm.state.is_terminated(), + Self::defensive_err(Error::::InconsistentState( + InconsistentStateError::NotEnoughRewardsInYieldFarm, + )) + ); + if !unclaimable_rewards.is_zero() { + yield_farm.left_to_distribute = yield_farm + .left_to_distribute + .checked_sub(unclaimable_rewards) + .defensive_ok_or::>( + InconsistentStateError::NotEnoughRewardsInYieldFarm.into(), + )?; + + global_farm.accumulated_paid_rewards = global_farm + .accumulated_paid_rewards + .checked_sub(unclaimable_rewards) + .defensive_ok_or::>( + InconsistentStateError::InvalidPaidAccumulatedRewards.into(), + )?; + + let global_farm_account = Self::farm_account_id(global_farm.id)?; + let pot = Self::pot_account_id().ok_or(Error::::ErrorGetAccountId)?; + + T::MultiCurrency::transfer( + global_farm.reward_currency, + &pot, + &global_farm_account, + unclaimable_rewards, + )?; + } + + yield_farm.decrease_entries_count()?; + if yield_farm.can_be_removed() { + global_farm.decrease_total_yield_farm_count()?; + + *maybe_yield_farm = None; + } + + Ok(()) + }, + )?; + + if global_farm.can_be_removed() { + *maybe_global_farm = None; + } + + Ok(()) + }, + )?; + + let withdrawn_amount = deposit.shares; + let mut deposit_destroyed = false; + if deposit.can_be_removed() { + *maybe_deposit = None; + + deposit_destroyed = true; + } + + Ok((farm_entry.global_farm_id, withdrawn_amount, deposit_destroyed)) + }) + } + + /// Helper function to create yield farm entry. + #[require_transactional] + fn do_deposit_lp_shares( + deposit: &mut DepositData, + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + get_token_value_of_lp_shares: impl Fn(T::AssetId, T::AmmPoolId, Balance) -> Result, + ) -> Result<(), DispatchError> { + //LP shares can be locked only once in the same yield farm. + ensure!( + deposit.search_yield_farm_entry(yield_farm_id).is_none(), + Error::::DoubleLock + ); + + >::try_mutate( + (deposit.amm_pool_id.clone(), global_farm_id, yield_farm_id), + |maybe_yield_farm| { + let yield_farm = maybe_yield_farm.as_mut().ok_or(Error::::YieldFarmNotFound)?; + + ensure!(yield_farm.state.is_active(), Error::::LiquidityMiningCanceled); + + >::try_mutate(global_farm_id, |maybe_global_farm| { + //NOTE: global-farm must exists if yield-farm exists. + let global_farm = maybe_global_farm + .as_mut() + .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; + + ensure!( + deposit.shares.ge(&global_farm.min_deposit), + Error::::InvalidDepositAmount, + ); + + //NOTE: If yield-farm is active also global-farm MUST be active. + ensure!( + global_farm.state.is_active(), + Self::defensive_err(Error::::InconsistentState( + InconsistentStateError::GlobalFarmNotFound + )) + ); + + let current_period = Self::get_current_period(global_farm.blocks_per_period)?; + + Self::sync_global_farm(global_farm, current_period)?; + Self::sync_yield_farm(yield_farm, global_farm, current_period)?; + + let valued_shares = get_token_value_of_lp_shares( + global_farm.incentivized_asset, + deposit.amm_pool_id.clone(), + deposit.shares, + )?; + + ensure!( + valued_shares >= global_farm.min_deposit, + Error::::IncorrectValuedShares + ); + + let deposit_stake_in_global_farm = + math::calculate_global_farm_shares(valued_shares, yield_farm.multiplier) + .map_err(|_| ArithmeticError::Overflow)?; + + yield_farm.total_shares = yield_farm + .total_shares + .checked_add(deposit.shares) + .ok_or(ArithmeticError::Overflow)?; + + yield_farm.total_valued_shares = yield_farm + .total_valued_shares + .checked_add(valued_shares) + .ok_or(ArithmeticError::Overflow)?; + + global_farm.add_stake(deposit_stake_in_global_farm)?; + + let farm_entry = YieldFarmEntry::new( + global_farm.id, + yield_farm.id, + valued_shares, + yield_farm.accumulated_rpvs, + current_period, + yield_farm.total_stopped, + ); + + deposit.add_yield_farm_entry(farm_entry)?; + + //Increment farm's entries count + yield_farm.increase_entries_count()?; + + Ok(()) + }) + }, + ) + } + + /// This function returns new unused `FarmId` usable for yield global farm or error. + fn get_next_farm_id() -> Result { + FarmSequencer::::try_mutate(|current_id| { + *current_id = current_id.checked_add(1).ok_or(ArithmeticError::Overflow)?; + + Ok(*current_id) + }) + } + + /// This function returns new unused `DepositId` or error. + fn get_next_deposit_id() -> Result { + DepositSequencer::::try_mutate(|current_id| { + *current_id = current_id.checked_add(1).ok_or(ArithmeticError::Overflow)?; + + Ok(*current_id) + }) + } + + /// Account id holding rewards allocated from all global farms for all yield farms. + pub fn pot_account_id() -> Option { + T::PalletId::get().try_into_account() + } + + /// This function returns account from `FarmId` or error. + /// + /// WARN: farm_id = 0 is same as `T::PalletId::get().into_account()`. 0 is not valid value. + pub fn farm_account_id(farm_id: FarmId) -> Result> { + Self::validate_farm_id(farm_id)?; + + match T::PalletId::get().try_into_sub_account(farm_id) { + Some(account) => Ok(account), + None => Err(Error::::ErrorGetAccountId), + } + } + + /// This function returns current period number or error. + fn get_current_period(blocks_per_period: BlockNumberFor) -> Result, Error> { + Self::get_period_number(T::BlockNumberProvider::current_block_number(), blocks_per_period) + } + + /// This function returns period number from block number(`block`) and `blocks_per_period` or error. + fn get_period_number( + block: BlockNumberFor, + blocks_per_period: BlockNumberFor, + ) -> Result, Error> { + block + .checked_div(&blocks_per_period) + .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into()) + } + + /// This function returns loyalty multiplier or error. + fn get_loyalty_multiplier(periods: PeriodOf, curve: Option) -> Result { + let curve = match curve { + Some(v) => v, + None => return Ok(FixedU128::one()), //no loyalty curve mean no loyalty multiplier + }; + + let m = math::calculate_loyalty_multiplier(periods, curve.initial_reward_percentage, curve.scale_coef) + .map_err(|_| ArithmeticError::Overflow)?; + + ensure!( + m.le(&FixedU128::one()), + Self::defensive_err(Error::::InconsistentState( + InconsistentStateError::InvalidLoyaltyMultiplier + )) + ); + + Ok(m) + } + + /// This function calculates and updates `accumulated_rpz` and all associated properties of + /// `global_farm` if conditions are met. + /// Returns the reward transferred to the pot. + #[require_transactional] + fn sync_global_farm( + global_farm: &mut GlobalFarmData, + current_period: PeriodOf, + ) -> Result { + // Inactive farm should not be updated + if !global_farm.state.is_active() { + return Ok(Zero::zero()); + } + + // Farm should be updated only once in the same period. + if global_farm.updated_at == current_period { + return Ok(Zero::zero()); + } + + // Nothing to update if there is no stake in the farm. + if global_farm.total_shares_z.is_zero() { + global_farm.updated_at = current_period; + return Ok(Zero::zero()); + } + + let global_farm_account = Self::farm_account_id(global_farm.id)?; + let reward_currency_ed = T::AssetRegistry::get(&global_farm.reward_currency); + let left_to_distribute = T::MultiCurrency::free_balance(global_farm.reward_currency, &global_farm_account) + .saturating_sub(reward_currency_ed); + + // Number of periods since last farm update. + let periods_since_last_update: Balance = TryInto::::try_into( + current_period + .checked_sub(&global_farm.updated_at) + .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into())?, + ) + .map_err(|_| ArithmeticError::Overflow)?; + + if let Ok(price_adjustment) = T::PriceAdjustment::get(global_farm) { + global_farm.price_adjustment = price_adjustment; + } + + // Calculate reward for all periods since last update capped by balance of `GlobalFarm` + // account. + let reward = math::calculate_global_farm_rewards( + global_farm.total_shares_z, + //NOTE: Fallback. Last saved value should be used if oracle is not available. + global_farm.price_adjustment, + global_farm.yield_per_period.into(), + global_farm.max_reward_per_period, + periods_since_last_update, + ) + .map_err(|_| ArithmeticError::Overflow)? + .min(left_to_distribute); + + if !reward.is_zero() { + let pot = Self::pot_account_id().ok_or(Error::::ErrorGetAccountId)?; + T::MultiCurrency::transfer(global_farm.reward_currency, &global_farm_account, &pot, reward)?; + + global_farm.accumulated_rpz = + math::calculate_accumulated_rps(global_farm.accumulated_rpz, global_farm.total_shares_z, reward) + .map_err(|_| ArithmeticError::Overflow)?; + + global_farm.pending_rewards = global_farm + .pending_rewards + .checked_add(reward) + .ok_or(ArithmeticError::Overflow)?; + } else { + Pallet::::deposit_event(Event::AllRewardsDistributed { + global_farm_id: global_farm.id, + }); + } + + global_farm.updated_at = current_period; + + Pallet::::deposit_event(Event::GlobalFarmAccRPZUpdated { + global_farm_id: global_farm.id, + accumulated_rpz: global_farm.accumulated_rpz, + total_shares_z: global_farm.total_shares_z, + }); + + Ok(reward) + } + + /// This function calculates and updates `accumulated_rpvz` and all associated properties of + /// `YieldFarm` if conditions are met. It also calculates yield-farm's rewards from `GlobalFarm`. + /// NOTE: Yield-farm's rewards are staying in the `pot`. + #[require_transactional] + fn sync_yield_farm( + yield_farm: &mut YieldFarmData, + global_farm: &mut GlobalFarmData, + current_period: BlockNumberFor, + ) -> Result<(), DispatchError> { + if !yield_farm.state.is_active() { + return Ok(()); + } + + if yield_farm.updated_at == current_period { + return Ok(()); + } + + if yield_farm.total_valued_shares.is_zero() { + //NOTE: This is important to prevent rewarding of the farms for emtpy periods and it + //also prevents the first user getting more rewards than the second user. + yield_farm.accumulated_rpz = global_farm.accumulated_rpz; + yield_farm.updated_at = current_period; + + return Ok(()); + } + + let (delta_rpvs, yield_farm_rewards) = math::calculate_yield_farm_rewards( + yield_farm.accumulated_rpz, + global_farm.accumulated_rpz, + yield_farm.multiplier, + yield_farm.total_valued_shares, + ) + .map_err(|_| ArithmeticError::Overflow)?; + + yield_farm.accumulated_rpz = global_farm.accumulated_rpz; + + global_farm.accumulated_paid_rewards = global_farm + .accumulated_paid_rewards + .checked_add(yield_farm_rewards) + .ok_or(ArithmeticError::Overflow)?; + + global_farm.pending_rewards = global_farm + .pending_rewards + .checked_sub(yield_farm_rewards) + .ok_or(ArithmeticError::Overflow)?; + + yield_farm.accumulated_rpvs = yield_farm + .accumulated_rpvs + .checked_add(&delta_rpvs) + .ok_or(ArithmeticError::Overflow)?; + + yield_farm.updated_at = current_period; + + yield_farm.left_to_distribute = yield_farm + .left_to_distribute + .checked_add(yield_farm_rewards) + .ok_or(ArithmeticError::Overflow)?; + + Pallet::::deposit_event(Event::YieldFarmAccRPVSUpdated { + global_farm_id: global_farm.id, + yield_farm_id: yield_farm.id, + accumulated_rpvs: yield_farm.accumulated_rpvs, + total_valued_shares: yield_farm.total_valued_shares, + }); + + Ok(()) + } + + /// This function returns an error if `farm_id` is not valid. + fn validate_farm_id(farm_id: FarmId) -> Result<(), Error> { + if farm_id.is_zero() { + return Err(InconsistentStateError::InvalidFarmId.into()).defensive(); + } + + Ok(()) + } + + /// This function is used to validate input data before creating new global farm. + fn validate_create_global_farm_data( + total_rewards: Balance, + planned_yielding_periods: PeriodOf, + blocks_per_period: BlockNumberFor, + yield_per_period: Perquintill, + min_deposit: Balance, + price_adjustment: FixedU128, + ) -> DispatchResult { + ensure!(min_deposit.ge(&MIN_DEPOSIT), Error::::InvalidMinDeposit); + + ensure!(!price_adjustment.is_zero(), Error::::InvalidPriceAdjustment); + + ensure!( + total_rewards >= T::MinTotalFarmRewards::get(), + Error::::InvalidTotalRewards + ); + + ensure!( + planned_yielding_periods >= T::MinPlannedYieldingPeriods::get(), + Error::::InvalidPlannedYieldingPeriods + ); + + ensure!(!blocks_per_period.is_zero(), Error::::InvalidBlocksPerPeriod); + + ensure!(!yield_per_period.is_zero(), Error::::InvalidYieldPerPeriod); + + Ok(()) + } + + // Claiming from `YieldFarm` is not possible(will fail) if yield farm is terminated or has no + // entries. + fn is_yield_farm_claimable( + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + amm_pool_id: T::AmmPoolId, + ) -> bool { + if let Some(yield_farm) = Self::yield_farm((amm_pool_id, global_farm_id, yield_farm_id)) { + return !yield_farm.state.is_terminated() && yield_farm.has_entries(); + } + + false + } + + // This function returns `GlobalFarmId` from deposit's farm entry or `None` if deposit or farm + // entry doesn't exists. + fn get_global_farm_id(id: DepositId, yield_farm_id: YieldFarmId) -> Option { + if let Some(mut deposit) = Self::deposit(id) { + if let Some(farm_entry) = deposit.get_yield_farm_entry(yield_farm_id) { + return Some(farm_entry.global_farm_id); + } + } + + None + } + + #[inline(always)] + fn defensive_err(e: Error) -> Error { + defensive!(e); + e + } +} + +impl, I: 'static> hydradx_traits::liquidity_mining::Mutate> + for Pallet +{ + type Error = DispatchError; + + type AmmPoolId = T::AmmPoolId; + type Balance = Balance; + type Period = PeriodOf; + type LoyaltyCurve = LoyaltyCurve; + + fn create_global_farm( + total_rewards: Self::Balance, + planned_yielding_periods: Self::Period, + blocks_per_period: BlockNumberFor, + incentivized_asset: T::AssetId, + reward_currency: T::AssetId, + owner: T::AccountId, + yield_per_period: Perquintill, + min_deposit: Self::Balance, + price_adjustment: FixedU128, + ) -> Result<(GlobalFarmId, Self::Balance), Self::Error> { + Self::create_global_farm( + total_rewards, + planned_yielding_periods, + blocks_per_period, + incentivized_asset, + reward_currency, + owner, + yield_per_period, + min_deposit, + price_adjustment, + ) + } + + /// This function should be used when external source(e.g. oracle) is used for `price_adjustment` + /// or if `incentivized_asset` and `reward_currency` can't be different. + fn create_global_farm_without_price_adjustment( + total_rewards: Self::Balance, + planned_yielding_periods: Self::Period, + blocks_per_period: BlockNumberFor, + incentivized_asset: T::AssetId, + reward_currency: T::AssetId, + owner: T::AccountId, + yield_per_period: Perquintill, + min_deposit: Self::Balance, + ) -> Result<(GlobalFarmId, Self::Balance), Self::Error> { + Self::create_global_farm( + total_rewards, + planned_yielding_periods, + blocks_per_period, + incentivized_asset, + reward_currency, + owner, + yield_per_period, + min_deposit, + //NOTE: `price_adjustment` == 1 is same as no `price_adjustment` + FixedU128::one(), + ) + } + + fn update_global_farm_price_adjustment( + who: T::AccountId, + global_farm_id: GlobalFarmId, + price_adjustment: FixedU128, + ) -> Result<(), Self::Error> { + Self::update_global_farm_price_adjustment(who, global_farm_id, price_adjustment) + } + + fn terminate_global_farm( + who: T::AccountId, + global_farm_id: u32, + ) -> Result<(T::AssetId, Self::Balance, T::AccountId), Self::Error> { + Self::terminate_global_farm(who, global_farm_id) + } + + fn create_yield_farm( + who: T::AccountId, + global_farm_id: GlobalFarmId, + multiplier: FixedU128, + loyalty_curve: Option, + amm_pool_id: Self::AmmPoolId, + assets: Vec, + ) -> Result { + Self::create_yield_farm(who, global_farm_id, multiplier, loyalty_curve, amm_pool_id, assets) + } + + fn update_yield_farm_multiplier( + who: T::AccountId, + global_farm_id: GlobalFarmId, + amm_pool_id: Self::AmmPoolId, + multiplier: FixedU128, + ) -> Result { + Self::update_yield_farm_multiplier(who, global_farm_id, amm_pool_id, multiplier) + } + + fn stop_yield_farm( + who: T::AccountId, + global_farm_id: GlobalFarmId, + amm_pool_id: Self::AmmPoolId, + ) -> Result { + Self::stop_yield_farm(who, global_farm_id, amm_pool_id) + } + + fn resume_yield_farm( + who: T::AccountId, + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + amm_pool_id: Self::AmmPoolId, + multiplier: FixedU128, + ) -> Result<(), Self::Error> { + Self::resume_yield_farm(who, global_farm_id, yield_farm_id, amm_pool_id, multiplier) + } + + fn terminate_yield_farm( + who: T::AccountId, + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + amm_pool_id: Self::AmmPoolId, + ) -> Result<(), Self::Error> { + Self::terminate_yield_farm(who, global_farm_id, yield_farm_id, amm_pool_id) + } + + fn deposit_lp_shares Result>( + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + amm_pool_id: Self::AmmPoolId, + shares_amount: Self::Balance, + get_token_value_of_lp_shares: F, + ) -> Result { + Self::deposit_lp_shares( + global_farm_id, + yield_farm_id, + amm_pool_id, + shares_amount, + get_token_value_of_lp_shares, + ) + } + + fn redeposit_lp_shares Result>( + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + deposit_id: DepositId, + get_token_value_of_lp_shares: F, + ) -> Result<(Self::Balance, Self::AmmPoolId), Self::Error> { + Self::redeposit_lp_shares(global_farm_id, yield_farm_id, deposit_id, get_token_value_of_lp_shares) + } + + fn claim_rewards( + who: T::AccountId, + deposit_id: DepositId, + yield_farm_id: YieldFarmId, + ) -> Result<(GlobalFarmId, T::AssetId, Self::Balance, Self::Balance), Self::Error> { + let fail_on_doubleclaim = true; + Self::claim_rewards(who, deposit_id, yield_farm_id, fail_on_doubleclaim) + } + + fn withdraw_lp_shares( + who: T::AccountId, + deposit_id: DepositId, + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + amm_pool_id: Self::AmmPoolId, + ) -> Result<(Self::Balance, Option<(T::AssetId, Self::Balance, Self::Balance)>, bool), Self::Error> { + let claim_data = if Self::is_yield_farm_claimable(global_farm_id, yield_farm_id, amm_pool_id) { + let fail_on_doubleclaim = false; + let (_, reward_currency, claimed, unclaimable) = + Self::claim_rewards(who, deposit_id, yield_farm_id, fail_on_doubleclaim)?; + + Some((reward_currency, claimed, unclaimable)) + } else { + None + }; + + let unclaimable = claim_data.map_or(Zero::zero(), |(_, _, unclaimable)| unclaimable); + let (_, withdrawn_amount, deposit_destroyed) = + Self::withdraw_lp_shares(deposit_id, yield_farm_id, unclaimable)?; + + Ok((withdrawn_amount, claim_data, deposit_destroyed)) + } + + fn is_yield_farm_claimable( + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + amm_pool_id: Self::AmmPoolId, + ) -> bool { + Self::is_yield_farm_claimable(global_farm_id, yield_farm_id, amm_pool_id) + } + + fn get_global_farm_id(deposit_id: DepositId, yield_farm_id: YieldFarmId) -> Option { + Self::get_global_farm_id(deposit_id, yield_farm_id) + } +} diff --git a/pallets/liquidity-mining/src/tests/claim_rewards.rs b/pallets/liquidity-mining/src/tests/claim_rewards.rs new file mode 100644 index 00000000000..28cb85db8ae --- /dev/null +++ b/pallets/liquidity-mining/src/tests/claim_rewards.rs @@ -0,0 +1,1265 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use crate::tests::mock::LiquidityMining2; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn claim_rewards_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const FAIL_ON_DOUBLECLAIM: bool = true; + const REWARD_CURRENCY: AssetId = BSX; + let global_farm_id = GC_FARM; + let pot = LiquidityMining::pot_account_id().unwrap(); + let global_farm_account = LiquidityMining::farm_account_id(global_farm_id).unwrap(); + let global_farm_total_rewards_start = 30_000_000_000 * ONE; + + //_0 - value before act. + let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); + let bsx_tkn1_yield_farm_key = (BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID); + let bsx_tkn2_yield_farm_key = (BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + let yield_farm_0 = LiquidityMining::yield_farm(bsx_tkn1_yield_farm_key).unwrap(); + + let expected_claimed_rewards = 23_306_074_766_355_140; + let unclaimable_rewards = 20_443_925_233_644_860; + + //claim A1.1 (dep. A1 1-th time) + assert_eq!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ) + .unwrap(), + ( + global_farm_id, + REWARD_CURRENCY, + expected_claimed_rewards, + unclaimable_rewards + ) + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(), + DepositData { + shares: 50 * ONE, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![YieldFarmEntry { + global_farm_id, + yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, + accumulated_rpvs: Zero::zero(), + accumulated_claimed_rewards: expected_claimed_rewards, + entered_at: 18, + updated_at: 25, + valued_shares: 2_500 * ONE, + stopped_at_creation: 0, + _phantom: PhantomData, + }] + .try_into() + .unwrap(), + }, + ); + + assert_eq!( + LiquidityMining::yield_farm(bsx_tkn1_yield_farm_key) + .unwrap() + .left_to_distribute, + yield_farm_0.left_to_distribute - expected_claimed_rewards + ); + + //Check if claimed rewards are transferred. + assert_eq!( + Tokens::free_balance(BSX, &ALICE), + alice_bsx_balance_0 + expected_claimed_rewards + ); + + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &pot), + pot_balance_0 - expected_claimed_rewards + ); + + // claim B3.1 + set_block_number(3_056); + //_0 - value before act. + let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + let yield_farm_0 = LiquidityMining::yield_farm(bsx_tkn2_yield_farm_key).unwrap(); + + let expected_claimed_rewards = 3_417_857_142_857_142; + let unclaimable_rewards = 3_107_142_857_142_858; + let reserved_for_both_farms = 1_759_975 * ONE; + let claimed_from_global = 1_190_725 * ONE; + + assert_eq!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[4], + GC_BSX_TKN2_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ) + .unwrap(), + ( + global_farm_id, + REWARD_CURRENCY, + expected_claimed_rewards, + unclaimable_rewards + ) + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[4]).unwrap(), + DepositData { + shares: 87 * ONE, + amm_pool_id: BSX_TKN2_AMM, + yield_farm_entries: vec![YieldFarmEntry { + global_farm_id, + yield_farm_id: GC_BSX_TKN2_YIELD_FARM_ID, + valued_shares: 261 * ONE, + accumulated_rpvs: FixedU128::from(35), + accumulated_claimed_rewards: expected_claimed_rewards, + entered_at: 25, + updated_at: 30, + stopped_at_creation: 0, + _phantom: PhantomData, + }] + .try_into() + .unwrap(), + }, + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 30, + accumulated_rpz: FixedU128::from(6), + total_shares_z: 703_990 * ONE, + pending_rewards: 569_250 * ONE, + accumulated_paid_rewards: 2_474_275 * ONE, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 30, + accumulated_rpvs: FixedU128::from(60), + accumulated_rpz: FixedU128::from(6), + total_shares: 960 * ONE, + total_valued_shares: 47_629 * ONE, + entries_count: 4, + left_to_distribute: yield_farm_0.left_to_distribute - expected_claimed_rewards + + claimed_from_global, + ..yield_farm_0 + }, + ); + + //Check if claimed rewards are transferred. + assert_eq!( + Tokens::free_balance(BSX, &ALICE), + alice_bsx_balance_0 + expected_claimed_rewards + ); + + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &pot), + pot_balance_0 + reserved_for_both_farms - expected_claimed_rewards + ); + + //Run for log time(longer than planned_yielding_periods) without interactions with farms. + //planned_yielding_periods = 500; 100 blocks per period + //claim A1.2 + set_block_number(125_879); + //_0 - value before act. + let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); + let bsx_tkn1_yield_farm_key = (BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + let yield_farm_0 = LiquidityMining::yield_farm(bsx_tkn1_yield_farm_key).unwrap(); + + let expected_claimed_rewards = 7_437_514_820_756_032_916; + let unclaimable_rewards = 289_179_104_477_611_944; + + let reserved_for_both_farms = 432_249_860 * ONE; + let yield_farm_claim_from_global = 140_377_050 * ONE; + + assert_eq!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ) + .unwrap(), + ( + global_farm_id, + REWARD_CURRENCY, + expected_claimed_rewards, + unclaimable_rewards + ) + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(), + DepositData { + shares: 50 * ONE, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![YieldFarmEntry { + global_farm_id, + yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, + valued_shares: 2_500 * ONE, + accumulated_rpvs: Zero::zero(), + accumulated_claimed_rewards: 7_460_820_895_522_388_056, + entered_at: 18, + updated_at: 1_258, + stopped_at_creation: 0, + _phantom: PhantomData, + }] + .try_into() + .unwrap(), + }, + ); + + let global_farm_1 = LiquidityMining::global_farm(GC_FARM).unwrap(); + pretty_assertions::assert_eq!( + global_farm_1, + GlobalFarmData { + updated_at: 1_258, + accumulated_rpz: FixedU128::from(620), + total_shares_z: 703_990 * ONE, + pending_rewards: 292_442_060 * ONE, + accumulated_paid_rewards: 142_851_325 * ONE, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 1_258, + accumulated_rpvs: FixedU128::from(3_100), + accumulated_rpz: FixedU128::from(620), + total_shares: 616 * ONE, + total_valued_shares: 45_540 * ONE, + entries_count: 3, + left_to_distribute: yield_farm_0.left_to_distribute + yield_farm_claim_from_global + - expected_claimed_rewards, + ..yield_farm_0 + }, + ); + + //Check if claimed rewards are transferred. + assert_eq!( + Tokens::free_balance(BSX, &ALICE), + alice_bsx_balance_0 + expected_claimed_rewards + ); + + assert_eq!( + Tokens::free_balance(BSX, &pot), + pot_balance_0 + reserved_for_both_farms - expected_claimed_rewards + ); + + let distributed_from_global = + global_farm_total_rewards_start - Tokens::total_balance(REWARD_CURRENCY, &global_farm_account); + + let tracked_distributed_rewards = global_farm_1.accumulated_paid_rewards + global_farm_1.pending_rewards; + + pretty_assertions::assert_eq!(distributed_from_global, tracked_distributed_rewards); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + + //Charlie's farm incentivize KSM and reward currency is ACA. + //This test check if correct currency is transferred if rewards and incentivized + //assets are different, otherwise farm behavior is the same as in tests above. + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const FAIL_ON_DOUBLECLAIM: bool = true; + set_block_number(1_800); //period 18 + + let global_farm_id = CHARLIE_FARM; + let expected_claimed_rewards = 23_306_074_766_355_140; //ACA + let unclaimable_rewards = 20_443_925_233_644_860; + let deposited_amount = 50 * ONE; + let deposit_id = 1; + assert_ok!(LiquidityMining::deposit_lp_shares( + CHARLIE_FARM, + CHARLIE_ACA_KSM_YIELD_FARM_ID, + ACA_KSM_AMM, + deposited_amount, + |_, _, _| { Ok(2_500 * ONE) } + )); + + assert_eq!( + LiquidityMining::deposit(deposit_id).unwrap(), + DepositData { + shares: deposited_amount, + amm_pool_id: ACA_KSM_AMM, + yield_farm_entries: vec![YieldFarmEntry { + global_farm_id, + yield_farm_id: CHARLIE_ACA_KSM_YIELD_FARM_ID, + accumulated_rpvs: Zero::zero(), + accumulated_claimed_rewards: 0, + entered_at: 18, + updated_at: 18, + valued_shares: 2_500 * ONE, + stopped_at_creation: 0, + _phantom: PhantomData, + }] + .try_into() + .unwrap(), + }, + ); + + set_block_number(2_596); //period 25 + + assert_eq!( + LiquidityMining::claim_rewards(ALICE, deposit_id, CHARLIE_ACA_KSM_YIELD_FARM_ID, FAIL_ON_DOUBLECLAIM) + .unwrap(), + (CHARLIE_FARM, ACA, expected_claimed_rewards, unclaimable_rewards) + ); + + //Alice had 0 ACA before claim. + assert_eq!(Tokens::free_balance(ACA, &ALICE), expected_claimed_rewards); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn claim_rewards_deposit_with_multiple_entries_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const FAIL_ON_DOUBLECLAIM: bool = true; + //predefined_deposit[0] - GC_FARM, BSX_TKN1_AMM + set_block_number(50_000); + assert_ok!(LiquidityMining::redeposit_lp_shares( + EVE_FARM, + EVE_BSX_TKN1_YIELD_FARM_ID, + PREDEFINED_DEPOSIT_IDS[0], + |_, _, _| { Ok(4_000 * ONE) } + )); + + set_block_number(800_000); + assert_ok!(LiquidityMining::redeposit_lp_shares( + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + PREDEFINED_DEPOSIT_IDS[0], + |_, _, _| { Ok(5_000 * ONE) } + )); + + let deposit = LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(); + + assert_eq!( + deposit.yield_farm_entries, + vec![ + YieldFarmEntry { + global_farm_id: GC_FARM, + valued_shares: 2_500 * ONE, + yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 0, + accumulated_rpvs: Zero::zero(), + entered_at: 18, + updated_at: 18, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + YieldFarmEntry { + global_farm_id: EVE_FARM, + valued_shares: 4_000 * ONE, + yield_farm_id: EVE_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 0, + accumulated_rpvs: Zero::zero(), + entered_at: 50, + updated_at: 50, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + YieldFarmEntry { + global_farm_id: DAVE_FARM, + valued_shares: 5_000 * ONE, + yield_farm_id: DAVE_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 0, + accumulated_rpvs: Zero::zero(), + entered_at: 800, + updated_at: 800, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + ] + ); + + set_block_number(1_000_000); + assert_eq!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + EVE_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ) + .unwrap(), + (EVE_FARM, KSM, 7_238_095_238_095_238_088, 361_904_761_904_761_912) + ); + + assert_noop!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + EVE_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ), + Error::::DoubleClaimInPeriod + ); + + assert_eq!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ) + .unwrap(), + (GC_FARM, BSX, 62_078_099_583_415_988_875, 309_400_416_584_011_125) + ); + + let deposit = LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(); + assert_eq!( + deposit.yield_farm_entries, + vec![ + YieldFarmEntry { + global_farm_id: GC_FARM, + valued_shares: 2_500 * ONE, + yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 62_078_099_583_415_988_875, + accumulated_rpvs: Zero::zero(), + entered_at: 18, + updated_at: 10_000, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + YieldFarmEntry { + global_farm_id: EVE_FARM, + valued_shares: 4_000 * ONE, + yield_farm_id: EVE_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 7_238_095_238_095_238_088, + accumulated_rpvs: Zero::zero(), + entered_at: 50, + updated_at: 1_000, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + YieldFarmEntry { + global_farm_id: DAVE_FARM, + valued_shares: 5_000 * ONE, + yield_farm_id: DAVE_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 0, + accumulated_rpvs: Zero::zero(), + entered_at: 800, + updated_at: 800, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + ] + ); + + //Same period different block. + set_block_number(1_000_050); + assert_noop!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + EVE_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ), + Error::::DoubleClaimInPeriod + ); + + assert_noop!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ), + Error::::DoubleClaimInPeriod + ); + + assert_eq!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + DAVE_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ) + .unwrap(), + (DAVE_FARM, ACA, 1_666_666_666_666_666_666, 333_333_333_333_333_334) + ); + + let deposit = LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(); + assert_eq!( + deposit.yield_farm_entries, + vec![ + YieldFarmEntry { + global_farm_id: GC_FARM, + valued_shares: 2_500 * ONE, + yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 62_078_099_583_415_988_875, + accumulated_rpvs: Zero::zero(), + entered_at: 18, + updated_at: 10_000, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + YieldFarmEntry { + global_farm_id: EVE_FARM, + valued_shares: 4_000 * ONE, + yield_farm_id: EVE_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 7_238_095_238_095_238_088, + accumulated_rpvs: Zero::zero(), + entered_at: 50, + updated_at: 1_000, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + YieldFarmEntry { + global_farm_id: DAVE_FARM, + valued_shares: 5_000 * ONE, + yield_farm_id: DAVE_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 1_666_666_666_666_666_666, + accumulated_rpvs: Zero::zero(), + entered_at: 800, + updated_at: 1_000, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + ] + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn claim_rewards_doubleclaim_in_the_same_period_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const FAIL_ON_DOUBLECLAIM: bool = true; + let global_farm_id = GC_FARM; + let alice_bsx_balance = Tokens::free_balance(BSX, &ALICE); + let pot = LiquidityMining::pot_account_id().unwrap(); + + let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let pot_balance_0 = Tokens::free_balance(BSX, &pot); + + //1-th claim should works. + assert_ok!(LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + )); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(), + DepositData { + shares: 50 * ONE, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![YieldFarmEntry { + global_farm_id, + yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, + valued_shares: 2_500 * ONE, + accumulated_rpvs: Zero::zero(), + accumulated_claimed_rewards: 23_306_074_766_355_140, + entered_at: 18, + updated_at: 25, + stopped_at_creation: 0, + _phantom: PhantomData, + }] + .try_into() + .unwrap(), + }, + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)) + .unwrap() + .left_to_distribute, + yield_farm_0.left_to_distribute - 23_306_074_766_355_140 + ); + + assert_eq!( + Tokens::free_balance(BSX, &ALICE), + alice_bsx_balance + 23_306_074_766_355_140 + ); + assert_eq!(Tokens::free_balance(BSX, &pot), pot_balance_0 - 23_306_074_766_355_140); + + //Second claim should fail. + assert_noop!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ), + Error::::DoubleClaimInPeriod + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn claim_rewards_should_claim_correct_amount_when_yield_farm_is_stopped() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const FAIL_ON_DOUBLECLAIM: bool = true; + let global_farm_id = GC_FARM; + let alibe_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); + let pot = LiquidityMining::pot_account_id().unwrap(); + let pot_balance_0 = Tokens::free_balance(BSX, &pot); + let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + + let expected_global_pending_rewards = 41_675_375_000_000_000_000_u128; + //Stop yield farming before claiming. + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + + set_block_number(20_000); + + let expected_claimed_rewards = 23_306_074_766_355_140; + let unclaimable_rewards = 20_443_925_233_644_860; + + //claim A1.1 (dep. A1 1-th time) + assert_eq!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ) + .unwrap(), + (global_farm_id, BSX, expected_claimed_rewards, unclaimable_rewards) + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(), + DepositData { + shares: 50 * ONE, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![YieldFarmEntry { + global_farm_id, + yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, + valued_shares: 2_500 * ONE, + accumulated_rpvs: Zero::zero(), + accumulated_claimed_rewards: expected_claimed_rewards, + entered_at: 18, + updated_at: 200, + stopped_at_creation: 0, + _phantom: PhantomData, + }] + .try_into() + .unwrap(), + }, + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)) + .unwrap() + .left_to_distribute, + yield_farm_0.left_to_distribute - expected_claimed_rewards + ); + + //Check if claimed rewards are transferred. + assert_eq!( + Tokens::free_balance(BSX, &ALICE), + alibe_bsx_balance_0 + expected_claimed_rewards + ); + + assert_eq!( + Tokens::free_balance(BSX, &pot), + pot_balance_0 + expected_global_pending_rewards - expected_claimed_rewards + ); + + //global-farm should be synced independetly of yield-farm (even it yield-farm is + //stopped). + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 200, + accumulated_rpz: FixedU128::from_inner(91_000_000_000_000_000_000_u128), + pending_rewards: 41_675_375_000_000_000_000_u128, + ..global_farm_0 + } + ); + + //Second claim on same deposit from stopped yield farm. + //This should claim 0 rewards. + set_block_number(300_000); + //claim A1.1 (dep. A1 1-th time) + assert_eq!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ) + .unwrap(), + (global_farm_id, BSX, 0, unclaimable_rewards) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn claim_rewards_should_fail_with_liqudity_mining_canceled_when_yield_farm_is_destroyed() { + const FAIL_ON_DOUBLECLAIM: bool = true; + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + //Stop yield farming before removing. + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + //Delete yield farm before claim test. + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + assert_noop!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM + ), + Error::::LiquidityMiningCanceled + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn second_claim_rewards_should_work_when_doubleclaim_is_allowed() { + const FAIL_ON_DOUBLECLAIM: bool = true; + + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let (_, _, claimable_rewards, unclaimable_rewards) = LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + !FAIL_ON_DOUBLECLAIM, + ) + .unwrap(); + + assert_eq!(claimable_rewards, 23_306_074_766_355_140); + assert_eq!(unclaimable_rewards, 20_443_925_233_644_860); + + //Second claim in the same period should return 0 for `claimable_rewards` and real value for + //`unclaimable_rewards` + let (_, _, claimable_rewards, unclaimable_rewards) = LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + !FAIL_ON_DOUBLECLAIM, + ) + .unwrap(); + + assert_eq!(claimable_rewards, 0); + assert_eq!(unclaimable_rewards, 20_443_925_233_644_860); + + //check if double claim fails + assert_noop!( + LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + FAIL_ON_DOUBLECLAIM, + ), + Error::::DoubleClaimInPeriod + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +//NOTE: farms are initialize like this intentionally. Bug may not appear with only 1 yield farm. +#[test] +fn deposits_should_claim_same_amount_when_created_in_the_same_period() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const GLOBAL_FARM: GlobalFarmId = 1; + const YIELD_FARM_A: YieldFarmId = 2; + const YIELD_FARM_B: YieldFarmId = 3; + + const BOB_DEPOSIT: DepositId = 2; + const CHARLIE_DEPOSIT: DepositId = 3; + + const PLANNED_PERIODS: u64 = 10_000; + const BLOCKS_PER_PERIOD: u64 = 10; + const TOTAL_REWARDS_TO_DISTRIBUTE: u128 = 1_000_000 * ONE; + + //initialize farms + set_block_number(1000); + assert_ok!(LiquidityMining2::create_global_farm( + TOTAL_REWARDS_TO_DISTRIBUTE, + PLANNED_PERIODS, + BLOCKS_PER_PERIOD, + BSX, + BSX, + GC, + Perquintill::from_float(0.005), + 1_000, + One::one(), + )); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + One::one(), + None, + BSX_TKN1_AMM, + vec![BSX, TKN1] + )); + + //alice + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_A, + BSX_TKN1_AMM, + 1_000 * ONE, + |_, _, _| { Ok(ONE) } + )); + + set_block_number(1_500); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + One::one(), + None, + BSX_TKN2_AMM, + vec![BSX, TKN2] + )); + + set_block_number(2_000); + //bob + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 1_000 * ONE, + |_, _, _| { Ok(ONE) } + )); + + //charlie + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 1_000 * ONE, + |_, _, _| { Ok(ONE) } + )); + + let bob_bsx_balance_0 = Tokens::free_balance(BSX, &BOB); + let charlie_bsx_balance_0 = Tokens::free_balance(BSX, &CHARLIE); + + set_block_number(2_500); + let _ = LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); + + let _ = LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); + + let bob_rewards = Tokens::free_balance(BSX, &BOB) - bob_bsx_balance_0; + let charlie_rewards = Tokens::free_balance(BSX, &CHARLIE) - charlie_bsx_balance_0; + + pretty_assertions::assert_eq!(bob_rewards, charlie_rewards); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn claim_rewards_should_claim_correct_amount_when_yield_farm_was_resumed() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const REWARD_CURRENCY: AssetId = ACA; + + //Arrange + //periods timeline: + // |--- 10 active ---|--- 20 stopped ---|--- 10 active ---|claim_rewards() + // + set_block_number(20_000); + + let first_deposit_id = LiquidityMining::deposit_lp_shares( + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + 1_000_000 * ONE, + |_, _, _| Ok(10_000_000 * ONE), + ) + .unwrap(); + + let second_deposit_id = LiquidityMining::deposit_lp_shares( + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + 2_000_000 * ONE, + |_, _, _| Ok(20_000_000 * ONE), + ) + .unwrap(); + + set_block_number(30_000); + + // stop yield-farm + assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); + // resume yield-farm after 20 stopped periods. + set_block_number(50_000); + assert_ok!(LiquidityMining::resume_yield_farm( + DAVE, + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + FixedU128::from(10) + )); + + //Act & assert + // claim rewards after 10 periods so deposit should claim in total for 20(active) + // periods. + set_block_number(60_000); + + assert_eq!( + LiquidityMining::claim_rewards(ALICE, first_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), + ( + DAVE_FARM, + REWARD_CURRENCY, + 233_333_333_333_333_333_200, + 166_666_666_666_666_666_800, + ) + ); + + assert_eq!( + LiquidityMining::claim_rewards(ALICE, second_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), + ( + DAVE_FARM, + REWARD_CURRENCY, + 466_666_666_666_666_666_400, + 333_333_333_333_333_333_600, + ) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn claim_rewards_should_claim_correct_amount_when_deposit_is_created_after_yield_farm_was_resumed() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const REWARD_CURRENCY: AssetId = ACA; + + //Arrange + set_block_number(20_000); + + let first_deposit_id = LiquidityMining::deposit_lp_shares( + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + 1_000_000 * ONE, + |_, _, _| Ok(10_000_000 * ONE), + ) + .unwrap(); + + set_block_number(30_000); + + // stop yield-farm + assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); + + // resume yield-farm after 20 stopped periods. + set_block_number(50_000); + assert_ok!(LiquidityMining::resume_yield_farm( + DAVE, + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + FixedU128::from(10) + )); + + let second_deposit_id = LiquidityMining::deposit_lp_shares( + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + 2_000_000 * ONE, + |_, _, _| Ok(20_000_000 * ONE), + ) + .unwrap(); + + //Act & assert + //dp 1 = total periods: 40, mining periods: 20 + //dp 2 = total periods: 10, mining periods: 10, (this dp was created after yield-farm + //was resumed + set_block_number(60_000); + + assert_eq!( + LiquidityMining::claim_rewards(ALICE, first_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), + ( + DAVE_FARM, + REWARD_CURRENCY, + 233_333_333_333_333_333_200, + 166_666_666_666_666_666_800, + ) + ); + + assert_eq!( + LiquidityMining::claim_rewards(ALICE, second_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), + ( + DAVE_FARM, + REWARD_CURRENCY, + 218_181_818_181_818_181_600, + 181_818_181_818_181_818_400, + ) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn claim_rewards_should_claim_correct_amount_when_yield_was_resumed_multiple_times() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const REWARD_CURRENCY: AssetId = ACA; + + //Arrange + set_block_number(20_000); + + let first_deposit_id = LiquidityMining::deposit_lp_shares( + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + 1_000_000 * ONE, + |_, _, _| Ok(10_000_000 * ONE), + ) + .unwrap(); + + // stop yield-farm + set_block_number(30_000); + assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); + + // resume yield-farm + set_block_number(50_000); + assert_ok!(LiquidityMining::resume_yield_farm( + DAVE, + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + FixedU128::from(10) + )); + + // create second deposit + set_block_number(60_000); + let second_deposit_id = LiquidityMining::deposit_lp_shares( + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + 2_000_000 * ONE, + |_, _, _| Ok(20_000_000 * ONE), + ) + .unwrap(); + + // stop yield-farm + set_block_number(80_000); + assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); + + // resume yield-farm + set_block_number(90_000); + assert_ok!(LiquidityMining::resume_yield_farm( + DAVE, + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + FixedU128::from(10) + )); + + // stop yield-farm + set_block_number(100_000); + assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); + + // resume yield-farm + set_block_number(120_000); + assert_ok!(LiquidityMining::resume_yield_farm( + DAVE, + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + FixedU128::from(10) + )); + + //Act & assert + //claim rewards + set_block_number(140_000); + //dp 1 = total periods: 120, mining periods: 70 + //dp 2 = total periods: 80, mining periods: 50 + + assert_eq!( + LiquidityMining::claim_rewards(ALICE, first_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), + ( + DAVE_FARM, + REWARD_CURRENCY, + 988_235_294_117_647_058_000, + 411_764_705_882_352_942_000, + ) + ); + + assert_eq!( + LiquidityMining::claim_rewards(ALICE, second_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), + ( + DAVE_FARM, + REWARD_CURRENCY, + 1_333_333_333_333_333_332_000, + 666_666_666_666_666_668_000, + ) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn claim_rewards_should_claim_correct_amount_when_yield_was_resumed_multiple_times_and_is_stopped_now() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const REWARD_CURRENCY: AssetId = ACA; + + //Arrange + set_block_number(20_000); + + let first_deposit_id = LiquidityMining::deposit_lp_shares( + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + 1_000_000 * ONE, + |_, _, _| Ok(10_000_000 * ONE), + ) + .unwrap(); + + // stop yield-farm + set_block_number(30_000); + assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); + + // resume yield-farm + set_block_number(50_000); + assert_ok!(LiquidityMining::resume_yield_farm( + DAVE, + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + FixedU128::from(10) + )); + + // create second deposit + set_block_number(60_000); + let second_deposit_id = LiquidityMining::deposit_lp_shares( + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + 2_000_000 * ONE, + |_, _, _| Ok(20_000_000 * ONE), + ) + .unwrap(); + + // stop yield-farm + set_block_number(80_000); + assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); + + // resume yield-farm + set_block_number(90_000); + assert_ok!(LiquidityMining::resume_yield_farm( + DAVE, + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + FixedU128::from(10) + )); + + // stop yield-farm + set_block_number(100_000); + assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); + + // resume yield-farm + set_block_number(120_000); + assert_ok!(LiquidityMining::resume_yield_farm( + DAVE, + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + FixedU128::from(10) + )); + + // stop yield-farm + set_block_number(140_000); + assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); + + //Act & assert + //claim rewards + + set_block_number(200_000); + + //dp 1 = total periods: 120, mining periods: 70 + //dp 2 = total periods: 80, mining periods: 50 + + assert_eq!( + LiquidityMining::claim_rewards(ALICE, first_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), + ( + DAVE_FARM, + REWARD_CURRENCY, + 988_235_294_117_647_058_000, + 411_764_705_882_352_942_000, + ) + ); + + assert_eq!( + LiquidityMining::claim_rewards(ALICE, second_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), + ( + DAVE_FARM, + REWARD_CURRENCY, + 1_333_333_333_333_333_332_000, + 666_666_666_666_666_668_000, + ) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} diff --git a/pallets/liquidity-mining/src/tests/create_global_farm.rs b/pallets/liquidity-mining/src/tests/create_global_farm.rs new file mode 100644 index 00000000000..b61d20165f5 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/create_global_farm.rs @@ -0,0 +1,276 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn create_global_farm_should_work() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + let global_farm_id = 1; + let total_rewards: Balance = 50_000_000_000_000; + let reward_currency = BSX; + let planned_yielding_periods: BlockNumber = 1_000_000_000_u64; + let blocks_per_period = 20_000; + let incentivized_token = BSX; + let owner = ALICE; + let yield_per_period = Perquintill::from_percent(20); + let min_deposit = 10_000; + let max_reward_per_period: Balance = total_rewards.checked_div(planned_yielding_periods.into()).unwrap(); + + let created_at_block = 15_896; + + set_block_number(created_at_block); + + let global_farm_account = LiquidityMining::farm_account_id(global_farm_id).unwrap(); + + assert_eq!(Tokens::free_balance(reward_currency, &global_farm_account), 0); + + assert_eq!( + LiquidityMining::create_global_farm( + total_rewards, + planned_yielding_periods, + blocks_per_period, + incentivized_token, + reward_currency, + owner, + yield_per_period, + min_deposit, + One::one(), + ) + .unwrap(), + (global_farm_id, max_reward_per_period) + ); + + //Check if total_rewards are transferred to farm's account. + assert_eq!( + Tokens::free_balance(reward_currency, &global_farm_account), + total_rewards + ); + assert_eq!( + Tokens::free_balance(reward_currency, &ALICE), + (INITIAL_BALANCE * ONE - total_rewards) + ); + + let updated_at = created_at_block / blocks_per_period; + + let global_farm = GlobalFarmData::new( + global_farm_id, + updated_at, + reward_currency, + yield_per_period, + planned_yielding_periods, + blocks_per_period, + owner, + incentivized_token, + max_reward_per_period, + min_deposit, + One::one(), + ); + + assert_eq!(LiquidityMining::global_farm(global_farm_id).unwrap(), global_farm); + //Non-dustable check + assert_eq!(Whitelist::contains(&global_farm_account), true); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn create_global_farm_invalid_data_should_not_work() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + let created_at_block = 15_896; + + set_block_number(created_at_block); + + //total_rewards bellow mini. limit. + assert_noop!( + LiquidityMining::create_global_farm( + 100, + 1_000, + 300, + BSX, + BSX, + ALICE, + Perquintill::from_percent(20), + 1_000, + One::one(), + ), + Error::::InvalidTotalRewards + ); + + //planned_yielding_periods bellow min. limit. + assert_noop!( + LiquidityMining::create_global_farm( + 1_000_000, + 10, + 300, + BSX, + BSX, + ALICE, + Perquintill::from_percent(20), + 1_000, + One::one(), + ), + Error::::InvalidPlannedYieldingPeriods + ); + + //blocks_per_period is 0. + assert_noop!( + LiquidityMining::create_global_farm( + 1_000_000, + 1_000, + 0, + BSX, + BSX, + ALICE, + Perquintill::from_percent(20), + 1_000, + One::one(), + ), + Error::::InvalidBlocksPerPeriod + ); + + //yield_per_period is 0. + assert_noop!( + LiquidityMining::create_global_farm( + 1_000_000, + 1_000, + 1, + BSX, + BSX, + ALICE, + Perquintill::from_percent(0), + 1_000, + One::one(), + ), + Error::::InvalidYieldPerPeriod + ); + + //min. deposit < crate::MIN_DEPOSIT + assert_noop!( + LiquidityMining::create_global_farm( + 1_000_000, + 1_000, + 1, + BSX, + BSX, + ALICE, + Perquintill::from_percent(10), + crate::MIN_DEPOSIT - 1, + One::one(), + ), + Error::::InvalidMinDeposit + ); + + //price adjustment is 0. + assert_noop!( + LiquidityMining::create_global_farm( + 1_000_000, + 1_000, + 1, + BSX, + BSX, + ALICE, + Perquintill::from_percent(10), + 1_000, + FixedU128::from(0_u128), + ), + Error::::InvalidPriceAdjustment + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn create_global_farm_with_inssufficient_balance_should_not_work() { + //Owner's account balance is 1M BSX. + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::create_global_farm( + 1_000_001 * ONE, + 1_000, + 1, + BSX, + BSX, + ACCOUNT_WITH_1M, + Perquintill::from_percent(20), + 10_000, + One::one(), + ), + Error::::InsufficientRewardCurrencyBalance + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn create_global_farm_should_not_work_when_reward_currency_is_not_registered() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::create_global_farm( + 1_000_000 * ONE, + 1_000, + 1, + BSX, + UNKNOWN_ASSET, + GC, + Perquintill::from_percent(20), + 10_000, + One::one(), + ), + Error::::RewardCurrencyNotRegistered + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn create_global_farm_should_not_work_when_incentivized_asset_is_not_registered() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::create_global_farm( + 1_000_000 * ONE, + 1_000, + 1, + UNKNOWN_ASSET, + BSX, + GC, + Perquintill::from_percent(20), + 10_000, + One::one(), + ), + Error::::IncentivizedAssetNotRegistered + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} diff --git a/pallets/liquidity-mining/src/tests/create_yield_farm.rs b/pallets/liquidity-mining/src/tests/create_yield_farm.rs new file mode 100644 index 00000000000..9047ffd51c4 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/create_yield_farm.rs @@ -0,0 +1,485 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn create_yield_farm_should_work() { + //NOTE: global_farm.updated_at isn't changed because global farm is empty. + let test_data = vec![ + ( + AssetPair { + asset_in: BSX, + asset_out: ACA, + }, + YieldFarmData { + id: 13, + updated_at: 17, + total_shares: 0, + total_valued_shares: 0, + accumulated_rpvs: Zero::zero(), + accumulated_rpz: Zero::zero(), + multiplier: FixedU128::from(20_000_u128), + loyalty_curve: Some(LoyaltyCurve::default()), + entries_count: 0, + state: FarmState::Active, + left_to_distribute: 0, + total_stopped: 0, + _phantom: PhantomData, + }, + BSX_ACA_AMM, + ALICE, + ALICE_FARM, + 17_850, + GlobalFarmData { + updated_at: 17, + live_yield_farms_count: 1, + total_yield_farms_count: 1, + ..get_predefined_global_farm_ins1(0) + }, + ), + ( + AssetPair { + asset_in: KSM, + asset_out: BSX, + }, + YieldFarmData { + id: 14, + updated_at: 17, + total_shares: 0, + total_valued_shares: 0, + accumulated_rpvs: Zero::zero(), + accumulated_rpz: Zero::zero(), + multiplier: FixedU128::from(10_000_u128), + loyalty_curve: None, + entries_count: 0, + state: FarmState::Active, + left_to_distribute: 0, + total_stopped: 0, + _phantom: PhantomData, + }, + BSX_KSM_AMM, + ALICE, + ALICE_FARM, + 17_850, + GlobalFarmData { + updated_at: 17, + live_yield_farms_count: 2, + total_yield_farms_count: 2, + ..get_predefined_global_farm_ins1(0) + }, + ), + ( + AssetPair { + asset_in: BSX, + asset_out: ETH, + }, + YieldFarmData { + id: 15, + updated_at: 20, + total_shares: 0, + total_valued_shares: 0, + accumulated_rpvs: Zero::zero(), + accumulated_rpz: Zero::zero(), + multiplier: FixedU128::from(10_000_u128), + loyalty_curve: Some(LoyaltyCurve { + initial_reward_percentage: FixedU128::from_inner(100_000_000_000_000_000), + scale_coef: 50, + }), + state: FarmState::Active, + entries_count: 0, + left_to_distribute: 0, + total_stopped: 0, + _phantom: PhantomData, + }, + BSX_ETH_AMM, + ALICE, + ALICE_FARM, + 20_000, + GlobalFarmData { + updated_at: 20, + live_yield_farms_count: 3, + total_yield_farms_count: 3, + ..get_predefined_global_farm_ins1(0) + }, + ), + ( + AssetPair { + asset_in: BSX, + asset_out: ETH, + }, + YieldFarmData { + id: 16, + updated_at: 2, + total_shares: 0, + total_valued_shares: 0, + accumulated_rpvs: Zero::zero(), + accumulated_rpz: Zero::zero(), + multiplier: FixedU128::from(50_000_128), + loyalty_curve: Some(LoyaltyCurve { + initial_reward_percentage: FixedU128::from_inner(1), + scale_coef: 0, + }), + state: FarmState::Active, + entries_count: 0, + left_to_distribute: 0, + total_stopped: 0, + _phantom: PhantomData, + }, + BSX_ETH_AMM, + BOB, + BOB_FARM, + 20_000, + GlobalFarmData { + updated_at: 2, + live_yield_farms_count: 1, + total_yield_farms_count: 1, + ..get_predefined_global_farm_ins1(1) + }, + ), + ]; + + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + for (assets, yield_farm, amm_id, who, global_farm_id, now, global_farm) in test_data.clone() { + set_block_number(now); + + assert_eq!( + LiquidityMining::create_yield_farm( + who, + global_farm_id, + yield_farm.multiplier, + yield_farm.loyalty_curve.clone(), + amm_id, + vec![assets.asset_in, assets.asset_out], + ) + .unwrap(), + yield_farm.id + ); + + assert_eq!(LiquidityMining::global_farm(global_farm_id).unwrap(), global_farm); + + assert_eq!( + LiquidityMining::active_yield_farm(amm_id, global_farm_id).unwrap(), + yield_farm.id + ); + + assert_eq!( + LiquidityMining::yield_farm((amm_id, global_farm_id, yield_farm.id)).unwrap(), + YieldFarmData { ..yield_farm } + ); + } + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn add_yield_farm_missing_incentivized_asset_should_not_work() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::create_yield_farm( + ALICE, + ALICE_FARM, + FixedU128::from(10_000_u128), + None, + KSM_DOT_AMM, + //Neither KSM nor DOT is incentivized by the farm. + vec![KSM, DOT], + ), + Error::::MissingIncentivizedAsset + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn add_yield_farm_not_owner_should_not_work() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::create_yield_farm( + BOB, + ALICE_FARM, + FixedU128::from(10_000_u128), + None, + BSX_HDX_AMM, + vec![BSX, HDX], + ), + Error::::Forbidden + ); + + assert_noop!( + LiquidityMining::create_yield_farm( + BOB, + ALICE_FARM, + FixedU128::from(10_000_u128), + Some(LoyaltyCurve::default()), + BSX_HDX_AMM, + vec![BSX, HDX], + ), + Error::::Forbidden + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn add_yield_farm_invalid_loyalty_curve_should_not_work() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + let curves = vec![ + Some(LoyaltyCurve { + initial_reward_percentage: FixedU128::one(), + scale_coef: 0, + }), + Some(LoyaltyCurve { + initial_reward_percentage: FixedU128::from_float(1.0), + scale_coef: 1_000_000, + }), + Some(LoyaltyCurve { + initial_reward_percentage: FixedU128::from_float(1.000_000_000_000_000_001), + scale_coef: 25_996_000, + }), + Some(LoyaltyCurve { + initial_reward_percentage: FixedU128::from(1_u128), + scale_coef: 25_996_000, + }), + Some(LoyaltyCurve { + initial_reward_percentage: FixedU128::from(5_u128), + scale_coef: 25_996_000, + }), + Some(LoyaltyCurve { + initial_reward_percentage: FixedU128::from(16_874_354_654_u128), + scale_coef: 25_996_000, + }), + ]; + + for c in curves { + assert_noop!( + LiquidityMining::create_yield_farm( + ALICE, + ALICE_FARM, + FixedU128::from(10_000_u128), + c, + BSX_HDX_AMM, + vec![BSX, HDX], + ), + Error::::InvalidInitialRewardPercentage + ); + } + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn add_yield_farm_invalid_multiplier_should_not_work() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::create_yield_farm( + ALICE, + ALICE_FARM, + MIN_YIELD_FARM_MULTIPLIER - FixedU128::from_inner(1_u128), + Some(LoyaltyCurve::default()), + BSX_HDX_AMM, + vec![BSX, HDX], + ), + Error::::InvalidMultiplier + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn add_yield_farm_add_duplicate_amm_should_not_work() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + set_block_number(20_000); + + let aca_ksm_assets = AssetPair { + asset_in: ACA, + asset_out: KSM, + }; + + let aca_ksm_amm_account = + AMM_POOLS.with(|v| v.borrow().get(&asset_pair_to_map_key(aca_ksm_assets)).unwrap().0); + + assert!(LiquidityMining::active_yield_farm(aca_ksm_amm_account, CHARLIE_FARM).is_some()); + + //Try to add same amm second time in the same block(period) + assert_noop!( + LiquidityMining::create_yield_farm( + CHARLIE, + CHARLIE_FARM, + FixedU128::from(9_000_u128), + Some(LoyaltyCurve::default()), + ACA_KSM_AMM, + vec![ACA, KSM], + ), + Error::::YieldFarmAlreadyExists + ); + + //Try to add same amm second time in later block(period). + set_block_number(30_000); + + assert_noop!( + LiquidityMining::create_yield_farm( + CHARLIE, + CHARLIE_FARM, + FixedU128::from(9_000_u128), + Some(LoyaltyCurve::default()), + ACA_KSM_AMM, + vec![ACA, KSM], + ), + Error::::YieldFarmAlreadyExists + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn add_yield_farm_global_farm_full_should_not_work() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + //GC FARM is initialized with 2 yield farms and mock limit is 4. + + // This should works 3-rd yield farm + assert_ok!(LiquidityMining::create_yield_farm( + GC, + GC_FARM, + 10_000.into(), + Some(LoyaltyCurve::default()), + BSX_ACA_AMM, + vec![BSX, ACA], + )); + + // This should works 4-th yield farm + let bsx_dot_yield_farm_id = LiquidityMining::create_yield_farm( + GC, + GC_FARM, + 10_000.into(), + Some(LoyaltyCurve::default()), + BSX_DOT_AMM, + vec![BSX, DOT], + ) + .unwrap(); + + // This should fail. + assert_noop!( + LiquidityMining::create_yield_farm( + GC, + GC_FARM, + 10_000.into(), + Some(LoyaltyCurve::default()), + BSX_HDX_AMM, + vec![BSX, HDX], + ), + Error::::GlobalFarmIsFull + ); + + //Stop farm + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_DOT_AMM)); + + //This still should now work because yield farms in storage are included in counts. + assert_noop!( + LiquidityMining::create_yield_farm( + GC, + GC_FARM, + 10_000.into(), + Some(LoyaltyCurve::default()), + BSX_HDX_AMM, + vec![BSX, HDX], + ), + Error::::GlobalFarmIsFull + ); + + //Stop and destroy yield farm (destroyed farm stays in the storage because of deposit) + //deposit to yield so it's not flushed on destroy + assert_ok!(LiquidityMining::deposit_lp_shares( + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + 1_000, + |_, _, _| { Ok(1_000_u128) } + )); + + //stop and destroy + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)) + .unwrap() + .state, + FarmState::Terminated + ); + + //This still should now work because deleted yield farms in storage are included in counts. + assert_noop!( + LiquidityMining::create_yield_farm( + GC, + GC_FARM, + 10_000.into(), + Some(LoyaltyCurve::default()), + BSX_HDX_AMM, + vec![BSX, HDX], + ), + Error::::GlobalFarmIsFull + ); + + //Destroy stopped empty farm(it will be flushed from storage). + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + bsx_dot_yield_farm_id, + BSX_DOT_AMM + )); + + //This should pass because yield farm was flushed from storage. + assert_ok!(LiquidityMining::create_yield_farm( + GC, + GC_FARM, + 10_000.into(), + Some(LoyaltyCurve::default()), + BSX_HDX_AMM, + vec![BSX, HDX], + )); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} diff --git a/pallets/liquidity-mining/src/tests/deposit_lp_shares.rs b/pallets/liquidity-mining/src/tests/deposit_lp_shares.rs new file mode 100644 index 00000000000..cb41b1e660c --- /dev/null +++ b/pallets/liquidity-mining/src/tests/deposit_lp_shares.rs @@ -0,0 +1,651 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn deposit_lp_shares_should_work() { + //NOTE: farm incentivize BSX token. + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + let global_farm_id = GC_FARM; + let global_farm_account = LiquidityMining::farm_account_id(global_farm_id).unwrap(); + let pot = LiquidityMining::pot_account_id().unwrap(); + + //DEPOSIT 1: + set_block_number(1_800); //18-th period + + let deposited_amount = 50 * ONE; + let yield_farm_id = GC_BSX_TKN1_YIELD_FARM_ID; + //_0 - value berfore act + let bsx_tkn1_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(); + + assert_eq!( + LiquidityMining::deposit_lp_shares( + global_farm_id, + yield_farm_id, + BSX_TKN1_AMM, + deposited_amount, + |_, _, _| { Ok(2_500 * ONE) } + ) + .unwrap(), + PREDEFINED_DEPOSIT_IDS[0] + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + total_shares_z: 12_500 * ONE, + updated_at: 18, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(), + YieldFarmData { + total_shares: deposited_amount, + total_valued_shares: 2_500 * ONE, + updated_at: 18, + entries_count: 1, + ..bsx_tkn1_yield_farm_0 + }, + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(), + DepositData { + shares: deposited_amount, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![YieldFarmEntry::new( + global_farm_id, + GC_BSX_TKN1_YIELD_FARM_ID, + 2_500 * ONE, + Zero::zero(), + 18, + 0 + )] + .try_into() + .unwrap(), + }, + ); + + // DEPOSIT 2 (deposit in the same period): + let deposited_amount = 80 * ONE; + let yield_farm_id = GC_BSX_TKN1_YIELD_FARM_ID; + //_0 - value berfore act + let bsx_tkn1_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(); + + assert_eq!( + LiquidityMining::deposit_lp_shares( + global_farm_id, + yield_farm_id, + BSX_TKN1_AMM, + deposited_amount, + |_, _, _| { Ok(4_160 * ONE) } + ) + .unwrap(), + PREDEFINED_DEPOSIT_IDS[1] + ); + + assert_eq!( + LiquidityMining::global_farm(global_farm_id).unwrap(), + GlobalFarmData { + accumulated_rpz: Zero::zero(), + updated_at: 18, + accumulated_paid_rewards: 0, + total_shares_z: 33_300 * ONE, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(), + YieldFarmData { + updated_at: 18, + total_shares: 130 * ONE, + total_valued_shares: 6_660 * ONE, + entries_count: 2, + ..bsx_tkn1_yield_farm_0 + }, + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[1]).unwrap(), + DepositData { + shares: deposited_amount, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![YieldFarmEntry::new( + global_farm_id, + GC_BSX_TKN1_YIELD_FARM_ID, + 4_160 * ONE, + Zero::zero(), + 18, + 0 + )] + .try_into() + .unwrap(), + }, + ); + + //Nohtig was claimed by yield-farm so nothings should change. + assert_eq!(Tokens::free_balance(BSX, &global_farm_account), 30_000_000_000 * ONE); + assert_eq!(Tokens::free_balance(BSX, &pot), 0); + + // DEPOSIT 3 (same period, second yield farm): + let deposited_amount = 25 * ONE; + let yield_farm_id = GC_BSX_TKN2_YIELD_FARM_ID; + + //_0 - value berfore act. + let bsx_tkn2_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(); + + assert_eq!( + LiquidityMining::deposit_lp_shares( + global_farm_id, + yield_farm_id, + BSX_TKN2_AMM, + deposited_amount, + |_, _, _| { Ok(200 * ONE) } + ) + .unwrap(), + PREDEFINED_DEPOSIT_IDS[2] + ); + + assert_eq!( + LiquidityMining::global_farm(global_farm_id).unwrap(), + GlobalFarmData { + updated_at: 18, + accumulated_rpz: Zero::zero(), + accumulated_paid_rewards: 0, + total_shares_z: 35_300 * ONE, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, yield_farm_id)).unwrap(), + YieldFarmData { + updated_at: 18, + total_shares: 25 * ONE, + total_valued_shares: 200 * ONE, + entries_count: 1, + ..bsx_tkn2_yield_farm_0 + }, + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[2]).unwrap(), + DepositData { + shares: deposited_amount, + amm_pool_id: BSX_TKN2_AMM, + yield_farm_entries: vec![YieldFarmEntry::new( + global_farm_id, + GC_BSX_TKN2_YIELD_FARM_ID, + 200 * ONE, + Zero::zero(), + 18, + 0 + )] + .try_into() + .unwrap(), + }, + ); + + //Garms wasn't updated in this period so no claim from global farm happened. + assert_eq!(Tokens::free_balance(BSX, &global_farm_account), 30_000_000_000 * ONE); + assert_eq!(Tokens::free_balance(BSX, &pot), 0); + + // DEPOSIT 4 (new period): + set_block_number(2051); //period 20 + + let deposited_amount = 800 * ONE; + let yield_farm_id = GC_BSX_TKN2_YIELD_FARM_ID; + + //_0 - value berfore act. + let bsx_tkn2_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(); + + assert_eq!( + LiquidityMining::deposit_lp_shares( + global_farm_id, + yield_farm_id, + BSX_TKN2_AMM, + deposited_amount, + |_, _, _| { Ok(46_400 * ONE) } + ) + .unwrap(), + PREDEFINED_DEPOSIT_IDS[3] + ); + + assert_eq!( + LiquidityMining::global_farm(global_farm_id).unwrap(), + GlobalFarmData { + updated_at: 20, + accumulated_rpz: FixedU128::one(), + pending_rewards: 33_300 * ONE, + accumulated_paid_rewards: 2_000 * ONE, + total_shares_z: 499_300 * ONE, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(), + YieldFarmData { + updated_at: 20, + accumulated_rpvs: FixedU128::from(10), + accumulated_rpz: FixedU128::one(), + total_shares: 825 * ONE, + total_valued_shares: 46_600 * ONE, + entries_count: 2, + left_to_distribute: 2_000 * ONE, + ..bsx_tkn2_yield_farm_0 + }, + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[3]).unwrap(), + DepositData { + shares: deposited_amount, + amm_pool_id: BSX_TKN2_AMM, + yield_farm_entries: vec![YieldFarmEntry::new( + global_farm_id, + GC_BSX_TKN2_YIELD_FARM_ID, + 46_400 * ONE, + FixedU128::from(10), + 20, + 0 + )] + .try_into() + .unwrap(), + }, + ); + + let reserved_for_both_farms = 35_300 * ONE; + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + (30_000_000_000 * ONE - reserved_for_both_farms) + ); + + assert_eq!(Tokens::free_balance(BSX, &pot), reserved_for_both_farms); + + // DEPOSIT 5 (same period, second liq pool yield farm): + set_block_number(2_586); //period 20 + + let deposited_amount = 87 * ONE; + let yield_farm_id = GC_BSX_TKN2_YIELD_FARM_ID; + + //_0 - value berfore act. + let bsx_tkn2_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(); + + assert_eq!( + LiquidityMining::deposit_lp_shares( + global_farm_id, + yield_farm_id, + BSX_TKN2_AMM, + deposited_amount, + |_, _, _| { Ok(261 * ONE) } + ) + .unwrap(), + PREDEFINED_DEPOSIT_IDS[4] + ); + + assert_eq!( + LiquidityMining::global_farm(global_farm_id).unwrap(), + GlobalFarmData { + updated_at: 25, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares_z: 501_910 * ONE, + pending_rewards: 116_550 * ONE, + accumulated_paid_rewards: 1_167_000 * ONE, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 912 * ONE, + total_valued_shares: 46_861 * ONE, + entries_count: 3, + left_to_distribute: 1_167_000 * ONE, + ..bsx_tkn2_yield_farm_0 + }, + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[4]).unwrap(), + DepositData { + shares: deposited_amount, + amm_pool_id: BSX_TKN2_AMM, + yield_farm_entries: vec![YieldFarmEntry::new( + global_farm_id, + GC_BSX_TKN2_YIELD_FARM_ID, + 261 * ONE, + FixedU128::from_inner(35_000_000_000_000_000_000_u128), + 25, + 0 + )] + .try_into() + .unwrap(), + }, + ); + + let reserved_for_both_farms = 1_283_550 * ONE; + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + (30_000_000_000 * ONE - reserved_for_both_farms) + ); + assert_eq!(Tokens::free_balance(BSX, &pot), reserved_for_both_farms); + + // DEPOSIT 6 (same period): + set_block_number(2_596); //period 20 + + let deposited_amount = 48 * ONE; + let yield_farm_id = GC_BSX_TKN2_YIELD_FARM_ID; + + //_0 - value berfore act. + let bsx_tkn2_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(); + + assert_eq!( + LiquidityMining::deposit_lp_shares( + global_farm_id, + yield_farm_id, + BSX_TKN2_AMM, + deposited_amount, + |_, _, _| { Ok(768 * ONE) } + ) + .unwrap(), + PREDEFINED_DEPOSIT_IDS[5] + ); + + assert_eq!( + LiquidityMining::global_farm(global_farm_id).unwrap(), + GlobalFarmData { + updated_at: 25, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares_z: 509_590 * ONE, + pending_rewards: 116_550 * ONE, + accumulated_paid_rewards: 1_167_000 * ONE, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 960 * ONE, + total_valued_shares: 47_629 * ONE, + entries_count: 4, + ..bsx_tkn2_yield_farm_0 //NOTE: same period so nothing claimed by farm + }, + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[5]).unwrap(), + DepositData { + shares: deposited_amount, + amm_pool_id: BSX_TKN2_AMM, + yield_farm_entries: vec![YieldFarmEntry::new( + global_farm_id, + GC_BSX_TKN2_YIELD_FARM_ID, + 768 * ONE, + FixedU128::from_inner(35_000_000_000_000_000_000_u128), + 25, + 0 + )] + .try_into() + .unwrap(), + }, + ); + + let reserved_for_both_farms = 1_283_550 * ONE; + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + (30_000_000_000 * ONE - reserved_for_both_farms) + ); + assert_eq!(Tokens::free_balance(BSX, &pot), reserved_for_both_farms); + + // DEPOSIT 7 : (same period different yield farm) + set_block_number(2_596); //period 20 + + let deposited_amount = 486 * ONE; + let yield_farm_id = GC_BSX_TKN1_YIELD_FARM_ID; + + //_0 - value berfore act. + let bsx_tkn1_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(); + + assert_eq!( + LiquidityMining::deposit_lp_shares( + global_farm_id, + yield_farm_id, + BSX_TKN1_AMM, + deposited_amount, + |_, _, _| { Ok(38_880 * ONE) } + ) + .unwrap(), + PREDEFINED_DEPOSIT_IDS[6] + ); + + assert_eq!( + LiquidityMining::global_farm(global_farm_id).unwrap(), + GlobalFarmData { + updated_at: 25, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares_z: 703_990 * ONE, + pending_rewards: 0, + accumulated_paid_rewards: 1_283_550 * ONE, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 616 * ONE, + total_valued_shares: 45_540 * ONE, + entries_count: 3, + left_to_distribute: 116_550 * ONE, + ..bsx_tkn1_yield_farm_0 + }, + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[6]).unwrap(), + DepositData { + shares: deposited_amount, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![YieldFarmEntry::new( + global_farm_id, + GC_BSX_TKN1_YIELD_FARM_ID, + 38_880 * ONE, + FixedU128::from_inner(17_500_000_000_000_000_000_u128), + 25, + 0 + )] + .try_into() + .unwrap(), + }, + ); + + let reserved_for_both_farms = 1_283_550 * ONE; + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + (30_000_000_000 * ONE - reserved_for_both_farms) + ); + assert_eq!(Tokens::free_balance(BSX, &pot), reserved_for_both_farms); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + + //Deposit to farm with different incentivized_asset and reward_currency. + //Charlie's farm incentivize KSM and reward currency is ACA + //This test only check if valued shares are correctly calculated if reward and incentivized + //assets are different, otherwise farm behavior is same as in test above. + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + set_block_number(2_596); //period 25 + + let deposited_amount = 1_000_000 * ONE; + let deposit_id = 1; //1 - because new test ext + let yield_farm_id = CHARLIE_ACA_KSM_YIELD_FARM_ID; + assert_eq!( + LiquidityMining::deposit_lp_shares( + CHARLIE_FARM, + yield_farm_id, + ACA_KSM_AMM, + deposited_amount, + |_, _, _| { Ok(16_000_000 * ONE) } + ) + .unwrap(), + deposit_id + ); + + assert_eq!( + LiquidityMining::deposit(deposit_id).unwrap(), + DepositData { + shares: deposited_amount, + amm_pool_id: ACA_KSM_AMM, + yield_farm_entries: vec![YieldFarmEntry::new( + CHARLIE_FARM, + CHARLIE_ACA_KSM_YIELD_FARM_ID, + 16_000_000 * ONE, + Zero::zero(), + 25, + 0 + )] + .try_into() + .unwrap(), + }, + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn deposit_lp_shares_bellow_min_deposit_should_not_work() { + let _ = predefined_test_ext_with_deposits().execute_with(|| { + with_transaction(|| { + //NOTE: min. deposit is 10 + let yield_farm_id = GC_BSX_TKN1_YIELD_FARM_ID; + + assert_noop!( + LiquidityMining::deposit_lp_shares(GC_FARM, yield_farm_id, BSX_TKN1_AMM, 0, |_, _, _| { Ok(10_u128) }), + Error::::InvalidDepositAmount + ); + + assert_noop!( + LiquidityMining::deposit_lp_shares(GC_FARM, yield_farm_id, BSX_TKN1_AMM, 1, |_, _, _| { Ok(10_u128) }), + Error::::InvalidDepositAmount + ); + + assert_noop!( + LiquidityMining::deposit_lp_shares(GC_FARM, yield_farm_id, BSX_TKN1_AMM, 8, |_, _, _| { Ok(10_u128) }), + Error::::InvalidDepositAmount + ); + + //margin value should works + assert_ok!(LiquidityMining::deposit_lp_shares( + GC_FARM, + yield_farm_id, + BSX_TKN1_AMM, + crate::MIN_DEPOSIT, + |_, _, _| { Ok(crate::MIN_DEPOSIT) } + )); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }) + }); +} + +#[test] +fn deposit_lp_shares_non_existing_yield_farm_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::deposit_lp_shares(GC_FARM, BSX_DOT_YIELD_FARM_ID, BSX_DOT_AMM, 10_000, |_, _, _| { + Ok(10_u128) + }), + Error::::YieldFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn deposit_lp_shares_stop_yield_farm_should_not_work() { + let _ = predefined_test_ext_with_deposits().execute_with(|| { + with_transaction(|| { + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + assert_noop!( + LiquidityMining::deposit_lp_shares( + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + 10_000, + |_, _, _| { Ok(10_u128) } + ), + Error::::LiquidityMiningCanceled + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }) + }); +} + +#[test] +fn deposit_lp_shares_should_not_work_when_valued_shares_are_bellow_min_deposit() { + let _ = predefined_test_ext_with_deposits().execute_with(|| { + with_transaction(|| { + assert_noop!( + LiquidityMining::deposit_lp_shares( + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + 100_000, + |_, _, _| { Ok(MIN_DEPOSIT - 1) } + ), + Error::::IncorrectValuedShares + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }) + }); +} diff --git a/pallets/liquidity-mining/src/tests/full_run.rs b/pallets/liquidity-mining/src/tests/full_run.rs new file mode 100644 index 00000000000..ea8bd67dcb0 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/full_run.rs @@ -0,0 +1,789 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +use crate::tests::mock::LiquidityMining2; +use test_utils::assert_balance_approx; + +use rand::Rng; + +//This test test full run LM. Global farm is not full but it's running longer than expected. Users +//should be able to claim expected amount. +//This test case is without loyalty factor. +#[test] +fn non_full_farm_running_longer_than_expected() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const GLOBAL_FARM: GlobalFarmId = 1; + const YIELD_FARM_A: YieldFarmId = 2; + const YIELD_FARM_B: YieldFarmId = 3; + + const ALICE_DEPOSIT: DepositId = 1; + const BOB_DEPOSIT: DepositId = 2; + const CHARLIE_DEPOSIT: DepositId = 3; + + //initialize farms + set_block_number(100); + assert_ok!(LiquidityMining2::create_global_farm( + 200_000 * ONE, + 20, + 10, + BSX, + BSX, + GC, + Perquintill::from_float(0.5), + 1_000, + One::one(), + )); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::from(2_u128), + None, + BSX_TKN1_AMM, + vec![BSX, TKN1], + )); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::from(1_u128), + None, + BSX_TKN2_AMM, + vec![BSX, TKN2], + )); + + set_block_number(120); + //alice + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_A, + BSX_TKN1_AMM, + 5_000 * ONE, + |_, _, _| { Ok(5_000 * ONE) } + )); + + //bob + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 2_500 * ONE, + |_, _, _| { Ok(2_500 * ONE) } + )); + + //charlie + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 2_500 * ONE, + |_, _, _| { Ok(2_500 * ONE) } + )); + + set_block_number(401); + + let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); + let bob_bsx_balance_0 = Tokens::free_balance(BSX, &BOB); + let charlie_bsx_balance_0 = Tokens::free_balance(BSX, &CHARLIE); + + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + ALICE_DEPOSIT, + YIELD_FARM_A, + unclaimable + )); + + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + BOB_DEPOSIT, + YIELD_FARM_B, + unclaimable + )); + + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + CHARLIE_DEPOSIT, + YIELD_FARM_B, + unclaimable + )); + + let alice_claimed = Tokens::free_balance(BSX, &ALICE) - alice_bsx_balance_0; + let bob_claimed = Tokens::free_balance(BSX, &BOB) - bob_bsx_balance_0; + let charlie_claimed = Tokens::free_balance(BSX, &CHARLIE) - charlie_bsx_balance_0; + + let claimed_total = alice_claimed + bob_claimed + charlie_claimed; + + assert_eq!(claimed_total.abs_diff(200_000 * ONE), 1002); + + let yield_farm_a_claimed = alice_claimed; + let yield_farm_b_claimed = bob_claimed + charlie_claimed; + + const TOLERANCE: u128 = 10; + assert!( + yield_farm_a_claimed.abs_diff(2 * yield_farm_b_claimed).le(&TOLERANCE), + "yield_farm_a_claimed == 2 * yield_farm_b_claimed" + ); + + assert!( + alice_claimed.abs_diff(4 * bob_claimed).le(&TOLERANCE), + "alice_claimed == 4 * bob_claimed" + ); + + assert_eq!(bob_claimed, charlie_claimed, "bob_claimed == charlie_claimed"); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +//This test tests `update_global_farm` and `update_yield_farm` after farm distributed all the +//rewards. +#[test] +fn non_full_farm_distribute_everything_and_update_farms() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const GLOBAL_FARM: GlobalFarmId = 1; + const YIELD_FARM_A: YieldFarmId = 2; + const YIELD_FARM_B: YieldFarmId = 3; + + const ALICE_DEPOSIT: DepositId = 1; + const BOB_DEPOSIT: DepositId = 2; + const CHARLIE_DEPOSIT: DepositId = 3; + + //initialize farms + set_block_number(100); + assert_ok!(LiquidityMining2::create_global_farm( + 200_000 * ONE, + 20, + 10, + BSX, + BSX, + GC, + Perquintill::from_float(0.5), + 1_000, + One::one(), + )); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::from(2_u128), + None, + BSX_TKN1_AMM, + vec![BSX, TKN1], + )); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::from(1_u128), + None, + BSX_TKN2_AMM, + vec![BSX, TKN2], + )); + + set_block_number(120); + //alice + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_A, + BSX_TKN1_AMM, + 5_000 * ONE, + |_, _, _| { Ok(5_000 * ONE) } + )); + + set_block_number(140); + //bob + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 2_500 * ONE, + |_, _, _| { Ok(2_500 * ONE) } + )); + + //charlie + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 2_500 * ONE, + |_, _, _| { Ok(2_500 * ONE) } + )); + + set_block_number(401); + + //last farms update and claim everything + let _ = LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); + + let _ = LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); + + let _ = LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); + + assert_eq!( + Tokens::free_balance(BSX, &LiquidityMining2::farm_account_id(GLOBAL_FARM).unwrap()), + 1_000 + ); + + assert_eq!( + Tokens::free_balance(BSX, &LiquidityMining2::pot_account_id().unwrap()), + 0 + ); + + set_block_number(501); + let (_, _, claimed, unclaimable) = + LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); + + assert_eq!(claimed, 0); + assert_eq!(unclaimable, 0); + + assert_eq!(LiquidityMining2::global_farm(GLOBAL_FARM).unwrap().updated_at, 50); + assert_eq!( + LiquidityMining2::yield_farm((BSX_TKN1_AMM, GLOBAL_FARM, YIELD_FARM_A)) + .unwrap() + .updated_at, + 50 + ); + + set_block_number(1000); + let _ = LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert_eq!(LiquidityMining2::global_farm(GLOBAL_FARM).unwrap().updated_at, 100); + assert_eq!( + LiquidityMining2::yield_farm((BSX_TKN2_AMM, GLOBAL_FARM, YIELD_FARM_B)) + .unwrap() + .updated_at, + 100 + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +//This test tests `update_global_farm` and `update_yield_farm` after farm distributed all the +//rewards. +#[test] +fn overcrowded_farm_running_longer_than_expected() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const GLOBAL_FARM: GlobalFarmId = 1; + const YIELD_FARM_A: YieldFarmId = 2; + const YIELD_FARM_B: YieldFarmId = 3; + + const ALICE_DEPOSIT: DepositId = 1; + const BOB_DEPOSIT: DepositId = 2; + const CHARLIE_DEPOSIT: DepositId = 3; + + //initialize farms + set_block_number(100); + assert_ok!(LiquidityMining2::create_global_farm( + 200_000 * ONE, + 20, + 10, + BSX, + BSX, + GC, + Perquintill::from_float(0.5), + 1_000, + One::one(), + )); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::from(2_u128), + None, + BSX_TKN1_AMM, + vec![BSX, TKN1], + )); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::from(1_u128), + None, + BSX_TKN2_AMM, + vec![BSX, TKN2], + )); + + //NOTE: farm is overcrowded when Z > 20_000 + set_block_number(120); + //alice + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_A, + BSX_TKN1_AMM, + 10_000 * ONE, + |_, _, _| { Ok(10_000 * ONE) } + )); + + //bob + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 5_000 * ONE, + |_, _, _| { Ok(5_000 * ONE) } + )); + + //charlie + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 5_000 * ONE, + |_, _, _| { Ok(5_000 * ONE) } + )); + + let mut block_number = 131; + + let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); + let bob_bsx_balance_0 = Tokens::free_balance(BSX, &BOB); + let charlie_bsx_balance_0 = Tokens::free_balance(BSX, &CHARLIE); + + let mut last_alice_balance = alice_bsx_balance_0; + let mut last_bob_balance = bob_bsx_balance_0; + let mut last_charlie_balance = charlie_bsx_balance_0; + //NOTE: we must be able to pay at least for 20 periods (131 + (20 * 10)) + while block_number < 331 { + set_block_number(block_number); + + //alice + let _ = LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); + assert!(Tokens::free_balance(BSX, &ALICE).gt(&last_alice_balance)); + last_alice_balance = Tokens::free_balance(BSX, &ALICE); + + //bob + let _ = LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert!(Tokens::free_balance(BSX, &BOB).gt(&last_bob_balance)); + last_bob_balance = Tokens::free_balance(BSX, &BOB); + + //charlie + let _ = LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert!(Tokens::free_balance(BSX, &CHARLIE).gt(&last_charlie_balance)); + last_charlie_balance = Tokens::free_balance(BSX, &CHARLIE); + + block_number += 10; + } + + set_block_number(401); + + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + ALICE_DEPOSIT, + YIELD_FARM_A, + unclaimable + )); + + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + BOB_DEPOSIT, + YIELD_FARM_B, + unclaimable + )); + + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + CHARLIE_DEPOSIT, + YIELD_FARM_B, + unclaimable + )); + + let alice_claimed = Tokens::free_balance(BSX, &ALICE) - alice_bsx_balance_0; + let bob_claimed = Tokens::free_balance(BSX, &BOB) - bob_bsx_balance_0; + let charlie_claimed = Tokens::free_balance(BSX, &CHARLIE) - charlie_bsx_balance_0; + + let claimed_total = alice_claimed + bob_claimed + charlie_claimed; + + assert_eq!((200_000 * ONE) - claimed_total, 1_020); //NOTE: ED = 1_000 + + let yield_farm_a_claimed = alice_claimed; + let yield_farm_b_claimed = bob_claimed + charlie_claimed; + + const TOLERANCE: u128 = 10; + assert!( + yield_farm_a_claimed.abs_diff(2 * yield_farm_b_claimed).le(&TOLERANCE), + "yield_farm_a_claimed == 2 * yield_farm_b_claimed" + ); + + assert!( + alice_claimed.abs_diff(4 * bob_claimed).le(&TOLERANCE), + "alice_claimed == 4 * bob_claimed" + ); + + assert_eq!(bob_claimed, charlie_claimed, "bob_claimed == charlie_claimed"); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +//Note: This test is running for like 4 min. and run it with `--nocapture` to see progress. +#[ignore = "This test takes too much time."] +#[test] +fn full_farm_running_planned_time() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const GLOBAL_FARM: GlobalFarmId = 1; + const YIELD_FARM_A: YieldFarmId = 2; + const YIELD_FARM_B: YieldFarmId = 3; + + const ALICE_DEPOSIT: DepositId = 1; + const BOB_DEPOSIT: DepositId = 2; + const CHARLIE_DEPOSIT: DepositId = 3; + + const PLANNED_PERIODS: u64 = 525_600; //1 year with 10 blocks per period and 6s blocktime. + const BLOCKS_PER_PERIOD: u64 = 10; + const TOTAL_REWARDS_TO_DISTRIBUTE: u128 = 5_256_000 * ONE; + + //initialize farms + set_block_number(100); + //NOTE: This farm is distributing 10BSX per period(10block) for 1 year on chain with 6s + //blocktime if it's full. This farm is full when Z(locked bsx value) = 20_000. + assert_ok!(LiquidityMining2::create_global_farm( + TOTAL_REWARDS_TO_DISTRIBUTE, + PLANNED_PERIODS, //1 year, 6s blocktime + BLOCKS_PER_PERIOD, + BSX, + BSX, + GC, + Perquintill::from_float(0.000_5), + 1_000, + One::one(), + )); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::from(2_u128), + None, + BSX_TKN1_AMM, + vec![BSX, TKN1] + )); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::from(1_u128), + None, + BSX_TKN2_AMM, + vec![BSX, TKN2] + )); + + set_block_number(120); + //alice + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_A, + BSX_TKN1_AMM, + 5_000 * ONE, + |_, _, _| { Ok(5_000 * ONE) } + )); + + //bob + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 5_000 * ONE, + |_, _, _| { Ok(5_000 * ONE) } + )); + + //charlie + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 5_000 * ONE, + |_, _, _| { Ok(5_000 * ONE) } + )); + + let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); + let bob_bsx_balance_0 = Tokens::free_balance(BSX, &BOB); + let charlie_bsx_balance_0 = Tokens::free_balance(BSX, &CHARLIE); + + let mut last_alice_balance = alice_bsx_balance_0; + let mut last_bob_balance = bob_bsx_balance_0; + let mut last_charlie_balance = charlie_bsx_balance_0; + + //NOTE: This farm should distribute rewards for at leas 525_600 periods + let mut current_block = 121; + let last_rewarded_period = current_block + PLANNED_PERIODS * BLOCKS_PER_PERIOD - BLOCKS_PER_PERIOD; + let mut rng = rand::thread_rng(); + let mut i: u32 = 0; + while current_block <= last_rewarded_period { + current_block += BLOCKS_PER_PERIOD; + set_block_number(current_block); + + match rng.gen_range(1..=3) { + 1 => { + //alice + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); + assert!(Tokens::free_balance(BSX, &ALICE).gt(&last_alice_balance)); + assert_eq!(unclaimable, 0); + last_alice_balance = Tokens::free_balance(BSX, &ALICE); + } + 2 => { + //Bob + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert!(Tokens::free_balance(BSX, &BOB).gt(&last_bob_balance)); + assert_eq!(unclaimable, 0); + last_bob_balance = Tokens::free_balance(BSX, &BOB); + } + x => { + //charlie + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert!(Tokens::free_balance(BSX, &CHARLIE).gt(&last_charlie_balance)); + assert_eq!(unclaimable, 0); + last_charlie_balance = Tokens::free_balance(BSX, &CHARLIE); + assert!(x == 3); + } + } + + i += 1; + if i % 50_000 == 0 { + println!("periods: {i}"); + } + } + + set_block_number(last_rewarded_period + 100); + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + ALICE_DEPOSIT, + YIELD_FARM_A, + unclaimable + )); + + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + BOB_DEPOSIT, + YIELD_FARM_B, + unclaimable + )); + + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + CHARLIE_DEPOSIT, + YIELD_FARM_B, + unclaimable + )); + + let alice_claimed = Tokens::free_balance(BSX, &ALICE) - alice_bsx_balance_0; + let bob_claimed = Tokens::free_balance(BSX, &BOB) - bob_bsx_balance_0; + let charlie_claimed = Tokens::free_balance(BSX, &CHARLIE) - charlie_bsx_balance_0; + + let claimed_total = alice_claimed + bob_claimed + charlie_claimed; + + assert_eq!(TOTAL_REWARDS_TO_DISTRIBUTE - claimed_total, 1_000); + + let yield_farm_a_claimed = alice_claimed; + let yield_farm_b_claimed = bob_claimed + charlie_claimed; + + const TOLERANCE: u128 = 10; + assert!( + yield_farm_a_claimed.abs_diff(yield_farm_b_claimed).le(&TOLERANCE), + "yield_farm_a_claimed == yield_farm_b_claimed" + ); + + assert!( + alice_claimed.abs_diff(2 * bob_claimed).le(&TOLERANCE), + "alice_claimed == 2 * bob_claimed" + ); + + assert_eq!(bob_claimed, charlie_claimed, "bob_claimed == charlie_claimed"); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +// This tests that yield farm claims expected amount from global farm. +#[test] +fn yield_farm_should_claim_expected_amount() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const GLOBAL_FARM: GlobalFarmId = 1; + const YIELD_FARM_A: YieldFarmId = 2; + const YIELD_FARM_B: YieldFarmId = 3; + + const ALICE_DEPOSIT: DepositId = 1; + const BOB_DEPOSIT: DepositId = 2; + const CHARLIE_DEPOSIT: DepositId = 3; + + const PLANNED_PERIODS: u64 = 10_000; + const BLOCKS_PER_PERIOD: u64 = 10; + const TOTAL_REWARDS_TO_DISTRIBUTE: u128 = 1_000_000 * ONE; + + let yield_farm_a_key = (BSX_TKN1_AMM, GLOBAL_FARM, YIELD_FARM_A); + let yield_farm_b_key = (BSX_TKN2_AMM, GLOBAL_FARM, YIELD_FARM_B); + + //initialize farms + set_block_number(1000); + assert_ok!(LiquidityMining2::create_global_farm( + TOTAL_REWARDS_TO_DISTRIBUTE, + PLANNED_PERIODS, + BLOCKS_PER_PERIOD, + BSX, + BSX, + GC, + Perquintill::from_float(0.005), + 1_000, + One::one(), + )); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + One::one(), + None, + BSX_TKN1_AMM, + vec![BSX, TKN1] + )); + + //alice + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_A, + BSX_TKN1_AMM, + 10_000 * ONE, + |_, _, _| { Ok(10_000 * ONE) } + )); + + set_block_number(1_500); + + assert_ok!(LiquidityMining2::create_yield_farm( + GC, + GLOBAL_FARM, + One::one(), + None, + BSX_TKN2_AMM, + vec![BSX, TKN2] + )); + + set_block_number(2_000); + //bob + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 10_000 * ONE, + |_, _, _| { Ok(10_000 * ONE) } + )); + + set_block_number(2_500); + //charlie + assert_ok!(LiquidityMining2::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 10_000 * ONE, + |_, _, _| { Ok(10_000 * ONE) } + )); + + let pot = LiquidityMining2::pot_account_id().unwrap(); + assert_eq!( + LiquidityMining2::yield_farm(yield_farm_a_key) + .unwrap() + .left_to_distribute, + 0 + ); + assert_eq!( + LiquidityMining2::yield_farm(yield_farm_b_key) + .unwrap() + .left_to_distribute, + 2_500 * ONE + ); + assert_eq!(Tokens::free_balance(BSX, &pot), 10_000 * ONE); + + //Global farm had rewards for 100_000 blocks. + set_block_number(120_000); + + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + ALICE_DEPOSIT, + YIELD_FARM_A, + unclaimable + )); + + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + BOB_DEPOSIT, + YIELD_FARM_B, + unclaimable + )); + + let (_, _, _, unclaimable) = + LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining2::withdraw_lp_shares( + CHARLIE_DEPOSIT, + YIELD_FARM_B, + unclaimable + )); + + let global_farm_account = LiquidityMining2::farm_account_id(GLOBAL_FARM).unwrap(); + //leftovers in the pot because of rounding errors + assert_balance_approx!(pot, BSX, 0, 2); + + assert_eq!( + LiquidityMining2::yield_farm(yield_farm_a_key) + .unwrap() + .left_to_distribute, + 0 + ); + assert_eq!( + LiquidityMining2::yield_farm(yield_farm_b_key) + .unwrap() + .left_to_distribute, + 1 + ); + assert_eq!(Tokens::free_balance(BSX, &global_farm_account), 1_000); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} diff --git a/pallets/liquidity-mining/src/tests/invariants.rs b/pallets/liquidity-mining/src/tests/invariants.rs new file mode 100644 index 00000000000..7ba94534474 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/invariants.rs @@ -0,0 +1,888 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use crate::tests::test_ext::new_test_ext; +use pretty_assertions::assert_eq; +use proptest::{ + prelude::*, + test_runner::{Config, TestRunner}, +}; +use sp_arithmetic::traits::{CheckedAdd, CheckedMul}; +use std::{cell::RefCell, collections::HashMap}; + +const ONE: Balance = 1_000_000_000_000; +const TOLERANCE: Balance = 1_000; +const REWARD_CURRENCY: AssetId = BSX; + +//6s blocks +const BLOCK_PER_YEAR: u64 = 5_256_000; + +fn total_shares_z() -> impl Strategy { + 0..1_000_000_000 * ONE +} + +fn left_to_distribute() -> impl Strategy { + 190 * ONE..100_000 * ONE +} + +fn reward_per_period() -> impl Strategy { + 190 * ONE..1_000_000 * ONE //190BSX -> distribute 3B in 3 years(6s blocks) with 1 block per period +} + +fn global_farm_accumulated_rewards() -> impl Strategy { + (0..10_000_000_000 * ONE, 0..10_000_000_000 * ONE) +} + +fn accumulated_rpz(total_shares_z: Balance, pending_rewards: Balance) -> impl Strategy { + 0..pending_rewards.checked_div(total_shares_z).unwrap().max(1) +} + +prop_compose! { + fn get_global_farm() + ( + total_shares_z in total_shares_z(), + (pending_rewards, accumulated_paid_rewards) in global_farm_accumulated_rewards(), + reward_per_period in reward_per_period(), + )( + accumulated_rpz in accumulated_rpz(total_shares_z, pending_rewards), + pending_rewards in Just(pending_rewards), + accumulated_paid_rewards in Just(accumulated_paid_rewards), + reward_per_period in Just(reward_per_period), + total_shares_z in Just(total_shares_z), + updated_at in 1_000_000..(BLOCK_PER_YEAR + 1_000_000), + ) + -> GlobalFarmData { + GlobalFarmData:: { + id: 1, + owner: ALICE, + updated_at, + total_shares_z, + accumulated_rpz: FixedU128::from(accumulated_rpz), + reward_currency: REWARD_CURRENCY, + pending_rewards, + accumulated_paid_rewards, + yield_per_period: Perquintill::from_float(0.002), + planned_yielding_periods: 1_000, + blocks_per_period: 1_000, + incentivized_asset: REWARD_CURRENCY, + max_reward_per_period: reward_per_period, + min_deposit: 1, + live_yield_farms_count: Zero::zero(), + total_yield_farms_count: Zero::zero(), + price_adjustment: FixedU128::one(), + state: FarmState::Active, + } + } +} + +prop_compose! { + fn get_farms() + ( + global_farm in get_global_farm(), + )( + yield_farm_accumulated_rpz in 0..global_farm.accumulated_rpz.checked_div_int(1_u128).unwrap().max(1), + tmp_reward in 100_000 * ONE..5_256_000_000 * ONE, //max: 10K for 1 year, every block + yield_farm_updated_at in global_farm.updated_at - 1_000..global_farm.updated_at, + global_farm in Just(global_farm), + ) + -> (GlobalFarmData, YieldFarmData) { + //multiplier == 1 => valued_shares== Z + let rpvs = tmp_reward.checked_div(global_farm.total_shares_z).unwrap(); + + let yield_farm = YieldFarmData:: { + id: 2, + updated_at: yield_farm_updated_at, + total_shares: Default::default(), + total_valued_shares: global_farm.total_shares_z, + accumulated_rpvs: FixedU128::from(rpvs), + accumulated_rpz: FixedU128::from(yield_farm_accumulated_rpz), + loyalty_curve: Default::default(), + multiplier: One::one(), + state: FarmState::Active, + entries_count: Default::default(), + left_to_distribute: Default::default(), + total_stopped: Default::default(), + _phantom: Default::default(), + }; + + (global_farm, yield_farm) + } +} + +prop_compose! { + fn get_global_farm_and_current_period() + ( + global_farm in get_global_farm(), + )( + current_period in global_farm.updated_at..(global_farm.updated_at + BLOCK_PER_YEAR), + global_farm in Just(global_farm), + ) + -> (GlobalFarmData, BlockNumber) { + (global_farm, current_period) + } +} + +prop_compose! { + fn get_farms_and_current_period_and_yield_farm_rewards() + ( + (global_farm, yield_farm) in get_farms(), + )( + current_period in global_farm.updated_at..(global_farm.updated_at + BLOCK_PER_YEAR), + yield_farm in Just(yield_farm), + global_farm in Just(global_farm), + ) + -> (GlobalFarmData, YieldFarmData, BlockNumber, Balance) { + //+1 rounding + let yield_farm_rewards = yield_farm.accumulated_rpvs.checked_mul_int(yield_farm.total_valued_shares).unwrap() + 1; + + (global_farm, yield_farm, current_period, yield_farm_rewards) + } +} + +prop_compose! { + fn get_farms_and_current_period_and_yield_farm_rewards_and_lef_to_distribute() + ( + (global_farm, yield_farm, current_period, yield_farm_rewards) in get_farms_and_current_period_and_yield_farm_rewards(), + )( + left_to_distribute in yield_farm_rewards + ONE..yield_farm_rewards + 1_000_000 * ONE, + global_farm in Just(global_farm), + yield_farm in Just(yield_farm), + current_period in Just(current_period), + yield_farm_rewards in Just(yield_farm_rewards), + ) + -> (GlobalFarmData, YieldFarmData, BlockNumber, Balance, Balance) { + + (global_farm, yield_farm, current_period, yield_farm_rewards, left_to_distribute) + } +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(1_000))] + #[test] + fn sync_global_farm( + (mut farm, current_period) in get_global_farm_and_current_period(), + left_to_distribute in left_to_distribute(), + ) { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + let farm_account = LiquidityMining::farm_account_id(farm.id).unwrap(); + Tokens::set_balance(Origin::root(), farm_account, REWARD_CURRENCY, left_to_distribute, 0).unwrap(); + + //NOTE: _0 - before action, _1 - after action + let pending_rewards_0 = farm.pending_rewards; + let accumulated_rpz_0 = farm.accumulated_rpz; + let reward = LiquidityMining::sync_global_farm(&mut farm, current_period).unwrap(); + + let s_0 = accumulated_rpz_0 + .checked_mul(&FixedU128::from((farm.total_shares_z, ONE))).unwrap() + .checked_add(&FixedU128::from((reward, ONE))).unwrap(); + let s_1 = farm.accumulated_rpz.checked_mul(&FixedU128::from((farm.total_shares_z, ONE))).unwrap(); + + assert_eq_approx!( + s_0, + s_1, + FixedU128::from((TOLERANCE, ONE)), + "acc_rpz[1] x shares = acc_rpz[0] x shares + reward" + ); + + assert!( + farm.pending_rewards == pending_rewards_0.checked_add(reward).unwrap(), + "acc_rewards[1] = acc_rewards[0] + reward" + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + } +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(1_000))] + #[test] + fn claim_rewards_should_be_inclued_in_paid_rewards( + (mut global_farm, mut yield_farm) in get_farms() + ) { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + //NOTE: _0 - before action, _1 - after action + let sum_accumulated_paid_rewards_0 = global_farm.pending_rewards + .checked_add(global_farm.accumulated_paid_rewards).unwrap(); + + let current_period = yield_farm.updated_at + 1; + LiquidityMining::sync_yield_farm(&mut yield_farm, &mut global_farm,current_period).unwrap(); + + let sum_accumulated_paid_rewards_1 = global_farm.pending_rewards + .checked_add(global_farm.accumulated_paid_rewards).unwrap(); + + assert_eq!(sum_accumulated_paid_rewards_0, sum_accumulated_paid_rewards_1); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + } +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(1_000))] + #[test] + fn sync_yield_farm( + (mut global_farm, mut yield_farm, current_period, _, left_to_distribute) in get_farms_and_current_period_and_yield_farm_rewards_and_lef_to_distribute(), + ) { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const GLOBAL_FARM_ID: GlobalFarmId = 1; + + let pot = LiquidityMining::pot_account_id().unwrap(); + let global_farm_account = LiquidityMining::farm_account_id(GLOBAL_FARM_ID).unwrap(); + //rewads for yield farm are paid from global-farm's account to pot + Tokens::set_balance(Origin::root(), global_farm_account, REWARD_CURRENCY, left_to_distribute, 0).unwrap(); + + //NOTE: _0 - before action, _1 - after action + let pot_balance_0 = Tokens::total_balance(REWARD_CURRENCY, &pot); + let global_farm_balance_0 = Tokens::total_balance(REWARD_CURRENCY, &global_farm_account); + let pending_rewards_0 = global_farm.pending_rewards; + let accumulated_rpvs_0 = yield_farm.accumulated_rpvs; + + LiquidityMining::sync_yield_farm( + &mut yield_farm, &mut global_farm, current_period).unwrap(); + + let global_farm_balance_1 = Tokens::total_balance(REWARD_CURRENCY, &global_farm_account); + + //invariant 1 + //NOTE: yield-farm's rewards are left in the pot until user claims. + let pot_balance_1 = Tokens::total_balance(REWARD_CURRENCY, &pot); + let s_0 = global_farm_balance_0 + pot_balance_0; + let s_1 = global_farm_balance_1 + pot_balance_1; + + assert_eq!( + s_0, + s_1, + "invariant: `global_farm_balance + pot_balance` is always constant" + ); + + //invariant 2 + let s_0 = FixedU128::from((pending_rewards_0, ONE)) + accumulated_rpvs_0 * FixedU128::from((yield_farm.total_valued_shares, ONE)); + let s_1 = FixedU128::from((global_farm.pending_rewards, ONE)) + yield_farm.accumulated_rpvs * FixedU128::from((yield_farm.total_valued_shares, ONE)); + + assert_eq!( + s_0, + s_1, + "invariant: `global_farm.pending_rewards + yield_farm.accumulated_rpvs * yield_farm.total_valued_shares` is always constant" + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + } +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(1_000))] + #[test] + fn sync_global_farm_left_to_distribute_invariant( + (mut global_farm, _, current_period, _, left_to_distribute) in get_farms_and_current_period_and_yield_farm_rewards_and_lef_to_distribute(), + ) { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const GLOBAL_FARM_ID: GlobalFarmId = 1; + let global_farm_account = LiquidityMining::farm_account_id(GLOBAL_FARM_ID).unwrap(); + let pot = LiquidityMining::pot_account_id().unwrap(); + Tokens::set_balance(Origin::root(), global_farm_account, REWARD_CURRENCY, left_to_distribute, 0).unwrap(); + + let left_to_distribute_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + + let reward = + LiquidityMining::sync_global_farm(&mut global_farm, current_period).unwrap(); + + let s_0 = (left_to_distribute_0 - reward).max(0); + let s_1 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + + assert_eq!( + s_0, + s_1, + "left_to_distribute[1] = max(0, left_to_distribute[0] - reward)" + ); + + let s_0 = left_to_distribute_0 + pot_balance_0; + let s_1 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account) + Tokens::free_balance(REWARD_CURRENCY, &pot); + + assert_eq!( + s_0, + s_1, + "global_farm_account[0] + pot[0] = global_farm_account[1] + pot[1]" + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + } +} + +#[derive(Clone)] +pub struct InvTestGFarm { + id: GlobalFarmId, + total_rewards: Balance, + reward_currency: AssetId, + yield_farms: Vec<(YieldFarmId, AccountId, Vec)>, +} + +//NOTE: Variables in this block are valid only if creation order in `invariants_externalities` won't change. +thread_local! { + pub static G_FARMS: RefCell> = RefCell::new(vec![ + InvTestGFarm { + id: 1, + total_rewards: 115_000_000 * ONE, + reward_currency: BSX, + yield_farms: vec![ + (4, BSX_TKN1_AMM, vec![BSX, TKN1]), + (5, BSX_TKN2_AMM, vec![BSX, TKN2]) + ] + }, + InvTestGFarm { + id: 2, + total_rewards: 1_000_000_000 * ONE, + reward_currency: BSX, + yield_farms: vec![ + (6, BSX_TKN1_AMM, vec![BSX, TKN1]), + (7, BSX_TKN2_AMM, vec![BSX, TKN2]) + ] + }, + InvTestGFarm { + id: 3, + //NOTE: `total_rewards` is intentionally small. This represents asses with fewer dec. places. + total_rewards: 100_000_000_000_000, + reward_currency: TKN1, + yield_farms: vec![ + (8, BSX_TKN1_AMM, vec![BSX, TKN1]), + (9, BSX_TKN2_AMM, vec![BSX, TKN2]) + ] + } + ]) +} + +pub fn invariants_externalities() -> sp_io::TestExternalities { + let mut ext = ExtBuilder::default().build(); + + ext.execute_with(|| { + let _ = with_transaction(|| { + //global-farms: + assert_ok!(LiquidityMining::create_global_farm( + G_FARMS.with(|v| v.borrow()[0].total_rewards), + 302_400, + 1, + BSX, + G_FARMS.with(|v| v.borrow()[0].reward_currency), + GC, + Perquintill::from_rational(152_207_001_522, FixedU128::DIV), //apr 80% + 1_000, + FixedU128::one() + )); + + assert_ok!(LiquidityMining::create_global_farm( + G_FARMS.with(|v| v.borrow()[1].total_rewards), + 500_000, + 1, + BSX, + G_FARMS.with(|v| v.borrow()[1].reward_currency), + GC, + Perquintill::from_rational(951_293_759_512, FixedU128::DIV), //apr 50% + 1_000, + FixedU128::one() + )); + + assert_ok!(LiquidityMining::create_global_farm( + G_FARMS.with(|v| v.borrow()[2].total_rewards), + 50_000, + 1, + BSX, + G_FARMS.with(|v| v.borrow()[2].reward_currency), + GC, + Perquintill::from_rational(9_512_937_595, FixedU128::DIV), //apr 5% + 1_000, + FixedU128::from_float(0.5_f64) + )); + + //yield-farms + let g_farm = G_FARMS.with(|v| v.borrow()[0].clone()); + assert_ok!(LiquidityMining::create_yield_farm( + GC, + g_farm.id, + FixedU128::one(), + Some(LoyaltyCurve::default()), + g_farm.yield_farms[0].1, + g_farm.yield_farms[0].2.clone(), + )); + + assert_ok!(LiquidityMining::create_yield_farm( + GC, + g_farm.id, + FixedU128::one(), + None, + g_farm.yield_farms[1].1, + g_farm.yield_farms[1].2.clone(), + )); + + let g_farm = G_FARMS.with(|v| v.borrow()[1].clone()); + assert_ok!(LiquidityMining::create_yield_farm( + GC, + g_farm.id, + FixedU128::one(), + Some(LoyaltyCurve::default()), + g_farm.yield_farms[0].1, + g_farm.yield_farms[0].2.clone(), + )); + + assert_ok!(LiquidityMining::create_yield_farm( + GC, + g_farm.id, + FixedU128::from_float(1.5_f64), + None, + g_farm.yield_farms[1].1, + g_farm.yield_farms[1].2.clone(), + )); + + let g_farm = G_FARMS.with(|v| v.borrow()[2].clone()); + assert_ok!(LiquidityMining::create_yield_farm( + GC, + g_farm.id, + FixedU128::one(), + Some(LoyaltyCurve::default()), + g_farm.yield_farms[0].1, + g_farm.yield_farms[0].2.clone(), + )); + + assert_ok!(LiquidityMining::create_yield_farm( + GC, + g_farm.id, + FixedU128::from_float(0.5_f64), + Some(LoyaltyCurve::default()), + g_farm.yield_farms[1].1, + g_farm.yield_farms[1].2.clone(), + )); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + + ext +} + +#[derive(Debug, Clone)] +struct Deposit { + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + amm_pool_id: AccountId, + shares: Balance, + valued_shares: Balance, +} + +prop_compose! { + fn arb_deposit()( + shares in 1_000 * ONE..1_000_000 * ONE, + valued_shares in 1..10_000_000 * ONE, + g_idx in 0..3_usize, + y_idx in 0..2_usize, + ) -> Deposit { + let g_farm = G_FARMS.with(|v| v.borrow()[g_idx].clone()); + let y_farm = &g_farm.yield_farms[y_idx]; + + Deposit {global_farm_id: g_farm.id,yield_farm_id: y_farm.0, amm_pool_id: y_farm.1, shares, valued_shares} + } +} + +#[test] +//https://www.notion.so/Liquidity-mining-spec-b30ccfe470a74173b82c3702b1e8fca1#87868f45e4d04ecb92374c5f795a493d +// +//For each g\ \in\ GlobalFarms +//total\_rewards_g = Balance_g + accumulated\_paid\_rewards_g +\ pending\_rewards_g +//where +//total\_rewards_g = max\_reward\_per\_period\ *\ planned\_yielding\_periods +fn invariant_1() { + //Number of sucessfull test cases that must execute for the test as a whole to pass. + let successfull_cases = 1_000; + //Number of blocks added to current block number in each test case run. This number should be + //reasonable smaller than total of runned test to make sure lot of claims is executed and + //multiple claims for same deposit to happen. + let blocks_offset_range = 1..10_u64; + //Index of deposit in `deposit` vec. This idx is used in each test case run and execute claim + //if deposit exits. + + let deposit_idx_range = 0..500_usize; + + invariants_externalities().execute_with(|| { + let mut runner = TestRunner::new(Config { + cases: successfull_cases, + source_file: Some("liquidity-mining/src/tests/invariants.rs"), + test_name: Some("invariant_1"), + ..Config::default() + }); + let deposits: RefCell> = RefCell::new(Vec::new()); + + runner + .run( + &(arb_deposit(), blocks_offset_range, deposit_idx_range), + |(d, blocks_offset, deposit_idx)| { + deposits.borrow_mut().push(d.clone()); + + //Act + let _ = with_transaction(|| { + assert_ok!(LiquidityMining::deposit_lp_shares( + d.global_farm_id, + d.yield_farm_id, + d.amm_pool_id, + d.shares, + |_, _, _| -> Result { Ok(d.valued_shares) } + )); + + set_block_number(mock::System::block_number() + blocks_offset); + + //claim rewards only if deposit exists + if deposit_idx < deposits.borrow().len() { + let d = &deposits.borrow()[deposit_idx]; + let deposit_id = deposit_idx as u128 + 1; + + assert_ok!(LiquidityMining::claim_rewards(ALICE, deposit_id, d.yield_farm_id, true)); + } + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + + //Assert: + G_FARMS.with(|v| { + v.borrow().clone().into_iter().for_each(|gf| { + let g_farm_balance = Tokens::free_balance( + gf.reward_currency, + &LiquidityMining::farm_account_id(gf.id).unwrap(), + ); + let g_farm_1 = LiquidityMining::global_farm(gf.id).unwrap(); + + //1.1 assert + let s_1 = g_farm_balance + g_farm_1.accumulated_paid_rewards + g_farm_1.pending_rewards; + //NOTE: This should be precise. + assert_eq!(gf.total_rewards, s_1); + + //1.2 assert + let s_1: u128 = g_farm_1.max_reward_per_period * g_farm_1.planned_yielding_periods as u128; + //NOTE: Approax becasue of div in max_reward_per_period calculation. + assert_eq_approx!( + gf.total_rewards, + s_1, + 100_000, + "total_rewards = max_reward_per_period * planned_yielding_periods" + ); + }) + }); + + Ok(()) + }, + ) + .unwrap(); + }); +} + +#[test] +//https://www.notion.so/Liquidity-mining-spec-b30ccfe470a74173b82c3702b1e8fca1#422dea2e23744859baeb704dbdb3caca +// +//\displaystyle \sum_{g\ \in\ globalFarm} total\_rewards_g = \sum_{g\ \in\ globalFarm} Balance_g + Balance_{pot} + \sum_{d\ \epsilon\ Deposits, y\ \in\ YieldFarm}claimed\_rewards^y_d +fn invariant_2() { + //Number of sucessfull test cases that must execute for the test as a whole to pass. + let successfull_cases = 1_000; + //Number of blocks added to current block number in each test case run. This number should be + //reasonable smaller than total of runned test to make sure lot of claims is executed and + //multiple claims for same deposit to happen. + let blocks_offset_range = 1..10_u64; + //Index of deposit in `deposit` vec. This idx is used in each test case run and execute claim + //if deposit exits. + + let deposit_idx_range = 0..500_usize; + + invariants_externalities().execute_with(|| { + let mut runner = TestRunner::new(Config { + cases: successfull_cases, + source_file: Some("liquidity-mining/src/tests/invariants.rs"), + test_name: Some("invariant_2"), + ..Config::default() + }); + let deposits: RefCell> = RefCell::new(Vec::new()); + let pot = LiquidityMining::pot_account_id().unwrap(); + + runner + .run( + &(arb_deposit(), blocks_offset_range, deposit_idx_range), + |(d, blocks_offset, deposit_idx)| { + deposits.borrow_mut().push(d.clone()); + + //Act + let _ = with_transaction(|| { + assert_ok!(LiquidityMining::deposit_lp_shares( + d.global_farm_id, + d.yield_farm_id, + d.amm_pool_id, + d.shares, + |_, _, _| -> Result { Ok(d.valued_shares) } + )); + + set_block_number(mock::System::block_number() + blocks_offset); + + //claim rewards only if deposit exists + if deposit_idx < deposits.borrow().len() { + let d = &deposits.borrow()[deposit_idx]; + let deposit_id = deposit_idx as u128 + 1; + + assert_ok!(LiquidityMining::claim_rewards(ALICE, deposit_id, d.yield_farm_id, true)); + } + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + + //Calculate necessary values and assert + let (total_rewards_sum, farm_balances_sum, pot_balance_sum) = G_FARMS.with(|v| { + let mut total_rewards_sum = 0_u128; + let mut farm_balances_sum = 0_u128; + let mut pot_balance_sum = 0_u128; + let mut already_summed_balances: Vec = Vec::new(); + + v.borrow().clone().into_iter().for_each(|gf| { + farm_balances_sum += Tokens::free_balance( + gf.reward_currency, + &LiquidityMining::farm_account_id(gf.id).unwrap(), + ); + + total_rewards_sum += gf.total_rewards; + + if !already_summed_balances.contains(&gf.reward_currency) { + pot_balance_sum += Tokens::total_balance(gf.reward_currency, &pot); + already_summed_balances.push(gf.reward_currency); + } + }); + (total_rewards_sum, farm_balances_sum, pot_balance_sum) + }); + + let last_deposit_id = LiquidityMining::deposit_id(); + let mut claimed_by_users_sum = 0_u128; + for i in 1..=last_deposit_id { + let d = LiquidityMining::deposit(i).unwrap(); + + let claimed_amount = d.yield_farm_entries[0].accumulated_claimed_rewards; + claimed_by_users_sum += claimed_amount; + } + + //WARN: There is no room for rounding errors in this invariant. Any discrepancy + //in this assert means we are loosing tokens somewhere. + assert_eq!( + total_rewards_sum, + farm_balances_sum + pot_balance_sum + claimed_by_users_sum, + ); + + Ok(()) + }, + ) + .unwrap(); + }); +} + +#[test] +//https://www.notion.so/Liquidity-mining-spec-b30ccfe470a74173b82c3702b1e8fca1#6dd41bee00384293980b7c20d8dc6ec6 +// +//For each g\ \in\ GlobalFarms +//\displaystyle accumulated\_paid\_rewards_g = \sum_{y\ \in\ YieldFarms} left\_to\_distribute_y + \sum_{d\ \in\ Deposits,y\ \in\ YielFarm} claimed\_rewards^y_d +fn invariant_3() { + //Number of sucessfull test cases that must execute for the test as a whole to pass. + let successfull_cases = 1_000; + //Number of blocks added to current block number in each test case run. This number should be + //reasonable smaller than total of runned test to make sure lot of claims is executed and + //multiple claims for same deposit to happen. + let blocks_offset_range = 1..10_u64; + //Index of deposit in `deposit` vec. This idx is used in each test case run and execute claim + //if deposit exits. + + let deposit_idx_range = 0..500_usize; + + invariants_externalities().execute_with(|| { + let mut runner = TestRunner::new(Config { + cases: successfull_cases, + source_file: Some("liquidity-mining/src/tests/invariants.rs"), + test_name: Some("invariant_3"), + ..Config::default() + }); + let deposits: RefCell> = RefCell::new(Vec::new()); + + runner + .run( + &(arb_deposit(), blocks_offset_range, deposit_idx_range), + |(d, blocks_offset, deposit_idx)| { + deposits.borrow_mut().push(d.clone()); + + //Act + let _ = with_transaction(|| { + assert_ok!(LiquidityMining::deposit_lp_shares( + d.global_farm_id, + d.yield_farm_id, + d.amm_pool_id, + d.shares, + |_, _, _| -> Result { Ok(d.valued_shares) } + )); + + set_block_number(mock::System::block_number() + blocks_offset); + + //claim rewards only if deposit exists + if deposit_idx < deposits.borrow().len() { + let d = &deposits.borrow()[deposit_idx]; + let deposit_id = deposit_idx as u128 + 1; + + assert_ok!(LiquidityMining::claim_rewards(ALICE, deposit_id, d.yield_farm_id, true)); + } + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + + //Calculate necessary values and assert + let last_deposit_id = LiquidityMining::deposit_id(); + let mut claimed_by_user_per_yield_farm: HashMap<(GlobalFarmId, YieldFarmId), u128> = HashMap::new(); + for i in 1..=last_deposit_id { + let d = LiquidityMining::deposit(i).unwrap(); + + let claimed_amount = d.yield_farm_entries[0].accumulated_claimed_rewards; + let global_farm_id = d.yield_farm_entries[0].global_farm_id; + let yield_farm_id = d.yield_farm_entries[0].yield_farm_id; + *claimed_by_user_per_yield_farm + .entry((global_farm_id, yield_farm_id)) + .or_insert(0) += claimed_amount; + } + + G_FARMS.with(|v| { + v.borrow().clone().into_iter().for_each(|gf| { + let g_farm = LiquidityMining::global_farm(gf.id).unwrap(); + let mut y_farms_let_to_distribute_sum = 0_u128; + + let mut claimed_by_yield_farms_in_global_farm = 0_u128; + gf.yield_farms.iter().for_each(|yf| { + y_farms_let_to_distribute_sum += LiquidityMining::yield_farm((yf.1, gf.id, yf.0)) + .unwrap() + .left_to_distribute; + + //NOTE this run for each iteration of test so record in HashMap may + //not exists if deposit doesn't exists yet. + claimed_by_yield_farms_in_global_farm += + claimed_by_user_per_yield_farm.get(&(gf.id, yf.0)).unwrap_or(&0_u128); + }); + + assert_eq!( + g_farm.accumulated_paid_rewards, + y_farms_let_to_distribute_sum + claimed_by_yield_farms_in_global_farm + ); + }) + }); + + Ok(()) + }, + ) + .unwrap(); + }); +} + +#[test] +//https://www.notion.so/Liquidity-mining-spec-b30ccfe470a74173b82c3702b1e8fca1#b8cb39a055054198a083c4946110b70d +// +//\displaystyle accumulated\_rewards_g + paid\_accumulated\_rewards_g = \sum_{i\ \in\ +//\{\frac{b}{block\_per\_period_g}|b\ \in\ BlockNumber\}}(accumulated\_rpz^i_g - +//accumulated\_rpz^{i-1}_g) * Z^i_g +fn invariant_4() { + //Number of sucessfull test cases that must execute for the test as a whole to pass. + let successfull_cases = 1_000; + //Number of blocks added to current block number in each test case run. This number should be + //reasonable smaller than total of runned test to make sure lot of claims is executed and + //multiple claims for same deposit to happen. + let blocks_offset_range = 1..10_u64; + //Index of deposit in `deposit` vec. This idx is used in each test case run and execute claim + //if deposit exits. + + let deposit_idx_range = 0..500_usize; + + invariants_externalities().execute_with(|| { + let mut runner = TestRunner::new(Config { + cases: successfull_cases, + source_file: Some("liquidity-mining/src/tests/invariants.rs"), + test_name: Some("invariant_4"), + ..Config::default() + }); + let deposits: RefCell> = RefCell::new(Vec::new()); + let paid_until_now: RefCell> = RefCell::new(HashMap::new()); + + runner + .run( + &(arb_deposit(), blocks_offset_range, deposit_idx_range), + |(d, blocks_offset, deposit_idx)| { + deposits.borrow_mut().push(d.clone()); + let _ = with_transaction(|| { + let g_farm_0 = LiquidityMining::global_farm(d.global_farm_id).unwrap(); + + assert_ok!(LiquidityMining::deposit_lp_shares( + d.global_farm_id, + d.yield_farm_id, + d.amm_pool_id, + d.shares, + |_,_,_| -> Result { + Ok(d.valued_shares) + } + )); + + let g_farm_1 = LiquidityMining::global_farm(g_farm_0.id).unwrap(); + let s_0 = g_farm_1.accumulated_paid_rewards + g_farm_1.pending_rewards; + *paid_until_now.borrow_mut().entry(g_farm_1.id).or_insert(0_u128) += (g_farm_1.accumulated_rpz + - g_farm_0.accumulated_rpz) + .checked_mul_int(g_farm_0.total_shares_z) + .unwrap(); + + //NOTE: global-farm is updated before deposit so in this case we need to + //use Z{now-1} instead of Z{now} which includes deposited shares. + assert_eq_approx!(s_0, *paid_until_now.borrow().get(&d.global_farm_id).unwrap(), 1_000_000, "accumulated_paid_rewards + pending_rewards = sum(rpz{now} - rpz{now-1} * Z{now-1}) for all periods"); + + set_block_number(mock::System::block_number() + blocks_offset); + + //claim rewards only if deposit exists + if deposit_idx < deposits.borrow().len() { + let d = &deposits.borrow()[deposit_idx]; + let deposit_id = deposit_idx as u128 + 1; + + let g_farm_0 = LiquidityMining::global_farm(d.global_farm_id).unwrap(); + + assert_ok!(LiquidityMining::claim_rewards(ALICE, deposit_id, d.yield_farm_id, true)); + + let g_farm_1 = LiquidityMining::global_farm(g_farm_0.id).unwrap(); + let s_0 = g_farm_1.accumulated_paid_rewards + g_farm_1.pending_rewards; + *paid_until_now.borrow_mut().entry(g_farm_1.id).or_insert(0_u128) += (g_farm_1.accumulated_rpz + - g_farm_0.accumulated_rpz) + .checked_mul_int(g_farm_1.total_shares_z) + .unwrap(); + + //NOTE: global-farm is updated before claim so RPZ includes all Z so Z{now} + //must be used in this case. + assert_eq_approx!(s_0, *paid_until_now.borrow().get(&d.global_farm_id).unwrap(), 1_000_000, "accumulated_paid_rewards + pending_rewards = sum(rpz{now} - rpz{now-1} * Z{now}) for all periods"); + } + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + + Ok(()) + }, + ) + .unwrap(); + }); +} diff --git a/pallets/liquidity-mining/src/tests/lm_with_oracle.rs b/pallets/liquidity-mining/src/tests/lm_with_oracle.rs new file mode 100644 index 00000000000..dbb8e90bb13 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/lm_with_oracle.rs @@ -0,0 +1,298 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +use crate::tests::mock::LiquidityMining3; + +//This test is using dummy oracle for price_adjustment. DummyOracle always returns .5 as +//price_adjusment. +#[test] +fn non_full_farm_should_pay_rewards_with_half_speed_when_price_adjustmnet_is_from_dummy_oracle() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const GLOBAL_FARM: GlobalFarmId = 1; + const YIELD_FARM_A: YieldFarmId = 2; + const YIELD_FARM_B: YieldFarmId = 3; + + const ALICE_DEPOSIT: DepositId = 1; + const BOB_DEPOSIT: DepositId = 2; + const CHARLIE_DEPOSIT: DepositId = 3; + + const TOTAL_REWARDS: u128 = 200_000 * ONE; + + //initialize farms + set_block_number(100); + assert_ok!(LiquidityMining3::create_global_farm( + TOTAL_REWARDS, + 20, + 10, + BSX, + BSX, + GC, + Perquintill::from_float(0.5), + 1_000, + One::one(), + )); + + assert_ok!(LiquidityMining3::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::from(2_u128), + None, + BSX_TKN1_AMM, + vec![BSX, TKN1], + )); + + assert_ok!(LiquidityMining3::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::from(1_u128), + None, + BSX_TKN2_AMM, + vec![BSX, TKN2], + )); + + set_block_number(120); + //alice + assert_ok!(LiquidityMining3::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_A, + BSX_TKN1_AMM, + 5_000 * ONE, + |_, _, _| { Ok(5_000 * ONE) } + )); + + //bob + assert_ok!(LiquidityMining3::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 2_500 * ONE, + |_, _, _| { Ok(2_500 * ONE) } + )); + + //charlie + assert_ok!(LiquidityMining3::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_B, + BSX_TKN2_AMM, + 2_500 * ONE, + |_, _, _| { Ok(2_500 * ONE) } + )); + + set_block_number(401); + + let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); + let bob_bsx_balance_0 = Tokens::free_balance(BSX, &BOB); + let charlie_bsx_balance_0 = Tokens::free_balance(BSX, &CHARLIE); + + let (_, _, _, unclaimable) = + LiquidityMining3::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining3::withdraw_lp_shares( + ALICE_DEPOSIT, + YIELD_FARM_A, + unclaimable + )); + + let (_, _, _, unclaimable) = + LiquidityMining3::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining3::withdraw_lp_shares( + BOB_DEPOSIT, + YIELD_FARM_B, + unclaimable + )); + + let (_, _, _, unclaimable) = + LiquidityMining3::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); + assert_eq!(unclaimable, 0); + assert_ok!(LiquidityMining3::withdraw_lp_shares( + CHARLIE_DEPOSIT, + YIELD_FARM_B, + unclaimable + )); + + let alice_claimed = Tokens::free_balance(BSX, &ALICE) - alice_bsx_balance_0; + let bob_claimed = Tokens::free_balance(BSX, &BOB) - bob_bsx_balance_0; + let charlie_claimed = Tokens::free_balance(BSX, &CHARLIE) - charlie_bsx_balance_0; + + assert_eq!(alice_claimed, 70_000 * ONE); + assert_eq!(bob_claimed, 17_500 * ONE); + assert_eq!(charlie_claimed, 17_500 * ONE); + + let claimed_total = alice_claimed + bob_claimed + charlie_claimed; + + assert_eq!(claimed_total.abs_diff(TOTAL_REWARDS), 95_000 * ONE); + + let yield_farm_a_claimed = alice_claimed; + let yield_farm_b_claimed = bob_claimed + charlie_claimed; + + const TOLERANCE: u128 = 10; + assert!( + yield_farm_a_claimed.abs_diff(2 * yield_farm_b_claimed).le(&TOLERANCE), + "yield_farm_a_claimed == 2 * yield_farm_b_claimed" + ); + + assert!( + alice_claimed.abs_diff(4 * bob_claimed).le(&TOLERANCE), + "alice_claimed == 4 * bob_claimed" + ); + + assert_eq!(bob_claimed, charlie_claimed, "bob_claimed == charlie_claimed"); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn oracles_price_adjustment_should_be_used_and_saved_when_oracle_is_available() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const GLOBAL_FARM: GlobalFarmId = 1; + const YIELD_FARM_A: YieldFarmId = 2; + + const ALICE_DEPOSIT: DepositId = 1; + + const TOTAL_REWARDS: u128 = 200_000 * ONE; + + //Arrange + set_block_number(100); + assert_ok!(LiquidityMining3::create_global_farm( + TOTAL_REWARDS, + 20, + 10, + BSX, + BSX, + GC, + Perquintill::from_float(0.5), + 1_000, + FixedU128::from_float(5.5_f64), //default price_adjustment, won't be used. + )); + + assert_ok!(LiquidityMining3::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::from(2_u128), + None, + BSX_TKN1_AMM, + vec![BSX, TKN1], + )); + + set_block_number(120); + //alice + assert_ok!(LiquidityMining3::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_A, + BSX_TKN1_AMM, + 5_000 * ONE, + |_, _, _| { Ok(5_000 * ONE) } + )); + + //Act + set_block_number(401); + let (_, _, claimed_amount, unclaimable) = + LiquidityMining3::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); + + //Assert + assert_eq!(unclaimable, 0); + assert_eq!(claimed_amount, 70_000 * ONE); + //NOTE: global-farm's price_adjustment should be updated + assert_eq!( + LiquidityMining3::global_farm(GLOBAL_FARM).unwrap().price_adjustment, + FixedU128::from_float(0.5_f64) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn last_saved_price_adjustment_should_be_used_when_oracle_is_not_available() { + new_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const GLOBAL_FARM: GlobalFarmId = 1; + const YIELD_FARM_A: YieldFarmId = 2; + + const ALICE_DEPOSIT: DepositId = 1; + + const TOTAL_REWARDS: u128 = 200_000 * ONE; + + //Arrange + set_block_number(100); + assert_ok!(LiquidityMining3::create_global_farm( + TOTAL_REWARDS, + 20, + 1, + BSX, + BSX, + GC, + Perquintill::from_float(0.5), + 1_000, + FixedU128::from(2_u128), //default price_adjustment + )); + + assert_ok!(LiquidityMining3::create_yield_farm( + GC, + GLOBAL_FARM, + FixedU128::one(), + None, + BSX_TKN1_AMM, + vec![BSX, TKN1], + )); + + //NOTE: This is special period. Oracle will fail if global-farm was updated in this + //period. + set_block_number(999_666_333); + //alice + assert_ok!(LiquidityMining3::deposit_lp_shares( + GLOBAL_FARM, + YIELD_FARM_A, + BSX_TKN1_AMM, + 5_000 * ONE, + |_, _, _| { Ok(5_000 * ONE) } + )); + + assert_eq!( + LiquidityMining3::global_farm(GLOBAL_FARM).unwrap().price_adjustment, + FixedU128::from(2_u128) + ); + //Act + set_block_number(999_666_334); + //NOTE: Oracle will fail because global_farm.updated_at == 999_666_333 when oracle is + //called. + let (_, _, claimed_amount, unclaimable) = + LiquidityMining3::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); + + //Assert + assert_eq!(unclaimable, 0); + assert_eq!(claimed_amount, 5_000 * ONE); + //NOTE: oracle is not available so value should not change. + assert_eq!( + LiquidityMining3::global_farm(GLOBAL_FARM).unwrap().price_adjustment, + FixedU128::from(2_u128) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} diff --git a/pallets/liquidity-mining/src/tests/mock.rs b/pallets/liquidity-mining/src/tests/mock.rs new file mode 100644 index 00000000000..8be1303f807 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/mock.rs @@ -0,0 +1,536 @@ +// This file is part of galacticcouncil/warehouse. + +// 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(test)] +use super::*; + +use crate::Config; +use crate::{self as liq_mining, types::DefaultPriceAdjustment}; +use frame_support::{parameter_types, traits::Contains, traits::Everything, PalletId}; +use frame_system as system; +use hydradx_traits::{pools::DustRemovalAccountWhitelist, registry::Registry, AssetKind, AMM}; +use orml_traits::GetByKey; +use sp_core::H256; +use sp_runtime::{ + traits::{BlakeTwo256, BlockNumberProvider, IdentityLookup}, + BuildStorage, +}; + +pub use frame_support::storage::with_transaction; +pub use sp_runtime::TransactionOutcome; + +#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, PartialOrd, Ord, MaxEncodedLen, RuntimeDebug, TypeInfo)] +#[repr(u8)] +pub enum ReserveIdentifier { + Nft, + Marketplace, + // always the last, indicate number of variants + Count, +} + +use std::{cell::RefCell, collections::HashMap}; + +pub type Balance = u128; +pub type AssetId = u32; +pub type Amount = i128; + +pub type AccountId = u128; +pub type FarmId = crate::FarmId; +pub type BlockNumber = u64; +pub const ALICE: AccountId = 10; +pub const BOB: AccountId = 11; +pub const CHARLIE: AccountId = 12; +pub const DAVE: AccountId = 13; +pub const EVE: AccountId = 14; +pub const TREASURY: AccountId = 15; +pub const ACCOUNT_WITH_1M: AccountId = 16; +pub const GC: AccountId = 17; + +pub const INITIAL_BALANCE: u128 = 1_000_000_000_000; + +pub const BSX_ACA_SHARE_ID: AssetId = 100; +pub const BSX_KSM_SHARE_ID: AssetId = 101; +pub const BSX_DOT_SHARE_ID: AssetId = 102; +pub const BSX_ETH_SHARE_ID: AssetId = 103; +pub const BSX_HDX_SHARE_ID: AssetId = 104; +pub const BSX_TKN1_SHARE_ID: AssetId = 105; +pub const BSX_TKN2_SHARE_ID: AssetId = 106; +pub const KSM_DOT_SHARE_ID: AssetId = 107; +pub const ACA_KSM_SHARE_ID: AssetId = 108; + +pub const BSX: AssetId = 1000; +pub const HDX: AssetId = 2000; +pub const ACA: AssetId = 3000; +pub const KSM: AssetId = 4000; +pub const DOT: AssetId = 5000; +pub const ETH: AssetId = 6000; +pub const TKN1: AssetId = 7_001; +pub const TKN2: AssetId = 7_002; +pub const UNKNOWN_ASSET: AssetId = 7_003; + +pub const BSX_ACA_AMM: AccountId = 11_000; +pub const BSX_KSM_AMM: AccountId = 11_001; +pub const BSX_DOT_AMM: AccountId = 11_002; +pub const BSX_ETH_AMM: AccountId = 11_003; +pub const BSX_HDX_AMM: AccountId = 11_004; +pub const BSX_TKN1_AMM: AccountId = 11_005; +pub const BSX_TKN2_AMM: AccountId = 11_006; +pub const DEFAULT_AMM: AccountId = 11_007; +pub const KSM_DOT_AMM: AccountId = 11_008; +pub const ACA_KSM_AMM: AccountId = 11_009; + +pub const BSX_ACA_YIELD_FARM_ID: FarmId = 12_000; +pub const BSX_KSM_YIELD_FARM_ID: FarmId = 12_001; +pub const BSX_DOT_YIELD_FARM_ID: FarmId = 12_002; + +pub const BSX_FARM: FarmId = 1; +pub const KSM_FARM: FarmId = 2; +pub const GC_FARM: FarmId = 3; +pub const ACA_FARM: FarmId = 4; + +pub const ONE: Balance = 1_000_000_000_000; + +type Block = frame_system::mocking::MockBlock; + +#[derive(Clone)] +pub struct AssetPair { + pub asset_in: AssetId, + pub asset_out: AssetId, +} + +frame_support::construct_runtime!( + pub enum Test + { + System: frame_system, + LiquidityMining: liq_mining::, + LiquidityMining2: liq_mining::, + //This LM instance is using dummy oracle for price_adjustment + LiquidityMining3: liq_mining::, + Tokens: orml_tokens, + Balances: pallet_balances, + } +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 63; + pub static MockBlockNumberProvider: u64 = 0; +} + +impl BlockNumberProvider for MockBlockNumberProvider { + type BlockNumber = u64; + + fn current_block_number() -> Self::BlockNumber { + Self::get() + } +} +impl system::Config for Test { + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type Nonce = u64; + type Block = Block; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +pub struct Amm; + +thread_local! { + pub static AMM_POOLS: RefCell> = RefCell::new(HashMap::new()); + pub static DUSTER_WHITELIST: RefCell> = RefCell::new(Vec::new()); +} + +impl AMM for Amm { + fn get_max_out_ratio() -> u128 { + 0_u32.into() + } + + fn get_fee(_pool_account_id: &AccountId) -> (u32, u32) { + (0, 0) + } + + fn get_max_in_ratio() -> u128 { + 0_u32.into() + } + + fn get_pool_assets(_pool_account_id: &AccountId) -> Option> { + None + } + + fn get_spot_price_unchecked(_asset_a: AssetId, _asset_b: AssetId, _amount: Balance) -> Balance { + Balance::from(0_u32) + } + + fn validate_sell( + _origin: &AccountId, + _assets: AssetPair, + _amount: Balance, + _min_bought: Balance, + _discount: bool, + ) -> Result< + hydradx_traits::AMMTransfer, + frame_support::sp_runtime::DispatchError, + > { + Err(sp_runtime::DispatchError::Other("NotImplemented")) + } + + fn execute_buy( + _transfer: &hydradx_traits::AMMTransfer, + ) -> frame_support::dispatch::DispatchResult { + Err(sp_runtime::DispatchError::Other("NotImplemented")) + } + + fn execute_sell( + _transfer: &hydradx_traits::AMMTransfer, + ) -> frame_support::dispatch::DispatchResult { + Err(sp_runtime::DispatchError::Other("NotImplemented")) + } + + fn validate_buy( + _origin: &AccountId, + _assets: AssetPair, + _amount: Balance, + _max_limit: Balance, + _discount: bool, + ) -> Result< + hydradx_traits::AMMTransfer, + frame_support::sp_runtime::DispatchError, + > { + Err(sp_runtime::DispatchError::Other("NotImplemented")) + } + + fn get_min_pool_liquidity() -> Balance { + Balance::from(0_u32) + } + + fn get_min_trading_limit() -> Balance { + Balance::from(0_u32) + } + + // Fn bellow are used by liq. mining pallet + fn exists(assets: AssetPair) -> bool { + AMM_POOLS.with(|v| v.borrow().contains_key(&asset_pair_to_map_key(assets))) + } + + fn get_pair_id(assets: AssetPair) -> AccountId { + AMM_POOLS.with(|v| match v.borrow().get(&asset_pair_to_map_key(assets)) { + Some(p) => p.0, + None => DEFAULT_AMM, + }) + } + + fn get_share_token(assets: AssetPair) -> AssetId { + AMM_POOLS.with(|v| match v.borrow().get(&asset_pair_to_map_key(assets)) { + Some(p) => p.1, + None => BSX, + }) + } +} + +pub fn asset_pair_to_map_key(assets: AssetPair) -> String { + format!("in:{}_out:{}", assets.asset_in, assets.asset_out) +} + +parameter_types! { + pub const LMPalletId: PalletId = PalletId(*b"TEST_lm_"); + pub const MinPlannedYieldingPeriods: BlockNumber = 100; + pub const MinTotalFarmRewards: Balance = 1_000_000; + #[derive(PartialEq, Eq)] + pub const MaxEntriesPerDeposit: u8 = 5; + pub const MaxYieldFarmsPerGlobalFarm: u8 = 4; +} + +impl Config for Test { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type MultiCurrency = Tokens; + type PalletId = LMPalletId; + type MinPlannedYieldingPeriods = MinPlannedYieldingPeriods; + type MinTotalFarmRewards = MinTotalFarmRewards; + type BlockNumberProvider = MockBlockNumberProvider; + type AmmPoolId = AccountId; + type MaxFarmEntriesPerDeposit = MaxEntriesPerDeposit; + type MaxYieldFarmsPerGlobalFarm = MaxYieldFarmsPerGlobalFarm; + type NonDustableWhitelistHandler = Whitelist; + type AssetRegistry = AssetRegistry; + type PriceAdjustment = DefaultPriceAdjustment; +} + +parameter_types! { + pub const LMPalletId2: PalletId = PalletId(*b"TEST_lm2"); + pub const MinPlannedYieldingPeriods2: BlockNumber = 10; + pub const MinTotalFarmRewards2: Balance = 100_000; + pub const MininumDeposit2: Balance = 1; + pub const MaxEntriesPerDeposit2: u8 = 1; +} + +impl Config for Test { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type MultiCurrency = Tokens; + type PalletId = LMPalletId2; + type MinPlannedYieldingPeriods = MinPlannedYieldingPeriods2; + type MinTotalFarmRewards = MinTotalFarmRewards2; + type BlockNumberProvider = MockBlockNumberProvider; + type AmmPoolId = AccountId; + type MaxFarmEntriesPerDeposit = MaxEntriesPerDeposit2; + type MaxYieldFarmsPerGlobalFarm = MaxYieldFarmsPerGlobalFarm; + type NonDustableWhitelistHandler = Whitelist; + type AssetRegistry = AssetRegistry; + type PriceAdjustment = DefaultPriceAdjustment; +} + +parameter_types! { + pub const LMPalletId3: PalletId = PalletId(*b"TEST_lm3"); +} + +impl Config for Test { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type MultiCurrency = Tokens; + type PalletId = LMPalletId3; + type MinPlannedYieldingPeriods = MinPlannedYieldingPeriods2; + type MinTotalFarmRewards = MinTotalFarmRewards; + type BlockNumberProvider = MockBlockNumberProvider; + type AmmPoolId = AccountId; + type MaxFarmEntriesPerDeposit = MaxEntriesPerDeposit; + type MaxYieldFarmsPerGlobalFarm = MaxYieldFarmsPerGlobalFarm; + type NonDustableWhitelistHandler = Whitelist; + type AssetRegistry = AssetRegistry; + type PriceAdjustment = DummyOraclePriceAdjustment; +} + +parameter_types! { + pub const MaxLocks: u32 = 1; + pub const ExistentialDeposit: u128 = 500; + pub const MaxReserves: u32 = 50; +} + +impl pallet_balances::Config for Test { + type Balance = Balance; + type RuntimeEvent = RuntimeEvent; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = frame_system::Pallet; + type MaxLocks = (); + type WeightInfo = (); + type MaxReserves = MaxReserves; + type ReserveIdentifier = ReserveIdentifier; + type FreezeIdentifier = (); + type MaxFreezes = (); + type MaxHolds = (); + type RuntimeHoldReason = (); +} + +impl orml_tokens::Config for Test { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type Amount = Amount; + type CurrencyId = AssetId; + type WeightInfo = (); + type ExistentialDeposits = AssetRegistry; + type MaxLocks = MaxLocks; + type DustRemovalWhitelist = Whitelist; + type MaxReserves = ConstU32<100_000>; + type ReserveIdentifier = (); + type CurrencyHooks = (); +} + +pub struct DummyOraclePriceAdjustment; + +impl PriceAdjustment> for DummyOraclePriceAdjustment { + type Error = DispatchError; + + type PriceAdjustment = FixedU128; + + fn get(global_farm: &GlobalFarmData) -> Result { + //This is special case to test global-fram's fallback when oracle is not available. + if global_farm.updated_at == 999_666_333 { + Err(sp_runtime::DispatchError::Other( + "Oracle is not available - updated_at == 999_666_333 is special case.", + )) + } else { + Ok(FixedU128::from_inner(500_000_000_000_000_000)) //0.5 + } + } +} + +pub struct Whitelist; + +impl Contains for Whitelist { + fn contains(account: &AccountId) -> bool { + if *account == LiquidityMining::pot_account_id().unwrap() { + return true; + } + + DUSTER_WHITELIST.with(|v| v.borrow().contains(account)) + } +} + +impl DustRemovalAccountWhitelist for Whitelist { + type Error = DispatchError; + + fn add_account(account: &AccountId) -> Result<(), Self::Error> { + if Whitelist::contains(account) { + return Err(sp_runtime::DispatchError::Other("Account is already in the whitelist")); + } + + DUSTER_WHITELIST.with(|v| v.borrow_mut().push(*account)); + + Ok(()) + } + + fn remove_account(account: &AccountId) -> Result<(), Self::Error> { + DUSTER_WHITELIST.with(|v| { + let mut v = v.borrow_mut(); + + let idx = v.iter().position(|x| *x == *account).unwrap(); + v.remove(idx); + + Ok(()) + }) + } +} + +pub struct AssetRegistry; + +impl Registry, Balance, DispatchError> for AssetRegistry { + fn exists(name: AssetId) -> bool { + name != UNKNOWN_ASSET + } + + fn retrieve_asset(_name: &Vec) -> Result { + Err(sp_runtime::DispatchError::Other("NotImplemented")) + } + + fn retrieve_asset_type(_asset_id: AssetId) -> Result { + unimplemented!() + } + + fn create_asset(_name: &Vec, _existential_deposit: Balance) -> Result { + Err(sp_runtime::DispatchError::Other("NotImplemented")) + } + + fn get_or_create_asset(_name: Vec, _existential_deposit: Balance) -> Result { + Err(sp_runtime::DispatchError::Other("NotImplemented")) + } +} + +impl GetByKey for AssetRegistry { + fn get(_key: &AssetId) -> Balance { + 1_000_u128 + } +} + +pub struct ExtBuilder { + endowed_accounts: Vec<(AccountId, AssetId, Balance)>, +} + +impl Default for ExtBuilder { + fn default() -> Self { + Self { + endowed_accounts: vec![ + (ALICE, BSX_ACA_SHARE_ID, INITIAL_BALANCE * ONE), + (ALICE, BSX_DOT_SHARE_ID, INITIAL_BALANCE * ONE), + (ALICE, BSX_KSM_SHARE_ID, INITIAL_BALANCE * ONE), + (ALICE, BSX_TKN1_SHARE_ID, 3_000_000 * ONE), + (ALICE, BSX_TKN2_SHARE_ID, 3_000_000 * ONE), + (ALICE, ACA_KSM_SHARE_ID, 3_000_000 * ONE), + (ALICE, BSX, INITIAL_BALANCE * ONE), + (ACCOUNT_WITH_1M, BSX, 1_000_000 * ONE), + (BOB, BSX_ACA_SHARE_ID, INITIAL_BALANCE * ONE), + (BOB, BSX_DOT_SHARE_ID, INITIAL_BALANCE * ONE), + (BOB, BSX_KSM_SHARE_ID, INITIAL_BALANCE * ONE), + (BOB, BSX_TKN1_SHARE_ID, 2_000_000 * ONE), + (BOB, BSX_TKN2_SHARE_ID, 2_000_000 * ONE), + (BOB, ACA_KSM_SHARE_ID, 2_000_000 * ONE), + (BOB, BSX, INITIAL_BALANCE * ONE), + (BOB, KSM, INITIAL_BALANCE * ONE), + (CHARLIE, BSX_ACA_SHARE_ID, INITIAL_BALANCE * ONE), + (CHARLIE, BSX_DOT_SHARE_ID, INITIAL_BALANCE * ONE), + (CHARLIE, BSX_KSM_SHARE_ID, INITIAL_BALANCE * ONE), + (CHARLIE, BSX_TKN1_SHARE_ID, 5_000_000 * ONE), + (CHARLIE, BSX_TKN2_SHARE_ID, 5_000_000 * ONE), + (CHARLIE, BSX, INITIAL_BALANCE * ONE), + (CHARLIE, KSM, INITIAL_BALANCE * ONE), + (CHARLIE, ACA, INITIAL_BALANCE * ONE), + (DAVE, BSX_ACA_SHARE_ID, INITIAL_BALANCE * ONE), + (DAVE, BSX_DOT_SHARE_ID, INITIAL_BALANCE * ONE), + (DAVE, BSX_KSM_SHARE_ID, INITIAL_BALANCE * ONE), + (DAVE, BSX_TKN1_SHARE_ID, 10_000_000 * ONE), + (DAVE, BSX_TKN2_SHARE_ID, 10_000_000 * ONE), + (DAVE, BSX, INITIAL_BALANCE * ONE), + (DAVE, KSM, INITIAL_BALANCE * ONE), + (DAVE, ACA, INITIAL_BALANCE * ONE), + (GC, BSX, INITIAL_BALANCE * ONE), + (GC, TKN1, INITIAL_BALANCE * ONE), + (GC, TKN2, INITIAL_BALANCE * ONE), + (TREASURY, BSX, 1_000_000_000_000 * ONE), + (TREASURY, ACA, 1_000_000_000_000 * ONE), + (TREASURY, HDX, 1_000_000_000_000 * ONE), + (TREASURY, KSM, 1_000_000_000_000 * ONE), + (EVE, BSX_ACA_SHARE_ID, INITIAL_BALANCE * ONE), + (EVE, BSX_DOT_SHARE_ID, INITIAL_BALANCE * ONE), + (EVE, BSX_KSM_SHARE_ID, INITIAL_BALANCE * ONE), + (EVE, BSX_TKN1_SHARE_ID, 10_000_000 * ONE), + (EVE, BSX_TKN2_SHARE_ID, 10_000_000 * ONE), + (EVE, BSX, INITIAL_BALANCE * ONE), + (EVE, KSM, INITIAL_BALANCE * ONE), + (EVE, ACA, INITIAL_BALANCE * ONE), + ], + } + } +} + +impl ExtBuilder { + pub fn build(self) -> sp_io::TestExternalities { + AMM_POOLS.with(|v| v.borrow_mut().clear()); + DUSTER_WHITELIST.with(|v| v.borrow_mut().clear()); + + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); + + orml_tokens::GenesisConfig:: { + balances: self.endowed_accounts, + } + .assimilate_storage(&mut t) + .unwrap(); + + t.into() + } +} + +pub fn set_block_number(n: u64) { + MockBlockNumberProvider::set(n); + System::set_block_number(n); +} diff --git a/pallets/liquidity-mining/src/tests/mod.rs b/pallets/liquidity-mining/src/tests/mod.rs new file mode 100644 index 00000000000..aabc3c60034 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/mod.rs @@ -0,0 +1,269 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use mock::{ + asset_pair_to_map_key, set_block_number, with_transaction, AccountId, AssetId, AssetPair, Balance, BlockNumber, + ExtBuilder, LiquidityMining, RuntimeOrigin as Origin, Test, Tokens, TransactionOutcome, Whitelist, ACA, ACA_FARM, + ACA_KSM_AMM, ACA_KSM_SHARE_ID, ACCOUNT_WITH_1M, ALICE, AMM_POOLS, BOB, BSX, BSX_ACA_AMM, BSX_ACA_SHARE_ID, + BSX_ACA_YIELD_FARM_ID, BSX_DOT_AMM, BSX_DOT_SHARE_ID, BSX_DOT_YIELD_FARM_ID, BSX_ETH_AMM, BSX_ETH_SHARE_ID, + BSX_FARM, BSX_HDX_AMM, BSX_HDX_SHARE_ID, BSX_KSM_AMM, BSX_KSM_SHARE_ID, BSX_KSM_YIELD_FARM_ID, BSX_TKN1_AMM, + BSX_TKN1_SHARE_ID, BSX_TKN2_AMM, BSX_TKN2_SHARE_ID, CHARLIE, DAVE, DOT, ETH, EVE, GC, GC_FARM, HDX, + INITIAL_BALANCE, KSM, KSM_DOT_AMM, KSM_DOT_SHARE_ID, KSM_FARM, ONE, TKN1, TKN2, TREASURY, UNKNOWN_ASSET, +}; + +use frame_support::{assert_noop, assert_ok, traits::Contains}; + +use sp_arithmetic::{traits::CheckedSub, FixedPointNumber}; +use std::cmp::Ordering; + +const ALICE_FARM: u32 = BSX_FARM; +const BOB_FARM: u32 = KSM_FARM; +const CHARLIE_FARM: u32 = ACA_FARM; +const DAVE_FARM: u32 = 5; +const EVE_FARM: u32 = 6; + +thread_local! { +static PREDEFINED_GLOBAL_FARMS_INS1: [GlobalFarmData; 6] = [ + GlobalFarmData { + id: ALICE_FARM, + updated_at: 0, + reward_currency: BSX, + yield_per_period: Perquintill::from_percent(20), + planned_yielding_periods: 300_u64, + blocks_per_period: 1_000_u64, + owner: ALICE, + incentivized_asset: BSX, + max_reward_per_period: 333_333_333_333_333_333_333, + accumulated_rpz: Zero::zero(), + live_yield_farms_count: Zero::zero(), + total_yield_farms_count: Zero::zero(), + accumulated_paid_rewards: 0, + total_shares_z: 0, + pending_rewards: 0, + state: FarmState::Active, + min_deposit: 1_000, + price_adjustment: One::one(), + }, + GlobalFarmData { + id: BOB_FARM, + updated_at: 0, + reward_currency: KSM, + yield_per_period: Perquintill::from_percent(38), + planned_yielding_periods: 5_000_u64, + blocks_per_period: 10_000_u64, + owner: BOB, + incentivized_asset: BSX, + max_reward_per_period: 200_000 * ONE, + accumulated_rpz: Zero::zero(), + live_yield_farms_count: Zero::zero(), + total_yield_farms_count: Zero::zero(), + accumulated_paid_rewards: 0, + total_shares_z: 0, + pending_rewards: 0, + state: FarmState::Active, + min_deposit: 1_000, + price_adjustment: One::one(), + }, + GlobalFarmData { + id: GC_FARM, + updated_at: 0, + reward_currency: BSX, + yield_per_period: Perquintill::from_percent(50), + planned_yielding_periods: 500_u64, + blocks_per_period: 100_u64, + owner: GC, + incentivized_asset: BSX, + max_reward_per_period: 60_000_000 * ONE, + accumulated_rpz: Zero::zero(), + live_yield_farms_count: 2, + total_yield_farms_count: 2, + accumulated_paid_rewards: 0, + total_shares_z: 0, + pending_rewards: 0, + state: FarmState::Active, + min_deposit: 1_000, + price_adjustment: One::one(), + }, + GlobalFarmData { + id: CHARLIE_FARM, + updated_at: 0, + reward_currency: ACA, + yield_per_period: Perquintill::from_percent(50), + planned_yielding_periods: 500_u64, + blocks_per_period: 100_u64, + owner: CHARLIE, + incentivized_asset: KSM, + max_reward_per_period: 60_000_000 * ONE, + accumulated_rpz: Zero::zero(), + live_yield_farms_count: 1, + total_yield_farms_count: 1, + accumulated_paid_rewards: 0, + total_shares_z: 0, + pending_rewards: 0, + state: FarmState::Active, + min_deposit: 1_000, + price_adjustment: FixedU128::from_float(0.5), + }, + GlobalFarmData { + id: DAVE_FARM, + updated_at: 0, + reward_currency: ACA, + yield_per_period: Perquintill::from_percent(20), + planned_yielding_periods: 300_u64, + blocks_per_period: 1_000_u64, + owner: DAVE, + incentivized_asset: TKN1, + max_reward_per_period: 333_333_333_333, + accumulated_rpz: Zero::zero(), + live_yield_farms_count: Zero::zero(), + total_yield_farms_count: Zero::zero(), + accumulated_paid_rewards: 0, + total_shares_z: 0, + pending_rewards: 0, + state: FarmState::Active, + min_deposit: 1_000, + price_adjustment: One::one(), + }, + GlobalFarmData { + id: EVE_FARM, + updated_at: 0, + reward_currency: KSM, + yield_per_period: Perquintill::from_percent(20), + planned_yielding_periods: 300_u64, + blocks_per_period: 1_000_u64, + owner: EVE, + incentivized_asset: BSX, + max_reward_per_period: 333_333_333_333, + accumulated_rpz: Zero::zero(), + live_yield_farms_count: Zero::zero(), + total_yield_farms_count: Zero::zero(), + accumulated_paid_rewards: 0, + total_shares_z: 0, + pending_rewards: 0, + state: FarmState::Active, + min_deposit: 1_000, + price_adjustment: One::one(), + }, +] +} + +const GC_BSX_TKN1_YIELD_FARM_ID: u32 = 7; +const GC_BSX_TKN2_YIELD_FARM_ID: u32 = 8; +const CHARLIE_ACA_KSM_YIELD_FARM_ID: u32 = 9; +const DAVE_BSX_TKN1_YIELD_FARM_ID: u32 = 10; +const EVE_BSX_TKN1_YIELD_FARM_ID: u32 = 11; +const EVE_BSX_TKN2_YIELD_FARM_ID: u32 = 12; + +thread_local! { + static PREDEFINED_YIELD_FARMS_INS1: [YieldFarmData; 6] = [ + YieldFarmData::new( + GC_BSX_TKN1_YIELD_FARM_ID, + 0, + Some(LoyaltyCurve::default()), + FixedU128::from(5), + ), + YieldFarmData::new( + GC_BSX_TKN2_YIELD_FARM_ID, + 0, + Some(LoyaltyCurve::default()), + FixedU128::from(10), + ), + YieldFarmData::new( + CHARLIE_ACA_KSM_YIELD_FARM_ID, + 0, + Some(LoyaltyCurve::default()), + FixedU128::from(10), + ), + YieldFarmData::new( + DAVE_BSX_TKN1_YIELD_FARM_ID, + 0, + Some(LoyaltyCurve::default()), + FixedU128::from(10), + ), + YieldFarmData::new( + EVE_BSX_TKN1_YIELD_FARM_ID, + 0, + Some(LoyaltyCurve::default()), + FixedU128::from(10), + ), + YieldFarmData::new( + EVE_BSX_TKN2_YIELD_FARM_ID, + 0, + Some(LoyaltyCurve::default()), + FixedU128::from(10), + ), + ] +} + +const PREDEFINED_DEPOSIT_IDS: [u128; 7] = [1, 2, 3, 4, 5, 6, 7]; + +//NOTE: look at approx pallet - https://github.com/brendanzab/approx +fn is_approx_eq_fixedu128(num_1: FixedU128, num_2: FixedU128, delta: FixedU128) -> bool { + let diff = match num_1.cmp(&num_2) { + Ordering::Less => num_2.checked_sub(&num_1).unwrap(), + Ordering::Greater => num_1.checked_sub(&num_2).unwrap(), + Ordering::Equal => return true, + }; + + if diff.cmp(&delta) == Ordering::Greater { + println!("diff: {diff:?}; delta: {delta:?}; n1: {num_1:?}; n2: {num_2:?}"); + + false + } else { + true + } +} + +fn get_predefined_global_farm_ins1(idx: usize) -> GlobalFarmData { + PREDEFINED_GLOBAL_FARMS_INS1.with(|v| v[idx].clone()) +} + +fn get_predefined_yield_farm_ins1(idx: usize) -> YieldFarmData { + PREDEFINED_YIELD_FARMS_INS1.with(|v| v[idx].clone()) +} + +#[macro_export] +macro_rules! assert_eq_approx { + ( $x:expr, $y:expr, $z:expr, $r:expr) => {{ + let diff = if $x >= $y { $x - $y } else { $y - $x }; + if diff > $z { + panic!("\n{} not equal\n left: {:?}\nright: {:?}\n", $r, $x, $y); + } + }}; +} + +pub mod claim_rewards; +pub mod create_global_farm; +pub mod create_yield_farm; +pub mod deposit_lp_shares; +pub mod full_run; +pub mod invariants; +pub mod mock; +pub mod redeposit_lp_shares; +pub mod resume_yield_farm; +pub mod stop_yield_farm; +pub mod terminate_global_farm; +pub mod terminate_yield_farm; +pub mod test_ext; + +pub mod lm_with_oracle; +#[allow(clippy::module_inception)] +pub mod tests; +pub mod update_global_farm; +pub mod update_yield_farm; +pub mod withdraw_lp_shares; diff --git a/pallets/liquidity-mining/src/tests/redeposit_lp_shares.rs b/pallets/liquidity-mining/src/tests/redeposit_lp_shares.rs new file mode 100644 index 00000000000..4a785d74110 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/redeposit_lp_shares.rs @@ -0,0 +1,289 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn redeposit_lp_shares_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + //predefined_deposit[0] - GC_FARM, BSX_TKN1_AMM + set_block_number(50_000); + assert_eq!( + LiquidityMining::redeposit_lp_shares( + EVE_FARM, + EVE_BSX_TKN1_YIELD_FARM_ID, + PREDEFINED_DEPOSIT_IDS[0], + |_, _, _| { Ok(500 * ONE) } + ) + .unwrap(), + (50 * ONE, BSX_TKN1_AMM) + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, EVE_FARM, EVE_BSX_TKN1_YIELD_FARM_ID)) + .unwrap() + .entries_count, + 1 + ); + + set_block_number(800_000); + //Dave's farm incentivize TKN1 - some balance must be set so `valued_shares` will not be `0`. + assert_eq!( + LiquidityMining::redeposit_lp_shares( + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + PREDEFINED_DEPOSIT_IDS[0], + |_, _, _| { Ok(5_000 * ONE) } + ) + .unwrap(), + (50 * ONE, BSX_TKN1_AMM) + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, DAVE_FARM, DAVE_BSX_TKN1_YIELD_FARM_ID)) + .unwrap() + .entries_count, + 1 + ); + + let deposit = LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(); + + assert_eq!( + deposit.yield_farm_entries, + vec![ + YieldFarmEntry { + global_farm_id: GC_FARM, + valued_shares: 2_500 * ONE, + yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 0, + accumulated_rpvs: Zero::zero(), + entered_at: 18, + updated_at: 18, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + YieldFarmEntry { + global_farm_id: EVE_FARM, + valued_shares: 500 * ONE, + yield_farm_id: EVE_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 0, + accumulated_rpvs: Zero::zero(), + entered_at: 50, + updated_at: 50, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + YieldFarmEntry { + global_farm_id: DAVE_FARM, + valued_shares: 5_000 * ONE, + yield_farm_id: DAVE_BSX_TKN1_YIELD_FARM_ID, + accumulated_claimed_rewards: 0, + accumulated_rpvs: Zero::zero(), + entered_at: 800, + updated_at: 800, + stopped_at_creation: 0, + _phantom: PhantomData, + }, + ] + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] +fn redeposit_lp_shares_deposit_not_found_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let yield_farm_id = DAVE_BSX_TKN1_YIELD_FARM_ID; + + assert_noop!( + LiquidityMining::redeposit_lp_shares(DAVE_FARM, yield_farm_id, 999_999_999, |_, _, _| { Ok(10_u128) }), + Error::::InconsistentState(InconsistentStateError::DepositNotFound) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn redeposit_lp_shares_to_wrong_yield_farm_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + // Desired yield farm is for different assert pair than original deposit. + let yield_farm_id = EVE_BSX_TKN2_YIELD_FARM_ID; //original deposit is for bsx/tkn1 assert pair + + assert_noop!( + LiquidityMining::redeposit_lp_shares(EVE_FARM, yield_farm_id, PREDEFINED_DEPOSIT_IDS[0], |_, _, _| { + Ok(10_u128) + }), + Error::::YieldFarmNotFound + ); + + // Same global farm different asset pair. + let yield_farm_id = GC_BSX_TKN2_YIELD_FARM_ID; + assert_noop!( + LiquidityMining::redeposit_lp_shares(GC_FARM, yield_farm_id, PREDEFINED_DEPOSIT_IDS[0], |_, _, _| { + Ok(10_u128) + }), + Error::::YieldFarmNotFound + ); + + //Desired yield farm is not in the provided global farm. + let yield_farm_id = EVE_BSX_TKN1_YIELD_FARM_ID; + assert_noop!( + LiquidityMining::redeposit_lp_shares(GC_FARM, yield_farm_id, PREDEFINED_DEPOSIT_IDS[0], |_, _, _| { + Ok(10_u128) + }), + Error::::YieldFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn redeposit_lp_shares_to_not_active_yield_farm_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let yield_farm_id = EVE_BSX_TKN1_YIELD_FARM_ID; + + //Deposit to yield farm to prevent flushing from storage on destroy. + assert_ok!(LiquidityMining::deposit_lp_shares( + EVE_FARM, + yield_farm_id, + BSX_TKN1_AMM, + 1_000, + |_, _, _| { Ok(1_000_u128) } + )); + + // Redeposit to stopped farm. + assert_ok!(LiquidityMining::stop_yield_farm(EVE, EVE_FARM, BSX_TKN1_AMM)); + + assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, EVE_FARM, yield_farm_id)) + .unwrap() + .state + .is_stopped()); + + assert_noop!( + LiquidityMining::redeposit_lp_shares(EVE_FARM, yield_farm_id, PREDEFINED_DEPOSIT_IDS[0], |_, _, _| { + Ok(10_u128) + }), + Error::::LiquidityMiningCanceled + ); + + // Redeposit to deleted farm + assert_ok!(LiquidityMining::terminate_yield_farm( + EVE, + EVE_FARM, + yield_farm_id, + BSX_TKN1_AMM + )); + + assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, EVE_FARM, yield_farm_id)) + .unwrap() + .state + .is_terminated()); + + assert_noop!( + LiquidityMining::redeposit_lp_shares(EVE_FARM, yield_farm_id, PREDEFINED_DEPOSIT_IDS[0], |_, _, _| { + Ok(10_u128) + }), + Error::::LiquidityMiningCanceled + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn redeposit_lp_shares_non_existing_farm_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const NON_EXISTING_YILED_FARM_ID: FarmId = 999_999_999; + + assert_noop!( + LiquidityMining::redeposit_lp_shares( + EVE_FARM, + NON_EXISTING_YILED_FARM_ID, + PREDEFINED_DEPOSIT_IDS[0], + |_, _, _| { Ok(10_u128) } + ), + Error::::YieldFarmNotFound + ); + + const NON_EXISTING_GLOBAL_FARM_ID: FarmId = 999_999_999; + assert_noop!( + LiquidityMining::redeposit_lp_shares( + NON_EXISTING_GLOBAL_FARM_ID, + GC_BSX_TKN2_YIELD_FARM_ID, + PREDEFINED_DEPOSIT_IDS[0], + |_, _, _| { Ok(10_u128) } + ), + Error::::YieldFarmNotFound //NOTE: check for yield farm existence is first that's why this error. + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn redeposit_lp_shares_same_deposit_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::redeposit_lp_shares( + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + PREDEFINED_DEPOSIT_IDS[0], + |_, _, _| { Ok(10_u128) } + ), + Error::::DoubleLock + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn redeposit_lp_shares_should_not_work_when_valued_shares_are_bellow_min_deposit() { + let _ = predefined_test_ext_with_deposits().execute_with(|| { + with_transaction(|| { + assert_noop!( + LiquidityMining::redeposit_lp_shares( + EVE_FARM, + EVE_BSX_TKN1_YIELD_FARM_ID, + PREDEFINED_DEPOSIT_IDS[0], + |_, _, _| { Ok(MIN_DEPOSIT - 1) } + ), + Error::::IncorrectValuedShares + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }) + }); +} diff --git a/pallets/liquidity-mining/src/tests/resume_yield_farm.rs b/pallets/liquidity-mining/src/tests/resume_yield_farm.rs new file mode 100644 index 00000000000..8230b470795 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/resume_yield_farm.rs @@ -0,0 +1,233 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn resume_yield_farm_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + //Stop yield farming before resuming. + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); + + let new_multiplier = FixedU128::from(7_490_000); + + assert!(yield_farm.state.is_stopped()); + assert!(yield_farm.multiplier.is_zero()); + assert!(LiquidityMining::active_yield_farm(BSX_TKN1_AMM, GC_FARM).is_none()); + + set_block_number(13_420_000); + + assert_ok!(LiquidityMining::resume_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + new_multiplier + )); + + let yield_farm_stake_in_global_farm = new_multiplier.checked_mul_int(45_540 * ONE).unwrap(); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + state: FarmState::Active, + accumulated_rpz: FixedU128::from_inner(62_987_640_859_560_351_884_356_u128), + multiplier: new_multiplier, + updated_at: 134_200, + total_stopped: 134_175, + ..yield_farm + } + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + total_shares_z: global_farm.total_shares_z + yield_farm_stake_in_global_farm, + updated_at: 134_200, + accumulated_rpz: FixedU128::from_inner(62_987_640_859_560_351_884_356_u128), + pending_rewards: 29_998_716_449_999_999_999_000, + ..global_farm + } + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn resume_yield_farm_non_existing_yield_farm_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let new_multiplier = FixedU128::from(7_490_000); + + assert_noop!( + LiquidityMining::resume_yield_farm(GC, GC_FARM, BSX_KSM_YIELD_FARM_ID, BSX_KSM_AMM, new_multiplier), + Error::::YieldFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn resume_yield_farm_non_canceled_yield_farm_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let new_multiplier = FixedU128::from(7_490_000); + + assert_noop!( + LiquidityMining::resume_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + new_multiplier + ), + Error::::YieldFarmAlreadyExists + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn resume_yield_farm_not_owner_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let new_multiplier = FixedU128::from(7_490_000); + + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + assert_noop!( + LiquidityMining::resume_yield_farm( + ALICE, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + new_multiplier + ), + Error::::Forbidden + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn resume_yield_farm_terminated_farm_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let new_multiplier = FixedU128::from(7_490_000); + + //Farm have to be stopped before delete. + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + //Terminate farm. + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + assert_noop!( + LiquidityMining::resume_yield_farm( + ALICE, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + new_multiplier + ), + Error::::LiquidityMiningIsNotStopped + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +//This function is testing case when new yield farm for the same asset pair was created in the global +//farm while first yield farm was stopped. +#[test] +fn resume_yield_farm_same_amm_farm_active_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let new_multiplier = FixedU128::from(7_490_000); + + //Stop 1-th farm. + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + //Create new farm for same assert pair. + assert_ok!(with_transaction(|| TransactionOutcome::Commit({ + LiquidityMining::create_yield_farm( + GC, + GC_FARM, + FixedU128::from(10_000_u128), + None, + BSX_TKN1_AMM, + vec![BSX, TKN1], + ) + }))); + + assert_noop!( + LiquidityMining::resume_yield_farm( + ALICE, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + new_multiplier + ), + Error::::YieldFarmAlreadyExists + ); + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn resume_yield_farm_should_not_work_when_multiplier_is_lt_min_yield_farm_multiplier() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let new_multiplier = MIN_YIELD_FARM_MULTIPLIER - FixedU128::from_inner(1_u128); + + //Arrange + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + //Act & assert + assert_noop!( + LiquidityMining::resume_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + new_multiplier + ), + Error::::InvalidMultiplier + ); + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} diff --git a/pallets/liquidity-mining/src/tests/stop_yield_farm.rs b/pallets/liquidity-mining/src/tests/stop_yield_farm.rs new file mode 100644 index 00000000000..f6fdde9b173 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/stop_yield_farm.rs @@ -0,0 +1,188 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn stop_yield_farm_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let yield_farm_account = LiquidityMining::farm_account_id(GC_BSX_TKN1_YIELD_FARM_ID).unwrap(); + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + let yield_farm_bsx_balance = Tokens::free_balance(BSX, &yield_farm_account); + let global_farm_bsx_balance = Tokens::free_balance(BSX, &global_farm_account); + let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); + + assert!(yield_farm.state.is_active()); + + assert_eq!( + LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM).unwrap(), + yield_farm.id + ); + + let stake_in_global_farm = yield_farm + .multiplier + .checked_mul_int(yield_farm.total_valued_shares) + .unwrap(); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + state: FarmState::Stopped, + multiplier: 0.into(), + ..yield_farm + } + ); + + assert!(LiquidityMining::active_yield_farm(BSX_TKN1_AMM, GC_FARM).is_none()); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + total_shares_z: global_farm.total_shares_z.checked_sub(stake_in_global_farm).unwrap(), + ..global_farm + } + ); + + assert_eq!(Tokens::free_balance(BSX, &yield_farm_account), yield_farm_bsx_balance); + assert_eq!(Tokens::free_balance(BSX, &global_farm_account), global_farm_bsx_balance); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + + //Cancel yield farming with farms update. + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + let pot = LiquidityMining::pot_account_id().unwrap(); + + //_0 - value before act. + let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + let pot_balance_0 = Tokens::free_balance(BSX, &pot); + let global_balance_0 = Tokens::free_balance(BSX, &global_farm_account); + + let last_yield_farm_rewards = 8_538_750 * ONE; + let allocated_for_other_yield_farms = 17_860_875 * ONE; + + assert!(yield_farm_0.state.is_active()); + + set_block_number(10_000); + + assert_eq!( + LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM).unwrap(), + yield_farm_0.id + ); + + let stake_in_global_farm = yield_farm_0 + .multiplier + .checked_mul_int(yield_farm_0.total_valued_shares) + .unwrap(); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 100, + accumulated_rpvs: FixedU128::from_inner(205_000_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(41_000_000_000_000_000_000_u128), + state: FarmState::Stopped, + multiplier: 0.into(), + left_to_distribute: yield_farm_0.left_to_distribute + last_yield_farm_rewards, + ..yield_farm_0 + } + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 100, + accumulated_rpz: FixedU128::from_inner(41_000_000_000_000_000_000_u128), + total_shares_z: global_farm_0.total_shares_z.checked_sub(stake_in_global_farm).unwrap(), + pending_rewards: global_farm_0.pending_rewards + allocated_for_other_yield_farms, + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards + last_yield_farm_rewards, + ..global_farm_0 + } + ); + + assert_eq!( + Tokens::free_balance(BSX, &pot), + pot_balance_0 + last_yield_farm_rewards + allocated_for_other_yield_farms + ); + + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + global_balance_0 - last_yield_farm_rewards - allocated_for_other_yield_farms + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn stop_yield_farm_invalid_yield_farm_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_DOT_AMM), + Error::::YieldFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn stop_yield_farm_liquidity_mining_already_canceled() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + //1-th stop should pass ok. + assert_eq!( + LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM).unwrap(), + GC_BSX_TKN1_YIELD_FARM_ID + ); + + assert_noop!( + LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM), + Error::::YieldFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn stop_yield_farm_not_owner_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const NOT_FARMS_OWNER: u128 = ALICE; + + assert_noop!( + LiquidityMining::stop_yield_farm(NOT_FARMS_OWNER, GC_FARM, BSX_TKN1_AMM), + Error::::Forbidden + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} diff --git a/pallets/liquidity-mining/src/tests/terminate_global_farm.rs b/pallets/liquidity-mining/src/tests/terminate_global_farm.rs new file mode 100644 index 00000000000..a3121ed303a --- /dev/null +++ b/pallets/liquidity-mining/src/tests/terminate_global_farm.rs @@ -0,0 +1,254 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn terminate_global_farm_should_work() { + //Test with flushing - global farm should be removed from storage if it has no yield farms. + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + let predefined_global_farm = get_predefined_global_farm_ins1(1); + let farm_account = LiquidityMining::farm_account_id(BOB_FARM).unwrap(); + let bob_reward_currency_balance = Tokens::free_balance(predefined_global_farm.reward_currency, &BOB); + + let undistributed_rewards = + Tokens::free_balance(get_predefined_global_farm_ins1(1).reward_currency, &farm_account); + + assert_eq!( + LiquidityMining::terminate_global_farm(BOB, BOB_FARM).unwrap(), + ( + get_predefined_global_farm_ins1(1).reward_currency, + undistributed_rewards, + BOB + ) + ); + + //Global farm with no yield farms should be flushed. + assert!(LiquidityMining::global_farm(BOB_FARM).is_none()); + + //Undistributed rewards should be transferred to owner. + assert_eq!( + Tokens::free_balance(predefined_global_farm.reward_currency, &BOB), + bob_reward_currency_balance + undistributed_rewards + ); + + //Non-dustable check + assert_eq!(Whitelist::contains(&farm_account), false); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + + //Without flushing - global farm should stay in the storage marked as deleted. + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + let predefined_global_farm = get_predefined_global_farm_ins1(3); + let farm_account = LiquidityMining::farm_account_id(CHARLIE_FARM).unwrap(); + let charlie_reward_currency_balance = + Tokens::free_balance(predefined_global_farm.reward_currency, &CHARLIE); + let undistributed_rewards = Tokens::free_balance(predefined_global_farm.reward_currency, &farm_account); + let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[2].id); + + //Add deposit to yield farm so it will not be flushed on destroy. + assert_ok!(LiquidityMining::deposit_lp_shares( + CHARLIE_FARM, + yield_farm_id, + ACA_KSM_AMM, + 1_000 * ONE, + |_, _, _| { Ok(10 * ONE) }, + )); + + //Stop farming. + assert_ok!(LiquidityMining::stop_yield_farm(CHARLIE, CHARLIE_FARM, ACA_KSM_AMM)); + + //Destroy yield farm (yield farm is destroyed but not flushed) + assert_ok!(LiquidityMining::terminate_yield_farm( + CHARLIE, + CHARLIE_FARM, + yield_farm_id, + ACA_KSM_AMM + )); + + //Destroy global farm. + assert_ok!(LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM)); + + //Global farm with yield farms should NOT be flushed. + assert_eq!( + LiquidityMining::global_farm(CHARLIE_FARM).unwrap(), + GlobalFarmData { + live_yield_farms_count: 0, + total_yield_farms_count: 1, + state: FarmState::Terminated, + ..predefined_global_farm + } + ); + + assert_eq!( + Tokens::free_balance(predefined_global_farm.reward_currency, &CHARLIE), + charlie_reward_currency_balance + undistributed_rewards + ); + + //Farm's account should be removed when farm is destroyed. + assert_eq!(Whitelist::contains(&farm_account), false); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }) +} + +#[test] +fn terminate_global_farm_not_owner_should_not_work() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::terminate_global_farm(ALICE, BOB_FARM), + Error::::Forbidden + ); + + assert_eq!( + LiquidityMining::global_farm(BOB_FARM).unwrap(), + get_predefined_global_farm_ins1(1) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn terminate_global_farm_farm_not_exists_should_not_work() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + const NON_EXISTING_FARM: u32 = 999_999_999; + assert_noop!( + LiquidityMining::terminate_global_farm(ALICE, NON_EXISTING_FARM), + Error::::GlobalFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn terminate_global_farm_with_yield_farms_should_not_work() { + //Global farm CAN'T be destroyed if it has active or stopped yield farms. + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + //Destroy farm with active yield farms should not work. + let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[2].id); + assert_eq!( + LiquidityMining::active_yield_farm(ACA_KSM_AMM, CHARLIE_FARM).unwrap(), + yield_farm_id + ); + + assert_noop!( + LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM), + Error::::GlobalFarmIsNotEmpty + ); + + assert_eq!( + LiquidityMining::global_farm(CHARLIE_FARM).unwrap(), + get_predefined_global_farm_ins1(3) + ); + + //Destroy farm with stopped yield farms should not work. + //Stop yield farm + assert_ok!(LiquidityMining::stop_yield_farm(CHARLIE, CHARLIE_FARM, ACA_KSM_AMM)); + assert!(LiquidityMining::active_yield_farm(ACA_KSM_AMM, CHARLIE_FARM).is_none()); + + assert_noop!( + LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM), + Error::::GlobalFarmIsNotEmpty + ); + + assert_eq!( + LiquidityMining::global_farm(CHARLIE_FARM).unwrap(), + get_predefined_global_farm_ins1(3) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn terminate_global_farm_healthy_farm_should_not_work() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + let farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + let predefined_global_farm = get_predefined_global_farm_ins1(2); + assert!(!Tokens::free_balance(predefined_global_farm.reward_currency, &farm_account).is_zero()); + + assert_noop!( + LiquidityMining::terminate_global_farm(GC, GC_FARM), + Error::::GlobalFarmIsNotEmpty + ); + + assert_eq!(LiquidityMining::global_farm(GC_FARM).unwrap(), predefined_global_farm); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn terminate_global_farm_should_fail_with_global_farm_not_found_when_farm_is_already_terminated() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + //Arrange + let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[2].id); + + //Add deposit to yield farm so it will not be flushed on destroy. + assert_ok!(LiquidityMining::deposit_lp_shares( + CHARLIE_FARM, + yield_farm_id, + ACA_KSM_AMM, + 1_000 * ONE, + |_, _, _| { Ok(10 * ONE) }, + )); + + //Stop farming. + assert_ok!(LiquidityMining::stop_yield_farm(CHARLIE, CHARLIE_FARM, ACA_KSM_AMM)); + + //Destroy yield farm (yield farm is destroyed but not flushed) + assert_ok!(LiquidityMining::terminate_yield_farm( + CHARLIE, + CHARLIE_FARM, + yield_farm_id, + ACA_KSM_AMM + )); + + //Destroy global farm. + assert_ok!(LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM)); + + //Global farm with yield farms should NOT be flushed. + pretty_assertions::assert_eq!(LiquidityMining::global_farm(CHARLIE_FARM).is_some(), true); + + //Act & assert + assert_noop!( + LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM), + Error::::GlobalFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }) +} diff --git a/pallets/liquidity-mining/src/tests/terminate_yield_farm.rs b/pallets/liquidity-mining/src/tests/terminate_yield_farm.rs new file mode 100644 index 00000000000..6433880aa97 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/terminate_yield_farm.rs @@ -0,0 +1,228 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn terminate_yield_farm_with_deposits_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + let global_farm_bsx_balance = Tokens::free_balance(BSX, &global_farm_account); + + let pot = LiquidityMining::pot_account_id().unwrap(); + let pot_balance_0 = Tokens::free_balance(BSX, &pot); + + // Cancel yield farm before removing. + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + live_yield_farms_count: global_farm_0.live_yield_farms_count.checked_sub(1).unwrap(), + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - yield_farm_0.left_to_distribute, + ..global_farm_0 + } + ); + + //Yield farm is removed from storage only if there are no more farm entries. + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + state: FarmState::Terminated, + left_to_distribute: 0, + ..yield_farm_0 + } + ); + + //Yield-farm's `left_to_distribute`(unpaid rewards) should be transferred from pot to + //global-farm's account. + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + global_farm_bsx_balance + .checked_add(yield_farm_0.left_to_distribute) + .unwrap() + ); + + assert_eq!( + Tokens::free_balance(BSX, &pot), + pot_balance_0.checked_sub(yield_farm_0.left_to_distribute).unwrap() + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn terminate_yield_farm_without_deposits_should_work() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + let yield_farm_account = LiquidityMining::farm_account_id(GC_BSX_TKN1_YIELD_FARM_ID).unwrap(); + + let yield_farm_bsx_balance = Tokens::free_balance(BSX, &yield_farm_account); + let global_farm_bsx_balance = Tokens::free_balance(BSX, &global_farm_account); + + //Stop yield farm before removing + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); + + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + live_yield_farms_count: global_farm.live_yield_farms_count.checked_sub(1).unwrap(), + //yield farm was removed from storage so this should change + total_yield_farms_count: global_farm.total_yield_farms_count.checked_sub(1).unwrap(), + ..global_farm + } + ); + + //Yield farm without deposits should be flushed. + assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).is_none()); + + assert_eq!(Tokens::free_balance(BSX, &yield_farm_account), 0); + + //Unpaid rewards from yield farm account should be transferred back to global farm's account. + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + global_farm_bsx_balance.checked_add(yield_farm_bsx_balance).unwrap() + ); + + //Non-dustable check + assert_eq!(Whitelist::contains(&yield_farm_account), false); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn terminate_yield_farm_not_stopped_yield_farming_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::terminate_yield_farm(GC, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID, BSX_TKN1_AMM), + Error::::LiquidityMiningIsActive + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn terminate_yield_farm_not_owner_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const NOT_OWNER: u128 = ALICE; + + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + assert_noop!( + LiquidityMining::terminate_yield_farm(NOT_OWNER, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID, BSX_TKN1_AMM), + Error::::Forbidden + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn terminate_yield_farm_yield_farm_does_not_exists_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::terminate_yield_farm(GC, GC_FARM, BSX_DOT_YIELD_FARM_ID, BSX_DOT_AMM), + Error::::YieldFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn terminate_yield_farm_should_work_when_farm_is_stopped_and_active_yield_farm_exists_for_same_amm_pool_id() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + let yield_farm_acoount = LiquidityMining::farm_account_id(GC_BSX_TKN1_YIELD_FARM_ID).unwrap(); + + let yield_farm_bsx_balance = Tokens::free_balance(BSX, &yield_farm_acoount); + let global_farm_bsx_balance = Tokens::free_balance(BSX, &global_farm_account); + + //Stop yield farm before removing + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + LiquidityMining::create_yield_farm(GC, GC_FARM, One::one(), None, BSX_TKN1_AMM, vec![BSX, TKN1]).unwrap(); + + let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); + + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + live_yield_farms_count: global_farm.live_yield_farms_count.checked_sub(1).unwrap(), + //yield farm was removed from storage so this should change + total_yield_farms_count: global_farm.total_yield_farms_count.checked_sub(1).unwrap(), + ..global_farm + } + ); + + //Yield farm without deposits should be flushed. + assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).is_none()); + + assert_eq!(Tokens::free_balance(BSX, &yield_farm_acoount), 0); + + //Unpaid rewards from yield farm account should be transferred back to global farm's account. + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + global_farm_bsx_balance.checked_add(yield_farm_bsx_balance).unwrap() + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} diff --git a/pallets/liquidity-mining/src/tests/test_ext.rs b/pallets/liquidity-mining/src/tests/test_ext.rs new file mode 100644 index 00000000000..1b331f232dc --- /dev/null +++ b/pallets/liquidity-mining/src/tests/test_ext.rs @@ -0,0 +1,411 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; + +pub fn new_test_ext() -> sp_io::TestExternalities { + let mut ext = ExtBuilder::default().build(); + ext.execute_with(|| set_block_number(1)); + ext +} + +pub fn predefined_test_ext() -> sp_io::TestExternalities { + let mut ext = new_test_ext(); + ext.execute_with(|| { + let _ = with_transaction(|| { + let expected_farm = get_predefined_global_farm_ins1(0); + assert_ok!(LiquidityMining::create_global_farm( + 100_000_000_000 * ONE, + expected_farm.planned_yielding_periods, + expected_farm.blocks_per_period, + expected_farm.incentivized_asset, + expected_farm.reward_currency, + ALICE, + expected_farm.yield_per_period, + expected_farm.min_deposit, + expected_farm.price_adjustment, + )); + + let expected_farm = get_predefined_global_farm_ins1(1); + assert_ok!(LiquidityMining::create_global_farm( + 1_000_000_000 * ONE, + expected_farm.planned_yielding_periods, + expected_farm.blocks_per_period, + expected_farm.incentivized_asset, + expected_farm.reward_currency, + BOB, + expected_farm.yield_per_period, + expected_farm.min_deposit, + expected_farm.price_adjustment, + )); + + let expected_farm = get_predefined_global_farm_ins1(2); + assert_ok!(LiquidityMining::create_global_farm( + 30_000_000_000 * ONE, + expected_farm.planned_yielding_periods, + expected_farm.blocks_per_period, + expected_farm.incentivized_asset, + expected_farm.reward_currency, + GC, + expected_farm.yield_per_period, + expected_farm.min_deposit, + expected_farm.price_adjustment, + )); + + let expected_farm = get_predefined_global_farm_ins1(3); + assert_ok!(LiquidityMining::create_global_farm( + 30_000_000_000 * ONE, + expected_farm.planned_yielding_periods, + expected_farm.blocks_per_period, + expected_farm.incentivized_asset, + expected_farm.reward_currency, + CHARLIE, + expected_farm.yield_per_period, + expected_farm.min_deposit, + expected_farm.price_adjustment, + )); + + let expected_farm = get_predefined_global_farm_ins1(4); + assert_ok!(LiquidityMining::create_global_farm( + 30_000_000_000 * ONE, + expected_farm.planned_yielding_periods, + expected_farm.blocks_per_period, + expected_farm.incentivized_asset, + expected_farm.reward_currency, + DAVE, + expected_farm.yield_per_period, + expected_farm.min_deposit, + expected_farm.price_adjustment, + )); + + let expected_farm = get_predefined_global_farm_ins1(5); + assert_ok!(LiquidityMining::create_global_farm( + 30_000_000_000 * ONE, + expected_farm.planned_yielding_periods, + expected_farm.blocks_per_period, + expected_farm.incentivized_asset, + expected_farm.reward_currency, + EVE, + expected_farm.yield_per_period, + expected_farm.min_deposit, + expected_farm.price_adjustment, + )); + + let amm_mock_data = vec![ + ( + AssetPair { + asset_in: BSX, + asset_out: ACA, + }, + (BSX_ACA_AMM, BSX_ACA_SHARE_ID), + ), + ( + AssetPair { + asset_in: KSM, + asset_out: BSX, + }, + (BSX_KSM_AMM, BSX_KSM_SHARE_ID), + ), + ( + AssetPair { + asset_in: BSX, + asset_out: DOT, + }, + (BSX_DOT_AMM, BSX_DOT_SHARE_ID), + ), + ( + AssetPair { + asset_in: BSX, + asset_out: ETH, + }, + (BSX_ETH_AMM, BSX_ETH_SHARE_ID), + ), + ( + AssetPair { + asset_in: BSX, + asset_out: HDX, + }, + (BSX_HDX_AMM, BSX_HDX_SHARE_ID), + ), + ( + AssetPair { + asset_in: BSX, + asset_out: TKN1, + }, + (BSX_TKN1_AMM, BSX_TKN1_SHARE_ID), + ), + ( + AssetPair { + asset_in: BSX, + asset_out: TKN2, + }, + (BSX_TKN2_AMM, BSX_TKN2_SHARE_ID), + ), + ( + AssetPair { + asset_in: KSM, + asset_out: DOT, + }, + (KSM_DOT_AMM, KSM_DOT_SHARE_ID), + ), + ( + AssetPair { + asset_in: ACA, + asset_out: KSM, + }, + (ACA_KSM_AMM, ACA_KSM_SHARE_ID), + ), + ]; + + AMM_POOLS.with(|h| { + let mut hm = h.borrow_mut(); + for (k, v) in amm_mock_data { + hm.insert(asset_pair_to_map_key(k), v); + } + }); + + let yield_farm = get_predefined_yield_farm_ins1(0); + init_yield_farm_ins1(GC, GC_FARM, BSX_TKN1_AMM, BSX, TKN1, yield_farm); + + let yield_farm = get_predefined_yield_farm_ins1(1); + init_yield_farm_ins1(GC, GC_FARM, BSX_TKN2_AMM, BSX, TKN2, yield_farm); + + let yield_farm = get_predefined_yield_farm_ins1(2); + init_yield_farm_ins1(CHARLIE, CHARLIE_FARM, ACA_KSM_AMM, ACA, KSM, yield_farm); + + let yield_farm = get_predefined_yield_farm_ins1(3); + init_yield_farm_ins1(DAVE, DAVE_FARM, BSX_TKN1_AMM, BSX, TKN1, yield_farm); + + let yield_farm = get_predefined_yield_farm_ins1(4); + init_yield_farm_ins1(EVE, EVE_FARM, BSX_TKN1_AMM, BSX, TKN1, yield_farm); + + let yield_farm = get_predefined_yield_farm_ins1(5); + init_yield_farm_ins1(EVE, EVE_FARM, BSX_TKN2_AMM, BSX, TKN2, yield_farm); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + + ext +} + +fn init_yield_farm_ins1( + owner: AccountId, + farm_id: GlobalFarmId, + amm_id: AccountId, + asset_a: AssetId, + asset_b: AssetId, + yield_farm: YieldFarmData, +) { + assert_ok!(LiquidityMining::create_yield_farm( + owner, + farm_id, + yield_farm.multiplier, + yield_farm.loyalty_curve.clone(), + amm_id, + vec![asset_a, asset_b], + )); + + assert_eq!( + LiquidityMining::yield_farm((amm_id, farm_id, yield_farm.id)).unwrap(), + yield_farm + ); +} + +pub fn predefined_test_ext_with_deposits() -> sp_io::TestExternalities { + let mut ext = predefined_test_ext(); + + ext.execute_with(|| { + let _ = with_transaction(|| { + let farm_id = GC_FARM; + + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + let pot_account = LiquidityMining::pot_account_id().unwrap(); + + //DEPOSIT 1: + set_block_number(1_800); //18-th period + + let deposited_amount = 50 * ONE; + assert_ok!(LiquidityMining::deposit_lp_shares( + farm_id, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + deposited_amount, + |_, _, _| { Ok(2_500 * ONE) }, + )); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).is_some()); + + // DEPOSIT 2 (deposit in same period): + let deposited_amount = 80 * ONE; + assert_eq!( + LiquidityMining::deposit_lp_shares( + farm_id, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + deposited_amount, + |_, _, _| { Ok(4_160 * ONE) }, + ) + .unwrap(), + PREDEFINED_DEPOSIT_IDS[1] + ); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[1]).is_some()); + + // DEPOSIT 3 (same period, second yield farm): + let deposited_amount = 25 * ONE; + assert_ok!(LiquidityMining::deposit_lp_shares( + farm_id, + GC_BSX_TKN2_YIELD_FARM_ID, + BSX_TKN2_AMM, + deposited_amount, + |_, _, _| { Ok(200 * ONE) }, + )); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[2]).is_some()); + + // DEPOSIT 4 (new period): + set_block_number(2051); //period 20 + + let deposited_amount = 800 * ONE; + assert_ok!(LiquidityMining::deposit_lp_shares( + farm_id, + GC_BSX_TKN2_YIELD_FARM_ID, + BSX_TKN2_AMM, + deposited_amount, + |_, _, _| { Ok(46_400 * ONE) }, + )); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[3]).is_some()); + + // DEPOSIT 5 (same period, second yield farm): + set_block_number(2_586); //period 25 + + let deposited_amount = 87 * ONE; + assert_ok!(LiquidityMining::deposit_lp_shares( + farm_id, + GC_BSX_TKN2_YIELD_FARM_ID, + BSX_TKN2_AMM, + deposited_amount, + |_, _, _| { Ok(261 * ONE) }, + )); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[4]).is_some()); + + // DEPOSIT 6 (same period): + set_block_number(2_596); //period 25 + + let deposited_amount = 48 * ONE; + assert_ok!(LiquidityMining::deposit_lp_shares( + farm_id, + GC_BSX_TKN2_YIELD_FARM_ID, + BSX_TKN2_AMM, + deposited_amount, + |_, _, _| { Ok(768 * ONE) }, + )); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[5]).is_some()); + + // DEPOSIT 7 : (same period different liq poll farm) + set_block_number(2_596); //period 25 + + let deposited_amount = 486 * ONE; + assert_ok!(LiquidityMining::deposit_lp_shares( + farm_id, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + deposited_amount, + |_, _, _| { Ok(38_880 * ONE) }, + )); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[6]).is_some()); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + id: GC_FARM, + updated_at: 25, + reward_currency: BSX, + yield_per_period: Perquintill::from_percent(50), + planned_yielding_periods: 500_u64, + blocks_per_period: 100_u64, + owner: GC, + incentivized_asset: BSX, + max_reward_per_period: 60_000_000 * ONE, + accumulated_rpz: FixedU128::from_float(3.5_f64), + live_yield_farms_count: 2, + total_yield_farms_count: 2, + total_shares_z: 703_990 * ONE, + pending_rewards: 0, + accumulated_paid_rewards: 1_283_550 * ONE, + state: FarmState::Active, + min_deposit: 1_000, + price_adjustment: One::one(), + } + ); + + let bsx_tkn1_yield_farm_left_to_distribute = 116_550 * ONE; + let bsx_tkn2_yield_farm_left_to_distribute = 1_167_000 * ONE; + + let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[0].id); + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, yield_farm_id)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_float(17.5_f64), + accumulated_rpz: FixedU128::from_float(3.5_f64), + total_shares: 616 * ONE, + total_valued_shares: 45_540 * ONE, + entries_count: 3, + left_to_distribute: bsx_tkn1_yield_farm_left_to_distribute, + ..PREDEFINED_YIELD_FARMS_INS1.with(|v| v[0].clone()) + }, + ); + + let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[1].id); + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, yield_farm_id)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from(35), + accumulated_rpz: FixedU128::from_float(3.5_f64), + total_shares: 960 * ONE, + total_valued_shares: 47_629 * ONE, + entries_count: 4, + left_to_distribute: bsx_tkn2_yield_farm_left_to_distribute, + ..PREDEFINED_YIELD_FARMS_INS1.with(|v| v[1].clone()) + }, + ); + + //Reward currency balance check. + //total_rewards - (global_farm_paid_accumulated_rewards + global_farm_accumualted_rewards) + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + (30_000_000_000 * ONE - (1_033_900 * ONE + 249_650 * ONE)) + ); + + //Pot account balance check + assert_eq!( + Tokens::free_balance(BSX, &pot_account), + bsx_tkn1_yield_farm_left_to_distribute + bsx_tkn2_yield_farm_left_to_distribute + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + + ext +} diff --git a/pallets/liquidity-mining/src/tests/tests.rs b/pallets/liquidity-mining/src/tests/tests.rs new file mode 100644 index 00000000000..c99457173b1 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/tests.rs @@ -0,0 +1,2132 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; +use test_utils::assert_transact_ok; + +#[test] +fn validate_create_farm_data_should_work() { + assert_ok!(LiquidityMining::validate_create_global_farm_data( + 1_000_000, + 100, + 1, + Perquintill::from_percent(50), + 5_000, + One::one(), + )); + + assert_ok!(LiquidityMining::validate_create_global_farm_data( + 9_999_000_000_000, + 2_000_000, + 500, + Perquintill::from_percent(100), + crate::MIN_DEPOSIT, + One::one(), + )); + + assert_ok!(LiquidityMining::validate_create_global_farm_data( + 10_000_000, + 101, + 16_986_741, + Perquintill::from_perthousand(1), + 1_000_000_000_000_000, + One::one(), + )); +} + +#[test] +fn validate_create_farm_data_should_not_work() { + new_test_ext().execute_with(|| { + assert_noop!( + LiquidityMining::validate_create_global_farm_data( + 999_999, + 100, + 1, + Perquintill::from_percent(50), + 10_000, + One::one() + ), + Error::::InvalidTotalRewards + ); + + assert_noop!( + LiquidityMining::validate_create_global_farm_data( + 9, + 100, + 1, + Perquintill::from_percent(50), + 1_500, + One::one() + ), + Error::::InvalidTotalRewards + ); + + assert_noop!( + LiquidityMining::validate_create_global_farm_data( + 0, + 100, + 1, + Perquintill::from_percent(50), + 1_000, + One::one() + ), + Error::::InvalidTotalRewards + ); + + assert_noop!( + LiquidityMining::validate_create_global_farm_data( + 1_000_000, + 99, + 1, + Perquintill::from_percent(50), + 2_000, + One::one() + ), + Error::::InvalidPlannedYieldingPeriods + ); + + assert_noop!( + LiquidityMining::validate_create_global_farm_data( + 1_000_000, + 0, + 1, + Perquintill::from_percent(50), + 3_000, + One::one() + ), + Error::::InvalidPlannedYieldingPeriods + ); + + assert_noop!( + LiquidityMining::validate_create_global_farm_data( + 1_000_000, + 87, + 1, + Perquintill::from_percent(50), + 4_000, + One::one() + ), + Error::::InvalidPlannedYieldingPeriods + ); + + assert_noop!( + LiquidityMining::validate_create_global_farm_data( + 1_000_000, + 100, + 0, + Perquintill::from_percent(50), + 4_000, + One::one() + ), + Error::::InvalidBlocksPerPeriod + ); + + assert_noop!( + LiquidityMining::validate_create_global_farm_data( + 1_000_000, + 100, + 10, + Perquintill::from_percent(0), + 10_000, + One::one() + ), + Error::::InvalidYieldPerPeriod + ); + + assert_noop!( + LiquidityMining::validate_create_global_farm_data( + 10_000_000, + 101, + 16_986_741, + Perquintill::from_perthousand(1), + crate::MIN_DEPOSIT - 1, + One::one() + ), + Error::::InvalidMinDeposit + ); + + assert_noop!( + LiquidityMining::validate_create_global_farm_data( + 10_000_000, + 101, + 16_986_741, + Perquintill::from_perthousand(1), + 10_000, + Zero::zero() + ), + Error::::InvalidPriceAdjustment + ); + }); +} +#[test] +fn get_period_number_should_work() { + let block_num: BlockNumber = 1_u64; + let blocks_per_period = 1; + assert_eq!( + LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), + 1 + ); + + let block_num: BlockNumber = 1_000_u64; + let blocks_per_period = 1; + assert_eq!( + LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), + 1_000 + ); + + let block_num: BlockNumber = 23_u64; + let blocks_per_period = 15; + assert_eq!( + LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), + 1 + ); + + let block_num: BlockNumber = 843_712_398_u64; + let blocks_per_period = 13_412_341; + assert_eq!( + LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), + 62 + ); + + let block_num: BlockNumber = 843_u64; + let blocks_per_period = 2_000; + assert_eq!( + LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), + 0 + ); + + let block_num: BlockNumber = 10_u64; + let blocks_per_period = 10; + assert_eq!( + LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), + 1 + ); +} + +#[test] +#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] +fn get_period_number_should_not_work_when_block_per_period_is_zero() { + new_test_ext().execute_with(|| { + let block_num: BlockNumber = 10_u64; + assert_noop!( + LiquidityMining::get_period_number(block_num, 0), + Error::InconsistentState(InconsistentStateError::InvalidPeriod) + ); + }); +} + +#[test] +fn get_loyalty_multiplier_should_work() { + let loyalty_curve_1 = LoyaltyCurve::default(); + let loyalty_curve_2 = LoyaltyCurve { + initial_reward_percentage: FixedU128::from(1), + scale_coef: 50, + }; + let loyalty_curve_3 = LoyaltyCurve { + initial_reward_percentage: FixedU128::from_inner(123_580_000_000_000_000), // 0.12358 + scale_coef: 23, + }; + let loyalty_curve_4 = LoyaltyCurve { + initial_reward_percentage: FixedU128::from_inner(0), // 0.12358 + scale_coef: 15, + }; + + let testing_values = vec![ + ( + 0, + FixedU128::from_float(0.5_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.12358_f64), + FixedU128::from_float(0_f64), + ), + ( + 1, + FixedU128::from_float(0.504950495_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.1600975_f64), + FixedU128::from_float(0.0625_f64), + ), + ( + 4, + FixedU128::from_float(0.5192307692_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.25342_f64), + FixedU128::from_float(0.2105263158_f64), + ), + ( + 130, + FixedU128::from_float(0.7826086957_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.8682505882_f64), + FixedU128::from_float(0.8965517241_f64), + ), + ( + 150, + FixedU128::from_float(0.8_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.8834817341_f64), + FixedU128::from_float(0.9090909091_f64), + ), + ( + 180, + FixedU128::from_float(0.8214285714_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.9007011823_f64), + FixedU128::from_float(0.9230769231_f64), + ), + ( + 240, + FixedU128::from_float(0.8529411765_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.9233549049_f64), + FixedU128::from_float(0.9411764706_f64), + ), + ( + 270, + FixedU128::from_float(0.8648648649_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.9312025256_f64), + FixedU128::from_float(0.9473684211_f64), + ), + ( + 280, + FixedU128::from_float(0.8684210526_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.9334730693_f64), + FixedU128::from_float(0.9491525424_f64), + ), + ( + 320, + FixedU128::from_float(0.880952381_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.941231312_f64), + FixedU128::from_float(0.9552238806_f64), + ), + ( + 380, + FixedU128::from_float(0.8958333333_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.9499809926_f64), + FixedU128::from_float(0.9620253165_f64), + ), + ( + 390, + FixedU128::from_float(0.8979591837_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.9511921065_f64), + FixedU128::from_float(0.962962963_f64), + ), + ( + 4000, + FixedU128::from_float(0.987804878_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.994989396_f64), + FixedU128::from_float(0.99626401_f64), + ), + ( + 4400, + FixedU128::from_float(0.9888888889_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.9954425367_f64), + FixedU128::from_float(0.9966024915_f64), + ), + ( + 4700, + FixedU128::from_float(0.9895833333_f64), + FixedU128::from_float(1_f64), + FixedU128::from_float(0.995732022_f64), + FixedU128::from_float(0.9968186638_f64), + ), + ]; + + //Special case: loyalty curve is None + assert_eq!( + LiquidityMining::get_loyalty_multiplier(10, None).unwrap(), + FixedU128::one() + ); + + let precission_delta = FixedU128::from_inner(100_000_000); //0.000_000_000_1 + for (periods, expected_multiplier_1, expected_multiplier_2, expected_multiplier_3, expected_multiplier_4) in + testing_values.iter() + { + //1-th curve test + assert!(is_approx_eq_fixedu128( + LiquidityMining::get_loyalty_multiplier(*periods, Some(loyalty_curve_1.clone())).unwrap(), + *expected_multiplier_1, + precission_delta + )); + + //2-nd curve test + assert!(is_approx_eq_fixedu128( + LiquidityMining::get_loyalty_multiplier(*periods, Some(loyalty_curve_2.clone())).unwrap(), + *expected_multiplier_2, + precission_delta + )); + + //3-rd curve test + assert!(is_approx_eq_fixedu128( + LiquidityMining::get_loyalty_multiplier(*periods, Some(loyalty_curve_3.clone())).unwrap(), + *expected_multiplier_3, + precission_delta + )); + + //-4th curve test + assert!(is_approx_eq_fixedu128( + LiquidityMining::get_loyalty_multiplier(*periods, Some(loyalty_curve_4.clone())).unwrap(), + *expected_multiplier_4, + precission_delta + )); + } +} + +#[test] +fn sync_global_farm_should_work() { + let testing_values = vec![ + ( + 26_u64, + 2501944769_u128, + FixedU128::from_float(259.000000_f64), + HDX, + ACA_FARM, + 0_u128, + 206_u64, + 55563662_u128, + FixedU128::from_float(259.000000000_f64), + 55563662_u128, + ), + ( + 188_u64, + 33769604_u128, + FixedU128::from_float(1148.000000_f64), + BSX, + ACA_FARM, + 30080406306_u128, + 259_u64, + 56710169_u128, + FixedU128::from_inner(1_183_500_000_000_000_000_000_u128), + 1255531111_u128, + ), + ( + 195_u64, + 26098384286056_u128, + FixedU128::from_float(523.000000_f64), + ACA, + ACA_FARM, + 32055_u128, + 326_u64, + 61424428_u128, + FixedU128::from_inner(523_000_000_001_189_920_405), + 61455483_u128, + ), + ( + 181_u64, + 9894090144_u128, + FixedU128::from_float(317.000000_f64), + KSM, + ACA_FARM, + 36806694280_u128, + 1856_u64, + 52711084_u128, + FixedU128::from_inner(320_720_068_520_127_685_628_u128), + 36859404364_u128, + ), + ( + 196_u64, + 26886423482043_u128, + FixedU128::from_float(596.000000_f64), + ACA, + BSX_FARM, + 30560755872_u128, + 954_u64, + 34013971_u128, + FixedU128::from_inner(596_001_136_661_218_343_563_u128), + 30594768843_u128, + ), + ( + 68_u64, + 1138057342_u128, + FixedU128::from_float(4.000000_f64), + ACA, + ACA_FARM, + 38398062768_u128, + 161_u64, + 71071995_u128, + FixedU128::from_inner(37_740_006_193_817_956_143_u128), + 38469133763_u128, + ), + ( + 161_u64, + 24495534649923_u128, + FixedU128::from_float(213.000000_f64), + KSM, + BSX_FARM, + 11116735745_u128, + 448_u64, + 85963452_u128, + FixedU128::from_inner(213_000_453_826_989_444_173_u128), + 11202698197_u128, + ), + ( + 27_u64, + 22108444_u128, + FixedU128::from_float(970.000000_f64), + KSM, + BSX_FARM, + 8572779460_u128, + 132_u64, + 43974403_u128, + FixedU128::from_float(1022.500000000_f64), + 1204667713_u128, + ), + ( + 97_u64, + 1593208_u128, + FixedU128::from_float(6.000000_f64), + HDX, + BSX_FARM, + 18440792496_u128, + 146_u64, + 14437690_u128, + FixedU128::from_float(30.500000000_f64), + 53471286_u128, + ), + ( + 154_u64, + 27279119649838_u128, + FixedU128::from_float(713.000000_f64), + BSX, + KSM_FARM, + 28318566664_u128, + 202_u64, + 7533987_u128, + FixedU128::from_inner(713_001_038_104_089_409_944_u128), + 28326099651_u128, + ), + ( + 104_u64, + 20462312838954_u128, + FixedU128::from_float(833.000000_f64), + BSX, + BSX_FARM, + 3852003_u128, + 131_u64, + 75149021_u128, + FixedU128::from_inner(833_000_000_188_199_791_016_u128), + 79000024_u128, + ), + ( + 90_u64, + 37650830596054_u128, + FixedU128::from_float(586.000000_f64), + HDX, + KSM_FARM, + 27990338179_u128, + 110_u64, + 36765518_u128, + FixedU128::from_inner(586_000_743_418_849_886_767_u128), + 28027102697_u128, + ), + ( + 198_u64, + 318777214_u128, + FixedU128::from_float(251.000000_f64), + ACA, + ACA_FARM, + 3615346492_u128, + 582_u64, + 12876432_u128, + FixedU128::from_inner(262_341_292_078_674_104_981_u128), + 3628221924_u128, + ), + ( + 29_u64, + 33478250_u128, + FixedU128::from_float(77.000000_f64), + BSX, + ACA_FARM, + 39174031245_u128, + 100_u64, + 26611087_u128, + FixedU128::from_float(112.500000000_f64), + 1215088962_u128, + ), + ( + 91_u64, + 393922835172_u128, + FixedU128::from_float(2491.000000_f64), + ACA, + KSM_FARM, + 63486975129400_u128, + 260_u64, + 85100506_u128, + FixedU128::from_inner(2_575_500_000_000_000_262_144_u128), + 33286564672540_u128, + ), + ( + 67_u64, + 1126422_u128, + FixedU128::from_float(295.000000_f64), + HDX, + BSX_FARM, + 7492177402_u128, + 229_u64, + 35844776_u128, + FixedU128::from_float(376.000000000_f64), + 127084958_u128, + ), + ( + 168_u64, + 28351324279041_u128, + FixedU128::from_float(450.000000_f64), + ACA, + KSM_FARM, + 38796364068_u128, + 361_u64, + 35695723_u128, + FixedU128::from_inner(450_001_368_414_494_016_443_u128), + 38832058791_u128, + ), + ( + 3_u64, + 17631376575792_u128, + FixedU128::from_float(82.000000_f64), + HDX, + KSM_FARM, + 20473946880_u128, + 52_u64, + 93293564_u128, + FixedU128::from_inner(82_001_161_222_199_071_561_u128), + 20567239444_u128, + ), + ( + 49_u64, + 94060_u128, + FixedU128::from_float(81.000000_f64), + HDX, + ACA_FARM, + 11126653978_u128, + 132_u64, + 75841904_u128, + FixedU128::from_float(122.500000000_f64), + 79745394_u128, + ), + ( + 38_u64, + 14086_u128, + FixedU128::from_float(266.000000_f64), + KSM, + BSX_FARM, + 36115448964_u128, + 400000_u64, + 52402278_u128, + FixedU128::from_inner(200_247_000_000_000_000_000_000_u128), + 2869334644_u128, + ), + ( + 158_u64, + 762784_u128, + FixedU128::from_float(129.000000_f64), + BSX, + ACA_FARM, + 21814882774_u128, + 158_u64, + 86085676_u128, + FixedU128::from_float(129.000000000_f64), + 86085676_u128, + ), + ]; + + for ( + updated_at, + total_shares_z, + accumulated_rpz, + reward_currency, + id, + rewards_left_to_distribute, + current_period, + accumulated_rewards, + expected_accumulated_rpz, + expected_pending_rewards, + ) in testing_values.iter() + { + let yield_per_period = Perquintill::from_percent(50); + let planned_yielding_periods = 100; + let blocks_per_period = 0; + let owner = ALICE; + let incentivized_asset = BSX; + let max_reward_per_period = 10_000 * ONE; + + let global_farm_0 = GlobalFarmData { + id: *id, + owner, + updated_at: *updated_at, + total_shares_z: *total_shares_z, + accumulated_rpz: *accumulated_rpz, + reward_currency: *reward_currency, + pending_rewards: *accumulated_rewards, + accumulated_paid_rewards: 10, + yield_per_period, + planned_yielding_periods, + blocks_per_period, + max_reward_per_period, + incentivized_asset, + min_deposit: crate::MIN_DEPOSIT, + live_yield_farms_count: Default::default(), + total_yield_farms_count: Default::default(), + price_adjustment: FixedU128::one(), + state: FarmState::Active, + }; + + let mut global_farm = global_farm_0.clone(); + + new_test_ext().execute_with(|| { + //Add farm's account to whitelist + let farm_account_id = LiquidityMining::farm_account_id(*id).unwrap(); + Whitelist::add_account(&farm_account_id).unwrap(); + + Tokens::transfer( + Origin::signed(TREASURY), + farm_account_id, + *reward_currency, + *rewards_left_to_distribute, + ) + .unwrap(); + + assert_eq!( + Tokens::free_balance(*reward_currency, &farm_account_id), + *rewards_left_to_distribute + ); + + let r = with_transaction(|| { + TransactionOutcome::Commit(LiquidityMining::sync_global_farm(&mut global_farm, *current_period)) + }) + .unwrap(); + + if r.is_zero() && updated_at != current_period { + frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( + Event::AllRewardsDistributed { global_farm_id: *id }, + )); + } + + let expected_global_farm = GlobalFarmData { + accumulated_rpz: *expected_accumulated_rpz, + pending_rewards: *expected_pending_rewards, + updated_at: *current_period, + ..global_farm_0.clone() + }; + + assert_eq!(global_farm, expected_global_farm); + + if updated_at != current_period { + frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( + Event::GlobalFarmAccRPZUpdated { + global_farm_id: *id, + accumulated_rpz: *expected_accumulated_rpz, + total_shares_z: *total_shares_z, + }, + )); + } + }); + } +} + +#[test] +fn sync_global_farm_should_not_update_farm_when_farm_is_not_active() { + { + let global_farm_0 = GlobalFarmData { + id: 1, + owner: ALICE, + updated_at: 100, + total_shares_z: 1_000_000 * ONE, + accumulated_rpz: FixedU128::from(5), + reward_currency: BSX, + pending_rewards: 1_000 * ONE, + accumulated_paid_rewards: 10, + yield_per_period: Perquintill::from_float(0.5_f64), + planned_yielding_periods: 1_000, + blocks_per_period: 1, + max_reward_per_period: 10_000 * ONE, + incentivized_asset: BSX, + min_deposit: crate::MIN_DEPOSIT, + live_yield_farms_count: Default::default(), + total_yield_farms_count: Default::default(), + price_adjustment: FixedU128::one(), + state: FarmState::Terminated, + }; + + let mut global_farm = global_farm_0.clone(); + + new_test_ext().execute_with(|| { + let current_period = global_farm_0.updated_at + 100; + let r = with_transaction(|| { + TransactionOutcome::Commit(LiquidityMining::sync_global_farm(&mut global_farm, current_period)) + }) + .unwrap(); + + assert_eq!(r, 0); + assert_eq!(global_farm, global_farm_0); + }); + } +} + +#[test] +fn sync_global_farm_should_only_update_updated_at_field_when_farm_has_no_shares() { + { + let global_farm_1 = GlobalFarmData { + id: 1, + owner: ALICE, + updated_at: 200, + total_shares_z: Balance::zero(), + accumulated_rpz: FixedU128::from(5), + reward_currency: BSX, + pending_rewards: 1_000 * ONE, + accumulated_paid_rewards: 10, + yield_per_period: Perquintill::from_float(0.5_f64), + planned_yielding_periods: 1_000, + blocks_per_period: 1, + max_reward_per_period: 10_000 * ONE, + incentivized_asset: BSX, + min_deposit: crate::MIN_DEPOSIT, + live_yield_farms_count: Default::default(), + total_yield_farms_count: Default::default(), + price_adjustment: FixedU128::one(), + state: FarmState::Active, + }; + + let mut global_farm = global_farm_1.clone(); + + new_test_ext().execute_with(|| { + let current_period = 200; + let r = with_transaction(|| { + TransactionOutcome::Commit(LiquidityMining::sync_global_farm(&mut global_farm, current_period)) + }) + .unwrap(); + + assert_eq!(r, 0); + assert_eq!(global_farm, global_farm_1); + }); + } +} + +#[test] +fn sync_global_farm_should_not_update_farm_when_farm_was_already_updated_in_this_period() { + { + let global_farm_0 = GlobalFarmData { + id: 1, + owner: ALICE, + updated_at: 100, + total_shares_z: 1_000_000 * ONE, + accumulated_rpz: FixedU128::from(5), + reward_currency: BSX, + pending_rewards: 1_000 * ONE, + accumulated_paid_rewards: 10, + yield_per_period: Perquintill::from_float(0.5_f64), + planned_yielding_periods: 1_000, + blocks_per_period: 1, + max_reward_per_period: 10_000 * ONE, + incentivized_asset: BSX, + min_deposit: crate::MIN_DEPOSIT, + live_yield_farms_count: Default::default(), + total_yield_farms_count: Default::default(), + price_adjustment: FixedU128::one(), + state: FarmState::Active, + }; + + let mut global_farm = global_farm_0.clone(); + + new_test_ext().execute_with(|| { + let current_period = global_farm_0.updated_at; + let r = with_transaction(|| { + TransactionOutcome::Commit(LiquidityMining::sync_global_farm(&mut global_farm, current_period)) + }) + .unwrap(); + + assert_eq!(r, 0); + assert_eq!(global_farm, global_farm_0); + }); + } +} + +#[test] +fn sync_yield_farm_should_work() { + let testing_values = vec![ + ( + BSX_FARM, + BSX_DOT_YIELD_FARM_ID, + 26_u64, + 206_u64, + 299_u128, + 0_u128, + 387_u128, + BSX, + 299_u128, + 206_u64, + 0_u128, + ), + ( + BSX_FARM, + BSX_ACA_YIELD_FARM_ID, + 188_u64, + 259_u64, + 1151_u128, + 33769603_u128, + 1225_u128, + BSX, + 1299_u128, + 259_u64, + 4997901244_u128, + ), + ( + BSX_FARM, + BSX_KSM_YIELD_FARM_ID, + 195_u64, + 326_u64, + 823_u128, + 2604286056_u128, + 971_u128, + BSX, + 1119_u128, + 326_u64, + 770868672576_u128, + ), + ( + BSX_FARM, + BSX_KSM_YIELD_FARM_ID, + 181_u64, + 1856_u64, + 320_u128, + 8940144_u128, + 398_u128, + BSX, + 476_u128, + 1856_u64, + 1394662464_u128, + ), + ( + BSX_FARM, + BSX_ACA_YIELD_FARM_ID, + 196_u64, + 954_u64, + 5684_u128, + 282043_u128, + 5758_u128, + BSX, + 5832_u128, + 954_u64, + 41742364_u128, + ), + ( + BSX_FARM, + BSX_DOT_YIELD_FARM_ID, + 68_u64, + 161_u64, + 37_u128, + 1138057342_u128, + 126_u128, + BSX, + 215_u128, + 161_u64, + 202574206876_u128, + ), + ( + BSX_FARM, + BSX_ACA_YIELD_FARM_ID, + 161_u64, + 448_u64, + 678_u128, + 49923_u128, + 845_u128, + BSX, + 1012_u128, + 448_u64, + 16674282_u128, + ), + ( + BSX_FARM, + BSX_DOT_YIELD_FARM_ID, + 27_u64, + 132_u64, + 978_u128, + 2444_u128, + 1135_u128, + BSX, + 1292_u128, + 132_u64, + 767416_u128, + ), + ( + BSX_FARM, + BSX_KSM_YIELD_FARM_ID, + 97_u64, + 146_u64, + 28_u128, + 1593208_u128, + 205_u128, + BSX, + 382_u128, + 146_u64, + 563995632_u128, + ), + ( + BSX_FARM, + BSX_ACA_YIELD_FARM_ID, + 154_u64, + 202_u64, + 876_u128, + 9838_u128, + 888_u128, + BSX, + 900_u128, + 202_u64, + 236112_u128, + ), + ( + BSX_FARM, + BSX_DOT_YIELD_FARM_ID, + 104_u64, + 131_u64, + 8373_u128, + 2046838954_u128, + 8412_u128, + BSX, + 8451_u128, + 131_u64, + 159653438412_u128, + ), + ( + BSX_FARM, + BSX_KSM_YIELD_FARM_ID, + 90_u64, + 110_u64, + 5886_u128, + 596054_u128, + 6010_u128, + BSX, + 6134_u128, + 110_u64, + 147821392_u128, + ), + ( + BSX_FARM, + BSX_DOT_YIELD_FARM_ID, + 198_u64, + 582_u64, + 2591_u128, + 377215_u128, + 2781_u128, + BSX, + 2971_u128, + 582_u64, + 143341700_u128, + ), + ( + BSX_FARM, + BSX_KSM_YIELD_FARM_ID, + 29_u64, + 100_u64, + 80_u128, + 8250_u128, + 257_u128, + BSX, + 434_u128, + 100_u64, + 2920500_u128, + ), + ( + BSX_FARM, + BSX_ACA_YIELD_FARM_ID, + 91_u64, + 260_u64, + 2537_u128, + 35172_u128, + 2556_u128, + BSX, + 2575_u128, + 260_u64, + 1336536_u128, + ), + ( + BSX_FARM, + BSX_ACA_YIELD_FARM_ID, + 67_u64, + 229_u64, + 471_u128, + 1126422_u128, + 579_u128, + BSX, + 687_u128, + 229_u64, + 243307152_u128, + ), + ( + BSX_FARM, + BSX_DOT_YIELD_FARM_ID, + 168_u64, + 361_u64, + 952_u128, + 28279041_u128, + 971_u128, + BSX, + 990_u128, + 361_u64, + 1074603558_u128, + ), + ( + BSX_FARM, + BSX_ACA_YIELD_FARM_ID, + 3_u64, + 52_u64, + 357_u128, + 2_u128, + 518_u128, + BSX, + 679_u128, + 52_u64, + 644_u128, + ), + ( + BSX_FARM, + BSX_KSM_YIELD_FARM_ID, + 49_u64, + 132_u64, + 1557_u128, + 94059_u128, + 1651_u128, + BSX, + 1745_u128, + 132_u64, + 17683092_u128, + ), + ( + BSX_FARM, + BSX_ACA_YIELD_FARM_ID, + 38_u64, + 38_u64, + 2564373_u128, + 14085_u128, + 2564404_u128, + BSX, + 2564373_u128, + 38_u64, + 0_u128, + ), + ( + BSX_FARM, + BSX_ACA_YIELD_FARM_ID, + 158_u64, + 158_u64, + 129_u128, + 762784_u128, + 286_u128, + BSX, + 129_u128, + 158_u64, + 0_u128, + ), + ]; + + for ( + global_farm_id, + yield_farm_id, + yield_farm_updated_at, + current_period, + yield_farm_accumulated_rpvs, + yield_farm_total_valued_shares, + global_farm_accumulated_rpz, + reward_currency, + expected_yield_farm_accumulated_rpvs, + expected_updated_at, + expected_yield_farm_reward_currency_balance, + ) in testing_values + { + let owner = ALICE; + let yield_per_period = Perquintill::from_percent(50); + let blocks_per_period = BlockNumber::from(1_u32); + let planned_yielding_periods = 100; + let incentivized_asset = BSX; + let updated_at = 200_u64; + let max_reward_per_period = Balance::from(10_000_u32); + + let global_farm_0 = GlobalFarmData { + id: global_farm_id, + owner, + updated_at, + total_shares_z: 1_000_000_u128, + accumulated_rpz: FixedU128::from(global_farm_accumulated_rpz), + reward_currency, + pending_rewards: 1_000_000 * ONE, + accumulated_paid_rewards: 1_000_000 * ONE, + yield_per_period, + planned_yielding_periods, + blocks_per_period, + max_reward_per_period, + incentivized_asset, + min_deposit: crate::MIN_DEPOSIT, + live_yield_farms_count: Default::default(), + total_yield_farms_count: Default::default(), + price_adjustment: FixedU128::one(), + state: FarmState::Active, + }; + + let yield_farm_0 = YieldFarmData { + id: yield_farm_id, + updated_at: yield_farm_updated_at, + total_shares: 200_u128, + total_valued_shares: yield_farm_total_valued_shares, + accumulated_rpvs: FixedU128::from(yield_farm_accumulated_rpvs), + accumulated_rpz: FixedU128::from(yield_farm_accumulated_rpvs), + loyalty_curve: None, + multiplier: FixedU128::from(2_u128), + state: FarmState::Active, + entries_count: 0, + left_to_distribute: 0, + total_stopped: 0, + _phantom: PhantomData, + }; + + let mut global_farm = global_farm_0.clone(); + let mut yield_farm = yield_farm_0.clone(); + + let global_farm_account_id = LiquidityMining::farm_account_id(global_farm_id).unwrap(); + let pot_account_id = LiquidityMining::pot_account_id().unwrap(); + + new_test_ext().execute_with(|| { + //Arrange + let _ = Tokens::transfer( + Origin::signed(TREASURY), + global_farm_account_id, + global_farm.reward_currency, + 9_000_000_000_000, + ); + assert_eq!( + Tokens::free_balance(global_farm.reward_currency, &global_farm_account_id), + 9_000_000_000_000_u128 + ); + + //_0 - value before action + let pot_balance_0 = 9_000_000_000_000; + let _ = Tokens::transfer( + Origin::signed(TREASURY), + pot_account_id, + global_farm.reward_currency, + pot_balance_0, + ); + + //Act + assert_transact_ok!(LiquidityMining::sync_yield_farm( + &mut yield_farm, + &mut global_farm, + current_period, + )); + + //Assert + // + //NOTE: update in the same period should happen only if farm is empty. RPVS is used as starting value + //for yield-farm's rpz in this test. + let rpz = if current_period == yield_farm_updated_at { + yield_farm_accumulated_rpvs + } else { + global_farm_accumulated_rpz + }; + assert_eq!( + global_farm, + GlobalFarmData { + updated_at: 200_u64, + pending_rewards: global_farm_0.pending_rewards - expected_yield_farm_reward_currency_balance, + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards + + expected_yield_farm_reward_currency_balance, + ..global_farm_0.clone() + } + ); + + assert_eq!( + yield_farm, + YieldFarmData { + updated_at: expected_updated_at, + accumulated_rpvs: FixedU128::from(expected_yield_farm_accumulated_rpvs), + accumulated_rpz: rpz.into(), + left_to_distribute: expected_yield_farm_reward_currency_balance, + ..yield_farm_0.clone() + } + ); + + //yield-farm's rewards are left in the pot so its balance should not change + assert_eq!( + Tokens::free_balance(global_farm.reward_currency, &pot_account_id), + pot_balance_0 + ); + + if current_period != yield_farm_updated_at && !yield_farm_total_valued_shares.is_zero() { + frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( + Event::YieldFarmAccRPVSUpdated { + global_farm_id: global_farm_0.id, + yield_farm_id: yield_farm_0.id, + accumulated_rpvs: FixedU128::from(expected_yield_farm_accumulated_rpvs), + total_valued_shares: yield_farm_0.total_valued_shares, + }, + )); + } + }); + } +} + +#[test] +fn sync_yield_farm_should_not_update_when_yield_farm_is_not_active() { + let global_farm_0 = GlobalFarmData { + id: 1, + owner: ALICE, + updated_at: 1000, + total_shares_z: 1_000_000_u128, + accumulated_rpz: FixedU128::from(10), + reward_currency: BSX, + pending_rewards: 1_000_000 * ONE, + accumulated_paid_rewards: 1_000_000 * ONE, + yield_per_period: Perquintill::from_float(0.5_f64), + planned_yielding_periods: 1_000, + blocks_per_period: 1, + max_reward_per_period: 10_000 * ONE, + incentivized_asset: BSX, + min_deposit: crate::MIN_DEPOSIT, + live_yield_farms_count: Default::default(), + total_yield_farms_count: Default::default(), + price_adjustment: FixedU128::one(), + state: FarmState::Active, + }; + + let yield_farm_0 = YieldFarmData { + id: 2, + updated_at: 50, + total_shares: 200_u128, + total_valued_shares: 10_000 * ONE, + accumulated_rpvs: FixedU128::from(3), + accumulated_rpz: FixedU128::from(4), + loyalty_curve: None, + multiplier: FixedU128::from(2_u128), + state: FarmState::Active, + entries_count: 0, + left_to_distribute: 0, + total_stopped: 0, + _phantom: PhantomData, + }; + + let mut global_farm = global_farm_0.clone(); + let mut stopped_yield_farm = yield_farm_0.clone(); + stopped_yield_farm.state = FarmState::Stopped; + let mut terminated_yield_farm = yield_farm_0.clone(); + terminated_yield_farm.state = FarmState::Terminated; + + new_test_ext().execute_with(|| { + let current_period = yield_farm_0.updated_at + global_farm_0.updated_at; + //Stopped yield-farm + assert_transact_ok!(LiquidityMining::sync_yield_farm( + &mut stopped_yield_farm, + &mut global_farm, + current_period, + )); + + assert_eq!( + stopped_yield_farm, + YieldFarmData { + state: FarmState::Stopped, + ..yield_farm_0.clone() + } + ); + assert_eq!(global_farm, global_farm_0); + + //Terminated yield-farm + assert_transact_ok!(LiquidityMining::sync_yield_farm( + &mut terminated_yield_farm, + &mut global_farm, + current_period, + )); + + assert_eq!( + terminated_yield_farm, + YieldFarmData { + state: FarmState::Terminated, + ..yield_farm_0 + } + ); + assert_eq!(global_farm, global_farm_0); + }); +} + +#[test] + +fn sync_yield_farm_should_only_update_updated_at_field_when_farm_has_no_valued_shares() { + let global_farm_0 = GlobalFarmData { + id: 1, + owner: ALICE, + updated_at: 1000, + total_shares_z: 1_000_000_u128, + accumulated_rpz: FixedU128::from(10), + reward_currency: BSX, + pending_rewards: 1_000_000 * ONE, + accumulated_paid_rewards: 1_000_000 * ONE, + yield_per_period: Perquintill::from_float(0.5_f64), + planned_yielding_periods: 1_000, + blocks_per_period: 1, + max_reward_per_period: 10_000 * ONE, + incentivized_asset: BSX, + min_deposit: crate::MIN_DEPOSIT, + live_yield_farms_count: Default::default(), + total_yield_farms_count: Default::default(), + price_adjustment: FixedU128::one(), + state: FarmState::Active, + }; + + //after action + let yield_farm_1 = YieldFarmData { + id: 2, + updated_at: 1050, + total_shares: 0, + total_valued_shares: 0, + accumulated_rpvs: FixedU128::from(3), + accumulated_rpz: FixedU128::from(4), + loyalty_curve: None, + multiplier: FixedU128::from(2_u128), + state: FarmState::Active, + entries_count: 0, + left_to_distribute: 0, + total_stopped: 0, + _phantom: PhantomData, + }; + + let mut global_farm = global_farm_0.clone(); + let mut yield_farm = yield_farm_1.clone(); + + new_test_ext().execute_with(|| { + let current_period = 1050; + assert_transact_ok!(LiquidityMining::sync_yield_farm( + &mut yield_farm, + &mut global_farm, + current_period, + )); + + assert_eq!(yield_farm, yield_farm_1); + assert_eq!(global_farm, global_farm_0); + }); +} + +#[test] +fn sync_yield_farm_should_not_update_when_yield_farm_was_already_updated_in_this_period() { + let global_farm_0 = GlobalFarmData { + id: 1, + owner: ALICE, + updated_at: 1000, + total_shares_z: 1_000_000_u128, + accumulated_rpz: FixedU128::from(10), + reward_currency: BSX, + pending_rewards: 1_000_000 * ONE, + accumulated_paid_rewards: 1_000_000 * ONE, + yield_per_period: Perquintill::from_float(0.5_f64), + planned_yielding_periods: 1_000, + blocks_per_period: 1, + max_reward_per_period: 10_000 * ONE, + incentivized_asset: BSX, + min_deposit: crate::MIN_DEPOSIT, + live_yield_farms_count: Default::default(), + total_yield_farms_count: Default::default(), + price_adjustment: FixedU128::one(), + state: FarmState::Active, + }; + + let yield_farm_0 = YieldFarmData { + id: 2, + updated_at: global_farm_0.updated_at, + total_shares: 10_000 * ONE, + total_valued_shares: 15_000 * ONE, + accumulated_rpvs: FixedU128::from(3), + accumulated_rpz: FixedU128::from(4), + loyalty_curve: None, + multiplier: FixedU128::from(2_u128), + state: FarmState::Active, + entries_count: 0, + left_to_distribute: 0, + total_stopped: 0, + _phantom: PhantomData, + }; + + let mut global_farm = global_farm_0.clone(); + let mut yield_farm = yield_farm_0.clone(); + + new_test_ext().execute_with(|| { + let current_period = global_farm_0.updated_at; + assert_transact_ok!(LiquidityMining::sync_yield_farm( + &mut yield_farm, + &mut global_farm, + current_period, + )); + + assert_eq!(yield_farm, yield_farm_0); + assert_eq!(global_farm, global_farm_0); + }); +} + +#[test] +fn get_next_farm_id_should_work() { + new_test_ext().execute_with(|| { + assert_eq!(LiquidityMining::get_next_farm_id().unwrap(), 1); + assert_eq!(LiquidityMining::last_farm_id(), 1); + + assert_eq!(LiquidityMining::get_next_farm_id().unwrap(), 2); + assert_eq!(LiquidityMining::last_farm_id(), 2); + + assert_eq!(LiquidityMining::get_next_farm_id().unwrap(), 3); + assert_eq!(LiquidityMining::last_farm_id(), 3); + + assert_eq!(LiquidityMining::get_next_farm_id().unwrap(), 4); + assert_eq!(LiquidityMining::last_farm_id(), 4); + }); +} + +#[test] +fn farm_account_id_should_work() { + let ids: Vec = vec![1, 100, 543, u32::max_value()]; + + for id in ids { + assert_ok!(LiquidityMining::farm_account_id(id)); + } +} + +#[test] +#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] +fn farm_account_id_should_fail_when_farm_id_is_zero() { + let ids: Vec = vec![0]; + new_test_ext().execute_with(|| { + for id in ids { + assert_noop!( + LiquidityMining::farm_account_id(id), + Error::::InconsistentState(InconsistentStateError::InvalidFarmId) + ); + } + }); +} + +#[test] +fn get_next_deposit_id_should_work() { + new_test_ext().execute_with(|| { + let test_data = vec![1, 2, 3, 4, 5]; + + for expected_deposit_id in test_data { + assert_eq!(LiquidityMining::get_next_deposit_id().unwrap(), expected_deposit_id); + } + }); +} + +#[test] +fn depositdata_add_farm_entry_to_should_work() { + new_test_ext().execute_with(|| { + let mut deposit = DepositData:: { + shares: 10, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![].try_into().unwrap(), + }; + + let test_farm_entries = vec![ + YieldFarmEntry::::new(1, 50, 20, FixedU128::from(12), 2, 1), + YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 1), + YieldFarmEntry::::new(3, 60, 20, FixedU128::from(1), 1, 1), + YieldFarmEntry::::new(4, 1, 20, FixedU128::from(10), 13, 1), + YieldFarmEntry::::new(7, 2, 20, FixedU128::from(10), 13, 1), + YieldFarmEntry::::new(5, 100, 20, FixedU128::from(10), 13, 1), + YieldFarmEntry::::new(6, 4, 20, FixedU128::from(10), 13, 1), + ]; + + assert_ok!(deposit.add_yield_farm_entry(test_farm_entries[0].clone())); + + assert_ok!(deposit.add_yield_farm_entry(test_farm_entries[2].clone())); + + assert_ok!(deposit.add_yield_farm_entry(test_farm_entries[3].clone())); + + //`yield_farm_id` must be unique in `yield_farm_entries` + assert_noop!( + deposit.add_yield_farm_entry(test_farm_entries[2].clone()), + Error::::DoubleLock + ); + assert_noop!( + deposit.add_yield_farm_entry(YieldFarmEntry::::new( + 1, + 50, + 10, + FixedU128::from(1), + 1, + 0 + )), + Error::::DoubleLock + ); + + assert_ok!(deposit.add_yield_farm_entry(test_farm_entries[4].clone())); + + assert_ok!(deposit.add_yield_farm_entry(test_farm_entries[6].clone())); + + assert_eq!( + deposit, + DepositData:: { + shares: 10, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![ + test_farm_entries[0].clone(), + test_farm_entries[2].clone(), + test_farm_entries[3].clone(), + test_farm_entries[4].clone(), + test_farm_entries[6].clone(), + ] + .try_into() + .unwrap(), + } + ); + + //5 is max farm entries. + assert_noop!( + deposit.add_yield_farm_entry(test_farm_entries[5].clone()), + Error::::MaxEntriesPerDeposit + ); + }); +} + +#[test] +fn deposit_remove_yield_farm_entry_should_work() { + new_test_ext().execute_with(|| { + let mut deposit = DepositData:: { + shares: 10, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![ + YieldFarmEntry::::new(4, 1, 20, FixedU128::from(10), 13, 0), + YieldFarmEntry::::new(7, 2, 20, FixedU128::from(1), 13, 0), + YieldFarmEntry::::new(6, 4, 20, FixedU128::from(10), 13, 0), + YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 0), + YieldFarmEntry::::new(3, 60, 20, FixedU128::from(1), 1, 0), + ] + .try_into() + .unwrap(), + }; + + const NON_EXISTING_YIELD_FARM_ID: YieldFarmId = 999_999_999; + assert_noop!( + deposit.remove_yield_farm_entry(NON_EXISTING_YIELD_FARM_ID), + Error::::YieldFarmEntryNotFound + ); + + assert_ok!(deposit.remove_yield_farm_entry(2)); + assert_ok!(deposit.remove_yield_farm_entry(18)); + assert_ok!(deposit.remove_yield_farm_entry(1)); + assert_ok!(deposit.remove_yield_farm_entry(4)); + assert_ok!(deposit.remove_yield_farm_entry(60)); + + //This state should never happen, deposit should be flushed from storage when have no more + //entries. + assert_eq!( + deposit.yield_farm_entries, + TryInto::, ConstU32<5>>>::try_into(vec![]).unwrap() + ); + + assert_noop!( + deposit.remove_yield_farm_entry(60), + Error::::YieldFarmEntryNotFound + ); + }); +} + +#[test] +fn deposit_get_yield_farm_entry_should_work() { + let mut deposit = DepositData:: { + shares: 10, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![ + YieldFarmEntry::::new(4, 1, 20, FixedU128::from(10), 13, 0), + YieldFarmEntry::::new(7, 2, 20, FixedU128::from(1), 13, 0), + YieldFarmEntry::::new(6, 4, 20, FixedU128::from(10), 13, 0), + YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 0), + YieldFarmEntry::::new(3, 60, 20, FixedU128::from(1), 1, 0), + ] + .try_into() + .unwrap(), + }; + + assert_eq!( + deposit.get_yield_farm_entry(18).unwrap(), + &mut YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 0) + ); + + const NON_EXISTING_YIELD_FARM_ID: YieldFarmId = 98_908; + assert!(deposit.get_yield_farm_entry(NON_EXISTING_YIELD_FARM_ID).is_none()) +} + +#[test] +fn deposit_search_yield_farm_entry_should_work() { + let deposit = DepositData:: { + shares: 10, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![ + YieldFarmEntry::::new(4, 1, 20, FixedU128::from(10), 13, 0), + YieldFarmEntry::::new(7, 2, 20, FixedU128::from(1), 13, 0), + YieldFarmEntry::::new(6, 4, 20, FixedU128::from(10), 13, 0), + YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 0), + YieldFarmEntry::::new(3, 60, 20, FixedU128::from(1), 1, 0), + ] + .try_into() + .unwrap(), + }; + + assert!(deposit.search_yield_farm_entry(1).is_some()); + assert!(deposit.search_yield_farm_entry(60).is_some()); + assert!(deposit.search_yield_farm_entry(4).is_some()); + + const NON_EXISTING_YIELD_FARM_ID: YieldFarmId = 98_908; + + assert!(deposit.search_yield_farm_entry(NON_EXISTING_YIELD_FARM_ID).is_none()); +} + +#[test] +fn deposit_can_be_flushed_should_work() { + //non empty deposit can't be flushed + let deposit = DepositData:: { + shares: 10, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![ + YieldFarmEntry::::new(4, 1, 20, FixedU128::from(10), 13, 0), + YieldFarmEntry::::new(7, 2, 20, FixedU128::from(1), 13, 0), + YieldFarmEntry::::new(6, 4, 20, FixedU128::from(10), 13, 0), + YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 0), + YieldFarmEntry::::new(3, 60, 20, FixedU128::from(1), 1, 0), + ] + .try_into() + .unwrap(), + }; + + assert!(!deposit.can_be_removed()); + + let deposit = DepositData:: { + shares: 10, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![YieldFarmEntry::::new( + 4, + 1, + 20, + FixedU128::from(10), + 13, + 0, + )] + .try_into() + .unwrap(), + }; + + assert!(!deposit.can_be_removed()); + + //deposit with no entries can be flushed + let deposit = DepositData:: { + shares: 10, + amm_pool_id: BSX_TKN1_AMM, + yield_farm_entries: vec![].try_into().unwrap(), + }; + + assert!(deposit.can_be_removed()); +} + +#[test] +#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] +fn yield_farm_data_should_work() { + new_test_ext().execute_with(|| { + let mut yield_farm = + YieldFarmData::::new(1, 10, Some(LoyaltyCurve::default()), FixedU128::from(10_000)); + + //new farm should be created active + assert!(yield_farm.state.is_active()); + assert!(!yield_farm.state.is_stopped()); + assert!(!yield_farm.state.is_terminated()); + + yield_farm.state = FarmState::Stopped; + assert!(!yield_farm.state.is_active()); + assert!(yield_farm.state.is_stopped()); + assert!(!yield_farm.state.is_terminated()); + + yield_farm.state = FarmState::Terminated; + assert!(!yield_farm.state.is_active()); + assert!(!yield_farm.state.is_stopped()); + assert!(yield_farm.state.is_terminated()); + + assert_ok!(yield_farm.increase_entries_count()); + assert_eq!(yield_farm.entries_count, 1); + assert_ok!(yield_farm.increase_entries_count()); + assert_ok!(yield_farm.increase_entries_count()); + assert_ok!(yield_farm.increase_entries_count()); + assert_eq!(yield_farm.entries_count, 4); + + assert_ok!(yield_farm.decrease_entries_count()); + assert_eq!(yield_farm.entries_count, 3); + assert_ok!(yield_farm.decrease_entries_count()); + assert_ok!(yield_farm.decrease_entries_count()); + assert_ok!(yield_farm.decrease_entries_count()); + assert_eq!(yield_farm.entries_count, 0); + assert_noop!( + yield_farm.decrease_entries_count(), + Error::::InconsistentState(InconsistentStateError::InvalidYieldFarmEntriesCount) + ); + + //no entries in the farm + yield_farm.entries_count = 0; + assert!(!yield_farm.has_entries()); + assert_ok!(yield_farm.increase_entries_count()); + assert!(yield_farm.has_entries()); + + yield_farm.state = FarmState::Active; + yield_farm.entries_count = 0; + //active farm can't be flushed + assert!(!yield_farm.can_be_removed()); + + //stopped farm can't be flushed + yield_farm.state = FarmState::Stopped; + assert!(!yield_farm.can_be_removed()); + + //deleted farm with entries can't be flushed + yield_farm.state = FarmState::Terminated; + yield_farm.entries_count = 1; + assert!(!yield_farm.can_be_removed()); + + //deleted farm with no entries can be flushed + yield_farm.entries_count = 0; + assert!(yield_farm.can_be_removed()); + }); +} + +#[test] +fn global_farm_should_work() { + let mut global_farm = GlobalFarmData::::new( + 1, + 10, + BSX, + Perquintill::from_float(0.2), + 1_000, + 100, + GC, + BSX, + 1_000_000, + 1_000, + One::one(), + ); + + //new farm should be created active + assert!(global_farm.state.is_active()); + global_farm.state = FarmState::Terminated; + assert!(!global_farm.state.is_active()); + + global_farm.state = FarmState::Active; + + assert_ok!(global_farm.increase_yield_farm_counts()); + assert_ok!(global_farm.increase_yield_farm_counts()); + assert_eq!(global_farm.live_yield_farms_count, 2); + assert_eq!(global_farm.total_yield_farms_count, 2); + assert_ok!(global_farm.increase_yield_farm_counts()); + assert_ok!(global_farm.increase_yield_farm_counts()); + assert_eq!(global_farm.live_yield_farms_count, 4); + assert_eq!(global_farm.total_yield_farms_count, 4); + assert_ok!(global_farm.decrease_live_yield_farm_count()); + assert_ok!(global_farm.decrease_live_yield_farm_count()); + //removing farm changes only live farms, total count is not changed + assert_eq!(global_farm.live_yield_farms_count, 2); + assert_eq!(global_farm.total_yield_farms_count, 4); + assert_ok!(global_farm.increase_yield_farm_counts()); + assert_eq!(global_farm.live_yield_farms_count, 3); + assert_eq!(global_farm.total_yield_farms_count, 5); + assert_ok!(global_farm.decrease_total_yield_farm_count()); + assert_ok!(global_farm.decrease_total_yield_farm_count()); + //removing farm changes only total count(farm has to removed and deleted before it can be + //flushed) + assert_eq!(global_farm.live_yield_farms_count, 3); + assert_eq!(global_farm.total_yield_farms_count, 3); + + assert!(global_farm.has_live_farms()); + global_farm.live_yield_farms_count = 0; + global_farm.total_yield_farms_count = 3; + assert!(!global_farm.has_live_farms()); + + //active farm can't be flushed + assert!(!global_farm.can_be_removed()); + global_farm.state = FarmState::Terminated; + //deleted farm with yield farm can't be flushed + assert!(!global_farm.can_be_removed()); + //deleted farm with no yield farms can be flushed + global_farm.live_yield_farms_count = 0; + global_farm.total_yield_farms_count = 0; + assert!(global_farm.can_be_removed()); +} + +#[test] +fn global_farm_add_stake_should_work_when_amount_is_provided() { + let global_farm_0 = GlobalFarmData::::new( + 1, + 10, + BSX, + Perquintill::from_float(0.2), + 1_000, + 100, + GC, + BSX, + 1_000_000, + 1_000, + One::one(), + ); + + let mut global_farm = global_farm_0.clone(); + + assert_ok!(global_farm.add_stake(1)); + assert_eq!( + global_farm, + GlobalFarmData { + total_shares_z: 1, + ..global_farm_0.clone() + } + ); + + assert_ok!(global_farm.add_stake(1_000_000 * ONE)); + assert_eq!( + global_farm, + GlobalFarmData { + total_shares_z: 1_000_000 * ONE + 1, //+1 from previous add_stake + ..global_farm_0 + } + ); +} + +#[test] +fn global_farm_remove_stake_should_work_when_amount_is_provided() { + new_test_ext().execute_with(|| { + let mut global_farm_0 = GlobalFarmData::::new( + 1, + 10, + BSX, + Perquintill::from_float(0.2), + 1_000, + 100, + GC, + BSX, + 1_000_000, + 1_000, + One::one(), + ); + + global_farm_0.total_shares_z = 1_000_000 * ONE; + + let mut global_farm = global_farm_0.clone(); + + assert_ok!(global_farm.remove_stake(1)); + assert_eq!( + global_farm, + GlobalFarmData { + total_shares_z: 1_000_000 * ONE - 1, + ..global_farm_0.clone() + } + ); + + assert_ok!(global_farm.remove_stake(1_000_000 * ONE - 1)); //-1 from previous remove_stake + assert_eq!( + global_farm, + GlobalFarmData { + total_shares_z: 0, + ..global_farm_0 + } + ); + }); +} + +#[test] +#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] +fn global_farm_remove_stake_should_not_work_when_math_overflow() { + new_test_ext().execute_with(|| { + let mut global_farm_0 = GlobalFarmData::::new( + 1, + 10, + BSX, + Perquintill::from_float(0.2), + 1_000, + 100, + GC, + BSX, + 1_000_000, + 1_000, + One::one(), + ); + + global_farm_0.total_shares_z = 1_000_000 * ONE; + let mut global_farm = global_farm_0; + + //sub with overflow + assert_noop!( + global_farm.remove_stake(1 + 1_000_000 * ONE), + Error::InconsistentState(InconsistentStateError::InvalidTotalSharesZ) + ); + }); +} + +#[test] +fn is_yield_farm_clamable_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + //active farm + assert!(LiquidityMining::is_yield_farm_claimable( + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + //invalid amm_pool_id + assert!(!LiquidityMining::is_yield_farm_claimable( + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN2_AMM + )); + + //farm withouth deposits + assert!(!LiquidityMining::is_yield_farm_claimable( + EVE_FARM, + EVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + //termianted yield farm + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + assert!(!LiquidityMining::is_yield_farm_claimable( + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn get_global_farm_id_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + //happy path + assert_eq!( + LiquidityMining::get_global_farm_id(PREDEFINED_DEPOSIT_IDS[0], GC_BSX_TKN1_YIELD_FARM_ID), + Some(GC_FARM) + ); + + //happy path deposit with multiple farm entries + //create second farm entry + assert_ok!(LiquidityMining::redeposit_lp_shares( + EVE_FARM, + EVE_BSX_TKN1_YIELD_FARM_ID, + PREDEFINED_DEPOSIT_IDS[0], + |_, _, _| { Ok(1_000_u128) } + )); + + assert_eq!( + LiquidityMining::get_global_farm_id(PREDEFINED_DEPOSIT_IDS[0], EVE_BSX_TKN1_YIELD_FARM_ID), + Some(EVE_FARM) + ); + + //deposit doesn't exists + assert!(LiquidityMining::get_global_farm_id(999_9999, GC_BSX_TKN1_YIELD_FARM_ID).is_none()); + + //farm's entry doesn't exists in the deposit + assert!( + LiquidityMining::get_global_farm_id(PREDEFINED_DEPOSIT_IDS[0], DAVE_BSX_TKN1_YIELD_FARM_ID).is_none() + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn farm_state_should_work() { + let active = FarmState::Active; + let deleted = FarmState::Terminated; + let stopped = FarmState::Stopped; + + assert_eq!(active.is_active(), true); + assert_eq!(active.is_stopped(), false); + assert_eq!(active.is_terminated(), false); + + assert_eq!(stopped.is_active(), false); + assert_eq!(stopped.is_stopped(), true); + assert_eq!(stopped.is_terminated(), false); + + assert_eq!(deleted.is_active(), false); + assert_eq!(deleted.is_stopped(), false); + assert_eq!(deleted.is_terminated(), true); +} + +#[test] +fn min_yield_farm_multiplier_should_be_ge_1_when_multiplied_by_min_deposit() { + //WARN: don't remove this test. This rule is important. + // min_yield_farm_multiplier * min_deposit >=1 otherwise non-zero deposit can result in a zero + // stake in global-farm and farm can be falsely identified as empty. + //https://github.com/galacticcouncil/warehouse/issues/127 + + assert_eq!( + crate::MIN_YIELD_FARM_MULTIPLIER + .checked_mul_int(crate::MIN_DEPOSIT) + .unwrap() + .ge(&1_u128), + true + ); +} + +#[test] +fn sync_global_farm_should_emit_all_rewards_distributed_when_reward_is_zero() { + new_test_ext().execute_with(|| { + let global_farm_id = 10; + + let mut global_farm = GlobalFarmData::new( + global_farm_id, + 10, + BSX, + Perquintill::from_percent(1), + 10_000, + 1, + ALICE, + BSX, + 1_000_000 * ONE, + 1_000, + One::one(), + ); + global_farm.total_shares_z = 1_000 * ONE; + + let farm_account_id = LiquidityMining::farm_account_id(global_farm_id).unwrap(); + Whitelist::add_account(&farm_account_id).unwrap(); + + assert_eq!(Tokens::free_balance(BSX, &farm_account_id), Balance::zero()); + + assert_eq!( + with_transaction(|| { + TransactionOutcome::Commit(LiquidityMining::sync_global_farm(&mut global_farm, 1_000_000_000)) + }) + .unwrap(), + Balance::zero() + ); + + frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( + Event::AllRewardsDistributed { global_farm_id }, + )); + }); +} diff --git a/pallets/liquidity-mining/src/tests/update_global_farm.rs b/pallets/liquidity-mining/src/tests/update_global_farm.rs new file mode 100644 index 00000000000..d567303a8d4 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/update_global_farm.rs @@ -0,0 +1,184 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn update_global_farm_price_adjustment_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let new_price_adjustment = FixedU128::from_float(0.856_f64); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + + set_block_number(100_000); + + assert_ok!(LiquidityMining::update_global_farm_price_adjustment( + GC, + GC_FARM, + new_price_adjustment + )); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 1_000, + accumulated_rpz: FixedU128::from_inner(491_000_000_000_000_000_000_u128), + price_adjustment: new_price_adjustment, + pending_rewards: 343_195_125_u128 * ONE, + ..global_farm_0 + }, + ); + + frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( + Event::GlobalFarmAccRPZUpdated { + global_farm_id: global_farm_0.id, + accumulated_rpz: FixedU128::from_inner(491_000_000_000_000_000_000_u128), + total_shares_z: global_farm_0.total_shares_z, + }, + )); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn update_global_farm_price_adjustment_in_same_period_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let new_price_adjustment = FixedU128::from_float(0.856_f64); + set_block_number(10_000); + + assert_ok!(LiquidityMining::update_global_farm_price_adjustment( + GC, + GC_FARM, + new_price_adjustment + )); + + frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( + Event::GlobalFarmAccRPZUpdated { + global_farm_id: GC_FARM, + accumulated_rpz: FixedU128::from_inner(41_000_000_000_000_000_000_u128), + total_shares_z: 703_990_u128 * ONE, + }, + )); + + let new_price_adjustment = FixedU128::from_float(0.6_f64); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + assert_ok!(LiquidityMining::update_global_farm_price_adjustment( + GC, + GC_FARM, + new_price_adjustment + )); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + price_adjustment: new_price_adjustment, + ..global_farm_0 + }, + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn update_global_farm_price_adjustment_not_owner_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let new_price_adjustment = FixedU128::from_float(0.6_f64); + let not_owner = ALICE; + + set_block_number(10_000); + + assert_noop!( + LiquidityMining::update_global_farm_price_adjustment(not_owner, GC_FARM, new_price_adjustment), + Error::::Forbidden + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +//global farm not found +#[test] +fn update_global_farm_price_adjustment_not_existing_farm_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let new_price_adjustment = FixedU128::from_float(0.6_f64); + let not_existing_farm = GlobalFarmId::MAX; + + set_block_number(10_000); + + assert_noop!( + LiquidityMining::update_global_farm_price_adjustment(GC, not_existing_farm, new_price_adjustment), + Error::::GlobalFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn update_global_farm_price_adjustment_should_fail_when_farm_is_already_terminated() { + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + //Arrange + let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[2].id); + + //Add deposit to yield farm so it won't be removed from storage on destroy. + assert_ok!(LiquidityMining::deposit_lp_shares( + CHARLIE_FARM, + yield_farm_id, + ACA_KSM_AMM, + 1_000 * ONE, + |_, _, _| { Ok(10 * ONE) }, + )); + + //Stop farming. + assert_ok!(LiquidityMining::stop_yield_farm(CHARLIE, CHARLIE_FARM, ACA_KSM_AMM)); + + //Destroy yield farm (yield farm is destroyed but not flushed) + assert_ok!(LiquidityMining::terminate_yield_farm( + CHARLIE, + CHARLIE_FARM, + yield_farm_id, + ACA_KSM_AMM + )); + + //Destroy global farm. + assert_ok!(LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM)); + + //Global farm with yield farms should NOT be flushed. + pretty_assertions::assert_eq!(LiquidityMining::global_farm(CHARLIE_FARM).is_some(), true); + + //Act & assert + assert_noop!( + LiquidityMining::update_global_farm_price_adjustment(CHARLIE, CHARLIE_FARM, FixedU128::one()), + Error::::GlobalFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }) +} diff --git a/pallets/liquidity-mining/src/tests/update_yield_farm.rs b/pallets/liquidity-mining/src/tests/update_yield_farm.rs new file mode 100644 index 00000000000..9687517f00e --- /dev/null +++ b/pallets/liquidity-mining/src/tests/update_yield_farm.rs @@ -0,0 +1,223 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn update_yield_farm_should_work() { + //Yield farm without deposits. + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + let new_multiplier: FarmMultiplier = FixedU128::from(5_000_u128); + let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); + + assert_eq!( + LiquidityMining::update_yield_farm_multiplier(GC, GC_FARM, BSX_TKN1_AMM, new_multiplier).unwrap(), + GC_BSX_TKN1_YIELD_FARM_ID + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + multiplier: new_multiplier, + ..yield_farm + } + ); + + assert_eq!(LiquidityMining::global_farm(GC_FARM).unwrap(), global_farm); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + + //Yield farm with deposits. + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + //Same period as last yield farm update so no farms(global or yield) need to be updated. + let new_multiplier: FarmMultiplier = FixedU128::from(10_000_u128); + let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); + + assert_ok!(LiquidityMining::update_yield_farm_multiplier( + GC, + GC_FARM, + BSX_TKN1_AMM, + new_multiplier, + )); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + multiplier: new_multiplier, + ..yield_farm + } + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + total_shares_z: 455_876_290 * ONE, + ..global_farm + } + ); + + //Different period so farms update should happen. + set_block_number(5_000); + let new_multiplier: FarmMultiplier = FixedU128::from(5_000_u128); + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + let pot = LiquidityMining::pot_account_id().unwrap(); + let expected_claimed_from_global_farm = 1_498_432_831_415_733_421_593_u128; + //This is not claimed by other yield farms. + let expected_allocated_for_other_yield_farms = 1_567_168_584_266_578_407_u128; + + //_0 - value before action. + let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + let global_farm_balance_0 = Tokens::free_balance(BSX, &global_farm_account); + let pot_balance_0 = Tokens::free_balance(BSX, &pot); + + assert_ok!(LiquidityMining::update_yield_farm_multiplier( + GC, + GC_FARM, + BSX_TKN1_AMM, + new_multiplier, + )); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 50, + accumulated_rpvs: FixedU128::from_inner(32_921_163_403_946_715_450_000_u128), + accumulated_rpz: FixedU128::from_inner(6_790_366_340_394_671_545_u128), + multiplier: new_multiplier, + left_to_distribute: yield_farm_0.left_to_distribute + expected_claimed_from_global_farm, + ..yield_farm_0 + } + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 50, + accumulated_rpz: FixedU128::from_inner(6_790_366_340_394_671_545_u128), + total_shares_z: 228_176_290 * ONE, + pending_rewards: global_farm_0.pending_rewards + expected_allocated_for_other_yield_farms, + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards + + expected_claimed_from_global_farm, + ..global_farm_0 + } + ); + + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + global_farm_balance_0 - expected_claimed_from_global_farm - expected_allocated_for_other_yield_farms + ); + assert_eq!( + Tokens::free_balance(BSX, &pot), + pot_balance_0 + expected_claimed_from_global_farm + expected_allocated_for_other_yield_farms + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn update_yield_farm_multiplier_should_not_work_when_multiplier_is_lt_min_yield_farm_multiplier() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::update_yield_farm_multiplier( + GC, + GC_FARM, + BSX_TKN1_AMM, + MIN_YIELD_FARM_MULTIPLIER - FixedU128::from_inner(1_u128), + ), + Error::::InvalidMultiplier + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn update_yield_farm_stopped_farm_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + //Yield farm must be in the active yield farm storage to update works. + assert_noop!( + LiquidityMining::update_yield_farm_multiplier(GC, GC_FARM, BSX_TKN1_AMM, FixedU128::from(10_001),), + Error::::YieldFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn update_yield_farm_termianted_farm_should_not_work() { + //NOTE: yield farm is in the storage but it's deleted. + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).is_some()); + + //Yield farm must be in the active yield farm storage to update works + assert_noop!( + LiquidityMining::update_yield_farm_multiplier(GC, GC_FARM, BSX_TKN1_AMM, FixedU128::from(10_001),), + Error::::YieldFarmNotFound + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn update_yield_farm_not_owner_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let not_owner = ALICE; + assert_noop!( + LiquidityMining::update_yield_farm_multiplier( + not_owner, + GC_FARM, + BSX_TKN1_AMM, + FixedU128::from(10_001_u128), + ), + Error::::Forbidden + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} diff --git a/pallets/liquidity-mining/src/tests/withdraw_lp_shares.rs b/pallets/liquidity-mining/src/tests/withdraw_lp_shares.rs new file mode 100644 index 00000000000..7cde2674fa3 --- /dev/null +++ b/pallets/liquidity-mining/src/tests/withdraw_lp_shares.rs @@ -0,0 +1,1377 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; +use hydradx_traits::liquidity_mining::Mutate; +use pretty_assertions::assert_eq; +use test_ext::*; + +#[test] +fn withdraw_shares_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const REWARD_CURRENCY: u32 = BSX; + const GLOBAL_FARM_ID: GlobalFarmId = GC_FARM; + + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + let global_farm_total_rewards_start = 30_000_000_000 * ONE; + + let pot = LiquidityMining::pot_account_id().unwrap(); + let pot_initial_balance = 1_000_000_000 * ONE; + + // This balance is used to transfer unclaimable_rewards from yield farm to global farm. + // Claiming is not part of withdraw_shares() so some balance need to be set. + Tokens::set_balance(Origin::root(), pot, REWARD_CURRENCY, pot_initial_balance, 0).unwrap(); + + // withdraw 1A + // _0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + let bsx_tkn1_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + + let unclaimable_rewards = 100_000 * ONE; + let withdrawn_amount = 50 * ONE; + let expected_deposit_destroyed = true; + + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + unclaimable_rewards, + ) + .unwrap(), + (GLOBAL_FARM_ID, withdrawn_amount, expected_deposit_destroyed,) + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 25, + reward_currency: BSX, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares_z: 691_490 * ONE, + pending_rewards: 0, + accumulated_paid_rewards: 1_283_550 * ONE - unclaimable_rewards, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 566 * ONE, + total_valued_shares: 43_040 * ONE, + entries_count: 2, + left_to_distribute: bsx_tkn1_yield_farm_0.left_to_distribute - unclaimable_rewards, + ..bsx_tkn1_yield_farm_0 + }, + ); + + //Unclaimabe rewards was transferred from pot to global-farm's account. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &pot), + pot_balance_0 - unclaimable_rewards + ); + + //Global farm balance checks. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert_eq!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]), None); + + set_block_number(12_800); + + // withdraw 3B + + let unclaimable_rewards = 32_786 * ONE; + let withdrawn_amount = 87 * ONE; + let expected_deposit_destroyed = true; + + // _0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + let bsx_tkn1_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let bsx_tkn2_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[4], + GC_BSX_TKN2_YIELD_FARM_ID, + unclaimable_rewards + ) + .unwrap(), + (GLOBAL_FARM_ID, withdrawn_amount, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 25, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + pending_rewards: 0, + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, + total_shares_z: 688_880 * ONE, + ..global_farm_0 + } + ); + + // This farm should not change. + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + bsx_tkn1_yield_farm_0 + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 873 * ONE, + total_valued_shares: 47_368 * ONE, + entries_count: 3, + left_to_distribute: bsx_tkn2_yield_farm_0.left_to_distribute - unclaimable_rewards, + ..bsx_tkn2_yield_farm_0 + }, + ); + + //Pot's balance checks. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &pot), + pot_balance_0 - unclaimable_rewards + ); + + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[4]).is_none()); + + // withdraw 3A + + let unclaimable_rewards = 2_441 * ONE; + let withdrawn_amount = 486 * ONE; + let expected_deposit_destroyed = true; + + // _0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + let bsx_tkn1_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[6], + GC_BSX_TKN1_YIELD_FARM_ID, + unclaimable_rewards, + ) + .unwrap(), + (GLOBAL_FARM_ID, withdrawn_amount, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 25, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + pending_rewards: 0, + total_shares_z: 494480 * ONE, + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, + ..global_farm_0 + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 80 * ONE, + total_valued_shares: 4_160 * ONE, + entries_count: 1, + left_to_distribute: bsx_tkn1_yield_farm_0.left_to_distribute - unclaimable_rewards, + ..bsx_tkn1_yield_farm_0 + }, + ); + + //Yield farm balance checks. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &pot), + pot_balance_0 - unclaimable_rewards + ); + + //Global farm balance checks. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[6]).is_none()); + + // withdraw 2A + + let unclaimable_rewards = 429 * ONE; + let withdrawn_amount = 80 * ONE; + let expected_deposit_destroyed = true; + + // _0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + let bsx_tkn1_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[1], + GC_BSX_TKN1_YIELD_FARM_ID, + unclaimable_rewards, + ) + .unwrap(), + (GLOBAL_FARM_ID, withdrawn_amount, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 25, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + pending_rewards: 0, + total_shares_z: 473_680 * ONE, + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, + ..global_farm_0 + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 0, + total_valued_shares: 0, + entries_count: 0, + left_to_distribute: bsx_tkn1_yield_farm_0.left_to_distribute - unclaimable_rewards, + ..bsx_tkn1_yield_farm_0 + }, + ); + + //Yield farm balance checks. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &pot), + pot_balance_0 - unclaimable_rewards + ); + + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[1]).is_none()); + + // withdraw 1B + let unclaimable_rewards = 30_001 * ONE; + + // _0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + let bsx_tkn1_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let bsx_tkn2_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + + assert_ok!(LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[2], + GC_BSX_TKN2_YIELD_FARM_ID, + unclaimable_rewards + )); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 25, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + pending_rewards: 0, + total_shares_z: 471_680 * ONE, + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, + ..global_farm_0 + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + bsx_tkn1_yield_farm_0 + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 848 * ONE, + total_valued_shares: 47_168 * ONE, + entries_count: 2, + left_to_distribute: bsx_tkn2_yield_farm_0.left_to_distribute - unclaimable_rewards, + ..bsx_tkn2_yield_farm_0 + }, + ); + + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &pot), + pot_balance_0 - unclaimable_rewards + ); + + //Global farm balance checks. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert_eq!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[2]), None); + + // withdraw 4B + let unclaimable_rewards = 96_473 * ONE; + let withdrawn_shares = 48 * ONE; + let expected_deposit_destroyed = true; + + // _0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + let bsx_tkn2_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[5], + GC_BSX_TKN2_YIELD_FARM_ID, + unclaimable_rewards, + ) + .unwrap(), + (GLOBAL_FARM_ID, withdrawn_shares, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 25, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + pending_rewards: 0, + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, + total_shares_z: 464_000 * ONE, + ..global_farm_0 + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 800 * ONE, + total_valued_shares: 46_400 * ONE, + entries_count: 1, + left_to_distribute: bsx_tkn2_yield_farm_0.left_to_distribute - unclaimable_rewards, + ..bsx_tkn2_yield_farm_0 + }, + ); + + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &pot), + pot_balance_0 - unclaimable_rewards + ); + + //Global farm balance checks. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[5]).is_none()); + + // withdraw 2B + let unclaimable_rewards = 5_911 * ONE; + let withdrawn_shares = 800 * ONE; + let expected_deposit_destroyed = true; + + // _0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + let bsx_tkn2_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[3], + GC_BSX_TKN2_YIELD_FARM_ID, + unclaimable_rewards + ) + .unwrap(), + (GLOBAL_FARM_ID, withdrawn_shares, expected_deposit_destroyed) + ); + + let global_farm_1 = LiquidityMining::global_farm(GC_FARM).unwrap(); + pretty_assertions::assert_eq!( + global_farm_1, + GlobalFarmData { + updated_at: 25, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + pending_rewards: 0, + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, + total_shares_z: 0, + ..global_farm_0 + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 0, + total_valued_shares: 0, + entries_count: 0, + left_to_distribute: bsx_tkn2_yield_farm_0.left_to_distribute - unclaimable_rewards, + ..bsx_tkn2_yield_farm_0 + }, + ); + + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &pot), + pot_balance_0 - unclaimable_rewards + ); + + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[2]).is_none()); + + let distributed_from_global = + global_farm_total_rewards_start - Tokens::total_balance(REWARD_CURRENCY, &global_farm_account); + + let tracked_distributed_rewards = global_farm_1.accumulated_paid_rewards + global_farm_1.pending_rewards; + + pretty_assertions::assert_eq!(distributed_from_global, tracked_distributed_rewards); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); + + //Charlie's farm incentivize KSM and reward currency is ACA + //This test check if correct currency is transferred if rewards and incentvized + //assets are different, otherwise farm behavior is the same as in test above. + predefined_test_ext().execute_with(|| { + let _ = with_transaction(|| { + set_block_number(1_800); //period 18 + + let deposited_amount = 50 * ONE; + assert_ok!(LiquidityMining::deposit_lp_shares( + CHARLIE_FARM, + CHARLIE_ACA_KSM_YIELD_FARM_ID, + ACA_KSM_AMM, + deposited_amount, + |_, _, _| { Ok(2_500 * ONE) } + )); + + const DEPOSIT_ID: DepositId = 1; + let global_farm_id = CHARLIE_FARM; + assert_eq!( + LiquidityMining::deposit(DEPOSIT_ID).unwrap(), + DepositData { + shares: 50 * ONE, + amm_pool_id: ACA_KSM_AMM, + yield_farm_entries: vec![YieldFarmEntry { + global_farm_id, + yield_farm_id: CHARLIE_ACA_KSM_YIELD_FARM_ID, + accumulated_rpvs: Zero::zero(), + accumulated_claimed_rewards: 0, + entered_at: 18, + updated_at: 18, + valued_shares: 2_500 * ONE, + stopped_at_creation: Zero::zero(), + _phantom: PhantomData, + }] + .try_into() + .unwrap(), + }, + ); + + set_block_number(2_596); //period 25 + + let expected_deposit_destroyed = true; + assert_eq!( + LiquidityMining::withdraw_lp_shares(DEPOSIT_ID, CHARLIE_ACA_KSM_YIELD_FARM_ID, 0).unwrap(), + (CHARLIE_FARM, deposited_amount, expected_deposit_destroyed) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn withdraw_with_multiple_entries_and_flush_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + let alice_bsx_tkn1_lp_shares_balance = Tokens::free_balance(BSX_TKN1_SHARE_ID, &ALICE); + + //Redeposit to multiple yield farms. + assert_ok!(LiquidityMining::redeposit_lp_shares( + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + PREDEFINED_DEPOSIT_IDS[0], + |_, _, _| { Ok(10 * ONE) }, + )); + + assert_ok!(LiquidityMining::redeposit_lp_shares( + EVE_FARM, + EVE_BSX_TKN1_YIELD_FARM_ID, + PREDEFINED_DEPOSIT_IDS[0], + |_, _, _| { Ok(10 * ONE) }, + )); + //NOTE: predefined_deposit_ids[0] is deposited in 3 yield farms now. + + //Stop yield farm. + assert_ok!(LiquidityMining::stop_yield_farm(EVE, EVE_FARM, BSX_TKN1_AMM)); + //Stop and destroy all yield farms so it can be flushed. + assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); + assert_ok!(LiquidityMining::terminate_yield_farm( + DAVE, + DAVE_FARM, + DAVE_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + assert_ok!(LiquidityMining::terminate_global_farm(DAVE, DAVE_FARM)); + + let unclaimable_rewards = 0; + let shares_amount = 50 * ONE; + let expected_deposit_destroyed = false; + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + unclaimable_rewards + ) + .unwrap(), + (GC_FARM, shares_amount, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]) + .unwrap() + .yield_farm_entries + .len(), + 2 + ); + + //LP tokens should not be unlocked. + assert_eq!( + Tokens::free_balance(BSX_TKN1_SHARE_ID, &ALICE), + alice_bsx_tkn1_lp_shares_balance + ); + + //This withdraw should flush yield and global farms. + let expected_deposit_destroyed = false; + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[0], + DAVE_BSX_TKN1_YIELD_FARM_ID, + unclaimable_rewards + ) + .unwrap(), + (DAVE_FARM, shares_amount, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]) + .unwrap() + .yield_farm_entries + .len(), + 1 + ); + + //LP tokens should not be unlocked. + assert_eq!( + Tokens::free_balance(BSX_TKN1_SHARE_ID, &ALICE), + alice_bsx_tkn1_lp_shares_balance + ); + + assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, DAVE_FARM, DAVE_BSX_TKN1_YIELD_FARM_ID)).is_none()); + assert!(LiquidityMining::global_farm(DAVE_FARM).is_none()); + + //Non-dustable check + let global_farm_account = LiquidityMining::farm_account_id(DAVE_FARM).unwrap(); + assert_eq!(Whitelist::contains(&global_farm_account), false); + + let yield_farm_account = LiquidityMining::farm_account_id(DAVE_BSX_TKN1_YIELD_FARM_ID).unwrap(); + assert_eq!(Whitelist::contains(&yield_farm_account), false); + + //This withdraw should flush yield and global farms. + let expected_deposit_destroyed = true; + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[0], + EVE_BSX_TKN1_YIELD_FARM_ID, + unclaimable_rewards + ) + .unwrap(), + (EVE_FARM, shares_amount, expected_deposit_destroyed) + ); + + //Last withdraw from deposit should flush deposit. + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).is_none()); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn withdraw_shares_from_destroyed_farm_should_work() { + //This is the case when yield farm is removed and global farm is destroyed. + //In this case only amm shares should be withdrawn. + + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + //Stop all yield farms in the global farm. + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN2_AMM)); + + //Remove all yield farms from global farm. + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN2_YIELD_FARM_ID, + BSX_TKN2_AMM + )); + + //Destroy farm. + assert_ok!(LiquidityMining::terminate_global_farm(GC, GC_FARM)); + + assert!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)) + .unwrap() + .state + .is_terminated() + ); + assert!( + LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)) + .unwrap() + .state + .is_terminated() + ); + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap().state, + FarmState::Terminated + ); + + let test_data = vec![ + ( + ALICE, + 0, + 50 * ONE, + 2_u64, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_SHARE_ID, + BSX_TKN1_AMM, + ), + ( + BOB, + 1, + 80 * ONE, + 1_u64, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_SHARE_ID, + BSX_TKN1_AMM, + ), + ( + BOB, + 2, + 25 * ONE, + 3_u64, + GC_BSX_TKN2_YIELD_FARM_ID, + BSX_TKN2_SHARE_ID, + BSX_TKN2_AMM, + ), + ( + BOB, + 3, + 800 * ONE, + 2_u64, + GC_BSX_TKN2_YIELD_FARM_ID, + BSX_TKN2_SHARE_ID, + BSX_TKN2_AMM, + ), + ( + ALICE, + 4, + 87 * ONE, + 1_u64, + GC_BSX_TKN2_YIELD_FARM_ID, + BSX_TKN2_SHARE_ID, + BSX_TKN2_AMM, + ), + ( + ALICE, + 5, + 48 * ONE, + 0_u64, + GC_BSX_TKN2_YIELD_FARM_ID, + BSX_TKN2_SHARE_ID, + BSX_TKN2_AMM, + ), + ( + ALICE, + 6, + 486 * ONE, + 0_u64, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_SHARE_ID, + BSX_TKN1_AMM, + ), + ]; + + for (_caller, deposit_idx, withdrawn_shares, _farm_entries_left, yield_farm_id, _lp_token, _amm_pool_id) in + test_data + { + let expected_deposit_destroyed = true; + assert_eq!( + LiquidityMining::withdraw_lp_shares(PREDEFINED_DEPOSIT_IDS[deposit_idx], yield_farm_id, 0,) + .unwrap(), + (GC_FARM, withdrawn_shares, expected_deposit_destroyed) + ); + + //check if deposit was removed. + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[deposit_idx]).is_none()); + } + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn withdraw_shares_from_canceled_yield_farm_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + set_block_number(10_000); + + // Stop yield farm before withdraw test. + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + let pot = LiquidityMining::pot_account_id().unwrap(); + + //1-th withdraw + //_0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(BSX, &global_farm_account); + let pot_balance_0 = Tokens::free_balance(BSX, &pot); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + + let unclaimable_rewards = 168_270 * ONE; + let withdrawn_amount = 50 * ONE; + let expected_deposit_destroyed = true; + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + unclaimable_rewards + ) + .unwrap(), + (GC_FARM, withdrawn_amount, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, + ..global_farm_0 + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + total_shares: yield_farm_0.total_shares - withdrawn_amount, + total_valued_shares: yield_farm_0.total_valued_shares - 2500 * ONE, + entries_count: 2, + left_to_distribute: yield_farm_0.left_to_distribute - unclaimable_rewards, + ..yield_farm_0 + } + ); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).is_none()); + + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert_eq!(Tokens::free_balance(BSX, &pot), pot_balance_0 - unclaimable_rewards); + + //2-nd withdraw + //_0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(BSX, &global_farm_account); + let pot_balance_0 = Tokens::free_balance(BSX, &pot); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + + let unclaimable_rewards = 2_055_086 * ONE; + let shares_amount = 486 * ONE; + let valued_shares_amount = 38_880 * ONE; + + let expected_deposit_destroyed = true; + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[6], + GC_BSX_TKN1_YIELD_FARM_ID, + unclaimable_rewards + ) + .unwrap(), + (GC_FARM, shares_amount, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, + ..global_farm_0 + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + total_shares: yield_farm_0.total_shares - shares_amount, + total_valued_shares: yield_farm_0.total_valued_shares - valued_shares_amount, + entries_count: 1, + left_to_distribute: yield_farm_0.left_to_distribute - unclaimable_rewards, + ..yield_farm_0 + } + ); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[6]).is_none()); + + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert_eq!(Tokens::free_balance(BSX, &pot), pot_balance_0 - unclaimable_rewards); + + //3-th withdraw + //_0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(BSX, &global_farm_account); + let pot_balance_0 = Tokens::free_balance(BSX, &pot); + let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); + let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + + let unclaimable_rewards = 228_572 * ONE; + let shares_amount = 80 * ONE; + + let expected_deposit_destroyed = true; + assert_eq!( + LiquidityMining::withdraw_lp_shares( + PREDEFINED_DEPOSIT_IDS[1], + GC_BSX_TKN1_YIELD_FARM_ID, + unclaimable_rewards + ) + .unwrap(), + (GC_FARM, shares_amount, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, + ..global_farm_0 + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + total_shares: 0, + total_valued_shares: 0, + entries_count: 0, + left_to_distribute: yield_farm_0.left_to_distribute - unclaimable_rewards, + ..yield_farm_0 + } + ); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[1]).is_none()); + + assert_eq!( + Tokens::free_balance(BSX, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert_eq!(Tokens::free_balance(BSX, &pot), pot_balance_0 - unclaimable_rewards); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn withdraw_shares_from_removed_pool_should_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + set_block_number(10_000); + + //Stop yield farm before removing. + assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); + + //Terminate yield farm before test + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + assert!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)) + .unwrap() + .state + .is_terminated(), + ); + + let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); + + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + let global_farm_bsx_balance = Tokens::free_balance(BSX, &global_farm_account); + let alice_bsx_balance = Tokens::free_balance(BSX, &ALICE); + + let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let shares_amount = 50 * ONE; + //1-th withdraw + let expected_deposit_destroyed = true; + assert_eq!( + LiquidityMining::withdraw_lp_shares(PREDEFINED_DEPOSIT_IDS[0], GC_BSX_TKN1_YIELD_FARM_ID, 0).unwrap(), + (GC_FARM, shares_amount, expected_deposit_destroyed) + ); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).is_none()); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + total_shares: 566 * ONE, + total_valued_shares: 43_040 * ONE, + entries_count: 2, + ..yield_farm + } + ); + + assert_eq!(LiquidityMining::global_farm(GC_FARM).unwrap(), global_farm); + + //Removed yield farm don't pay rewards, only transfers amm shares. + assert_eq!(Tokens::free_balance(BSX, &ALICE), alice_bsx_balance); + assert_eq!(Tokens::free_balance(BSX, &global_farm_account), global_farm_bsx_balance); + + //2-nd withdraw + let alice_bsx_balance = Tokens::free_balance(BSX, &ALICE); + let shares_amount = 486 * ONE; + + let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let expected_deposit_destroyed = true; + assert_eq!( + LiquidityMining::withdraw_lp_shares(PREDEFINED_DEPOSIT_IDS[6], GC_BSX_TKN1_YIELD_FARM_ID, 0,).unwrap(), + (GC_FARM, shares_amount, expected_deposit_destroyed) + ); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[6]).is_none()); + + assert_eq!(LiquidityMining::global_farm(GC_FARM).unwrap(), global_farm); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + total_shares: 80 * ONE, + total_valued_shares: 4_160 * ONE, + entries_count: 1, + ..yield_farm + } + ); + + //removed yield farm don't pay rewards, only return LP shares + assert_eq!(Tokens::free_balance(BSX, &ALICE), alice_bsx_balance); + assert_eq!(Tokens::free_balance(BSX, &global_farm_account), global_farm_bsx_balance); + + //3-th withdraw + let bob_bsx_balance = Tokens::free_balance(BSX, &BOB); + let shares_amount = 80 * ONE; + + let expected_deposit_destroyed = true; + assert_eq!( + LiquidityMining::withdraw_lp_shares(PREDEFINED_DEPOSIT_IDS[1], GC_BSX_TKN1_YIELD_FARM_ID, 0).unwrap(), + (GC_FARM, shares_amount, expected_deposit_destroyed) + ); + + //Last withdraw should flush yield farm if it's deleted + assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).is_none()); + + assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[1]).is_none()); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + //counts changed because last deposit removed deleted yield farm from storage + live_yield_farms_count: 1, + total_yield_farms_count: 1, + ..global_farm + } + ); + + //Removed yield farm don't pay rewards, only return LP shares. + assert_eq!(Tokens::free_balance(BSX, &BOB), bob_bsx_balance); + assert_eq!(Tokens::free_balance(BSX, &global_farm_account), global_farm_bsx_balance); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn withdraw_shares_yield_farm_entry_not_found_should_not_work() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const DEPOSIT_ID: DepositId = 1; + const NOT_FOUND_ENTRY_ID: YieldFarmId = 999_999; + assert_noop!( + LiquidityMining::withdraw_lp_shares(DEPOSIT_ID, NOT_FOUND_ENTRY_ID, 0), + Error::::YieldFarmEntryNotFound + ); + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] +fn withdraw_shares_should_fail_when_deposit_not_found() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + assert_noop!( + LiquidityMining::withdraw_lp_shares(72_334_321_125_861_359_621, GC_BSX_TKN1_YIELD_FARM_ID, 0), + Error::::InconsistentState(InconsistentStateError::DepositNotFound) + ); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn trait_withdraw_lp_shares_should_claim_and_withdraw_when_yield_farm_is_claimable() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const REWARD_CURRENCY: u32 = BSX; + + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + + let pot = LiquidityMining::pot_account_id().unwrap(); + let pot_initial_balance = 1_000_000_000 * ONE; + + // This balance is used to transfer unclaimable_rewards from yield farm to global farm. + // Claiming is not part of withdraw_shares() so some balance need to be set. + Tokens::set_balance(Origin::root(), pot, REWARD_CURRENCY, pot_initial_balance, 0).unwrap(); + + // withdraw 1A + // _0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + let bsx_tkn1_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + + let withdrawn_amount = 50 * ONE; + let expected_deposit_destroyed = true; + let expected_claimed_amount = 23_306_074_766_355_140_u128; + let unclaimable_rewards = 20_443_925_233_644_860_u128; + let expected_claim_data = Some((REWARD_CURRENCY, expected_claimed_amount, unclaimable_rewards)); + + assert_eq!( + >>::withdraw_lp_shares( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + ) + .unwrap(), + (withdrawn_amount, expected_claim_data, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 25, + reward_currency: BSX, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares_z: 691_490 * ONE, + pending_rewards: 0, + accumulated_paid_rewards: 1_283_550 * ONE - unclaimable_rewards, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 566 * ONE, + total_valued_shares: 43_040 * ONE, + entries_count: 2, + left_to_distribute: bsx_tkn1_yield_farm_0.left_to_distribute + - unclaimable_rewards - expected_claimed_amount, + ..bsx_tkn1_yield_farm_0 + }, + ); + + //Unclaimabe rewards was transferred from pot to global-farm's account and claimed + //amount was transferred to user. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &pot), + pot_balance_0 - unclaimable_rewards - expected_claimed_amount + ); + + //Global farm balance checks. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert_eq!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]), None); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn trait_withdraw_lp_shares_should_only_withdraw_when_yield_farm_is_not_claimable() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const REWARD_CURRENCY: u32 = BSX; + const GLOBAL_FARM_ID: GlobalFarmId = GC_FARM; + + //destroy yield-farm + assert_ok!(LiquidityMining::stop_yield_farm(GC, GLOBAL_FARM_ID, BSX_TKN1_AMM)); + assert_ok!(LiquidityMining::terminate_yield_farm( + GC, + GLOBAL_FARM_ID, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM + )); + + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + + let pot = LiquidityMining::pot_account_id().unwrap(); + let pot_initial_balance = 1_000_000_000 * ONE; + + // This balance is used to transfer unclaimable_rewards from yield farm to global farm. + // Claiming is not part of withdraw_shares() so some balance need to be set. + Tokens::set_balance(Origin::root(), pot, REWARD_CURRENCY, pot_initial_balance, 0).unwrap(); + + // withdraw 1A + // _0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + let bsx_tkn1_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let global_farm_0 = LiquidityMining::global_farm(GLOBAL_FARM_ID).unwrap(); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + + let withdrawn_amount = 50 * ONE; + let expected_deposit_destroyed = true; + let expected_claim_data = None; //claim from terminated farm should not happen + + assert_eq!( + >>::withdraw_lp_shares( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + ) + .unwrap(), + (withdrawn_amount, expected_claim_data, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 25, + reward_currency: BSX, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + pending_rewards: 0, + ..global_farm_0 + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + total_shares: 566 * ONE, + total_valued_shares: 43_040 * ONE, + entries_count: 2, + ..bsx_tkn1_yield_farm_0 + } + ); + + //Nothing was claimed from pot becasue yield-farm is terminated so balance should not + //change + assert_eq!(Tokens::free_balance(REWARD_CURRENCY, &pot), pot_balance_0); + + //Global farm balance should not change becasue no rewards were transferred. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), + global_farm_balance_0 + ); + + assert_eq!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]), None); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} + +#[test] +fn trait_withdraw_lp_shares_should_claim_zero_when_user_already_claimed_rewards() { + predefined_test_ext_with_deposits().execute_with(|| { + let _ = with_transaction(|| { + const REWARD_CURRENCY: u32 = BSX; + + let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); + + let pot = LiquidityMining::pot_account_id().unwrap(); + let pot_initial_balance = 1_000_000_000 * ONE; + + let fail_on_doubleclaim = true; + assert_ok!(LiquidityMining::claim_rewards( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_BSX_TKN1_YIELD_FARM_ID, + fail_on_doubleclaim + )); + + // This balance is used to transfer unclaimable_rewards from yield farm to global farm. + // Claiming is not part of withdraw_shares() so some balance need to be set. + Tokens::set_balance(Origin::root(), pot, REWARD_CURRENCY, pot_initial_balance, 0).unwrap(); + + // withdraw 1A + // _0 - value before act. + let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); + let bsx_tkn1_yield_farm_0 = + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); + let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); + + let withdrawn_amount = 50 * ONE; + let expected_deposit_destroyed = true; + let expected_claimed_amount = 0_u128; + let unclaimable_rewards = 20_443_925_233_644_860_u128; + let expected_claim_data = Some((REWARD_CURRENCY, expected_claimed_amount, unclaimable_rewards)); + + assert_eq!( + >>::withdraw_lp_shares( + ALICE, + PREDEFINED_DEPOSIT_IDS[0], + GC_FARM, + GC_BSX_TKN1_YIELD_FARM_ID, + BSX_TKN1_AMM, + ) + .unwrap(), + (withdrawn_amount, expected_claim_data, expected_deposit_destroyed) + ); + + assert_eq!( + LiquidityMining::global_farm(GC_FARM).unwrap(), + GlobalFarmData { + updated_at: 25, + reward_currency: BSX, + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares_z: 691_490 * ONE, + pending_rewards: 0, + accumulated_paid_rewards: 1_283_550 * ONE - unclaimable_rewards, + ..get_predefined_global_farm_ins1(2) + } + ); + + assert_eq!( + LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), + YieldFarmData { + updated_at: 25, + accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), + accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), + total_shares: 566 * ONE, + total_valued_shares: 43_040 * ONE, + entries_count: 2, + left_to_distribute: bsx_tkn1_yield_farm_0.left_to_distribute + - unclaimable_rewards - expected_claimed_amount, + ..bsx_tkn1_yield_farm_0 + }, + ); + + //Unclaimabe rewards was transferred from pot to global-farm's account and claimed + //amount was transferred to user. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &pot), + pot_balance_0 - unclaimable_rewards - expected_claimed_amount + ); + + //Global farm balance checks. + assert_eq!( + Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), + global_farm_balance_0 + unclaimable_rewards + ); + + assert_eq!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]), None); + + TransactionOutcome::Commit(DispatchResult::Ok(())) + }); + }); +} diff --git a/pallets/liquidity-mining/src/types.rs b/pallets/liquidity-mining/src/types.rs new file mode 100644 index 00000000000..e4d11091d78 --- /dev/null +++ b/pallets/liquidity-mining/src/types.rs @@ -0,0 +1,429 @@ +// This file is part of galacticcouncil/warehouse. + +// 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 super::*; + +use hydradx_traits::liquidity_mining::PriceAdjustment; +pub use hydradx_traits::liquidity_mining::{DepositId, GlobalFarmId, YieldFarmId}; + +pub type FarmId = u32; +pub type Balance = u128; +pub type FarmMultiplier = FixedU128; + +/// Default implementation of `PriceAdjustment` trait which returns `price_adjustment` value saved +/// in `GlobalFarm`. +pub struct DefaultPriceAdjustment; + +impl, I: 'static> PriceAdjustment> for DefaultPriceAdjustment { + type Error = DispatchError; + + type PriceAdjustment = FixedU128; + + fn get(global_farm: &GlobalFarmData) -> Result { + Ok(global_farm.price_adjustment) + } +} + +/// This struct represents the state a of single liquidity mining program. `YieldFarm`s are rewarded from +/// `GlobalFarm` based on their stake in `GlobalFarm`. `YieldFarm` stake in `GlobalFarm` is derived from +/// users stake in `YieldFarm`. +/// Yield farm is considered live from global farm view if yield farm is `active` or `stopped`. +#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] +#[codec(mel_bound())] +#[scale_info(skip_type_params(T, I))] +pub struct GlobalFarmData, I: 'static = ()> { + pub id: GlobalFarmId, + pub(super) owner: T::AccountId, + pub(super) updated_at: PeriodOf, + pub(super) total_shares_z: Balance, + pub(super) accumulated_rpz: FixedU128, + pub reward_currency: T::AssetId, + pub(super) pending_rewards: Balance, + pub(super) accumulated_paid_rewards: Balance, + pub(super) yield_per_period: Perquintill, + pub(super) planned_yielding_periods: PeriodOf, + pub(super) blocks_per_period: BlockNumberFor, + pub incentivized_asset: T::AssetId, + pub(super) max_reward_per_period: Balance, + // min. LP shares user must deposit to start yield farming. + pub(super) min_deposit: Balance, + // This include `active` and `stopped` yield farms. + pub(super) live_yield_farms_count: u32, + // This include `active`, `stopped`, `terminated` - this count is decreased only if yield + // farm is removed from storage. + pub(super) total_yield_farms_count: u32, + pub(super) price_adjustment: FixedU128, + pub(super) state: FarmState, +} + +impl, I: 'static> GlobalFarmData { + #[allow(clippy::too_many_arguments)] + pub fn new( + id: GlobalFarmId, + updated_at: PeriodOf, + reward_currency: T::AssetId, + yield_per_period: Perquintill, + planned_yielding_periods: PeriodOf, + blocks_per_period: BlockNumberFor, + owner: T::AccountId, + incentivized_asset: T::AssetId, + max_reward_per_period: Balance, + min_deposit: Balance, + price_adjustment: FixedU128, + ) -> Self { + Self { + pending_rewards: Zero::zero(), + accumulated_rpz: Zero::zero(), + accumulated_paid_rewards: Zero::zero(), + total_shares_z: Zero::zero(), + live_yield_farms_count: Zero::zero(), + total_yield_farms_count: Zero::zero(), + id, + updated_at, + reward_currency, + yield_per_period, + planned_yielding_periods, + blocks_per_period, + owner, + incentivized_asset, + max_reward_per_period, + min_deposit, + price_adjustment, + state: FarmState::Active, + } + } + + /// This function updates yields_farm_count when new yield farm is added into the global farm. + /// This function should be called only when new yield farm is created/added into the global + /// farm. + pub fn increase_yield_farm_counts(&mut self) -> Result<(), ArithmeticError> { + self.live_yield_farms_count = self + .live_yield_farms_count + .checked_add(1) + .ok_or(ArithmeticError::Overflow)?; + + self.total_yield_farms_count = self + .total_yield_farms_count + .checked_add(1) + .ok_or(ArithmeticError::Overflow)?; + + Ok(()) + } + + /// This function updates `yield_farms_count` when yield farm is terminated from global farm. + /// This function should be called only when yield farm is removed from global farm. + pub fn decrease_live_yield_farm_count(&mut self) -> Result<(), Error> { + //NOTE: only live count should change + //NOTE: this counter is managed only by pallet so this sub should never fail. + self.live_yield_farms_count = self + .live_yield_farms_count + .checked_sub(1) + .defensive_ok_or::>(InconsistentStateError::InvalidLiveYielFarmsCount.into())?; + + Ok(()) + } + + /// This function updates `yield_farms_count` when yield farm is removed from storage. + /// This function should be called only if yield farm was removed from storage. + /// !!! DON'T call this function if yield farm is in stopped or terminated. + pub fn decrease_total_yield_farm_count(&mut self) -> Result<(), Error> { + //NOTE: this counter is managed only by pallet so this sub should never fail. + self.total_yield_farms_count = self + .total_yield_farms_count + .checked_sub(1) + .defensive_ok_or::>(InconsistentStateError::InvalidTotalYieldFarmsCount.into())?; + + Ok(()) + } + + /// Function returns `true` if global farm has live yield farms. + pub fn has_live_farms(&self) -> bool { + !self.live_yield_farms_count.is_zero() + } + + /// Function return `true` if global farm can be removed from storage. + pub fn can_be_removed(&self) -> bool { + //farm can be removed from storage only if all yield farms was removed from storage. + self.state == FarmState::Terminated && self.total_yield_farms_count.is_zero() + } + + /// This function returns `true` if farm has no capacity for next yield farm(yield farm can't + /// be added into global farm until some yield farm is removed from storage). + pub fn is_full(&self) -> bool { + self.total_yield_farms_count.ge(&::MaxYieldFarmsPerGlobalFarm::get()) + } + + /// Function adds `amount` to `total_shares_z`. + pub fn add_stake(&mut self, amount: Balance) -> Result<(), ArithmeticError> { + self.total_shares_z = self + .total_shares_z + .checked_add(amount) + .ok_or(ArithmeticError::Overflow)?; + + Ok(()) + } + + /// Function removes `amount` from `total_shares_z`. + pub fn remove_stake(&mut self, amount: Balance) -> Result<(), Error> { + //NOTE: This should never fail, we should never sub more than current state. + self.total_shares_z = self + .total_shares_z + .checked_sub(amount) + .defensive_ok_or::>(InconsistentStateError::InvalidTotalSharesZ.into())?; + + Ok(()) + } +} + +#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] +#[codec(mel_bound())] +#[scale_info(skip_type_params(T, I))] +pub struct YieldFarmData, I: 'static = ()> { + pub(super) id: FarmId, + pub(super) updated_at: PeriodOf, + pub(super) total_shares: Balance, + pub(super) total_valued_shares: Balance, + pub(super) accumulated_rpvs: FixedU128, + pub(super) accumulated_rpz: FixedU128, + pub(super) loyalty_curve: Option, + pub(super) multiplier: FarmMultiplier, + pub(super) state: FarmState, + pub(super) entries_count: u64, + pub(super) left_to_distribute: Balance, + pub(super) total_stopped: PeriodOf, + pub(super) _phantom: PhantomData, +} + +impl, I: 'static> YieldFarmData { + #[allow(clippy::too_many_arguments)] + pub fn new( + id: FarmId, + updated_at: PeriodOf, + loyalty_curve: Option, + multiplier: FarmMultiplier, + ) -> Self { + Self { + id, + updated_at, + loyalty_curve, + multiplier, + accumulated_rpvs: Zero::zero(), + accumulated_rpz: Zero::zero(), + total_shares: Zero::zero(), + total_valued_shares: Zero::zero(), + state: FarmState::Active, + entries_count: Default::default(), + left_to_distribute: Default::default(), + total_stopped: Default::default(), + _phantom: PhantomData, + } + } + + /// Returns `true` if yield farm can be removed from storage, `false` otherwise. + pub fn can_be_removed(&self) -> bool { + self.state == FarmState::Terminated && self.entries_count.is_zero() + } + + /// This function updates entries count in the yield farm. This function should be called if + /// entry is removed from the yield farm. + pub fn decrease_entries_count(&mut self) -> Result<(), Error> { + //NOTE: this counter is managed only by pallet so this sub should never fail. + self.entries_count = self + .entries_count + .checked_sub(1) + .defensive_ok_or::>(InconsistentStateError::InvalidYieldFarmEntriesCount.into())?; + + Ok(()) + } + + /// This function updates entries count in the yield farm. This function should be called if + /// entry is added into the yield farm. + pub fn increase_entries_count(&mut self) -> Result<(), ArithmeticError> { + self.entries_count = self.entries_count.checked_add(1).ok_or(ArithmeticError::Overflow)?; + + Ok(()) + } + + /// This function return `true` if deposit exists in the yield farm. + pub fn has_entries(&self) -> bool { + !self.entries_count.is_zero() + } +} + +/// Loyalty curve to calculate loyalty multiplier. +/// +/// `t = t_now - t_added` +/// `num = t + initial_reward_percentage * scale_coef` +/// `denom = t + scale_coef` +/// +/// `loyalty_multiplier = num/denom` +#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] +#[scale_info(skip_type_params(T, I))] +pub struct LoyaltyCurve { + pub initial_reward_percentage: FixedU128, + pub scale_coef: u32, +} + +impl Default for LoyaltyCurve { + fn default() -> Self { + Self { + initial_reward_percentage: FixedU128::from_inner(500_000_000_000_000_000), // 0.5 + scale_coef: 100, + } + } +} + +/// Deposit represents a group of locked LP shares in the liquidity mining program("Position"). +/// LP shares in the deposit can be locked in one or more yield farms based on pallet's +/// configuration(`MaxEntriesPerDeposit`). +/// The LP token's lock in the deposit is called "farm entry". Farm entry entitles deposit +/// owner to accumulate rewards from the yield farm. +/// Every deposit should have at least one farm entry and deposit without farm entries +/// should be removed from storage and LP shares should be unlocked. +/// `redeposit_lp_shares()` is used to add a new farm entry into the deposit("re-lock" LP shares"). +#[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq, Eq, MaxEncodedLen)] +#[codec(mel_bound())] +#[scale_info(skip_type_params(T, I))] +pub struct DepositData, I: 'static = ()> { + pub(super) shares: Balance, + pub(super) amm_pool_id: T::AmmPoolId, + // NOTE: `MaxFarmEntriesPerDeposit` of this vector MUST BE at least 1 for the configuration to + // be sensible. + pub(super) yield_farm_entries: BoundedVec, T::MaxFarmEntriesPerDeposit>, +} + +impl, I: 'static> DepositData { + pub fn new(shares: Balance, amm_pool_id: T::AmmPoolId) -> Self { + Self { + shares, + amm_pool_id, + yield_farm_entries: BoundedVec::default(), + } + } + + /// This function add new yield farm entry into the deposit. + /// This function returns error if deposit reached max entries in the deposit or + /// `entry.yield_farm_id` is not unique. + pub fn add_yield_farm_entry(&mut self, entry: YieldFarmEntry) -> Result<(), DispatchError> { + if self.search_yield_farm_entry(entry.yield_farm_id).is_some() { + return Err(Error::::DoubleLock.into()); + } + + self.yield_farm_entries + .try_push(entry) + .map_err(|_| Error::::MaxEntriesPerDeposit)?; + + Ok(()) + } + + /// This function remove yield farm entry from the deposit. This function returns error if + /// yield farm entry in not found in the deposit. + pub fn remove_yield_farm_entry(&mut self, yield_farm_id: YieldFarmId) -> Result, Error> { + if let Some(idx) = self.search_yield_farm_entry(yield_farm_id) { + return Ok(self.yield_farm_entries.swap_remove(idx)); + } + + Err(Error::::YieldFarmEntryNotFound) + } + + /// This function return yield farm entry from deposit of `None` if yield farm entry is not + /// found. + pub fn get_yield_farm_entry(&mut self, yield_farm_id: YieldFarmId) -> Option<&mut YieldFarmEntry> { + if let Some(idx) = self.search_yield_farm_entry(yield_farm_id) { + return self.yield_farm_entries.get_mut(idx); + } + + None + } + + /// This function returns its index if deposit contains yield farm entry with given yield farm id. + pub fn search_yield_farm_entry(&self, yield_farm_id: YieldFarmId) -> Option { + self.yield_farm_entries + .iter() + .position(|e| e.yield_farm_id == yield_farm_id) + } + + /// This function returns `true` if deposit can be removed from storage. + pub fn can_be_removed(&self) -> bool { + //NOTE: deposit with no entries should/must be removed from storage + self.yield_farm_entries.is_empty() + } +} + +#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] +#[codec(mel_bound())] +#[scale_info(skip_type_params(T, I))] +pub struct YieldFarmEntry, I: 'static = ()> { + pub(super) global_farm_id: GlobalFarmId, + pub(super) yield_farm_id: YieldFarmId, + pub(super) valued_shares: Balance, + pub(super) accumulated_rpvs: FixedU128, + pub(super) accumulated_claimed_rewards: Balance, + pub(super) entered_at: PeriodOf, + pub(super) updated_at: PeriodOf, + // Number of periods yield-farm experienced before creation of this entry. + pub(super) stopped_at_creation: PeriodOf, + pub(super) _phantom: PhantomData, +} + +impl, I: 'static> YieldFarmEntry { + pub fn new( + global_farm_id: GlobalFarmId, + yield_farm_id: YieldFarmId, + valued_shares: Balance, + accumulated_rpvs: FixedU128, + entered_at: PeriodOf, + stopped_at_creation: PeriodOf, + ) -> Self { + Self { + global_farm_id, + yield_farm_id, + valued_shares, + accumulated_rpvs, + accumulated_claimed_rewards: Zero::zero(), + entered_at, + updated_at: entered_at, + stopped_at_creation, + _phantom: PhantomData, + } + } +} + +/// An enum whose variants represent the state of the yield or global farm. +/// - `Active` - farm has full functionality. This state may be used for both farm types. +/// - `Stopped` - only partial functionality of the farm is available to users. Farm can became +/// `Active` again or can be `Terminated`. This state can be used only for yield farms. +/// - `Terminated` - farm is destroyed and it's waiting to be removed from the storage. This state can't be +/// reverted and is available for both farm types. +#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] +pub enum FarmState { + Active, + Stopped, + Terminated, +} + +impl FarmState { + pub fn is_active(&self) -> bool { + *self == FarmState::Active + } + pub fn is_stopped(&self) -> bool { + *self == FarmState::Stopped + } + pub fn is_terminated(&self) -> bool { + *self == FarmState::Terminated + } +} diff --git a/runtime/basilisk/Cargo.toml b/runtime/basilisk/Cargo.toml index c2b07628f6e..aed7e7dd894 100644 --- a/runtime/basilisk/Cargo.toml +++ b/runtime/basilisk/Cargo.toml @@ -88,6 +88,7 @@ xcm-builder = { workspace = true } pallet-xcm = { workspace = true } xcm-executor = { workspace = true } polkadot-xcm = { workspace = true } +polkadot-runtime-common= { workspace = true } # Substrate dependencies primitive-types = { workspace = true } @@ -245,6 +246,7 @@ std = [ "cumulus-primitives-utility/std", "parachains-common/std", "pallet-message-queue/std", + "polkadot-runtime-common/std", ] try-runtime= [ "frame-try-runtime", diff --git a/runtime/basilisk/src/assets.rs b/runtime/basilisk/src/assets.rs index c3413dd6802..0638510fa82 100644 --- a/runtime/basilisk/src/assets.rs +++ b/runtime/basilisk/src/assets.rs @@ -92,8 +92,8 @@ impl pallet_balances::Config for Runtime { type ReserveIdentifier = (); type FreezeIdentifier = (); type MaxFreezes = (); - type RuntimeHoldReason = (); - type RuntimeFreezeReason = (); + type RuntimeHoldReason = RuntimeHoldReason; + type RuntimeFreezeReason = RuntimeFreezeReason; } pub struct CurrencyHooks; diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index abcdc7b1214..fdb346a6adc 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -39,8 +39,9 @@ use pallet_transaction_multi_payment::DepositAll; use pallet_xcm::XcmPassthrough; use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; use polkadot_parachain::primitives::{RelayChainBlockNumber, Sibling}; -use polkadot_xcm::latest::Asset; -use polkadot_xcm::v3::{prelude::*, MultiLocation, Weight as XcmWeight}; +use polkadot_xcm::latest::{Asset, Location}; +use polkadot_xcm::prelude::{InteriorLocation}; +use polkadot_xcm::v3::{prelude::{X1, X2, X3, GeneralIndex, Parachain, GlobalConsensus, NetworkId, Here, Concrete, AccountId32}, MultiAsset, MultiLocation, Weight as XcmWeight}; use primitives::AssetId; use scale_info::TypeInfo; use sp_runtime::Perbill; @@ -82,7 +83,7 @@ pub type Barrier = ( ); parameter_types! { - pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into()))); + pub SelfLocation: Location = Location::here(); } parameter_types! { @@ -119,7 +120,7 @@ parameter_types! { pub const BaseXcmWeight: XcmWeight = XcmWeight::from_parts(100_000_000, 0); pub const MaxInstructions: u32 = 100; pub const MaxAssetsForTransfer: usize = 2; - pub UniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())); + pub UniversalLocation: InteriorLocation = [polkadot_xcm::v4::prelude::GlobalConsensus(RelayNetwork::get().into()), polkadot_xcm::v4::prelude::Parachain(ParachainInfo::parachain_id().into())].into(); } pub struct XcmConfig; @@ -163,6 +164,7 @@ impl Config for XcmConfig { type CallDispatcher = RuntimeCall; type SafeCallFilter = SafeCallFilter; type Aliasers = Nothing; + type TransactionalProcessor = xcm_builder::FrameTransactionalProcessor; } impl cumulus_pallet_xcm::Config for Runtime { @@ -183,7 +185,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type VersionWrapper = PolkadotXcm; type ControllerOrigin = MajorityTechCommitteeOrRoot; type ControllerOriginConverter = XcmOriginToCallOrigin; - type PriceForSiblingDelivery = (); + type PriceForSiblingDelivery = polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery; type WeightInfo = weights::xcmp_queue::BasiliskWeight; type XcmpQueue = TransformOrigin; type MaxInboundSuspended = MaxInboundSuspended; @@ -196,7 +198,7 @@ impl cumulus_pallet_dmp_queue::Config for Runtime { } parameter_type_with_key! { - pub ParachainMinFee: |_location: MultiLocation| -> Option { + pub ParachainMinFee: |_location: Location| -> Option { None }; } @@ -368,6 +370,15 @@ impl Convert for AccountIdToMultiLocation { .into() } } +impl Convert for AccountIdToMultiLocation { + fn convert(account: AccountId) -> Location { + [polkadot_xcm::prelude::AccountId32 { + network: None, + id: account.into(), + }] + .into() + } +} impl Convert> for CurrencyIdConvert { @@ -383,7 +394,7 @@ impl Convert> for CurrencyIdConv Some(CORE_ASSET_ID) } polkadot_xcm::latest::Junctions::X1(a) if parents == 0 && a.contains(&polkadot_xcm::prelude::GeneralIndex(CORE_ASSET_ID.into())) => Some(CORE_ASSET_ID), - _ => AssetRegistry::location_to_asset(AssetLocation(location)), + _ => AssetRegistry::location_to_asset(AssetLocation(location.into())), } // Note: keeping the original code for reference until tests are successful @@ -419,6 +430,18 @@ impl Convert> for CurrencyIdConvert { } } +impl Convert> for CurrencyIdConvert { + fn convert(id: AssetId) -> Option { + match id { + CORE_ASSET_ID => Some(Location { + parents: 1, + interior: [polkadot_xcm::prelude::Parachain(ParachainInfo::get().into()), polkadot_xcm::prelude::GeneralIndex(id.into())].into(), + }), + _ => AssetRegistry::asset_to_location(id).map(|loc| loc.0.into()), + } + } +} + /// The means for routing XCM messages which are not for local execution into the right message /// queues. pub type XcmRouter = ( From 610cff495ed0b19870468b1fc47548dc99fd13f6 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 15 Apr 2024 12:06:45 +0200 Subject: [PATCH 06/56] pallets configs --- Cargo.lock | 223 +++++++++--------- pallets/asset-registry/src/lib.rs | 10 +- .../src/weights/collator_selection.rs | 2 +- runtime/basilisk/src/xcm.rs | 141 ++++++----- 4 files changed, 201 insertions(+), 175 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 71d55c8f996..d9dac7c7696 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -214,7 +214,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -595,9 +595,9 @@ dependencies = [ [[package]] name = "async-channel" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" +checksum = "136d4d23bcc79e27423727b36823d86233aad06dfea531837b038394d11e9928" dependencies = [ "concurrent-queue", "event-listener 5.3.0", @@ -608,11 +608,10 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f98c37cf288e302c16ef6c8472aad1e034c6c84ce5ea7b8101c98eb4a802fee" +checksum = "b10202063978b3351199d68f8b22c4e47e4b1b822f8d43fd862d5ea8c006b29a" dependencies = [ - "async-lock 3.3.0", "async-task", "concurrent-queue", "fastrand 2.0.2", @@ -751,7 +750,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -787,7 +786,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -1094,13 +1093,13 @@ dependencies = [ "lazy_static", "lazycell", "peeking_take_while", - "prettyplease 0.2.17", + "prettyplease 0.2.19", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -1252,7 +1251,7 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ - "async-channel 2.2.0", + "async-channel 2.2.1", "async-lock 3.3.0", "async-task", "fastrand 2.0.2", @@ -1431,9 +1430,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" +checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" dependencies = [ "jobserver", "libc", @@ -1602,7 +1601,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2315,7 +2314,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2623,7 +2622,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2663,7 +2662,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2680,7 +2679,7 @@ checksum = "ad08a837629ad949b73d032c637653d069e909cffe4ee7870b02301939ce39cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2772,7 +2771,7 @@ checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2880,7 +2879,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2920,7 +2919,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.58", + "syn 2.0.59", "termcolor", "toml 0.8.12", "walkdir", @@ -3041,9 +3040,9 @@ dependencies = [ [[package]] name = "either" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "elliptic-curve" @@ -3099,7 +3098,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3110,7 +3109,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3342,7 +3341,7 @@ dependencies = [ "prettier-please", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3664,7 +3663,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3793,7 +3792,7 @@ dependencies = [ "proc-macro2", "quote", "sp-crypto-hashing", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3805,7 +3804,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3815,7 +3814,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3994,7 +3993,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -4418,7 +4417,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hydra-dx-build-script-utils" version = "1.0.3" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "cargo-lock", "platforms 1.1.0", @@ -4427,7 +4426,7 @@ dependencies = [ [[package]] name = "hydra-dx-math" version = "8.0.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "fixed", "num-traits", @@ -4442,7 +4441,7 @@ dependencies = [ [[package]] name = "hydradx-adapters" version = "1.3.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -4490,7 +4489,7 @@ dependencies = [ [[package]] name = "hydradx-traits" version = "3.2.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -5806,7 +5805,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -5820,7 +5819,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -5831,7 +5830,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -5842,7 +5841,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -6495,7 +6494,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -6824,7 +6823,7 @@ dependencies = [ [[package]] name = "pallet-asset-registry" version = "3.2.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-benchmarking", "frame-support", @@ -7035,7 +7034,7 @@ dependencies = [ [[package]] name = "pallet-bonds" version = "2.2.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-benchmarking", "frame-support", @@ -7111,7 +7110,7 @@ dependencies = [ [[package]] name = "pallet-circuit-breaker" version = "1.1.21" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "frame-system", @@ -7127,7 +7126,7 @@ dependencies = [ [[package]] name = "pallet-collator-rewards" version = "1.0.6" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "frame-system", @@ -7199,7 +7198,7 @@ dependencies = [ [[package]] name = "pallet-currencies" version = "2.1.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "frame-system", @@ -7216,7 +7215,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.1.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "frame-system", @@ -7250,7 +7249,7 @@ dependencies = [ [[package]] name = "pallet-duster" version = "3.2.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-benchmarking", "frame-support", @@ -7269,7 +7268,7 @@ dependencies = [ [[package]] name = "pallet-dynamic-fees" version = "1.0.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "frame-system", @@ -7341,7 +7340,7 @@ dependencies = [ [[package]] name = "pallet-ema-oracle" version = "1.3.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-benchmarking", "frame-support", @@ -7483,7 +7482,7 @@ dependencies = [ [[package]] name = "pallet-lbp" version = "4.7.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-benchmarking", "frame-support", @@ -7531,7 +7530,7 @@ dependencies = [ [[package]] name = "pallet-liquidity-mining" version = "4.3.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "frame-system", @@ -7641,7 +7640,7 @@ dependencies = [ [[package]] name = "pallet-nft" version = "7.1.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-benchmarking", "frame-support", @@ -7767,7 +7766,7 @@ dependencies = [ [[package]] name = "pallet-omnipool" version = "4.1.5" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "bitflags 1.3.2", "frame-benchmarking", @@ -7791,7 +7790,7 @@ dependencies = [ [[package]] name = "pallet-omnipool-liquidity-mining" version = "2.1.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "frame-system", @@ -7901,7 +7900,7 @@ dependencies = [ [[package]] name = "pallet-referrals" version = "1.2.3" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "frame-system", @@ -7919,7 +7918,7 @@ dependencies = [ [[package]] name = "pallet-relaychain-info" version = "0.3.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -7949,7 +7948,7 @@ dependencies = [ [[package]] name = "pallet-route-executor" version = "2.2.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "frame-system", @@ -8041,7 +8040,7 @@ dependencies = [ [[package]] name = "pallet-stableswap" version = "3.5.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "bitflags 1.3.2", "frame-support", @@ -8060,7 +8059,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "frame-system", @@ -8107,7 +8106,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -8204,7 +8203,7 @@ dependencies = [ [[package]] name = "pallet-transaction-multi-payment" version = "9.5.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "frame-system", @@ -8226,7 +8225,7 @@ dependencies = [ [[package]] name = "pallet-transaction-pause" version = "1.0.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-benchmarking", "frame-support", @@ -8711,7 +8710,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -8752,7 +8751,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -9906,7 +9905,7 @@ dependencies = [ "polkavm-common", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -9916,7 +9915,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ba81f7b5faac81e528eb6158a6f3c9e0bb1008e0ffa19653bc8dea925ecb429" dependencies = [ "polkavm-derive-impl", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -10028,7 +10027,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22020dfcf177fcc7bf5deaf7440af371400c67c0de14c399938d8ed4fb4645d3" dependencies = [ "proc-macro2", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -10053,12 +10052,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" +checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550" dependencies = [ "proc-macro2", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -10078,7 +10077,7 @@ dependencies = [ [[package]] name = "primitives" version = "6.0.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-support", "hex-literal 0.3.4", @@ -10185,14 +10184,14 @@ checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ "unicode-ident", ] @@ -10231,7 +10230,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -10319,7 +10318,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -10585,7 +10584,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -11305,7 +11304,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -12279,7 +12278,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -12566,7 +12565,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -12946,7 +12945,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -13186,7 +13185,7 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" +source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -13223,7 +13222,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "quote", "sp-crypto-hashing", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -13242,17 +13241,17 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" +source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -13269,7 +13268,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" +source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" dependencies = [ "environmental", "parity-scale-codec", @@ -13487,7 +13486,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" +source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -13513,20 +13512,20 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" +source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" dependencies = [ "Inflector", "expander 2.1.0", "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -13612,7 +13611,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" +source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" [[package]] name = "sp-storage" @@ -13630,7 +13629,7 @@ dependencies = [ [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" +source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13667,7 +13666,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" +source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" dependencies = [ "parity-scale-codec", "tracing", @@ -13748,7 +13747,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -13767,7 +13766,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#c963dc283af77824ceeeecc20e205f3a17968746" +source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" dependencies = [ "impl-trait-for-tuples", "log", @@ -14009,7 +14008,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -14140,9 +14139,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.58" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ "proc-macro2", "quote", @@ -14249,7 +14248,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -14260,14 +14259,14 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", "test-case-core", ] [[package]] name = "test-utils" version = "1.1.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#886520874528213bdcea7cd506b12af540e4b042" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-system", "pretty_assertions", @@ -14299,7 +14298,7 @@ checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -14310,7 +14309,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -14454,7 +14453,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -14660,7 +14659,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -14703,7 +14702,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -15144,7 +15143,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", "wasm-bindgen-shared", ] @@ -15178,7 +15177,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -16061,7 +16060,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -16110,7 +16109,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -16130,7 +16129,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] diff --git a/pallets/asset-registry/src/lib.rs b/pallets/asset-registry/src/lib.rs index fdfddceb43b..e8501238d9e 100644 --- a/pallets/asset-registry/src/lib.rs +++ b/pallets/asset-registry/src/lib.rs @@ -34,9 +34,9 @@ mod tests; mod benchmarking; pub mod migration; +pub mod traits; mod types; pub mod weights; -pub mod traits; use weights::WeightInfo; @@ -47,8 +47,8 @@ pub use pallet::*; pub use crate::types::{AssetDetails, AssetMetadata}; use frame_support::BoundedVec; -use traits::{CreateRegistry, InspectRegistry, Registry, ShareTokenRegistry}; use hydradx_traits::{AssetKind, Inspect}; +use traits::{CreateRegistry, InspectRegistry, Registry, ShareTokenRegistry}; #[frame_support::pallet] pub mod pallet { @@ -658,7 +658,7 @@ impl> Inspect for Pallet { type AssetId = T::AssetId; type Location = T::AssetNativeLocation; - fn is_sufficient(id: Self::AssetId) -> bool { + fn is_sufficient(_id: Self::AssetId) -> bool { true } @@ -674,7 +674,7 @@ impl> Inspect for Pallet { Self::assets(id).map(|a| a.asset_type.into()) } - fn is_banned(id: Self::AssetId) -> bool { + fn is_banned(_id: Self::AssetId) -> bool { false } @@ -689,4 +689,4 @@ impl> Inspect for Pallet { fn existential_deposit(id: Self::AssetId) -> Option { Self::assets(id).map(|a| a.existential_deposit) } -} \ No newline at end of file +} diff --git a/runtime/basilisk/src/weights/collator_selection.rs b/runtime/basilisk/src/weights/collator_selection.rs index d0afd54b857..b0aa6a38cd1 100644 --- a/runtime/basilisk/src/weights/collator_selection.rs +++ b/runtime/basilisk/src/weights/collator_selection.rs @@ -121,7 +121,7 @@ impl WeightInfo for BasiliskWeight { } /// Storage: `CollatorSelection::CandidacyBond` (r:0 w:1) /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_candidacy_bond(_: u32, _:u32) -> Weight { + fn set_candidacy_bond(_: u32, _: u32) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index fdb346a6adc..0f982a22bbf 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -39,11 +39,15 @@ use pallet_transaction_multi_payment::DepositAll; use pallet_xcm::XcmPassthrough; use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; use polkadot_parachain::primitives::{RelayChainBlockNumber, Sibling}; -use polkadot_xcm::latest::{Asset, Location}; -use polkadot_xcm::prelude::{InteriorLocation}; -use polkadot_xcm::v3::{prelude::{X1, X2, X3, GeneralIndex, Parachain, GlobalConsensus, NetworkId, Here, Concrete, AccountId32}, MultiAsset, MultiLocation, Weight as XcmWeight}; +use polkadot_xcm::latest::{Asset, Junctions, Location}; +use polkadot_xcm::prelude::InteriorLocation; +use polkadot_xcm::v3::{ + prelude::{AccountId32, Concrete, GeneralIndex, GlobalConsensus, Here, NetworkId, Parachain, X1, X2, X3}, + MultiAsset, MultiLocation, Weight as XcmWeight, +}; use primitives::AssetId; use scale_info::TypeInfo; +use sp_runtime::traits::MaybeEquivalence; use sp_runtime::Perbill; use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, @@ -56,6 +60,21 @@ use xcm_executor::{Config, XcmExecutor}; #[derive(Debug, Default, Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)] pub struct AssetLocation(pub MultiLocation); +impl Into> for AssetLocation { + fn into(self) -> Option { + xcm_builder::V4V3LocationConverter::convert_back(&self.0) + } +} + +impl TryFrom for AssetLocation { + type Error = (); + + fn try_from(value: Location) -> Result { + let loc: MultiLocation = value.try_into()?; + Ok(AssetLocation(loc.into())) + } +} + pub const RELAY_CHAIN_ASSET_LOCATION: AssetLocation = AssetLocation(MultiLocation { parents: 1, interior: Here, @@ -314,46 +333,83 @@ impl pallet_message_queue::Config for Runtime { pub struct CurrencyIdConvert; use primitives::constants::chain::CORE_ASSET_ID; -impl Convert> for CurrencyIdConvert { - fn convert(id: AssetId) -> Option { +impl Convert> for CurrencyIdConvert { + fn convert(id: AssetId) -> Option { match id { - CORE_ASSET_ID => Some(MultiLocation::new( - 1, - X2(Parachain(ParachainInfo::get().into()), GeneralIndex(id.into())), - )), - _ => AssetRegistry::asset_to_location(id).map(|loc| loc.0), + CORE_ASSET_ID => Some(Location { + parents: 1, + interior: [ + polkadot_xcm::prelude::Parachain(ParachainInfo::get().into()), + polkadot_xcm::prelude::GeneralIndex(id.into()), + ] + .into(), + }), + _ => { + let loc = AssetRegistry::asset_to_location(id); + if let Some(location) = loc { + location.into() + } else { + None + } + } } } } -impl Convert> for CurrencyIdConvert { - fn convert(location: MultiLocation) -> Option { +impl Convert> for CurrencyIdConvert { + fn convert(location: Location) -> Option { + let Location { parents, interior } = location.clone(); + + match interior { + Junctions::X2(a) + if parents == 1 + && a.contains(&polkadot_xcm::prelude::GeneralIndex(CORE_ASSET_ID.into())) + && a.contains(&polkadot_xcm::prelude::Parachain(ParachainInfo::get().into())) => + { + Some(CORE_ASSET_ID) + } + Junctions::X1(a) + if parents == 0 && a.contains(&polkadot_xcm::prelude::GeneralIndex(CORE_ASSET_ID.into())) => + { + Some(CORE_ASSET_ID) + } + _ => { + let location: Option = location.try_into().ok(); + if let Some(location) = location { + AssetRegistry::location_to_asset(location) + } else { + None + } + } + } + + // Note: keeping the original code for reference until tests are successful + /* match location { - MultiLocation { - parents, - interior: X2(Parachain(id), GeneralIndex(index)), - } if parents == 1 && ParaId::from(id) == ParachainInfo::get() && (index as u32) == CORE_ASSET_ID => { + Location { + parents: p, + interior: [Parachain(id), GeneralIndex(index)].into(), + } if p == 1 && ParaId::from(id) == ParachainInfo::get() && (index as u32) == CORE_ASSET_ID => { // Handling native asset for this parachain Some(CORE_ASSET_ID) } // handle reanchor canonical location: https://github.com/paritytech/polkadot/pull/4470 - MultiLocation { + Location { parents: 0, - interior: X1(GeneralIndex(index)), + interior: [GeneralIndex(index)].into(), } if (index as u32) == CORE_ASSET_ID => Some(CORE_ASSET_ID), // delegate to asset-registry _ => AssetRegistry::location_to_asset(AssetLocation(location)), } + + */ } } -impl Convert> for CurrencyIdConvert { - fn convert(asset: MultiAsset) -> Option { - if let MultiAsset { - id: Concrete(location), .. - } = asset - { - Self::convert(location) +impl Convert> for CurrencyIdConvert { + fn convert(asset: Asset) -> Option { + if let Asset { id: asset_id, .. } = asset { + Self::convert(asset_id.0) } else { None } @@ -361,26 +417,17 @@ impl Convert> for CurrencyIdConvert { } pub struct AccountIdToMultiLocation; -impl Convert for AccountIdToMultiLocation { - fn convert(account: AccountId) -> MultiLocation { - X1(AccountId32 { - network: None, - id: account.into(), - }) - .into() - } -} impl Convert for AccountIdToMultiLocation { fn convert(account: AccountId) -> Location { [polkadot_xcm::prelude::AccountId32 { network: None, id: account.into(), }] - .into() + .into() } } - +/* impl Convert> for CurrencyIdConvert { fn convert(location: polkadot_xcm::latest::Location) -> Option { let polkadot_xcm::latest::Location { parents, interior } = location.clone(); @@ -420,27 +467,7 @@ impl Convert> for CurrencyIdConv } } -impl Convert> for CurrencyIdConvert { - fn convert(asset: Asset) -> Option { - if let Asset { id: asset_id, .. } = asset { - Self::convert(asset_id.0) - } else { - None - } - } -} - -impl Convert> for CurrencyIdConvert { - fn convert(id: AssetId) -> Option { - match id { - CORE_ASSET_ID => Some(Location { - parents: 1, - interior: [polkadot_xcm::prelude::Parachain(ParachainInfo::get().into()), polkadot_xcm::prelude::GeneralIndex(id.into())].into(), - }), - _ => AssetRegistry::asset_to_location(id).map(|loc| loc.0.into()), - } - } -} + */ /// The means for routing XCM messages which are not for local execution into the right message /// queues. From bf15ad851dbc3e1f12c62171344093aab8abf2e2 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 15 Apr 2024 12:43:52 +0200 Subject: [PATCH 07/56] update node --- Cargo.lock | 173 ++++++++--------------------------------- node/Cargo.toml | 2 +- node/src/chain_spec.rs | 9 ++- node/src/cli.rs | 2 +- node/src/command.rs | 46 ++++++++++- node/src/service.rs | 5 ++ 6 files changed, 87 insertions(+), 150 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d9dac7c7696..b5c945d3c61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -894,7 +894,7 @@ dependencies = [ "futures", "hex-literal 0.4.1", "hydra-dx-build-script-utils", - "jsonrpsee 0.16.3", + "jsonrpsee", "log", "pallet-transaction-payment-rpc", "pallet-transaction-payment-rpc-runtime-api", @@ -1308,16 +1308,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "bstr" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" -dependencies = [ - "memchr", - "serde", -] - [[package]] name = "build-helper" version = "0.1.1" @@ -2480,7 +2470,7 @@ dependencies = [ "async-trait", "cumulus-primitives-core", "futures", - "jsonrpsee-core 0.20.3", + "jsonrpsee-core", "parity-scale-codec", "polkadot-overseer", "sc-client-api", @@ -2542,7 +2532,7 @@ dependencies = [ "either", "futures", "futures-timer", - "jsonrpsee 0.20.3", + "jsonrpsee", "parity-scale-codec", "pin-project", "polkadot-overseer", @@ -3720,7 +3710,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "futures", "indicatif", - "jsonrpsee 0.20.3", + "jsonrpsee", "log", "parity-scale-codec", "serde", @@ -4147,19 +4137,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "globset" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", -] - [[package]] name = "group" version = "0.13.0" @@ -4849,30 +4826,17 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonrpsee" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "367a292944c07385839818bb71c8d76611138e2dedb0677d035b8da21d29c78b" -dependencies = [ - "jsonrpsee-core 0.16.3", - "jsonrpsee-proc-macros 0.16.3", - "jsonrpsee-server 0.16.3", - "jsonrpsee-types 0.16.3", - "tracing", -] - [[package]] name = "jsonrpsee" version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "affdc52f7596ccb2d7645231fc6163bb314630c989b64998f3699a28b4d5d4dc" dependencies = [ - "jsonrpsee-core 0.20.3", + "jsonrpsee-core", "jsonrpsee-http-client", - "jsonrpsee-proc-macros 0.20.3", - "jsonrpsee-server 0.20.3", - "jsonrpsee-types 0.20.3", + "jsonrpsee-proc-macros", + "jsonrpsee-server", + "jsonrpsee-types", "jsonrpsee-ws-client", "tokio", "tracing", @@ -4886,7 +4850,7 @@ checksum = "b5b005c793122d03217da09af68ba9383363caa950b90d3436106df8cabce935" dependencies = [ "futures-util", "http", - "jsonrpsee-core 0.20.3", + "jsonrpsee-core", "pin-project", "rustls-native-certs", "soketto", @@ -4898,32 +4862,6 @@ dependencies = [ "url", ] -[[package]] -name = "jsonrpsee-core" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b5dde66c53d6dcdc8caea1874a45632ec0fcf5b437789f1e45766a1512ce803" -dependencies = [ - "anyhow", - "arrayvec 0.7.4", - "async-trait", - "beef", - "futures-channel", - "futures-util", - "globset", - "hyper", - "jsonrpsee-types 0.16.3", - "parking_lot 0.12.1", - "rand", - "rustc-hash", - "serde", - "serde_json", - "soketto", - "thiserror", - "tokio", - "tracing", -] - [[package]] name = "jsonrpsee-core" version = "0.20.3" @@ -4937,7 +4875,7 @@ dependencies = [ "futures-timer", "futures-util", "hyper", - "jsonrpsee-types 0.20.3", + "jsonrpsee-types", "parking_lot 0.12.1", "rand", "rustc-hash", @@ -4958,8 +4896,8 @@ dependencies = [ "async-trait", "hyper", "hyper-rustls", - "jsonrpsee-core 0.20.3", - "jsonrpsee-types 0.20.3", + "jsonrpsee-core", + "jsonrpsee-types", "serde", "serde_json", "thiserror", @@ -4969,19 +4907,6 @@ dependencies = [ "url", ] -[[package]] -name = "jsonrpsee-proc-macros" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44e8ab85614a08792b9bff6c8feee23be78c98d0182d4c622c05256ab553892a" -dependencies = [ - "heck 0.4.1", - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "jsonrpsee-proc-macros" version = "0.20.3" @@ -4995,28 +4920,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "jsonrpsee-server" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4d945a6008c9b03db3354fb3c83ee02d2faa9f2e755ec1dfb69c3551b8f4ba" -dependencies = [ - "futures-channel", - "futures-util", - "http", - "hyper", - "jsonrpsee-core 0.16.3", - "jsonrpsee-types 0.16.3", - "serde", - "serde_json", - "soketto", - "tokio", - "tokio-stream", - "tokio-util", - "tower", - "tracing", -] - [[package]] name = "jsonrpsee-server" version = "0.20.3" @@ -5026,8 +4929,8 @@ dependencies = [ "futures-util", "http", "hyper", - "jsonrpsee-core 0.20.3", - "jsonrpsee-types 0.20.3", + "jsonrpsee-core", + "jsonrpsee-types", "route-recognizer", "serde", "serde_json", @@ -5040,20 +4943,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "jsonrpsee-types" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245ba8e5aa633dd1c1e4fae72bce06e71f42d34c14a2767c6b4d173b57bee5e5" -dependencies = [ - "anyhow", - "beef", - "serde", - "serde_json", - "thiserror", - "tracing", -] - [[package]] name = "jsonrpsee-types" version = "0.20.3" @@ -5076,8 +4965,8 @@ checksum = "bca9cb3933ccae417eb6b08c3448eb1cb46e39834e5b503e395e5e5bd08546c0" dependencies = [ "http", "jsonrpsee-client-transport", - "jsonrpsee-core 0.20.3", - "jsonrpsee-types 0.20.3", + "jsonrpsee-core", + "jsonrpsee-types", "url", ] @@ -6039,7 +5928,7 @@ name = "mmr-rpc" version = "28.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "jsonrpsee 0.20.3", + "jsonrpsee", "parity-scale-codec", "serde", "sp-api", @@ -8258,7 +8147,7 @@ name = "pallet-transaction-payment-rpc" version = "30.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "jsonrpsee 0.20.3", + "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", "sp-api", @@ -9588,7 +9477,7 @@ name = "polkadot-rpc" version = "7.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "jsonrpsee 0.20.3", + "jsonrpsee", "mmr-rpc", "pallet-transaction-payment-rpc", "polkadot-primitives", @@ -11497,7 +11386,7 @@ version = "0.34.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", - "jsonrpsee 0.20.3", + "jsonrpsee", "sc-consensus-babe", "sc-consensus-epochs", "sc-rpc-api", @@ -11555,7 +11444,7 @@ version = "13.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", - "jsonrpsee 0.20.3", + "jsonrpsee", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -11631,7 +11520,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "finality-grandpa", "futures", - "jsonrpsee 0.20.3", + "jsonrpsee", "log", "parity-scale-codec", "sc-client-api", @@ -12003,7 +11892,7 @@ version = "29.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "futures", - "jsonrpsee 0.20.3", + "jsonrpsee", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -12034,7 +11923,7 @@ name = "sc-rpc-api" version = "0.33.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "jsonrpsee 0.20.3", + "jsonrpsee", "parity-scale-codec", "sc-chain-spec", "sc-mixnet", @@ -12055,7 +11944,7 @@ version = "11.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "http", - "jsonrpsee 0.20.3", + "jsonrpsee", "log", "serde_json", "substrate-prometheus-endpoint", @@ -12073,7 +11962,7 @@ dependencies = [ "futures", "futures-util", "hex", - "jsonrpsee 0.20.3", + "jsonrpsee", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -12104,7 +11993,7 @@ dependencies = [ "exit-future", "futures", "futures-timer", - "jsonrpsee 0.20.3", + "jsonrpsee", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -12186,7 +12075,7 @@ name = "sc-sync-state-rpc" version = "0.34.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "jsonrpsee 0.20.3", + "jsonrpsee", "parity-scale-codec", "sc-chain-spec", "sc-client-api", @@ -14036,7 +13925,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "frame-system-rpc-runtime-api", "futures", - "jsonrpsee 0.20.3", + "jsonrpsee", "log", "parity-scale-codec", "sc-rpc-api", @@ -14066,7 +13955,7 @@ version = "0.33.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ "async-trait", - "jsonrpsee 0.20.3", + "jsonrpsee", "log", "sc-rpc-api", "serde", @@ -14078,7 +13967,7 @@ name = "substrate-state-trie-migration-rpc" version = "27.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" dependencies = [ - "jsonrpsee 0.20.3", + "jsonrpsee", "parity-scale-codec", "sc-client-api", "sc-rpc-api", diff --git a/node/Cargo.toml b/node/Cargo.toml index 018181bfba3..2f5b5aebfa7 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -21,7 +21,7 @@ hydra-dx-build-script-utils = { workspace = true } [dependencies] codec = { package = "parity-scale-codec", version = "3.4.0" } hex-literal = "0.4.1" -jsonrpsee = { version = "0.16.2", features = ["server", "macros"] } +jsonrpsee = { version = "0.20.3", features = ["server", "macros"] } log = "0.4.17" serde = { version = "1.0.136", features = ["derive"] } serde_json = "1.0.85" diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index adc225605d6..3e7c3e42045 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -184,6 +184,7 @@ pub fn kusama_staging_parachain_config() -> Result { relay_chain: "kusama".into(), para_id: PARA_ID, }, + vec![].as_slice(), )) } @@ -265,6 +266,7 @@ pub fn testnet_parachain_config() -> Result { relay_chain: "westend".into(), para_id: PARA_ID, }, + vec![].as_slice(), )) } @@ -336,6 +338,7 @@ pub fn parachain_development_config() -> Result { relay_chain: "rococo-dev".into(), para_id: PARA_ID, }, + vec![].as_slice(), )) } @@ -412,6 +415,7 @@ pub fn rococo_parachain_config() -> Result { relay_chain: "rococo".into(), para_id: PARA_ID, }, + vec![].as_slice(), )) } @@ -484,6 +488,7 @@ pub fn karura_testnet_parachain_config() -> Result { relay_chain: "kusama-local".into(), para_id: PARA_ID, }, + vec![].as_slice(), )) } @@ -554,6 +559,7 @@ pub fn benchmarks_development_config() -> Result { relay_chain: "rococo-dev".into(), para_id: PARA_ID, }, + vec![].as_slice(), )) } @@ -633,6 +639,7 @@ pub fn local_parachain_config() -> Result { relay_chain: "rococo-local".into(), para_id: PARA_ID, }, + vec![].as_slice(), )) } @@ -647,7 +654,6 @@ fn parachain_genesis( RuntimeGenesisConfig { system: SystemConfig { // Add Wasm runtime to storage. - code: wasm_binary.to_vec(), ..Default::default() }, balances: BalancesConfig { @@ -756,7 +762,6 @@ fn testnet_parachain_genesis( RuntimeGenesisConfig { system: SystemConfig { // Add Wasm runtime to storage. - code: wasm_binary.to_vec(), ..Default::default() }, balances: BalancesConfig { diff --git a/node/src/cli.rs b/node/src/cli.rs index 853a61a50bd..9ed3cd40de4 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -110,7 +110,7 @@ pub enum Subcommand { /// Export the genesis state of the parachain. #[clap(name = "export-genesis-state")] - ExportGenesisState(cumulus_client_cli::ExportGenesisStateCommand), + ExportGenesisHead(cumulus_client_cli::ExportGenesisHeadCommand), /// Export the genesis wasm of the parachain. #[clap(name = "export-genesis-wasm")] diff --git a/node/src/command.rs b/node/src/command.rs index b9526aa1abd..65f5aab3d99 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -21,7 +21,6 @@ use crate::service::{new_partial, BasiliskNativeExecutor}; use basilisk_runtime::Block; use codec::Encode; -use cumulus_client_cli::generate_genesis_block; use cumulus_primitives_core::ParaId; use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use log::info; @@ -32,9 +31,12 @@ use sc_cli::{ use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; use sc_service::config::{BasePath, PrometheusConfig}; use sp_core::hexdisplay::HexDisplay; -use sp_runtime::traits::AccountIdConversion; +use sp_runtime::traits::{AccountIdConversion, Zero}; use sp_runtime::traits::Block as BlockT; +use sp_runtime::traits::Header as HeaderT; +use sp_runtime::traits::Hash as HashT; use std::io::Write; +use sp_storage::StateVersion; fn load_spec(id: &str) -> std::result::Result, String> { Ok(match id { @@ -232,7 +234,7 @@ pub fn run() -> sc_cli::Result<()> { BenchmarkCmd::Extrinsic(_) => Err("Unsupported benchmarking command".into()), } } - Some(Subcommand::ExportGenesisState(params)) => { + Some(Subcommand::ExportGenesisHead(params)) => { let mut builder = sc_cli::LoggerBuilder::new(""); builder.with_profiling(sc_tracing::TracingReceiver::Log, ""); let _ = builder.init(); @@ -307,7 +309,7 @@ pub fn run() -> sc_cli::Result<()> { let id = ParaId::from(para_id); let parachain_account = - AccountIdConversion::::into_account_truncating(&id); + AccountIdConversion::::into_account_truncating(&id); let state_version = Cli::runtime_version().state_version(); @@ -453,3 +455,39 @@ impl Cli { &basilisk_runtime::VERSION } } + +/// Generate the genesis block from a given ChainSpec. +pub fn generate_genesis_block( + chain_spec: &dyn ChainSpec, + genesis_state_version: StateVersion, +) -> std::result::Result { + let storage = chain_spec.build_storage()?; + + let child_roots = storage.children_default.iter().map(|(sk, child_content)| { + let state_root = <<::Header as HeaderT>::Hashing as HashT>::trie_root( + child_content.data.clone().into_iter().collect(), + genesis_state_version, + ); + (sk.clone(), state_root.encode()) + }); + let state_root = <<::Header as HeaderT>::Hashing as HashT>::trie_root( + storage.top.clone().into_iter().chain(child_roots).collect(), + genesis_state_version, + ); + + let extrinsics_root = <<::Header as HeaderT>::Hashing as HashT>::trie_root( + Vec::new(), + genesis_state_version, + ); + + Ok(Block::new( + <::Header as HeaderT>::new( + Zero::zero(), + extrinsics_root, + state_root, + Default::default(), + Default::default(), + ), + Default::default(), + )) +} diff --git a/node/src/service.rs b/node/src/service.rs index 2e5fe6ee07c..b76df987834 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -269,6 +269,8 @@ async fn start_node_impl( if let Some(hwbench) = hwbench { sc_sysinfo::print_hwbench(&hwbench); + //TODO: need? + /* // Here you can check whether the hardware meets your chains' requirements. Putting a link // in there and swapping out the requirements for your own are probably a good idea. The // requirements for a para-chain are dictated by its relay-chain. @@ -279,6 +281,8 @@ async fn start_node_impl( ); } + */ + if let Some(ref mut telemetry) = telemetry { let telemetry_handle = telemetry.handle(); task_manager.spawn_handle().spawn( @@ -429,6 +433,7 @@ fn start_consensus( collator_service, // Very limited proposal time. authoring_duration: Duration::from_millis(500), + collation_request_receiver: None, }; let fut = basic_aura::run::(params); From 2f6961114d6624c2f82c5aab237e10e37285fa74 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 15 Apr 2024 13:14:06 +0200 Subject: [PATCH 08/56] pallet test mocks --- Cargo.lock | 10 +++++----- pallets/asset-registry/src/mock.rs | 1 + pallets/liquidity-mining/src/tests/mock.rs | 6 ++++-- pallets/marketplace/src/mock.rs | 3 ++- pallets/xyk-liquidity-mining/src/tests/mock.rs | 3 ++- pallets/xyk/src/tests/creation.rs | 2 +- pallets/xyk/src/tests/mock.rs | 1 + runtime/basilisk/src/tests.rs | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5c945d3c61..96f21b39e7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16069,11 +16069,6 @@ dependencies = [ "pkg-config", ] -[[patch.unused]] -name = "orml-currencies" -version = "0.8.0" -source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" - [[patch.unused]] name = "sp-core-hashing" version = "15.0.0" @@ -16083,3 +16078,8 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot name = "sp-crypto-ec-utils" version = "0.10.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" + +[[patch.unused]] +name = "orml-currencies" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/pallets/asset-registry/src/mock.rs b/pallets/asset-registry/src/mock.rs index b3cb3693842..6bc0fce114a 100644 --- a/pallets/asset-registry/src/mock.rs +++ b/pallets/asset-registry/src/mock.rs @@ -61,6 +61,7 @@ impl system::Config for Test { type BlockLength = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; + type RuntimeTask = RuntimeTask; type Nonce = u64; type Block = Block; type Hash = H256; diff --git a/pallets/liquidity-mining/src/tests/mock.rs b/pallets/liquidity-mining/src/tests/mock.rs index 8be1303f807..77f99390263 100644 --- a/pallets/liquidity-mining/src/tests/mock.rs +++ b/pallets/liquidity-mining/src/tests/mock.rs @@ -22,7 +22,8 @@ use crate::Config; use crate::{self as liq_mining, types::DefaultPriceAdjustment}; use frame_support::{parameter_types, traits::Contains, traits::Everything, PalletId}; use frame_system as system; -use hydradx_traits::{pools::DustRemovalAccountWhitelist, registry::Registry, AssetKind, AMM}; +use hydradx_traits::{pools::DustRemovalAccountWhitelist, AssetKind, AMM}; +use pallet_asset_registry::traits::Registry; use orml_traits::GetByKey; use sp_core::H256; use sp_runtime::{ @@ -145,6 +146,7 @@ impl system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; + type RuntimeTask = RuntimeTask; type Nonce = u64; type Block = Block; type Hash = H256; @@ -349,8 +351,8 @@ impl pallet_balances::Config for Test { type ReserveIdentifier = ReserveIdentifier; type FreezeIdentifier = (); type MaxFreezes = (); - type MaxHolds = (); type RuntimeHoldReason = (); + type RuntimeFreezeReason = (); } impl orml_tokens::Config for Test { diff --git a/pallets/marketplace/src/mock.rs b/pallets/marketplace/src/mock.rs index db2af406ecb..92a2efbf501 100644 --- a/pallets/marketplace/src/mock.rs +++ b/pallets/marketplace/src/mock.rs @@ -89,8 +89,8 @@ impl pallet_balances::Config for Test { type ReserveIdentifier = (); type FreezeIdentifier = (); type MaxFreezes = (); - type MaxHolds = (); type RuntimeHoldReason = (); + type RuntimeFreezeReason = (); } impl system::Config for Test { @@ -100,6 +100,7 @@ impl system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; + type RuntimeTask = RuntimeTask; type Nonce = u64; type Block = Block; type Hash = H256; diff --git a/pallets/xyk-liquidity-mining/src/tests/mock.rs b/pallets/xyk-liquidity-mining/src/tests/mock.rs index f3b95b18f6c..ac1d0b920a7 100644 --- a/pallets/xyk-liquidity-mining/src/tests/mock.rs +++ b/pallets/xyk-liquidity-mining/src/tests/mock.rs @@ -121,6 +121,7 @@ impl system::Config for Test { type DbWeight = DbWeight; type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; + type RuntimeTask = RuntimeTask; type Nonce = u64; type Block = Block; type Hash = H256; @@ -802,8 +803,8 @@ impl pallet_balances::Config for Test { type ReserveIdentifier = (); type FreezeIdentifier = (); type MaxFreezes = (); - type MaxHolds = (); type RuntimeHoldReason = (); + type RuntimeFreezeReason = (); } parameter_type_with_key! { diff --git a/pallets/xyk/src/tests/creation.rs b/pallets/xyk/src/tests/creation.rs index e6566ecc9b7..cfe47439b8b 100644 --- a/pallets/xyk/src/tests/creation.rs +++ b/pallets/xyk/src/tests/creation.rs @@ -1,7 +1,7 @@ pub use super::mock::*; use crate::{Error, Event}; use frame_support::{assert_noop, assert_ok, BoundedVec}; -use hydradx_traits::Registry; +use pallet_asset_registry::traits::Registry; use hydradx_traits::AMM as AmmPool; use orml_traits::MultiCurrency; use pallet_asset_registry::AssetType; diff --git a/pallets/xyk/src/tests/mock.rs b/pallets/xyk/src/tests/mock.rs index eca5ebc1b3b..e2211540d4b 100644 --- a/pallets/xyk/src/tests/mock.rs +++ b/pallets/xyk/src/tests/mock.rs @@ -116,6 +116,7 @@ impl system::Config for Test { type BlockLength = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; + type RuntimeTask = RuntimeTask; type Nonce = u64; type Block = Block; type Hash = H256; diff --git a/runtime/basilisk/src/tests.rs b/runtime/basilisk/src/tests.rs index 6179dc291da..98d5d63b591 100644 --- a/runtime/basilisk/src/tests.rs +++ b/runtime/basilisk/src/tests.rs @@ -47,7 +47,7 @@ fn extrinsic_base_fee_is_correct() { #[test] // Useful to calculate how much single transfer costs in native currency with fee components breakdown fn transfer_cost() { - let call = pallet_balances::Call::::transfer { + let call = pallet_balances::Call::::transfer_keep_alive { dest: AccountId::new([0; 32]), value: Default::default(), }; From cd82137e30f681a7f07fa4c8b5dba6c44a2201a9 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 15 Apr 2024 15:37:10 +0200 Subject: [PATCH 09/56] use rococo runtime --- Cargo.lock | 15 +++--- Cargo.toml | 3 +- integration-tests/Cargo.toml | 2 + integration-tests/src/call_filter.rs | 6 +-- integration-tests/src/cross_chain_transfer.rs | 16 +++---- integration-tests/src/exchange_asset.rs | 4 +- integration-tests/src/kusama_test_net.rs | 47 +++++++++---------- integration-tests/src/lib.rs | 2 +- integration-tests/src/transact_call_filter.rs | 2 +- 9 files changed, 50 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 96f21b39e7d..be1ba892a70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1494,9 +1494,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -10858,6 +10858,7 @@ dependencies = [ "polkadot-service", "pretty_assertions", "primitives 6.6.0", + "rococo-runtime", "sc-consensus-grandpa", "sp-api", "sp-arithmetic", @@ -16069,6 +16070,11 @@ dependencies = [ "pkg-config", ] +[[patch.unused]] +name = "orml-currencies" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" + [[patch.unused]] name = "sp-core-hashing" version = "15.0.0" @@ -16078,8 +16084,3 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot name = "sp-crypto-ec-utils" version = "0.10.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" - -[[patch.unused]] -name = "orml-currencies" -version = "0.8.0" -source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/Cargo.toml b/Cargo.toml index 1da4696a13b..9762a830240 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -182,7 +182,7 @@ pallet-mmr = { git = "https://github.com/paritytech/polkadot-sdk", branch ="rele sp-mmr-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } substrate-state-trie-migration-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2" } -kusama-runtime = { package = "staging-kusama-runtime", git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +#kusama-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } @@ -200,6 +200,7 @@ polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sd polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } polkadot-statement-table = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } rococo-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } +rococo-emulated-chain = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } westend-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } polkadot-xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 3c4214742e3..19817246190 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -107,6 +107,7 @@ polkadot-primitives = { workspace = true } polkadot-runtime-parachains = { workspace = true } basilisk-runtime = { path = "../runtime/basilisk", default-features = false} +rococo-runtime = {workspace = true} cumulus-test-relay-sproof-builder = { workspace = true } [dev-dependencies] @@ -184,6 +185,7 @@ std = [ "pallet-authorship/std", "basilisk-runtime/std", "hydradx-traits/std", + "rococo-runtime/std", ] runtime-benchmarks = [ diff --git a/integration-tests/src/call_filter.rs b/integration-tests/src/call_filter.rs index 858c719c6ea..9f9055e21c2 100644 --- a/integration-tests/src/call_filter.rs +++ b/integration-tests/src/call_filter.rs @@ -1,7 +1,7 @@ #![cfg(test)] use crate::kusama_test_net::*; use frame_support::traits::Contains; -use polkadot_xcm::latest::prelude::*; +use polkadot_xcm::v3::prelude::*; use polkadot_xcm::VersionedXcm; use xcm_emulator::TestExt; @@ -26,7 +26,7 @@ fn calling_pallet_xcm_extrinsic_should_be_filtered_by_call_filter() { Basilisk::execute_with(|| { // the values here don't need to make sense, all we need is a valid Call let call = basilisk_runtime::RuntimeCall::PolkadotXcm(pallet_xcm::Call::send { - dest: Box::new(MultiLocation::parent().into()), + dest: Box::new(MultiLocation::parent().into_versioned()), message: Box::new(VersionedXcm::from(Xcm(vec![]))), }); @@ -41,7 +41,7 @@ fn calling_orml_xcm_extrinsic_should_be_filtered_by_call_filter() { Basilisk::execute_with(|| { // the values here don't need to make sense, all we need is a valid Call let call = basilisk_runtime::RuntimeCall::OrmlXcm(orml_xcm::Call::send_as_sovereign { - dest: Box::new(MultiLocation::parent().into()), + dest: Box::new(MultiLocation::parent().into_versioned()), message: Box::new(VersionedXcm::from(Xcm(vec![]))), }); diff --git a/integration-tests/src/cross_chain_transfer.rs b/integration-tests/src/cross_chain_transfer.rs index 082e7bd60f1..519132c72a7 100644 --- a/integration-tests/src/cross_chain_transfer.rs +++ b/integration-tests/src/cross_chain_transfer.rs @@ -4,7 +4,7 @@ use crate::kusama_test_net::*; use frame_support::{assert_noop, assert_ok}; -use polkadot_xcm::{latest::prelude::*, VersionedMultiAssets, VersionedXcm}; +use polkadot_xcm::{v3::prelude::*, VersionedAssets,VersionedXcm}; use cumulus_primitives_core::ParaId; use frame_support::weights::Weight; @@ -19,7 +19,7 @@ fn determine_hash(origin: &MultiLocation, assets: M) -> H256 where M: Into, { - let versioned = VersionedMultiAssets::from(assets.into()); + let versioned = VersionedAssets::from(assets.into()); BlakeTwo256::hash_of(&(origin, &versioned)) } @@ -33,16 +33,16 @@ fn basilisk_should_receive_asset_when_transferred_from_relaychain() { )); }); Kusama::execute_with(|| { - assert_ok!(kusama_runtime::XcmPallet::reserve_transfer_assets( - kusama_runtime::RuntimeOrigin::signed(ALICE.into()), + assert_ok!(rococo_runtime::XcmPallet::reserve_transfer_assets( + rococo_runtime::RuntimeOrigin::signed(ALICE.into()), Box::new(Parachain(BASILISK_PARA_ID).into_versioned()), - Box::new(Junction::AccountId32 { id: BOB, network: None }.into()), + Box::new(Junction::AccountId32 { id: BOB, network: None }.into_versioned()), Box::new((Here, 300 * UNITS).into()), 0, )); assert_eq!( - kusama_runtime::Balances::free_balance(AccountIdConversion::::into_account_truncating( + rococo_runtime::Balances::free_balance(AccountIdConversion::::into_account_truncating( &ParaId::from(BASILISK_PARA_ID) )), 310 * UNITS @@ -85,7 +85,7 @@ fn relaychain_should_receive_asset_when_transferred_from_basilisk() { Kusama::execute_with(|| { assert_eq!( - kusama_runtime::Balances::free_balance(AccountId::from(BOB)), + rococo_runtime::Balances::free_balance(AccountId::from(BOB)), 2999918220455 // 3 * BSX - fee ); }); @@ -118,7 +118,7 @@ fn basilisk_should_receive_asset_when_sent_from_other_parachain() { Junction::AccountId32 { id: BOB, network: None } ) ) - .into() + .into_versioned() ), WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) )); diff --git a/integration-tests/src/exchange_asset.rs b/integration-tests/src/exchange_asset.rs index ca0c9692108..bcec0866dea 100644 --- a/integration-tests/src/exchange_asset.rs +++ b/integration-tests/src/exchange_asset.rs @@ -11,7 +11,7 @@ use hydradx_traits::router::AssetPair; use hydradx_traits::router::PoolType; use hydradx_traits::router::Trade; use orml_traits::currency::MultiCurrency; -use polkadot_xcm::{latest::prelude::*, VersionedXcm}; +use polkadot_xcm::{v3::prelude::*, VersionedXcm}; use pretty_assertions::assert_eq; use primitives::constants::chain::CORE_ASSET_ID; use sp_runtime::FixedU128; @@ -262,7 +262,7 @@ fn craft_exchange_asset_xcm, RC: Decode + GetDispatchInfo>( want: M, is_sell: bool, ) -> VersionedXcm { - use kusama_runtime::xcm_config::BaseXcmWeight; + use rococo_runtime::xcm_config::BaseXcmWeight; use xcm_builder::FixedWeightBounds; use xcm_executor::traits::WeightBounds; diff --git a/integration-tests/src/kusama_test_net.rs b/integration-tests/src/kusama_test_net.rs index ebc15282f6d..2ef136227d3 100644 --- a/integration-tests/src/kusama_test_net.rs +++ b/integration-tests/src/kusama_test_net.rs @@ -48,7 +48,7 @@ use frame_support::assert_ok; use frame_support::traits::OnInitialize; use pallet_transaction_multi_payment::Price; pub use pallet_xyk::types::AssetPair; -use polkadot_primitives::v5::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE}; +use polkadot_primitives::v6::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE}; use polkadot_runtime_parachains::configuration::HostConfiguration; use pretty_assertions::assert_eq; use primitives::{AssetId, Balance}; @@ -57,22 +57,21 @@ use sp_runtime::{traits::AccountIdConversion, BuildStorage}; use primitives::constants::chain::CORE_ASSET_ID; pub use xcm_emulator::Network; -use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, DefaultMessageProcessor}; +use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains ,TestExt}; decl_test_relay_chains! { #[api_version(5)] pub struct Kusama { genesis = kusama::genesis(), on_init = (), - runtime = kusama_runtime, + runtime = rococo_runtime, core = { - MessageProcessor: DefaultMessageProcessor, - SovereignAccountOf: kusama_runtime::xcm_config::SovereignAccountOf, + SovereignAccountOf: rococo_runtime::xcm_config::LocationConverter, }, pallets = { - XcmPallet: kusama_runtime::XcmPallet, - Balances: kusama_runtime::Balances, - Hrmp: kusama_runtime::Hrmp, + XcmPallet: rococo_runtime::XcmPallet, + Balances: rococo_runtime::Balances, + Hrmp: rococo_runtime::Hrmp, } } } @@ -88,9 +87,9 @@ decl_test_parachains! { runtime = basilisk_runtime, core = { XcmpMessageHandler: basilisk_runtime::XcmpQueue, - DmpMessageHandler: basilisk_runtime::DmpQueue, LocationToAccountId: basilisk_runtime::xcm::LocationToAccountId, ParachainInfo: basilisk_runtime::ParachainInfo, + MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin, }, pallets = { PolkadotXcm: basilisk_runtime::PolkadotXcm, @@ -107,9 +106,9 @@ decl_test_parachains! { runtime = basilisk_runtime, core = { XcmpMessageHandler: basilisk_runtime::XcmpQueue, - DmpMessageHandler: basilisk_runtime::DmpQueue, LocationToAccountId: basilisk_runtime::LocationToAccountId, ParachainInfo: basilisk_runtime::ParachainInfo, + MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin, }, pallets = { PolkadotXcm: basilisk_runtime::PolkadotXcm, @@ -191,8 +190,8 @@ pub mod kusama { para_assignment: AssignmentId, authority_discovery: AuthorityDiscoveryId, beefy: BeefyId, - ) -> kusama_runtime::SessionKeys { - kusama_runtime::SessionKeys { + ) -> rococo_runtime::SessionKeys { + rococo_runtime::SessionKeys { babe, grandpa, im_online, @@ -217,14 +216,14 @@ pub mod kusama { } pub fn genesis() -> Storage { - let genesis_config = kusama_runtime::RuntimeGenesisConfig { - balances: kusama_runtime::BalancesConfig { + let genesis_config = rococo_runtime::RuntimeGenesisConfig { + balances: rococo_runtime::BalancesConfig { balances: vec![ (AccountId::from(ALICE), 2002 * UNITS), (ParaId::from(BASILISK_PARA_ID).into_account_truncating(), 10 * UNITS), ], }, - session: kusama_runtime::SessionConfig { + session: rococo_runtime::SessionConfig { keys: initial_authorities() .iter() .map(|x| { @@ -244,16 +243,16 @@ pub mod kusama { }) .collect::>(), }, - babe: kusama_runtime::BabeConfig { + babe: rococo_runtime::BabeConfig { authorities: Default::default(), - epoch_config: Some(kusama_runtime::BABE_GENESIS_EPOCH_CONFIG), + epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), ..Default::default() }, - configuration: kusama_runtime::ConfigurationConfig { + configuration: rococo_runtime::ConfigurationConfig { config: get_host_configuration(), }, - xcm_pallet: kusama_runtime::XcmPalletConfig { + xcm_pallet: rococo_runtime::XcmPalletConfig { safe_xcm_version: Some(3), ..Default::default() }, @@ -517,10 +516,10 @@ pub fn set_relaychain_block_number(number: BlockNumber) { pub fn kusama_run_to_block(to: BlockNumber) { use frame_support::traits::OnFinalize; - while kusama_runtime::System::block_number() < to { - let b = kusama_runtime::System::block_number(); - kusama_runtime::System::on_finalize(b); - kusama_runtime::System::on_initialize(b + 1); - kusama_runtime::System::set_block_number(b + 1); + while rococo_runtime::System::block_number() < to { + let b = rococo_runtime::System::block_number(); + rococo_runtime::System::on_finalize(b); + rococo_runtime::System::on_initialize(b + 1); + rococo_runtime::System::set_block_number(b + 1); } } diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index e877e58f7be..01fa8b5128d 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -13,5 +13,5 @@ mod oracle; mod router; mod transact_call_filter; mod vesting; -mod xcm_rate_limiter; +//mod xcm_rate_limiter; mod xyk; diff --git a/integration-tests/src/transact_call_filter.rs b/integration-tests/src/transact_call_filter.rs index a0bb626b355..7a3543de033 100644 --- a/integration-tests/src/transact_call_filter.rs +++ b/integration-tests/src/transact_call_filter.rs @@ -4,7 +4,7 @@ use crate::kusama_test_net::*; use frame_support::{assert_ok, dispatch::GetDispatchInfo, weights::Weight}; use sp_runtime::codec::Encode; -use polkadot_xcm::latest::prelude::*; +use polkadot_xcm::v3::prelude::*; use xcm_emulator::TestExt; #[test] From 2b2e8a1f8c2cabef91c6a4d7d39524e0733cce45 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 16 Apr 2024 11:44:43 +0200 Subject: [PATCH 10/56] fix benchmark build --- Cargo.lock | 3 +-- integration-tests/Cargo.toml | 1 + runtime/basilisk/Cargo.toml | 4 +--- .../basilisk/src/benchmarking/marketplace.rs | 2 +- .../src/benchmarking/route_executor.rs | 2 +- runtime/basilisk/src/lib.rs | 22 ++++++++++++++----- runtime/basilisk/src/xcm.rs | 11 ---------- 7 files changed, 21 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be1ba892a70..db56b6dc524 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -953,10 +953,9 @@ dependencies = [ [[package]] name = "basilisk-runtime" -version = "112.0.0" +version = "113.0.0" dependencies = [ "cumulus-pallet-aura-ext", - "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-xcm", "cumulus-pallet-xcmp-queue", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 19817246190..2367d940074 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -190,4 +190,5 @@ std = [ runtime-benchmarks = [ "basilisk-runtime/runtime-benchmarks", + "rococo-runtime/runtime-benchmarks", ] \ No newline at end of file diff --git a/runtime/basilisk/Cargo.toml b/runtime/basilisk/Cargo.toml index aed7e7dd894..acc5165c4f8 100644 --- a/runtime/basilisk/Cargo.toml +++ b/runtime/basilisk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "basilisk-runtime" -version = "112.0.0" +version = "113.0.0" authors = ["GalacticCouncil"] edition = "2021" homepage = "https://github.com/galacticcouncil/Basilisk-node" @@ -74,7 +74,6 @@ cumulus-pallet-aura-ext = { workspace = true } cumulus-pallet-parachain-system = { workspace = true } cumulus-pallet-xcm = { workspace = true } cumulus-pallet-xcmp-queue = { workspace = true } -cumulus-pallet-dmp-queue = { workspace = true } cumulus-primitives-core = { workspace = true } cumulus-primitives-utility = { workspace = true } cumulus-primitives-parachain-inherent = { workspace = true } @@ -284,7 +283,6 @@ try-runtime= [ "pallet-preimage/try-runtime", "pallet-identity/try-runtime", "pallet-xcm/try-runtime", - "cumulus-pallet-dmp-queue/try-runtime", "pallet-asset-registry/try-runtime", "pallet-xyk/try-runtime", "pallet-duster/try-runtime", diff --git a/runtime/basilisk/src/benchmarking/marketplace.rs b/runtime/basilisk/src/benchmarking/marketplace.rs index e2b019c01e7..f6e64b822b6 100644 --- a/runtime/basilisk/src/benchmarking/marketplace.rs +++ b/runtime/basilisk/src/benchmarking/marketplace.rs @@ -9,8 +9,8 @@ use frame_support::{ BoundedVec, }; use frame_system::RawOrigin; -use hydradx_traits::registry::Registry; use orml_benchmarking::runtime_benchmarks; +use pallet_asset_registry::traits::Registry; use pallet_nft::BoundedVecOfUnq; use primitives::{constants::currency::UNITS, CollectionId, ItemId}; use sp_std::convert::TryInto; diff --git a/runtime/basilisk/src/benchmarking/route_executor.rs b/runtime/basilisk/src/benchmarking/route_executor.rs index 493f40ffa38..95cb74c7c85 100644 --- a/runtime/basilisk/src/benchmarking/route_executor.rs +++ b/runtime/basilisk/src/benchmarking/route_executor.rs @@ -25,9 +25,9 @@ use frame_support::{assert_ok, ensure}; use frame_system::RawOrigin; use hydradx_traits::router::AssetPair; use hydradx_traits::router::{PoolType, RouterT, Trade}; -use hydradx_traits::Registry; use orml_benchmarking::runtime_benchmarks; use orml_traits::{MultiCurrency, MultiCurrencyExtended}; +use pallet_asset_registry::traits::Registry; use primitives::constants::currency::UNITS; use sp_std::vec; diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index a47cf06d09e..227d7b7b2b7 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -67,7 +67,7 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; // A few exports that help ease life for downstream crates. -use frame_support::{construct_runtime, weights::Weight}; +use frame_support::{construct_runtime, parameter_types, weights::Weight}; /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats @@ -102,7 +102,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("basilisk"), impl_name: create_runtime_str!("basilisk"), authoring_version: 1, - spec_version: 112, + spec_version: 113, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -201,7 +201,7 @@ construct_runtime!( PolkadotXcm: pallet_xcm = 52, CumulusXcm: cumulus_pallet_xcm = 53, XcmpQueue: cumulus_pallet_xcmp_queue exclude_parts { Call } = 54, - DmpQueue: cumulus_pallet_dmp_queue = 55, + // 55 was used by DmpQueue which is now replaced by MessageQueue MessageQueue: pallet_message_queue = 56, // Basilisk - runtime module index for basilisk's pallets starts at 100 @@ -265,11 +265,15 @@ pub type Executive = frame_executive::Executive< Runtime, AllPalletsWithSystem, ( + frame_support::migrations::RemovePallet::DbWeight>, migrations::OnRuntimeUpgradeMigration, - pallet_transaction_pause::migration::v1::Migration, ), >; +parameter_types! { + pub const DmpQueuePalletName: &'static str = "DmpQueue"; +} + impl_runtime_apis! { impl sp_api::Core for Runtime { fn version() -> RuntimeVersion { @@ -445,11 +449,14 @@ impl_runtime_apis! { list_benchmark!(list, extra, pallet_scheduler, Scheduler); list_benchmark!(list, extra, pallet_utility, Utility); list_benchmark!(list, extra, pallet_tips, Tips); + list_benchmark!(list, extra, pallet_identity, Identity); list_benchmark!(list, extra, pallet_collective, TechnicalCommittee); list_benchmark!(list, extra, pallet_state_trie_migration, StateTrieMigration); + list_benchmark!(list, extra, pallet_preimage, Preimage); list_benchmark!(list, extra, cumulus_pallet_xcmp_queue, XcmpQueue); - list_benchmark!(list, extra, pallet_xcm, PolkadotXcm); + list_benchmark!(list, extra, pallet_message_queue, MessageQueue); + //list_benchmark!(list, extra, pallet_xcm, PolkadotXcm); orml_list_benchmark!(list, extra, pallet_currencies, benchmarking::currencies); orml_list_benchmark!(list, extra, orml_tokens, benchmarking::tokens); @@ -525,11 +532,14 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_scheduler, Scheduler); add_benchmark!(params, batches, pallet_utility, Utility); add_benchmark!(params, batches, pallet_tips, Tips); + add_benchmark!(params, batches, pallet_identity, Identity); add_benchmark!(params, batches, pallet_collective, TechnicalCommittee); add_benchmark!(params, batches, pallet_state_trie_migration, StateTrieMigration); + add_benchmark!(params, batches, pallet_preimage, Preimage); add_benchmark!(params, batches, cumulus_pallet_xcmp_queue, XcmpQueue); - add_benchmark!(params, batches, pallet_xcm, PolkadotXcm); + add_benchmark!(params, batches, pallet_message_queue, MessageQueue); + //add_benchmark!(params, batches, pallet_xcm, PolkadotXcm); orml_add_benchmark!(params, batches, pallet_currencies, benchmarking::currencies); orml_add_benchmark!(params, batches, orml_tokens, benchmarking::tokens); diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index 0f982a22bbf..41c78a0838d 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -210,12 +210,6 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type MaxInboundSuspended = MaxInboundSuspended; } -impl cumulus_pallet_dmp_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type DmpSink = frame_support::traits::EnqueueWithOrigin; - type WeightInfo = (); -} - parameter_type_with_key! { pub ParachainMinFee: |_location: Location| -> Option { None @@ -250,11 +244,6 @@ impl orml_xcm::Config for Runtime { type SovereignOrigin = SuperMajorityCouncilOrRoot; } -#[cfg(feature = "runtime-benchmarks")] -parameter_types! { - pub ReachableDest: Option = Some(Parent.into()); -} - parameter_types! { //Xcm asset exchange pub DefaultPoolType: PoolType = PoolType::XYK; From 2ddb21e068a999d42ab9364015c286c36e48a457 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 16 Apr 2024 14:12:35 +0200 Subject: [PATCH 11/56] remove xcm rate limiter pallet --- Cargo.lock | 26 +++++++++++++------------- runtime/basilisk/src/lib.rs | 2 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index db56b6dc524..3709f57edbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12459,9 +12459,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.115" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" +checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" dependencies = [ "itoa", "ryu", @@ -13074,7 +13074,7 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" +source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -13136,7 +13136,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" +source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" dependencies = [ "proc-macro2", "quote", @@ -13157,7 +13157,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" +source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" dependencies = [ "environmental", "parity-scale-codec", @@ -13375,7 +13375,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" +source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -13407,7 +13407,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" +source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" dependencies = [ "Inflector", "expander 2.1.0", @@ -13500,7 +13500,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" +source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" [[package]] name = "sp-storage" @@ -13518,7 +13518,7 @@ dependencies = [ [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" +source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13555,7 +13555,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" +source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" dependencies = [ "parity-scale-codec", "tracing", @@ -13655,7 +13655,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#d1b0ef76a8b060437ec7dfc1bf6b400626cd6208" +source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" dependencies = [ "impl-trait-for-tuples", "log", @@ -15551,9 +15551,9 @@ dependencies = [ [[package]] name = "wide" -version = "0.7.15" +version = "0.7.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89beec544f246e679fc25490e3f8e08003bc4bf612068f325120dad4cea02c1c" +checksum = "81a1851a719f11d1d2fea40e15c72f6c00de8c142d7ac47c1441cc7e4d0d5bc6" dependencies = [ "bytemuck", "safe_arch", diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 227d7b7b2b7..cbb02925c71 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -266,12 +266,14 @@ pub type Executive = frame_executive::Executive< AllPalletsWithSystem, ( frame_support::migrations::RemovePallet::DbWeight>, + frame_support::migrations::RemovePallet::DbWeight>, migrations::OnRuntimeUpgradeMigration, ), >; parameter_types! { pub const DmpQueuePalletName: &'static str = "DmpQueue"; + pub const XcmRateLimiterPalletName: &'static str = "XcmRateLimiter"; } impl_runtime_apis! { From 64781ca9dadf13c8be0520c52e81db883f7b015d Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 22 Apr 2024 12:19:46 +0200 Subject: [PATCH 12/56] use xyk from hydra --- Cargo.lock | 341 +-- Cargo.toml | 13 +- pallets/asset-registry/src/lib.rs | 62 +- pallets/asset-registry/src/types.rs | 4 + pallets/liquidity-mining/Cargo.toml | 62 - pallets/liquidity-mining/src/lib.rs | 1914 --------------- .../src/tests/claim_rewards.rs | 1265 ---------- .../src/tests/create_global_farm.rs | 276 --- .../src/tests/create_yield_farm.rs | 485 ---- .../src/tests/deposit_lp_shares.rs | 651 ----- .../liquidity-mining/src/tests/full_run.rs | 789 ------ .../liquidity-mining/src/tests/invariants.rs | 888 ------- .../src/tests/lm_with_oracle.rs | 298 --- pallets/liquidity-mining/src/tests/mock.rs | 538 ----- pallets/liquidity-mining/src/tests/mod.rs | 269 --- .../src/tests/redeposit_lp_shares.rs | 289 --- .../src/tests/resume_yield_farm.rs | 233 -- .../src/tests/stop_yield_farm.rs | 188 -- .../src/tests/terminate_global_farm.rs | 254 -- .../src/tests/terminate_yield_farm.rs | 228 -- .../liquidity-mining/src/tests/test_ext.rs | 411 ---- pallets/liquidity-mining/src/tests/tests.rs | 2132 ----------------- .../src/tests/update_global_farm.rs | 184 -- .../src/tests/update_yield_farm.rs | 223 -- .../src/tests/withdraw_lp_shares.rs | 1377 ----------- pallets/liquidity-mining/src/types.rs | 429 ---- pallets/xyk/Cargo.toml | 70 - pallets/xyk/README.md | 25 - pallets/xyk/src/benchmarking.rs | 207 -- pallets/xyk/src/impls.rs | 31 - pallets/xyk/src/lib.rs | 1115 --------- pallets/xyk/src/tests/amm_position.rs | 53 - pallets/xyk/src/tests/creation.rs | 425 ---- pallets/xyk/src/tests/fees.rs | 498 ---- pallets/xyk/src/tests/invariants.rs | 560 ----- pallets/xyk/src/tests/liquidity.rs | 689 ------ pallets/xyk/src/tests/mock.rs | 289 --- pallets/xyk/src/tests/mod.rs | 8 - pallets/xyk/src/tests/spot_price.rs | 83 - pallets/xyk/src/tests/trades.rs | 1085 --------- pallets/xyk/src/trade_execution.rs | 143 -- pallets/xyk/src/types.rs | 69 - pallets/xyk/src/weights.rs | 368 --- 43 files changed, 194 insertions(+), 19327 deletions(-) delete mode 100644 pallets/liquidity-mining/Cargo.toml delete mode 100644 pallets/liquidity-mining/src/lib.rs delete mode 100644 pallets/liquidity-mining/src/tests/claim_rewards.rs delete mode 100644 pallets/liquidity-mining/src/tests/create_global_farm.rs delete mode 100644 pallets/liquidity-mining/src/tests/create_yield_farm.rs delete mode 100644 pallets/liquidity-mining/src/tests/deposit_lp_shares.rs delete mode 100644 pallets/liquidity-mining/src/tests/full_run.rs delete mode 100644 pallets/liquidity-mining/src/tests/invariants.rs delete mode 100644 pallets/liquidity-mining/src/tests/lm_with_oracle.rs delete mode 100644 pallets/liquidity-mining/src/tests/mock.rs delete mode 100644 pallets/liquidity-mining/src/tests/mod.rs delete mode 100644 pallets/liquidity-mining/src/tests/redeposit_lp_shares.rs delete mode 100644 pallets/liquidity-mining/src/tests/resume_yield_farm.rs delete mode 100644 pallets/liquidity-mining/src/tests/stop_yield_farm.rs delete mode 100644 pallets/liquidity-mining/src/tests/terminate_global_farm.rs delete mode 100644 pallets/liquidity-mining/src/tests/terminate_yield_farm.rs delete mode 100644 pallets/liquidity-mining/src/tests/test_ext.rs delete mode 100644 pallets/liquidity-mining/src/tests/tests.rs delete mode 100644 pallets/liquidity-mining/src/tests/update_global_farm.rs delete mode 100644 pallets/liquidity-mining/src/tests/update_yield_farm.rs delete mode 100644 pallets/liquidity-mining/src/tests/withdraw_lp_shares.rs delete mode 100644 pallets/liquidity-mining/src/types.rs delete mode 100644 pallets/xyk/Cargo.toml delete mode 100644 pallets/xyk/README.md delete mode 100644 pallets/xyk/src/benchmarking.rs delete mode 100644 pallets/xyk/src/impls.rs delete mode 100644 pallets/xyk/src/lib.rs delete mode 100644 pallets/xyk/src/tests/amm_position.rs delete mode 100644 pallets/xyk/src/tests/creation.rs delete mode 100644 pallets/xyk/src/tests/fees.rs delete mode 100644 pallets/xyk/src/tests/invariants.rs delete mode 100644 pallets/xyk/src/tests/liquidity.rs delete mode 100644 pallets/xyk/src/tests/mock.rs delete mode 100644 pallets/xyk/src/tests/mod.rs delete mode 100644 pallets/xyk/src/tests/spot_price.rs delete mode 100644 pallets/xyk/src/tests/trades.rs delete mode 100644 pallets/xyk/src/trade_execution.rs delete mode 100644 pallets/xyk/src/types.rs delete mode 100644 pallets/xyk/src/weights.rs diff --git a/Cargo.lock b/Cargo.lock index 3709f57edbd..7ec158c232d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -214,7 +214,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -664,7 +664,7 @@ dependencies = [ "futures-lite 2.3.0", "parking", "polling 3.6.0", - "rustix 0.38.32", + "rustix 0.38.33", "slab", "tracing", "windows-sys 0.52.0", @@ -714,26 +714,26 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.32", + "rustix 0.38.33", "windows-sys 0.48.0", ] [[package]] name = "async-signal" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" +checksum = "afe66191c335039c7bb78f99dc7520b0cbb166b3a1cb33a03f53d8a1c6f2afda" dependencies = [ "async-io 2.3.2", - "async-lock 2.8.0", + "async-lock 3.3.0", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 0.38.32", + "rustix 0.38.33", "signal-hook-registry", "slab", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -750,7 +750,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -786,7 +786,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -997,7 +997,7 @@ dependencies = [ "pallet-ema-oracle", "pallet-identity", "pallet-lbp", - "pallet-liquidity-mining 4.2.5", + "pallet-liquidity-mining", "pallet-marketplace", "pallet-message-queue", "pallet-multisig", @@ -1098,7 +1098,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -1114,21 +1114,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - [[package]] name = "bitcoin_hashes" version = "0.11.0" @@ -1419,12 +1404,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" +checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" dependencies = [ "jobserver", "libc", + "once_cell", ] [[package]] @@ -1590,7 +1576,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -2303,7 +2289,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -2611,7 +2597,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -2651,7 +2637,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -2668,7 +2654,7 @@ checksum = "ad08a837629ad949b73d032c637653d069e909cffe4ee7870b02301939ce39cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -2760,7 +2746,7 @@ checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -2868,7 +2854,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -2908,7 +2894,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.59", + "syn 2.0.60", "termcolor", "toml 0.8.12", "walkdir", @@ -3087,7 +3073,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -3098,7 +3084,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -3330,7 +3316,7 @@ dependencies = [ "prettier-please", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -3652,7 +3638,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -3781,7 +3767,7 @@ dependencies = [ "proc-macro2", "quote", "sp-crypto-hashing", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -3793,7 +3779,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -3803,7 +3789,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -3887,7 +3873,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29f9df8a11882c4e3335eb2d18a0137c505d9ca927470b0cac9c6f0ae07d28f7" dependencies = [ - "rustix 0.38.32", + "rustix 0.38.33", "windows-sys 0.48.0", ] @@ -3982,7 +3968,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -4439,7 +4425,7 @@ dependencies = [ "pallet-dynamic-fees", "pallet-ema-oracle", "pallet-lbp", - "pallet-liquidity-mining 4.3.1", + "pallet-liquidity-mining", "pallet-omnipool", "pallet-omnipool-liquidity-mining", "pallet-referrals", @@ -4510,7 +4496,7 @@ dependencies = [ "http", "hyper", "log", - "rustls 0.21.10", + "rustls 0.21.11", "rustls-native-certs", "tokio", "tokio-rustls", @@ -5693,7 +5679,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -5707,7 +5693,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -5718,7 +5704,7 @@ checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -5729,7 +5715,7 @@ checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -5790,7 +5776,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.32", + "rustix 0.38.33", ] [[package]] @@ -6382,7 +6368,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -7389,32 +7375,6 @@ dependencies = [ "substrate-wasm-builder", ] -[[package]] -name = "pallet-liquidity-mining" -version = "4.2.5" -dependencies = [ - "fixed", - "frame-support", - "frame-system", - "hydra-dx-math", - "hydradx-traits", - "orml-tokens", - "orml-traits", - "pallet-asset-registry 2.3.3", - "pallet-balances", - "parity-scale-codec", - "pretty_assertions", - "proptest", - "rand", - "scale-info", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", - "test-utils", -] - [[package]] name = "pallet-liquidity-mining" version = "4.3.1" @@ -7688,7 +7648,7 @@ dependencies = [ "orml-traits", "pallet-balances", "pallet-ema-oracle", - "pallet-liquidity-mining 4.3.1", + "pallet-liquidity-mining", "pallet-omnipool", "parity-scale-codec", "primitive-types", @@ -7994,7 +7954,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -8293,7 +8253,8 @@ dependencies = [ [[package]] name = "pallet-xyk" -version = "6.3.4" +version = "6.4.1" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" dependencies = [ "frame-benchmarking", "frame-support", @@ -8303,15 +8264,11 @@ dependencies = [ "log", "orml-tokens", "orml-traits", - "pallet-asset-registry 2.3.3", "parity-scale-codec", "primitive-types", - "proptest", "scale-info", "serde", - "sp-api", "sp-core", - "sp-io", "sp-runtime", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2)", "substrate-wasm-builder", @@ -8329,7 +8286,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", - "pallet-liquidity-mining 4.2.5", + "pallet-liquidity-mining", "pallet-nft", "pallet-xyk", "parity-scale-codec", @@ -8356,7 +8313,7 @@ dependencies = [ "pallet-asset-registry 2.3.3", "pallet-balances", "pallet-duster", - "pallet-liquidity-mining 4.2.5", + "pallet-liquidity-mining", "pallet-nft", "pallet-uniques", "pallet-xyk", @@ -8598,7 +8555,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -8639,7 +8596,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -9793,7 +9750,7 @@ dependencies = [ "polkavm-common", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -9803,7 +9760,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ba81f7b5faac81e528eb6158a6f3c9e0bb1008e0ffa19653bc8dea925ecb429" dependencies = [ "polkavm-derive-impl", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -9832,7 +9789,7 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite 0.2.14", - "rustix 0.38.32", + "rustix 0.38.33", "tracing", "windows-sys 0.52.0", ] @@ -9915,7 +9872,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22020dfcf177fcc7bf5deaf7440af371400c67c0de14c399938d8ed4fb4645d3" dependencies = [ "proc-macro2", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -9945,7 +9902,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550" dependencies = [ "proc-macro2", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -10072,14 +10029,14 @@ checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] name = "proc-macro2" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] @@ -10118,27 +10075,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", -] - -[[package]] -name = "proptest" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" -dependencies = [ - "bit-set", - "bit-vec", - "bitflags 2.5.0", - "lazy_static", - "num-traits", - "rand", - "rand_chacha 0.3.1", - "rand_xorshift", - "regex-syntax 0.8.3", - "rusty-fork", - "tempfile", - "unarray", + "syn 2.0.60", ] [[package]] @@ -10206,7 +10143,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -10367,15 +10304,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "rand_xorshift" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" -dependencies = [ - "rand_core 0.6.4", -] - [[package]] name = "rawpointer" version = "0.2.1" @@ -10472,7 +10400,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -10952,9 +10880,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.32" +version = "0.38.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" +checksum = "e3cc72858054fcff6d7dea32df2aeaee6a7c24227366d7ea429aada2f26b16ad" dependencies = [ "bitflags 2.5.0", "errno", @@ -10977,9 +10905,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.10" +version = "0.21.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" dependencies = [ "log", "ring 0.17.8", @@ -11024,18 +10952,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" -[[package]] -name = "rusty-fork" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" -dependencies = [ - "fnv", - "quick-error", - "tempfile", - "wait-timeout", -] - [[package]] name = "ruzstd" version = "0.4.0" @@ -11193,7 +11109,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -12167,7 +12083,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -12430,9 +12346,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" dependencies = [ "serde_derive", ] @@ -12448,13 +12364,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -12552,9 +12468,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -12834,7 +12750,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -13074,7 +12990,7 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" +source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -13111,7 +13027,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "quote", "sp-crypto-hashing", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -13130,17 +13046,17 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" +source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -13157,7 +13073,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" +source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" dependencies = [ "environmental", "parity-scale-codec", @@ -13375,7 +13291,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" +source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -13401,20 +13317,20 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" +source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" dependencies = [ "Inflector", "expander 2.1.0", "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -13500,7 +13416,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" +source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" [[package]] name = "sp-storage" @@ -13518,7 +13434,7 @@ dependencies = [ [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" +source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13555,7 +13471,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" +source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" dependencies = [ "parity-scale-codec", "tracing", @@ -13636,7 +13552,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -13655,7 +13571,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#61d45ed72b2f8afade997e1a973327f2ada02aa0" +source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" dependencies = [ "impl-trait-for-tuples", "log", @@ -13897,7 +13813,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -14028,9 +13944,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.59" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", @@ -14090,7 +14006,7 @@ checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand 2.0.2", - "rustix 0.38.32", + "rustix 0.38.33", "windows-sys 0.52.0", ] @@ -14109,7 +14025,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ - "rustix 0.38.32", + "rustix 0.38.33", "windows-sys 0.48.0", ] @@ -14137,7 +14053,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -14148,7 +14064,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", "test-case-core", ] @@ -14163,9 +14079,9 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] @@ -14187,18 +14103,18 @@ checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -14342,7 +14258,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -14362,7 +14278,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.10", + "rustls 0.21.11", "tokio", ] @@ -14423,7 +14339,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.9", + "toml_edit 0.22.12", ] [[package]] @@ -14472,9 +14388,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.9" +version = "0.22.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" +checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" dependencies = [ "indexmap 2.2.6", "serde", @@ -14548,7 +14464,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -14591,7 +14507,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -14818,12 +14734,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "unarray" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" - [[package]] name = "unicode-bidi" version = "0.3.15" @@ -14956,15 +14866,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "wait-timeout" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" -dependencies = [ - "libc", -] - [[package]] name = "waker-fn" version = "1.1.1" @@ -15032,7 +14933,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", "wasm-bindgen-shared", ] @@ -15066,7 +14967,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -15184,9 +15085,9 @@ dependencies = [ [[package]] name = "wasmparser-nostd" -version = "0.100.1" +version = "0.100.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9157cab83003221bfd385833ab587a039f5d6fa7304854042ba358a3b09e0724" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" dependencies = [ "indexmap-nostd", ] @@ -15546,7 +15447,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.32", + "rustix 0.38.33", ] [[package]] @@ -15949,7 +15850,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -15998,7 +15899,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -16018,7 +15919,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.59", + "syn 2.0.60", ] [[package]] @@ -16069,11 +15970,6 @@ dependencies = [ "pkg-config", ] -[[patch.unused]] -name = "orml-currencies" -version = "0.8.0" -source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" - [[patch.unused]] name = "sp-core-hashing" version = "15.0.0" @@ -16083,3 +15979,8 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot name = "sp-crypto-ec-utils" version = "0.10.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" + +[[patch.unused]] +name = "orml-currencies" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/Cargo.toml b/Cargo.toml index 9762a830240..f4927976649 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,9 @@ members = [ 'node', 'runtime/basilisk', 'pallets/marketplace', - 'pallets/xyk', + #'pallets/xyk', 'pallets/asset-registry', - 'pallets/liquidity-mining', + #'pallets/liquidity-mining', 'pallets/xyk-liquidity-mining', 'pallets/xyk-liquidity-mining/benchmarking', 'integration-tests', @@ -23,11 +23,11 @@ log = "0.4.20" basilisk-runtime = { path = "runtime/basilisk", default-features = false } pallet-marketplace = { path = "pallets/marketplace", default-features = false} -pallet-xyk = { path = "pallets/xyk", default-features = false} +#pallet-xyk = { path = "pallets/xyk", default-features = false} pallet-asset-registry = { path = "pallets/asset-registry", default-features = false} pallet-xyk-liquidity-mining = { path = "pallets/xyk-liquidity-mining", default-features = false} -warehouse-liquidity-mining = { package = "pallet-liquidity-mining", path = "pallets/liquidity-mining", default-features = false} -pallet-liquidity-mining = { path = "pallets/liquidity-mining", default-features = false} +#warehouse-liquidity-mining = { package = "pallet-liquidity-mining", path = "pallets/liquidity-mining", default-features = false} +#pallet-liquidity-mining = { path = "pallets/liquidity-mining", default-features = false} pallet-xyk-liquidity-mining-benchmarking = { path = "pallets/xyk-liquidity-mining/benchmarking", default-features = false} hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } @@ -44,6 +44,9 @@ pallet-duster = { git = "https://github.com/galacticcouncil/HydraDX-node", branc pallet-collator-rewards = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } test-utils = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } pallet-lbp = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-xyk = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +pallet-liquidity-mining = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } +warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } hydra-dx-build-script-utils = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2" } frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } diff --git a/pallets/asset-registry/src/lib.rs b/pallets/asset-registry/src/lib.rs index e8501238d9e..df512ecef5f 100644 --- a/pallets/asset-registry/src/lib.rs +++ b/pallets/asset-registry/src/lib.rs @@ -47,7 +47,7 @@ pub use pallet::*; pub use crate::types::{AssetDetails, AssetMetadata}; use frame_support::BoundedVec; -use hydradx_traits::{AssetKind, Inspect}; +use hydradx_traits::{AssetKind, Create, Inspect}; use traits::{CreateRegistry, InspectRegistry, Registry, ShareTokenRegistry}; #[frame_support::pallet] @@ -602,6 +602,7 @@ impl ShareTokenRegistry, T::Balance, DispatchErro use orml_traits::GetByKey; use sp_arithmetic::traits::Bounded; +use crate::types::{Name, Symbol}; // Return Existential deposit of an asset impl GetByKey for Pallet { @@ -690,3 +691,62 @@ impl> Inspect for Pallet { Self::assets(id).map(|a| a.existential_deposit) } } + +/// Default value of existential deposit. This value is used if existential deposit wasn't +/// provided. +pub const DEFAULT_ED: u128 = 1; + +// Dev note: this comes from new version of asset registry, but in order to support new xyk, we need to implement it here +// but we can ignore the new fields for now +impl> Create for Pallet{ + type Error = DispatchError; + type Name = Name; + type Symbol = Symbol; + + fn register_asset( + asset_id: Option, + name: Option, + kind: AssetKind, + existential_deposit: Option, + _symbol: Option, + _decimals: Option, + _location: Option, + xcm_rate_limit: Option, + _is_sufficient: bool, + ) -> Result { + let Some(asset_name) = name else { + return Err(Error::::TooLong.into()); + }; + + Self::register_asset(asset_name, + kind.into(), + existential_deposit.unwrap_or(DEFAULT_ED), + asset_id, + xcm_rate_limit, + ) + + } + + fn get_or_register_asset( + name: Self::Name, + kind: AssetKind, + existential_deposit: Option, + _symbol: Option, + _decimals: Option, + _location: Option, + xcm_rate_limit: Option, + _is_sufficient: bool, + ) -> Result { + match Self::asset_ids(&name) { + Some(id) => Ok(id), + None => { + Self::register_asset(name, + kind.into(), + existential_deposit.unwrap_or(DEFAULT_ED), + None, + xcm_rate_limit, + ) + } + } + } +} \ No newline at end of file diff --git a/pallets/asset-registry/src/types.rs b/pallets/asset-registry/src/types.rs index ccbbd0c5b2a..d5cb837b58c 100644 --- a/pallets/asset-registry/src/types.rs +++ b/pallets/asset-registry/src/types.rs @@ -23,6 +23,10 @@ use hydradx_traits::AssetKind; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; + +pub type Name = BoundedVec; +pub type Symbol = BoundedVec; + #[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum AssetType { diff --git a/pallets/liquidity-mining/Cargo.toml b/pallets/liquidity-mining/Cargo.toml deleted file mode 100644 index 740d141971d..00000000000 --- a/pallets/liquidity-mining/Cargo.toml +++ /dev/null @@ -1,62 +0,0 @@ -[package] -name = "pallet-liquidity-mining" -version = "4.2.5" -description = "Liquidity mining" -authors = ["GalacticCouncil"] -edition = "2021" -homepage = "https://github.com/galacticcouncil/warehouse" -license = "Apache 2.0" -repository = "https://github.com/galacticcouncil/warehouse" - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -codec = { package = "parity-scale-codec", version = "3.4.0", features = ["derive", "max-encoded-len"], default-features = false } -scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-arithmetic = { workspace = true } - -pallet-asset-registry = { workspace = true } - -# ORML dependencies -orml-traits = { workspace = true } - -# HydraDX dependencies -hydradx-traits = { workspace = true } -hydra-dx-math = { workspace = true } - -# Substrate dependencies -frame-support = { workspace = true } -frame-system = { workspace = true } -sp-runtime = { workspace = true } -sp-std = { workspace = true } - -[dev-dependencies] -test-utils = { workspace = true } -sp-io = { workspace = true } -sp-core = { workspace = true } -orml-tokens = { workspace = true } -pallet-balances = { workspace = true } -# This can be updated to lates after rust update(>=1.61) -fixed = { version = "=1.15.0", default-features = false } -proptest = "1.0.0" -pretty_assertions = "1.2.1" -rand = "0.8.5" - -[features] -default = ["std"] -std = [ - "codec/std", - "frame-support/std", - "frame-system/std", - "sp-std/std", - "orml-traits/std", - "orml-tokens/std", - "pallet-balances/std", - "hydradx-traits/std", - "sp-arithmetic/std", - "sp-runtime/std", - "scale-info/std", - "hydra-dx-math/std", -] -try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/liquidity-mining/src/lib.rs b/pallets/liquidity-mining/src/lib.rs deleted file mode 100644 index 34120ea4c06..00000000000 --- a/pallets/liquidity-mining/src/lib.rs +++ /dev/null @@ -1,1914 +0,0 @@ -// This file is part of galacticcouncil/warehouse. -// 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. -// -// Abbr: -// rpvs - reward per valued share -// rpz - reward per share in global farm - -// Notion spec naming map: -// * shares -> s -// * total_shares -> S -// * valued_shares -> s' -// * total_valued_shares -> S' -// * stake_in_global_pool -> z -// * total_shares_z -> Z -// * multiplier -> m - -//! # Liquidity mining pallet -//! -//! ## Overview -//! -//! This pallet provides functionality for a liquidity mining program with a time incentive (loyalty -//! factor) and multiple incentives scheme. -//! Users are rewarded for each period they stay in the liq. mining program. -//! -//! Reward per one period is derived from the user's loyalty factor which grows with time (periods) -//! the user is in the liq. mining program and the amount of LP shares the user locked into deposit. -//! User's loyalty factor is reset if the user exits and reenters liquidity mining. -//! User can claim rewards without resetting loyalty factor, only withdrawing shares -//! is penalized by loyalty factor reset. -//! The user is rewarded from the next period after they enters. -//! -//! Multiple Incentives -//! -//! This feature allows users to redeposit already deposited LP shares to multiple yield farms and -//! receive incentives from these farms. -//! Deposit in yield farm is called "farm entry". -//! Maximal number of redepositing same LP shares is configured by variable: `MaxFarmEntriesPerDeposit`. -//! Set `MaxFarmEntriesPerDeposit` to `1` to disable multiple incentives scheme. !!!NEVER set this -//! variable to `0`. -//! LP shares can be redeposited only to different yield farms running liquidity mining for same -//! pair of assets. -//! -//! Notes: -//! * LP shares are returned ONLY if deposit is destroyed - withdrawing LP shares can -//! be used to "free slot" for re-lock LP shares to different yield farm. Withdrawing LP shares result in -//! resetting loyalty factor for yield farm user is withdrawing from(other farm entries in the -//! deposit are not affected). If deposit has no more farm entries, deposit is destroyed and LP -//! shares are returned back to user. -//! * `YieldFarm` - can be in the 3 states: [`Active`, `Stopped`, `Terminated`] -//! * `Active` - liquidity mining is running, users are able to deposit, claim and withdraw LP -//! shares. `YieldFarm` is rewarded from `GlobalFarm` in this state. -//! * `Stopped` - liquidity mining is stopped. Users can claim and withdraw LP shares from the -//! farm. Users CAN'T deposit new LP shares to stopped farm. Stopped farm is not rewarded from the -//! `GlobalFarm`. -//! Note: stopped farm can be resumed or destroyed. -//! * `Terminated` - liquidity mining is ended. User's CAN'T deposit or claim rewards from -//! stopped farm. Users CAN only withdraw LP shares(without rewards). -//! `YieldFarm` must be stopped before it can be terminated. Terminated farm stays in the storage -//! until last farm's entry is withdrawn. Last withdrawn from yield farm will remove terminated -//! farm from the storage. -//! Note: Terminated farm CAN'T be resumed. -//! * `GlobalFarm` - can be in the 2 states: [`Active`, `Terminated`] -//! * `Active` - liquidity mining program is running, new yield farms can be added to the -//! global farm. -//! * `Terminated` - liquidity mining program is ended. Yield farms can't be added to the global -//! farm. Global farm MUST be empty(all yield farms in the global farm must be destroyed) -//! before it can be destroyed. Destroying global farm transfer undistributed rewards to farm's -//! owner. Terminated global farm stay in the storage until all yield farms are removed from -//! the storage. Last yield farm removal from storage triggers global farm removal from -//! storage. -//! Note: Terminated global farm CAN'T be resumed. -//! * Pot - account holding all rewards allocated for all `YieldFarm`s from all `GlobalFarm`s. -//! User's rewards are transferred from `pot`'s account to user's accounts. -//! - -#![cfg_attr(not(feature = "std"), no_std)] -#![allow(clippy::derive_partial_eq_without_eq)] - -#[cfg(test)] -mod tests; -mod types; - -pub use pallet::*; - -pub use crate::types::{ - Balance, DefaultPriceAdjustment, DepositData, DepositId, FarmId, FarmMultiplier, FarmState, GlobalFarmData, - GlobalFarmId, LoyaltyCurve, YieldFarmData, YieldFarmEntry, YieldFarmId, -}; -use codec::{Decode, Encode, FullCodec}; -use frame_support::{ - defensive, - pallet_prelude::*, - require_transactional, - sp_runtime::{ - traits::{AccountIdConversion, BlockNumberProvider, MaybeSerializeDeserialize, One, Zero}, - RuntimeDebug, - }, - traits::{Defensive, DefensiveOption}, - PalletId, -}; - -use frame_system::pallet_prelude::BlockNumberFor; -use sp_runtime::ArithmeticError; - -use hydra_dx_math::liquidity_mining as math; -use hydradx_traits::{liquidity_mining::PriceAdjustment, pools::DustRemovalAccountWhitelist}; -use pallet_asset_registry::traits::Registry; -use orml_traits::{GetByKey, MultiCurrency}; -use scale_info::TypeInfo; -use sp_arithmetic::{ - fixed_point::FixedU128, - traits::{CheckedAdd, CheckedDiv, CheckedSub}, - Perquintill, -}; -use sp_std::{ - convert::{From, Into, TryInto}, - vec::Vec, -}; - -type PeriodOf = BlockNumberFor; - -//WARN: MIN_YIELD_FARM_MULTIPLIER.check_mul_int(MIN_DEPOSIT) >= 1. This rule is important otherwise -//non-zero deposit can result in a zero stake in global-farm and farm can be falsely identified as -//empty. https://github.com/galacticcouncil/warehouse/issues/127 -/// Min value farm's owner can set as `min_deposit` -pub(crate) const MIN_DEPOSIT: Balance = 1_000; -/// Min value farm's owner can set as yield-farm's `multiplier` -pub(crate) const MIN_YIELD_FARM_MULTIPLIER: FixedU128 = FixedU128::from_inner(1_000_000_000_000_000); - -#[frame_support::pallet] -pub mod pallet { - use super::*; - - #[pallet::pallet] - pub struct Pallet(PhantomData<(T, I)>); - - #[pallet::hooks] - impl, I: 'static> Hooks> for Pallet { - fn integrity_test() { - assert!( - T::MaxFarmEntriesPerDeposit::get().ge(&1_u32), - "`T::MaxFarmEntriesPerDeposit` must be greater or equal to 1" - ); - } - } - - #[pallet::genesis_config] - #[derive(frame_support::DefaultNoBound)] - pub struct GenesisConfig, I: 'static = ()> { - #[serde(skip)] - pub _phantom: PhantomData<(T, I)>, - } - - #[pallet::genesis_build] - impl, I: 'static> BuildGenesisConfig for GenesisConfig { - fn build(&self) { - let pot = >::pot_account_id().unwrap(); - - T::NonDustableWhitelistHandler::add_account(&pot).unwrap(); - } - } - - #[pallet::config] - pub trait Config: frame_system::Config + TypeInfo { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - - /// Asset type. - type AssetId: Parameter + Member + Copy + MaybeSerializeDeserialize + MaxEncodedLen + Into; - - /// Currency for transfers. - type MultiCurrency: MultiCurrency; - - /// Pallet id. - #[pallet::constant] - type PalletId: Get; - - /// Minimum total rewards to distribute from global farm during liquidity mining. - #[pallet::constant] - type MinTotalFarmRewards: Get; - - /// Minimum number of periods to run liquidity mining program. - #[pallet::constant] - type MinPlannedYieldingPeriods: Get>; - - /// The block number provider - type BlockNumberProvider: BlockNumberProvider>; - - /// Id used to identify amm pool in liquidity mining pallet. - type AmmPoolId: Parameter + Member + Clone + FullCodec + MaxEncodedLen; - - /// Maximum number of yield farms same LP shares can be re/deposited into. This value always - /// MUST BE >= 1. - #[pallet::constant] - type MaxFarmEntriesPerDeposit: Get; - - /// Max number of yield farms can exist in global farm. This includes all farms in the - /// storage(active, stopped, terminated). - #[pallet::constant] - type MaxYieldFarmsPerGlobalFarm: Get; - - /// Asset Registry - used to check if asset is correctly registered in asset registry and - /// provides information about existential deposit of the asset. - type AssetRegistry: Registry, Balance, DispatchError> + GetByKey; - - /// Account whitelist manager to exclude pool accounts from dusting mechanism. - type NonDustableWhitelistHandler: DustRemovalAccountWhitelist; - - type PriceAdjustment: PriceAdjustment< - GlobalFarmData, - Error = DispatchError, - PriceAdjustment = FixedU128, - >; - } - - #[pallet::error] - #[cfg_attr(test, derive(Eq, PartialEq))] - pub enum Error { - /// Global farm does not exist. - GlobalFarmNotFound, - - /// Yield farm does not exist. - YieldFarmNotFound, - - /// Multiple claims in the same period is not allowed. - DoubleClaimInPeriod, - - /// Liquidity mining is canceled. - LiquidityMiningCanceled, - - /// Liquidity mining is not canceled. - LiquidityMiningIsActive, - - /// Liquidity mining is in `active` or `terminated` state and action cannot be completed. - LiquidityMiningIsNotStopped, - - /// LP shares amount is not valid. - InvalidDepositAmount, - - /// Account is not allowed to perform action. - Forbidden, - - /// Yield farm multiplier can't be 0. - InvalidMultiplier, - - /// Yield farm with given `amm_pool_id` already exists in global farm. - YieldFarmAlreadyExists, - - /// Loyalty curve's initial reward percentage is not valid. Valid range is: [0, 1). - InvalidInitialRewardPercentage, - - /// One or more yield farms exist in global farm. - GlobalFarmIsNotEmpty, - - /// Farm's `incentivized_asset` is missing in provided asset pair. - MissingIncentivizedAsset, - - /// Reward currency balance is not sufficient. - InsufficientRewardCurrencyBalance, - - /// Blocks per period can't be 0. - InvalidBlocksPerPeriod, - - /// Yield per period can't be 0. - InvalidYieldPerPeriod, - - /// Total rewards is less than `MinTotalFarmRewards`. - InvalidTotalRewards, - - /// Planned yielding periods is less than `MinPlannedYieldingPeriods`. - InvalidPlannedYieldingPeriods, - - /// Maximum number of locks reached for deposit. - MaxEntriesPerDeposit, - - /// Trying to lock LP shares into already locked yield farm. - DoubleLock, - - /// Yield farm entry doesn't exist for given deposit. - YieldFarmEntryNotFound, - - /// Max number of yield farms in global farm was reached. Global farm can't accept new - /// yield farms until some yield farm is not removed from storage. - GlobalFarmIsFull, - - /// Invalid min. deposit was set for global farm. - InvalidMinDeposit, - - /// Price adjustment multiplier can't be 0. - InvalidPriceAdjustment, - - /// Account creation from id failed. - ErrorGetAccountId, - - /// Value of deposited shares amount in reward currency is bellow min. limit. - IncorrectValuedShares, - - /// `reward_currency` is not registered in asset registry. - RewardCurrencyNotRegistered, - - /// `incentivized_asset` is not registered in asset registry. - IncentivizedAssetNotRegistered, - - /// Action cannot be completed because unexpected error has occurred. This should be reported - /// to protocol maintainers. - InconsistentState(InconsistentStateError), - } - - //NOTE: these errors should never happen. - #[derive(Encode, Decode, Eq, PartialEq, TypeInfo, frame_support::PalletError, RuntimeDebug)] - pub enum InconsistentStateError { - /// Yield farm does not exist. - YieldFarmNotFound, - - /// Global farm does not exist. - GlobalFarmNotFound, - - /// Liquidity mining is `stopped` or `terminated`. - LiquidityIsNotActive, - - /// Global farm is terminated. - GlobalFarmIsNotActive, - - /// Deposit does not exist. - DepositNotFound, - - /// Period calculation overflow. - InvalidPeriod, - - /// Rewards allocated for yield-farm are lower then calculated rewards. - NotEnoughRewardsInYieldFarm, - - /// Global-farm's `live_yield_farms_count` calculation overflow. - InvalidLiveYielFarmsCount, - - /// Global-farm's `total_yield_farms_count` calculation overflow. - InvalidTotalYieldFarmsCount, - - /// Yield-farm's entries count calculation overflow. - InvalidYieldFarmEntriesCount, - - /// Yield-farm's `total_shares` calculation overflow. - InvalidTotalShares, - - /// Yield-farm's `valued_shares` calculation overflow. - InvalidValuedShares, - - /// Global-farm's `total_shares_z` calculation overflow. - InvalidTotalSharesZ, - - /// Global-farm's `paid_accumulated_rewards` calculation overflow. - InvalidPaidAccumulatedRewards, - - /// `FarmId` can't be 0. - InvalidFarmId, - - /// Loyalty multiplier can't be greater than one. - InvalidLoyaltyMultiplier, - } - - impl From for Error { - fn from(e: InconsistentStateError) -> Error { - Error::::InconsistentState(e) - } - } - - /// Id sequencer for `GlobalFarm` and `YieldFarm`. - #[pallet::storage] - #[pallet::getter(fn last_farm_id)] - pub type FarmSequencer, I: 'static = ()> = StorageValue<_, FarmId, ValueQuery>; - - #[pallet::storage] - #[pallet::getter(fn deposit_id)] - pub type DepositSequencer, I: 'static = ()> = StorageValue<_, DepositId, ValueQuery>; - - #[pallet::storage] - #[pallet::getter(fn global_farm)] - pub type GlobalFarm, I: 'static = ()> = - StorageMap<_, Blake2_128Concat, GlobalFarmId, GlobalFarmData, OptionQuery>; - - /// Yield farm details. - #[pallet::storage] - #[pallet::getter(fn yield_farm)] - pub type YieldFarm, I: 'static = ()> = StorageNMap< - _, - ( - NMapKey, - NMapKey, - NMapKey, - ), - YieldFarmData, - OptionQuery, - >; - - /// Deposit details. - #[pallet::storage] - #[pallet::getter(fn deposit)] - pub type Deposit, I: 'static = ()> = - StorageMap<_, Twox64Concat, DepositId, DepositData, OptionQuery>; - - /// Active(farms able to receive LP shares deposits) yield farms. - #[pallet::storage] - #[pallet::getter(fn active_yield_farm)] - pub type ActiveYieldFarm, I: 'static = ()> = - StorageDoubleMap<_, Blake2_128Concat, T::AmmPoolId, Blake2_128Concat, GlobalFarmId, YieldFarmId>; - - #[pallet::event] - #[pallet::generate_deposit(pub(crate) fn deposit_event)] - pub enum Event, I: 'static = ()> { - /// Global farm accumulated reward per share was updated. - GlobalFarmAccRPZUpdated { - global_farm_id: GlobalFarmId, - accumulated_rpz: FixedU128, - total_shares_z: Balance, - }, - - /// Yield farm accumulated reward per valued share was updated. - YieldFarmAccRPVSUpdated { - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - accumulated_rpvs: FixedU128, - total_valued_shares: Balance, - }, - - /// Global farm has no more rewards to distribute in the moment. - AllRewardsDistributed { global_farm_id: GlobalFarmId }, - } - - #[pallet::call] - impl, I: 'static> Pallet {} -} - -impl, I: 'static> Pallet { - /// Create a new liquidity mining program with provided parameters. - /// - /// `owner` account has to have at least `total_rewards` balance. These funds will be - /// transferred from `owner` to farm account. - /// - /// Returns: `(GlobalFarmId, max reward per period)` - /// - /// Parameters: - /// - `total_rewards`: total rewards planned to distribute. These rewards will be - /// distributed between all yield farms in the global farm. - /// - `planned_yielding_periods`: planned number of periods to distribute `total_rewards`. - /// WARN: THIS IS NOT HARD DEADLINE. Not all rewards have to be distributed in - /// `planned_yielding_periods`. Rewards are distributed based on the situation in the yield - /// farm and can be distributed in a longer, though never in a shorter, time frame. - /// - `blocks_per_period`: number of blocks in a single period. Min. number of blocks per - /// period is 1. - /// - `incentivized_asset`: asset to be incentivized in AMM pools. All yield farms added into - /// global farm must to have `incentivized_asset` in their pair. - /// - `reward_currency`: payoff currency of rewards. - /// - `owner`: liq. mining farm owner. - /// - `yield_per_period`: percentage return on `reward_currency` of all pools. - /// - `min_deposit`: minimum amount of LP shares to be deposited into liquidity mining by each user. - /// - `price_adjustment`: price adjustment between `incentivized_asset` and `reward_currency`. - /// This value should be `1` if `incentivized_asset` and `reward_currency` are the same. - #[allow(clippy::too_many_arguments)] - #[require_transactional] - fn create_global_farm( - total_rewards: Balance, - planned_yielding_periods: PeriodOf, - blocks_per_period: BlockNumberFor, - incentivized_asset: T::AssetId, - reward_currency: T::AssetId, - owner: T::AccountId, - yield_per_period: Perquintill, - min_deposit: Balance, - price_adjustment: FixedU128, - ) -> Result<(GlobalFarmId, Balance), DispatchError> { - Self::validate_create_global_farm_data( - total_rewards, - planned_yielding_periods, - blocks_per_period, - yield_per_period, - min_deposit, - price_adjustment, - )?; - - ensure!( - T::AssetRegistry::exists(reward_currency), - Error::::RewardCurrencyNotRegistered - ); - ensure!( - T::AssetRegistry::exists(incentivized_asset), - Error::::IncentivizedAssetNotRegistered - ); - - T::MultiCurrency::ensure_can_withdraw(reward_currency, &owner, total_rewards) - .map_err(|_| Error::::InsufficientRewardCurrencyBalance)?; - - let planned_periods = - TryInto::::try_into(planned_yielding_periods).map_err(|_| ArithmeticError::Overflow)?; - let max_reward_per_period = total_rewards - .checked_div(planned_periods) - .ok_or(ArithmeticError::DivisionByZero)?; - let current_period = Self::get_current_period(blocks_per_period)?; - let farm_id = Self::get_next_farm_id()?; - - let global_farm = GlobalFarmData::new( - farm_id, - current_period, - reward_currency, - yield_per_period, - planned_yielding_periods, - blocks_per_period, - owner, - incentivized_asset, - max_reward_per_period, - min_deposit, - price_adjustment, - ); - - >::insert(global_farm.id, &global_farm); - - let global_farm_account = Self::farm_account_id(global_farm.id)?; - - T::NonDustableWhitelistHandler::add_account(&global_farm_account)?; - T::MultiCurrency::transfer(reward_currency, &global_farm.owner, &global_farm_account, total_rewards)?; - - Ok((farm_id, max_reward_per_period)) - } - - /// Update global farm's price adjustment. - /// - /// Only farm's owner can perform this action. - /// - /// Parameters: - /// - `who`: farm's owner - /// - `global_farm_id`: global farm id. - /// - `price_adjustment`: new price adjustment value. - fn update_global_farm_price_adjustment( - who: T::AccountId, - global_farm_id: GlobalFarmId, - price_adjustment: FixedU128, - ) -> Result<(), DispatchError> { - ensure!(!price_adjustment.is_zero(), Error::::InvalidPriceAdjustment); - - >::try_mutate(global_farm_id, |maybe_global_farm| { - let global_farm = maybe_global_farm.as_mut().ok_or(Error::::GlobalFarmNotFound)?; - - ensure!(global_farm.state.is_active(), Error::::GlobalFarmNotFound); - - ensure!(who == global_farm.owner, Error::::Forbidden); - - let current_period = Self::get_current_period(global_farm.blocks_per_period)?; - Self::sync_global_farm(global_farm, current_period)?; - - global_farm.price_adjustment = price_adjustment; - - Ok(()) - }) - } - - /// Terminate existing liquidity mining program. Undistributed rewards are transferred to - /// owner(`who`). - /// - /// Only farm's owner can perform this action. - /// - /// WARN: To successfully terminate a global farm, farm have to be empty(all yield farms in the - /// global farm must be terminated) - /// - /// Returns: `(reward currency, undistributed rewards, destination account)` - /// - /// Parameters: - /// - `who`: farm's owner. - /// - `farm_id`: id of farm to be terminated. - #[require_transactional] - fn terminate_global_farm( - who: T::AccountId, - farm_id: GlobalFarmId, - ) -> Result<(T::AssetId, Balance, T::AccountId), DispatchError> { - >::try_mutate_exists(farm_id, |maybe_global_farm| { - let global_farm = maybe_global_farm.as_mut().ok_or(Error::::GlobalFarmNotFound)?; - - ensure!(who == global_farm.owner, Error::::Forbidden); - - ensure!(global_farm.state.is_active(), Error::::GlobalFarmNotFound); - - ensure!(!global_farm.has_live_farms(), Error::::GlobalFarmIsNotEmpty); - - let global_farm_account = Self::farm_account_id(global_farm.id)?; - let undistributed_rewards = - T::MultiCurrency::free_balance(global_farm.reward_currency, &global_farm_account); - - T::MultiCurrency::transfer( - global_farm.reward_currency, - &global_farm_account, - &who, - undistributed_rewards, - )?; - - //Mark for removal from storage on last `YieldFarm` in the farm removed. - global_farm.state = FarmState::Terminated; - - //NOTE: Nothing can be send to this account because `YieldFarm`'s has to be terminated - //first so it can be dusted. - T::NonDustableWhitelistHandler::remove_account(&global_farm_account)?; - - let reward_currency = global_farm.reward_currency; - if global_farm.can_be_removed() { - *maybe_global_farm = None; - } - - Ok((reward_currency, undistributed_rewards, who)) - }) - } - - /// Add yield farm to global farm and start liquidity mining for given assets pair. - /// - /// Only farm owner can perform this action. - /// - /// One of the AMM assets has to be `incentivized_token`. Same AMM can be - /// in the same farm only once. - /// - /// Returns: `(YieldFarmId)` - /// - /// Parameters: - /// - `who`: farm's owner - /// - `global_farm_id`: farm id to which a yield farm will be added. - /// - `multiplier`: yield farm multiplier. - /// - `loyalty_curve`: curve to calculate loyalty multiplier to distribute rewards to users - /// with time incentive. `None` means no loyalty multiplier. - /// - `amm_pool_id`: identifier of the AMM pool. - /// - `assets`: list of assets in the AMM pool. One of this assets must be incentivized asset - #[require_transactional] - fn create_yield_farm( - who: T::AccountId, - global_farm_id: GlobalFarmId, - multiplier: FarmMultiplier, - loyalty_curve: Option, - amm_pool_id: T::AmmPoolId, - assets: Vec, - ) -> Result { - ensure!( - multiplier >= MIN_YIELD_FARM_MULTIPLIER, - Error::::InvalidMultiplier - ); - - if let Some(ref curve) = loyalty_curve { - ensure!( - curve.initial_reward_percentage.lt(&FixedU128::one()), - Error::::InvalidInitialRewardPercentage - ); - } - - >::try_mutate( - global_farm_id, - |maybe_global_farm| -> Result { - let global_farm = maybe_global_farm.as_mut().ok_or(Error::::GlobalFarmNotFound)?; - - //This is basically same as farm not found. - ensure!(global_farm.state.is_active(), Error::::GlobalFarmNotFound); - - ensure!(who == global_farm.owner, Error::::Forbidden); - - ensure!(!global_farm.is_full(), Error::::GlobalFarmIsFull); - - ensure!( - assets.contains(&global_farm.incentivized_asset), - Error::::MissingIncentivizedAsset - ); - - >::try_mutate(amm_pool_id.clone(), global_farm_id, |maybe_active_yield_farm| { - ensure!(maybe_active_yield_farm.is_none(), Error::::YieldFarmAlreadyExists); - - let current_period = Self::get_current_period(global_farm.blocks_per_period)?; - Self::sync_global_farm(global_farm, current_period)?; - - let yield_farm_id = Self::get_next_farm_id()?; - - let yield_farm = - YieldFarmData::new(yield_farm_id, current_period, loyalty_curve.clone(), multiplier); - - >::insert((amm_pool_id, global_farm_id, yield_farm_id), yield_farm); - global_farm.increase_yield_farm_counts()?; - - *maybe_active_yield_farm = Some(yield_farm_id); - - Ok(yield_farm_id) - }) - }, - ) - } - - /// Update yield farm's multiplier. - /// - /// Only farm's owner can perform this action. - /// - /// Returns: `(YieldFarmId)` - /// - /// Parameters: - /// - `who`: farm's owner - /// - `global_farm_id`: global farm id in which yield farm will be updated. - /// - `multiplier`: new yield farm multiplier. - /// - `amm_pool_id`: identifier of the AMM pool. - #[require_transactional] - fn update_yield_farm_multiplier( - who: T::AccountId, - global_farm_id: GlobalFarmId, - amm_pool_id: T::AmmPoolId, - multiplier: FarmMultiplier, - ) -> Result { - ensure!( - multiplier >= MIN_YIELD_FARM_MULTIPLIER, - Error::::InvalidMultiplier - ); - - let yield_farm_id = - Self::active_yield_farm(amm_pool_id.clone(), global_farm_id).ok_or(Error::::YieldFarmNotFound)?; - - >::try_mutate((amm_pool_id, global_farm_id, yield_farm_id), |maybe_yield_farm| { - //NOTE: yield-farm must exist if it's in the active_yield_farm storage. - let yield_farm = maybe_yield_farm - .as_mut() - .defensive_ok_or::>(InconsistentStateError::YieldFarmNotFound.into())?; - - ensure!(yield_farm.state.is_active(), Error::::LiquidityMiningCanceled); - - >::try_mutate(global_farm_id, |maybe_global_farm| { - //NOTE: global-farm must exist if yield-farm exists. - let global_farm = maybe_global_farm - .as_mut() - .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; - - ensure!(who == global_farm.owner, Error::::Forbidden); - - let old_stake_in_global_farm = - math::calculate_global_farm_shares(yield_farm.total_valued_shares, yield_farm.multiplier) - .map_err(|_| ArithmeticError::Overflow)?; - - let current_period = Self::get_current_period(global_farm.blocks_per_period)?; - Self::sync_global_farm(global_farm, current_period)?; - Self::sync_yield_farm(yield_farm, global_farm, current_period)?; - - let new_stake_in_global_farm = - math::calculate_global_farm_shares(yield_farm.total_valued_shares, multiplier) - .map_err(|_| ArithmeticError::Overflow)?; - - global_farm.remove_stake(old_stake_in_global_farm)?; - global_farm.add_stake(new_stake_in_global_farm)?; - - yield_farm.multiplier = multiplier; - - Ok(yield_farm.id) - }) - }) - } - - /// Stop liquidity mining for specific yield farm. - /// - /// This function claims rewards from `GlobalFarm` for the last time and stops yield farm - /// incentivization from a `GlobalFarm`. Users will be able to only claim and withdraw LP - /// shares after calling this function. - /// `deposit_lp_shares()` is not allowed on stopped yield farm. - /// - /// Returns: `(YieldFarmId)` - /// - /// Only farm owner can perform this action. - /// - /// Parameters: - /// - `who`: farm's owner. - /// - `global_farm_id`: farm id in which yield farm will be stopped. - /// - `amm_pool_id`: identifier of the AMM pool. - #[require_transactional] - fn stop_yield_farm( - who: T::AccountId, - global_farm_id: GlobalFarmId, - amm_pool_id: T::AmmPoolId, - ) -> Result { - >::try_mutate_exists( - amm_pool_id.clone(), - global_farm_id, - |maybe_active_yield_farm_id| -> Result { - let yield_farm_id = maybe_active_yield_farm_id - .as_ref() - .ok_or(Error::::YieldFarmNotFound)?; - - >::try_mutate( - (amm_pool_id, global_farm_id, yield_farm_id), - |maybe_yield_farm| -> Result<(), DispatchError> { - //NOTE: yield-farm must exist if it's in the active_yield_farm storage. - let yield_farm = maybe_yield_farm - .as_mut() - .defensive_ok_or::>(InconsistentStateError::YieldFarmNotFound.into())?; - - //NOTE: inactive yield-farm can't be in the active_yield_farm storage. - ensure!( - yield_farm.state.is_active(), - Self::defensive_err(Error::::InconsistentState( - InconsistentStateError::LiquidityIsNotActive - )) - ); - - >::try_mutate(global_farm_id, |maybe_global_farm| { - //NOTE: global-farm must exist when yield-farm exists. - let global_farm = maybe_global_farm - .as_mut() - .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; - - ensure!(global_farm.owner == who, Error::::Forbidden); - - let current_period = Self::get_current_period(global_farm.blocks_per_period)?; - Self::sync_global_farm(global_farm, current_period)?; - Self::sync_yield_farm(yield_farm, global_farm, current_period)?; - - let old_stake_in_global_farm = math::calculate_global_farm_shares( - yield_farm.total_valued_shares, - yield_farm.multiplier, - ) - .map_err(|_| ArithmeticError::Overflow)?; - - global_farm.remove_stake(old_stake_in_global_farm)?; - - yield_farm.state = FarmState::Stopped; - yield_farm.multiplier = FarmMultiplier::default(); - - Ok(()) - }) - }, - )?; - - let yield_farm_id = *yield_farm_id; - //Remove yield farm from active farms storage. - *maybe_active_yield_farm_id = None; - - Ok(yield_farm_id) - }, - ) - } - - /// Resume liquidity mining for stopped yield farm. - /// - /// This function resume incentivization from `GlobalPool` and restore full functionality - /// for yield farm. Users will be able to deposit, claim and withdraw again. - /// - /// Yield farm is not rewarded for the time it was stopped. - /// - /// Only farm's owner can perform this action. - /// - /// Parameters: - /// - `who`: farm's owner - /// - `global_farm_id`: farm id in which yield farm will be resumed. - /// - `yield_farm_id`: id of yield farm to resume. - /// - `amm_pool_id`: identifier of the AMM pool. - /// - `multiplier`: yield farm's multiplier. - #[require_transactional] - fn resume_yield_farm( - who: T::AccountId, - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - amm_pool_id: T::AmmPoolId, - multiplier: FarmMultiplier, - ) -> Result<(), DispatchError> { - ensure!( - multiplier >= MIN_YIELD_FARM_MULTIPLIER, - Error::::InvalidMultiplier - ); - - >::try_mutate(amm_pool_id.clone(), global_farm_id, |maybe_active_yield_farm_id| { - ensure!( - maybe_active_yield_farm_id.is_none(), - Error::::YieldFarmAlreadyExists - ); - - >::try_mutate((amm_pool_id, global_farm_id, yield_farm_id), |maybe_yield_farm| { - let yield_farm = maybe_yield_farm.as_mut().ok_or(Error::::YieldFarmNotFound)?; - - //Active or terminated yield farms can't be resumed. - ensure!( - yield_farm.state.is_stopped(), - Error::::LiquidityMiningIsNotStopped - ); - - >::try_mutate(global_farm_id, |maybe_global_farm| { - //NOTE: global-farm must exist if yield-farm exists. - let global_farm = maybe_global_farm - .as_mut() - .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; - - ensure!(global_farm.owner == who, Error::::Forbidden); - - let current_period = Self::get_current_period(global_farm.blocks_per_period)?; - Self::sync_global_farm(global_farm, current_period)?; - - //NOTE: this should never fail. - let stopped_periods = current_period - .checked_sub(&yield_farm.updated_at) - .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into())?; - - let new_stake_in_global_farm = - math::calculate_global_farm_shares(yield_farm.total_valued_shares, multiplier) - .map_err(|_| ArithmeticError::Overflow)?; - - global_farm.add_stake(new_stake_in_global_farm)?; - - yield_farm.accumulated_rpz = global_farm.accumulated_rpz; - yield_farm.updated_at = current_period; - yield_farm.state = FarmState::Active; - yield_farm.multiplier = multiplier; - yield_farm.total_stopped = yield_farm - .total_stopped - .checked_add(&stopped_periods) - .ok_or(ArithmeticError::Overflow)?; - - //add yield farm to active farms. - *maybe_active_yield_farm_id = Some(yield_farm.id); - - Ok(()) - }) - }) - }) - } - - /// This function marks an yield farm ready for removal from storage when it's empty. Users will - /// be able to only withdraw shares(without claiming rewards from yield farm). Unpaid rewards - /// will be transferred back to global farm and will be used to distribute to other yield farms. - /// - /// Yield farm must be stopped before calling this function. - /// - /// Only farm's owner can perform this action. Yield farm stays in the storage until it's - /// empty(all farm entries are withdrawn). Last withdrawn from yield farm trigger removing from - /// the storage. - /// - /// Parameters: - /// - `who`: farm's owner. - /// - `global_farm_id`: farm id from which yield farm will be removed. - /// - `yield_farm_id`: yield farm id of farm to terminate. - /// - `amm_pool_id`: identifier of the AMM pool. - #[require_transactional] - fn terminate_yield_farm( - who: T::AccountId, - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - amm_pool_id: T::AmmPoolId, - ) -> Result<(), DispatchError> { - ensure!( - >::get(amm_pool_id.clone(), global_farm_id) != Some(yield_farm_id), - Error::::LiquidityMiningIsActive - ); - - >::try_mutate_exists(global_farm_id, |maybe_global_farm| { - let global_farm = maybe_global_farm.as_mut().ok_or(Error::::GlobalFarmNotFound)?; - - ensure!(global_farm.owner == who, Error::::Forbidden); - - >::try_mutate_exists( - (amm_pool_id, global_farm_id, yield_farm_id), - |maybe_yield_farm| -> Result<(), DispatchError> { - let yield_farm = maybe_yield_farm.as_mut().ok_or(Error::::YieldFarmNotFound)?; - - //Only stopped farms can be resumed. - ensure!( - yield_farm.state.is_stopped(), - Error::::LiquidityMiningIsNotStopped - ); - - //Transfer yield-farm's unpaid rewards back to global farm. - let global_farm_account = Self::farm_account_id(global_farm.id)?; - let pot = Self::pot_account_id().ok_or(Error::::ErrorGetAccountId)?; - - global_farm.accumulated_paid_rewards = global_farm - .accumulated_paid_rewards - .checked_sub(yield_farm.left_to_distribute) - .ok_or(ArithmeticError::Overflow)?; - - T::MultiCurrency::transfer( - global_farm.reward_currency, - &pot, - &global_farm_account, - yield_farm.left_to_distribute, - )?; - - yield_farm.left_to_distribute = Zero::zero(); - //Delete yield farm. - yield_farm.state = FarmState::Terminated; - global_farm.decrease_live_yield_farm_count()?; - - //Cleanup if it's possible - if yield_farm.can_be_removed() { - global_farm.decrease_total_yield_farm_count()?; - - *maybe_yield_farm = None; - } - - Ok(()) - }, - )?; - - Ok(()) - }) - } - - /// Deposit LP shares to a yield farm. - /// - /// This function creates new deposit farm entry in the yield farm. - /// - /// Returns: `(DepositId)` - /// - /// Parameters: - /// - `global_farm_id`: global farm identifier. - /// - `yield_farm_id`: yield farm identifier depositing to. - /// - `amm_pool_id`: identifier of the AMM pool. - /// - `shares_amount`: amount of LP shares user want to deposit. - /// - `get_token_value_of_lp_shares`: callback function returning amount of - /// `incentivized_asset` behind `lp_shares`. - #[require_transactional] - fn deposit_lp_shares( - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - amm_pool_id: T::AmmPoolId, - shares_amount: Balance, - get_token_value_of_lp_shares: impl Fn(T::AssetId, T::AmmPoolId, Balance) -> Result, - ) -> Result { - let mut deposit = DepositData::new(shares_amount, amm_pool_id); - - Self::do_deposit_lp_shares( - &mut deposit, - global_farm_id, - yield_farm_id, - get_token_value_of_lp_shares, - )?; - - //Save deposit to storage. - let deposit_id = Self::get_next_deposit_id()?; - >::insert(deposit_id, deposit); - - Ok(deposit_id) - } - - /// This function create yield farm entry for existing deposit. LP shares are not transferred - /// and amount of LP shares is based on existing deposit. - /// - /// This function DOESN'T create new deposit. - /// - /// Returns: `(redeposited shares amount, amm pool id)` - /// - /// Parameters: - /// - `global_farm_id`: global farm identifier. - /// - `yield_farm_id`: yield farm identifier redepositing to. - /// - `deposit_id`: identifier of the AMM pool. - /// - `get_token_value_of_lp_shares`: callback function returning amount of - /// `incentivized_asset` behind `lp_shares`. - fn redeposit_lp_shares( - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - deposit_id: DepositId, - get_token_value_of_lp_shares: impl Fn(T::AssetId, T::AmmPoolId, Balance) -> Result, - ) -> Result<(Balance, T::AmmPoolId), DispatchError> { - >::try_mutate(deposit_id, |maybe_deposit| { - //NOTE: At this point deposit existence and owner must be checked by pallet calling this - //function so this should never happen. - let deposit = maybe_deposit - .as_mut() - .defensive_ok_or::>(InconsistentStateError::DepositNotFound.into())?; - - Self::do_deposit_lp_shares(deposit, global_farm_id, yield_farm_id, get_token_value_of_lp_shares)?; - - Ok((deposit.shares, deposit.amm_pool_id.clone())) - }) - } - - /// Claim rewards from yield farm for given deposit. - /// - /// This function calculate user rewards from yield farm and transfer rewards to `who` - /// account. Claiming in the same period is configured by `check_double_claim` parameter. - /// Second claim in the same period result in `0` claims. This is desirable for in case we need - /// `unclaimable_rewards` e.g. for `withdraw_lp_shares()` - /// - /// WARN: User have to use `withdraw_shares()` if yield farm is terminated. - /// - /// Returns: `(GlobalFarmId, reward currency, claimed amount, unclaimable amount)` - /// - /// Parameters: - /// - `who`: destination account to receive rewards. - /// - `deposit_id`: id representing deposit in the yield farm. - /// - `yield_farm_id`: identifier of yield farm to withdrawn from. - /// - `check_double_claim`: fn failed on second claim in the same period if set to `true`. - #[require_transactional] - fn claim_rewards( - who: T::AccountId, - deposit_id: DepositId, - yield_farm_id: YieldFarmId, - fail_on_doubleclaim: bool, - ) -> Result<(GlobalFarmId, T::AssetId, Balance, Balance), DispatchError> { - >::try_mutate(deposit_id, |maybe_deposit| { - //NOTE: At this point deposit existence and owner must be checked by pallet calling this - //function so this should never happen. - let deposit = maybe_deposit - .as_mut() - .defensive_ok_or::>(InconsistentStateError::DepositNotFound.into())?; - - let amm_pool_id = deposit.amm_pool_id.clone(); - let farm_entry = deposit - .get_yield_farm_entry(yield_farm_id) - .ok_or(Error::::YieldFarmEntryNotFound)?; - - >::try_mutate( - (amm_pool_id, farm_entry.global_farm_id, yield_farm_id), - |maybe_yield_farm| { - //NOTE: yield-farm must exist if yield-farm-entry exists. - let yield_farm = maybe_yield_farm - .as_mut() - .defensive_ok_or::>(InconsistentStateError::YieldFarmNotFound.into())?; - - ensure!( - !yield_farm.state.is_terminated(), - Error::::LiquidityMiningCanceled - ); - - >::try_mutate(farm_entry.global_farm_id, |maybe_global_farm| { - //NOTE: global-farm must exist if yield-farm exists. - let global_farm = maybe_global_farm - .as_mut() - .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; - - let current_period = Self::get_current_period(global_farm.blocks_per_period)?; - //Double claim should be allowed in some case e.g withdraw_lp_shares need - //`unclaimable_rewards` returned by this function. - if fail_on_doubleclaim { - ensure!( - farm_entry.updated_at != current_period, - Error::::DoubleClaimInPeriod - ); - } - - Self::sync_global_farm(global_farm, current_period)?; - Self::sync_yield_farm(yield_farm, global_farm, current_period)?; - - //NOTE: this should never fail yield-farm's stopped must be >= entry's - //stopped - let delta_stopped = - yield_farm - .total_stopped - .checked_sub(&farm_entry.stopped_at_creation) - .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into())?; - - //NOTE: yield-farm's `updated_at` is updated to current period if it's - //possible so this should be ok. - let periods = yield_farm - .updated_at - .checked_sub(&farm_entry.entered_at) - .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into())? - .checked_sub(&delta_stopped) - .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into())?; - - let loyalty_multiplier = - Self::get_loyalty_multiplier(periods, yield_farm.loyalty_curve.clone())?; - - let (rewards, unclaimable_rewards) = math::calculate_user_reward( - farm_entry.accumulated_rpvs, - farm_entry.valued_shares, - farm_entry.accumulated_claimed_rewards, - yield_farm.accumulated_rpvs, - loyalty_multiplier, - ) - .map_err(|_| ArithmeticError::Overflow)?; - - if !rewards.is_zero() { - yield_farm.left_to_distribute = yield_farm - .left_to_distribute - .checked_sub(rewards) - .defensive_ok_or::>( - InconsistentStateError::NotEnoughRewardsInYieldFarm.into(), - )?; - - farm_entry.accumulated_claimed_rewards = farm_entry - .accumulated_claimed_rewards - .checked_add(rewards) - .ok_or(ArithmeticError::Overflow)?; - - farm_entry.updated_at = current_period; - - let pot = Self::pot_account_id().ok_or(Error::::ErrorGetAccountId)?; - T::MultiCurrency::transfer(global_farm.reward_currency, &pot, &who, rewards)?; - } - - Ok(( - global_farm.id, - global_farm.reward_currency, - rewards, - unclaimable_rewards, - )) - }) - }, - ) - }) - } - - /// Withdraw LP shares from yield farm. This function can be used to free slot for yield - /// farm entry in the deposit or to destroy deposit and return LP shares if deposit has no more - /// farm entries. - /// - /// WARNING: This function doesn't automatically claim rewards for user. Caller of this - /// function must call `claim_rewards()` first if claiming is desirable. - /// - /// !!!LP shares are transferred back to user only when deposit is destroyed. - /// - /// This function transfer user's unclaimable rewards back to global farm. - /// - /// Returns: `(GlobalFarmId, withdrawn amount, true if deposit was destroyed)` - /// - /// Parameters: - /// - `deposit_id`: id representing deposit in the yield farm. - /// - `yield_farm_id`: identifier yield farm to withdrawn from. - /// - `unclaimable_rewards`: amount of rewards user will not be able to claim because of early - /// exit from liquidity mining program. - #[require_transactional] - fn withdraw_lp_shares( - deposit_id: DepositId, - yield_farm_id: YieldFarmId, - unclaimable_rewards: Balance, - ) -> Result<(GlobalFarmId, Balance, bool), DispatchError> { - >::try_mutate_exists(deposit_id, |maybe_deposit| { - //NOTE: At this point deposit existence and owner must be checked by pallet calling this - //function so this should never fail. - let deposit = maybe_deposit - .as_mut() - .defensive_ok_or::>(InconsistentStateError::DepositNotFound.into())?; - - let farm_entry = deposit.remove_yield_farm_entry(yield_farm_id)?; - let amm_pool_id = deposit.amm_pool_id.clone(); - - >::try_mutate_exists( - farm_entry.global_farm_id, - |maybe_global_farm| -> Result<(), DispatchError> { - //NOTE: global-farm must exist if yield-farm-entry exists. - let global_farm = maybe_global_farm - .as_mut() - .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; - - >::try_mutate_exists( - (&amm_pool_id, farm_entry.global_farm_id, yield_farm_id), - |maybe_yield_farm| -> Result<(), DispatchError> { - //NOTE: yield-farm must exist if yield-farm-entry exists. - let yield_farm = maybe_yield_farm - .as_mut() - .defensive_ok_or::>(InconsistentStateError::YieldFarmNotFound.into())?; - - yield_farm.total_shares = yield_farm - .total_shares - .checked_sub(deposit.shares) - .defensive_ok_or::>(InconsistentStateError::InvalidTotalShares.into())?; - - yield_farm.total_valued_shares = yield_farm - .total_valued_shares - .checked_sub(farm_entry.valued_shares) - .defensive_ok_or::>(InconsistentStateError::InvalidValuedShares.into())?; - - // yield farm's stake in global farm is set to `0` when farm is - // stopped and yield farm have to be stopped before it's terminated so - // this update is only required for active farms. - if yield_farm.state.is_active() { - let deposit_stake_in_global_farm = - math::calculate_global_farm_shares(farm_entry.valued_shares, yield_farm.multiplier) - .map_err(|_| ArithmeticError::Overflow)?; - - global_farm.remove_stake(deposit_stake_in_global_farm)?; - } - - //NOTE: this should never happen. It's the responsibility of a pallet - //which is using this function to provide `unclaimable_rewards == 0` - //if yield-farm is not claimable. - ensure!( - unclaimable_rewards.is_zero() || !yield_farm.state.is_terminated(), - Self::defensive_err(Error::::InconsistentState( - InconsistentStateError::NotEnoughRewardsInYieldFarm, - )) - ); - if !unclaimable_rewards.is_zero() { - yield_farm.left_to_distribute = yield_farm - .left_to_distribute - .checked_sub(unclaimable_rewards) - .defensive_ok_or::>( - InconsistentStateError::NotEnoughRewardsInYieldFarm.into(), - )?; - - global_farm.accumulated_paid_rewards = global_farm - .accumulated_paid_rewards - .checked_sub(unclaimable_rewards) - .defensive_ok_or::>( - InconsistentStateError::InvalidPaidAccumulatedRewards.into(), - )?; - - let global_farm_account = Self::farm_account_id(global_farm.id)?; - let pot = Self::pot_account_id().ok_or(Error::::ErrorGetAccountId)?; - - T::MultiCurrency::transfer( - global_farm.reward_currency, - &pot, - &global_farm_account, - unclaimable_rewards, - )?; - } - - yield_farm.decrease_entries_count()?; - if yield_farm.can_be_removed() { - global_farm.decrease_total_yield_farm_count()?; - - *maybe_yield_farm = None; - } - - Ok(()) - }, - )?; - - if global_farm.can_be_removed() { - *maybe_global_farm = None; - } - - Ok(()) - }, - )?; - - let withdrawn_amount = deposit.shares; - let mut deposit_destroyed = false; - if deposit.can_be_removed() { - *maybe_deposit = None; - - deposit_destroyed = true; - } - - Ok((farm_entry.global_farm_id, withdrawn_amount, deposit_destroyed)) - }) - } - - /// Helper function to create yield farm entry. - #[require_transactional] - fn do_deposit_lp_shares( - deposit: &mut DepositData, - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - get_token_value_of_lp_shares: impl Fn(T::AssetId, T::AmmPoolId, Balance) -> Result, - ) -> Result<(), DispatchError> { - //LP shares can be locked only once in the same yield farm. - ensure!( - deposit.search_yield_farm_entry(yield_farm_id).is_none(), - Error::::DoubleLock - ); - - >::try_mutate( - (deposit.amm_pool_id.clone(), global_farm_id, yield_farm_id), - |maybe_yield_farm| { - let yield_farm = maybe_yield_farm.as_mut().ok_or(Error::::YieldFarmNotFound)?; - - ensure!(yield_farm.state.is_active(), Error::::LiquidityMiningCanceled); - - >::try_mutate(global_farm_id, |maybe_global_farm| { - //NOTE: global-farm must exists if yield-farm exists. - let global_farm = maybe_global_farm - .as_mut() - .defensive_ok_or::>(InconsistentStateError::GlobalFarmNotFound.into())?; - - ensure!( - deposit.shares.ge(&global_farm.min_deposit), - Error::::InvalidDepositAmount, - ); - - //NOTE: If yield-farm is active also global-farm MUST be active. - ensure!( - global_farm.state.is_active(), - Self::defensive_err(Error::::InconsistentState( - InconsistentStateError::GlobalFarmNotFound - )) - ); - - let current_period = Self::get_current_period(global_farm.blocks_per_period)?; - - Self::sync_global_farm(global_farm, current_period)?; - Self::sync_yield_farm(yield_farm, global_farm, current_period)?; - - let valued_shares = get_token_value_of_lp_shares( - global_farm.incentivized_asset, - deposit.amm_pool_id.clone(), - deposit.shares, - )?; - - ensure!( - valued_shares >= global_farm.min_deposit, - Error::::IncorrectValuedShares - ); - - let deposit_stake_in_global_farm = - math::calculate_global_farm_shares(valued_shares, yield_farm.multiplier) - .map_err(|_| ArithmeticError::Overflow)?; - - yield_farm.total_shares = yield_farm - .total_shares - .checked_add(deposit.shares) - .ok_or(ArithmeticError::Overflow)?; - - yield_farm.total_valued_shares = yield_farm - .total_valued_shares - .checked_add(valued_shares) - .ok_or(ArithmeticError::Overflow)?; - - global_farm.add_stake(deposit_stake_in_global_farm)?; - - let farm_entry = YieldFarmEntry::new( - global_farm.id, - yield_farm.id, - valued_shares, - yield_farm.accumulated_rpvs, - current_period, - yield_farm.total_stopped, - ); - - deposit.add_yield_farm_entry(farm_entry)?; - - //Increment farm's entries count - yield_farm.increase_entries_count()?; - - Ok(()) - }) - }, - ) - } - - /// This function returns new unused `FarmId` usable for yield global farm or error. - fn get_next_farm_id() -> Result { - FarmSequencer::::try_mutate(|current_id| { - *current_id = current_id.checked_add(1).ok_or(ArithmeticError::Overflow)?; - - Ok(*current_id) - }) - } - - /// This function returns new unused `DepositId` or error. - fn get_next_deposit_id() -> Result { - DepositSequencer::::try_mutate(|current_id| { - *current_id = current_id.checked_add(1).ok_or(ArithmeticError::Overflow)?; - - Ok(*current_id) - }) - } - - /// Account id holding rewards allocated from all global farms for all yield farms. - pub fn pot_account_id() -> Option { - T::PalletId::get().try_into_account() - } - - /// This function returns account from `FarmId` or error. - /// - /// WARN: farm_id = 0 is same as `T::PalletId::get().into_account()`. 0 is not valid value. - pub fn farm_account_id(farm_id: FarmId) -> Result> { - Self::validate_farm_id(farm_id)?; - - match T::PalletId::get().try_into_sub_account(farm_id) { - Some(account) => Ok(account), - None => Err(Error::::ErrorGetAccountId), - } - } - - /// This function returns current period number or error. - fn get_current_period(blocks_per_period: BlockNumberFor) -> Result, Error> { - Self::get_period_number(T::BlockNumberProvider::current_block_number(), blocks_per_period) - } - - /// This function returns period number from block number(`block`) and `blocks_per_period` or error. - fn get_period_number( - block: BlockNumberFor, - blocks_per_period: BlockNumberFor, - ) -> Result, Error> { - block - .checked_div(&blocks_per_period) - .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into()) - } - - /// This function returns loyalty multiplier or error. - fn get_loyalty_multiplier(periods: PeriodOf, curve: Option) -> Result { - let curve = match curve { - Some(v) => v, - None => return Ok(FixedU128::one()), //no loyalty curve mean no loyalty multiplier - }; - - let m = math::calculate_loyalty_multiplier(periods, curve.initial_reward_percentage, curve.scale_coef) - .map_err(|_| ArithmeticError::Overflow)?; - - ensure!( - m.le(&FixedU128::one()), - Self::defensive_err(Error::::InconsistentState( - InconsistentStateError::InvalidLoyaltyMultiplier - )) - ); - - Ok(m) - } - - /// This function calculates and updates `accumulated_rpz` and all associated properties of - /// `global_farm` if conditions are met. - /// Returns the reward transferred to the pot. - #[require_transactional] - fn sync_global_farm( - global_farm: &mut GlobalFarmData, - current_period: PeriodOf, - ) -> Result { - // Inactive farm should not be updated - if !global_farm.state.is_active() { - return Ok(Zero::zero()); - } - - // Farm should be updated only once in the same period. - if global_farm.updated_at == current_period { - return Ok(Zero::zero()); - } - - // Nothing to update if there is no stake in the farm. - if global_farm.total_shares_z.is_zero() { - global_farm.updated_at = current_period; - return Ok(Zero::zero()); - } - - let global_farm_account = Self::farm_account_id(global_farm.id)?; - let reward_currency_ed = T::AssetRegistry::get(&global_farm.reward_currency); - let left_to_distribute = T::MultiCurrency::free_balance(global_farm.reward_currency, &global_farm_account) - .saturating_sub(reward_currency_ed); - - // Number of periods since last farm update. - let periods_since_last_update: Balance = TryInto::::try_into( - current_period - .checked_sub(&global_farm.updated_at) - .defensive_ok_or::>(InconsistentStateError::InvalidPeriod.into())?, - ) - .map_err(|_| ArithmeticError::Overflow)?; - - if let Ok(price_adjustment) = T::PriceAdjustment::get(global_farm) { - global_farm.price_adjustment = price_adjustment; - } - - // Calculate reward for all periods since last update capped by balance of `GlobalFarm` - // account. - let reward = math::calculate_global_farm_rewards( - global_farm.total_shares_z, - //NOTE: Fallback. Last saved value should be used if oracle is not available. - global_farm.price_adjustment, - global_farm.yield_per_period.into(), - global_farm.max_reward_per_period, - periods_since_last_update, - ) - .map_err(|_| ArithmeticError::Overflow)? - .min(left_to_distribute); - - if !reward.is_zero() { - let pot = Self::pot_account_id().ok_or(Error::::ErrorGetAccountId)?; - T::MultiCurrency::transfer(global_farm.reward_currency, &global_farm_account, &pot, reward)?; - - global_farm.accumulated_rpz = - math::calculate_accumulated_rps(global_farm.accumulated_rpz, global_farm.total_shares_z, reward) - .map_err(|_| ArithmeticError::Overflow)?; - - global_farm.pending_rewards = global_farm - .pending_rewards - .checked_add(reward) - .ok_or(ArithmeticError::Overflow)?; - } else { - Pallet::::deposit_event(Event::AllRewardsDistributed { - global_farm_id: global_farm.id, - }); - } - - global_farm.updated_at = current_period; - - Pallet::::deposit_event(Event::GlobalFarmAccRPZUpdated { - global_farm_id: global_farm.id, - accumulated_rpz: global_farm.accumulated_rpz, - total_shares_z: global_farm.total_shares_z, - }); - - Ok(reward) - } - - /// This function calculates and updates `accumulated_rpvz` and all associated properties of - /// `YieldFarm` if conditions are met. It also calculates yield-farm's rewards from `GlobalFarm`. - /// NOTE: Yield-farm's rewards are staying in the `pot`. - #[require_transactional] - fn sync_yield_farm( - yield_farm: &mut YieldFarmData, - global_farm: &mut GlobalFarmData, - current_period: BlockNumberFor, - ) -> Result<(), DispatchError> { - if !yield_farm.state.is_active() { - return Ok(()); - } - - if yield_farm.updated_at == current_period { - return Ok(()); - } - - if yield_farm.total_valued_shares.is_zero() { - //NOTE: This is important to prevent rewarding of the farms for emtpy periods and it - //also prevents the first user getting more rewards than the second user. - yield_farm.accumulated_rpz = global_farm.accumulated_rpz; - yield_farm.updated_at = current_period; - - return Ok(()); - } - - let (delta_rpvs, yield_farm_rewards) = math::calculate_yield_farm_rewards( - yield_farm.accumulated_rpz, - global_farm.accumulated_rpz, - yield_farm.multiplier, - yield_farm.total_valued_shares, - ) - .map_err(|_| ArithmeticError::Overflow)?; - - yield_farm.accumulated_rpz = global_farm.accumulated_rpz; - - global_farm.accumulated_paid_rewards = global_farm - .accumulated_paid_rewards - .checked_add(yield_farm_rewards) - .ok_or(ArithmeticError::Overflow)?; - - global_farm.pending_rewards = global_farm - .pending_rewards - .checked_sub(yield_farm_rewards) - .ok_or(ArithmeticError::Overflow)?; - - yield_farm.accumulated_rpvs = yield_farm - .accumulated_rpvs - .checked_add(&delta_rpvs) - .ok_or(ArithmeticError::Overflow)?; - - yield_farm.updated_at = current_period; - - yield_farm.left_to_distribute = yield_farm - .left_to_distribute - .checked_add(yield_farm_rewards) - .ok_or(ArithmeticError::Overflow)?; - - Pallet::::deposit_event(Event::YieldFarmAccRPVSUpdated { - global_farm_id: global_farm.id, - yield_farm_id: yield_farm.id, - accumulated_rpvs: yield_farm.accumulated_rpvs, - total_valued_shares: yield_farm.total_valued_shares, - }); - - Ok(()) - } - - /// This function returns an error if `farm_id` is not valid. - fn validate_farm_id(farm_id: FarmId) -> Result<(), Error> { - if farm_id.is_zero() { - return Err(InconsistentStateError::InvalidFarmId.into()).defensive(); - } - - Ok(()) - } - - /// This function is used to validate input data before creating new global farm. - fn validate_create_global_farm_data( - total_rewards: Balance, - planned_yielding_periods: PeriodOf, - blocks_per_period: BlockNumberFor, - yield_per_period: Perquintill, - min_deposit: Balance, - price_adjustment: FixedU128, - ) -> DispatchResult { - ensure!(min_deposit.ge(&MIN_DEPOSIT), Error::::InvalidMinDeposit); - - ensure!(!price_adjustment.is_zero(), Error::::InvalidPriceAdjustment); - - ensure!( - total_rewards >= T::MinTotalFarmRewards::get(), - Error::::InvalidTotalRewards - ); - - ensure!( - planned_yielding_periods >= T::MinPlannedYieldingPeriods::get(), - Error::::InvalidPlannedYieldingPeriods - ); - - ensure!(!blocks_per_period.is_zero(), Error::::InvalidBlocksPerPeriod); - - ensure!(!yield_per_period.is_zero(), Error::::InvalidYieldPerPeriod); - - Ok(()) - } - - // Claiming from `YieldFarm` is not possible(will fail) if yield farm is terminated or has no - // entries. - fn is_yield_farm_claimable( - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - amm_pool_id: T::AmmPoolId, - ) -> bool { - if let Some(yield_farm) = Self::yield_farm((amm_pool_id, global_farm_id, yield_farm_id)) { - return !yield_farm.state.is_terminated() && yield_farm.has_entries(); - } - - false - } - - // This function returns `GlobalFarmId` from deposit's farm entry or `None` if deposit or farm - // entry doesn't exists. - fn get_global_farm_id(id: DepositId, yield_farm_id: YieldFarmId) -> Option { - if let Some(mut deposit) = Self::deposit(id) { - if let Some(farm_entry) = deposit.get_yield_farm_entry(yield_farm_id) { - return Some(farm_entry.global_farm_id); - } - } - - None - } - - #[inline(always)] - fn defensive_err(e: Error) -> Error { - defensive!(e); - e - } -} - -impl, I: 'static> hydradx_traits::liquidity_mining::Mutate> - for Pallet -{ - type Error = DispatchError; - - type AmmPoolId = T::AmmPoolId; - type Balance = Balance; - type Period = PeriodOf; - type LoyaltyCurve = LoyaltyCurve; - - fn create_global_farm( - total_rewards: Self::Balance, - planned_yielding_periods: Self::Period, - blocks_per_period: BlockNumberFor, - incentivized_asset: T::AssetId, - reward_currency: T::AssetId, - owner: T::AccountId, - yield_per_period: Perquintill, - min_deposit: Self::Balance, - price_adjustment: FixedU128, - ) -> Result<(GlobalFarmId, Self::Balance), Self::Error> { - Self::create_global_farm( - total_rewards, - planned_yielding_periods, - blocks_per_period, - incentivized_asset, - reward_currency, - owner, - yield_per_period, - min_deposit, - price_adjustment, - ) - } - - /// This function should be used when external source(e.g. oracle) is used for `price_adjustment` - /// or if `incentivized_asset` and `reward_currency` can't be different. - fn create_global_farm_without_price_adjustment( - total_rewards: Self::Balance, - planned_yielding_periods: Self::Period, - blocks_per_period: BlockNumberFor, - incentivized_asset: T::AssetId, - reward_currency: T::AssetId, - owner: T::AccountId, - yield_per_period: Perquintill, - min_deposit: Self::Balance, - ) -> Result<(GlobalFarmId, Self::Balance), Self::Error> { - Self::create_global_farm( - total_rewards, - planned_yielding_periods, - blocks_per_period, - incentivized_asset, - reward_currency, - owner, - yield_per_period, - min_deposit, - //NOTE: `price_adjustment` == 1 is same as no `price_adjustment` - FixedU128::one(), - ) - } - - fn update_global_farm_price_adjustment( - who: T::AccountId, - global_farm_id: GlobalFarmId, - price_adjustment: FixedU128, - ) -> Result<(), Self::Error> { - Self::update_global_farm_price_adjustment(who, global_farm_id, price_adjustment) - } - - fn terminate_global_farm( - who: T::AccountId, - global_farm_id: u32, - ) -> Result<(T::AssetId, Self::Balance, T::AccountId), Self::Error> { - Self::terminate_global_farm(who, global_farm_id) - } - - fn create_yield_farm( - who: T::AccountId, - global_farm_id: GlobalFarmId, - multiplier: FixedU128, - loyalty_curve: Option, - amm_pool_id: Self::AmmPoolId, - assets: Vec, - ) -> Result { - Self::create_yield_farm(who, global_farm_id, multiplier, loyalty_curve, amm_pool_id, assets) - } - - fn update_yield_farm_multiplier( - who: T::AccountId, - global_farm_id: GlobalFarmId, - amm_pool_id: Self::AmmPoolId, - multiplier: FixedU128, - ) -> Result { - Self::update_yield_farm_multiplier(who, global_farm_id, amm_pool_id, multiplier) - } - - fn stop_yield_farm( - who: T::AccountId, - global_farm_id: GlobalFarmId, - amm_pool_id: Self::AmmPoolId, - ) -> Result { - Self::stop_yield_farm(who, global_farm_id, amm_pool_id) - } - - fn resume_yield_farm( - who: T::AccountId, - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - amm_pool_id: Self::AmmPoolId, - multiplier: FixedU128, - ) -> Result<(), Self::Error> { - Self::resume_yield_farm(who, global_farm_id, yield_farm_id, amm_pool_id, multiplier) - } - - fn terminate_yield_farm( - who: T::AccountId, - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - amm_pool_id: Self::AmmPoolId, - ) -> Result<(), Self::Error> { - Self::terminate_yield_farm(who, global_farm_id, yield_farm_id, amm_pool_id) - } - - fn deposit_lp_shares Result>( - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - amm_pool_id: Self::AmmPoolId, - shares_amount: Self::Balance, - get_token_value_of_lp_shares: F, - ) -> Result { - Self::deposit_lp_shares( - global_farm_id, - yield_farm_id, - amm_pool_id, - shares_amount, - get_token_value_of_lp_shares, - ) - } - - fn redeposit_lp_shares Result>( - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - deposit_id: DepositId, - get_token_value_of_lp_shares: F, - ) -> Result<(Self::Balance, Self::AmmPoolId), Self::Error> { - Self::redeposit_lp_shares(global_farm_id, yield_farm_id, deposit_id, get_token_value_of_lp_shares) - } - - fn claim_rewards( - who: T::AccountId, - deposit_id: DepositId, - yield_farm_id: YieldFarmId, - ) -> Result<(GlobalFarmId, T::AssetId, Self::Balance, Self::Balance), Self::Error> { - let fail_on_doubleclaim = true; - Self::claim_rewards(who, deposit_id, yield_farm_id, fail_on_doubleclaim) - } - - fn withdraw_lp_shares( - who: T::AccountId, - deposit_id: DepositId, - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - amm_pool_id: Self::AmmPoolId, - ) -> Result<(Self::Balance, Option<(T::AssetId, Self::Balance, Self::Balance)>, bool), Self::Error> { - let claim_data = if Self::is_yield_farm_claimable(global_farm_id, yield_farm_id, amm_pool_id) { - let fail_on_doubleclaim = false; - let (_, reward_currency, claimed, unclaimable) = - Self::claim_rewards(who, deposit_id, yield_farm_id, fail_on_doubleclaim)?; - - Some((reward_currency, claimed, unclaimable)) - } else { - None - }; - - let unclaimable = claim_data.map_or(Zero::zero(), |(_, _, unclaimable)| unclaimable); - let (_, withdrawn_amount, deposit_destroyed) = - Self::withdraw_lp_shares(deposit_id, yield_farm_id, unclaimable)?; - - Ok((withdrawn_amount, claim_data, deposit_destroyed)) - } - - fn is_yield_farm_claimable( - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - amm_pool_id: Self::AmmPoolId, - ) -> bool { - Self::is_yield_farm_claimable(global_farm_id, yield_farm_id, amm_pool_id) - } - - fn get_global_farm_id(deposit_id: DepositId, yield_farm_id: YieldFarmId) -> Option { - Self::get_global_farm_id(deposit_id, yield_farm_id) - } -} diff --git a/pallets/liquidity-mining/src/tests/claim_rewards.rs b/pallets/liquidity-mining/src/tests/claim_rewards.rs deleted file mode 100644 index 28cb85db8ae..00000000000 --- a/pallets/liquidity-mining/src/tests/claim_rewards.rs +++ /dev/null @@ -1,1265 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use crate::tests::mock::LiquidityMining2; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn claim_rewards_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const FAIL_ON_DOUBLECLAIM: bool = true; - const REWARD_CURRENCY: AssetId = BSX; - let global_farm_id = GC_FARM; - let pot = LiquidityMining::pot_account_id().unwrap(); - let global_farm_account = LiquidityMining::farm_account_id(global_farm_id).unwrap(); - let global_farm_total_rewards_start = 30_000_000_000 * ONE; - - //_0 - value before act. - let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); - let bsx_tkn1_yield_farm_key = (BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID); - let bsx_tkn2_yield_farm_key = (BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - let yield_farm_0 = LiquidityMining::yield_farm(bsx_tkn1_yield_farm_key).unwrap(); - - let expected_claimed_rewards = 23_306_074_766_355_140; - let unclaimable_rewards = 20_443_925_233_644_860; - - //claim A1.1 (dep. A1 1-th time) - assert_eq!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ) - .unwrap(), - ( - global_farm_id, - REWARD_CURRENCY, - expected_claimed_rewards, - unclaimable_rewards - ) - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(), - DepositData { - shares: 50 * ONE, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![YieldFarmEntry { - global_farm_id, - yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, - accumulated_rpvs: Zero::zero(), - accumulated_claimed_rewards: expected_claimed_rewards, - entered_at: 18, - updated_at: 25, - valued_shares: 2_500 * ONE, - stopped_at_creation: 0, - _phantom: PhantomData, - }] - .try_into() - .unwrap(), - }, - ); - - assert_eq!( - LiquidityMining::yield_farm(bsx_tkn1_yield_farm_key) - .unwrap() - .left_to_distribute, - yield_farm_0.left_to_distribute - expected_claimed_rewards - ); - - //Check if claimed rewards are transferred. - assert_eq!( - Tokens::free_balance(BSX, &ALICE), - alice_bsx_balance_0 + expected_claimed_rewards - ); - - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &pot), - pot_balance_0 - expected_claimed_rewards - ); - - // claim B3.1 - set_block_number(3_056); - //_0 - value before act. - let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - let yield_farm_0 = LiquidityMining::yield_farm(bsx_tkn2_yield_farm_key).unwrap(); - - let expected_claimed_rewards = 3_417_857_142_857_142; - let unclaimable_rewards = 3_107_142_857_142_858; - let reserved_for_both_farms = 1_759_975 * ONE; - let claimed_from_global = 1_190_725 * ONE; - - assert_eq!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[4], - GC_BSX_TKN2_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ) - .unwrap(), - ( - global_farm_id, - REWARD_CURRENCY, - expected_claimed_rewards, - unclaimable_rewards - ) - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[4]).unwrap(), - DepositData { - shares: 87 * ONE, - amm_pool_id: BSX_TKN2_AMM, - yield_farm_entries: vec![YieldFarmEntry { - global_farm_id, - yield_farm_id: GC_BSX_TKN2_YIELD_FARM_ID, - valued_shares: 261 * ONE, - accumulated_rpvs: FixedU128::from(35), - accumulated_claimed_rewards: expected_claimed_rewards, - entered_at: 25, - updated_at: 30, - stopped_at_creation: 0, - _phantom: PhantomData, - }] - .try_into() - .unwrap(), - }, - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 30, - accumulated_rpz: FixedU128::from(6), - total_shares_z: 703_990 * ONE, - pending_rewards: 569_250 * ONE, - accumulated_paid_rewards: 2_474_275 * ONE, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 30, - accumulated_rpvs: FixedU128::from(60), - accumulated_rpz: FixedU128::from(6), - total_shares: 960 * ONE, - total_valued_shares: 47_629 * ONE, - entries_count: 4, - left_to_distribute: yield_farm_0.left_to_distribute - expected_claimed_rewards - + claimed_from_global, - ..yield_farm_0 - }, - ); - - //Check if claimed rewards are transferred. - assert_eq!( - Tokens::free_balance(BSX, &ALICE), - alice_bsx_balance_0 + expected_claimed_rewards - ); - - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &pot), - pot_balance_0 + reserved_for_both_farms - expected_claimed_rewards - ); - - //Run for log time(longer than planned_yielding_periods) without interactions with farms. - //planned_yielding_periods = 500; 100 blocks per period - //claim A1.2 - set_block_number(125_879); - //_0 - value before act. - let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); - let bsx_tkn1_yield_farm_key = (BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - let yield_farm_0 = LiquidityMining::yield_farm(bsx_tkn1_yield_farm_key).unwrap(); - - let expected_claimed_rewards = 7_437_514_820_756_032_916; - let unclaimable_rewards = 289_179_104_477_611_944; - - let reserved_for_both_farms = 432_249_860 * ONE; - let yield_farm_claim_from_global = 140_377_050 * ONE; - - assert_eq!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ) - .unwrap(), - ( - global_farm_id, - REWARD_CURRENCY, - expected_claimed_rewards, - unclaimable_rewards - ) - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(), - DepositData { - shares: 50 * ONE, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![YieldFarmEntry { - global_farm_id, - yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, - valued_shares: 2_500 * ONE, - accumulated_rpvs: Zero::zero(), - accumulated_claimed_rewards: 7_460_820_895_522_388_056, - entered_at: 18, - updated_at: 1_258, - stopped_at_creation: 0, - _phantom: PhantomData, - }] - .try_into() - .unwrap(), - }, - ); - - let global_farm_1 = LiquidityMining::global_farm(GC_FARM).unwrap(); - pretty_assertions::assert_eq!( - global_farm_1, - GlobalFarmData { - updated_at: 1_258, - accumulated_rpz: FixedU128::from(620), - total_shares_z: 703_990 * ONE, - pending_rewards: 292_442_060 * ONE, - accumulated_paid_rewards: 142_851_325 * ONE, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 1_258, - accumulated_rpvs: FixedU128::from(3_100), - accumulated_rpz: FixedU128::from(620), - total_shares: 616 * ONE, - total_valued_shares: 45_540 * ONE, - entries_count: 3, - left_to_distribute: yield_farm_0.left_to_distribute + yield_farm_claim_from_global - - expected_claimed_rewards, - ..yield_farm_0 - }, - ); - - //Check if claimed rewards are transferred. - assert_eq!( - Tokens::free_balance(BSX, &ALICE), - alice_bsx_balance_0 + expected_claimed_rewards - ); - - assert_eq!( - Tokens::free_balance(BSX, &pot), - pot_balance_0 + reserved_for_both_farms - expected_claimed_rewards - ); - - let distributed_from_global = - global_farm_total_rewards_start - Tokens::total_balance(REWARD_CURRENCY, &global_farm_account); - - let tracked_distributed_rewards = global_farm_1.accumulated_paid_rewards + global_farm_1.pending_rewards; - - pretty_assertions::assert_eq!(distributed_from_global, tracked_distributed_rewards); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - - //Charlie's farm incentivize KSM and reward currency is ACA. - //This test check if correct currency is transferred if rewards and incentivized - //assets are different, otherwise farm behavior is the same as in tests above. - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const FAIL_ON_DOUBLECLAIM: bool = true; - set_block_number(1_800); //period 18 - - let global_farm_id = CHARLIE_FARM; - let expected_claimed_rewards = 23_306_074_766_355_140; //ACA - let unclaimable_rewards = 20_443_925_233_644_860; - let deposited_amount = 50 * ONE; - let deposit_id = 1; - assert_ok!(LiquidityMining::deposit_lp_shares( - CHARLIE_FARM, - CHARLIE_ACA_KSM_YIELD_FARM_ID, - ACA_KSM_AMM, - deposited_amount, - |_, _, _| { Ok(2_500 * ONE) } - )); - - assert_eq!( - LiquidityMining::deposit(deposit_id).unwrap(), - DepositData { - shares: deposited_amount, - amm_pool_id: ACA_KSM_AMM, - yield_farm_entries: vec![YieldFarmEntry { - global_farm_id, - yield_farm_id: CHARLIE_ACA_KSM_YIELD_FARM_ID, - accumulated_rpvs: Zero::zero(), - accumulated_claimed_rewards: 0, - entered_at: 18, - updated_at: 18, - valued_shares: 2_500 * ONE, - stopped_at_creation: 0, - _phantom: PhantomData, - }] - .try_into() - .unwrap(), - }, - ); - - set_block_number(2_596); //period 25 - - assert_eq!( - LiquidityMining::claim_rewards(ALICE, deposit_id, CHARLIE_ACA_KSM_YIELD_FARM_ID, FAIL_ON_DOUBLECLAIM) - .unwrap(), - (CHARLIE_FARM, ACA, expected_claimed_rewards, unclaimable_rewards) - ); - - //Alice had 0 ACA before claim. - assert_eq!(Tokens::free_balance(ACA, &ALICE), expected_claimed_rewards); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn claim_rewards_deposit_with_multiple_entries_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const FAIL_ON_DOUBLECLAIM: bool = true; - //predefined_deposit[0] - GC_FARM, BSX_TKN1_AMM - set_block_number(50_000); - assert_ok!(LiquidityMining::redeposit_lp_shares( - EVE_FARM, - EVE_BSX_TKN1_YIELD_FARM_ID, - PREDEFINED_DEPOSIT_IDS[0], - |_, _, _| { Ok(4_000 * ONE) } - )); - - set_block_number(800_000); - assert_ok!(LiquidityMining::redeposit_lp_shares( - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - PREDEFINED_DEPOSIT_IDS[0], - |_, _, _| { Ok(5_000 * ONE) } - )); - - let deposit = LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(); - - assert_eq!( - deposit.yield_farm_entries, - vec![ - YieldFarmEntry { - global_farm_id: GC_FARM, - valued_shares: 2_500 * ONE, - yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 0, - accumulated_rpvs: Zero::zero(), - entered_at: 18, - updated_at: 18, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - YieldFarmEntry { - global_farm_id: EVE_FARM, - valued_shares: 4_000 * ONE, - yield_farm_id: EVE_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 0, - accumulated_rpvs: Zero::zero(), - entered_at: 50, - updated_at: 50, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - YieldFarmEntry { - global_farm_id: DAVE_FARM, - valued_shares: 5_000 * ONE, - yield_farm_id: DAVE_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 0, - accumulated_rpvs: Zero::zero(), - entered_at: 800, - updated_at: 800, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - ] - ); - - set_block_number(1_000_000); - assert_eq!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - EVE_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ) - .unwrap(), - (EVE_FARM, KSM, 7_238_095_238_095_238_088, 361_904_761_904_761_912) - ); - - assert_noop!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - EVE_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ), - Error::::DoubleClaimInPeriod - ); - - assert_eq!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ) - .unwrap(), - (GC_FARM, BSX, 62_078_099_583_415_988_875, 309_400_416_584_011_125) - ); - - let deposit = LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(); - assert_eq!( - deposit.yield_farm_entries, - vec![ - YieldFarmEntry { - global_farm_id: GC_FARM, - valued_shares: 2_500 * ONE, - yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 62_078_099_583_415_988_875, - accumulated_rpvs: Zero::zero(), - entered_at: 18, - updated_at: 10_000, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - YieldFarmEntry { - global_farm_id: EVE_FARM, - valued_shares: 4_000 * ONE, - yield_farm_id: EVE_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 7_238_095_238_095_238_088, - accumulated_rpvs: Zero::zero(), - entered_at: 50, - updated_at: 1_000, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - YieldFarmEntry { - global_farm_id: DAVE_FARM, - valued_shares: 5_000 * ONE, - yield_farm_id: DAVE_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 0, - accumulated_rpvs: Zero::zero(), - entered_at: 800, - updated_at: 800, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - ] - ); - - //Same period different block. - set_block_number(1_000_050); - assert_noop!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - EVE_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ), - Error::::DoubleClaimInPeriod - ); - - assert_noop!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ), - Error::::DoubleClaimInPeriod - ); - - assert_eq!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - DAVE_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ) - .unwrap(), - (DAVE_FARM, ACA, 1_666_666_666_666_666_666, 333_333_333_333_333_334) - ); - - let deposit = LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(); - assert_eq!( - deposit.yield_farm_entries, - vec![ - YieldFarmEntry { - global_farm_id: GC_FARM, - valued_shares: 2_500 * ONE, - yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 62_078_099_583_415_988_875, - accumulated_rpvs: Zero::zero(), - entered_at: 18, - updated_at: 10_000, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - YieldFarmEntry { - global_farm_id: EVE_FARM, - valued_shares: 4_000 * ONE, - yield_farm_id: EVE_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 7_238_095_238_095_238_088, - accumulated_rpvs: Zero::zero(), - entered_at: 50, - updated_at: 1_000, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - YieldFarmEntry { - global_farm_id: DAVE_FARM, - valued_shares: 5_000 * ONE, - yield_farm_id: DAVE_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 1_666_666_666_666_666_666, - accumulated_rpvs: Zero::zero(), - entered_at: 800, - updated_at: 1_000, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - ] - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn claim_rewards_doubleclaim_in_the_same_period_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const FAIL_ON_DOUBLECLAIM: bool = true; - let global_farm_id = GC_FARM; - let alice_bsx_balance = Tokens::free_balance(BSX, &ALICE); - let pot = LiquidityMining::pot_account_id().unwrap(); - - let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let pot_balance_0 = Tokens::free_balance(BSX, &pot); - - //1-th claim should works. - assert_ok!(LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - )); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(), - DepositData { - shares: 50 * ONE, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![YieldFarmEntry { - global_farm_id, - yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, - valued_shares: 2_500 * ONE, - accumulated_rpvs: Zero::zero(), - accumulated_claimed_rewards: 23_306_074_766_355_140, - entered_at: 18, - updated_at: 25, - stopped_at_creation: 0, - _phantom: PhantomData, - }] - .try_into() - .unwrap(), - }, - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)) - .unwrap() - .left_to_distribute, - yield_farm_0.left_to_distribute - 23_306_074_766_355_140 - ); - - assert_eq!( - Tokens::free_balance(BSX, &ALICE), - alice_bsx_balance + 23_306_074_766_355_140 - ); - assert_eq!(Tokens::free_balance(BSX, &pot), pot_balance_0 - 23_306_074_766_355_140); - - //Second claim should fail. - assert_noop!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ), - Error::::DoubleClaimInPeriod - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn claim_rewards_should_claim_correct_amount_when_yield_farm_is_stopped() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const FAIL_ON_DOUBLECLAIM: bool = true; - let global_farm_id = GC_FARM; - let alibe_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); - let pot = LiquidityMining::pot_account_id().unwrap(); - let pot_balance_0 = Tokens::free_balance(BSX, &pot); - let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - - let expected_global_pending_rewards = 41_675_375_000_000_000_000_u128; - //Stop yield farming before claiming. - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - - set_block_number(20_000); - - let expected_claimed_rewards = 23_306_074_766_355_140; - let unclaimable_rewards = 20_443_925_233_644_860; - - //claim A1.1 (dep. A1 1-th time) - assert_eq!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ) - .unwrap(), - (global_farm_id, BSX, expected_claimed_rewards, unclaimable_rewards) - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(), - DepositData { - shares: 50 * ONE, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![YieldFarmEntry { - global_farm_id, - yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, - valued_shares: 2_500 * ONE, - accumulated_rpvs: Zero::zero(), - accumulated_claimed_rewards: expected_claimed_rewards, - entered_at: 18, - updated_at: 200, - stopped_at_creation: 0, - _phantom: PhantomData, - }] - .try_into() - .unwrap(), - }, - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)) - .unwrap() - .left_to_distribute, - yield_farm_0.left_to_distribute - expected_claimed_rewards - ); - - //Check if claimed rewards are transferred. - assert_eq!( - Tokens::free_balance(BSX, &ALICE), - alibe_bsx_balance_0 + expected_claimed_rewards - ); - - assert_eq!( - Tokens::free_balance(BSX, &pot), - pot_balance_0 + expected_global_pending_rewards - expected_claimed_rewards - ); - - //global-farm should be synced independetly of yield-farm (even it yield-farm is - //stopped). - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 200, - accumulated_rpz: FixedU128::from_inner(91_000_000_000_000_000_000_u128), - pending_rewards: 41_675_375_000_000_000_000_u128, - ..global_farm_0 - } - ); - - //Second claim on same deposit from stopped yield farm. - //This should claim 0 rewards. - set_block_number(300_000); - //claim A1.1 (dep. A1 1-th time) - assert_eq!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ) - .unwrap(), - (global_farm_id, BSX, 0, unclaimable_rewards) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn claim_rewards_should_fail_with_liqudity_mining_canceled_when_yield_farm_is_destroyed() { - const FAIL_ON_DOUBLECLAIM: bool = true; - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - //Stop yield farming before removing. - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - //Delete yield farm before claim test. - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - assert_noop!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM - ), - Error::::LiquidityMiningCanceled - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn second_claim_rewards_should_work_when_doubleclaim_is_allowed() { - const FAIL_ON_DOUBLECLAIM: bool = true; - - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let (_, _, claimable_rewards, unclaimable_rewards) = LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - !FAIL_ON_DOUBLECLAIM, - ) - .unwrap(); - - assert_eq!(claimable_rewards, 23_306_074_766_355_140); - assert_eq!(unclaimable_rewards, 20_443_925_233_644_860); - - //Second claim in the same period should return 0 for `claimable_rewards` and real value for - //`unclaimable_rewards` - let (_, _, claimable_rewards, unclaimable_rewards) = LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - !FAIL_ON_DOUBLECLAIM, - ) - .unwrap(); - - assert_eq!(claimable_rewards, 0); - assert_eq!(unclaimable_rewards, 20_443_925_233_644_860); - - //check if double claim fails - assert_noop!( - LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - FAIL_ON_DOUBLECLAIM, - ), - Error::::DoubleClaimInPeriod - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -//NOTE: farms are initialize like this intentionally. Bug may not appear with only 1 yield farm. -#[test] -fn deposits_should_claim_same_amount_when_created_in_the_same_period() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const GLOBAL_FARM: GlobalFarmId = 1; - const YIELD_FARM_A: YieldFarmId = 2; - const YIELD_FARM_B: YieldFarmId = 3; - - const BOB_DEPOSIT: DepositId = 2; - const CHARLIE_DEPOSIT: DepositId = 3; - - const PLANNED_PERIODS: u64 = 10_000; - const BLOCKS_PER_PERIOD: u64 = 10; - const TOTAL_REWARDS_TO_DISTRIBUTE: u128 = 1_000_000 * ONE; - - //initialize farms - set_block_number(1000); - assert_ok!(LiquidityMining2::create_global_farm( - TOTAL_REWARDS_TO_DISTRIBUTE, - PLANNED_PERIODS, - BLOCKS_PER_PERIOD, - BSX, - BSX, - GC, - Perquintill::from_float(0.005), - 1_000, - One::one(), - )); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - One::one(), - None, - BSX_TKN1_AMM, - vec![BSX, TKN1] - )); - - //alice - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_A, - BSX_TKN1_AMM, - 1_000 * ONE, - |_, _, _| { Ok(ONE) } - )); - - set_block_number(1_500); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - One::one(), - None, - BSX_TKN2_AMM, - vec![BSX, TKN2] - )); - - set_block_number(2_000); - //bob - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 1_000 * ONE, - |_, _, _| { Ok(ONE) } - )); - - //charlie - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 1_000 * ONE, - |_, _, _| { Ok(ONE) } - )); - - let bob_bsx_balance_0 = Tokens::free_balance(BSX, &BOB); - let charlie_bsx_balance_0 = Tokens::free_balance(BSX, &CHARLIE); - - set_block_number(2_500); - let _ = LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); - - let _ = LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); - - let bob_rewards = Tokens::free_balance(BSX, &BOB) - bob_bsx_balance_0; - let charlie_rewards = Tokens::free_balance(BSX, &CHARLIE) - charlie_bsx_balance_0; - - pretty_assertions::assert_eq!(bob_rewards, charlie_rewards); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn claim_rewards_should_claim_correct_amount_when_yield_farm_was_resumed() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const REWARD_CURRENCY: AssetId = ACA; - - //Arrange - //periods timeline: - // |--- 10 active ---|--- 20 stopped ---|--- 10 active ---|claim_rewards() - // - set_block_number(20_000); - - let first_deposit_id = LiquidityMining::deposit_lp_shares( - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - 1_000_000 * ONE, - |_, _, _| Ok(10_000_000 * ONE), - ) - .unwrap(); - - let second_deposit_id = LiquidityMining::deposit_lp_shares( - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - 2_000_000 * ONE, - |_, _, _| Ok(20_000_000 * ONE), - ) - .unwrap(); - - set_block_number(30_000); - - // stop yield-farm - assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); - // resume yield-farm after 20 stopped periods. - set_block_number(50_000); - assert_ok!(LiquidityMining::resume_yield_farm( - DAVE, - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - FixedU128::from(10) - )); - - //Act & assert - // claim rewards after 10 periods so deposit should claim in total for 20(active) - // periods. - set_block_number(60_000); - - assert_eq!( - LiquidityMining::claim_rewards(ALICE, first_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), - ( - DAVE_FARM, - REWARD_CURRENCY, - 233_333_333_333_333_333_200, - 166_666_666_666_666_666_800, - ) - ); - - assert_eq!( - LiquidityMining::claim_rewards(ALICE, second_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), - ( - DAVE_FARM, - REWARD_CURRENCY, - 466_666_666_666_666_666_400, - 333_333_333_333_333_333_600, - ) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn claim_rewards_should_claim_correct_amount_when_deposit_is_created_after_yield_farm_was_resumed() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const REWARD_CURRENCY: AssetId = ACA; - - //Arrange - set_block_number(20_000); - - let first_deposit_id = LiquidityMining::deposit_lp_shares( - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - 1_000_000 * ONE, - |_, _, _| Ok(10_000_000 * ONE), - ) - .unwrap(); - - set_block_number(30_000); - - // stop yield-farm - assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); - - // resume yield-farm after 20 stopped periods. - set_block_number(50_000); - assert_ok!(LiquidityMining::resume_yield_farm( - DAVE, - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - FixedU128::from(10) - )); - - let second_deposit_id = LiquidityMining::deposit_lp_shares( - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - 2_000_000 * ONE, - |_, _, _| Ok(20_000_000 * ONE), - ) - .unwrap(); - - //Act & assert - //dp 1 = total periods: 40, mining periods: 20 - //dp 2 = total periods: 10, mining periods: 10, (this dp was created after yield-farm - //was resumed - set_block_number(60_000); - - assert_eq!( - LiquidityMining::claim_rewards(ALICE, first_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), - ( - DAVE_FARM, - REWARD_CURRENCY, - 233_333_333_333_333_333_200, - 166_666_666_666_666_666_800, - ) - ); - - assert_eq!( - LiquidityMining::claim_rewards(ALICE, second_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), - ( - DAVE_FARM, - REWARD_CURRENCY, - 218_181_818_181_818_181_600, - 181_818_181_818_181_818_400, - ) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn claim_rewards_should_claim_correct_amount_when_yield_was_resumed_multiple_times() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const REWARD_CURRENCY: AssetId = ACA; - - //Arrange - set_block_number(20_000); - - let first_deposit_id = LiquidityMining::deposit_lp_shares( - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - 1_000_000 * ONE, - |_, _, _| Ok(10_000_000 * ONE), - ) - .unwrap(); - - // stop yield-farm - set_block_number(30_000); - assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); - - // resume yield-farm - set_block_number(50_000); - assert_ok!(LiquidityMining::resume_yield_farm( - DAVE, - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - FixedU128::from(10) - )); - - // create second deposit - set_block_number(60_000); - let second_deposit_id = LiquidityMining::deposit_lp_shares( - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - 2_000_000 * ONE, - |_, _, _| Ok(20_000_000 * ONE), - ) - .unwrap(); - - // stop yield-farm - set_block_number(80_000); - assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); - - // resume yield-farm - set_block_number(90_000); - assert_ok!(LiquidityMining::resume_yield_farm( - DAVE, - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - FixedU128::from(10) - )); - - // stop yield-farm - set_block_number(100_000); - assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); - - // resume yield-farm - set_block_number(120_000); - assert_ok!(LiquidityMining::resume_yield_farm( - DAVE, - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - FixedU128::from(10) - )); - - //Act & assert - //claim rewards - set_block_number(140_000); - //dp 1 = total periods: 120, mining periods: 70 - //dp 2 = total periods: 80, mining periods: 50 - - assert_eq!( - LiquidityMining::claim_rewards(ALICE, first_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), - ( - DAVE_FARM, - REWARD_CURRENCY, - 988_235_294_117_647_058_000, - 411_764_705_882_352_942_000, - ) - ); - - assert_eq!( - LiquidityMining::claim_rewards(ALICE, second_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), - ( - DAVE_FARM, - REWARD_CURRENCY, - 1_333_333_333_333_333_332_000, - 666_666_666_666_666_668_000, - ) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn claim_rewards_should_claim_correct_amount_when_yield_was_resumed_multiple_times_and_is_stopped_now() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const REWARD_CURRENCY: AssetId = ACA; - - //Arrange - set_block_number(20_000); - - let first_deposit_id = LiquidityMining::deposit_lp_shares( - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - 1_000_000 * ONE, - |_, _, _| Ok(10_000_000 * ONE), - ) - .unwrap(); - - // stop yield-farm - set_block_number(30_000); - assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); - - // resume yield-farm - set_block_number(50_000); - assert_ok!(LiquidityMining::resume_yield_farm( - DAVE, - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - FixedU128::from(10) - )); - - // create second deposit - set_block_number(60_000); - let second_deposit_id = LiquidityMining::deposit_lp_shares( - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - 2_000_000 * ONE, - |_, _, _| Ok(20_000_000 * ONE), - ) - .unwrap(); - - // stop yield-farm - set_block_number(80_000); - assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); - - // resume yield-farm - set_block_number(90_000); - assert_ok!(LiquidityMining::resume_yield_farm( - DAVE, - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - FixedU128::from(10) - )); - - // stop yield-farm - set_block_number(100_000); - assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); - - // resume yield-farm - set_block_number(120_000); - assert_ok!(LiquidityMining::resume_yield_farm( - DAVE, - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - FixedU128::from(10) - )); - - // stop yield-farm - set_block_number(140_000); - assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); - - //Act & assert - //claim rewards - - set_block_number(200_000); - - //dp 1 = total periods: 120, mining periods: 70 - //dp 2 = total periods: 80, mining periods: 50 - - assert_eq!( - LiquidityMining::claim_rewards(ALICE, first_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), - ( - DAVE_FARM, - REWARD_CURRENCY, - 988_235_294_117_647_058_000, - 411_764_705_882_352_942_000, - ) - ); - - assert_eq!( - LiquidityMining::claim_rewards(ALICE, second_deposit_id, DAVE_BSX_TKN1_YIELD_FARM_ID, true,).unwrap(), - ( - DAVE_FARM, - REWARD_CURRENCY, - 1_333_333_333_333_333_332_000, - 666_666_666_666_666_668_000, - ) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} diff --git a/pallets/liquidity-mining/src/tests/create_global_farm.rs b/pallets/liquidity-mining/src/tests/create_global_farm.rs deleted file mode 100644 index b61d20165f5..00000000000 --- a/pallets/liquidity-mining/src/tests/create_global_farm.rs +++ /dev/null @@ -1,276 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn create_global_farm_should_work() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - let global_farm_id = 1; - let total_rewards: Balance = 50_000_000_000_000; - let reward_currency = BSX; - let planned_yielding_periods: BlockNumber = 1_000_000_000_u64; - let blocks_per_period = 20_000; - let incentivized_token = BSX; - let owner = ALICE; - let yield_per_period = Perquintill::from_percent(20); - let min_deposit = 10_000; - let max_reward_per_period: Balance = total_rewards.checked_div(planned_yielding_periods.into()).unwrap(); - - let created_at_block = 15_896; - - set_block_number(created_at_block); - - let global_farm_account = LiquidityMining::farm_account_id(global_farm_id).unwrap(); - - assert_eq!(Tokens::free_balance(reward_currency, &global_farm_account), 0); - - assert_eq!( - LiquidityMining::create_global_farm( - total_rewards, - planned_yielding_periods, - blocks_per_period, - incentivized_token, - reward_currency, - owner, - yield_per_period, - min_deposit, - One::one(), - ) - .unwrap(), - (global_farm_id, max_reward_per_period) - ); - - //Check if total_rewards are transferred to farm's account. - assert_eq!( - Tokens::free_balance(reward_currency, &global_farm_account), - total_rewards - ); - assert_eq!( - Tokens::free_balance(reward_currency, &ALICE), - (INITIAL_BALANCE * ONE - total_rewards) - ); - - let updated_at = created_at_block / blocks_per_period; - - let global_farm = GlobalFarmData::new( - global_farm_id, - updated_at, - reward_currency, - yield_per_period, - planned_yielding_periods, - blocks_per_period, - owner, - incentivized_token, - max_reward_per_period, - min_deposit, - One::one(), - ); - - assert_eq!(LiquidityMining::global_farm(global_farm_id).unwrap(), global_farm); - //Non-dustable check - assert_eq!(Whitelist::contains(&global_farm_account), true); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn create_global_farm_invalid_data_should_not_work() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - let created_at_block = 15_896; - - set_block_number(created_at_block); - - //total_rewards bellow mini. limit. - assert_noop!( - LiquidityMining::create_global_farm( - 100, - 1_000, - 300, - BSX, - BSX, - ALICE, - Perquintill::from_percent(20), - 1_000, - One::one(), - ), - Error::::InvalidTotalRewards - ); - - //planned_yielding_periods bellow min. limit. - assert_noop!( - LiquidityMining::create_global_farm( - 1_000_000, - 10, - 300, - BSX, - BSX, - ALICE, - Perquintill::from_percent(20), - 1_000, - One::one(), - ), - Error::::InvalidPlannedYieldingPeriods - ); - - //blocks_per_period is 0. - assert_noop!( - LiquidityMining::create_global_farm( - 1_000_000, - 1_000, - 0, - BSX, - BSX, - ALICE, - Perquintill::from_percent(20), - 1_000, - One::one(), - ), - Error::::InvalidBlocksPerPeriod - ); - - //yield_per_period is 0. - assert_noop!( - LiquidityMining::create_global_farm( - 1_000_000, - 1_000, - 1, - BSX, - BSX, - ALICE, - Perquintill::from_percent(0), - 1_000, - One::one(), - ), - Error::::InvalidYieldPerPeriod - ); - - //min. deposit < crate::MIN_DEPOSIT - assert_noop!( - LiquidityMining::create_global_farm( - 1_000_000, - 1_000, - 1, - BSX, - BSX, - ALICE, - Perquintill::from_percent(10), - crate::MIN_DEPOSIT - 1, - One::one(), - ), - Error::::InvalidMinDeposit - ); - - //price adjustment is 0. - assert_noop!( - LiquidityMining::create_global_farm( - 1_000_000, - 1_000, - 1, - BSX, - BSX, - ALICE, - Perquintill::from_percent(10), - 1_000, - FixedU128::from(0_u128), - ), - Error::::InvalidPriceAdjustment - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn create_global_farm_with_inssufficient_balance_should_not_work() { - //Owner's account balance is 1M BSX. - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::create_global_farm( - 1_000_001 * ONE, - 1_000, - 1, - BSX, - BSX, - ACCOUNT_WITH_1M, - Perquintill::from_percent(20), - 10_000, - One::one(), - ), - Error::::InsufficientRewardCurrencyBalance - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn create_global_farm_should_not_work_when_reward_currency_is_not_registered() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::create_global_farm( - 1_000_000 * ONE, - 1_000, - 1, - BSX, - UNKNOWN_ASSET, - GC, - Perquintill::from_percent(20), - 10_000, - One::one(), - ), - Error::::RewardCurrencyNotRegistered - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn create_global_farm_should_not_work_when_incentivized_asset_is_not_registered() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::create_global_farm( - 1_000_000 * ONE, - 1_000, - 1, - UNKNOWN_ASSET, - BSX, - GC, - Perquintill::from_percent(20), - 10_000, - One::one(), - ), - Error::::IncentivizedAssetNotRegistered - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} diff --git a/pallets/liquidity-mining/src/tests/create_yield_farm.rs b/pallets/liquidity-mining/src/tests/create_yield_farm.rs deleted file mode 100644 index 9047ffd51c4..00000000000 --- a/pallets/liquidity-mining/src/tests/create_yield_farm.rs +++ /dev/null @@ -1,485 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn create_yield_farm_should_work() { - //NOTE: global_farm.updated_at isn't changed because global farm is empty. - let test_data = vec![ - ( - AssetPair { - asset_in: BSX, - asset_out: ACA, - }, - YieldFarmData { - id: 13, - updated_at: 17, - total_shares: 0, - total_valued_shares: 0, - accumulated_rpvs: Zero::zero(), - accumulated_rpz: Zero::zero(), - multiplier: FixedU128::from(20_000_u128), - loyalty_curve: Some(LoyaltyCurve::default()), - entries_count: 0, - state: FarmState::Active, - left_to_distribute: 0, - total_stopped: 0, - _phantom: PhantomData, - }, - BSX_ACA_AMM, - ALICE, - ALICE_FARM, - 17_850, - GlobalFarmData { - updated_at: 17, - live_yield_farms_count: 1, - total_yield_farms_count: 1, - ..get_predefined_global_farm_ins1(0) - }, - ), - ( - AssetPair { - asset_in: KSM, - asset_out: BSX, - }, - YieldFarmData { - id: 14, - updated_at: 17, - total_shares: 0, - total_valued_shares: 0, - accumulated_rpvs: Zero::zero(), - accumulated_rpz: Zero::zero(), - multiplier: FixedU128::from(10_000_u128), - loyalty_curve: None, - entries_count: 0, - state: FarmState::Active, - left_to_distribute: 0, - total_stopped: 0, - _phantom: PhantomData, - }, - BSX_KSM_AMM, - ALICE, - ALICE_FARM, - 17_850, - GlobalFarmData { - updated_at: 17, - live_yield_farms_count: 2, - total_yield_farms_count: 2, - ..get_predefined_global_farm_ins1(0) - }, - ), - ( - AssetPair { - asset_in: BSX, - asset_out: ETH, - }, - YieldFarmData { - id: 15, - updated_at: 20, - total_shares: 0, - total_valued_shares: 0, - accumulated_rpvs: Zero::zero(), - accumulated_rpz: Zero::zero(), - multiplier: FixedU128::from(10_000_u128), - loyalty_curve: Some(LoyaltyCurve { - initial_reward_percentage: FixedU128::from_inner(100_000_000_000_000_000), - scale_coef: 50, - }), - state: FarmState::Active, - entries_count: 0, - left_to_distribute: 0, - total_stopped: 0, - _phantom: PhantomData, - }, - BSX_ETH_AMM, - ALICE, - ALICE_FARM, - 20_000, - GlobalFarmData { - updated_at: 20, - live_yield_farms_count: 3, - total_yield_farms_count: 3, - ..get_predefined_global_farm_ins1(0) - }, - ), - ( - AssetPair { - asset_in: BSX, - asset_out: ETH, - }, - YieldFarmData { - id: 16, - updated_at: 2, - total_shares: 0, - total_valued_shares: 0, - accumulated_rpvs: Zero::zero(), - accumulated_rpz: Zero::zero(), - multiplier: FixedU128::from(50_000_128), - loyalty_curve: Some(LoyaltyCurve { - initial_reward_percentage: FixedU128::from_inner(1), - scale_coef: 0, - }), - state: FarmState::Active, - entries_count: 0, - left_to_distribute: 0, - total_stopped: 0, - _phantom: PhantomData, - }, - BSX_ETH_AMM, - BOB, - BOB_FARM, - 20_000, - GlobalFarmData { - updated_at: 2, - live_yield_farms_count: 1, - total_yield_farms_count: 1, - ..get_predefined_global_farm_ins1(1) - }, - ), - ]; - - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - for (assets, yield_farm, amm_id, who, global_farm_id, now, global_farm) in test_data.clone() { - set_block_number(now); - - assert_eq!( - LiquidityMining::create_yield_farm( - who, - global_farm_id, - yield_farm.multiplier, - yield_farm.loyalty_curve.clone(), - amm_id, - vec![assets.asset_in, assets.asset_out], - ) - .unwrap(), - yield_farm.id - ); - - assert_eq!(LiquidityMining::global_farm(global_farm_id).unwrap(), global_farm); - - assert_eq!( - LiquidityMining::active_yield_farm(amm_id, global_farm_id).unwrap(), - yield_farm.id - ); - - assert_eq!( - LiquidityMining::yield_farm((amm_id, global_farm_id, yield_farm.id)).unwrap(), - YieldFarmData { ..yield_farm } - ); - } - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn add_yield_farm_missing_incentivized_asset_should_not_work() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::create_yield_farm( - ALICE, - ALICE_FARM, - FixedU128::from(10_000_u128), - None, - KSM_DOT_AMM, - //Neither KSM nor DOT is incentivized by the farm. - vec![KSM, DOT], - ), - Error::::MissingIncentivizedAsset - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn add_yield_farm_not_owner_should_not_work() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::create_yield_farm( - BOB, - ALICE_FARM, - FixedU128::from(10_000_u128), - None, - BSX_HDX_AMM, - vec![BSX, HDX], - ), - Error::::Forbidden - ); - - assert_noop!( - LiquidityMining::create_yield_farm( - BOB, - ALICE_FARM, - FixedU128::from(10_000_u128), - Some(LoyaltyCurve::default()), - BSX_HDX_AMM, - vec![BSX, HDX], - ), - Error::::Forbidden - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn add_yield_farm_invalid_loyalty_curve_should_not_work() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - let curves = vec![ - Some(LoyaltyCurve { - initial_reward_percentage: FixedU128::one(), - scale_coef: 0, - }), - Some(LoyaltyCurve { - initial_reward_percentage: FixedU128::from_float(1.0), - scale_coef: 1_000_000, - }), - Some(LoyaltyCurve { - initial_reward_percentage: FixedU128::from_float(1.000_000_000_000_000_001), - scale_coef: 25_996_000, - }), - Some(LoyaltyCurve { - initial_reward_percentage: FixedU128::from(1_u128), - scale_coef: 25_996_000, - }), - Some(LoyaltyCurve { - initial_reward_percentage: FixedU128::from(5_u128), - scale_coef: 25_996_000, - }), - Some(LoyaltyCurve { - initial_reward_percentage: FixedU128::from(16_874_354_654_u128), - scale_coef: 25_996_000, - }), - ]; - - for c in curves { - assert_noop!( - LiquidityMining::create_yield_farm( - ALICE, - ALICE_FARM, - FixedU128::from(10_000_u128), - c, - BSX_HDX_AMM, - vec![BSX, HDX], - ), - Error::::InvalidInitialRewardPercentage - ); - } - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn add_yield_farm_invalid_multiplier_should_not_work() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::create_yield_farm( - ALICE, - ALICE_FARM, - MIN_YIELD_FARM_MULTIPLIER - FixedU128::from_inner(1_u128), - Some(LoyaltyCurve::default()), - BSX_HDX_AMM, - vec![BSX, HDX], - ), - Error::::InvalidMultiplier - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn add_yield_farm_add_duplicate_amm_should_not_work() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - set_block_number(20_000); - - let aca_ksm_assets = AssetPair { - asset_in: ACA, - asset_out: KSM, - }; - - let aca_ksm_amm_account = - AMM_POOLS.with(|v| v.borrow().get(&asset_pair_to_map_key(aca_ksm_assets)).unwrap().0); - - assert!(LiquidityMining::active_yield_farm(aca_ksm_amm_account, CHARLIE_FARM).is_some()); - - //Try to add same amm second time in the same block(period) - assert_noop!( - LiquidityMining::create_yield_farm( - CHARLIE, - CHARLIE_FARM, - FixedU128::from(9_000_u128), - Some(LoyaltyCurve::default()), - ACA_KSM_AMM, - vec![ACA, KSM], - ), - Error::::YieldFarmAlreadyExists - ); - - //Try to add same amm second time in later block(period). - set_block_number(30_000); - - assert_noop!( - LiquidityMining::create_yield_farm( - CHARLIE, - CHARLIE_FARM, - FixedU128::from(9_000_u128), - Some(LoyaltyCurve::default()), - ACA_KSM_AMM, - vec![ACA, KSM], - ), - Error::::YieldFarmAlreadyExists - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn add_yield_farm_global_farm_full_should_not_work() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - //GC FARM is initialized with 2 yield farms and mock limit is 4. - - // This should works 3-rd yield farm - assert_ok!(LiquidityMining::create_yield_farm( - GC, - GC_FARM, - 10_000.into(), - Some(LoyaltyCurve::default()), - BSX_ACA_AMM, - vec![BSX, ACA], - )); - - // This should works 4-th yield farm - let bsx_dot_yield_farm_id = LiquidityMining::create_yield_farm( - GC, - GC_FARM, - 10_000.into(), - Some(LoyaltyCurve::default()), - BSX_DOT_AMM, - vec![BSX, DOT], - ) - .unwrap(); - - // This should fail. - assert_noop!( - LiquidityMining::create_yield_farm( - GC, - GC_FARM, - 10_000.into(), - Some(LoyaltyCurve::default()), - BSX_HDX_AMM, - vec![BSX, HDX], - ), - Error::::GlobalFarmIsFull - ); - - //Stop farm - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_DOT_AMM)); - - //This still should now work because yield farms in storage are included in counts. - assert_noop!( - LiquidityMining::create_yield_farm( - GC, - GC_FARM, - 10_000.into(), - Some(LoyaltyCurve::default()), - BSX_HDX_AMM, - vec![BSX, HDX], - ), - Error::::GlobalFarmIsFull - ); - - //Stop and destroy yield farm (destroyed farm stays in the storage because of deposit) - //deposit to yield so it's not flushed on destroy - assert_ok!(LiquidityMining::deposit_lp_shares( - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - 1_000, - |_, _, _| { Ok(1_000_u128) } - )); - - //stop and destroy - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)) - .unwrap() - .state, - FarmState::Terminated - ); - - //This still should now work because deleted yield farms in storage are included in counts. - assert_noop!( - LiquidityMining::create_yield_farm( - GC, - GC_FARM, - 10_000.into(), - Some(LoyaltyCurve::default()), - BSX_HDX_AMM, - vec![BSX, HDX], - ), - Error::::GlobalFarmIsFull - ); - - //Destroy stopped empty farm(it will be flushed from storage). - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - bsx_dot_yield_farm_id, - BSX_DOT_AMM - )); - - //This should pass because yield farm was flushed from storage. - assert_ok!(LiquidityMining::create_yield_farm( - GC, - GC_FARM, - 10_000.into(), - Some(LoyaltyCurve::default()), - BSX_HDX_AMM, - vec![BSX, HDX], - )); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} diff --git a/pallets/liquidity-mining/src/tests/deposit_lp_shares.rs b/pallets/liquidity-mining/src/tests/deposit_lp_shares.rs deleted file mode 100644 index cb41b1e660c..00000000000 --- a/pallets/liquidity-mining/src/tests/deposit_lp_shares.rs +++ /dev/null @@ -1,651 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn deposit_lp_shares_should_work() { - //NOTE: farm incentivize BSX token. - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - let global_farm_id = GC_FARM; - let global_farm_account = LiquidityMining::farm_account_id(global_farm_id).unwrap(); - let pot = LiquidityMining::pot_account_id().unwrap(); - - //DEPOSIT 1: - set_block_number(1_800); //18-th period - - let deposited_amount = 50 * ONE; - let yield_farm_id = GC_BSX_TKN1_YIELD_FARM_ID; - //_0 - value berfore act - let bsx_tkn1_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(); - - assert_eq!( - LiquidityMining::deposit_lp_shares( - global_farm_id, - yield_farm_id, - BSX_TKN1_AMM, - deposited_amount, - |_, _, _| { Ok(2_500 * ONE) } - ) - .unwrap(), - PREDEFINED_DEPOSIT_IDS[0] - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - total_shares_z: 12_500 * ONE, - updated_at: 18, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(), - YieldFarmData { - total_shares: deposited_amount, - total_valued_shares: 2_500 * ONE, - updated_at: 18, - entries_count: 1, - ..bsx_tkn1_yield_farm_0 - }, - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(), - DepositData { - shares: deposited_amount, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![YieldFarmEntry::new( - global_farm_id, - GC_BSX_TKN1_YIELD_FARM_ID, - 2_500 * ONE, - Zero::zero(), - 18, - 0 - )] - .try_into() - .unwrap(), - }, - ); - - // DEPOSIT 2 (deposit in the same period): - let deposited_amount = 80 * ONE; - let yield_farm_id = GC_BSX_TKN1_YIELD_FARM_ID; - //_0 - value berfore act - let bsx_tkn1_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(); - - assert_eq!( - LiquidityMining::deposit_lp_shares( - global_farm_id, - yield_farm_id, - BSX_TKN1_AMM, - deposited_amount, - |_, _, _| { Ok(4_160 * ONE) } - ) - .unwrap(), - PREDEFINED_DEPOSIT_IDS[1] - ); - - assert_eq!( - LiquidityMining::global_farm(global_farm_id).unwrap(), - GlobalFarmData { - accumulated_rpz: Zero::zero(), - updated_at: 18, - accumulated_paid_rewards: 0, - total_shares_z: 33_300 * ONE, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(), - YieldFarmData { - updated_at: 18, - total_shares: 130 * ONE, - total_valued_shares: 6_660 * ONE, - entries_count: 2, - ..bsx_tkn1_yield_farm_0 - }, - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[1]).unwrap(), - DepositData { - shares: deposited_amount, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![YieldFarmEntry::new( - global_farm_id, - GC_BSX_TKN1_YIELD_FARM_ID, - 4_160 * ONE, - Zero::zero(), - 18, - 0 - )] - .try_into() - .unwrap(), - }, - ); - - //Nohtig was claimed by yield-farm so nothings should change. - assert_eq!(Tokens::free_balance(BSX, &global_farm_account), 30_000_000_000 * ONE); - assert_eq!(Tokens::free_balance(BSX, &pot), 0); - - // DEPOSIT 3 (same period, second yield farm): - let deposited_amount = 25 * ONE; - let yield_farm_id = GC_BSX_TKN2_YIELD_FARM_ID; - - //_0 - value berfore act. - let bsx_tkn2_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(); - - assert_eq!( - LiquidityMining::deposit_lp_shares( - global_farm_id, - yield_farm_id, - BSX_TKN2_AMM, - deposited_amount, - |_, _, _| { Ok(200 * ONE) } - ) - .unwrap(), - PREDEFINED_DEPOSIT_IDS[2] - ); - - assert_eq!( - LiquidityMining::global_farm(global_farm_id).unwrap(), - GlobalFarmData { - updated_at: 18, - accumulated_rpz: Zero::zero(), - accumulated_paid_rewards: 0, - total_shares_z: 35_300 * ONE, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, yield_farm_id)).unwrap(), - YieldFarmData { - updated_at: 18, - total_shares: 25 * ONE, - total_valued_shares: 200 * ONE, - entries_count: 1, - ..bsx_tkn2_yield_farm_0 - }, - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[2]).unwrap(), - DepositData { - shares: deposited_amount, - amm_pool_id: BSX_TKN2_AMM, - yield_farm_entries: vec![YieldFarmEntry::new( - global_farm_id, - GC_BSX_TKN2_YIELD_FARM_ID, - 200 * ONE, - Zero::zero(), - 18, - 0 - )] - .try_into() - .unwrap(), - }, - ); - - //Garms wasn't updated in this period so no claim from global farm happened. - assert_eq!(Tokens::free_balance(BSX, &global_farm_account), 30_000_000_000 * ONE); - assert_eq!(Tokens::free_balance(BSX, &pot), 0); - - // DEPOSIT 4 (new period): - set_block_number(2051); //period 20 - - let deposited_amount = 800 * ONE; - let yield_farm_id = GC_BSX_TKN2_YIELD_FARM_ID; - - //_0 - value berfore act. - let bsx_tkn2_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(); - - assert_eq!( - LiquidityMining::deposit_lp_shares( - global_farm_id, - yield_farm_id, - BSX_TKN2_AMM, - deposited_amount, - |_, _, _| { Ok(46_400 * ONE) } - ) - .unwrap(), - PREDEFINED_DEPOSIT_IDS[3] - ); - - assert_eq!( - LiquidityMining::global_farm(global_farm_id).unwrap(), - GlobalFarmData { - updated_at: 20, - accumulated_rpz: FixedU128::one(), - pending_rewards: 33_300 * ONE, - accumulated_paid_rewards: 2_000 * ONE, - total_shares_z: 499_300 * ONE, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(), - YieldFarmData { - updated_at: 20, - accumulated_rpvs: FixedU128::from(10), - accumulated_rpz: FixedU128::one(), - total_shares: 825 * ONE, - total_valued_shares: 46_600 * ONE, - entries_count: 2, - left_to_distribute: 2_000 * ONE, - ..bsx_tkn2_yield_farm_0 - }, - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[3]).unwrap(), - DepositData { - shares: deposited_amount, - amm_pool_id: BSX_TKN2_AMM, - yield_farm_entries: vec![YieldFarmEntry::new( - global_farm_id, - GC_BSX_TKN2_YIELD_FARM_ID, - 46_400 * ONE, - FixedU128::from(10), - 20, - 0 - )] - .try_into() - .unwrap(), - }, - ); - - let reserved_for_both_farms = 35_300 * ONE; - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - (30_000_000_000 * ONE - reserved_for_both_farms) - ); - - assert_eq!(Tokens::free_balance(BSX, &pot), reserved_for_both_farms); - - // DEPOSIT 5 (same period, second liq pool yield farm): - set_block_number(2_586); //period 20 - - let deposited_amount = 87 * ONE; - let yield_farm_id = GC_BSX_TKN2_YIELD_FARM_ID; - - //_0 - value berfore act. - let bsx_tkn2_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(); - - assert_eq!( - LiquidityMining::deposit_lp_shares( - global_farm_id, - yield_farm_id, - BSX_TKN2_AMM, - deposited_amount, - |_, _, _| { Ok(261 * ONE) } - ) - .unwrap(), - PREDEFINED_DEPOSIT_IDS[4] - ); - - assert_eq!( - LiquidityMining::global_farm(global_farm_id).unwrap(), - GlobalFarmData { - updated_at: 25, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares_z: 501_910 * ONE, - pending_rewards: 116_550 * ONE, - accumulated_paid_rewards: 1_167_000 * ONE, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 912 * ONE, - total_valued_shares: 46_861 * ONE, - entries_count: 3, - left_to_distribute: 1_167_000 * ONE, - ..bsx_tkn2_yield_farm_0 - }, - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[4]).unwrap(), - DepositData { - shares: deposited_amount, - amm_pool_id: BSX_TKN2_AMM, - yield_farm_entries: vec![YieldFarmEntry::new( - global_farm_id, - GC_BSX_TKN2_YIELD_FARM_ID, - 261 * ONE, - FixedU128::from_inner(35_000_000_000_000_000_000_u128), - 25, - 0 - )] - .try_into() - .unwrap(), - }, - ); - - let reserved_for_both_farms = 1_283_550 * ONE; - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - (30_000_000_000 * ONE - reserved_for_both_farms) - ); - assert_eq!(Tokens::free_balance(BSX, &pot), reserved_for_both_farms); - - // DEPOSIT 6 (same period): - set_block_number(2_596); //period 20 - - let deposited_amount = 48 * ONE; - let yield_farm_id = GC_BSX_TKN2_YIELD_FARM_ID; - - //_0 - value berfore act. - let bsx_tkn2_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(); - - assert_eq!( - LiquidityMining::deposit_lp_shares( - global_farm_id, - yield_farm_id, - BSX_TKN2_AMM, - deposited_amount, - |_, _, _| { Ok(768 * ONE) } - ) - .unwrap(), - PREDEFINED_DEPOSIT_IDS[5] - ); - - assert_eq!( - LiquidityMining::global_farm(global_farm_id).unwrap(), - GlobalFarmData { - updated_at: 25, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares_z: 509_590 * ONE, - pending_rewards: 116_550 * ONE, - accumulated_paid_rewards: 1_167_000 * ONE, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN2_AMM, global_farm_id, yield_farm_id)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 960 * ONE, - total_valued_shares: 47_629 * ONE, - entries_count: 4, - ..bsx_tkn2_yield_farm_0 //NOTE: same period so nothing claimed by farm - }, - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[5]).unwrap(), - DepositData { - shares: deposited_amount, - amm_pool_id: BSX_TKN2_AMM, - yield_farm_entries: vec![YieldFarmEntry::new( - global_farm_id, - GC_BSX_TKN2_YIELD_FARM_ID, - 768 * ONE, - FixedU128::from_inner(35_000_000_000_000_000_000_u128), - 25, - 0 - )] - .try_into() - .unwrap(), - }, - ); - - let reserved_for_both_farms = 1_283_550 * ONE; - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - (30_000_000_000 * ONE - reserved_for_both_farms) - ); - assert_eq!(Tokens::free_balance(BSX, &pot), reserved_for_both_farms); - - // DEPOSIT 7 : (same period different yield farm) - set_block_number(2_596); //period 20 - - let deposited_amount = 486 * ONE; - let yield_farm_id = GC_BSX_TKN1_YIELD_FARM_ID; - - //_0 - value berfore act. - let bsx_tkn1_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(); - - assert_eq!( - LiquidityMining::deposit_lp_shares( - global_farm_id, - yield_farm_id, - BSX_TKN1_AMM, - deposited_amount, - |_, _, _| { Ok(38_880 * ONE) } - ) - .unwrap(), - PREDEFINED_DEPOSIT_IDS[6] - ); - - assert_eq!( - LiquidityMining::global_farm(global_farm_id).unwrap(), - GlobalFarmData { - updated_at: 25, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares_z: 703_990 * ONE, - pending_rewards: 0, - accumulated_paid_rewards: 1_283_550 * ONE, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, global_farm_id, yield_farm_id)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 616 * ONE, - total_valued_shares: 45_540 * ONE, - entries_count: 3, - left_to_distribute: 116_550 * ONE, - ..bsx_tkn1_yield_farm_0 - }, - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[6]).unwrap(), - DepositData { - shares: deposited_amount, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![YieldFarmEntry::new( - global_farm_id, - GC_BSX_TKN1_YIELD_FARM_ID, - 38_880 * ONE, - FixedU128::from_inner(17_500_000_000_000_000_000_u128), - 25, - 0 - )] - .try_into() - .unwrap(), - }, - ); - - let reserved_for_both_farms = 1_283_550 * ONE; - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - (30_000_000_000 * ONE - reserved_for_both_farms) - ); - assert_eq!(Tokens::free_balance(BSX, &pot), reserved_for_both_farms); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - - //Deposit to farm with different incentivized_asset and reward_currency. - //Charlie's farm incentivize KSM and reward currency is ACA - //This test only check if valued shares are correctly calculated if reward and incentivized - //assets are different, otherwise farm behavior is same as in test above. - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - set_block_number(2_596); //period 25 - - let deposited_amount = 1_000_000 * ONE; - let deposit_id = 1; //1 - because new test ext - let yield_farm_id = CHARLIE_ACA_KSM_YIELD_FARM_ID; - assert_eq!( - LiquidityMining::deposit_lp_shares( - CHARLIE_FARM, - yield_farm_id, - ACA_KSM_AMM, - deposited_amount, - |_, _, _| { Ok(16_000_000 * ONE) } - ) - .unwrap(), - deposit_id - ); - - assert_eq!( - LiquidityMining::deposit(deposit_id).unwrap(), - DepositData { - shares: deposited_amount, - amm_pool_id: ACA_KSM_AMM, - yield_farm_entries: vec![YieldFarmEntry::new( - CHARLIE_FARM, - CHARLIE_ACA_KSM_YIELD_FARM_ID, - 16_000_000 * ONE, - Zero::zero(), - 25, - 0 - )] - .try_into() - .unwrap(), - }, - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn deposit_lp_shares_bellow_min_deposit_should_not_work() { - let _ = predefined_test_ext_with_deposits().execute_with(|| { - with_transaction(|| { - //NOTE: min. deposit is 10 - let yield_farm_id = GC_BSX_TKN1_YIELD_FARM_ID; - - assert_noop!( - LiquidityMining::deposit_lp_shares(GC_FARM, yield_farm_id, BSX_TKN1_AMM, 0, |_, _, _| { Ok(10_u128) }), - Error::::InvalidDepositAmount - ); - - assert_noop!( - LiquidityMining::deposit_lp_shares(GC_FARM, yield_farm_id, BSX_TKN1_AMM, 1, |_, _, _| { Ok(10_u128) }), - Error::::InvalidDepositAmount - ); - - assert_noop!( - LiquidityMining::deposit_lp_shares(GC_FARM, yield_farm_id, BSX_TKN1_AMM, 8, |_, _, _| { Ok(10_u128) }), - Error::::InvalidDepositAmount - ); - - //margin value should works - assert_ok!(LiquidityMining::deposit_lp_shares( - GC_FARM, - yield_farm_id, - BSX_TKN1_AMM, - crate::MIN_DEPOSIT, - |_, _, _| { Ok(crate::MIN_DEPOSIT) } - )); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }) - }); -} - -#[test] -fn deposit_lp_shares_non_existing_yield_farm_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::deposit_lp_shares(GC_FARM, BSX_DOT_YIELD_FARM_ID, BSX_DOT_AMM, 10_000, |_, _, _| { - Ok(10_u128) - }), - Error::::YieldFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn deposit_lp_shares_stop_yield_farm_should_not_work() { - let _ = predefined_test_ext_with_deposits().execute_with(|| { - with_transaction(|| { - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - assert_noop!( - LiquidityMining::deposit_lp_shares( - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - 10_000, - |_, _, _| { Ok(10_u128) } - ), - Error::::LiquidityMiningCanceled - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }) - }); -} - -#[test] -fn deposit_lp_shares_should_not_work_when_valued_shares_are_bellow_min_deposit() { - let _ = predefined_test_ext_with_deposits().execute_with(|| { - with_transaction(|| { - assert_noop!( - LiquidityMining::deposit_lp_shares( - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - 100_000, - |_, _, _| { Ok(MIN_DEPOSIT - 1) } - ), - Error::::IncorrectValuedShares - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }) - }); -} diff --git a/pallets/liquidity-mining/src/tests/full_run.rs b/pallets/liquidity-mining/src/tests/full_run.rs deleted file mode 100644 index ea8bd67dcb0..00000000000 --- a/pallets/liquidity-mining/src/tests/full_run.rs +++ /dev/null @@ -1,789 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -use crate::tests::mock::LiquidityMining2; -use test_utils::assert_balance_approx; - -use rand::Rng; - -//This test test full run LM. Global farm is not full but it's running longer than expected. Users -//should be able to claim expected amount. -//This test case is without loyalty factor. -#[test] -fn non_full_farm_running_longer_than_expected() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const GLOBAL_FARM: GlobalFarmId = 1; - const YIELD_FARM_A: YieldFarmId = 2; - const YIELD_FARM_B: YieldFarmId = 3; - - const ALICE_DEPOSIT: DepositId = 1; - const BOB_DEPOSIT: DepositId = 2; - const CHARLIE_DEPOSIT: DepositId = 3; - - //initialize farms - set_block_number(100); - assert_ok!(LiquidityMining2::create_global_farm( - 200_000 * ONE, - 20, - 10, - BSX, - BSX, - GC, - Perquintill::from_float(0.5), - 1_000, - One::one(), - )); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::from(2_u128), - None, - BSX_TKN1_AMM, - vec![BSX, TKN1], - )); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::from(1_u128), - None, - BSX_TKN2_AMM, - vec![BSX, TKN2], - )); - - set_block_number(120); - //alice - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_A, - BSX_TKN1_AMM, - 5_000 * ONE, - |_, _, _| { Ok(5_000 * ONE) } - )); - - //bob - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 2_500 * ONE, - |_, _, _| { Ok(2_500 * ONE) } - )); - - //charlie - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 2_500 * ONE, - |_, _, _| { Ok(2_500 * ONE) } - )); - - set_block_number(401); - - let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); - let bob_bsx_balance_0 = Tokens::free_balance(BSX, &BOB); - let charlie_bsx_balance_0 = Tokens::free_balance(BSX, &CHARLIE); - - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - ALICE_DEPOSIT, - YIELD_FARM_A, - unclaimable - )); - - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - BOB_DEPOSIT, - YIELD_FARM_B, - unclaimable - )); - - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - CHARLIE_DEPOSIT, - YIELD_FARM_B, - unclaimable - )); - - let alice_claimed = Tokens::free_balance(BSX, &ALICE) - alice_bsx_balance_0; - let bob_claimed = Tokens::free_balance(BSX, &BOB) - bob_bsx_balance_0; - let charlie_claimed = Tokens::free_balance(BSX, &CHARLIE) - charlie_bsx_balance_0; - - let claimed_total = alice_claimed + bob_claimed + charlie_claimed; - - assert_eq!(claimed_total.abs_diff(200_000 * ONE), 1002); - - let yield_farm_a_claimed = alice_claimed; - let yield_farm_b_claimed = bob_claimed + charlie_claimed; - - const TOLERANCE: u128 = 10; - assert!( - yield_farm_a_claimed.abs_diff(2 * yield_farm_b_claimed).le(&TOLERANCE), - "yield_farm_a_claimed == 2 * yield_farm_b_claimed" - ); - - assert!( - alice_claimed.abs_diff(4 * bob_claimed).le(&TOLERANCE), - "alice_claimed == 4 * bob_claimed" - ); - - assert_eq!(bob_claimed, charlie_claimed, "bob_claimed == charlie_claimed"); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -//This test tests `update_global_farm` and `update_yield_farm` after farm distributed all the -//rewards. -#[test] -fn non_full_farm_distribute_everything_and_update_farms() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const GLOBAL_FARM: GlobalFarmId = 1; - const YIELD_FARM_A: YieldFarmId = 2; - const YIELD_FARM_B: YieldFarmId = 3; - - const ALICE_DEPOSIT: DepositId = 1; - const BOB_DEPOSIT: DepositId = 2; - const CHARLIE_DEPOSIT: DepositId = 3; - - //initialize farms - set_block_number(100); - assert_ok!(LiquidityMining2::create_global_farm( - 200_000 * ONE, - 20, - 10, - BSX, - BSX, - GC, - Perquintill::from_float(0.5), - 1_000, - One::one(), - )); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::from(2_u128), - None, - BSX_TKN1_AMM, - vec![BSX, TKN1], - )); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::from(1_u128), - None, - BSX_TKN2_AMM, - vec![BSX, TKN2], - )); - - set_block_number(120); - //alice - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_A, - BSX_TKN1_AMM, - 5_000 * ONE, - |_, _, _| { Ok(5_000 * ONE) } - )); - - set_block_number(140); - //bob - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 2_500 * ONE, - |_, _, _| { Ok(2_500 * ONE) } - )); - - //charlie - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 2_500 * ONE, - |_, _, _| { Ok(2_500 * ONE) } - )); - - set_block_number(401); - - //last farms update and claim everything - let _ = LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); - - let _ = LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); - - let _ = LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); - - assert_eq!( - Tokens::free_balance(BSX, &LiquidityMining2::farm_account_id(GLOBAL_FARM).unwrap()), - 1_000 - ); - - assert_eq!( - Tokens::free_balance(BSX, &LiquidityMining2::pot_account_id().unwrap()), - 0 - ); - - set_block_number(501); - let (_, _, claimed, unclaimable) = - LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); - - assert_eq!(claimed, 0); - assert_eq!(unclaimable, 0); - - assert_eq!(LiquidityMining2::global_farm(GLOBAL_FARM).unwrap().updated_at, 50); - assert_eq!( - LiquidityMining2::yield_farm((BSX_TKN1_AMM, GLOBAL_FARM, YIELD_FARM_A)) - .unwrap() - .updated_at, - 50 - ); - - set_block_number(1000); - let _ = LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert_eq!(LiquidityMining2::global_farm(GLOBAL_FARM).unwrap().updated_at, 100); - assert_eq!( - LiquidityMining2::yield_farm((BSX_TKN2_AMM, GLOBAL_FARM, YIELD_FARM_B)) - .unwrap() - .updated_at, - 100 - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -//This test tests `update_global_farm` and `update_yield_farm` after farm distributed all the -//rewards. -#[test] -fn overcrowded_farm_running_longer_than_expected() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const GLOBAL_FARM: GlobalFarmId = 1; - const YIELD_FARM_A: YieldFarmId = 2; - const YIELD_FARM_B: YieldFarmId = 3; - - const ALICE_DEPOSIT: DepositId = 1; - const BOB_DEPOSIT: DepositId = 2; - const CHARLIE_DEPOSIT: DepositId = 3; - - //initialize farms - set_block_number(100); - assert_ok!(LiquidityMining2::create_global_farm( - 200_000 * ONE, - 20, - 10, - BSX, - BSX, - GC, - Perquintill::from_float(0.5), - 1_000, - One::one(), - )); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::from(2_u128), - None, - BSX_TKN1_AMM, - vec![BSX, TKN1], - )); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::from(1_u128), - None, - BSX_TKN2_AMM, - vec![BSX, TKN2], - )); - - //NOTE: farm is overcrowded when Z > 20_000 - set_block_number(120); - //alice - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_A, - BSX_TKN1_AMM, - 10_000 * ONE, - |_, _, _| { Ok(10_000 * ONE) } - )); - - //bob - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 5_000 * ONE, - |_, _, _| { Ok(5_000 * ONE) } - )); - - //charlie - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 5_000 * ONE, - |_, _, _| { Ok(5_000 * ONE) } - )); - - let mut block_number = 131; - - let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); - let bob_bsx_balance_0 = Tokens::free_balance(BSX, &BOB); - let charlie_bsx_balance_0 = Tokens::free_balance(BSX, &CHARLIE); - - let mut last_alice_balance = alice_bsx_balance_0; - let mut last_bob_balance = bob_bsx_balance_0; - let mut last_charlie_balance = charlie_bsx_balance_0; - //NOTE: we must be able to pay at least for 20 periods (131 + (20 * 10)) - while block_number < 331 { - set_block_number(block_number); - - //alice - let _ = LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); - assert!(Tokens::free_balance(BSX, &ALICE).gt(&last_alice_balance)); - last_alice_balance = Tokens::free_balance(BSX, &ALICE); - - //bob - let _ = LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert!(Tokens::free_balance(BSX, &BOB).gt(&last_bob_balance)); - last_bob_balance = Tokens::free_balance(BSX, &BOB); - - //charlie - let _ = LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert!(Tokens::free_balance(BSX, &CHARLIE).gt(&last_charlie_balance)); - last_charlie_balance = Tokens::free_balance(BSX, &CHARLIE); - - block_number += 10; - } - - set_block_number(401); - - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - ALICE_DEPOSIT, - YIELD_FARM_A, - unclaimable - )); - - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - BOB_DEPOSIT, - YIELD_FARM_B, - unclaimable - )); - - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - CHARLIE_DEPOSIT, - YIELD_FARM_B, - unclaimable - )); - - let alice_claimed = Tokens::free_balance(BSX, &ALICE) - alice_bsx_balance_0; - let bob_claimed = Tokens::free_balance(BSX, &BOB) - bob_bsx_balance_0; - let charlie_claimed = Tokens::free_balance(BSX, &CHARLIE) - charlie_bsx_balance_0; - - let claimed_total = alice_claimed + bob_claimed + charlie_claimed; - - assert_eq!((200_000 * ONE) - claimed_total, 1_020); //NOTE: ED = 1_000 - - let yield_farm_a_claimed = alice_claimed; - let yield_farm_b_claimed = bob_claimed + charlie_claimed; - - const TOLERANCE: u128 = 10; - assert!( - yield_farm_a_claimed.abs_diff(2 * yield_farm_b_claimed).le(&TOLERANCE), - "yield_farm_a_claimed == 2 * yield_farm_b_claimed" - ); - - assert!( - alice_claimed.abs_diff(4 * bob_claimed).le(&TOLERANCE), - "alice_claimed == 4 * bob_claimed" - ); - - assert_eq!(bob_claimed, charlie_claimed, "bob_claimed == charlie_claimed"); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -//Note: This test is running for like 4 min. and run it with `--nocapture` to see progress. -#[ignore = "This test takes too much time."] -#[test] -fn full_farm_running_planned_time() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const GLOBAL_FARM: GlobalFarmId = 1; - const YIELD_FARM_A: YieldFarmId = 2; - const YIELD_FARM_B: YieldFarmId = 3; - - const ALICE_DEPOSIT: DepositId = 1; - const BOB_DEPOSIT: DepositId = 2; - const CHARLIE_DEPOSIT: DepositId = 3; - - const PLANNED_PERIODS: u64 = 525_600; //1 year with 10 blocks per period and 6s blocktime. - const BLOCKS_PER_PERIOD: u64 = 10; - const TOTAL_REWARDS_TO_DISTRIBUTE: u128 = 5_256_000 * ONE; - - //initialize farms - set_block_number(100); - //NOTE: This farm is distributing 10BSX per period(10block) for 1 year on chain with 6s - //blocktime if it's full. This farm is full when Z(locked bsx value) = 20_000. - assert_ok!(LiquidityMining2::create_global_farm( - TOTAL_REWARDS_TO_DISTRIBUTE, - PLANNED_PERIODS, //1 year, 6s blocktime - BLOCKS_PER_PERIOD, - BSX, - BSX, - GC, - Perquintill::from_float(0.000_5), - 1_000, - One::one(), - )); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::from(2_u128), - None, - BSX_TKN1_AMM, - vec![BSX, TKN1] - )); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::from(1_u128), - None, - BSX_TKN2_AMM, - vec![BSX, TKN2] - )); - - set_block_number(120); - //alice - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_A, - BSX_TKN1_AMM, - 5_000 * ONE, - |_, _, _| { Ok(5_000 * ONE) } - )); - - //bob - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 5_000 * ONE, - |_, _, _| { Ok(5_000 * ONE) } - )); - - //charlie - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 5_000 * ONE, - |_, _, _| { Ok(5_000 * ONE) } - )); - - let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); - let bob_bsx_balance_0 = Tokens::free_balance(BSX, &BOB); - let charlie_bsx_balance_0 = Tokens::free_balance(BSX, &CHARLIE); - - let mut last_alice_balance = alice_bsx_balance_0; - let mut last_bob_balance = bob_bsx_balance_0; - let mut last_charlie_balance = charlie_bsx_balance_0; - - //NOTE: This farm should distribute rewards for at leas 525_600 periods - let mut current_block = 121; - let last_rewarded_period = current_block + PLANNED_PERIODS * BLOCKS_PER_PERIOD - BLOCKS_PER_PERIOD; - let mut rng = rand::thread_rng(); - let mut i: u32 = 0; - while current_block <= last_rewarded_period { - current_block += BLOCKS_PER_PERIOD; - set_block_number(current_block); - - match rng.gen_range(1..=3) { - 1 => { - //alice - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); - assert!(Tokens::free_balance(BSX, &ALICE).gt(&last_alice_balance)); - assert_eq!(unclaimable, 0); - last_alice_balance = Tokens::free_balance(BSX, &ALICE); - } - 2 => { - //Bob - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert!(Tokens::free_balance(BSX, &BOB).gt(&last_bob_balance)); - assert_eq!(unclaimable, 0); - last_bob_balance = Tokens::free_balance(BSX, &BOB); - } - x => { - //charlie - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert!(Tokens::free_balance(BSX, &CHARLIE).gt(&last_charlie_balance)); - assert_eq!(unclaimable, 0); - last_charlie_balance = Tokens::free_balance(BSX, &CHARLIE); - assert!(x == 3); - } - } - - i += 1; - if i % 50_000 == 0 { - println!("periods: {i}"); - } - } - - set_block_number(last_rewarded_period + 100); - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - ALICE_DEPOSIT, - YIELD_FARM_A, - unclaimable - )); - - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - BOB_DEPOSIT, - YIELD_FARM_B, - unclaimable - )); - - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - CHARLIE_DEPOSIT, - YIELD_FARM_B, - unclaimable - )); - - let alice_claimed = Tokens::free_balance(BSX, &ALICE) - alice_bsx_balance_0; - let bob_claimed = Tokens::free_balance(BSX, &BOB) - bob_bsx_balance_0; - let charlie_claimed = Tokens::free_balance(BSX, &CHARLIE) - charlie_bsx_balance_0; - - let claimed_total = alice_claimed + bob_claimed + charlie_claimed; - - assert_eq!(TOTAL_REWARDS_TO_DISTRIBUTE - claimed_total, 1_000); - - let yield_farm_a_claimed = alice_claimed; - let yield_farm_b_claimed = bob_claimed + charlie_claimed; - - const TOLERANCE: u128 = 10; - assert!( - yield_farm_a_claimed.abs_diff(yield_farm_b_claimed).le(&TOLERANCE), - "yield_farm_a_claimed == yield_farm_b_claimed" - ); - - assert!( - alice_claimed.abs_diff(2 * bob_claimed).le(&TOLERANCE), - "alice_claimed == 2 * bob_claimed" - ); - - assert_eq!(bob_claimed, charlie_claimed, "bob_claimed == charlie_claimed"); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -// This tests that yield farm claims expected amount from global farm. -#[test] -fn yield_farm_should_claim_expected_amount() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const GLOBAL_FARM: GlobalFarmId = 1; - const YIELD_FARM_A: YieldFarmId = 2; - const YIELD_FARM_B: YieldFarmId = 3; - - const ALICE_DEPOSIT: DepositId = 1; - const BOB_DEPOSIT: DepositId = 2; - const CHARLIE_DEPOSIT: DepositId = 3; - - const PLANNED_PERIODS: u64 = 10_000; - const BLOCKS_PER_PERIOD: u64 = 10; - const TOTAL_REWARDS_TO_DISTRIBUTE: u128 = 1_000_000 * ONE; - - let yield_farm_a_key = (BSX_TKN1_AMM, GLOBAL_FARM, YIELD_FARM_A); - let yield_farm_b_key = (BSX_TKN2_AMM, GLOBAL_FARM, YIELD_FARM_B); - - //initialize farms - set_block_number(1000); - assert_ok!(LiquidityMining2::create_global_farm( - TOTAL_REWARDS_TO_DISTRIBUTE, - PLANNED_PERIODS, - BLOCKS_PER_PERIOD, - BSX, - BSX, - GC, - Perquintill::from_float(0.005), - 1_000, - One::one(), - )); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - One::one(), - None, - BSX_TKN1_AMM, - vec![BSX, TKN1] - )); - - //alice - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_A, - BSX_TKN1_AMM, - 10_000 * ONE, - |_, _, _| { Ok(10_000 * ONE) } - )); - - set_block_number(1_500); - - assert_ok!(LiquidityMining2::create_yield_farm( - GC, - GLOBAL_FARM, - One::one(), - None, - BSX_TKN2_AMM, - vec![BSX, TKN2] - )); - - set_block_number(2_000); - //bob - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 10_000 * ONE, - |_, _, _| { Ok(10_000 * ONE) } - )); - - set_block_number(2_500); - //charlie - assert_ok!(LiquidityMining2::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 10_000 * ONE, - |_, _, _| { Ok(10_000 * ONE) } - )); - - let pot = LiquidityMining2::pot_account_id().unwrap(); - assert_eq!( - LiquidityMining2::yield_farm(yield_farm_a_key) - .unwrap() - .left_to_distribute, - 0 - ); - assert_eq!( - LiquidityMining2::yield_farm(yield_farm_b_key) - .unwrap() - .left_to_distribute, - 2_500 * ONE - ); - assert_eq!(Tokens::free_balance(BSX, &pot), 10_000 * ONE); - - //Global farm had rewards for 100_000 blocks. - set_block_number(120_000); - - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - ALICE_DEPOSIT, - YIELD_FARM_A, - unclaimable - )); - - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - BOB_DEPOSIT, - YIELD_FARM_B, - unclaimable - )); - - let (_, _, _, unclaimable) = - LiquidityMining2::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining2::withdraw_lp_shares( - CHARLIE_DEPOSIT, - YIELD_FARM_B, - unclaimable - )); - - let global_farm_account = LiquidityMining2::farm_account_id(GLOBAL_FARM).unwrap(); - //leftovers in the pot because of rounding errors - assert_balance_approx!(pot, BSX, 0, 2); - - assert_eq!( - LiquidityMining2::yield_farm(yield_farm_a_key) - .unwrap() - .left_to_distribute, - 0 - ); - assert_eq!( - LiquidityMining2::yield_farm(yield_farm_b_key) - .unwrap() - .left_to_distribute, - 1 - ); - assert_eq!(Tokens::free_balance(BSX, &global_farm_account), 1_000); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} diff --git a/pallets/liquidity-mining/src/tests/invariants.rs b/pallets/liquidity-mining/src/tests/invariants.rs deleted file mode 100644 index 7ba94534474..00000000000 --- a/pallets/liquidity-mining/src/tests/invariants.rs +++ /dev/null @@ -1,888 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use crate::tests::test_ext::new_test_ext; -use pretty_assertions::assert_eq; -use proptest::{ - prelude::*, - test_runner::{Config, TestRunner}, -}; -use sp_arithmetic::traits::{CheckedAdd, CheckedMul}; -use std::{cell::RefCell, collections::HashMap}; - -const ONE: Balance = 1_000_000_000_000; -const TOLERANCE: Balance = 1_000; -const REWARD_CURRENCY: AssetId = BSX; - -//6s blocks -const BLOCK_PER_YEAR: u64 = 5_256_000; - -fn total_shares_z() -> impl Strategy { - 0..1_000_000_000 * ONE -} - -fn left_to_distribute() -> impl Strategy { - 190 * ONE..100_000 * ONE -} - -fn reward_per_period() -> impl Strategy { - 190 * ONE..1_000_000 * ONE //190BSX -> distribute 3B in 3 years(6s blocks) with 1 block per period -} - -fn global_farm_accumulated_rewards() -> impl Strategy { - (0..10_000_000_000 * ONE, 0..10_000_000_000 * ONE) -} - -fn accumulated_rpz(total_shares_z: Balance, pending_rewards: Balance) -> impl Strategy { - 0..pending_rewards.checked_div(total_shares_z).unwrap().max(1) -} - -prop_compose! { - fn get_global_farm() - ( - total_shares_z in total_shares_z(), - (pending_rewards, accumulated_paid_rewards) in global_farm_accumulated_rewards(), - reward_per_period in reward_per_period(), - )( - accumulated_rpz in accumulated_rpz(total_shares_z, pending_rewards), - pending_rewards in Just(pending_rewards), - accumulated_paid_rewards in Just(accumulated_paid_rewards), - reward_per_period in Just(reward_per_period), - total_shares_z in Just(total_shares_z), - updated_at in 1_000_000..(BLOCK_PER_YEAR + 1_000_000), - ) - -> GlobalFarmData { - GlobalFarmData:: { - id: 1, - owner: ALICE, - updated_at, - total_shares_z, - accumulated_rpz: FixedU128::from(accumulated_rpz), - reward_currency: REWARD_CURRENCY, - pending_rewards, - accumulated_paid_rewards, - yield_per_period: Perquintill::from_float(0.002), - planned_yielding_periods: 1_000, - blocks_per_period: 1_000, - incentivized_asset: REWARD_CURRENCY, - max_reward_per_period: reward_per_period, - min_deposit: 1, - live_yield_farms_count: Zero::zero(), - total_yield_farms_count: Zero::zero(), - price_adjustment: FixedU128::one(), - state: FarmState::Active, - } - } -} - -prop_compose! { - fn get_farms() - ( - global_farm in get_global_farm(), - )( - yield_farm_accumulated_rpz in 0..global_farm.accumulated_rpz.checked_div_int(1_u128).unwrap().max(1), - tmp_reward in 100_000 * ONE..5_256_000_000 * ONE, //max: 10K for 1 year, every block - yield_farm_updated_at in global_farm.updated_at - 1_000..global_farm.updated_at, - global_farm in Just(global_farm), - ) - -> (GlobalFarmData, YieldFarmData) { - //multiplier == 1 => valued_shares== Z - let rpvs = tmp_reward.checked_div(global_farm.total_shares_z).unwrap(); - - let yield_farm = YieldFarmData:: { - id: 2, - updated_at: yield_farm_updated_at, - total_shares: Default::default(), - total_valued_shares: global_farm.total_shares_z, - accumulated_rpvs: FixedU128::from(rpvs), - accumulated_rpz: FixedU128::from(yield_farm_accumulated_rpz), - loyalty_curve: Default::default(), - multiplier: One::one(), - state: FarmState::Active, - entries_count: Default::default(), - left_to_distribute: Default::default(), - total_stopped: Default::default(), - _phantom: Default::default(), - }; - - (global_farm, yield_farm) - } -} - -prop_compose! { - fn get_global_farm_and_current_period() - ( - global_farm in get_global_farm(), - )( - current_period in global_farm.updated_at..(global_farm.updated_at + BLOCK_PER_YEAR), - global_farm in Just(global_farm), - ) - -> (GlobalFarmData, BlockNumber) { - (global_farm, current_period) - } -} - -prop_compose! { - fn get_farms_and_current_period_and_yield_farm_rewards() - ( - (global_farm, yield_farm) in get_farms(), - )( - current_period in global_farm.updated_at..(global_farm.updated_at + BLOCK_PER_YEAR), - yield_farm in Just(yield_farm), - global_farm in Just(global_farm), - ) - -> (GlobalFarmData, YieldFarmData, BlockNumber, Balance) { - //+1 rounding - let yield_farm_rewards = yield_farm.accumulated_rpvs.checked_mul_int(yield_farm.total_valued_shares).unwrap() + 1; - - (global_farm, yield_farm, current_period, yield_farm_rewards) - } -} - -prop_compose! { - fn get_farms_and_current_period_and_yield_farm_rewards_and_lef_to_distribute() - ( - (global_farm, yield_farm, current_period, yield_farm_rewards) in get_farms_and_current_period_and_yield_farm_rewards(), - )( - left_to_distribute in yield_farm_rewards + ONE..yield_farm_rewards + 1_000_000 * ONE, - global_farm in Just(global_farm), - yield_farm in Just(yield_farm), - current_period in Just(current_period), - yield_farm_rewards in Just(yield_farm_rewards), - ) - -> (GlobalFarmData, YieldFarmData, BlockNumber, Balance, Balance) { - - (global_farm, yield_farm, current_period, yield_farm_rewards, left_to_distribute) - } -} - -proptest! { - #![proptest_config(ProptestConfig::with_cases(1_000))] - #[test] - fn sync_global_farm( - (mut farm, current_period) in get_global_farm_and_current_period(), - left_to_distribute in left_to_distribute(), - ) { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - let farm_account = LiquidityMining::farm_account_id(farm.id).unwrap(); - Tokens::set_balance(Origin::root(), farm_account, REWARD_CURRENCY, left_to_distribute, 0).unwrap(); - - //NOTE: _0 - before action, _1 - after action - let pending_rewards_0 = farm.pending_rewards; - let accumulated_rpz_0 = farm.accumulated_rpz; - let reward = LiquidityMining::sync_global_farm(&mut farm, current_period).unwrap(); - - let s_0 = accumulated_rpz_0 - .checked_mul(&FixedU128::from((farm.total_shares_z, ONE))).unwrap() - .checked_add(&FixedU128::from((reward, ONE))).unwrap(); - let s_1 = farm.accumulated_rpz.checked_mul(&FixedU128::from((farm.total_shares_z, ONE))).unwrap(); - - assert_eq_approx!( - s_0, - s_1, - FixedU128::from((TOLERANCE, ONE)), - "acc_rpz[1] x shares = acc_rpz[0] x shares + reward" - ); - - assert!( - farm.pending_rewards == pending_rewards_0.checked_add(reward).unwrap(), - "acc_rewards[1] = acc_rewards[0] + reward" - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - } -} - -proptest! { - #![proptest_config(ProptestConfig::with_cases(1_000))] - #[test] - fn claim_rewards_should_be_inclued_in_paid_rewards( - (mut global_farm, mut yield_farm) in get_farms() - ) { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - //NOTE: _0 - before action, _1 - after action - let sum_accumulated_paid_rewards_0 = global_farm.pending_rewards - .checked_add(global_farm.accumulated_paid_rewards).unwrap(); - - let current_period = yield_farm.updated_at + 1; - LiquidityMining::sync_yield_farm(&mut yield_farm, &mut global_farm,current_period).unwrap(); - - let sum_accumulated_paid_rewards_1 = global_farm.pending_rewards - .checked_add(global_farm.accumulated_paid_rewards).unwrap(); - - assert_eq!(sum_accumulated_paid_rewards_0, sum_accumulated_paid_rewards_1); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - } -} - -proptest! { - #![proptest_config(ProptestConfig::with_cases(1_000))] - #[test] - fn sync_yield_farm( - (mut global_farm, mut yield_farm, current_period, _, left_to_distribute) in get_farms_and_current_period_and_yield_farm_rewards_and_lef_to_distribute(), - ) { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const GLOBAL_FARM_ID: GlobalFarmId = 1; - - let pot = LiquidityMining::pot_account_id().unwrap(); - let global_farm_account = LiquidityMining::farm_account_id(GLOBAL_FARM_ID).unwrap(); - //rewads for yield farm are paid from global-farm's account to pot - Tokens::set_balance(Origin::root(), global_farm_account, REWARD_CURRENCY, left_to_distribute, 0).unwrap(); - - //NOTE: _0 - before action, _1 - after action - let pot_balance_0 = Tokens::total_balance(REWARD_CURRENCY, &pot); - let global_farm_balance_0 = Tokens::total_balance(REWARD_CURRENCY, &global_farm_account); - let pending_rewards_0 = global_farm.pending_rewards; - let accumulated_rpvs_0 = yield_farm.accumulated_rpvs; - - LiquidityMining::sync_yield_farm( - &mut yield_farm, &mut global_farm, current_period).unwrap(); - - let global_farm_balance_1 = Tokens::total_balance(REWARD_CURRENCY, &global_farm_account); - - //invariant 1 - //NOTE: yield-farm's rewards are left in the pot until user claims. - let pot_balance_1 = Tokens::total_balance(REWARD_CURRENCY, &pot); - let s_0 = global_farm_balance_0 + pot_balance_0; - let s_1 = global_farm_balance_1 + pot_balance_1; - - assert_eq!( - s_0, - s_1, - "invariant: `global_farm_balance + pot_balance` is always constant" - ); - - //invariant 2 - let s_0 = FixedU128::from((pending_rewards_0, ONE)) + accumulated_rpvs_0 * FixedU128::from((yield_farm.total_valued_shares, ONE)); - let s_1 = FixedU128::from((global_farm.pending_rewards, ONE)) + yield_farm.accumulated_rpvs * FixedU128::from((yield_farm.total_valued_shares, ONE)); - - assert_eq!( - s_0, - s_1, - "invariant: `global_farm.pending_rewards + yield_farm.accumulated_rpvs * yield_farm.total_valued_shares` is always constant" - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - } -} - -proptest! { - #![proptest_config(ProptestConfig::with_cases(1_000))] - #[test] - fn sync_global_farm_left_to_distribute_invariant( - (mut global_farm, _, current_period, _, left_to_distribute) in get_farms_and_current_period_and_yield_farm_rewards_and_lef_to_distribute(), - ) { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const GLOBAL_FARM_ID: GlobalFarmId = 1; - let global_farm_account = LiquidityMining::farm_account_id(GLOBAL_FARM_ID).unwrap(); - let pot = LiquidityMining::pot_account_id().unwrap(); - Tokens::set_balance(Origin::root(), global_farm_account, REWARD_CURRENCY, left_to_distribute, 0).unwrap(); - - let left_to_distribute_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - - let reward = - LiquidityMining::sync_global_farm(&mut global_farm, current_period).unwrap(); - - let s_0 = (left_to_distribute_0 - reward).max(0); - let s_1 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - - assert_eq!( - s_0, - s_1, - "left_to_distribute[1] = max(0, left_to_distribute[0] - reward)" - ); - - let s_0 = left_to_distribute_0 + pot_balance_0; - let s_1 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account) + Tokens::free_balance(REWARD_CURRENCY, &pot); - - assert_eq!( - s_0, - s_1, - "global_farm_account[0] + pot[0] = global_farm_account[1] + pot[1]" - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - } -} - -#[derive(Clone)] -pub struct InvTestGFarm { - id: GlobalFarmId, - total_rewards: Balance, - reward_currency: AssetId, - yield_farms: Vec<(YieldFarmId, AccountId, Vec)>, -} - -//NOTE: Variables in this block are valid only if creation order in `invariants_externalities` won't change. -thread_local! { - pub static G_FARMS: RefCell> = RefCell::new(vec![ - InvTestGFarm { - id: 1, - total_rewards: 115_000_000 * ONE, - reward_currency: BSX, - yield_farms: vec![ - (4, BSX_TKN1_AMM, vec![BSX, TKN1]), - (5, BSX_TKN2_AMM, vec![BSX, TKN2]) - ] - }, - InvTestGFarm { - id: 2, - total_rewards: 1_000_000_000 * ONE, - reward_currency: BSX, - yield_farms: vec![ - (6, BSX_TKN1_AMM, vec![BSX, TKN1]), - (7, BSX_TKN2_AMM, vec![BSX, TKN2]) - ] - }, - InvTestGFarm { - id: 3, - //NOTE: `total_rewards` is intentionally small. This represents asses with fewer dec. places. - total_rewards: 100_000_000_000_000, - reward_currency: TKN1, - yield_farms: vec![ - (8, BSX_TKN1_AMM, vec![BSX, TKN1]), - (9, BSX_TKN2_AMM, vec![BSX, TKN2]) - ] - } - ]) -} - -pub fn invariants_externalities() -> sp_io::TestExternalities { - let mut ext = ExtBuilder::default().build(); - - ext.execute_with(|| { - let _ = with_transaction(|| { - //global-farms: - assert_ok!(LiquidityMining::create_global_farm( - G_FARMS.with(|v| v.borrow()[0].total_rewards), - 302_400, - 1, - BSX, - G_FARMS.with(|v| v.borrow()[0].reward_currency), - GC, - Perquintill::from_rational(152_207_001_522, FixedU128::DIV), //apr 80% - 1_000, - FixedU128::one() - )); - - assert_ok!(LiquidityMining::create_global_farm( - G_FARMS.with(|v| v.borrow()[1].total_rewards), - 500_000, - 1, - BSX, - G_FARMS.with(|v| v.borrow()[1].reward_currency), - GC, - Perquintill::from_rational(951_293_759_512, FixedU128::DIV), //apr 50% - 1_000, - FixedU128::one() - )); - - assert_ok!(LiquidityMining::create_global_farm( - G_FARMS.with(|v| v.borrow()[2].total_rewards), - 50_000, - 1, - BSX, - G_FARMS.with(|v| v.borrow()[2].reward_currency), - GC, - Perquintill::from_rational(9_512_937_595, FixedU128::DIV), //apr 5% - 1_000, - FixedU128::from_float(0.5_f64) - )); - - //yield-farms - let g_farm = G_FARMS.with(|v| v.borrow()[0].clone()); - assert_ok!(LiquidityMining::create_yield_farm( - GC, - g_farm.id, - FixedU128::one(), - Some(LoyaltyCurve::default()), - g_farm.yield_farms[0].1, - g_farm.yield_farms[0].2.clone(), - )); - - assert_ok!(LiquidityMining::create_yield_farm( - GC, - g_farm.id, - FixedU128::one(), - None, - g_farm.yield_farms[1].1, - g_farm.yield_farms[1].2.clone(), - )); - - let g_farm = G_FARMS.with(|v| v.borrow()[1].clone()); - assert_ok!(LiquidityMining::create_yield_farm( - GC, - g_farm.id, - FixedU128::one(), - Some(LoyaltyCurve::default()), - g_farm.yield_farms[0].1, - g_farm.yield_farms[0].2.clone(), - )); - - assert_ok!(LiquidityMining::create_yield_farm( - GC, - g_farm.id, - FixedU128::from_float(1.5_f64), - None, - g_farm.yield_farms[1].1, - g_farm.yield_farms[1].2.clone(), - )); - - let g_farm = G_FARMS.with(|v| v.borrow()[2].clone()); - assert_ok!(LiquidityMining::create_yield_farm( - GC, - g_farm.id, - FixedU128::one(), - Some(LoyaltyCurve::default()), - g_farm.yield_farms[0].1, - g_farm.yield_farms[0].2.clone(), - )); - - assert_ok!(LiquidityMining::create_yield_farm( - GC, - g_farm.id, - FixedU128::from_float(0.5_f64), - Some(LoyaltyCurve::default()), - g_farm.yield_farms[1].1, - g_farm.yield_farms[1].2.clone(), - )); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - - ext -} - -#[derive(Debug, Clone)] -struct Deposit { - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - amm_pool_id: AccountId, - shares: Balance, - valued_shares: Balance, -} - -prop_compose! { - fn arb_deposit()( - shares in 1_000 * ONE..1_000_000 * ONE, - valued_shares in 1..10_000_000 * ONE, - g_idx in 0..3_usize, - y_idx in 0..2_usize, - ) -> Deposit { - let g_farm = G_FARMS.with(|v| v.borrow()[g_idx].clone()); - let y_farm = &g_farm.yield_farms[y_idx]; - - Deposit {global_farm_id: g_farm.id,yield_farm_id: y_farm.0, amm_pool_id: y_farm.1, shares, valued_shares} - } -} - -#[test] -//https://www.notion.so/Liquidity-mining-spec-b30ccfe470a74173b82c3702b1e8fca1#87868f45e4d04ecb92374c5f795a493d -// -//For each g\ \in\ GlobalFarms -//total\_rewards_g = Balance_g + accumulated\_paid\_rewards_g +\ pending\_rewards_g -//where -//total\_rewards_g = max\_reward\_per\_period\ *\ planned\_yielding\_periods -fn invariant_1() { - //Number of sucessfull test cases that must execute for the test as a whole to pass. - let successfull_cases = 1_000; - //Number of blocks added to current block number in each test case run. This number should be - //reasonable smaller than total of runned test to make sure lot of claims is executed and - //multiple claims for same deposit to happen. - let blocks_offset_range = 1..10_u64; - //Index of deposit in `deposit` vec. This idx is used in each test case run and execute claim - //if deposit exits. - - let deposit_idx_range = 0..500_usize; - - invariants_externalities().execute_with(|| { - let mut runner = TestRunner::new(Config { - cases: successfull_cases, - source_file: Some("liquidity-mining/src/tests/invariants.rs"), - test_name: Some("invariant_1"), - ..Config::default() - }); - let deposits: RefCell> = RefCell::new(Vec::new()); - - runner - .run( - &(arb_deposit(), blocks_offset_range, deposit_idx_range), - |(d, blocks_offset, deposit_idx)| { - deposits.borrow_mut().push(d.clone()); - - //Act - let _ = with_transaction(|| { - assert_ok!(LiquidityMining::deposit_lp_shares( - d.global_farm_id, - d.yield_farm_id, - d.amm_pool_id, - d.shares, - |_, _, _| -> Result { Ok(d.valued_shares) } - )); - - set_block_number(mock::System::block_number() + blocks_offset); - - //claim rewards only if deposit exists - if deposit_idx < deposits.borrow().len() { - let d = &deposits.borrow()[deposit_idx]; - let deposit_id = deposit_idx as u128 + 1; - - assert_ok!(LiquidityMining::claim_rewards(ALICE, deposit_id, d.yield_farm_id, true)); - } - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - - //Assert: - G_FARMS.with(|v| { - v.borrow().clone().into_iter().for_each(|gf| { - let g_farm_balance = Tokens::free_balance( - gf.reward_currency, - &LiquidityMining::farm_account_id(gf.id).unwrap(), - ); - let g_farm_1 = LiquidityMining::global_farm(gf.id).unwrap(); - - //1.1 assert - let s_1 = g_farm_balance + g_farm_1.accumulated_paid_rewards + g_farm_1.pending_rewards; - //NOTE: This should be precise. - assert_eq!(gf.total_rewards, s_1); - - //1.2 assert - let s_1: u128 = g_farm_1.max_reward_per_period * g_farm_1.planned_yielding_periods as u128; - //NOTE: Approax becasue of div in max_reward_per_period calculation. - assert_eq_approx!( - gf.total_rewards, - s_1, - 100_000, - "total_rewards = max_reward_per_period * planned_yielding_periods" - ); - }) - }); - - Ok(()) - }, - ) - .unwrap(); - }); -} - -#[test] -//https://www.notion.so/Liquidity-mining-spec-b30ccfe470a74173b82c3702b1e8fca1#422dea2e23744859baeb704dbdb3caca -// -//\displaystyle \sum_{g\ \in\ globalFarm} total\_rewards_g = \sum_{g\ \in\ globalFarm} Balance_g + Balance_{pot} + \sum_{d\ \epsilon\ Deposits, y\ \in\ YieldFarm}claimed\_rewards^y_d -fn invariant_2() { - //Number of sucessfull test cases that must execute for the test as a whole to pass. - let successfull_cases = 1_000; - //Number of blocks added to current block number in each test case run. This number should be - //reasonable smaller than total of runned test to make sure lot of claims is executed and - //multiple claims for same deposit to happen. - let blocks_offset_range = 1..10_u64; - //Index of deposit in `deposit` vec. This idx is used in each test case run and execute claim - //if deposit exits. - - let deposit_idx_range = 0..500_usize; - - invariants_externalities().execute_with(|| { - let mut runner = TestRunner::new(Config { - cases: successfull_cases, - source_file: Some("liquidity-mining/src/tests/invariants.rs"), - test_name: Some("invariant_2"), - ..Config::default() - }); - let deposits: RefCell> = RefCell::new(Vec::new()); - let pot = LiquidityMining::pot_account_id().unwrap(); - - runner - .run( - &(arb_deposit(), blocks_offset_range, deposit_idx_range), - |(d, blocks_offset, deposit_idx)| { - deposits.borrow_mut().push(d.clone()); - - //Act - let _ = with_transaction(|| { - assert_ok!(LiquidityMining::deposit_lp_shares( - d.global_farm_id, - d.yield_farm_id, - d.amm_pool_id, - d.shares, - |_, _, _| -> Result { Ok(d.valued_shares) } - )); - - set_block_number(mock::System::block_number() + blocks_offset); - - //claim rewards only if deposit exists - if deposit_idx < deposits.borrow().len() { - let d = &deposits.borrow()[deposit_idx]; - let deposit_id = deposit_idx as u128 + 1; - - assert_ok!(LiquidityMining::claim_rewards(ALICE, deposit_id, d.yield_farm_id, true)); - } - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - - //Calculate necessary values and assert - let (total_rewards_sum, farm_balances_sum, pot_balance_sum) = G_FARMS.with(|v| { - let mut total_rewards_sum = 0_u128; - let mut farm_balances_sum = 0_u128; - let mut pot_balance_sum = 0_u128; - let mut already_summed_balances: Vec = Vec::new(); - - v.borrow().clone().into_iter().for_each(|gf| { - farm_balances_sum += Tokens::free_balance( - gf.reward_currency, - &LiquidityMining::farm_account_id(gf.id).unwrap(), - ); - - total_rewards_sum += gf.total_rewards; - - if !already_summed_balances.contains(&gf.reward_currency) { - pot_balance_sum += Tokens::total_balance(gf.reward_currency, &pot); - already_summed_balances.push(gf.reward_currency); - } - }); - (total_rewards_sum, farm_balances_sum, pot_balance_sum) - }); - - let last_deposit_id = LiquidityMining::deposit_id(); - let mut claimed_by_users_sum = 0_u128; - for i in 1..=last_deposit_id { - let d = LiquidityMining::deposit(i).unwrap(); - - let claimed_amount = d.yield_farm_entries[0].accumulated_claimed_rewards; - claimed_by_users_sum += claimed_amount; - } - - //WARN: There is no room for rounding errors in this invariant. Any discrepancy - //in this assert means we are loosing tokens somewhere. - assert_eq!( - total_rewards_sum, - farm_balances_sum + pot_balance_sum + claimed_by_users_sum, - ); - - Ok(()) - }, - ) - .unwrap(); - }); -} - -#[test] -//https://www.notion.so/Liquidity-mining-spec-b30ccfe470a74173b82c3702b1e8fca1#6dd41bee00384293980b7c20d8dc6ec6 -// -//For each g\ \in\ GlobalFarms -//\displaystyle accumulated\_paid\_rewards_g = \sum_{y\ \in\ YieldFarms} left\_to\_distribute_y + \sum_{d\ \in\ Deposits,y\ \in\ YielFarm} claimed\_rewards^y_d -fn invariant_3() { - //Number of sucessfull test cases that must execute for the test as a whole to pass. - let successfull_cases = 1_000; - //Number of blocks added to current block number in each test case run. This number should be - //reasonable smaller than total of runned test to make sure lot of claims is executed and - //multiple claims for same deposit to happen. - let blocks_offset_range = 1..10_u64; - //Index of deposit in `deposit` vec. This idx is used in each test case run and execute claim - //if deposit exits. - - let deposit_idx_range = 0..500_usize; - - invariants_externalities().execute_with(|| { - let mut runner = TestRunner::new(Config { - cases: successfull_cases, - source_file: Some("liquidity-mining/src/tests/invariants.rs"), - test_name: Some("invariant_3"), - ..Config::default() - }); - let deposits: RefCell> = RefCell::new(Vec::new()); - - runner - .run( - &(arb_deposit(), blocks_offset_range, deposit_idx_range), - |(d, blocks_offset, deposit_idx)| { - deposits.borrow_mut().push(d.clone()); - - //Act - let _ = with_transaction(|| { - assert_ok!(LiquidityMining::deposit_lp_shares( - d.global_farm_id, - d.yield_farm_id, - d.amm_pool_id, - d.shares, - |_, _, _| -> Result { Ok(d.valued_shares) } - )); - - set_block_number(mock::System::block_number() + blocks_offset); - - //claim rewards only if deposit exists - if deposit_idx < deposits.borrow().len() { - let d = &deposits.borrow()[deposit_idx]; - let deposit_id = deposit_idx as u128 + 1; - - assert_ok!(LiquidityMining::claim_rewards(ALICE, deposit_id, d.yield_farm_id, true)); - } - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - - //Calculate necessary values and assert - let last_deposit_id = LiquidityMining::deposit_id(); - let mut claimed_by_user_per_yield_farm: HashMap<(GlobalFarmId, YieldFarmId), u128> = HashMap::new(); - for i in 1..=last_deposit_id { - let d = LiquidityMining::deposit(i).unwrap(); - - let claimed_amount = d.yield_farm_entries[0].accumulated_claimed_rewards; - let global_farm_id = d.yield_farm_entries[0].global_farm_id; - let yield_farm_id = d.yield_farm_entries[0].yield_farm_id; - *claimed_by_user_per_yield_farm - .entry((global_farm_id, yield_farm_id)) - .or_insert(0) += claimed_amount; - } - - G_FARMS.with(|v| { - v.borrow().clone().into_iter().for_each(|gf| { - let g_farm = LiquidityMining::global_farm(gf.id).unwrap(); - let mut y_farms_let_to_distribute_sum = 0_u128; - - let mut claimed_by_yield_farms_in_global_farm = 0_u128; - gf.yield_farms.iter().for_each(|yf| { - y_farms_let_to_distribute_sum += LiquidityMining::yield_farm((yf.1, gf.id, yf.0)) - .unwrap() - .left_to_distribute; - - //NOTE this run for each iteration of test so record in HashMap may - //not exists if deposit doesn't exists yet. - claimed_by_yield_farms_in_global_farm += - claimed_by_user_per_yield_farm.get(&(gf.id, yf.0)).unwrap_or(&0_u128); - }); - - assert_eq!( - g_farm.accumulated_paid_rewards, - y_farms_let_to_distribute_sum + claimed_by_yield_farms_in_global_farm - ); - }) - }); - - Ok(()) - }, - ) - .unwrap(); - }); -} - -#[test] -//https://www.notion.so/Liquidity-mining-spec-b30ccfe470a74173b82c3702b1e8fca1#b8cb39a055054198a083c4946110b70d -// -//\displaystyle accumulated\_rewards_g + paid\_accumulated\_rewards_g = \sum_{i\ \in\ -//\{\frac{b}{block\_per\_period_g}|b\ \in\ BlockNumber\}}(accumulated\_rpz^i_g - -//accumulated\_rpz^{i-1}_g) * Z^i_g -fn invariant_4() { - //Number of sucessfull test cases that must execute for the test as a whole to pass. - let successfull_cases = 1_000; - //Number of blocks added to current block number in each test case run. This number should be - //reasonable smaller than total of runned test to make sure lot of claims is executed and - //multiple claims for same deposit to happen. - let blocks_offset_range = 1..10_u64; - //Index of deposit in `deposit` vec. This idx is used in each test case run and execute claim - //if deposit exits. - - let deposit_idx_range = 0..500_usize; - - invariants_externalities().execute_with(|| { - let mut runner = TestRunner::new(Config { - cases: successfull_cases, - source_file: Some("liquidity-mining/src/tests/invariants.rs"), - test_name: Some("invariant_4"), - ..Config::default() - }); - let deposits: RefCell> = RefCell::new(Vec::new()); - let paid_until_now: RefCell> = RefCell::new(HashMap::new()); - - runner - .run( - &(arb_deposit(), blocks_offset_range, deposit_idx_range), - |(d, blocks_offset, deposit_idx)| { - deposits.borrow_mut().push(d.clone()); - let _ = with_transaction(|| { - let g_farm_0 = LiquidityMining::global_farm(d.global_farm_id).unwrap(); - - assert_ok!(LiquidityMining::deposit_lp_shares( - d.global_farm_id, - d.yield_farm_id, - d.amm_pool_id, - d.shares, - |_,_,_| -> Result { - Ok(d.valued_shares) - } - )); - - let g_farm_1 = LiquidityMining::global_farm(g_farm_0.id).unwrap(); - let s_0 = g_farm_1.accumulated_paid_rewards + g_farm_1.pending_rewards; - *paid_until_now.borrow_mut().entry(g_farm_1.id).or_insert(0_u128) += (g_farm_1.accumulated_rpz - - g_farm_0.accumulated_rpz) - .checked_mul_int(g_farm_0.total_shares_z) - .unwrap(); - - //NOTE: global-farm is updated before deposit so in this case we need to - //use Z{now-1} instead of Z{now} which includes deposited shares. - assert_eq_approx!(s_0, *paid_until_now.borrow().get(&d.global_farm_id).unwrap(), 1_000_000, "accumulated_paid_rewards + pending_rewards = sum(rpz{now} - rpz{now-1} * Z{now-1}) for all periods"); - - set_block_number(mock::System::block_number() + blocks_offset); - - //claim rewards only if deposit exists - if deposit_idx < deposits.borrow().len() { - let d = &deposits.borrow()[deposit_idx]; - let deposit_id = deposit_idx as u128 + 1; - - let g_farm_0 = LiquidityMining::global_farm(d.global_farm_id).unwrap(); - - assert_ok!(LiquidityMining::claim_rewards(ALICE, deposit_id, d.yield_farm_id, true)); - - let g_farm_1 = LiquidityMining::global_farm(g_farm_0.id).unwrap(); - let s_0 = g_farm_1.accumulated_paid_rewards + g_farm_1.pending_rewards; - *paid_until_now.borrow_mut().entry(g_farm_1.id).or_insert(0_u128) += (g_farm_1.accumulated_rpz - - g_farm_0.accumulated_rpz) - .checked_mul_int(g_farm_1.total_shares_z) - .unwrap(); - - //NOTE: global-farm is updated before claim so RPZ includes all Z so Z{now} - //must be used in this case. - assert_eq_approx!(s_0, *paid_until_now.borrow().get(&d.global_farm_id).unwrap(), 1_000_000, "accumulated_paid_rewards + pending_rewards = sum(rpz{now} - rpz{now-1} * Z{now}) for all periods"); - } - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - - Ok(()) - }, - ) - .unwrap(); - }); -} diff --git a/pallets/liquidity-mining/src/tests/lm_with_oracle.rs b/pallets/liquidity-mining/src/tests/lm_with_oracle.rs deleted file mode 100644 index dbb8e90bb13..00000000000 --- a/pallets/liquidity-mining/src/tests/lm_with_oracle.rs +++ /dev/null @@ -1,298 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -use crate::tests::mock::LiquidityMining3; - -//This test is using dummy oracle for price_adjustment. DummyOracle always returns .5 as -//price_adjusment. -#[test] -fn non_full_farm_should_pay_rewards_with_half_speed_when_price_adjustmnet_is_from_dummy_oracle() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const GLOBAL_FARM: GlobalFarmId = 1; - const YIELD_FARM_A: YieldFarmId = 2; - const YIELD_FARM_B: YieldFarmId = 3; - - const ALICE_DEPOSIT: DepositId = 1; - const BOB_DEPOSIT: DepositId = 2; - const CHARLIE_DEPOSIT: DepositId = 3; - - const TOTAL_REWARDS: u128 = 200_000 * ONE; - - //initialize farms - set_block_number(100); - assert_ok!(LiquidityMining3::create_global_farm( - TOTAL_REWARDS, - 20, - 10, - BSX, - BSX, - GC, - Perquintill::from_float(0.5), - 1_000, - One::one(), - )); - - assert_ok!(LiquidityMining3::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::from(2_u128), - None, - BSX_TKN1_AMM, - vec![BSX, TKN1], - )); - - assert_ok!(LiquidityMining3::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::from(1_u128), - None, - BSX_TKN2_AMM, - vec![BSX, TKN2], - )); - - set_block_number(120); - //alice - assert_ok!(LiquidityMining3::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_A, - BSX_TKN1_AMM, - 5_000 * ONE, - |_, _, _| { Ok(5_000 * ONE) } - )); - - //bob - assert_ok!(LiquidityMining3::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 2_500 * ONE, - |_, _, _| { Ok(2_500 * ONE) } - )); - - //charlie - assert_ok!(LiquidityMining3::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_B, - BSX_TKN2_AMM, - 2_500 * ONE, - |_, _, _| { Ok(2_500 * ONE) } - )); - - set_block_number(401); - - let alice_bsx_balance_0 = Tokens::free_balance(BSX, &ALICE); - let bob_bsx_balance_0 = Tokens::free_balance(BSX, &BOB); - let charlie_bsx_balance_0 = Tokens::free_balance(BSX, &CHARLIE); - - let (_, _, _, unclaimable) = - LiquidityMining3::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining3::withdraw_lp_shares( - ALICE_DEPOSIT, - YIELD_FARM_A, - unclaimable - )); - - let (_, _, _, unclaimable) = - LiquidityMining3::claim_rewards(BOB, BOB_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining3::withdraw_lp_shares( - BOB_DEPOSIT, - YIELD_FARM_B, - unclaimable - )); - - let (_, _, _, unclaimable) = - LiquidityMining3::claim_rewards(CHARLIE, CHARLIE_DEPOSIT, YIELD_FARM_B, false).unwrap(); - assert_eq!(unclaimable, 0); - assert_ok!(LiquidityMining3::withdraw_lp_shares( - CHARLIE_DEPOSIT, - YIELD_FARM_B, - unclaimable - )); - - let alice_claimed = Tokens::free_balance(BSX, &ALICE) - alice_bsx_balance_0; - let bob_claimed = Tokens::free_balance(BSX, &BOB) - bob_bsx_balance_0; - let charlie_claimed = Tokens::free_balance(BSX, &CHARLIE) - charlie_bsx_balance_0; - - assert_eq!(alice_claimed, 70_000 * ONE); - assert_eq!(bob_claimed, 17_500 * ONE); - assert_eq!(charlie_claimed, 17_500 * ONE); - - let claimed_total = alice_claimed + bob_claimed + charlie_claimed; - - assert_eq!(claimed_total.abs_diff(TOTAL_REWARDS), 95_000 * ONE); - - let yield_farm_a_claimed = alice_claimed; - let yield_farm_b_claimed = bob_claimed + charlie_claimed; - - const TOLERANCE: u128 = 10; - assert!( - yield_farm_a_claimed.abs_diff(2 * yield_farm_b_claimed).le(&TOLERANCE), - "yield_farm_a_claimed == 2 * yield_farm_b_claimed" - ); - - assert!( - alice_claimed.abs_diff(4 * bob_claimed).le(&TOLERANCE), - "alice_claimed == 4 * bob_claimed" - ); - - assert_eq!(bob_claimed, charlie_claimed, "bob_claimed == charlie_claimed"); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn oracles_price_adjustment_should_be_used_and_saved_when_oracle_is_available() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const GLOBAL_FARM: GlobalFarmId = 1; - const YIELD_FARM_A: YieldFarmId = 2; - - const ALICE_DEPOSIT: DepositId = 1; - - const TOTAL_REWARDS: u128 = 200_000 * ONE; - - //Arrange - set_block_number(100); - assert_ok!(LiquidityMining3::create_global_farm( - TOTAL_REWARDS, - 20, - 10, - BSX, - BSX, - GC, - Perquintill::from_float(0.5), - 1_000, - FixedU128::from_float(5.5_f64), //default price_adjustment, won't be used. - )); - - assert_ok!(LiquidityMining3::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::from(2_u128), - None, - BSX_TKN1_AMM, - vec![BSX, TKN1], - )); - - set_block_number(120); - //alice - assert_ok!(LiquidityMining3::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_A, - BSX_TKN1_AMM, - 5_000 * ONE, - |_, _, _| { Ok(5_000 * ONE) } - )); - - //Act - set_block_number(401); - let (_, _, claimed_amount, unclaimable) = - LiquidityMining3::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); - - //Assert - assert_eq!(unclaimable, 0); - assert_eq!(claimed_amount, 70_000 * ONE); - //NOTE: global-farm's price_adjustment should be updated - assert_eq!( - LiquidityMining3::global_farm(GLOBAL_FARM).unwrap().price_adjustment, - FixedU128::from_float(0.5_f64) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn last_saved_price_adjustment_should_be_used_when_oracle_is_not_available() { - new_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const GLOBAL_FARM: GlobalFarmId = 1; - const YIELD_FARM_A: YieldFarmId = 2; - - const ALICE_DEPOSIT: DepositId = 1; - - const TOTAL_REWARDS: u128 = 200_000 * ONE; - - //Arrange - set_block_number(100); - assert_ok!(LiquidityMining3::create_global_farm( - TOTAL_REWARDS, - 20, - 1, - BSX, - BSX, - GC, - Perquintill::from_float(0.5), - 1_000, - FixedU128::from(2_u128), //default price_adjustment - )); - - assert_ok!(LiquidityMining3::create_yield_farm( - GC, - GLOBAL_FARM, - FixedU128::one(), - None, - BSX_TKN1_AMM, - vec![BSX, TKN1], - )); - - //NOTE: This is special period. Oracle will fail if global-farm was updated in this - //period. - set_block_number(999_666_333); - //alice - assert_ok!(LiquidityMining3::deposit_lp_shares( - GLOBAL_FARM, - YIELD_FARM_A, - BSX_TKN1_AMM, - 5_000 * ONE, - |_, _, _| { Ok(5_000 * ONE) } - )); - - assert_eq!( - LiquidityMining3::global_farm(GLOBAL_FARM).unwrap().price_adjustment, - FixedU128::from(2_u128) - ); - //Act - set_block_number(999_666_334); - //NOTE: Oracle will fail because global_farm.updated_at == 999_666_333 when oracle is - //called. - let (_, _, claimed_amount, unclaimable) = - LiquidityMining3::claim_rewards(ALICE, ALICE_DEPOSIT, YIELD_FARM_A, false).unwrap(); - - //Assert - assert_eq!(unclaimable, 0); - assert_eq!(claimed_amount, 5_000 * ONE); - //NOTE: oracle is not available so value should not change. - assert_eq!( - LiquidityMining3::global_farm(GLOBAL_FARM).unwrap().price_adjustment, - FixedU128::from(2_u128) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} diff --git a/pallets/liquidity-mining/src/tests/mock.rs b/pallets/liquidity-mining/src/tests/mock.rs deleted file mode 100644 index 77f99390263..00000000000 --- a/pallets/liquidity-mining/src/tests/mock.rs +++ /dev/null @@ -1,538 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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(test)] -use super::*; - -use crate::Config; -use crate::{self as liq_mining, types::DefaultPriceAdjustment}; -use frame_support::{parameter_types, traits::Contains, traits::Everything, PalletId}; -use frame_system as system; -use hydradx_traits::{pools::DustRemovalAccountWhitelist, AssetKind, AMM}; -use pallet_asset_registry::traits::Registry; -use orml_traits::GetByKey; -use sp_core::H256; -use sp_runtime::{ - traits::{BlakeTwo256, BlockNumberProvider, IdentityLookup}, - BuildStorage, -}; - -pub use frame_support::storage::with_transaction; -pub use sp_runtime::TransactionOutcome; - -#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, PartialOrd, Ord, MaxEncodedLen, RuntimeDebug, TypeInfo)] -#[repr(u8)] -pub enum ReserveIdentifier { - Nft, - Marketplace, - // always the last, indicate number of variants - Count, -} - -use std::{cell::RefCell, collections::HashMap}; - -pub type Balance = u128; -pub type AssetId = u32; -pub type Amount = i128; - -pub type AccountId = u128; -pub type FarmId = crate::FarmId; -pub type BlockNumber = u64; -pub const ALICE: AccountId = 10; -pub const BOB: AccountId = 11; -pub const CHARLIE: AccountId = 12; -pub const DAVE: AccountId = 13; -pub const EVE: AccountId = 14; -pub const TREASURY: AccountId = 15; -pub const ACCOUNT_WITH_1M: AccountId = 16; -pub const GC: AccountId = 17; - -pub const INITIAL_BALANCE: u128 = 1_000_000_000_000; - -pub const BSX_ACA_SHARE_ID: AssetId = 100; -pub const BSX_KSM_SHARE_ID: AssetId = 101; -pub const BSX_DOT_SHARE_ID: AssetId = 102; -pub const BSX_ETH_SHARE_ID: AssetId = 103; -pub const BSX_HDX_SHARE_ID: AssetId = 104; -pub const BSX_TKN1_SHARE_ID: AssetId = 105; -pub const BSX_TKN2_SHARE_ID: AssetId = 106; -pub const KSM_DOT_SHARE_ID: AssetId = 107; -pub const ACA_KSM_SHARE_ID: AssetId = 108; - -pub const BSX: AssetId = 1000; -pub const HDX: AssetId = 2000; -pub const ACA: AssetId = 3000; -pub const KSM: AssetId = 4000; -pub const DOT: AssetId = 5000; -pub const ETH: AssetId = 6000; -pub const TKN1: AssetId = 7_001; -pub const TKN2: AssetId = 7_002; -pub const UNKNOWN_ASSET: AssetId = 7_003; - -pub const BSX_ACA_AMM: AccountId = 11_000; -pub const BSX_KSM_AMM: AccountId = 11_001; -pub const BSX_DOT_AMM: AccountId = 11_002; -pub const BSX_ETH_AMM: AccountId = 11_003; -pub const BSX_HDX_AMM: AccountId = 11_004; -pub const BSX_TKN1_AMM: AccountId = 11_005; -pub const BSX_TKN2_AMM: AccountId = 11_006; -pub const DEFAULT_AMM: AccountId = 11_007; -pub const KSM_DOT_AMM: AccountId = 11_008; -pub const ACA_KSM_AMM: AccountId = 11_009; - -pub const BSX_ACA_YIELD_FARM_ID: FarmId = 12_000; -pub const BSX_KSM_YIELD_FARM_ID: FarmId = 12_001; -pub const BSX_DOT_YIELD_FARM_ID: FarmId = 12_002; - -pub const BSX_FARM: FarmId = 1; -pub const KSM_FARM: FarmId = 2; -pub const GC_FARM: FarmId = 3; -pub const ACA_FARM: FarmId = 4; - -pub const ONE: Balance = 1_000_000_000_000; - -type Block = frame_system::mocking::MockBlock; - -#[derive(Clone)] -pub struct AssetPair { - pub asset_in: AssetId, - pub asset_out: AssetId, -} - -frame_support::construct_runtime!( - pub enum Test - { - System: frame_system, - LiquidityMining: liq_mining::, - LiquidityMining2: liq_mining::, - //This LM instance is using dummy oracle for price_adjustment - LiquidityMining3: liq_mining::, - Tokens: orml_tokens, - Balances: pallet_balances, - } -); - -parameter_types! { - pub const BlockHashCount: u64 = 250; - pub const SS58Prefix: u8 = 63; - pub static MockBlockNumberProvider: u64 = 0; -} - -impl BlockNumberProvider for MockBlockNumberProvider { - type BlockNumber = u64; - - fn current_block_number() -> Self::BlockNumber { - Self::get() - } -} -impl system::Config for Test { - type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); - type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - type RuntimeTask = RuntimeTask; - type Nonce = u64; - type Block = Block; - type Hash = H256; - type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; -} - -pub struct Amm; - -thread_local! { - pub static AMM_POOLS: RefCell> = RefCell::new(HashMap::new()); - pub static DUSTER_WHITELIST: RefCell> = RefCell::new(Vec::new()); -} - -impl AMM for Amm { - fn get_max_out_ratio() -> u128 { - 0_u32.into() - } - - fn get_fee(_pool_account_id: &AccountId) -> (u32, u32) { - (0, 0) - } - - fn get_max_in_ratio() -> u128 { - 0_u32.into() - } - - fn get_pool_assets(_pool_account_id: &AccountId) -> Option> { - None - } - - fn get_spot_price_unchecked(_asset_a: AssetId, _asset_b: AssetId, _amount: Balance) -> Balance { - Balance::from(0_u32) - } - - fn validate_sell( - _origin: &AccountId, - _assets: AssetPair, - _amount: Balance, - _min_bought: Balance, - _discount: bool, - ) -> Result< - hydradx_traits::AMMTransfer, - frame_support::sp_runtime::DispatchError, - > { - Err(sp_runtime::DispatchError::Other("NotImplemented")) - } - - fn execute_buy( - _transfer: &hydradx_traits::AMMTransfer, - ) -> frame_support::dispatch::DispatchResult { - Err(sp_runtime::DispatchError::Other("NotImplemented")) - } - - fn execute_sell( - _transfer: &hydradx_traits::AMMTransfer, - ) -> frame_support::dispatch::DispatchResult { - Err(sp_runtime::DispatchError::Other("NotImplemented")) - } - - fn validate_buy( - _origin: &AccountId, - _assets: AssetPair, - _amount: Balance, - _max_limit: Balance, - _discount: bool, - ) -> Result< - hydradx_traits::AMMTransfer, - frame_support::sp_runtime::DispatchError, - > { - Err(sp_runtime::DispatchError::Other("NotImplemented")) - } - - fn get_min_pool_liquidity() -> Balance { - Balance::from(0_u32) - } - - fn get_min_trading_limit() -> Balance { - Balance::from(0_u32) - } - - // Fn bellow are used by liq. mining pallet - fn exists(assets: AssetPair) -> bool { - AMM_POOLS.with(|v| v.borrow().contains_key(&asset_pair_to_map_key(assets))) - } - - fn get_pair_id(assets: AssetPair) -> AccountId { - AMM_POOLS.with(|v| match v.borrow().get(&asset_pair_to_map_key(assets)) { - Some(p) => p.0, - None => DEFAULT_AMM, - }) - } - - fn get_share_token(assets: AssetPair) -> AssetId { - AMM_POOLS.with(|v| match v.borrow().get(&asset_pair_to_map_key(assets)) { - Some(p) => p.1, - None => BSX, - }) - } -} - -pub fn asset_pair_to_map_key(assets: AssetPair) -> String { - format!("in:{}_out:{}", assets.asset_in, assets.asset_out) -} - -parameter_types! { - pub const LMPalletId: PalletId = PalletId(*b"TEST_lm_"); - pub const MinPlannedYieldingPeriods: BlockNumber = 100; - pub const MinTotalFarmRewards: Balance = 1_000_000; - #[derive(PartialEq, Eq)] - pub const MaxEntriesPerDeposit: u8 = 5; - pub const MaxYieldFarmsPerGlobalFarm: u8 = 4; -} - -impl Config for Test { - type RuntimeEvent = RuntimeEvent; - type AssetId = AssetId; - type MultiCurrency = Tokens; - type PalletId = LMPalletId; - type MinPlannedYieldingPeriods = MinPlannedYieldingPeriods; - type MinTotalFarmRewards = MinTotalFarmRewards; - type BlockNumberProvider = MockBlockNumberProvider; - type AmmPoolId = AccountId; - type MaxFarmEntriesPerDeposit = MaxEntriesPerDeposit; - type MaxYieldFarmsPerGlobalFarm = MaxYieldFarmsPerGlobalFarm; - type NonDustableWhitelistHandler = Whitelist; - type AssetRegistry = AssetRegistry; - type PriceAdjustment = DefaultPriceAdjustment; -} - -parameter_types! { - pub const LMPalletId2: PalletId = PalletId(*b"TEST_lm2"); - pub const MinPlannedYieldingPeriods2: BlockNumber = 10; - pub const MinTotalFarmRewards2: Balance = 100_000; - pub const MininumDeposit2: Balance = 1; - pub const MaxEntriesPerDeposit2: u8 = 1; -} - -impl Config for Test { - type RuntimeEvent = RuntimeEvent; - type AssetId = AssetId; - type MultiCurrency = Tokens; - type PalletId = LMPalletId2; - type MinPlannedYieldingPeriods = MinPlannedYieldingPeriods2; - type MinTotalFarmRewards = MinTotalFarmRewards2; - type BlockNumberProvider = MockBlockNumberProvider; - type AmmPoolId = AccountId; - type MaxFarmEntriesPerDeposit = MaxEntriesPerDeposit2; - type MaxYieldFarmsPerGlobalFarm = MaxYieldFarmsPerGlobalFarm; - type NonDustableWhitelistHandler = Whitelist; - type AssetRegistry = AssetRegistry; - type PriceAdjustment = DefaultPriceAdjustment; -} - -parameter_types! { - pub const LMPalletId3: PalletId = PalletId(*b"TEST_lm3"); -} - -impl Config for Test { - type RuntimeEvent = RuntimeEvent; - type AssetId = AssetId; - type MultiCurrency = Tokens; - type PalletId = LMPalletId3; - type MinPlannedYieldingPeriods = MinPlannedYieldingPeriods2; - type MinTotalFarmRewards = MinTotalFarmRewards; - type BlockNumberProvider = MockBlockNumberProvider; - type AmmPoolId = AccountId; - type MaxFarmEntriesPerDeposit = MaxEntriesPerDeposit; - type MaxYieldFarmsPerGlobalFarm = MaxYieldFarmsPerGlobalFarm; - type NonDustableWhitelistHandler = Whitelist; - type AssetRegistry = AssetRegistry; - type PriceAdjustment = DummyOraclePriceAdjustment; -} - -parameter_types! { - pub const MaxLocks: u32 = 1; - pub const ExistentialDeposit: u128 = 500; - pub const MaxReserves: u32 = 50; -} - -impl pallet_balances::Config for Test { - type Balance = Balance; - type RuntimeEvent = RuntimeEvent; - type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = frame_system::Pallet; - type MaxLocks = (); - type WeightInfo = (); - type MaxReserves = MaxReserves; - type ReserveIdentifier = ReserveIdentifier; - type FreezeIdentifier = (); - type MaxFreezes = (); - type RuntimeHoldReason = (); - type RuntimeFreezeReason = (); -} - -impl orml_tokens::Config for Test { - type RuntimeEvent = RuntimeEvent; - type Balance = Balance; - type Amount = Amount; - type CurrencyId = AssetId; - type WeightInfo = (); - type ExistentialDeposits = AssetRegistry; - type MaxLocks = MaxLocks; - type DustRemovalWhitelist = Whitelist; - type MaxReserves = ConstU32<100_000>; - type ReserveIdentifier = (); - type CurrencyHooks = (); -} - -pub struct DummyOraclePriceAdjustment; - -impl PriceAdjustment> for DummyOraclePriceAdjustment { - type Error = DispatchError; - - type PriceAdjustment = FixedU128; - - fn get(global_farm: &GlobalFarmData) -> Result { - //This is special case to test global-fram's fallback when oracle is not available. - if global_farm.updated_at == 999_666_333 { - Err(sp_runtime::DispatchError::Other( - "Oracle is not available - updated_at == 999_666_333 is special case.", - )) - } else { - Ok(FixedU128::from_inner(500_000_000_000_000_000)) //0.5 - } - } -} - -pub struct Whitelist; - -impl Contains for Whitelist { - fn contains(account: &AccountId) -> bool { - if *account == LiquidityMining::pot_account_id().unwrap() { - return true; - } - - DUSTER_WHITELIST.with(|v| v.borrow().contains(account)) - } -} - -impl DustRemovalAccountWhitelist for Whitelist { - type Error = DispatchError; - - fn add_account(account: &AccountId) -> Result<(), Self::Error> { - if Whitelist::contains(account) { - return Err(sp_runtime::DispatchError::Other("Account is already in the whitelist")); - } - - DUSTER_WHITELIST.with(|v| v.borrow_mut().push(*account)); - - Ok(()) - } - - fn remove_account(account: &AccountId) -> Result<(), Self::Error> { - DUSTER_WHITELIST.with(|v| { - let mut v = v.borrow_mut(); - - let idx = v.iter().position(|x| *x == *account).unwrap(); - v.remove(idx); - - Ok(()) - }) - } -} - -pub struct AssetRegistry; - -impl Registry, Balance, DispatchError> for AssetRegistry { - fn exists(name: AssetId) -> bool { - name != UNKNOWN_ASSET - } - - fn retrieve_asset(_name: &Vec) -> Result { - Err(sp_runtime::DispatchError::Other("NotImplemented")) - } - - fn retrieve_asset_type(_asset_id: AssetId) -> Result { - unimplemented!() - } - - fn create_asset(_name: &Vec, _existential_deposit: Balance) -> Result { - Err(sp_runtime::DispatchError::Other("NotImplemented")) - } - - fn get_or_create_asset(_name: Vec, _existential_deposit: Balance) -> Result { - Err(sp_runtime::DispatchError::Other("NotImplemented")) - } -} - -impl GetByKey for AssetRegistry { - fn get(_key: &AssetId) -> Balance { - 1_000_u128 - } -} - -pub struct ExtBuilder { - endowed_accounts: Vec<(AccountId, AssetId, Balance)>, -} - -impl Default for ExtBuilder { - fn default() -> Self { - Self { - endowed_accounts: vec![ - (ALICE, BSX_ACA_SHARE_ID, INITIAL_BALANCE * ONE), - (ALICE, BSX_DOT_SHARE_ID, INITIAL_BALANCE * ONE), - (ALICE, BSX_KSM_SHARE_ID, INITIAL_BALANCE * ONE), - (ALICE, BSX_TKN1_SHARE_ID, 3_000_000 * ONE), - (ALICE, BSX_TKN2_SHARE_ID, 3_000_000 * ONE), - (ALICE, ACA_KSM_SHARE_ID, 3_000_000 * ONE), - (ALICE, BSX, INITIAL_BALANCE * ONE), - (ACCOUNT_WITH_1M, BSX, 1_000_000 * ONE), - (BOB, BSX_ACA_SHARE_ID, INITIAL_BALANCE * ONE), - (BOB, BSX_DOT_SHARE_ID, INITIAL_BALANCE * ONE), - (BOB, BSX_KSM_SHARE_ID, INITIAL_BALANCE * ONE), - (BOB, BSX_TKN1_SHARE_ID, 2_000_000 * ONE), - (BOB, BSX_TKN2_SHARE_ID, 2_000_000 * ONE), - (BOB, ACA_KSM_SHARE_ID, 2_000_000 * ONE), - (BOB, BSX, INITIAL_BALANCE * ONE), - (BOB, KSM, INITIAL_BALANCE * ONE), - (CHARLIE, BSX_ACA_SHARE_ID, INITIAL_BALANCE * ONE), - (CHARLIE, BSX_DOT_SHARE_ID, INITIAL_BALANCE * ONE), - (CHARLIE, BSX_KSM_SHARE_ID, INITIAL_BALANCE * ONE), - (CHARLIE, BSX_TKN1_SHARE_ID, 5_000_000 * ONE), - (CHARLIE, BSX_TKN2_SHARE_ID, 5_000_000 * ONE), - (CHARLIE, BSX, INITIAL_BALANCE * ONE), - (CHARLIE, KSM, INITIAL_BALANCE * ONE), - (CHARLIE, ACA, INITIAL_BALANCE * ONE), - (DAVE, BSX_ACA_SHARE_ID, INITIAL_BALANCE * ONE), - (DAVE, BSX_DOT_SHARE_ID, INITIAL_BALANCE * ONE), - (DAVE, BSX_KSM_SHARE_ID, INITIAL_BALANCE * ONE), - (DAVE, BSX_TKN1_SHARE_ID, 10_000_000 * ONE), - (DAVE, BSX_TKN2_SHARE_ID, 10_000_000 * ONE), - (DAVE, BSX, INITIAL_BALANCE * ONE), - (DAVE, KSM, INITIAL_BALANCE * ONE), - (DAVE, ACA, INITIAL_BALANCE * ONE), - (GC, BSX, INITIAL_BALANCE * ONE), - (GC, TKN1, INITIAL_BALANCE * ONE), - (GC, TKN2, INITIAL_BALANCE * ONE), - (TREASURY, BSX, 1_000_000_000_000 * ONE), - (TREASURY, ACA, 1_000_000_000_000 * ONE), - (TREASURY, HDX, 1_000_000_000_000 * ONE), - (TREASURY, KSM, 1_000_000_000_000 * ONE), - (EVE, BSX_ACA_SHARE_ID, INITIAL_BALANCE * ONE), - (EVE, BSX_DOT_SHARE_ID, INITIAL_BALANCE * ONE), - (EVE, BSX_KSM_SHARE_ID, INITIAL_BALANCE * ONE), - (EVE, BSX_TKN1_SHARE_ID, 10_000_000 * ONE), - (EVE, BSX_TKN2_SHARE_ID, 10_000_000 * ONE), - (EVE, BSX, INITIAL_BALANCE * ONE), - (EVE, KSM, INITIAL_BALANCE * ONE), - (EVE, ACA, INITIAL_BALANCE * ONE), - ], - } - } -} - -impl ExtBuilder { - pub fn build(self) -> sp_io::TestExternalities { - AMM_POOLS.with(|v| v.borrow_mut().clear()); - DUSTER_WHITELIST.with(|v| v.borrow_mut().clear()); - - let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - - orml_tokens::GenesisConfig:: { - balances: self.endowed_accounts, - } - .assimilate_storage(&mut t) - .unwrap(); - - t.into() - } -} - -pub fn set_block_number(n: u64) { - MockBlockNumberProvider::set(n); - System::set_block_number(n); -} diff --git a/pallets/liquidity-mining/src/tests/mod.rs b/pallets/liquidity-mining/src/tests/mod.rs deleted file mode 100644 index aabc3c60034..00000000000 --- a/pallets/liquidity-mining/src/tests/mod.rs +++ /dev/null @@ -1,269 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use mock::{ - asset_pair_to_map_key, set_block_number, with_transaction, AccountId, AssetId, AssetPair, Balance, BlockNumber, - ExtBuilder, LiquidityMining, RuntimeOrigin as Origin, Test, Tokens, TransactionOutcome, Whitelist, ACA, ACA_FARM, - ACA_KSM_AMM, ACA_KSM_SHARE_ID, ACCOUNT_WITH_1M, ALICE, AMM_POOLS, BOB, BSX, BSX_ACA_AMM, BSX_ACA_SHARE_ID, - BSX_ACA_YIELD_FARM_ID, BSX_DOT_AMM, BSX_DOT_SHARE_ID, BSX_DOT_YIELD_FARM_ID, BSX_ETH_AMM, BSX_ETH_SHARE_ID, - BSX_FARM, BSX_HDX_AMM, BSX_HDX_SHARE_ID, BSX_KSM_AMM, BSX_KSM_SHARE_ID, BSX_KSM_YIELD_FARM_ID, BSX_TKN1_AMM, - BSX_TKN1_SHARE_ID, BSX_TKN2_AMM, BSX_TKN2_SHARE_ID, CHARLIE, DAVE, DOT, ETH, EVE, GC, GC_FARM, HDX, - INITIAL_BALANCE, KSM, KSM_DOT_AMM, KSM_DOT_SHARE_ID, KSM_FARM, ONE, TKN1, TKN2, TREASURY, UNKNOWN_ASSET, -}; - -use frame_support::{assert_noop, assert_ok, traits::Contains}; - -use sp_arithmetic::{traits::CheckedSub, FixedPointNumber}; -use std::cmp::Ordering; - -const ALICE_FARM: u32 = BSX_FARM; -const BOB_FARM: u32 = KSM_FARM; -const CHARLIE_FARM: u32 = ACA_FARM; -const DAVE_FARM: u32 = 5; -const EVE_FARM: u32 = 6; - -thread_local! { -static PREDEFINED_GLOBAL_FARMS_INS1: [GlobalFarmData; 6] = [ - GlobalFarmData { - id: ALICE_FARM, - updated_at: 0, - reward_currency: BSX, - yield_per_period: Perquintill::from_percent(20), - planned_yielding_periods: 300_u64, - blocks_per_period: 1_000_u64, - owner: ALICE, - incentivized_asset: BSX, - max_reward_per_period: 333_333_333_333_333_333_333, - accumulated_rpz: Zero::zero(), - live_yield_farms_count: Zero::zero(), - total_yield_farms_count: Zero::zero(), - accumulated_paid_rewards: 0, - total_shares_z: 0, - pending_rewards: 0, - state: FarmState::Active, - min_deposit: 1_000, - price_adjustment: One::one(), - }, - GlobalFarmData { - id: BOB_FARM, - updated_at: 0, - reward_currency: KSM, - yield_per_period: Perquintill::from_percent(38), - planned_yielding_periods: 5_000_u64, - blocks_per_period: 10_000_u64, - owner: BOB, - incentivized_asset: BSX, - max_reward_per_period: 200_000 * ONE, - accumulated_rpz: Zero::zero(), - live_yield_farms_count: Zero::zero(), - total_yield_farms_count: Zero::zero(), - accumulated_paid_rewards: 0, - total_shares_z: 0, - pending_rewards: 0, - state: FarmState::Active, - min_deposit: 1_000, - price_adjustment: One::one(), - }, - GlobalFarmData { - id: GC_FARM, - updated_at: 0, - reward_currency: BSX, - yield_per_period: Perquintill::from_percent(50), - planned_yielding_periods: 500_u64, - blocks_per_period: 100_u64, - owner: GC, - incentivized_asset: BSX, - max_reward_per_period: 60_000_000 * ONE, - accumulated_rpz: Zero::zero(), - live_yield_farms_count: 2, - total_yield_farms_count: 2, - accumulated_paid_rewards: 0, - total_shares_z: 0, - pending_rewards: 0, - state: FarmState::Active, - min_deposit: 1_000, - price_adjustment: One::one(), - }, - GlobalFarmData { - id: CHARLIE_FARM, - updated_at: 0, - reward_currency: ACA, - yield_per_period: Perquintill::from_percent(50), - planned_yielding_periods: 500_u64, - blocks_per_period: 100_u64, - owner: CHARLIE, - incentivized_asset: KSM, - max_reward_per_period: 60_000_000 * ONE, - accumulated_rpz: Zero::zero(), - live_yield_farms_count: 1, - total_yield_farms_count: 1, - accumulated_paid_rewards: 0, - total_shares_z: 0, - pending_rewards: 0, - state: FarmState::Active, - min_deposit: 1_000, - price_adjustment: FixedU128::from_float(0.5), - }, - GlobalFarmData { - id: DAVE_FARM, - updated_at: 0, - reward_currency: ACA, - yield_per_period: Perquintill::from_percent(20), - planned_yielding_periods: 300_u64, - blocks_per_period: 1_000_u64, - owner: DAVE, - incentivized_asset: TKN1, - max_reward_per_period: 333_333_333_333, - accumulated_rpz: Zero::zero(), - live_yield_farms_count: Zero::zero(), - total_yield_farms_count: Zero::zero(), - accumulated_paid_rewards: 0, - total_shares_z: 0, - pending_rewards: 0, - state: FarmState::Active, - min_deposit: 1_000, - price_adjustment: One::one(), - }, - GlobalFarmData { - id: EVE_FARM, - updated_at: 0, - reward_currency: KSM, - yield_per_period: Perquintill::from_percent(20), - planned_yielding_periods: 300_u64, - blocks_per_period: 1_000_u64, - owner: EVE, - incentivized_asset: BSX, - max_reward_per_period: 333_333_333_333, - accumulated_rpz: Zero::zero(), - live_yield_farms_count: Zero::zero(), - total_yield_farms_count: Zero::zero(), - accumulated_paid_rewards: 0, - total_shares_z: 0, - pending_rewards: 0, - state: FarmState::Active, - min_deposit: 1_000, - price_adjustment: One::one(), - }, -] -} - -const GC_BSX_TKN1_YIELD_FARM_ID: u32 = 7; -const GC_BSX_TKN2_YIELD_FARM_ID: u32 = 8; -const CHARLIE_ACA_KSM_YIELD_FARM_ID: u32 = 9; -const DAVE_BSX_TKN1_YIELD_FARM_ID: u32 = 10; -const EVE_BSX_TKN1_YIELD_FARM_ID: u32 = 11; -const EVE_BSX_TKN2_YIELD_FARM_ID: u32 = 12; - -thread_local! { - static PREDEFINED_YIELD_FARMS_INS1: [YieldFarmData; 6] = [ - YieldFarmData::new( - GC_BSX_TKN1_YIELD_FARM_ID, - 0, - Some(LoyaltyCurve::default()), - FixedU128::from(5), - ), - YieldFarmData::new( - GC_BSX_TKN2_YIELD_FARM_ID, - 0, - Some(LoyaltyCurve::default()), - FixedU128::from(10), - ), - YieldFarmData::new( - CHARLIE_ACA_KSM_YIELD_FARM_ID, - 0, - Some(LoyaltyCurve::default()), - FixedU128::from(10), - ), - YieldFarmData::new( - DAVE_BSX_TKN1_YIELD_FARM_ID, - 0, - Some(LoyaltyCurve::default()), - FixedU128::from(10), - ), - YieldFarmData::new( - EVE_BSX_TKN1_YIELD_FARM_ID, - 0, - Some(LoyaltyCurve::default()), - FixedU128::from(10), - ), - YieldFarmData::new( - EVE_BSX_TKN2_YIELD_FARM_ID, - 0, - Some(LoyaltyCurve::default()), - FixedU128::from(10), - ), - ] -} - -const PREDEFINED_DEPOSIT_IDS: [u128; 7] = [1, 2, 3, 4, 5, 6, 7]; - -//NOTE: look at approx pallet - https://github.com/brendanzab/approx -fn is_approx_eq_fixedu128(num_1: FixedU128, num_2: FixedU128, delta: FixedU128) -> bool { - let diff = match num_1.cmp(&num_2) { - Ordering::Less => num_2.checked_sub(&num_1).unwrap(), - Ordering::Greater => num_1.checked_sub(&num_2).unwrap(), - Ordering::Equal => return true, - }; - - if diff.cmp(&delta) == Ordering::Greater { - println!("diff: {diff:?}; delta: {delta:?}; n1: {num_1:?}; n2: {num_2:?}"); - - false - } else { - true - } -} - -fn get_predefined_global_farm_ins1(idx: usize) -> GlobalFarmData { - PREDEFINED_GLOBAL_FARMS_INS1.with(|v| v[idx].clone()) -} - -fn get_predefined_yield_farm_ins1(idx: usize) -> YieldFarmData { - PREDEFINED_YIELD_FARMS_INS1.with(|v| v[idx].clone()) -} - -#[macro_export] -macro_rules! assert_eq_approx { - ( $x:expr, $y:expr, $z:expr, $r:expr) => {{ - let diff = if $x >= $y { $x - $y } else { $y - $x }; - if diff > $z { - panic!("\n{} not equal\n left: {:?}\nright: {:?}\n", $r, $x, $y); - } - }}; -} - -pub mod claim_rewards; -pub mod create_global_farm; -pub mod create_yield_farm; -pub mod deposit_lp_shares; -pub mod full_run; -pub mod invariants; -pub mod mock; -pub mod redeposit_lp_shares; -pub mod resume_yield_farm; -pub mod stop_yield_farm; -pub mod terminate_global_farm; -pub mod terminate_yield_farm; -pub mod test_ext; - -pub mod lm_with_oracle; -#[allow(clippy::module_inception)] -pub mod tests; -pub mod update_global_farm; -pub mod update_yield_farm; -pub mod withdraw_lp_shares; diff --git a/pallets/liquidity-mining/src/tests/redeposit_lp_shares.rs b/pallets/liquidity-mining/src/tests/redeposit_lp_shares.rs deleted file mode 100644 index 4a785d74110..00000000000 --- a/pallets/liquidity-mining/src/tests/redeposit_lp_shares.rs +++ /dev/null @@ -1,289 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn redeposit_lp_shares_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - //predefined_deposit[0] - GC_FARM, BSX_TKN1_AMM - set_block_number(50_000); - assert_eq!( - LiquidityMining::redeposit_lp_shares( - EVE_FARM, - EVE_BSX_TKN1_YIELD_FARM_ID, - PREDEFINED_DEPOSIT_IDS[0], - |_, _, _| { Ok(500 * ONE) } - ) - .unwrap(), - (50 * ONE, BSX_TKN1_AMM) - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, EVE_FARM, EVE_BSX_TKN1_YIELD_FARM_ID)) - .unwrap() - .entries_count, - 1 - ); - - set_block_number(800_000); - //Dave's farm incentivize TKN1 - some balance must be set so `valued_shares` will not be `0`. - assert_eq!( - LiquidityMining::redeposit_lp_shares( - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - PREDEFINED_DEPOSIT_IDS[0], - |_, _, _| { Ok(5_000 * ONE) } - ) - .unwrap(), - (50 * ONE, BSX_TKN1_AMM) - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, DAVE_FARM, DAVE_BSX_TKN1_YIELD_FARM_ID)) - .unwrap() - .entries_count, - 1 - ); - - let deposit = LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).unwrap(); - - assert_eq!( - deposit.yield_farm_entries, - vec![ - YieldFarmEntry { - global_farm_id: GC_FARM, - valued_shares: 2_500 * ONE, - yield_farm_id: GC_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 0, - accumulated_rpvs: Zero::zero(), - entered_at: 18, - updated_at: 18, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - YieldFarmEntry { - global_farm_id: EVE_FARM, - valued_shares: 500 * ONE, - yield_farm_id: EVE_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 0, - accumulated_rpvs: Zero::zero(), - entered_at: 50, - updated_at: 50, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - YieldFarmEntry { - global_farm_id: DAVE_FARM, - valued_shares: 5_000 * ONE, - yield_farm_id: DAVE_BSX_TKN1_YIELD_FARM_ID, - accumulated_claimed_rewards: 0, - accumulated_rpvs: Zero::zero(), - entered_at: 800, - updated_at: 800, - stopped_at_creation: 0, - _phantom: PhantomData, - }, - ] - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] -fn redeposit_lp_shares_deposit_not_found_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let yield_farm_id = DAVE_BSX_TKN1_YIELD_FARM_ID; - - assert_noop!( - LiquidityMining::redeposit_lp_shares(DAVE_FARM, yield_farm_id, 999_999_999, |_, _, _| { Ok(10_u128) }), - Error::::InconsistentState(InconsistentStateError::DepositNotFound) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn redeposit_lp_shares_to_wrong_yield_farm_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - // Desired yield farm is for different assert pair than original deposit. - let yield_farm_id = EVE_BSX_TKN2_YIELD_FARM_ID; //original deposit is for bsx/tkn1 assert pair - - assert_noop!( - LiquidityMining::redeposit_lp_shares(EVE_FARM, yield_farm_id, PREDEFINED_DEPOSIT_IDS[0], |_, _, _| { - Ok(10_u128) - }), - Error::::YieldFarmNotFound - ); - - // Same global farm different asset pair. - let yield_farm_id = GC_BSX_TKN2_YIELD_FARM_ID; - assert_noop!( - LiquidityMining::redeposit_lp_shares(GC_FARM, yield_farm_id, PREDEFINED_DEPOSIT_IDS[0], |_, _, _| { - Ok(10_u128) - }), - Error::::YieldFarmNotFound - ); - - //Desired yield farm is not in the provided global farm. - let yield_farm_id = EVE_BSX_TKN1_YIELD_FARM_ID; - assert_noop!( - LiquidityMining::redeposit_lp_shares(GC_FARM, yield_farm_id, PREDEFINED_DEPOSIT_IDS[0], |_, _, _| { - Ok(10_u128) - }), - Error::::YieldFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn redeposit_lp_shares_to_not_active_yield_farm_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let yield_farm_id = EVE_BSX_TKN1_YIELD_FARM_ID; - - //Deposit to yield farm to prevent flushing from storage on destroy. - assert_ok!(LiquidityMining::deposit_lp_shares( - EVE_FARM, - yield_farm_id, - BSX_TKN1_AMM, - 1_000, - |_, _, _| { Ok(1_000_u128) } - )); - - // Redeposit to stopped farm. - assert_ok!(LiquidityMining::stop_yield_farm(EVE, EVE_FARM, BSX_TKN1_AMM)); - - assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, EVE_FARM, yield_farm_id)) - .unwrap() - .state - .is_stopped()); - - assert_noop!( - LiquidityMining::redeposit_lp_shares(EVE_FARM, yield_farm_id, PREDEFINED_DEPOSIT_IDS[0], |_, _, _| { - Ok(10_u128) - }), - Error::::LiquidityMiningCanceled - ); - - // Redeposit to deleted farm - assert_ok!(LiquidityMining::terminate_yield_farm( - EVE, - EVE_FARM, - yield_farm_id, - BSX_TKN1_AMM - )); - - assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, EVE_FARM, yield_farm_id)) - .unwrap() - .state - .is_terminated()); - - assert_noop!( - LiquidityMining::redeposit_lp_shares(EVE_FARM, yield_farm_id, PREDEFINED_DEPOSIT_IDS[0], |_, _, _| { - Ok(10_u128) - }), - Error::::LiquidityMiningCanceled - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn redeposit_lp_shares_non_existing_farm_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const NON_EXISTING_YILED_FARM_ID: FarmId = 999_999_999; - - assert_noop!( - LiquidityMining::redeposit_lp_shares( - EVE_FARM, - NON_EXISTING_YILED_FARM_ID, - PREDEFINED_DEPOSIT_IDS[0], - |_, _, _| { Ok(10_u128) } - ), - Error::::YieldFarmNotFound - ); - - const NON_EXISTING_GLOBAL_FARM_ID: FarmId = 999_999_999; - assert_noop!( - LiquidityMining::redeposit_lp_shares( - NON_EXISTING_GLOBAL_FARM_ID, - GC_BSX_TKN2_YIELD_FARM_ID, - PREDEFINED_DEPOSIT_IDS[0], - |_, _, _| { Ok(10_u128) } - ), - Error::::YieldFarmNotFound //NOTE: check for yield farm existence is first that's why this error. - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn redeposit_lp_shares_same_deposit_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::redeposit_lp_shares( - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - PREDEFINED_DEPOSIT_IDS[0], - |_, _, _| { Ok(10_u128) } - ), - Error::::DoubleLock - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn redeposit_lp_shares_should_not_work_when_valued_shares_are_bellow_min_deposit() { - let _ = predefined_test_ext_with_deposits().execute_with(|| { - with_transaction(|| { - assert_noop!( - LiquidityMining::redeposit_lp_shares( - EVE_FARM, - EVE_BSX_TKN1_YIELD_FARM_ID, - PREDEFINED_DEPOSIT_IDS[0], - |_, _, _| { Ok(MIN_DEPOSIT - 1) } - ), - Error::::IncorrectValuedShares - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }) - }); -} diff --git a/pallets/liquidity-mining/src/tests/resume_yield_farm.rs b/pallets/liquidity-mining/src/tests/resume_yield_farm.rs deleted file mode 100644 index 8230b470795..00000000000 --- a/pallets/liquidity-mining/src/tests/resume_yield_farm.rs +++ /dev/null @@ -1,233 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn resume_yield_farm_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - //Stop yield farming before resuming. - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); - - let new_multiplier = FixedU128::from(7_490_000); - - assert!(yield_farm.state.is_stopped()); - assert!(yield_farm.multiplier.is_zero()); - assert!(LiquidityMining::active_yield_farm(BSX_TKN1_AMM, GC_FARM).is_none()); - - set_block_number(13_420_000); - - assert_ok!(LiquidityMining::resume_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - new_multiplier - )); - - let yield_farm_stake_in_global_farm = new_multiplier.checked_mul_int(45_540 * ONE).unwrap(); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - state: FarmState::Active, - accumulated_rpz: FixedU128::from_inner(62_987_640_859_560_351_884_356_u128), - multiplier: new_multiplier, - updated_at: 134_200, - total_stopped: 134_175, - ..yield_farm - } - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - total_shares_z: global_farm.total_shares_z + yield_farm_stake_in_global_farm, - updated_at: 134_200, - accumulated_rpz: FixedU128::from_inner(62_987_640_859_560_351_884_356_u128), - pending_rewards: 29_998_716_449_999_999_999_000, - ..global_farm - } - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn resume_yield_farm_non_existing_yield_farm_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let new_multiplier = FixedU128::from(7_490_000); - - assert_noop!( - LiquidityMining::resume_yield_farm(GC, GC_FARM, BSX_KSM_YIELD_FARM_ID, BSX_KSM_AMM, new_multiplier), - Error::::YieldFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn resume_yield_farm_non_canceled_yield_farm_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let new_multiplier = FixedU128::from(7_490_000); - - assert_noop!( - LiquidityMining::resume_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - new_multiplier - ), - Error::::YieldFarmAlreadyExists - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn resume_yield_farm_not_owner_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let new_multiplier = FixedU128::from(7_490_000); - - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - assert_noop!( - LiquidityMining::resume_yield_farm( - ALICE, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - new_multiplier - ), - Error::::Forbidden - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn resume_yield_farm_terminated_farm_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let new_multiplier = FixedU128::from(7_490_000); - - //Farm have to be stopped before delete. - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - //Terminate farm. - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - assert_noop!( - LiquidityMining::resume_yield_farm( - ALICE, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - new_multiplier - ), - Error::::LiquidityMiningIsNotStopped - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -//This function is testing case when new yield farm for the same asset pair was created in the global -//farm while first yield farm was stopped. -#[test] -fn resume_yield_farm_same_amm_farm_active_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let new_multiplier = FixedU128::from(7_490_000); - - //Stop 1-th farm. - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - //Create new farm for same assert pair. - assert_ok!(with_transaction(|| TransactionOutcome::Commit({ - LiquidityMining::create_yield_farm( - GC, - GC_FARM, - FixedU128::from(10_000_u128), - None, - BSX_TKN1_AMM, - vec![BSX, TKN1], - ) - }))); - - assert_noop!( - LiquidityMining::resume_yield_farm( - ALICE, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - new_multiplier - ), - Error::::YieldFarmAlreadyExists - ); - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn resume_yield_farm_should_not_work_when_multiplier_is_lt_min_yield_farm_multiplier() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let new_multiplier = MIN_YIELD_FARM_MULTIPLIER - FixedU128::from_inner(1_u128); - - //Arrange - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - //Act & assert - assert_noop!( - LiquidityMining::resume_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - new_multiplier - ), - Error::::InvalidMultiplier - ); - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} diff --git a/pallets/liquidity-mining/src/tests/stop_yield_farm.rs b/pallets/liquidity-mining/src/tests/stop_yield_farm.rs deleted file mode 100644 index f6fdde9b173..00000000000 --- a/pallets/liquidity-mining/src/tests/stop_yield_farm.rs +++ /dev/null @@ -1,188 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn stop_yield_farm_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let yield_farm_account = LiquidityMining::farm_account_id(GC_BSX_TKN1_YIELD_FARM_ID).unwrap(); - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - let yield_farm_bsx_balance = Tokens::free_balance(BSX, &yield_farm_account); - let global_farm_bsx_balance = Tokens::free_balance(BSX, &global_farm_account); - let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); - - assert!(yield_farm.state.is_active()); - - assert_eq!( - LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM).unwrap(), - yield_farm.id - ); - - let stake_in_global_farm = yield_farm - .multiplier - .checked_mul_int(yield_farm.total_valued_shares) - .unwrap(); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - state: FarmState::Stopped, - multiplier: 0.into(), - ..yield_farm - } - ); - - assert!(LiquidityMining::active_yield_farm(BSX_TKN1_AMM, GC_FARM).is_none()); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - total_shares_z: global_farm.total_shares_z.checked_sub(stake_in_global_farm).unwrap(), - ..global_farm - } - ); - - assert_eq!(Tokens::free_balance(BSX, &yield_farm_account), yield_farm_bsx_balance); - assert_eq!(Tokens::free_balance(BSX, &global_farm_account), global_farm_bsx_balance); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - - //Cancel yield farming with farms update. - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - let pot = LiquidityMining::pot_account_id().unwrap(); - - //_0 - value before act. - let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - let pot_balance_0 = Tokens::free_balance(BSX, &pot); - let global_balance_0 = Tokens::free_balance(BSX, &global_farm_account); - - let last_yield_farm_rewards = 8_538_750 * ONE; - let allocated_for_other_yield_farms = 17_860_875 * ONE; - - assert!(yield_farm_0.state.is_active()); - - set_block_number(10_000); - - assert_eq!( - LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM).unwrap(), - yield_farm_0.id - ); - - let stake_in_global_farm = yield_farm_0 - .multiplier - .checked_mul_int(yield_farm_0.total_valued_shares) - .unwrap(); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 100, - accumulated_rpvs: FixedU128::from_inner(205_000_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(41_000_000_000_000_000_000_u128), - state: FarmState::Stopped, - multiplier: 0.into(), - left_to_distribute: yield_farm_0.left_to_distribute + last_yield_farm_rewards, - ..yield_farm_0 - } - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 100, - accumulated_rpz: FixedU128::from_inner(41_000_000_000_000_000_000_u128), - total_shares_z: global_farm_0.total_shares_z.checked_sub(stake_in_global_farm).unwrap(), - pending_rewards: global_farm_0.pending_rewards + allocated_for_other_yield_farms, - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards + last_yield_farm_rewards, - ..global_farm_0 - } - ); - - assert_eq!( - Tokens::free_balance(BSX, &pot), - pot_balance_0 + last_yield_farm_rewards + allocated_for_other_yield_farms - ); - - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - global_balance_0 - last_yield_farm_rewards - allocated_for_other_yield_farms - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn stop_yield_farm_invalid_yield_farm_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_DOT_AMM), - Error::::YieldFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn stop_yield_farm_liquidity_mining_already_canceled() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - //1-th stop should pass ok. - assert_eq!( - LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM).unwrap(), - GC_BSX_TKN1_YIELD_FARM_ID - ); - - assert_noop!( - LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM), - Error::::YieldFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn stop_yield_farm_not_owner_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const NOT_FARMS_OWNER: u128 = ALICE; - - assert_noop!( - LiquidityMining::stop_yield_farm(NOT_FARMS_OWNER, GC_FARM, BSX_TKN1_AMM), - Error::::Forbidden - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} diff --git a/pallets/liquidity-mining/src/tests/terminate_global_farm.rs b/pallets/liquidity-mining/src/tests/terminate_global_farm.rs deleted file mode 100644 index a3121ed303a..00000000000 --- a/pallets/liquidity-mining/src/tests/terminate_global_farm.rs +++ /dev/null @@ -1,254 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn terminate_global_farm_should_work() { - //Test with flushing - global farm should be removed from storage if it has no yield farms. - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - let predefined_global_farm = get_predefined_global_farm_ins1(1); - let farm_account = LiquidityMining::farm_account_id(BOB_FARM).unwrap(); - let bob_reward_currency_balance = Tokens::free_balance(predefined_global_farm.reward_currency, &BOB); - - let undistributed_rewards = - Tokens::free_balance(get_predefined_global_farm_ins1(1).reward_currency, &farm_account); - - assert_eq!( - LiquidityMining::terminate_global_farm(BOB, BOB_FARM).unwrap(), - ( - get_predefined_global_farm_ins1(1).reward_currency, - undistributed_rewards, - BOB - ) - ); - - //Global farm with no yield farms should be flushed. - assert!(LiquidityMining::global_farm(BOB_FARM).is_none()); - - //Undistributed rewards should be transferred to owner. - assert_eq!( - Tokens::free_balance(predefined_global_farm.reward_currency, &BOB), - bob_reward_currency_balance + undistributed_rewards - ); - - //Non-dustable check - assert_eq!(Whitelist::contains(&farm_account), false); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - - //Without flushing - global farm should stay in the storage marked as deleted. - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - let predefined_global_farm = get_predefined_global_farm_ins1(3); - let farm_account = LiquidityMining::farm_account_id(CHARLIE_FARM).unwrap(); - let charlie_reward_currency_balance = - Tokens::free_balance(predefined_global_farm.reward_currency, &CHARLIE); - let undistributed_rewards = Tokens::free_balance(predefined_global_farm.reward_currency, &farm_account); - let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[2].id); - - //Add deposit to yield farm so it will not be flushed on destroy. - assert_ok!(LiquidityMining::deposit_lp_shares( - CHARLIE_FARM, - yield_farm_id, - ACA_KSM_AMM, - 1_000 * ONE, - |_, _, _| { Ok(10 * ONE) }, - )); - - //Stop farming. - assert_ok!(LiquidityMining::stop_yield_farm(CHARLIE, CHARLIE_FARM, ACA_KSM_AMM)); - - //Destroy yield farm (yield farm is destroyed but not flushed) - assert_ok!(LiquidityMining::terminate_yield_farm( - CHARLIE, - CHARLIE_FARM, - yield_farm_id, - ACA_KSM_AMM - )); - - //Destroy global farm. - assert_ok!(LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM)); - - //Global farm with yield farms should NOT be flushed. - assert_eq!( - LiquidityMining::global_farm(CHARLIE_FARM).unwrap(), - GlobalFarmData { - live_yield_farms_count: 0, - total_yield_farms_count: 1, - state: FarmState::Terminated, - ..predefined_global_farm - } - ); - - assert_eq!( - Tokens::free_balance(predefined_global_farm.reward_currency, &CHARLIE), - charlie_reward_currency_balance + undistributed_rewards - ); - - //Farm's account should be removed when farm is destroyed. - assert_eq!(Whitelist::contains(&farm_account), false); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }) -} - -#[test] -fn terminate_global_farm_not_owner_should_not_work() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::terminate_global_farm(ALICE, BOB_FARM), - Error::::Forbidden - ); - - assert_eq!( - LiquidityMining::global_farm(BOB_FARM).unwrap(), - get_predefined_global_farm_ins1(1) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn terminate_global_farm_farm_not_exists_should_not_work() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - const NON_EXISTING_FARM: u32 = 999_999_999; - assert_noop!( - LiquidityMining::terminate_global_farm(ALICE, NON_EXISTING_FARM), - Error::::GlobalFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn terminate_global_farm_with_yield_farms_should_not_work() { - //Global farm CAN'T be destroyed if it has active or stopped yield farms. - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - //Destroy farm with active yield farms should not work. - let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[2].id); - assert_eq!( - LiquidityMining::active_yield_farm(ACA_KSM_AMM, CHARLIE_FARM).unwrap(), - yield_farm_id - ); - - assert_noop!( - LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM), - Error::::GlobalFarmIsNotEmpty - ); - - assert_eq!( - LiquidityMining::global_farm(CHARLIE_FARM).unwrap(), - get_predefined_global_farm_ins1(3) - ); - - //Destroy farm with stopped yield farms should not work. - //Stop yield farm - assert_ok!(LiquidityMining::stop_yield_farm(CHARLIE, CHARLIE_FARM, ACA_KSM_AMM)); - assert!(LiquidityMining::active_yield_farm(ACA_KSM_AMM, CHARLIE_FARM).is_none()); - - assert_noop!( - LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM), - Error::::GlobalFarmIsNotEmpty - ); - - assert_eq!( - LiquidityMining::global_farm(CHARLIE_FARM).unwrap(), - get_predefined_global_farm_ins1(3) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn terminate_global_farm_healthy_farm_should_not_work() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - let farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - let predefined_global_farm = get_predefined_global_farm_ins1(2); - assert!(!Tokens::free_balance(predefined_global_farm.reward_currency, &farm_account).is_zero()); - - assert_noop!( - LiquidityMining::terminate_global_farm(GC, GC_FARM), - Error::::GlobalFarmIsNotEmpty - ); - - assert_eq!(LiquidityMining::global_farm(GC_FARM).unwrap(), predefined_global_farm); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn terminate_global_farm_should_fail_with_global_farm_not_found_when_farm_is_already_terminated() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - //Arrange - let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[2].id); - - //Add deposit to yield farm so it will not be flushed on destroy. - assert_ok!(LiquidityMining::deposit_lp_shares( - CHARLIE_FARM, - yield_farm_id, - ACA_KSM_AMM, - 1_000 * ONE, - |_, _, _| { Ok(10 * ONE) }, - )); - - //Stop farming. - assert_ok!(LiquidityMining::stop_yield_farm(CHARLIE, CHARLIE_FARM, ACA_KSM_AMM)); - - //Destroy yield farm (yield farm is destroyed but not flushed) - assert_ok!(LiquidityMining::terminate_yield_farm( - CHARLIE, - CHARLIE_FARM, - yield_farm_id, - ACA_KSM_AMM - )); - - //Destroy global farm. - assert_ok!(LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM)); - - //Global farm with yield farms should NOT be flushed. - pretty_assertions::assert_eq!(LiquidityMining::global_farm(CHARLIE_FARM).is_some(), true); - - //Act & assert - assert_noop!( - LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM), - Error::::GlobalFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }) -} diff --git a/pallets/liquidity-mining/src/tests/terminate_yield_farm.rs b/pallets/liquidity-mining/src/tests/terminate_yield_farm.rs deleted file mode 100644 index 6433880aa97..00000000000 --- a/pallets/liquidity-mining/src/tests/terminate_yield_farm.rs +++ /dev/null @@ -1,228 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn terminate_yield_farm_with_deposits_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - let global_farm_bsx_balance = Tokens::free_balance(BSX, &global_farm_account); - - let pot = LiquidityMining::pot_account_id().unwrap(); - let pot_balance_0 = Tokens::free_balance(BSX, &pot); - - // Cancel yield farm before removing. - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - live_yield_farms_count: global_farm_0.live_yield_farms_count.checked_sub(1).unwrap(), - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - yield_farm_0.left_to_distribute, - ..global_farm_0 - } - ); - - //Yield farm is removed from storage only if there are no more farm entries. - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - state: FarmState::Terminated, - left_to_distribute: 0, - ..yield_farm_0 - } - ); - - //Yield-farm's `left_to_distribute`(unpaid rewards) should be transferred from pot to - //global-farm's account. - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - global_farm_bsx_balance - .checked_add(yield_farm_0.left_to_distribute) - .unwrap() - ); - - assert_eq!( - Tokens::free_balance(BSX, &pot), - pot_balance_0.checked_sub(yield_farm_0.left_to_distribute).unwrap() - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn terminate_yield_farm_without_deposits_should_work() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - let yield_farm_account = LiquidityMining::farm_account_id(GC_BSX_TKN1_YIELD_FARM_ID).unwrap(); - - let yield_farm_bsx_balance = Tokens::free_balance(BSX, &yield_farm_account); - let global_farm_bsx_balance = Tokens::free_balance(BSX, &global_farm_account); - - //Stop yield farm before removing - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); - - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - live_yield_farms_count: global_farm.live_yield_farms_count.checked_sub(1).unwrap(), - //yield farm was removed from storage so this should change - total_yield_farms_count: global_farm.total_yield_farms_count.checked_sub(1).unwrap(), - ..global_farm - } - ); - - //Yield farm without deposits should be flushed. - assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).is_none()); - - assert_eq!(Tokens::free_balance(BSX, &yield_farm_account), 0); - - //Unpaid rewards from yield farm account should be transferred back to global farm's account. - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - global_farm_bsx_balance.checked_add(yield_farm_bsx_balance).unwrap() - ); - - //Non-dustable check - assert_eq!(Whitelist::contains(&yield_farm_account), false); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn terminate_yield_farm_not_stopped_yield_farming_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::terminate_yield_farm(GC, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID, BSX_TKN1_AMM), - Error::::LiquidityMiningIsActive - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn terminate_yield_farm_not_owner_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const NOT_OWNER: u128 = ALICE; - - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - assert_noop!( - LiquidityMining::terminate_yield_farm(NOT_OWNER, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID, BSX_TKN1_AMM), - Error::::Forbidden - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn terminate_yield_farm_yield_farm_does_not_exists_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::terminate_yield_farm(GC, GC_FARM, BSX_DOT_YIELD_FARM_ID, BSX_DOT_AMM), - Error::::YieldFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn terminate_yield_farm_should_work_when_farm_is_stopped_and_active_yield_farm_exists_for_same_amm_pool_id() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - let yield_farm_acoount = LiquidityMining::farm_account_id(GC_BSX_TKN1_YIELD_FARM_ID).unwrap(); - - let yield_farm_bsx_balance = Tokens::free_balance(BSX, &yield_farm_acoount); - let global_farm_bsx_balance = Tokens::free_balance(BSX, &global_farm_account); - - //Stop yield farm before removing - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - LiquidityMining::create_yield_farm(GC, GC_FARM, One::one(), None, BSX_TKN1_AMM, vec![BSX, TKN1]).unwrap(); - - let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); - - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - live_yield_farms_count: global_farm.live_yield_farms_count.checked_sub(1).unwrap(), - //yield farm was removed from storage so this should change - total_yield_farms_count: global_farm.total_yield_farms_count.checked_sub(1).unwrap(), - ..global_farm - } - ); - - //Yield farm without deposits should be flushed. - assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).is_none()); - - assert_eq!(Tokens::free_balance(BSX, &yield_farm_acoount), 0); - - //Unpaid rewards from yield farm account should be transferred back to global farm's account. - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - global_farm_bsx_balance.checked_add(yield_farm_bsx_balance).unwrap() - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} diff --git a/pallets/liquidity-mining/src/tests/test_ext.rs b/pallets/liquidity-mining/src/tests/test_ext.rs deleted file mode 100644 index 1b331f232dc..00000000000 --- a/pallets/liquidity-mining/src/tests/test_ext.rs +++ /dev/null @@ -1,411 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; - -pub fn new_test_ext() -> sp_io::TestExternalities { - let mut ext = ExtBuilder::default().build(); - ext.execute_with(|| set_block_number(1)); - ext -} - -pub fn predefined_test_ext() -> sp_io::TestExternalities { - let mut ext = new_test_ext(); - ext.execute_with(|| { - let _ = with_transaction(|| { - let expected_farm = get_predefined_global_farm_ins1(0); - assert_ok!(LiquidityMining::create_global_farm( - 100_000_000_000 * ONE, - expected_farm.planned_yielding_periods, - expected_farm.blocks_per_period, - expected_farm.incentivized_asset, - expected_farm.reward_currency, - ALICE, - expected_farm.yield_per_period, - expected_farm.min_deposit, - expected_farm.price_adjustment, - )); - - let expected_farm = get_predefined_global_farm_ins1(1); - assert_ok!(LiquidityMining::create_global_farm( - 1_000_000_000 * ONE, - expected_farm.planned_yielding_periods, - expected_farm.blocks_per_period, - expected_farm.incentivized_asset, - expected_farm.reward_currency, - BOB, - expected_farm.yield_per_period, - expected_farm.min_deposit, - expected_farm.price_adjustment, - )); - - let expected_farm = get_predefined_global_farm_ins1(2); - assert_ok!(LiquidityMining::create_global_farm( - 30_000_000_000 * ONE, - expected_farm.planned_yielding_periods, - expected_farm.blocks_per_period, - expected_farm.incentivized_asset, - expected_farm.reward_currency, - GC, - expected_farm.yield_per_period, - expected_farm.min_deposit, - expected_farm.price_adjustment, - )); - - let expected_farm = get_predefined_global_farm_ins1(3); - assert_ok!(LiquidityMining::create_global_farm( - 30_000_000_000 * ONE, - expected_farm.planned_yielding_periods, - expected_farm.blocks_per_period, - expected_farm.incentivized_asset, - expected_farm.reward_currency, - CHARLIE, - expected_farm.yield_per_period, - expected_farm.min_deposit, - expected_farm.price_adjustment, - )); - - let expected_farm = get_predefined_global_farm_ins1(4); - assert_ok!(LiquidityMining::create_global_farm( - 30_000_000_000 * ONE, - expected_farm.planned_yielding_periods, - expected_farm.blocks_per_period, - expected_farm.incentivized_asset, - expected_farm.reward_currency, - DAVE, - expected_farm.yield_per_period, - expected_farm.min_deposit, - expected_farm.price_adjustment, - )); - - let expected_farm = get_predefined_global_farm_ins1(5); - assert_ok!(LiquidityMining::create_global_farm( - 30_000_000_000 * ONE, - expected_farm.planned_yielding_periods, - expected_farm.blocks_per_period, - expected_farm.incentivized_asset, - expected_farm.reward_currency, - EVE, - expected_farm.yield_per_period, - expected_farm.min_deposit, - expected_farm.price_adjustment, - )); - - let amm_mock_data = vec![ - ( - AssetPair { - asset_in: BSX, - asset_out: ACA, - }, - (BSX_ACA_AMM, BSX_ACA_SHARE_ID), - ), - ( - AssetPair { - asset_in: KSM, - asset_out: BSX, - }, - (BSX_KSM_AMM, BSX_KSM_SHARE_ID), - ), - ( - AssetPair { - asset_in: BSX, - asset_out: DOT, - }, - (BSX_DOT_AMM, BSX_DOT_SHARE_ID), - ), - ( - AssetPair { - asset_in: BSX, - asset_out: ETH, - }, - (BSX_ETH_AMM, BSX_ETH_SHARE_ID), - ), - ( - AssetPair { - asset_in: BSX, - asset_out: HDX, - }, - (BSX_HDX_AMM, BSX_HDX_SHARE_ID), - ), - ( - AssetPair { - asset_in: BSX, - asset_out: TKN1, - }, - (BSX_TKN1_AMM, BSX_TKN1_SHARE_ID), - ), - ( - AssetPair { - asset_in: BSX, - asset_out: TKN2, - }, - (BSX_TKN2_AMM, BSX_TKN2_SHARE_ID), - ), - ( - AssetPair { - asset_in: KSM, - asset_out: DOT, - }, - (KSM_DOT_AMM, KSM_DOT_SHARE_ID), - ), - ( - AssetPair { - asset_in: ACA, - asset_out: KSM, - }, - (ACA_KSM_AMM, ACA_KSM_SHARE_ID), - ), - ]; - - AMM_POOLS.with(|h| { - let mut hm = h.borrow_mut(); - for (k, v) in amm_mock_data { - hm.insert(asset_pair_to_map_key(k), v); - } - }); - - let yield_farm = get_predefined_yield_farm_ins1(0); - init_yield_farm_ins1(GC, GC_FARM, BSX_TKN1_AMM, BSX, TKN1, yield_farm); - - let yield_farm = get_predefined_yield_farm_ins1(1); - init_yield_farm_ins1(GC, GC_FARM, BSX_TKN2_AMM, BSX, TKN2, yield_farm); - - let yield_farm = get_predefined_yield_farm_ins1(2); - init_yield_farm_ins1(CHARLIE, CHARLIE_FARM, ACA_KSM_AMM, ACA, KSM, yield_farm); - - let yield_farm = get_predefined_yield_farm_ins1(3); - init_yield_farm_ins1(DAVE, DAVE_FARM, BSX_TKN1_AMM, BSX, TKN1, yield_farm); - - let yield_farm = get_predefined_yield_farm_ins1(4); - init_yield_farm_ins1(EVE, EVE_FARM, BSX_TKN1_AMM, BSX, TKN1, yield_farm); - - let yield_farm = get_predefined_yield_farm_ins1(5); - init_yield_farm_ins1(EVE, EVE_FARM, BSX_TKN2_AMM, BSX, TKN2, yield_farm); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - - ext -} - -fn init_yield_farm_ins1( - owner: AccountId, - farm_id: GlobalFarmId, - amm_id: AccountId, - asset_a: AssetId, - asset_b: AssetId, - yield_farm: YieldFarmData, -) { - assert_ok!(LiquidityMining::create_yield_farm( - owner, - farm_id, - yield_farm.multiplier, - yield_farm.loyalty_curve.clone(), - amm_id, - vec![asset_a, asset_b], - )); - - assert_eq!( - LiquidityMining::yield_farm((amm_id, farm_id, yield_farm.id)).unwrap(), - yield_farm - ); -} - -pub fn predefined_test_ext_with_deposits() -> sp_io::TestExternalities { - let mut ext = predefined_test_ext(); - - ext.execute_with(|| { - let _ = with_transaction(|| { - let farm_id = GC_FARM; - - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - let pot_account = LiquidityMining::pot_account_id().unwrap(); - - //DEPOSIT 1: - set_block_number(1_800); //18-th period - - let deposited_amount = 50 * ONE; - assert_ok!(LiquidityMining::deposit_lp_shares( - farm_id, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - deposited_amount, - |_, _, _| { Ok(2_500 * ONE) }, - )); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).is_some()); - - // DEPOSIT 2 (deposit in same period): - let deposited_amount = 80 * ONE; - assert_eq!( - LiquidityMining::deposit_lp_shares( - farm_id, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - deposited_amount, - |_, _, _| { Ok(4_160 * ONE) }, - ) - .unwrap(), - PREDEFINED_DEPOSIT_IDS[1] - ); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[1]).is_some()); - - // DEPOSIT 3 (same period, second yield farm): - let deposited_amount = 25 * ONE; - assert_ok!(LiquidityMining::deposit_lp_shares( - farm_id, - GC_BSX_TKN2_YIELD_FARM_ID, - BSX_TKN2_AMM, - deposited_amount, - |_, _, _| { Ok(200 * ONE) }, - )); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[2]).is_some()); - - // DEPOSIT 4 (new period): - set_block_number(2051); //period 20 - - let deposited_amount = 800 * ONE; - assert_ok!(LiquidityMining::deposit_lp_shares( - farm_id, - GC_BSX_TKN2_YIELD_FARM_ID, - BSX_TKN2_AMM, - deposited_amount, - |_, _, _| { Ok(46_400 * ONE) }, - )); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[3]).is_some()); - - // DEPOSIT 5 (same period, second yield farm): - set_block_number(2_586); //period 25 - - let deposited_amount = 87 * ONE; - assert_ok!(LiquidityMining::deposit_lp_shares( - farm_id, - GC_BSX_TKN2_YIELD_FARM_ID, - BSX_TKN2_AMM, - deposited_amount, - |_, _, _| { Ok(261 * ONE) }, - )); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[4]).is_some()); - - // DEPOSIT 6 (same period): - set_block_number(2_596); //period 25 - - let deposited_amount = 48 * ONE; - assert_ok!(LiquidityMining::deposit_lp_shares( - farm_id, - GC_BSX_TKN2_YIELD_FARM_ID, - BSX_TKN2_AMM, - deposited_amount, - |_, _, _| { Ok(768 * ONE) }, - )); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[5]).is_some()); - - // DEPOSIT 7 : (same period different liq poll farm) - set_block_number(2_596); //period 25 - - let deposited_amount = 486 * ONE; - assert_ok!(LiquidityMining::deposit_lp_shares( - farm_id, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - deposited_amount, - |_, _, _| { Ok(38_880 * ONE) }, - )); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[6]).is_some()); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - id: GC_FARM, - updated_at: 25, - reward_currency: BSX, - yield_per_period: Perquintill::from_percent(50), - planned_yielding_periods: 500_u64, - blocks_per_period: 100_u64, - owner: GC, - incentivized_asset: BSX, - max_reward_per_period: 60_000_000 * ONE, - accumulated_rpz: FixedU128::from_float(3.5_f64), - live_yield_farms_count: 2, - total_yield_farms_count: 2, - total_shares_z: 703_990 * ONE, - pending_rewards: 0, - accumulated_paid_rewards: 1_283_550 * ONE, - state: FarmState::Active, - min_deposit: 1_000, - price_adjustment: One::one(), - } - ); - - let bsx_tkn1_yield_farm_left_to_distribute = 116_550 * ONE; - let bsx_tkn2_yield_farm_left_to_distribute = 1_167_000 * ONE; - - let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[0].id); - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, yield_farm_id)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_float(17.5_f64), - accumulated_rpz: FixedU128::from_float(3.5_f64), - total_shares: 616 * ONE, - total_valued_shares: 45_540 * ONE, - entries_count: 3, - left_to_distribute: bsx_tkn1_yield_farm_left_to_distribute, - ..PREDEFINED_YIELD_FARMS_INS1.with(|v| v[0].clone()) - }, - ); - - let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[1].id); - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, yield_farm_id)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from(35), - accumulated_rpz: FixedU128::from_float(3.5_f64), - total_shares: 960 * ONE, - total_valued_shares: 47_629 * ONE, - entries_count: 4, - left_to_distribute: bsx_tkn2_yield_farm_left_to_distribute, - ..PREDEFINED_YIELD_FARMS_INS1.with(|v| v[1].clone()) - }, - ); - - //Reward currency balance check. - //total_rewards - (global_farm_paid_accumulated_rewards + global_farm_accumualted_rewards) - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - (30_000_000_000 * ONE - (1_033_900 * ONE + 249_650 * ONE)) - ); - - //Pot account balance check - assert_eq!( - Tokens::free_balance(BSX, &pot_account), - bsx_tkn1_yield_farm_left_to_distribute + bsx_tkn2_yield_farm_left_to_distribute - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - - ext -} diff --git a/pallets/liquidity-mining/src/tests/tests.rs b/pallets/liquidity-mining/src/tests/tests.rs deleted file mode 100644 index c99457173b1..00000000000 --- a/pallets/liquidity-mining/src/tests/tests.rs +++ /dev/null @@ -1,2132 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; -use test_utils::assert_transact_ok; - -#[test] -fn validate_create_farm_data_should_work() { - assert_ok!(LiquidityMining::validate_create_global_farm_data( - 1_000_000, - 100, - 1, - Perquintill::from_percent(50), - 5_000, - One::one(), - )); - - assert_ok!(LiquidityMining::validate_create_global_farm_data( - 9_999_000_000_000, - 2_000_000, - 500, - Perquintill::from_percent(100), - crate::MIN_DEPOSIT, - One::one(), - )); - - assert_ok!(LiquidityMining::validate_create_global_farm_data( - 10_000_000, - 101, - 16_986_741, - Perquintill::from_perthousand(1), - 1_000_000_000_000_000, - One::one(), - )); -} - -#[test] -fn validate_create_farm_data_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - LiquidityMining::validate_create_global_farm_data( - 999_999, - 100, - 1, - Perquintill::from_percent(50), - 10_000, - One::one() - ), - Error::::InvalidTotalRewards - ); - - assert_noop!( - LiquidityMining::validate_create_global_farm_data( - 9, - 100, - 1, - Perquintill::from_percent(50), - 1_500, - One::one() - ), - Error::::InvalidTotalRewards - ); - - assert_noop!( - LiquidityMining::validate_create_global_farm_data( - 0, - 100, - 1, - Perquintill::from_percent(50), - 1_000, - One::one() - ), - Error::::InvalidTotalRewards - ); - - assert_noop!( - LiquidityMining::validate_create_global_farm_data( - 1_000_000, - 99, - 1, - Perquintill::from_percent(50), - 2_000, - One::one() - ), - Error::::InvalidPlannedYieldingPeriods - ); - - assert_noop!( - LiquidityMining::validate_create_global_farm_data( - 1_000_000, - 0, - 1, - Perquintill::from_percent(50), - 3_000, - One::one() - ), - Error::::InvalidPlannedYieldingPeriods - ); - - assert_noop!( - LiquidityMining::validate_create_global_farm_data( - 1_000_000, - 87, - 1, - Perquintill::from_percent(50), - 4_000, - One::one() - ), - Error::::InvalidPlannedYieldingPeriods - ); - - assert_noop!( - LiquidityMining::validate_create_global_farm_data( - 1_000_000, - 100, - 0, - Perquintill::from_percent(50), - 4_000, - One::one() - ), - Error::::InvalidBlocksPerPeriod - ); - - assert_noop!( - LiquidityMining::validate_create_global_farm_data( - 1_000_000, - 100, - 10, - Perquintill::from_percent(0), - 10_000, - One::one() - ), - Error::::InvalidYieldPerPeriod - ); - - assert_noop!( - LiquidityMining::validate_create_global_farm_data( - 10_000_000, - 101, - 16_986_741, - Perquintill::from_perthousand(1), - crate::MIN_DEPOSIT - 1, - One::one() - ), - Error::::InvalidMinDeposit - ); - - assert_noop!( - LiquidityMining::validate_create_global_farm_data( - 10_000_000, - 101, - 16_986_741, - Perquintill::from_perthousand(1), - 10_000, - Zero::zero() - ), - Error::::InvalidPriceAdjustment - ); - }); -} -#[test] -fn get_period_number_should_work() { - let block_num: BlockNumber = 1_u64; - let blocks_per_period = 1; - assert_eq!( - LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), - 1 - ); - - let block_num: BlockNumber = 1_000_u64; - let blocks_per_period = 1; - assert_eq!( - LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), - 1_000 - ); - - let block_num: BlockNumber = 23_u64; - let blocks_per_period = 15; - assert_eq!( - LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), - 1 - ); - - let block_num: BlockNumber = 843_712_398_u64; - let blocks_per_period = 13_412_341; - assert_eq!( - LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), - 62 - ); - - let block_num: BlockNumber = 843_u64; - let blocks_per_period = 2_000; - assert_eq!( - LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), - 0 - ); - - let block_num: BlockNumber = 10_u64; - let blocks_per_period = 10; - assert_eq!( - LiquidityMining::get_period_number(block_num, blocks_per_period).unwrap(), - 1 - ); -} - -#[test] -#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] -fn get_period_number_should_not_work_when_block_per_period_is_zero() { - new_test_ext().execute_with(|| { - let block_num: BlockNumber = 10_u64; - assert_noop!( - LiquidityMining::get_period_number(block_num, 0), - Error::InconsistentState(InconsistentStateError::InvalidPeriod) - ); - }); -} - -#[test] -fn get_loyalty_multiplier_should_work() { - let loyalty_curve_1 = LoyaltyCurve::default(); - let loyalty_curve_2 = LoyaltyCurve { - initial_reward_percentage: FixedU128::from(1), - scale_coef: 50, - }; - let loyalty_curve_3 = LoyaltyCurve { - initial_reward_percentage: FixedU128::from_inner(123_580_000_000_000_000), // 0.12358 - scale_coef: 23, - }; - let loyalty_curve_4 = LoyaltyCurve { - initial_reward_percentage: FixedU128::from_inner(0), // 0.12358 - scale_coef: 15, - }; - - let testing_values = vec![ - ( - 0, - FixedU128::from_float(0.5_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.12358_f64), - FixedU128::from_float(0_f64), - ), - ( - 1, - FixedU128::from_float(0.504950495_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.1600975_f64), - FixedU128::from_float(0.0625_f64), - ), - ( - 4, - FixedU128::from_float(0.5192307692_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.25342_f64), - FixedU128::from_float(0.2105263158_f64), - ), - ( - 130, - FixedU128::from_float(0.7826086957_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.8682505882_f64), - FixedU128::from_float(0.8965517241_f64), - ), - ( - 150, - FixedU128::from_float(0.8_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.8834817341_f64), - FixedU128::from_float(0.9090909091_f64), - ), - ( - 180, - FixedU128::from_float(0.8214285714_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.9007011823_f64), - FixedU128::from_float(0.9230769231_f64), - ), - ( - 240, - FixedU128::from_float(0.8529411765_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.9233549049_f64), - FixedU128::from_float(0.9411764706_f64), - ), - ( - 270, - FixedU128::from_float(0.8648648649_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.9312025256_f64), - FixedU128::from_float(0.9473684211_f64), - ), - ( - 280, - FixedU128::from_float(0.8684210526_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.9334730693_f64), - FixedU128::from_float(0.9491525424_f64), - ), - ( - 320, - FixedU128::from_float(0.880952381_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.941231312_f64), - FixedU128::from_float(0.9552238806_f64), - ), - ( - 380, - FixedU128::from_float(0.8958333333_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.9499809926_f64), - FixedU128::from_float(0.9620253165_f64), - ), - ( - 390, - FixedU128::from_float(0.8979591837_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.9511921065_f64), - FixedU128::from_float(0.962962963_f64), - ), - ( - 4000, - FixedU128::from_float(0.987804878_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.994989396_f64), - FixedU128::from_float(0.99626401_f64), - ), - ( - 4400, - FixedU128::from_float(0.9888888889_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.9954425367_f64), - FixedU128::from_float(0.9966024915_f64), - ), - ( - 4700, - FixedU128::from_float(0.9895833333_f64), - FixedU128::from_float(1_f64), - FixedU128::from_float(0.995732022_f64), - FixedU128::from_float(0.9968186638_f64), - ), - ]; - - //Special case: loyalty curve is None - assert_eq!( - LiquidityMining::get_loyalty_multiplier(10, None).unwrap(), - FixedU128::one() - ); - - let precission_delta = FixedU128::from_inner(100_000_000); //0.000_000_000_1 - for (periods, expected_multiplier_1, expected_multiplier_2, expected_multiplier_3, expected_multiplier_4) in - testing_values.iter() - { - //1-th curve test - assert!(is_approx_eq_fixedu128( - LiquidityMining::get_loyalty_multiplier(*periods, Some(loyalty_curve_1.clone())).unwrap(), - *expected_multiplier_1, - precission_delta - )); - - //2-nd curve test - assert!(is_approx_eq_fixedu128( - LiquidityMining::get_loyalty_multiplier(*periods, Some(loyalty_curve_2.clone())).unwrap(), - *expected_multiplier_2, - precission_delta - )); - - //3-rd curve test - assert!(is_approx_eq_fixedu128( - LiquidityMining::get_loyalty_multiplier(*periods, Some(loyalty_curve_3.clone())).unwrap(), - *expected_multiplier_3, - precission_delta - )); - - //-4th curve test - assert!(is_approx_eq_fixedu128( - LiquidityMining::get_loyalty_multiplier(*periods, Some(loyalty_curve_4.clone())).unwrap(), - *expected_multiplier_4, - precission_delta - )); - } -} - -#[test] -fn sync_global_farm_should_work() { - let testing_values = vec![ - ( - 26_u64, - 2501944769_u128, - FixedU128::from_float(259.000000_f64), - HDX, - ACA_FARM, - 0_u128, - 206_u64, - 55563662_u128, - FixedU128::from_float(259.000000000_f64), - 55563662_u128, - ), - ( - 188_u64, - 33769604_u128, - FixedU128::from_float(1148.000000_f64), - BSX, - ACA_FARM, - 30080406306_u128, - 259_u64, - 56710169_u128, - FixedU128::from_inner(1_183_500_000_000_000_000_000_u128), - 1255531111_u128, - ), - ( - 195_u64, - 26098384286056_u128, - FixedU128::from_float(523.000000_f64), - ACA, - ACA_FARM, - 32055_u128, - 326_u64, - 61424428_u128, - FixedU128::from_inner(523_000_000_001_189_920_405), - 61455483_u128, - ), - ( - 181_u64, - 9894090144_u128, - FixedU128::from_float(317.000000_f64), - KSM, - ACA_FARM, - 36806694280_u128, - 1856_u64, - 52711084_u128, - FixedU128::from_inner(320_720_068_520_127_685_628_u128), - 36859404364_u128, - ), - ( - 196_u64, - 26886423482043_u128, - FixedU128::from_float(596.000000_f64), - ACA, - BSX_FARM, - 30560755872_u128, - 954_u64, - 34013971_u128, - FixedU128::from_inner(596_001_136_661_218_343_563_u128), - 30594768843_u128, - ), - ( - 68_u64, - 1138057342_u128, - FixedU128::from_float(4.000000_f64), - ACA, - ACA_FARM, - 38398062768_u128, - 161_u64, - 71071995_u128, - FixedU128::from_inner(37_740_006_193_817_956_143_u128), - 38469133763_u128, - ), - ( - 161_u64, - 24495534649923_u128, - FixedU128::from_float(213.000000_f64), - KSM, - BSX_FARM, - 11116735745_u128, - 448_u64, - 85963452_u128, - FixedU128::from_inner(213_000_453_826_989_444_173_u128), - 11202698197_u128, - ), - ( - 27_u64, - 22108444_u128, - FixedU128::from_float(970.000000_f64), - KSM, - BSX_FARM, - 8572779460_u128, - 132_u64, - 43974403_u128, - FixedU128::from_float(1022.500000000_f64), - 1204667713_u128, - ), - ( - 97_u64, - 1593208_u128, - FixedU128::from_float(6.000000_f64), - HDX, - BSX_FARM, - 18440792496_u128, - 146_u64, - 14437690_u128, - FixedU128::from_float(30.500000000_f64), - 53471286_u128, - ), - ( - 154_u64, - 27279119649838_u128, - FixedU128::from_float(713.000000_f64), - BSX, - KSM_FARM, - 28318566664_u128, - 202_u64, - 7533987_u128, - FixedU128::from_inner(713_001_038_104_089_409_944_u128), - 28326099651_u128, - ), - ( - 104_u64, - 20462312838954_u128, - FixedU128::from_float(833.000000_f64), - BSX, - BSX_FARM, - 3852003_u128, - 131_u64, - 75149021_u128, - FixedU128::from_inner(833_000_000_188_199_791_016_u128), - 79000024_u128, - ), - ( - 90_u64, - 37650830596054_u128, - FixedU128::from_float(586.000000_f64), - HDX, - KSM_FARM, - 27990338179_u128, - 110_u64, - 36765518_u128, - FixedU128::from_inner(586_000_743_418_849_886_767_u128), - 28027102697_u128, - ), - ( - 198_u64, - 318777214_u128, - FixedU128::from_float(251.000000_f64), - ACA, - ACA_FARM, - 3615346492_u128, - 582_u64, - 12876432_u128, - FixedU128::from_inner(262_341_292_078_674_104_981_u128), - 3628221924_u128, - ), - ( - 29_u64, - 33478250_u128, - FixedU128::from_float(77.000000_f64), - BSX, - ACA_FARM, - 39174031245_u128, - 100_u64, - 26611087_u128, - FixedU128::from_float(112.500000000_f64), - 1215088962_u128, - ), - ( - 91_u64, - 393922835172_u128, - FixedU128::from_float(2491.000000_f64), - ACA, - KSM_FARM, - 63486975129400_u128, - 260_u64, - 85100506_u128, - FixedU128::from_inner(2_575_500_000_000_000_262_144_u128), - 33286564672540_u128, - ), - ( - 67_u64, - 1126422_u128, - FixedU128::from_float(295.000000_f64), - HDX, - BSX_FARM, - 7492177402_u128, - 229_u64, - 35844776_u128, - FixedU128::from_float(376.000000000_f64), - 127084958_u128, - ), - ( - 168_u64, - 28351324279041_u128, - FixedU128::from_float(450.000000_f64), - ACA, - KSM_FARM, - 38796364068_u128, - 361_u64, - 35695723_u128, - FixedU128::from_inner(450_001_368_414_494_016_443_u128), - 38832058791_u128, - ), - ( - 3_u64, - 17631376575792_u128, - FixedU128::from_float(82.000000_f64), - HDX, - KSM_FARM, - 20473946880_u128, - 52_u64, - 93293564_u128, - FixedU128::from_inner(82_001_161_222_199_071_561_u128), - 20567239444_u128, - ), - ( - 49_u64, - 94060_u128, - FixedU128::from_float(81.000000_f64), - HDX, - ACA_FARM, - 11126653978_u128, - 132_u64, - 75841904_u128, - FixedU128::from_float(122.500000000_f64), - 79745394_u128, - ), - ( - 38_u64, - 14086_u128, - FixedU128::from_float(266.000000_f64), - KSM, - BSX_FARM, - 36115448964_u128, - 400000_u64, - 52402278_u128, - FixedU128::from_inner(200_247_000_000_000_000_000_000_u128), - 2869334644_u128, - ), - ( - 158_u64, - 762784_u128, - FixedU128::from_float(129.000000_f64), - BSX, - ACA_FARM, - 21814882774_u128, - 158_u64, - 86085676_u128, - FixedU128::from_float(129.000000000_f64), - 86085676_u128, - ), - ]; - - for ( - updated_at, - total_shares_z, - accumulated_rpz, - reward_currency, - id, - rewards_left_to_distribute, - current_period, - accumulated_rewards, - expected_accumulated_rpz, - expected_pending_rewards, - ) in testing_values.iter() - { - let yield_per_period = Perquintill::from_percent(50); - let planned_yielding_periods = 100; - let blocks_per_period = 0; - let owner = ALICE; - let incentivized_asset = BSX; - let max_reward_per_period = 10_000 * ONE; - - let global_farm_0 = GlobalFarmData { - id: *id, - owner, - updated_at: *updated_at, - total_shares_z: *total_shares_z, - accumulated_rpz: *accumulated_rpz, - reward_currency: *reward_currency, - pending_rewards: *accumulated_rewards, - accumulated_paid_rewards: 10, - yield_per_period, - planned_yielding_periods, - blocks_per_period, - max_reward_per_period, - incentivized_asset, - min_deposit: crate::MIN_DEPOSIT, - live_yield_farms_count: Default::default(), - total_yield_farms_count: Default::default(), - price_adjustment: FixedU128::one(), - state: FarmState::Active, - }; - - let mut global_farm = global_farm_0.clone(); - - new_test_ext().execute_with(|| { - //Add farm's account to whitelist - let farm_account_id = LiquidityMining::farm_account_id(*id).unwrap(); - Whitelist::add_account(&farm_account_id).unwrap(); - - Tokens::transfer( - Origin::signed(TREASURY), - farm_account_id, - *reward_currency, - *rewards_left_to_distribute, - ) - .unwrap(); - - assert_eq!( - Tokens::free_balance(*reward_currency, &farm_account_id), - *rewards_left_to_distribute - ); - - let r = with_transaction(|| { - TransactionOutcome::Commit(LiquidityMining::sync_global_farm(&mut global_farm, *current_period)) - }) - .unwrap(); - - if r.is_zero() && updated_at != current_period { - frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( - Event::AllRewardsDistributed { global_farm_id: *id }, - )); - } - - let expected_global_farm = GlobalFarmData { - accumulated_rpz: *expected_accumulated_rpz, - pending_rewards: *expected_pending_rewards, - updated_at: *current_period, - ..global_farm_0.clone() - }; - - assert_eq!(global_farm, expected_global_farm); - - if updated_at != current_period { - frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( - Event::GlobalFarmAccRPZUpdated { - global_farm_id: *id, - accumulated_rpz: *expected_accumulated_rpz, - total_shares_z: *total_shares_z, - }, - )); - } - }); - } -} - -#[test] -fn sync_global_farm_should_not_update_farm_when_farm_is_not_active() { - { - let global_farm_0 = GlobalFarmData { - id: 1, - owner: ALICE, - updated_at: 100, - total_shares_z: 1_000_000 * ONE, - accumulated_rpz: FixedU128::from(5), - reward_currency: BSX, - pending_rewards: 1_000 * ONE, - accumulated_paid_rewards: 10, - yield_per_period: Perquintill::from_float(0.5_f64), - planned_yielding_periods: 1_000, - blocks_per_period: 1, - max_reward_per_period: 10_000 * ONE, - incentivized_asset: BSX, - min_deposit: crate::MIN_DEPOSIT, - live_yield_farms_count: Default::default(), - total_yield_farms_count: Default::default(), - price_adjustment: FixedU128::one(), - state: FarmState::Terminated, - }; - - let mut global_farm = global_farm_0.clone(); - - new_test_ext().execute_with(|| { - let current_period = global_farm_0.updated_at + 100; - let r = with_transaction(|| { - TransactionOutcome::Commit(LiquidityMining::sync_global_farm(&mut global_farm, current_period)) - }) - .unwrap(); - - assert_eq!(r, 0); - assert_eq!(global_farm, global_farm_0); - }); - } -} - -#[test] -fn sync_global_farm_should_only_update_updated_at_field_when_farm_has_no_shares() { - { - let global_farm_1 = GlobalFarmData { - id: 1, - owner: ALICE, - updated_at: 200, - total_shares_z: Balance::zero(), - accumulated_rpz: FixedU128::from(5), - reward_currency: BSX, - pending_rewards: 1_000 * ONE, - accumulated_paid_rewards: 10, - yield_per_period: Perquintill::from_float(0.5_f64), - planned_yielding_periods: 1_000, - blocks_per_period: 1, - max_reward_per_period: 10_000 * ONE, - incentivized_asset: BSX, - min_deposit: crate::MIN_DEPOSIT, - live_yield_farms_count: Default::default(), - total_yield_farms_count: Default::default(), - price_adjustment: FixedU128::one(), - state: FarmState::Active, - }; - - let mut global_farm = global_farm_1.clone(); - - new_test_ext().execute_with(|| { - let current_period = 200; - let r = with_transaction(|| { - TransactionOutcome::Commit(LiquidityMining::sync_global_farm(&mut global_farm, current_period)) - }) - .unwrap(); - - assert_eq!(r, 0); - assert_eq!(global_farm, global_farm_1); - }); - } -} - -#[test] -fn sync_global_farm_should_not_update_farm_when_farm_was_already_updated_in_this_period() { - { - let global_farm_0 = GlobalFarmData { - id: 1, - owner: ALICE, - updated_at: 100, - total_shares_z: 1_000_000 * ONE, - accumulated_rpz: FixedU128::from(5), - reward_currency: BSX, - pending_rewards: 1_000 * ONE, - accumulated_paid_rewards: 10, - yield_per_period: Perquintill::from_float(0.5_f64), - planned_yielding_periods: 1_000, - blocks_per_period: 1, - max_reward_per_period: 10_000 * ONE, - incentivized_asset: BSX, - min_deposit: crate::MIN_DEPOSIT, - live_yield_farms_count: Default::default(), - total_yield_farms_count: Default::default(), - price_adjustment: FixedU128::one(), - state: FarmState::Active, - }; - - let mut global_farm = global_farm_0.clone(); - - new_test_ext().execute_with(|| { - let current_period = global_farm_0.updated_at; - let r = with_transaction(|| { - TransactionOutcome::Commit(LiquidityMining::sync_global_farm(&mut global_farm, current_period)) - }) - .unwrap(); - - assert_eq!(r, 0); - assert_eq!(global_farm, global_farm_0); - }); - } -} - -#[test] -fn sync_yield_farm_should_work() { - let testing_values = vec![ - ( - BSX_FARM, - BSX_DOT_YIELD_FARM_ID, - 26_u64, - 206_u64, - 299_u128, - 0_u128, - 387_u128, - BSX, - 299_u128, - 206_u64, - 0_u128, - ), - ( - BSX_FARM, - BSX_ACA_YIELD_FARM_ID, - 188_u64, - 259_u64, - 1151_u128, - 33769603_u128, - 1225_u128, - BSX, - 1299_u128, - 259_u64, - 4997901244_u128, - ), - ( - BSX_FARM, - BSX_KSM_YIELD_FARM_ID, - 195_u64, - 326_u64, - 823_u128, - 2604286056_u128, - 971_u128, - BSX, - 1119_u128, - 326_u64, - 770868672576_u128, - ), - ( - BSX_FARM, - BSX_KSM_YIELD_FARM_ID, - 181_u64, - 1856_u64, - 320_u128, - 8940144_u128, - 398_u128, - BSX, - 476_u128, - 1856_u64, - 1394662464_u128, - ), - ( - BSX_FARM, - BSX_ACA_YIELD_FARM_ID, - 196_u64, - 954_u64, - 5684_u128, - 282043_u128, - 5758_u128, - BSX, - 5832_u128, - 954_u64, - 41742364_u128, - ), - ( - BSX_FARM, - BSX_DOT_YIELD_FARM_ID, - 68_u64, - 161_u64, - 37_u128, - 1138057342_u128, - 126_u128, - BSX, - 215_u128, - 161_u64, - 202574206876_u128, - ), - ( - BSX_FARM, - BSX_ACA_YIELD_FARM_ID, - 161_u64, - 448_u64, - 678_u128, - 49923_u128, - 845_u128, - BSX, - 1012_u128, - 448_u64, - 16674282_u128, - ), - ( - BSX_FARM, - BSX_DOT_YIELD_FARM_ID, - 27_u64, - 132_u64, - 978_u128, - 2444_u128, - 1135_u128, - BSX, - 1292_u128, - 132_u64, - 767416_u128, - ), - ( - BSX_FARM, - BSX_KSM_YIELD_FARM_ID, - 97_u64, - 146_u64, - 28_u128, - 1593208_u128, - 205_u128, - BSX, - 382_u128, - 146_u64, - 563995632_u128, - ), - ( - BSX_FARM, - BSX_ACA_YIELD_FARM_ID, - 154_u64, - 202_u64, - 876_u128, - 9838_u128, - 888_u128, - BSX, - 900_u128, - 202_u64, - 236112_u128, - ), - ( - BSX_FARM, - BSX_DOT_YIELD_FARM_ID, - 104_u64, - 131_u64, - 8373_u128, - 2046838954_u128, - 8412_u128, - BSX, - 8451_u128, - 131_u64, - 159653438412_u128, - ), - ( - BSX_FARM, - BSX_KSM_YIELD_FARM_ID, - 90_u64, - 110_u64, - 5886_u128, - 596054_u128, - 6010_u128, - BSX, - 6134_u128, - 110_u64, - 147821392_u128, - ), - ( - BSX_FARM, - BSX_DOT_YIELD_FARM_ID, - 198_u64, - 582_u64, - 2591_u128, - 377215_u128, - 2781_u128, - BSX, - 2971_u128, - 582_u64, - 143341700_u128, - ), - ( - BSX_FARM, - BSX_KSM_YIELD_FARM_ID, - 29_u64, - 100_u64, - 80_u128, - 8250_u128, - 257_u128, - BSX, - 434_u128, - 100_u64, - 2920500_u128, - ), - ( - BSX_FARM, - BSX_ACA_YIELD_FARM_ID, - 91_u64, - 260_u64, - 2537_u128, - 35172_u128, - 2556_u128, - BSX, - 2575_u128, - 260_u64, - 1336536_u128, - ), - ( - BSX_FARM, - BSX_ACA_YIELD_FARM_ID, - 67_u64, - 229_u64, - 471_u128, - 1126422_u128, - 579_u128, - BSX, - 687_u128, - 229_u64, - 243307152_u128, - ), - ( - BSX_FARM, - BSX_DOT_YIELD_FARM_ID, - 168_u64, - 361_u64, - 952_u128, - 28279041_u128, - 971_u128, - BSX, - 990_u128, - 361_u64, - 1074603558_u128, - ), - ( - BSX_FARM, - BSX_ACA_YIELD_FARM_ID, - 3_u64, - 52_u64, - 357_u128, - 2_u128, - 518_u128, - BSX, - 679_u128, - 52_u64, - 644_u128, - ), - ( - BSX_FARM, - BSX_KSM_YIELD_FARM_ID, - 49_u64, - 132_u64, - 1557_u128, - 94059_u128, - 1651_u128, - BSX, - 1745_u128, - 132_u64, - 17683092_u128, - ), - ( - BSX_FARM, - BSX_ACA_YIELD_FARM_ID, - 38_u64, - 38_u64, - 2564373_u128, - 14085_u128, - 2564404_u128, - BSX, - 2564373_u128, - 38_u64, - 0_u128, - ), - ( - BSX_FARM, - BSX_ACA_YIELD_FARM_ID, - 158_u64, - 158_u64, - 129_u128, - 762784_u128, - 286_u128, - BSX, - 129_u128, - 158_u64, - 0_u128, - ), - ]; - - for ( - global_farm_id, - yield_farm_id, - yield_farm_updated_at, - current_period, - yield_farm_accumulated_rpvs, - yield_farm_total_valued_shares, - global_farm_accumulated_rpz, - reward_currency, - expected_yield_farm_accumulated_rpvs, - expected_updated_at, - expected_yield_farm_reward_currency_balance, - ) in testing_values - { - let owner = ALICE; - let yield_per_period = Perquintill::from_percent(50); - let blocks_per_period = BlockNumber::from(1_u32); - let planned_yielding_periods = 100; - let incentivized_asset = BSX; - let updated_at = 200_u64; - let max_reward_per_period = Balance::from(10_000_u32); - - let global_farm_0 = GlobalFarmData { - id: global_farm_id, - owner, - updated_at, - total_shares_z: 1_000_000_u128, - accumulated_rpz: FixedU128::from(global_farm_accumulated_rpz), - reward_currency, - pending_rewards: 1_000_000 * ONE, - accumulated_paid_rewards: 1_000_000 * ONE, - yield_per_period, - planned_yielding_periods, - blocks_per_period, - max_reward_per_period, - incentivized_asset, - min_deposit: crate::MIN_DEPOSIT, - live_yield_farms_count: Default::default(), - total_yield_farms_count: Default::default(), - price_adjustment: FixedU128::one(), - state: FarmState::Active, - }; - - let yield_farm_0 = YieldFarmData { - id: yield_farm_id, - updated_at: yield_farm_updated_at, - total_shares: 200_u128, - total_valued_shares: yield_farm_total_valued_shares, - accumulated_rpvs: FixedU128::from(yield_farm_accumulated_rpvs), - accumulated_rpz: FixedU128::from(yield_farm_accumulated_rpvs), - loyalty_curve: None, - multiplier: FixedU128::from(2_u128), - state: FarmState::Active, - entries_count: 0, - left_to_distribute: 0, - total_stopped: 0, - _phantom: PhantomData, - }; - - let mut global_farm = global_farm_0.clone(); - let mut yield_farm = yield_farm_0.clone(); - - let global_farm_account_id = LiquidityMining::farm_account_id(global_farm_id).unwrap(); - let pot_account_id = LiquidityMining::pot_account_id().unwrap(); - - new_test_ext().execute_with(|| { - //Arrange - let _ = Tokens::transfer( - Origin::signed(TREASURY), - global_farm_account_id, - global_farm.reward_currency, - 9_000_000_000_000, - ); - assert_eq!( - Tokens::free_balance(global_farm.reward_currency, &global_farm_account_id), - 9_000_000_000_000_u128 - ); - - //_0 - value before action - let pot_balance_0 = 9_000_000_000_000; - let _ = Tokens::transfer( - Origin::signed(TREASURY), - pot_account_id, - global_farm.reward_currency, - pot_balance_0, - ); - - //Act - assert_transact_ok!(LiquidityMining::sync_yield_farm( - &mut yield_farm, - &mut global_farm, - current_period, - )); - - //Assert - // - //NOTE: update in the same period should happen only if farm is empty. RPVS is used as starting value - //for yield-farm's rpz in this test. - let rpz = if current_period == yield_farm_updated_at { - yield_farm_accumulated_rpvs - } else { - global_farm_accumulated_rpz - }; - assert_eq!( - global_farm, - GlobalFarmData { - updated_at: 200_u64, - pending_rewards: global_farm_0.pending_rewards - expected_yield_farm_reward_currency_balance, - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - + expected_yield_farm_reward_currency_balance, - ..global_farm_0.clone() - } - ); - - assert_eq!( - yield_farm, - YieldFarmData { - updated_at: expected_updated_at, - accumulated_rpvs: FixedU128::from(expected_yield_farm_accumulated_rpvs), - accumulated_rpz: rpz.into(), - left_to_distribute: expected_yield_farm_reward_currency_balance, - ..yield_farm_0.clone() - } - ); - - //yield-farm's rewards are left in the pot so its balance should not change - assert_eq!( - Tokens::free_balance(global_farm.reward_currency, &pot_account_id), - pot_balance_0 - ); - - if current_period != yield_farm_updated_at && !yield_farm_total_valued_shares.is_zero() { - frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( - Event::YieldFarmAccRPVSUpdated { - global_farm_id: global_farm_0.id, - yield_farm_id: yield_farm_0.id, - accumulated_rpvs: FixedU128::from(expected_yield_farm_accumulated_rpvs), - total_valued_shares: yield_farm_0.total_valued_shares, - }, - )); - } - }); - } -} - -#[test] -fn sync_yield_farm_should_not_update_when_yield_farm_is_not_active() { - let global_farm_0 = GlobalFarmData { - id: 1, - owner: ALICE, - updated_at: 1000, - total_shares_z: 1_000_000_u128, - accumulated_rpz: FixedU128::from(10), - reward_currency: BSX, - pending_rewards: 1_000_000 * ONE, - accumulated_paid_rewards: 1_000_000 * ONE, - yield_per_period: Perquintill::from_float(0.5_f64), - planned_yielding_periods: 1_000, - blocks_per_period: 1, - max_reward_per_period: 10_000 * ONE, - incentivized_asset: BSX, - min_deposit: crate::MIN_DEPOSIT, - live_yield_farms_count: Default::default(), - total_yield_farms_count: Default::default(), - price_adjustment: FixedU128::one(), - state: FarmState::Active, - }; - - let yield_farm_0 = YieldFarmData { - id: 2, - updated_at: 50, - total_shares: 200_u128, - total_valued_shares: 10_000 * ONE, - accumulated_rpvs: FixedU128::from(3), - accumulated_rpz: FixedU128::from(4), - loyalty_curve: None, - multiplier: FixedU128::from(2_u128), - state: FarmState::Active, - entries_count: 0, - left_to_distribute: 0, - total_stopped: 0, - _phantom: PhantomData, - }; - - let mut global_farm = global_farm_0.clone(); - let mut stopped_yield_farm = yield_farm_0.clone(); - stopped_yield_farm.state = FarmState::Stopped; - let mut terminated_yield_farm = yield_farm_0.clone(); - terminated_yield_farm.state = FarmState::Terminated; - - new_test_ext().execute_with(|| { - let current_period = yield_farm_0.updated_at + global_farm_0.updated_at; - //Stopped yield-farm - assert_transact_ok!(LiquidityMining::sync_yield_farm( - &mut stopped_yield_farm, - &mut global_farm, - current_period, - )); - - assert_eq!( - stopped_yield_farm, - YieldFarmData { - state: FarmState::Stopped, - ..yield_farm_0.clone() - } - ); - assert_eq!(global_farm, global_farm_0); - - //Terminated yield-farm - assert_transact_ok!(LiquidityMining::sync_yield_farm( - &mut terminated_yield_farm, - &mut global_farm, - current_period, - )); - - assert_eq!( - terminated_yield_farm, - YieldFarmData { - state: FarmState::Terminated, - ..yield_farm_0 - } - ); - assert_eq!(global_farm, global_farm_0); - }); -} - -#[test] - -fn sync_yield_farm_should_only_update_updated_at_field_when_farm_has_no_valued_shares() { - let global_farm_0 = GlobalFarmData { - id: 1, - owner: ALICE, - updated_at: 1000, - total_shares_z: 1_000_000_u128, - accumulated_rpz: FixedU128::from(10), - reward_currency: BSX, - pending_rewards: 1_000_000 * ONE, - accumulated_paid_rewards: 1_000_000 * ONE, - yield_per_period: Perquintill::from_float(0.5_f64), - planned_yielding_periods: 1_000, - blocks_per_period: 1, - max_reward_per_period: 10_000 * ONE, - incentivized_asset: BSX, - min_deposit: crate::MIN_DEPOSIT, - live_yield_farms_count: Default::default(), - total_yield_farms_count: Default::default(), - price_adjustment: FixedU128::one(), - state: FarmState::Active, - }; - - //after action - let yield_farm_1 = YieldFarmData { - id: 2, - updated_at: 1050, - total_shares: 0, - total_valued_shares: 0, - accumulated_rpvs: FixedU128::from(3), - accumulated_rpz: FixedU128::from(4), - loyalty_curve: None, - multiplier: FixedU128::from(2_u128), - state: FarmState::Active, - entries_count: 0, - left_to_distribute: 0, - total_stopped: 0, - _phantom: PhantomData, - }; - - let mut global_farm = global_farm_0.clone(); - let mut yield_farm = yield_farm_1.clone(); - - new_test_ext().execute_with(|| { - let current_period = 1050; - assert_transact_ok!(LiquidityMining::sync_yield_farm( - &mut yield_farm, - &mut global_farm, - current_period, - )); - - assert_eq!(yield_farm, yield_farm_1); - assert_eq!(global_farm, global_farm_0); - }); -} - -#[test] -fn sync_yield_farm_should_not_update_when_yield_farm_was_already_updated_in_this_period() { - let global_farm_0 = GlobalFarmData { - id: 1, - owner: ALICE, - updated_at: 1000, - total_shares_z: 1_000_000_u128, - accumulated_rpz: FixedU128::from(10), - reward_currency: BSX, - pending_rewards: 1_000_000 * ONE, - accumulated_paid_rewards: 1_000_000 * ONE, - yield_per_period: Perquintill::from_float(0.5_f64), - planned_yielding_periods: 1_000, - blocks_per_period: 1, - max_reward_per_period: 10_000 * ONE, - incentivized_asset: BSX, - min_deposit: crate::MIN_DEPOSIT, - live_yield_farms_count: Default::default(), - total_yield_farms_count: Default::default(), - price_adjustment: FixedU128::one(), - state: FarmState::Active, - }; - - let yield_farm_0 = YieldFarmData { - id: 2, - updated_at: global_farm_0.updated_at, - total_shares: 10_000 * ONE, - total_valued_shares: 15_000 * ONE, - accumulated_rpvs: FixedU128::from(3), - accumulated_rpz: FixedU128::from(4), - loyalty_curve: None, - multiplier: FixedU128::from(2_u128), - state: FarmState::Active, - entries_count: 0, - left_to_distribute: 0, - total_stopped: 0, - _phantom: PhantomData, - }; - - let mut global_farm = global_farm_0.clone(); - let mut yield_farm = yield_farm_0.clone(); - - new_test_ext().execute_with(|| { - let current_period = global_farm_0.updated_at; - assert_transact_ok!(LiquidityMining::sync_yield_farm( - &mut yield_farm, - &mut global_farm, - current_period, - )); - - assert_eq!(yield_farm, yield_farm_0); - assert_eq!(global_farm, global_farm_0); - }); -} - -#[test] -fn get_next_farm_id_should_work() { - new_test_ext().execute_with(|| { - assert_eq!(LiquidityMining::get_next_farm_id().unwrap(), 1); - assert_eq!(LiquidityMining::last_farm_id(), 1); - - assert_eq!(LiquidityMining::get_next_farm_id().unwrap(), 2); - assert_eq!(LiquidityMining::last_farm_id(), 2); - - assert_eq!(LiquidityMining::get_next_farm_id().unwrap(), 3); - assert_eq!(LiquidityMining::last_farm_id(), 3); - - assert_eq!(LiquidityMining::get_next_farm_id().unwrap(), 4); - assert_eq!(LiquidityMining::last_farm_id(), 4); - }); -} - -#[test] -fn farm_account_id_should_work() { - let ids: Vec = vec![1, 100, 543, u32::max_value()]; - - for id in ids { - assert_ok!(LiquidityMining::farm_account_id(id)); - } -} - -#[test] -#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] -fn farm_account_id_should_fail_when_farm_id_is_zero() { - let ids: Vec = vec![0]; - new_test_ext().execute_with(|| { - for id in ids { - assert_noop!( - LiquidityMining::farm_account_id(id), - Error::::InconsistentState(InconsistentStateError::InvalidFarmId) - ); - } - }); -} - -#[test] -fn get_next_deposit_id_should_work() { - new_test_ext().execute_with(|| { - let test_data = vec![1, 2, 3, 4, 5]; - - for expected_deposit_id in test_data { - assert_eq!(LiquidityMining::get_next_deposit_id().unwrap(), expected_deposit_id); - } - }); -} - -#[test] -fn depositdata_add_farm_entry_to_should_work() { - new_test_ext().execute_with(|| { - let mut deposit = DepositData:: { - shares: 10, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![].try_into().unwrap(), - }; - - let test_farm_entries = vec![ - YieldFarmEntry::::new(1, 50, 20, FixedU128::from(12), 2, 1), - YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 1), - YieldFarmEntry::::new(3, 60, 20, FixedU128::from(1), 1, 1), - YieldFarmEntry::::new(4, 1, 20, FixedU128::from(10), 13, 1), - YieldFarmEntry::::new(7, 2, 20, FixedU128::from(10), 13, 1), - YieldFarmEntry::::new(5, 100, 20, FixedU128::from(10), 13, 1), - YieldFarmEntry::::new(6, 4, 20, FixedU128::from(10), 13, 1), - ]; - - assert_ok!(deposit.add_yield_farm_entry(test_farm_entries[0].clone())); - - assert_ok!(deposit.add_yield_farm_entry(test_farm_entries[2].clone())); - - assert_ok!(deposit.add_yield_farm_entry(test_farm_entries[3].clone())); - - //`yield_farm_id` must be unique in `yield_farm_entries` - assert_noop!( - deposit.add_yield_farm_entry(test_farm_entries[2].clone()), - Error::::DoubleLock - ); - assert_noop!( - deposit.add_yield_farm_entry(YieldFarmEntry::::new( - 1, - 50, - 10, - FixedU128::from(1), - 1, - 0 - )), - Error::::DoubleLock - ); - - assert_ok!(deposit.add_yield_farm_entry(test_farm_entries[4].clone())); - - assert_ok!(deposit.add_yield_farm_entry(test_farm_entries[6].clone())); - - assert_eq!( - deposit, - DepositData:: { - shares: 10, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![ - test_farm_entries[0].clone(), - test_farm_entries[2].clone(), - test_farm_entries[3].clone(), - test_farm_entries[4].clone(), - test_farm_entries[6].clone(), - ] - .try_into() - .unwrap(), - } - ); - - //5 is max farm entries. - assert_noop!( - deposit.add_yield_farm_entry(test_farm_entries[5].clone()), - Error::::MaxEntriesPerDeposit - ); - }); -} - -#[test] -fn deposit_remove_yield_farm_entry_should_work() { - new_test_ext().execute_with(|| { - let mut deposit = DepositData:: { - shares: 10, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![ - YieldFarmEntry::::new(4, 1, 20, FixedU128::from(10), 13, 0), - YieldFarmEntry::::new(7, 2, 20, FixedU128::from(1), 13, 0), - YieldFarmEntry::::new(6, 4, 20, FixedU128::from(10), 13, 0), - YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 0), - YieldFarmEntry::::new(3, 60, 20, FixedU128::from(1), 1, 0), - ] - .try_into() - .unwrap(), - }; - - const NON_EXISTING_YIELD_FARM_ID: YieldFarmId = 999_999_999; - assert_noop!( - deposit.remove_yield_farm_entry(NON_EXISTING_YIELD_FARM_ID), - Error::::YieldFarmEntryNotFound - ); - - assert_ok!(deposit.remove_yield_farm_entry(2)); - assert_ok!(deposit.remove_yield_farm_entry(18)); - assert_ok!(deposit.remove_yield_farm_entry(1)); - assert_ok!(deposit.remove_yield_farm_entry(4)); - assert_ok!(deposit.remove_yield_farm_entry(60)); - - //This state should never happen, deposit should be flushed from storage when have no more - //entries. - assert_eq!( - deposit.yield_farm_entries, - TryInto::, ConstU32<5>>>::try_into(vec![]).unwrap() - ); - - assert_noop!( - deposit.remove_yield_farm_entry(60), - Error::::YieldFarmEntryNotFound - ); - }); -} - -#[test] -fn deposit_get_yield_farm_entry_should_work() { - let mut deposit = DepositData:: { - shares: 10, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![ - YieldFarmEntry::::new(4, 1, 20, FixedU128::from(10), 13, 0), - YieldFarmEntry::::new(7, 2, 20, FixedU128::from(1), 13, 0), - YieldFarmEntry::::new(6, 4, 20, FixedU128::from(10), 13, 0), - YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 0), - YieldFarmEntry::::new(3, 60, 20, FixedU128::from(1), 1, 0), - ] - .try_into() - .unwrap(), - }; - - assert_eq!( - deposit.get_yield_farm_entry(18).unwrap(), - &mut YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 0) - ); - - const NON_EXISTING_YIELD_FARM_ID: YieldFarmId = 98_908; - assert!(deposit.get_yield_farm_entry(NON_EXISTING_YIELD_FARM_ID).is_none()) -} - -#[test] -fn deposit_search_yield_farm_entry_should_work() { - let deposit = DepositData:: { - shares: 10, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![ - YieldFarmEntry::::new(4, 1, 20, FixedU128::from(10), 13, 0), - YieldFarmEntry::::new(7, 2, 20, FixedU128::from(1), 13, 0), - YieldFarmEntry::::new(6, 4, 20, FixedU128::from(10), 13, 0), - YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 0), - YieldFarmEntry::::new(3, 60, 20, FixedU128::from(1), 1, 0), - ] - .try_into() - .unwrap(), - }; - - assert!(deposit.search_yield_farm_entry(1).is_some()); - assert!(deposit.search_yield_farm_entry(60).is_some()); - assert!(deposit.search_yield_farm_entry(4).is_some()); - - const NON_EXISTING_YIELD_FARM_ID: YieldFarmId = 98_908; - - assert!(deposit.search_yield_farm_entry(NON_EXISTING_YIELD_FARM_ID).is_none()); -} - -#[test] -fn deposit_can_be_flushed_should_work() { - //non empty deposit can't be flushed - let deposit = DepositData:: { - shares: 10, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![ - YieldFarmEntry::::new(4, 1, 20, FixedU128::from(10), 13, 0), - YieldFarmEntry::::new(7, 2, 20, FixedU128::from(1), 13, 0), - YieldFarmEntry::::new(6, 4, 20, FixedU128::from(10), 13, 0), - YieldFarmEntry::::new(2, 18, 20, FixedU128::from(14), 18, 0), - YieldFarmEntry::::new(3, 60, 20, FixedU128::from(1), 1, 0), - ] - .try_into() - .unwrap(), - }; - - assert!(!deposit.can_be_removed()); - - let deposit = DepositData:: { - shares: 10, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![YieldFarmEntry::::new( - 4, - 1, - 20, - FixedU128::from(10), - 13, - 0, - )] - .try_into() - .unwrap(), - }; - - assert!(!deposit.can_be_removed()); - - //deposit with no entries can be flushed - let deposit = DepositData:: { - shares: 10, - amm_pool_id: BSX_TKN1_AMM, - yield_farm_entries: vec![].try_into().unwrap(), - }; - - assert!(deposit.can_be_removed()); -} - -#[test] -#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] -fn yield_farm_data_should_work() { - new_test_ext().execute_with(|| { - let mut yield_farm = - YieldFarmData::::new(1, 10, Some(LoyaltyCurve::default()), FixedU128::from(10_000)); - - //new farm should be created active - assert!(yield_farm.state.is_active()); - assert!(!yield_farm.state.is_stopped()); - assert!(!yield_farm.state.is_terminated()); - - yield_farm.state = FarmState::Stopped; - assert!(!yield_farm.state.is_active()); - assert!(yield_farm.state.is_stopped()); - assert!(!yield_farm.state.is_terminated()); - - yield_farm.state = FarmState::Terminated; - assert!(!yield_farm.state.is_active()); - assert!(!yield_farm.state.is_stopped()); - assert!(yield_farm.state.is_terminated()); - - assert_ok!(yield_farm.increase_entries_count()); - assert_eq!(yield_farm.entries_count, 1); - assert_ok!(yield_farm.increase_entries_count()); - assert_ok!(yield_farm.increase_entries_count()); - assert_ok!(yield_farm.increase_entries_count()); - assert_eq!(yield_farm.entries_count, 4); - - assert_ok!(yield_farm.decrease_entries_count()); - assert_eq!(yield_farm.entries_count, 3); - assert_ok!(yield_farm.decrease_entries_count()); - assert_ok!(yield_farm.decrease_entries_count()); - assert_ok!(yield_farm.decrease_entries_count()); - assert_eq!(yield_farm.entries_count, 0); - assert_noop!( - yield_farm.decrease_entries_count(), - Error::::InconsistentState(InconsistentStateError::InvalidYieldFarmEntriesCount) - ); - - //no entries in the farm - yield_farm.entries_count = 0; - assert!(!yield_farm.has_entries()); - assert_ok!(yield_farm.increase_entries_count()); - assert!(yield_farm.has_entries()); - - yield_farm.state = FarmState::Active; - yield_farm.entries_count = 0; - //active farm can't be flushed - assert!(!yield_farm.can_be_removed()); - - //stopped farm can't be flushed - yield_farm.state = FarmState::Stopped; - assert!(!yield_farm.can_be_removed()); - - //deleted farm with entries can't be flushed - yield_farm.state = FarmState::Terminated; - yield_farm.entries_count = 1; - assert!(!yield_farm.can_be_removed()); - - //deleted farm with no entries can be flushed - yield_farm.entries_count = 0; - assert!(yield_farm.can_be_removed()); - }); -} - -#[test] -fn global_farm_should_work() { - let mut global_farm = GlobalFarmData::::new( - 1, - 10, - BSX, - Perquintill::from_float(0.2), - 1_000, - 100, - GC, - BSX, - 1_000_000, - 1_000, - One::one(), - ); - - //new farm should be created active - assert!(global_farm.state.is_active()); - global_farm.state = FarmState::Terminated; - assert!(!global_farm.state.is_active()); - - global_farm.state = FarmState::Active; - - assert_ok!(global_farm.increase_yield_farm_counts()); - assert_ok!(global_farm.increase_yield_farm_counts()); - assert_eq!(global_farm.live_yield_farms_count, 2); - assert_eq!(global_farm.total_yield_farms_count, 2); - assert_ok!(global_farm.increase_yield_farm_counts()); - assert_ok!(global_farm.increase_yield_farm_counts()); - assert_eq!(global_farm.live_yield_farms_count, 4); - assert_eq!(global_farm.total_yield_farms_count, 4); - assert_ok!(global_farm.decrease_live_yield_farm_count()); - assert_ok!(global_farm.decrease_live_yield_farm_count()); - //removing farm changes only live farms, total count is not changed - assert_eq!(global_farm.live_yield_farms_count, 2); - assert_eq!(global_farm.total_yield_farms_count, 4); - assert_ok!(global_farm.increase_yield_farm_counts()); - assert_eq!(global_farm.live_yield_farms_count, 3); - assert_eq!(global_farm.total_yield_farms_count, 5); - assert_ok!(global_farm.decrease_total_yield_farm_count()); - assert_ok!(global_farm.decrease_total_yield_farm_count()); - //removing farm changes only total count(farm has to removed and deleted before it can be - //flushed) - assert_eq!(global_farm.live_yield_farms_count, 3); - assert_eq!(global_farm.total_yield_farms_count, 3); - - assert!(global_farm.has_live_farms()); - global_farm.live_yield_farms_count = 0; - global_farm.total_yield_farms_count = 3; - assert!(!global_farm.has_live_farms()); - - //active farm can't be flushed - assert!(!global_farm.can_be_removed()); - global_farm.state = FarmState::Terminated; - //deleted farm with yield farm can't be flushed - assert!(!global_farm.can_be_removed()); - //deleted farm with no yield farms can be flushed - global_farm.live_yield_farms_count = 0; - global_farm.total_yield_farms_count = 0; - assert!(global_farm.can_be_removed()); -} - -#[test] -fn global_farm_add_stake_should_work_when_amount_is_provided() { - let global_farm_0 = GlobalFarmData::::new( - 1, - 10, - BSX, - Perquintill::from_float(0.2), - 1_000, - 100, - GC, - BSX, - 1_000_000, - 1_000, - One::one(), - ); - - let mut global_farm = global_farm_0.clone(); - - assert_ok!(global_farm.add_stake(1)); - assert_eq!( - global_farm, - GlobalFarmData { - total_shares_z: 1, - ..global_farm_0.clone() - } - ); - - assert_ok!(global_farm.add_stake(1_000_000 * ONE)); - assert_eq!( - global_farm, - GlobalFarmData { - total_shares_z: 1_000_000 * ONE + 1, //+1 from previous add_stake - ..global_farm_0 - } - ); -} - -#[test] -fn global_farm_remove_stake_should_work_when_amount_is_provided() { - new_test_ext().execute_with(|| { - let mut global_farm_0 = GlobalFarmData::::new( - 1, - 10, - BSX, - Perquintill::from_float(0.2), - 1_000, - 100, - GC, - BSX, - 1_000_000, - 1_000, - One::one(), - ); - - global_farm_0.total_shares_z = 1_000_000 * ONE; - - let mut global_farm = global_farm_0.clone(); - - assert_ok!(global_farm.remove_stake(1)); - assert_eq!( - global_farm, - GlobalFarmData { - total_shares_z: 1_000_000 * ONE - 1, - ..global_farm_0.clone() - } - ); - - assert_ok!(global_farm.remove_stake(1_000_000 * ONE - 1)); //-1 from previous remove_stake - assert_eq!( - global_farm, - GlobalFarmData { - total_shares_z: 0, - ..global_farm_0 - } - ); - }); -} - -#[test] -#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] -fn global_farm_remove_stake_should_not_work_when_math_overflow() { - new_test_ext().execute_with(|| { - let mut global_farm_0 = GlobalFarmData::::new( - 1, - 10, - BSX, - Perquintill::from_float(0.2), - 1_000, - 100, - GC, - BSX, - 1_000_000, - 1_000, - One::one(), - ); - - global_farm_0.total_shares_z = 1_000_000 * ONE; - let mut global_farm = global_farm_0; - - //sub with overflow - assert_noop!( - global_farm.remove_stake(1 + 1_000_000 * ONE), - Error::InconsistentState(InconsistentStateError::InvalidTotalSharesZ) - ); - }); -} - -#[test] -fn is_yield_farm_clamable_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - //active farm - assert!(LiquidityMining::is_yield_farm_claimable( - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - //invalid amm_pool_id - assert!(!LiquidityMining::is_yield_farm_claimable( - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN2_AMM - )); - - //farm withouth deposits - assert!(!LiquidityMining::is_yield_farm_claimable( - EVE_FARM, - EVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - //termianted yield farm - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - assert!(!LiquidityMining::is_yield_farm_claimable( - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn get_global_farm_id_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - //happy path - assert_eq!( - LiquidityMining::get_global_farm_id(PREDEFINED_DEPOSIT_IDS[0], GC_BSX_TKN1_YIELD_FARM_ID), - Some(GC_FARM) - ); - - //happy path deposit with multiple farm entries - //create second farm entry - assert_ok!(LiquidityMining::redeposit_lp_shares( - EVE_FARM, - EVE_BSX_TKN1_YIELD_FARM_ID, - PREDEFINED_DEPOSIT_IDS[0], - |_, _, _| { Ok(1_000_u128) } - )); - - assert_eq!( - LiquidityMining::get_global_farm_id(PREDEFINED_DEPOSIT_IDS[0], EVE_BSX_TKN1_YIELD_FARM_ID), - Some(EVE_FARM) - ); - - //deposit doesn't exists - assert!(LiquidityMining::get_global_farm_id(999_9999, GC_BSX_TKN1_YIELD_FARM_ID).is_none()); - - //farm's entry doesn't exists in the deposit - assert!( - LiquidityMining::get_global_farm_id(PREDEFINED_DEPOSIT_IDS[0], DAVE_BSX_TKN1_YIELD_FARM_ID).is_none() - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn farm_state_should_work() { - let active = FarmState::Active; - let deleted = FarmState::Terminated; - let stopped = FarmState::Stopped; - - assert_eq!(active.is_active(), true); - assert_eq!(active.is_stopped(), false); - assert_eq!(active.is_terminated(), false); - - assert_eq!(stopped.is_active(), false); - assert_eq!(stopped.is_stopped(), true); - assert_eq!(stopped.is_terminated(), false); - - assert_eq!(deleted.is_active(), false); - assert_eq!(deleted.is_stopped(), false); - assert_eq!(deleted.is_terminated(), true); -} - -#[test] -fn min_yield_farm_multiplier_should_be_ge_1_when_multiplied_by_min_deposit() { - //WARN: don't remove this test. This rule is important. - // min_yield_farm_multiplier * min_deposit >=1 otherwise non-zero deposit can result in a zero - // stake in global-farm and farm can be falsely identified as empty. - //https://github.com/galacticcouncil/warehouse/issues/127 - - assert_eq!( - crate::MIN_YIELD_FARM_MULTIPLIER - .checked_mul_int(crate::MIN_DEPOSIT) - .unwrap() - .ge(&1_u128), - true - ); -} - -#[test] -fn sync_global_farm_should_emit_all_rewards_distributed_when_reward_is_zero() { - new_test_ext().execute_with(|| { - let global_farm_id = 10; - - let mut global_farm = GlobalFarmData::new( - global_farm_id, - 10, - BSX, - Perquintill::from_percent(1), - 10_000, - 1, - ALICE, - BSX, - 1_000_000 * ONE, - 1_000, - One::one(), - ); - global_farm.total_shares_z = 1_000 * ONE; - - let farm_account_id = LiquidityMining::farm_account_id(global_farm_id).unwrap(); - Whitelist::add_account(&farm_account_id).unwrap(); - - assert_eq!(Tokens::free_balance(BSX, &farm_account_id), Balance::zero()); - - assert_eq!( - with_transaction(|| { - TransactionOutcome::Commit(LiquidityMining::sync_global_farm(&mut global_farm, 1_000_000_000)) - }) - .unwrap(), - Balance::zero() - ); - - frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( - Event::AllRewardsDistributed { global_farm_id }, - )); - }); -} diff --git a/pallets/liquidity-mining/src/tests/update_global_farm.rs b/pallets/liquidity-mining/src/tests/update_global_farm.rs deleted file mode 100644 index d567303a8d4..00000000000 --- a/pallets/liquidity-mining/src/tests/update_global_farm.rs +++ /dev/null @@ -1,184 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn update_global_farm_price_adjustment_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let new_price_adjustment = FixedU128::from_float(0.856_f64); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - - set_block_number(100_000); - - assert_ok!(LiquidityMining::update_global_farm_price_adjustment( - GC, - GC_FARM, - new_price_adjustment - )); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 1_000, - accumulated_rpz: FixedU128::from_inner(491_000_000_000_000_000_000_u128), - price_adjustment: new_price_adjustment, - pending_rewards: 343_195_125_u128 * ONE, - ..global_farm_0 - }, - ); - - frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( - Event::GlobalFarmAccRPZUpdated { - global_farm_id: global_farm_0.id, - accumulated_rpz: FixedU128::from_inner(491_000_000_000_000_000_000_u128), - total_shares_z: global_farm_0.total_shares_z, - }, - )); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn update_global_farm_price_adjustment_in_same_period_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let new_price_adjustment = FixedU128::from_float(0.856_f64); - set_block_number(10_000); - - assert_ok!(LiquidityMining::update_global_farm_price_adjustment( - GC, - GC_FARM, - new_price_adjustment - )); - - frame_system::Pallet::::assert_has_event(mock::RuntimeEvent::LiquidityMining( - Event::GlobalFarmAccRPZUpdated { - global_farm_id: GC_FARM, - accumulated_rpz: FixedU128::from_inner(41_000_000_000_000_000_000_u128), - total_shares_z: 703_990_u128 * ONE, - }, - )); - - let new_price_adjustment = FixedU128::from_float(0.6_f64); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - assert_ok!(LiquidityMining::update_global_farm_price_adjustment( - GC, - GC_FARM, - new_price_adjustment - )); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - price_adjustment: new_price_adjustment, - ..global_farm_0 - }, - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn update_global_farm_price_adjustment_not_owner_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let new_price_adjustment = FixedU128::from_float(0.6_f64); - let not_owner = ALICE; - - set_block_number(10_000); - - assert_noop!( - LiquidityMining::update_global_farm_price_adjustment(not_owner, GC_FARM, new_price_adjustment), - Error::::Forbidden - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -//global farm not found -#[test] -fn update_global_farm_price_adjustment_not_existing_farm_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let new_price_adjustment = FixedU128::from_float(0.6_f64); - let not_existing_farm = GlobalFarmId::MAX; - - set_block_number(10_000); - - assert_noop!( - LiquidityMining::update_global_farm_price_adjustment(GC, not_existing_farm, new_price_adjustment), - Error::::GlobalFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn update_global_farm_price_adjustment_should_fail_when_farm_is_already_terminated() { - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - //Arrange - let yield_farm_id = PREDEFINED_YIELD_FARMS_INS1.with(|v| v[2].id); - - //Add deposit to yield farm so it won't be removed from storage on destroy. - assert_ok!(LiquidityMining::deposit_lp_shares( - CHARLIE_FARM, - yield_farm_id, - ACA_KSM_AMM, - 1_000 * ONE, - |_, _, _| { Ok(10 * ONE) }, - )); - - //Stop farming. - assert_ok!(LiquidityMining::stop_yield_farm(CHARLIE, CHARLIE_FARM, ACA_KSM_AMM)); - - //Destroy yield farm (yield farm is destroyed but not flushed) - assert_ok!(LiquidityMining::terminate_yield_farm( - CHARLIE, - CHARLIE_FARM, - yield_farm_id, - ACA_KSM_AMM - )); - - //Destroy global farm. - assert_ok!(LiquidityMining::terminate_global_farm(CHARLIE, CHARLIE_FARM)); - - //Global farm with yield farms should NOT be flushed. - pretty_assertions::assert_eq!(LiquidityMining::global_farm(CHARLIE_FARM).is_some(), true); - - //Act & assert - assert_noop!( - LiquidityMining::update_global_farm_price_adjustment(CHARLIE, CHARLIE_FARM, FixedU128::one()), - Error::::GlobalFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }) -} diff --git a/pallets/liquidity-mining/src/tests/update_yield_farm.rs b/pallets/liquidity-mining/src/tests/update_yield_farm.rs deleted file mode 100644 index 9687517f00e..00000000000 --- a/pallets/liquidity-mining/src/tests/update_yield_farm.rs +++ /dev/null @@ -1,223 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn update_yield_farm_should_work() { - //Yield farm without deposits. - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - let new_multiplier: FarmMultiplier = FixedU128::from(5_000_u128); - let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); - - assert_eq!( - LiquidityMining::update_yield_farm_multiplier(GC, GC_FARM, BSX_TKN1_AMM, new_multiplier).unwrap(), - GC_BSX_TKN1_YIELD_FARM_ID - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - multiplier: new_multiplier, - ..yield_farm - } - ); - - assert_eq!(LiquidityMining::global_farm(GC_FARM).unwrap(), global_farm); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - - //Yield farm with deposits. - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - //Same period as last yield farm update so no farms(global or yield) need to be updated. - let new_multiplier: FarmMultiplier = FixedU128::from(10_000_u128); - let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); - - assert_ok!(LiquidityMining::update_yield_farm_multiplier( - GC, - GC_FARM, - BSX_TKN1_AMM, - new_multiplier, - )); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - multiplier: new_multiplier, - ..yield_farm - } - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - total_shares_z: 455_876_290 * ONE, - ..global_farm - } - ); - - //Different period so farms update should happen. - set_block_number(5_000); - let new_multiplier: FarmMultiplier = FixedU128::from(5_000_u128); - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - let pot = LiquidityMining::pot_account_id().unwrap(); - let expected_claimed_from_global_farm = 1_498_432_831_415_733_421_593_u128; - //This is not claimed by other yield farms. - let expected_allocated_for_other_yield_farms = 1_567_168_584_266_578_407_u128; - - //_0 - value before action. - let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - let global_farm_balance_0 = Tokens::free_balance(BSX, &global_farm_account); - let pot_balance_0 = Tokens::free_balance(BSX, &pot); - - assert_ok!(LiquidityMining::update_yield_farm_multiplier( - GC, - GC_FARM, - BSX_TKN1_AMM, - new_multiplier, - )); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 50, - accumulated_rpvs: FixedU128::from_inner(32_921_163_403_946_715_450_000_u128), - accumulated_rpz: FixedU128::from_inner(6_790_366_340_394_671_545_u128), - multiplier: new_multiplier, - left_to_distribute: yield_farm_0.left_to_distribute + expected_claimed_from_global_farm, - ..yield_farm_0 - } - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 50, - accumulated_rpz: FixedU128::from_inner(6_790_366_340_394_671_545_u128), - total_shares_z: 228_176_290 * ONE, - pending_rewards: global_farm_0.pending_rewards + expected_allocated_for_other_yield_farms, - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - + expected_claimed_from_global_farm, - ..global_farm_0 - } - ); - - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - global_farm_balance_0 - expected_claimed_from_global_farm - expected_allocated_for_other_yield_farms - ); - assert_eq!( - Tokens::free_balance(BSX, &pot), - pot_balance_0 + expected_claimed_from_global_farm + expected_allocated_for_other_yield_farms - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn update_yield_farm_multiplier_should_not_work_when_multiplier_is_lt_min_yield_farm_multiplier() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::update_yield_farm_multiplier( - GC, - GC_FARM, - BSX_TKN1_AMM, - MIN_YIELD_FARM_MULTIPLIER - FixedU128::from_inner(1_u128), - ), - Error::::InvalidMultiplier - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn update_yield_farm_stopped_farm_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - //Yield farm must be in the active yield farm storage to update works. - assert_noop!( - LiquidityMining::update_yield_farm_multiplier(GC, GC_FARM, BSX_TKN1_AMM, FixedU128::from(10_001),), - Error::::YieldFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn update_yield_farm_termianted_farm_should_not_work() { - //NOTE: yield farm is in the storage but it's deleted. - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).is_some()); - - //Yield farm must be in the active yield farm storage to update works - assert_noop!( - LiquidityMining::update_yield_farm_multiplier(GC, GC_FARM, BSX_TKN1_AMM, FixedU128::from(10_001),), - Error::::YieldFarmNotFound - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn update_yield_farm_not_owner_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let not_owner = ALICE; - assert_noop!( - LiquidityMining::update_yield_farm_multiplier( - not_owner, - GC_FARM, - BSX_TKN1_AMM, - FixedU128::from(10_001_u128), - ), - Error::::Forbidden - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} diff --git a/pallets/liquidity-mining/src/tests/withdraw_lp_shares.rs b/pallets/liquidity-mining/src/tests/withdraw_lp_shares.rs deleted file mode 100644 index 7cde2674fa3..00000000000 --- a/pallets/liquidity-mining/src/tests/withdraw_lp_shares.rs +++ /dev/null @@ -1,1377 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; -use hydradx_traits::liquidity_mining::Mutate; -use pretty_assertions::assert_eq; -use test_ext::*; - -#[test] -fn withdraw_shares_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const REWARD_CURRENCY: u32 = BSX; - const GLOBAL_FARM_ID: GlobalFarmId = GC_FARM; - - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - let global_farm_total_rewards_start = 30_000_000_000 * ONE; - - let pot = LiquidityMining::pot_account_id().unwrap(); - let pot_initial_balance = 1_000_000_000 * ONE; - - // This balance is used to transfer unclaimable_rewards from yield farm to global farm. - // Claiming is not part of withdraw_shares() so some balance need to be set. - Tokens::set_balance(Origin::root(), pot, REWARD_CURRENCY, pot_initial_balance, 0).unwrap(); - - // withdraw 1A - // _0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - let bsx_tkn1_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - - let unclaimable_rewards = 100_000 * ONE; - let withdrawn_amount = 50 * ONE; - let expected_deposit_destroyed = true; - - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - unclaimable_rewards, - ) - .unwrap(), - (GLOBAL_FARM_ID, withdrawn_amount, expected_deposit_destroyed,) - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 25, - reward_currency: BSX, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares_z: 691_490 * ONE, - pending_rewards: 0, - accumulated_paid_rewards: 1_283_550 * ONE - unclaimable_rewards, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 566 * ONE, - total_valued_shares: 43_040 * ONE, - entries_count: 2, - left_to_distribute: bsx_tkn1_yield_farm_0.left_to_distribute - unclaimable_rewards, - ..bsx_tkn1_yield_farm_0 - }, - ); - - //Unclaimabe rewards was transferred from pot to global-farm's account. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &pot), - pot_balance_0 - unclaimable_rewards - ); - - //Global farm balance checks. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert_eq!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]), None); - - set_block_number(12_800); - - // withdraw 3B - - let unclaimable_rewards = 32_786 * ONE; - let withdrawn_amount = 87 * ONE; - let expected_deposit_destroyed = true; - - // _0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - let bsx_tkn1_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let bsx_tkn2_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[4], - GC_BSX_TKN2_YIELD_FARM_ID, - unclaimable_rewards - ) - .unwrap(), - (GLOBAL_FARM_ID, withdrawn_amount, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 25, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - pending_rewards: 0, - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, - total_shares_z: 688_880 * ONE, - ..global_farm_0 - } - ); - - // This farm should not change. - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - bsx_tkn1_yield_farm_0 - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 873 * ONE, - total_valued_shares: 47_368 * ONE, - entries_count: 3, - left_to_distribute: bsx_tkn2_yield_farm_0.left_to_distribute - unclaimable_rewards, - ..bsx_tkn2_yield_farm_0 - }, - ); - - //Pot's balance checks. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &pot), - pot_balance_0 - unclaimable_rewards - ); - - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[4]).is_none()); - - // withdraw 3A - - let unclaimable_rewards = 2_441 * ONE; - let withdrawn_amount = 486 * ONE; - let expected_deposit_destroyed = true; - - // _0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - let bsx_tkn1_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[6], - GC_BSX_TKN1_YIELD_FARM_ID, - unclaimable_rewards, - ) - .unwrap(), - (GLOBAL_FARM_ID, withdrawn_amount, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 25, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - pending_rewards: 0, - total_shares_z: 494480 * ONE, - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, - ..global_farm_0 - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 80 * ONE, - total_valued_shares: 4_160 * ONE, - entries_count: 1, - left_to_distribute: bsx_tkn1_yield_farm_0.left_to_distribute - unclaimable_rewards, - ..bsx_tkn1_yield_farm_0 - }, - ); - - //Yield farm balance checks. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &pot), - pot_balance_0 - unclaimable_rewards - ); - - //Global farm balance checks. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[6]).is_none()); - - // withdraw 2A - - let unclaimable_rewards = 429 * ONE; - let withdrawn_amount = 80 * ONE; - let expected_deposit_destroyed = true; - - // _0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - let bsx_tkn1_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[1], - GC_BSX_TKN1_YIELD_FARM_ID, - unclaimable_rewards, - ) - .unwrap(), - (GLOBAL_FARM_ID, withdrawn_amount, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 25, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - pending_rewards: 0, - total_shares_z: 473_680 * ONE, - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, - ..global_farm_0 - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 0, - total_valued_shares: 0, - entries_count: 0, - left_to_distribute: bsx_tkn1_yield_farm_0.left_to_distribute - unclaimable_rewards, - ..bsx_tkn1_yield_farm_0 - }, - ); - - //Yield farm balance checks. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &pot), - pot_balance_0 - unclaimable_rewards - ); - - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[1]).is_none()); - - // withdraw 1B - let unclaimable_rewards = 30_001 * ONE; - - // _0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - let bsx_tkn1_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let bsx_tkn2_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - - assert_ok!(LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[2], - GC_BSX_TKN2_YIELD_FARM_ID, - unclaimable_rewards - )); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 25, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - pending_rewards: 0, - total_shares_z: 471_680 * ONE, - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, - ..global_farm_0 - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - bsx_tkn1_yield_farm_0 - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 848 * ONE, - total_valued_shares: 47_168 * ONE, - entries_count: 2, - left_to_distribute: bsx_tkn2_yield_farm_0.left_to_distribute - unclaimable_rewards, - ..bsx_tkn2_yield_farm_0 - }, - ); - - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &pot), - pot_balance_0 - unclaimable_rewards - ); - - //Global farm balance checks. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert_eq!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[2]), None); - - // withdraw 4B - let unclaimable_rewards = 96_473 * ONE; - let withdrawn_shares = 48 * ONE; - let expected_deposit_destroyed = true; - - // _0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - let bsx_tkn2_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[5], - GC_BSX_TKN2_YIELD_FARM_ID, - unclaimable_rewards, - ) - .unwrap(), - (GLOBAL_FARM_ID, withdrawn_shares, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 25, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - pending_rewards: 0, - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, - total_shares_z: 464_000 * ONE, - ..global_farm_0 - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 800 * ONE, - total_valued_shares: 46_400 * ONE, - entries_count: 1, - left_to_distribute: bsx_tkn2_yield_farm_0.left_to_distribute - unclaimable_rewards, - ..bsx_tkn2_yield_farm_0 - }, - ); - - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &pot), - pot_balance_0 - unclaimable_rewards - ); - - //Global farm balance checks. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[5]).is_none()); - - // withdraw 2B - let unclaimable_rewards = 5_911 * ONE; - let withdrawn_shares = 800 * ONE; - let expected_deposit_destroyed = true; - - // _0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - let bsx_tkn2_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[3], - GC_BSX_TKN2_YIELD_FARM_ID, - unclaimable_rewards - ) - .unwrap(), - (GLOBAL_FARM_ID, withdrawn_shares, expected_deposit_destroyed) - ); - - let global_farm_1 = LiquidityMining::global_farm(GC_FARM).unwrap(); - pretty_assertions::assert_eq!( - global_farm_1, - GlobalFarmData { - updated_at: 25, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - pending_rewards: 0, - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, - total_shares_z: 0, - ..global_farm_0 - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(35_000_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 0, - total_valued_shares: 0, - entries_count: 0, - left_to_distribute: bsx_tkn2_yield_farm_0.left_to_distribute - unclaimable_rewards, - ..bsx_tkn2_yield_farm_0 - }, - ); - - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &pot), - pot_balance_0 - unclaimable_rewards - ); - - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[2]).is_none()); - - let distributed_from_global = - global_farm_total_rewards_start - Tokens::total_balance(REWARD_CURRENCY, &global_farm_account); - - let tracked_distributed_rewards = global_farm_1.accumulated_paid_rewards + global_farm_1.pending_rewards; - - pretty_assertions::assert_eq!(distributed_from_global, tracked_distributed_rewards); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); - - //Charlie's farm incentivize KSM and reward currency is ACA - //This test check if correct currency is transferred if rewards and incentvized - //assets are different, otherwise farm behavior is the same as in test above. - predefined_test_ext().execute_with(|| { - let _ = with_transaction(|| { - set_block_number(1_800); //period 18 - - let deposited_amount = 50 * ONE; - assert_ok!(LiquidityMining::deposit_lp_shares( - CHARLIE_FARM, - CHARLIE_ACA_KSM_YIELD_FARM_ID, - ACA_KSM_AMM, - deposited_amount, - |_, _, _| { Ok(2_500 * ONE) } - )); - - const DEPOSIT_ID: DepositId = 1; - let global_farm_id = CHARLIE_FARM; - assert_eq!( - LiquidityMining::deposit(DEPOSIT_ID).unwrap(), - DepositData { - shares: 50 * ONE, - amm_pool_id: ACA_KSM_AMM, - yield_farm_entries: vec![YieldFarmEntry { - global_farm_id, - yield_farm_id: CHARLIE_ACA_KSM_YIELD_FARM_ID, - accumulated_rpvs: Zero::zero(), - accumulated_claimed_rewards: 0, - entered_at: 18, - updated_at: 18, - valued_shares: 2_500 * ONE, - stopped_at_creation: Zero::zero(), - _phantom: PhantomData, - }] - .try_into() - .unwrap(), - }, - ); - - set_block_number(2_596); //period 25 - - let expected_deposit_destroyed = true; - assert_eq!( - LiquidityMining::withdraw_lp_shares(DEPOSIT_ID, CHARLIE_ACA_KSM_YIELD_FARM_ID, 0).unwrap(), - (CHARLIE_FARM, deposited_amount, expected_deposit_destroyed) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn withdraw_with_multiple_entries_and_flush_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - let alice_bsx_tkn1_lp_shares_balance = Tokens::free_balance(BSX_TKN1_SHARE_ID, &ALICE); - - //Redeposit to multiple yield farms. - assert_ok!(LiquidityMining::redeposit_lp_shares( - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - PREDEFINED_DEPOSIT_IDS[0], - |_, _, _| { Ok(10 * ONE) }, - )); - - assert_ok!(LiquidityMining::redeposit_lp_shares( - EVE_FARM, - EVE_BSX_TKN1_YIELD_FARM_ID, - PREDEFINED_DEPOSIT_IDS[0], - |_, _, _| { Ok(10 * ONE) }, - )); - //NOTE: predefined_deposit_ids[0] is deposited in 3 yield farms now. - - //Stop yield farm. - assert_ok!(LiquidityMining::stop_yield_farm(EVE, EVE_FARM, BSX_TKN1_AMM)); - //Stop and destroy all yield farms so it can be flushed. - assert_ok!(LiquidityMining::stop_yield_farm(DAVE, DAVE_FARM, BSX_TKN1_AMM)); - assert_ok!(LiquidityMining::terminate_yield_farm( - DAVE, - DAVE_FARM, - DAVE_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - assert_ok!(LiquidityMining::terminate_global_farm(DAVE, DAVE_FARM)); - - let unclaimable_rewards = 0; - let shares_amount = 50 * ONE; - let expected_deposit_destroyed = false; - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - unclaimable_rewards - ) - .unwrap(), - (GC_FARM, shares_amount, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]) - .unwrap() - .yield_farm_entries - .len(), - 2 - ); - - //LP tokens should not be unlocked. - assert_eq!( - Tokens::free_balance(BSX_TKN1_SHARE_ID, &ALICE), - alice_bsx_tkn1_lp_shares_balance - ); - - //This withdraw should flush yield and global farms. - let expected_deposit_destroyed = false; - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[0], - DAVE_BSX_TKN1_YIELD_FARM_ID, - unclaimable_rewards - ) - .unwrap(), - (DAVE_FARM, shares_amount, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]) - .unwrap() - .yield_farm_entries - .len(), - 1 - ); - - //LP tokens should not be unlocked. - assert_eq!( - Tokens::free_balance(BSX_TKN1_SHARE_ID, &ALICE), - alice_bsx_tkn1_lp_shares_balance - ); - - assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, DAVE_FARM, DAVE_BSX_TKN1_YIELD_FARM_ID)).is_none()); - assert!(LiquidityMining::global_farm(DAVE_FARM).is_none()); - - //Non-dustable check - let global_farm_account = LiquidityMining::farm_account_id(DAVE_FARM).unwrap(); - assert_eq!(Whitelist::contains(&global_farm_account), false); - - let yield_farm_account = LiquidityMining::farm_account_id(DAVE_BSX_TKN1_YIELD_FARM_ID).unwrap(); - assert_eq!(Whitelist::contains(&yield_farm_account), false); - - //This withdraw should flush yield and global farms. - let expected_deposit_destroyed = true; - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[0], - EVE_BSX_TKN1_YIELD_FARM_ID, - unclaimable_rewards - ) - .unwrap(), - (EVE_FARM, shares_amount, expected_deposit_destroyed) - ); - - //Last withdraw from deposit should flush deposit. - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).is_none()); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn withdraw_shares_from_destroyed_farm_should_work() { - //This is the case when yield farm is removed and global farm is destroyed. - //In this case only amm shares should be withdrawn. - - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - //Stop all yield farms in the global farm. - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN2_AMM)); - - //Remove all yield farms from global farm. - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN2_YIELD_FARM_ID, - BSX_TKN2_AMM - )); - - //Destroy farm. - assert_ok!(LiquidityMining::terminate_global_farm(GC, GC_FARM)); - - assert!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)) - .unwrap() - .state - .is_terminated() - ); - assert!( - LiquidityMining::yield_farm((BSX_TKN2_AMM, GC_FARM, GC_BSX_TKN2_YIELD_FARM_ID)) - .unwrap() - .state - .is_terminated() - ); - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap().state, - FarmState::Terminated - ); - - let test_data = vec![ - ( - ALICE, - 0, - 50 * ONE, - 2_u64, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_SHARE_ID, - BSX_TKN1_AMM, - ), - ( - BOB, - 1, - 80 * ONE, - 1_u64, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_SHARE_ID, - BSX_TKN1_AMM, - ), - ( - BOB, - 2, - 25 * ONE, - 3_u64, - GC_BSX_TKN2_YIELD_FARM_ID, - BSX_TKN2_SHARE_ID, - BSX_TKN2_AMM, - ), - ( - BOB, - 3, - 800 * ONE, - 2_u64, - GC_BSX_TKN2_YIELD_FARM_ID, - BSX_TKN2_SHARE_ID, - BSX_TKN2_AMM, - ), - ( - ALICE, - 4, - 87 * ONE, - 1_u64, - GC_BSX_TKN2_YIELD_FARM_ID, - BSX_TKN2_SHARE_ID, - BSX_TKN2_AMM, - ), - ( - ALICE, - 5, - 48 * ONE, - 0_u64, - GC_BSX_TKN2_YIELD_FARM_ID, - BSX_TKN2_SHARE_ID, - BSX_TKN2_AMM, - ), - ( - ALICE, - 6, - 486 * ONE, - 0_u64, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_SHARE_ID, - BSX_TKN1_AMM, - ), - ]; - - for (_caller, deposit_idx, withdrawn_shares, _farm_entries_left, yield_farm_id, _lp_token, _amm_pool_id) in - test_data - { - let expected_deposit_destroyed = true; - assert_eq!( - LiquidityMining::withdraw_lp_shares(PREDEFINED_DEPOSIT_IDS[deposit_idx], yield_farm_id, 0,) - .unwrap(), - (GC_FARM, withdrawn_shares, expected_deposit_destroyed) - ); - - //check if deposit was removed. - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[deposit_idx]).is_none()); - } - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn withdraw_shares_from_canceled_yield_farm_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - set_block_number(10_000); - - // Stop yield farm before withdraw test. - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - let pot = LiquidityMining::pot_account_id().unwrap(); - - //1-th withdraw - //_0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(BSX, &global_farm_account); - let pot_balance_0 = Tokens::free_balance(BSX, &pot); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - - let unclaimable_rewards = 168_270 * ONE; - let withdrawn_amount = 50 * ONE; - let expected_deposit_destroyed = true; - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - unclaimable_rewards - ) - .unwrap(), - (GC_FARM, withdrawn_amount, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, - ..global_farm_0 - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - total_shares: yield_farm_0.total_shares - withdrawn_amount, - total_valued_shares: yield_farm_0.total_valued_shares - 2500 * ONE, - entries_count: 2, - left_to_distribute: yield_farm_0.left_to_distribute - unclaimable_rewards, - ..yield_farm_0 - } - ); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).is_none()); - - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert_eq!(Tokens::free_balance(BSX, &pot), pot_balance_0 - unclaimable_rewards); - - //2-nd withdraw - //_0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(BSX, &global_farm_account); - let pot_balance_0 = Tokens::free_balance(BSX, &pot); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - - let unclaimable_rewards = 2_055_086 * ONE; - let shares_amount = 486 * ONE; - let valued_shares_amount = 38_880 * ONE; - - let expected_deposit_destroyed = true; - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[6], - GC_BSX_TKN1_YIELD_FARM_ID, - unclaimable_rewards - ) - .unwrap(), - (GC_FARM, shares_amount, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, - ..global_farm_0 - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - total_shares: yield_farm_0.total_shares - shares_amount, - total_valued_shares: yield_farm_0.total_valued_shares - valued_shares_amount, - entries_count: 1, - left_to_distribute: yield_farm_0.left_to_distribute - unclaimable_rewards, - ..yield_farm_0 - } - ); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[6]).is_none()); - - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert_eq!(Tokens::free_balance(BSX, &pot), pot_balance_0 - unclaimable_rewards); - - //3-th withdraw - //_0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(BSX, &global_farm_account); - let pot_balance_0 = Tokens::free_balance(BSX, &pot); - let global_farm_0 = LiquidityMining::global_farm(GC_FARM).unwrap(); - let yield_farm_0 = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - - let unclaimable_rewards = 228_572 * ONE; - let shares_amount = 80 * ONE; - - let expected_deposit_destroyed = true; - assert_eq!( - LiquidityMining::withdraw_lp_shares( - PREDEFINED_DEPOSIT_IDS[1], - GC_BSX_TKN1_YIELD_FARM_ID, - unclaimable_rewards - ) - .unwrap(), - (GC_FARM, shares_amount, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - accumulated_paid_rewards: global_farm_0.accumulated_paid_rewards - unclaimable_rewards, - ..global_farm_0 - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - total_shares: 0, - total_valued_shares: 0, - entries_count: 0, - left_to_distribute: yield_farm_0.left_to_distribute - unclaimable_rewards, - ..yield_farm_0 - } - ); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[1]).is_none()); - - assert_eq!( - Tokens::free_balance(BSX, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert_eq!(Tokens::free_balance(BSX, &pot), pot_balance_0 - unclaimable_rewards); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn withdraw_shares_from_removed_pool_should_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - set_block_number(10_000); - - //Stop yield farm before removing. - assert_ok!(LiquidityMining::stop_yield_farm(GC, GC_FARM, BSX_TKN1_AMM)); - - //Terminate yield farm before test - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - assert!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)) - .unwrap() - .state - .is_terminated(), - ); - - let global_farm = LiquidityMining::global_farm(GC_FARM).unwrap(); - - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - let global_farm_bsx_balance = Tokens::free_balance(BSX, &global_farm_account); - let alice_bsx_balance = Tokens::free_balance(BSX, &ALICE); - - let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let shares_amount = 50 * ONE; - //1-th withdraw - let expected_deposit_destroyed = true; - assert_eq!( - LiquidityMining::withdraw_lp_shares(PREDEFINED_DEPOSIT_IDS[0], GC_BSX_TKN1_YIELD_FARM_ID, 0).unwrap(), - (GC_FARM, shares_amount, expected_deposit_destroyed) - ); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]).is_none()); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - total_shares: 566 * ONE, - total_valued_shares: 43_040 * ONE, - entries_count: 2, - ..yield_farm - } - ); - - assert_eq!(LiquidityMining::global_farm(GC_FARM).unwrap(), global_farm); - - //Removed yield farm don't pay rewards, only transfers amm shares. - assert_eq!(Tokens::free_balance(BSX, &ALICE), alice_bsx_balance); - assert_eq!(Tokens::free_balance(BSX, &global_farm_account), global_farm_bsx_balance); - - //2-nd withdraw - let alice_bsx_balance = Tokens::free_balance(BSX, &ALICE); - let shares_amount = 486 * ONE; - - let yield_farm = LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let expected_deposit_destroyed = true; - assert_eq!( - LiquidityMining::withdraw_lp_shares(PREDEFINED_DEPOSIT_IDS[6], GC_BSX_TKN1_YIELD_FARM_ID, 0,).unwrap(), - (GC_FARM, shares_amount, expected_deposit_destroyed) - ); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[6]).is_none()); - - assert_eq!(LiquidityMining::global_farm(GC_FARM).unwrap(), global_farm); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - total_shares: 80 * ONE, - total_valued_shares: 4_160 * ONE, - entries_count: 1, - ..yield_farm - } - ); - - //removed yield farm don't pay rewards, only return LP shares - assert_eq!(Tokens::free_balance(BSX, &ALICE), alice_bsx_balance); - assert_eq!(Tokens::free_balance(BSX, &global_farm_account), global_farm_bsx_balance); - - //3-th withdraw - let bob_bsx_balance = Tokens::free_balance(BSX, &BOB); - let shares_amount = 80 * ONE; - - let expected_deposit_destroyed = true; - assert_eq!( - LiquidityMining::withdraw_lp_shares(PREDEFINED_DEPOSIT_IDS[1], GC_BSX_TKN1_YIELD_FARM_ID, 0).unwrap(), - (GC_FARM, shares_amount, expected_deposit_destroyed) - ); - - //Last withdraw should flush yield farm if it's deleted - assert!(LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).is_none()); - - assert!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[1]).is_none()); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - //counts changed because last deposit removed deleted yield farm from storage - live_yield_farms_count: 1, - total_yield_farms_count: 1, - ..global_farm - } - ); - - //Removed yield farm don't pay rewards, only return LP shares. - assert_eq!(Tokens::free_balance(BSX, &BOB), bob_bsx_balance); - assert_eq!(Tokens::free_balance(BSX, &global_farm_account), global_farm_bsx_balance); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn withdraw_shares_yield_farm_entry_not_found_should_not_work() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const DEPOSIT_ID: DepositId = 1; - const NOT_FOUND_ENTRY_ID: YieldFarmId = 999_999; - assert_noop!( - LiquidityMining::withdraw_lp_shares(DEPOSIT_ID, NOT_FOUND_ENTRY_ID, 0), - Error::::YieldFarmEntryNotFound - ); - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -#[cfg_attr(debug_assertions, should_panic(expected = "Defensive failure has been triggered!"))] -fn withdraw_shares_should_fail_when_deposit_not_found() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - assert_noop!( - LiquidityMining::withdraw_lp_shares(72_334_321_125_861_359_621, GC_BSX_TKN1_YIELD_FARM_ID, 0), - Error::::InconsistentState(InconsistentStateError::DepositNotFound) - ); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn trait_withdraw_lp_shares_should_claim_and_withdraw_when_yield_farm_is_claimable() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const REWARD_CURRENCY: u32 = BSX; - - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - - let pot = LiquidityMining::pot_account_id().unwrap(); - let pot_initial_balance = 1_000_000_000 * ONE; - - // This balance is used to transfer unclaimable_rewards from yield farm to global farm. - // Claiming is not part of withdraw_shares() so some balance need to be set. - Tokens::set_balance(Origin::root(), pot, REWARD_CURRENCY, pot_initial_balance, 0).unwrap(); - - // withdraw 1A - // _0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - let bsx_tkn1_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - - let withdrawn_amount = 50 * ONE; - let expected_deposit_destroyed = true; - let expected_claimed_amount = 23_306_074_766_355_140_u128; - let unclaimable_rewards = 20_443_925_233_644_860_u128; - let expected_claim_data = Some((REWARD_CURRENCY, expected_claimed_amount, unclaimable_rewards)); - - assert_eq!( - >>::withdraw_lp_shares( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - ) - .unwrap(), - (withdrawn_amount, expected_claim_data, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 25, - reward_currency: BSX, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares_z: 691_490 * ONE, - pending_rewards: 0, - accumulated_paid_rewards: 1_283_550 * ONE - unclaimable_rewards, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 566 * ONE, - total_valued_shares: 43_040 * ONE, - entries_count: 2, - left_to_distribute: bsx_tkn1_yield_farm_0.left_to_distribute - - unclaimable_rewards - expected_claimed_amount, - ..bsx_tkn1_yield_farm_0 - }, - ); - - //Unclaimabe rewards was transferred from pot to global-farm's account and claimed - //amount was transferred to user. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &pot), - pot_balance_0 - unclaimable_rewards - expected_claimed_amount - ); - - //Global farm balance checks. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert_eq!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]), None); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn trait_withdraw_lp_shares_should_only_withdraw_when_yield_farm_is_not_claimable() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const REWARD_CURRENCY: u32 = BSX; - const GLOBAL_FARM_ID: GlobalFarmId = GC_FARM; - - //destroy yield-farm - assert_ok!(LiquidityMining::stop_yield_farm(GC, GLOBAL_FARM_ID, BSX_TKN1_AMM)); - assert_ok!(LiquidityMining::terminate_yield_farm( - GC, - GLOBAL_FARM_ID, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM - )); - - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - - let pot = LiquidityMining::pot_account_id().unwrap(); - let pot_initial_balance = 1_000_000_000 * ONE; - - // This balance is used to transfer unclaimable_rewards from yield farm to global farm. - // Claiming is not part of withdraw_shares() so some balance need to be set. - Tokens::set_balance(Origin::root(), pot, REWARD_CURRENCY, pot_initial_balance, 0).unwrap(); - - // withdraw 1A - // _0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - let bsx_tkn1_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let global_farm_0 = LiquidityMining::global_farm(GLOBAL_FARM_ID).unwrap(); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - - let withdrawn_amount = 50 * ONE; - let expected_deposit_destroyed = true; - let expected_claim_data = None; //claim from terminated farm should not happen - - assert_eq!( - >>::withdraw_lp_shares( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - ) - .unwrap(), - (withdrawn_amount, expected_claim_data, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 25, - reward_currency: BSX, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - pending_rewards: 0, - ..global_farm_0 - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - total_shares: 566 * ONE, - total_valued_shares: 43_040 * ONE, - entries_count: 2, - ..bsx_tkn1_yield_farm_0 - } - ); - - //Nothing was claimed from pot becasue yield-farm is terminated so balance should not - //change - assert_eq!(Tokens::free_balance(REWARD_CURRENCY, &pot), pot_balance_0); - - //Global farm balance should not change becasue no rewards were transferred. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), - global_farm_balance_0 - ); - - assert_eq!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]), None); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} - -#[test] -fn trait_withdraw_lp_shares_should_claim_zero_when_user_already_claimed_rewards() { - predefined_test_ext_with_deposits().execute_with(|| { - let _ = with_transaction(|| { - const REWARD_CURRENCY: u32 = BSX; - - let global_farm_account = LiquidityMining::farm_account_id(GC_FARM).unwrap(); - - let pot = LiquidityMining::pot_account_id().unwrap(); - let pot_initial_balance = 1_000_000_000 * ONE; - - let fail_on_doubleclaim = true; - assert_ok!(LiquidityMining::claim_rewards( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_BSX_TKN1_YIELD_FARM_ID, - fail_on_doubleclaim - )); - - // This balance is used to transfer unclaimable_rewards from yield farm to global farm. - // Claiming is not part of withdraw_shares() so some balance need to be set. - Tokens::set_balance(Origin::root(), pot, REWARD_CURRENCY, pot_initial_balance, 0).unwrap(); - - // withdraw 1A - // _0 - value before act. - let global_farm_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &global_farm_account); - let bsx_tkn1_yield_farm_0 = - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(); - let pot_balance_0 = Tokens::free_balance(REWARD_CURRENCY, &pot); - - let withdrawn_amount = 50 * ONE; - let expected_deposit_destroyed = true; - let expected_claimed_amount = 0_u128; - let unclaimable_rewards = 20_443_925_233_644_860_u128; - let expected_claim_data = Some((REWARD_CURRENCY, expected_claimed_amount, unclaimable_rewards)); - - assert_eq!( - >>::withdraw_lp_shares( - ALICE, - PREDEFINED_DEPOSIT_IDS[0], - GC_FARM, - GC_BSX_TKN1_YIELD_FARM_ID, - BSX_TKN1_AMM, - ) - .unwrap(), - (withdrawn_amount, expected_claim_data, expected_deposit_destroyed) - ); - - assert_eq!( - LiquidityMining::global_farm(GC_FARM).unwrap(), - GlobalFarmData { - updated_at: 25, - reward_currency: BSX, - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares_z: 691_490 * ONE, - pending_rewards: 0, - accumulated_paid_rewards: 1_283_550 * ONE - unclaimable_rewards, - ..get_predefined_global_farm_ins1(2) - } - ); - - assert_eq!( - LiquidityMining::yield_farm((BSX_TKN1_AMM, GC_FARM, GC_BSX_TKN1_YIELD_FARM_ID)).unwrap(), - YieldFarmData { - updated_at: 25, - accumulated_rpvs: FixedU128::from_inner(17_500_000_000_000_000_000_u128), - accumulated_rpz: FixedU128::from_inner(3_500_000_000_000_000_000_u128), - total_shares: 566 * ONE, - total_valued_shares: 43_040 * ONE, - entries_count: 2, - left_to_distribute: bsx_tkn1_yield_farm_0.left_to_distribute - - unclaimable_rewards - expected_claimed_amount, - ..bsx_tkn1_yield_farm_0 - }, - ); - - //Unclaimabe rewards was transferred from pot to global-farm's account and claimed - //amount was transferred to user. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &pot), - pot_balance_0 - unclaimable_rewards - expected_claimed_amount - ); - - //Global farm balance checks. - assert_eq!( - Tokens::free_balance(REWARD_CURRENCY, &global_farm_account), - global_farm_balance_0 + unclaimable_rewards - ); - - assert_eq!(LiquidityMining::deposit(PREDEFINED_DEPOSIT_IDS[0]), None); - - TransactionOutcome::Commit(DispatchResult::Ok(())) - }); - }); -} diff --git a/pallets/liquidity-mining/src/types.rs b/pallets/liquidity-mining/src/types.rs deleted file mode 100644 index e4d11091d78..00000000000 --- a/pallets/liquidity-mining/src/types.rs +++ /dev/null @@ -1,429 +0,0 @@ -// This file is part of galacticcouncil/warehouse. - -// 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 super::*; - -use hydradx_traits::liquidity_mining::PriceAdjustment; -pub use hydradx_traits::liquidity_mining::{DepositId, GlobalFarmId, YieldFarmId}; - -pub type FarmId = u32; -pub type Balance = u128; -pub type FarmMultiplier = FixedU128; - -/// Default implementation of `PriceAdjustment` trait which returns `price_adjustment` value saved -/// in `GlobalFarm`. -pub struct DefaultPriceAdjustment; - -impl, I: 'static> PriceAdjustment> for DefaultPriceAdjustment { - type Error = DispatchError; - - type PriceAdjustment = FixedU128; - - fn get(global_farm: &GlobalFarmData) -> Result { - Ok(global_farm.price_adjustment) - } -} - -/// This struct represents the state a of single liquidity mining program. `YieldFarm`s are rewarded from -/// `GlobalFarm` based on their stake in `GlobalFarm`. `YieldFarm` stake in `GlobalFarm` is derived from -/// users stake in `YieldFarm`. -/// Yield farm is considered live from global farm view if yield farm is `active` or `stopped`. -#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] -#[codec(mel_bound())] -#[scale_info(skip_type_params(T, I))] -pub struct GlobalFarmData, I: 'static = ()> { - pub id: GlobalFarmId, - pub(super) owner: T::AccountId, - pub(super) updated_at: PeriodOf, - pub(super) total_shares_z: Balance, - pub(super) accumulated_rpz: FixedU128, - pub reward_currency: T::AssetId, - pub(super) pending_rewards: Balance, - pub(super) accumulated_paid_rewards: Balance, - pub(super) yield_per_period: Perquintill, - pub(super) planned_yielding_periods: PeriodOf, - pub(super) blocks_per_period: BlockNumberFor, - pub incentivized_asset: T::AssetId, - pub(super) max_reward_per_period: Balance, - // min. LP shares user must deposit to start yield farming. - pub(super) min_deposit: Balance, - // This include `active` and `stopped` yield farms. - pub(super) live_yield_farms_count: u32, - // This include `active`, `stopped`, `terminated` - this count is decreased only if yield - // farm is removed from storage. - pub(super) total_yield_farms_count: u32, - pub(super) price_adjustment: FixedU128, - pub(super) state: FarmState, -} - -impl, I: 'static> GlobalFarmData { - #[allow(clippy::too_many_arguments)] - pub fn new( - id: GlobalFarmId, - updated_at: PeriodOf, - reward_currency: T::AssetId, - yield_per_period: Perquintill, - planned_yielding_periods: PeriodOf, - blocks_per_period: BlockNumberFor, - owner: T::AccountId, - incentivized_asset: T::AssetId, - max_reward_per_period: Balance, - min_deposit: Balance, - price_adjustment: FixedU128, - ) -> Self { - Self { - pending_rewards: Zero::zero(), - accumulated_rpz: Zero::zero(), - accumulated_paid_rewards: Zero::zero(), - total_shares_z: Zero::zero(), - live_yield_farms_count: Zero::zero(), - total_yield_farms_count: Zero::zero(), - id, - updated_at, - reward_currency, - yield_per_period, - planned_yielding_periods, - blocks_per_period, - owner, - incentivized_asset, - max_reward_per_period, - min_deposit, - price_adjustment, - state: FarmState::Active, - } - } - - /// This function updates yields_farm_count when new yield farm is added into the global farm. - /// This function should be called only when new yield farm is created/added into the global - /// farm. - pub fn increase_yield_farm_counts(&mut self) -> Result<(), ArithmeticError> { - self.live_yield_farms_count = self - .live_yield_farms_count - .checked_add(1) - .ok_or(ArithmeticError::Overflow)?; - - self.total_yield_farms_count = self - .total_yield_farms_count - .checked_add(1) - .ok_or(ArithmeticError::Overflow)?; - - Ok(()) - } - - /// This function updates `yield_farms_count` when yield farm is terminated from global farm. - /// This function should be called only when yield farm is removed from global farm. - pub fn decrease_live_yield_farm_count(&mut self) -> Result<(), Error> { - //NOTE: only live count should change - //NOTE: this counter is managed only by pallet so this sub should never fail. - self.live_yield_farms_count = self - .live_yield_farms_count - .checked_sub(1) - .defensive_ok_or::>(InconsistentStateError::InvalidLiveYielFarmsCount.into())?; - - Ok(()) - } - - /// This function updates `yield_farms_count` when yield farm is removed from storage. - /// This function should be called only if yield farm was removed from storage. - /// !!! DON'T call this function if yield farm is in stopped or terminated. - pub fn decrease_total_yield_farm_count(&mut self) -> Result<(), Error> { - //NOTE: this counter is managed only by pallet so this sub should never fail. - self.total_yield_farms_count = self - .total_yield_farms_count - .checked_sub(1) - .defensive_ok_or::>(InconsistentStateError::InvalidTotalYieldFarmsCount.into())?; - - Ok(()) - } - - /// Function returns `true` if global farm has live yield farms. - pub fn has_live_farms(&self) -> bool { - !self.live_yield_farms_count.is_zero() - } - - /// Function return `true` if global farm can be removed from storage. - pub fn can_be_removed(&self) -> bool { - //farm can be removed from storage only if all yield farms was removed from storage. - self.state == FarmState::Terminated && self.total_yield_farms_count.is_zero() - } - - /// This function returns `true` if farm has no capacity for next yield farm(yield farm can't - /// be added into global farm until some yield farm is removed from storage). - pub fn is_full(&self) -> bool { - self.total_yield_farms_count.ge(&::MaxYieldFarmsPerGlobalFarm::get()) - } - - /// Function adds `amount` to `total_shares_z`. - pub fn add_stake(&mut self, amount: Balance) -> Result<(), ArithmeticError> { - self.total_shares_z = self - .total_shares_z - .checked_add(amount) - .ok_or(ArithmeticError::Overflow)?; - - Ok(()) - } - - /// Function removes `amount` from `total_shares_z`. - pub fn remove_stake(&mut self, amount: Balance) -> Result<(), Error> { - //NOTE: This should never fail, we should never sub more than current state. - self.total_shares_z = self - .total_shares_z - .checked_sub(amount) - .defensive_ok_or::>(InconsistentStateError::InvalidTotalSharesZ.into())?; - - Ok(()) - } -} - -#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] -#[codec(mel_bound())] -#[scale_info(skip_type_params(T, I))] -pub struct YieldFarmData, I: 'static = ()> { - pub(super) id: FarmId, - pub(super) updated_at: PeriodOf, - pub(super) total_shares: Balance, - pub(super) total_valued_shares: Balance, - pub(super) accumulated_rpvs: FixedU128, - pub(super) accumulated_rpz: FixedU128, - pub(super) loyalty_curve: Option, - pub(super) multiplier: FarmMultiplier, - pub(super) state: FarmState, - pub(super) entries_count: u64, - pub(super) left_to_distribute: Balance, - pub(super) total_stopped: PeriodOf, - pub(super) _phantom: PhantomData, -} - -impl, I: 'static> YieldFarmData { - #[allow(clippy::too_many_arguments)] - pub fn new( - id: FarmId, - updated_at: PeriodOf, - loyalty_curve: Option, - multiplier: FarmMultiplier, - ) -> Self { - Self { - id, - updated_at, - loyalty_curve, - multiplier, - accumulated_rpvs: Zero::zero(), - accumulated_rpz: Zero::zero(), - total_shares: Zero::zero(), - total_valued_shares: Zero::zero(), - state: FarmState::Active, - entries_count: Default::default(), - left_to_distribute: Default::default(), - total_stopped: Default::default(), - _phantom: PhantomData, - } - } - - /// Returns `true` if yield farm can be removed from storage, `false` otherwise. - pub fn can_be_removed(&self) -> bool { - self.state == FarmState::Terminated && self.entries_count.is_zero() - } - - /// This function updates entries count in the yield farm. This function should be called if - /// entry is removed from the yield farm. - pub fn decrease_entries_count(&mut self) -> Result<(), Error> { - //NOTE: this counter is managed only by pallet so this sub should never fail. - self.entries_count = self - .entries_count - .checked_sub(1) - .defensive_ok_or::>(InconsistentStateError::InvalidYieldFarmEntriesCount.into())?; - - Ok(()) - } - - /// This function updates entries count in the yield farm. This function should be called if - /// entry is added into the yield farm. - pub fn increase_entries_count(&mut self) -> Result<(), ArithmeticError> { - self.entries_count = self.entries_count.checked_add(1).ok_or(ArithmeticError::Overflow)?; - - Ok(()) - } - - /// This function return `true` if deposit exists in the yield farm. - pub fn has_entries(&self) -> bool { - !self.entries_count.is_zero() - } -} - -/// Loyalty curve to calculate loyalty multiplier. -/// -/// `t = t_now - t_added` -/// `num = t + initial_reward_percentage * scale_coef` -/// `denom = t + scale_coef` -/// -/// `loyalty_multiplier = num/denom` -#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] -#[scale_info(skip_type_params(T, I))] -pub struct LoyaltyCurve { - pub initial_reward_percentage: FixedU128, - pub scale_coef: u32, -} - -impl Default for LoyaltyCurve { - fn default() -> Self { - Self { - initial_reward_percentage: FixedU128::from_inner(500_000_000_000_000_000), // 0.5 - scale_coef: 100, - } - } -} - -/// Deposit represents a group of locked LP shares in the liquidity mining program("Position"). -/// LP shares in the deposit can be locked in one or more yield farms based on pallet's -/// configuration(`MaxEntriesPerDeposit`). -/// The LP token's lock in the deposit is called "farm entry". Farm entry entitles deposit -/// owner to accumulate rewards from the yield farm. -/// Every deposit should have at least one farm entry and deposit without farm entries -/// should be removed from storage and LP shares should be unlocked. -/// `redeposit_lp_shares()` is used to add a new farm entry into the deposit("re-lock" LP shares"). -#[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq, Eq, MaxEncodedLen)] -#[codec(mel_bound())] -#[scale_info(skip_type_params(T, I))] -pub struct DepositData, I: 'static = ()> { - pub(super) shares: Balance, - pub(super) amm_pool_id: T::AmmPoolId, - // NOTE: `MaxFarmEntriesPerDeposit` of this vector MUST BE at least 1 for the configuration to - // be sensible. - pub(super) yield_farm_entries: BoundedVec, T::MaxFarmEntriesPerDeposit>, -} - -impl, I: 'static> DepositData { - pub fn new(shares: Balance, amm_pool_id: T::AmmPoolId) -> Self { - Self { - shares, - amm_pool_id, - yield_farm_entries: BoundedVec::default(), - } - } - - /// This function add new yield farm entry into the deposit. - /// This function returns error if deposit reached max entries in the deposit or - /// `entry.yield_farm_id` is not unique. - pub fn add_yield_farm_entry(&mut self, entry: YieldFarmEntry) -> Result<(), DispatchError> { - if self.search_yield_farm_entry(entry.yield_farm_id).is_some() { - return Err(Error::::DoubleLock.into()); - } - - self.yield_farm_entries - .try_push(entry) - .map_err(|_| Error::::MaxEntriesPerDeposit)?; - - Ok(()) - } - - /// This function remove yield farm entry from the deposit. This function returns error if - /// yield farm entry in not found in the deposit. - pub fn remove_yield_farm_entry(&mut self, yield_farm_id: YieldFarmId) -> Result, Error> { - if let Some(idx) = self.search_yield_farm_entry(yield_farm_id) { - return Ok(self.yield_farm_entries.swap_remove(idx)); - } - - Err(Error::::YieldFarmEntryNotFound) - } - - /// This function return yield farm entry from deposit of `None` if yield farm entry is not - /// found. - pub fn get_yield_farm_entry(&mut self, yield_farm_id: YieldFarmId) -> Option<&mut YieldFarmEntry> { - if let Some(idx) = self.search_yield_farm_entry(yield_farm_id) { - return self.yield_farm_entries.get_mut(idx); - } - - None - } - - /// This function returns its index if deposit contains yield farm entry with given yield farm id. - pub fn search_yield_farm_entry(&self, yield_farm_id: YieldFarmId) -> Option { - self.yield_farm_entries - .iter() - .position(|e| e.yield_farm_id == yield_farm_id) - } - - /// This function returns `true` if deposit can be removed from storage. - pub fn can_be_removed(&self) -> bool { - //NOTE: deposit with no entries should/must be removed from storage - self.yield_farm_entries.is_empty() - } -} - -#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] -#[codec(mel_bound())] -#[scale_info(skip_type_params(T, I))] -pub struct YieldFarmEntry, I: 'static = ()> { - pub(super) global_farm_id: GlobalFarmId, - pub(super) yield_farm_id: YieldFarmId, - pub(super) valued_shares: Balance, - pub(super) accumulated_rpvs: FixedU128, - pub(super) accumulated_claimed_rewards: Balance, - pub(super) entered_at: PeriodOf, - pub(super) updated_at: PeriodOf, - // Number of periods yield-farm experienced before creation of this entry. - pub(super) stopped_at_creation: PeriodOf, - pub(super) _phantom: PhantomData, -} - -impl, I: 'static> YieldFarmEntry { - pub fn new( - global_farm_id: GlobalFarmId, - yield_farm_id: YieldFarmId, - valued_shares: Balance, - accumulated_rpvs: FixedU128, - entered_at: PeriodOf, - stopped_at_creation: PeriodOf, - ) -> Self { - Self { - global_farm_id, - yield_farm_id, - valued_shares, - accumulated_rpvs, - accumulated_claimed_rewards: Zero::zero(), - entered_at, - updated_at: entered_at, - stopped_at_creation, - _phantom: PhantomData, - } - } -} - -/// An enum whose variants represent the state of the yield or global farm. -/// - `Active` - farm has full functionality. This state may be used for both farm types. -/// - `Stopped` - only partial functionality of the farm is available to users. Farm can became -/// `Active` again or can be `Terminated`. This state can be used only for yield farms. -/// - `Terminated` - farm is destroyed and it's waiting to be removed from the storage. This state can't be -/// reverted and is available for both farm types. -#[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] -pub enum FarmState { - Active, - Stopped, - Terminated, -} - -impl FarmState { - pub fn is_active(&self) -> bool { - *self == FarmState::Active - } - pub fn is_stopped(&self) -> bool { - *self == FarmState::Stopped - } - pub fn is_terminated(&self) -> bool { - *self == FarmState::Terminated - } -} diff --git a/pallets/xyk/Cargo.toml b/pallets/xyk/Cargo.toml deleted file mode 100644 index db318e5a369..00000000000 --- a/pallets/xyk/Cargo.toml +++ /dev/null @@ -1,70 +0,0 @@ -[package] -name = 'pallet-xyk' -version = "6.3.4" -description = 'XYK automated market maker' -authors = ['GalacticCouncil'] -edition = '2021' -homepage = 'https://github.com/galacticcouncil/hydradx-node' -license = 'Apache 2.0' -repository = 'https://github.com/galacticcouncil/hydradx-node' - -[package.metadata.docs.rs] -targets = ['x86_64-unknown-linux-gnu'] - -[build-dependencies] -substrate-wasm-builder = { workspace = true } - -[dependencies] -codec = { default-features = false, features = ["derive"], package = "parity-scale-codec", version = "3.1.5" } -scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } -primitive-types = { default-features = false, version = "0.12.0" } -serde = { features = ['derive'], optional = true, version = '1.0.136' } -log = { version = "0.4.17", default-features = false } - -hydra-dx-math = { workspace = true } - -# ORML dependencies -orml-tokens = { workspace = true } -orml-traits = { workspace = true } - -# HydraDX dependencies -hydradx-traits = { workspace = true } - -# Substrate dependencies -frame-benchmarking = { workspace = true, optional = true } -frame-support = { workspace = true } -frame-system = { workspace = true } -sp-core = { workspace = true } -sp-runtime = { workspace = true } -sp-std = { workspace = true } - -pallet-asset-registry = { workspace = true } - -[dev-dependencies] -sp-io = { workspace = true } -sp-api = { workspace = true } -proptest = "1.0.0" - -[features] -default = ['std'] -runtime-benchmarks = [ - "frame-benchmarking", - "frame-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", -] -std = [ - 'serde', - 'codec/std', - 'frame-support/std', - 'frame-system/std', - 'sp-runtime/std', - 'sp-core/std', - 'sp-std/std', - 'orml-traits/std', - "hydradx-traits/std", - 'orml-tokens/std', - 'frame-benchmarking/std', - "scale-info/std", - "pallet-asset-registry/std", -] -try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/xyk/README.md b/pallets/xyk/README.md deleted file mode 100644 index c29db36c790..00000000000 --- a/pallets/xyk/README.md +++ /dev/null @@ -1,25 +0,0 @@ -### AMM XYK pallet - -## Overview -AMM pallet provides functionality for managing liquidity pool and executing trades. - -This pallet implements AMM Api trait therefore it is possible to plug this pool implementation -into the exchange pallet. - -### Terminology - -- **Currency** - implementation of fungible multi-currency system -- **AssetPairAccount** / **AssetPairAccountId** - support for creating share accounts for asset pairs. -- **NativeAssetId** - asset id native currency -- **ShareToken** - asset id from asset registry for an asset pair -- **TotalLiquidity** - total liquidity in a pool identified by asset pair account id -- **PoolAssets** - asset pair in a pool identified by asset pair account id - -### Interface - -#### Dispatchable functions -- `create_pool` -- `add_liquidity` -- `remove_liquidity` -- `sell` -- `buy` diff --git a/pallets/xyk/src/benchmarking.rs b/pallets/xyk/src/benchmarking.rs deleted file mode 100644 index f8835aa7ed4..00000000000 --- a/pallets/xyk/src/benchmarking.rs +++ /dev/null @@ -1,207 +0,0 @@ -// This file is part of HydraDX-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_system::RawOrigin; -use sp_std::prelude::*; - -use crate::Pallet as XYK; - -use crate::types::{AssetId, Balance}; -use hydradx_traits::router::{PoolType, TradeExecution}; - -const SEED: u32 = 1; - -fn funded_account(name: &'static str, index: u32) -> T::AccountId { - let caller: T::AccountId = account(name, index, SEED); - T::Currency::update_balance(1, &caller, 1_000_000_000_000_000).unwrap(); - T::Currency::update_balance(2, &caller, 1_000_000_000_000_000).unwrap(); - caller -} - -benchmarks! { - create_pool { - let caller = funded_account::("caller", 0); - - let asset_a: AssetId = 1; - let asset_b: AssetId = 2; - let amount_a : Balance = 10 * 1_000_000_000; - let amount_b : Balance = 20 * 1_000_000_000; - - }: _(RawOrigin::Signed(caller.clone()), asset_a, amount_a, asset_b, amount_b) - verify { - assert_eq!(T::Currency::free_balance(asset_a, &caller), 999990000000000); - } - - add_liquidity { - let maker = funded_account::("maker", 0); - let caller = funded_account::("caller", 0); - - let asset_a: AssetId = 1; - let asset_b: AssetId = 2; - let amount : Balance = 10 * 1_000_000_000; - let max_limit : Balance = 10 * 1_000_000_000_000; - - XYK::::create_pool(RawOrigin::Signed(maker).into(), asset_a, 1_000_000_000,asset_b, 1_000_000_000)?; - - }: _(RawOrigin::Signed(caller.clone()), asset_a, asset_b, amount, max_limit) - verify { - assert_eq!(T::Currency::free_balance(asset_a, &caller), 999990000000000); - assert_eq!(T::Currency::free_balance(asset_b, &caller), 999990000000000 - 1); // Due to rounding in favor of pool - } - - remove_liquidity { - let maker = funded_account::("maker", 0); - let caller = funded_account::("caller", 0); - - let asset_a: AssetId = 1; - let asset_b: AssetId = 2; - let amount : Balance = 1_000_000_000; - - XYK::::create_pool(RawOrigin::Signed(maker).into(), 1, 10_000_000_000, 2, 20_000_000_000)?; - XYK::::add_liquidity(RawOrigin::Signed(caller.clone()).into(), 1, 2, 5_000_000_000, 10_100_000_000)?; - - assert_eq!(T::Currency::free_balance(asset_a, &caller), 999995000000000); - assert_eq!(T::Currency::free_balance(asset_b, &caller), 999990000000000 - 1);// Due to rounding in favor of pool - - }: _(RawOrigin::Signed(caller.clone()), asset_a, asset_b, amount) - verify { - assert_eq!(T::Currency::free_balance(asset_a, &caller), 999996000000000); - assert_eq!(T::Currency::free_balance(asset_b, &caller), 999992000000000 - 1);// Due to rounding in favor of pool - } - - sell { - let maker = funded_account::("maker", 0); - let caller = funded_account::("caller", 0); - - let asset_a: AssetId = 1; - let asset_b: AssetId = 2; - let amount : Balance = 1_000_000_000; - let discount = false; - - let min_bought: Balance = 10 * 1_000; - - XYK::::create_pool(RawOrigin::Signed(maker).into(), asset_a, 1_000_000_000_000, asset_b, 3_000_000_000_000)?; - - }: _(RawOrigin::Signed(caller.clone()), asset_a, asset_b, amount, min_bought, discount) - verify{ - assert_eq!(T::Currency::free_balance(asset_a, &caller), 999999000000000); - } - - buy { - let maker = funded_account::("maker", 0); - let caller = funded_account::("caller", 0); - - let asset_a: AssetId = 1; - let asset_b: AssetId = 2; - let amount : Balance = 1_000_000_000; - let discount = false; - - let max_sold: Balance = 6_000_000_000; - - XYK::::create_pool(RawOrigin::Signed(maker).into(), asset_a, 1_000_000_000_000, asset_b, 3_000_000_000_000)?; - - }: _(RawOrigin::Signed(caller.clone()), asset_a, asset_b, amount, max_sold, discount) - verify{ - assert_eq!(T::Currency::free_balance(asset_a, &caller), 1000001000000000); - } - - router_execution_sell { - let c in 1..2; // if c == 1, calculate_sell is executed - let e in 0..1; // if e == 1, execute_sell is executed - - let maker = funded_account::("maker", 0); - let caller = funded_account::("caller", 0); - - let asset_a: AssetId = 1; - let asset_b: AssetId = 2; - let amount : Balance = 1_000_000_000; - let discount = false; - - let min_bought: Balance = 10 * 1_000; - - XYK::::create_pool(RawOrigin::Signed(maker).into(), asset_a, 1_000_000_000_000, asset_b, 3_000_000_000_000)?; - - }: { - for _ in 1..c { - assert!( as TradeExecution>::calculate_sell(PoolType::XYK, asset_a, asset_b, amount).is_ok()); - } - if e != 0 { - assert!( as TradeExecution>::execute_sell(RawOrigin::Signed(caller.clone()).into(), PoolType::XYK, asset_a, asset_b, amount, min_bought).is_ok()); - } - } - verify{ - if e != 0 { - assert_eq!(T::Currency::free_balance(asset_a, &caller), 999999000000000); - } - } - - router_execution_buy { - let c in 1..3; // number of times calculate_buy is executed - let e in 0..1; // if e == 1, execute_buy is executed - - let maker = funded_account::("maker", 0); - let caller = funded_account::("caller", 0); - - let asset_a: AssetId = 1; - let asset_b: AssetId = 2; - let amount : Balance = 1_000_000_000; - let discount = false; - - let max_sold: Balance = 6_000_000_000; - - XYK::::create_pool(RawOrigin::Signed(maker).into(), asset_a, 1_000_000_000_000, asset_b, 3_000_000_000_000)?; - - }: { - for _ in 1..c { - assert!( as TradeExecution>::calculate_buy(PoolType::XYK, asset_a, asset_b, amount).is_ok()); - } - if e != 0 { - assert!( as TradeExecution>::execute_buy(RawOrigin::Signed(caller.clone()).into(), PoolType::XYK, asset_a, asset_b, amount, max_sold).is_ok()); - } - } - verify{ - if e != 0 { - assert_eq!(T::Currency::free_balance(asset_b, &caller), 1000001000000000); - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::tests::mock::{ExtBuilder, System, Test}; - use frame_support::assert_ok; - - #[test] - fn test_benchmarks() { - ExtBuilder::default().build().execute_with(|| { - System::set_block_number(1); - assert_ok!(Pallet::::test_benchmark_create_pool()); - assert_ok!(Pallet::::test_benchmark_add_liquidity()); - assert_ok!(Pallet::::test_benchmark_remove_liquidity()); - assert_ok!(Pallet::::test_benchmark_sell()); - assert_ok!(Pallet::::test_benchmark_buy()); - assert_ok!(Pallet::::test_benchmark_router_execution_sell()); - assert_ok!(Pallet::::test_benchmark_router_execution_buy()); - }); - } -} diff --git a/pallets/xyk/src/impls.rs b/pallets/xyk/src/impls.rs deleted file mode 100644 index 41f8a3ca017..00000000000 --- a/pallets/xyk/src/impls.rs +++ /dev/null @@ -1,31 +0,0 @@ -use crate::types::{AssetId, AssetPair, Price}; -use hydradx_traits::pools::SpotPriceProvider; -use hydradx_traits::AMM; -use orml_traits::MultiCurrency; -use sp_runtime::FixedPointNumber; -use sp_std::marker::PhantomData; - -pub struct XYKSpotPrice(PhantomData); - -impl SpotPriceProvider for XYKSpotPrice { - type Price = Price; - - fn pair_exists(asset_a: AssetId, asset_b: AssetId) -> bool { - >::exists(AssetPair::new(asset_b, asset_a)) - } - - fn spot_price(asset_a: AssetId, asset_b: AssetId) -> Option { - if Self::pair_exists(asset_a, asset_b) { - let pair_account = >::get_pair_id(AssetPair { - asset_out: asset_a, - asset_in: asset_b, - }); - let asset_a_reserve = T::Currency::free_balance(asset_a, &pair_account); - let asset_b_reserve = T::Currency::free_balance(asset_b, &pair_account); - - Price::checked_from_rational(asset_a_reserve, asset_b_reserve) - } else { - None - } - } -} diff --git a/pallets/xyk/src/lib.rs b/pallets/xyk/src/lib.rs deleted file mode 100644 index a1099cfd981..00000000000 --- a/pallets/xyk/src/lib.rs +++ /dev/null @@ -1,1115 +0,0 @@ -// This file is part of HydraDX-node. - -// 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. - -//! # XYK Pallet -//! -//! ## Overview -//! -//! XYK pallet provides functionality for managing liquidity pool and executing trades. -//! -//! This pallet implements AMM Api trait therefore it is possible to plug this pool implementation -//! into the exchange pallet. - -#![cfg_attr(not(feature = "std"), no_std)] -#![allow(clippy::unused_unit)] -#![allow(clippy::upper_case_acronyms)] - -use frame_support::sp_runtime::{traits::Zero, DispatchError}; -use frame_support::{dispatch::DispatchResult, ensure, traits::Get, transactional}; -use frame_system::ensure_signed; -use frame_system::pallet_prelude::BlockNumberFor; -use hydradx_traits::{ - AMMPosition, AMMTransfer, AssetPairAccountIdFor, CanCreatePool, OnCreatePoolHandler, OnLiquidityChangedHandler, - OnTradeHandler, AMM, -}; -use sp_std::{vec, vec::Vec}; - -use crate::types::{Amount, AssetId, AssetPair, Balance}; -use hydra_dx_math::ratio::Ratio; -use orml_traits::{MultiCurrency, MultiCurrencyExtended}; - -#[cfg(test)] -mod tests; - -mod benchmarking; - -mod impls; -mod trade_execution; -pub mod types; -pub mod weights; - -pub use impls::XYKSpotPrice; - -use weights::WeightInfo; - -// Re-export pallet items so that they can be accessed from the crate namespace. -pub use pallet::*; - -#[frame_support::pallet] -pub mod pallet { - use super::*; - use frame_support::pallet_prelude::*; - use frame_system::pallet_prelude::OriginFor; - use hydradx_traits::{pools::DustRemovalAccountWhitelist, Source}; - use pallet_asset_registry::traits::ShareTokenRegistry; - - #[pallet::pallet] - pub struct Pallet(_); - - #[pallet::hooks] - impl Hooks> for Pallet {} - - #[pallet::config] - pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - - /// Registry support - type AssetRegistry: ShareTokenRegistry, Balance, DispatchError>; - - /// Share token support - type AssetPairAccountId: AssetPairAccountIdFor; - - /// Multi currency for transfer of currencies - type Currency: MultiCurrencyExtended; - - /// Native Asset Id - #[pallet::constant] - type NativeAssetId: Get; - - /// Weight information for the extrinsics. - type WeightInfo: WeightInfo; - - /// Trading fee rate - #[pallet::constant] - type GetExchangeFee: Get<(u32, u32)>; - - /// Minimum trading limit - #[pallet::constant] - type MinTradingLimit: Get; - - /// Minimum pool liquidity - #[pallet::constant] - type MinPoolLiquidity: Get; - - /// Max fraction of pool to sell in single transaction - #[pallet::constant] - type MaxInRatio: Get; - - /// Max fraction of pool to buy in single transaction - #[pallet::constant] - type MaxOutRatio: Get; - - /// Oracle source identifier for this pallet. - #[pallet::constant] - type OracleSource: Get; - - /// Called to ensure that pool can be created - type CanCreatePool: CanCreatePool; - - /// AMM handlers - type AMMHandler: OnCreatePoolHandler - + OnTradeHandler - + OnLiquidityChangedHandler; - - /// Discounted fee - type DiscountedFee: Get<(u32, u32)>; - - /// Account whitelist manager to exclude pool accounts from dusting mechanism. - type NonDustableWhitelistHandler: DustRemovalAccountWhitelist; - } - - #[pallet::error] - pub enum Error { - /// It is not allowed to create a pool between same assets. - CannotCreatePoolWithSameAssets, - - /// Liquidity has not reached the required minimum. - InsufficientLiquidity, - - /// Amount is less than min trading limit. - InsufficientTradingAmount, - - /// Liquidity is zero. - ZeroLiquidity, - - /// It is not allowed to create a pool with zero initial price. - /// Not used, kept for backward compatibility - ZeroInitialPrice, - - /// Overflow - /// Not used, kept for backward compatibility - CreatePoolAssetAmountInvalid, - - /// Overflow - InvalidMintedLiquidity, // No tests - but it is currently not possible this error to occur due to previous checks in the code. - - /// Overflow - InvalidLiquidityAmount, // no tests - it is currently not possible this error to occur due to previous checks in the code. - - /// Asset amount has exceeded given limit. - AssetAmountExceededLimit, - - /// Asset amount has not reached given limit. - AssetAmountNotReachedLimit, - - /// Asset balance is not sufficient. - InsufficientAssetBalance, - - /// Not enough asset liquidity in the pool. - InsufficientPoolAssetBalance, - - /// Not enough core asset liquidity in the pool. - InsufficientNativeCurrencyBalance, - - /// Liquidity pool for given assets does not exist. - TokenPoolNotFound, - - /// Liquidity pool for given assets already exists. - TokenPoolAlreadyExists, - - /// Overflow - AddAssetAmountInvalid, // no tests - /// Overflow - RemoveAssetAmountInvalid, // no tests - /// Overflow - SellAssetAmountInvalid, // no tests - /// Overflow - BuyAssetAmountInvalid, // no tests - - /// Overflow - FeeAmountInvalid, - - /// Overflow - CannotApplyDiscount, - - /// Max fraction of pool to buy in single transaction has been exceeded. - MaxOutRatioExceeded, - /// Max fraction of pool to sell in single transaction has been exceeded. - MaxInRatioExceeded, - - /// Overflow - Overflow, - - /// Pool cannot be created due to outside factors. - CannotCreatePool, - } - - #[pallet::event] - #[pallet::generate_deposit(pub(crate) fn deposit_event)] - pub enum Event { - /// New liquidity was provided to the pool. - LiquidityAdded { - who: T::AccountId, - asset_a: AssetId, - asset_b: AssetId, - amount_a: Balance, - amount_b: Balance, - }, - - /// Liquidity was removed from the pool. - LiquidityRemoved { - who: T::AccountId, - asset_a: AssetId, - asset_b: AssetId, - shares: Balance, - }, - - /// Pool was created. - PoolCreated { - who: T::AccountId, - asset_a: AssetId, - asset_b: AssetId, - initial_shares_amount: Balance, - share_token: AssetId, - pool: T::AccountId, - }, - - /// Pool was destroyed. - PoolDestroyed { - who: T::AccountId, - asset_a: AssetId, - asset_b: AssetId, - share_token: AssetId, - pool: T::AccountId, - }, - - /// Asset sale executed. - SellExecuted { - who: T::AccountId, - asset_in: AssetId, - asset_out: AssetId, - amount: Balance, - sale_price: Balance, - fee_asset: AssetId, - fee_amount: Balance, - pool: T::AccountId, - }, - - /// Asset purchase executed. - BuyExecuted { - who: T::AccountId, - asset_out: AssetId, - asset_in: AssetId, - amount: Balance, - buy_price: Balance, - fee_asset: AssetId, - fee_amount: Balance, - pool: T::AccountId, - }, - } - - /// Asset id storage for shared pool tokens - #[pallet::storage] - #[pallet::getter(fn share_token)] - pub(crate) type ShareToken = StorageMap<_, Blake2_128Concat, T::AccountId, AssetId, ValueQuery>; - - /// Total liquidity in a pool. - #[pallet::storage] - #[pallet::getter(fn total_liquidity)] - pub(crate) type TotalLiquidity = StorageMap<_, Blake2_128Concat, T::AccountId, Balance, ValueQuery>; - - /// Asset pair in a pool. - #[pallet::storage] - #[pallet::getter(fn pool_assets)] - pub(crate) type PoolAssets = - StorageMap<_, Blake2_128Concat, T::AccountId, (AssetId, AssetId), OptionQuery>; - - #[pallet::call] - impl Pallet { - /// Create new pool for given asset pair. - /// - /// Registers new pool for given asset pair (`asset a` and `asset b`) in asset registry. - /// Asset registry creates new id or returns previously created one if such pool existed before. - /// - /// Pool is created with initial liquidity provided by `origin`. - /// Shares are issued with specified initial price and represents proportion of asset in the pool. - /// - /// Emits `PoolCreated` event when successful. - #[pallet::call_index(0)] - #[pallet::weight(::WeightInfo::create_pool())] - pub fn create_pool( - origin: OriginFor, - asset_a: AssetId, - amount_a: Balance, - asset_b: AssetId, - amount_b: Balance, - ) -> DispatchResult { - let who = ensure_signed(origin)?; - - ensure!( - T::CanCreatePool::can_create(asset_a, asset_b), - Error::::CannotCreatePool - ); - - ensure!( - amount_a >= T::MinPoolLiquidity::get() && amount_b >= T::MinPoolLiquidity::get(), - Error::::InsufficientLiquidity - ); - - ensure!(asset_a != asset_b, Error::::CannotCreatePoolWithSameAssets); - - let asset_pair = AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }; - - ensure!(!Self::exists(asset_pair), Error::::TokenPoolAlreadyExists); - - let shares_added = if asset_a < asset_b { amount_a } else { amount_b }; - - ensure!( - T::Currency::free_balance(asset_a, &who) >= amount_a, - Error::::InsufficientAssetBalance - ); - - ensure!( - T::Currency::free_balance(asset_b, &who) >= amount_b, - Error::::InsufficientAssetBalance - ); - - let pair_account = Self::get_pair_id(asset_pair); - - let token_name = asset_pair.name(); - - let share_token = T::AssetRegistry::get_or_create_shared_asset( - token_name, - vec![asset_a, asset_b], - T::MinPoolLiquidity::get(), - )?; - - let _ = T::AMMHandler::on_create_pool(asset_pair.asset_in, asset_pair.asset_out); - - T::NonDustableWhitelistHandler::add_account(&pair_account)?; - - >::insert(&pair_account, share_token); - >::insert(&pair_account, (asset_a, asset_b)); - - Self::deposit_event(Event::PoolCreated { - who: who.clone(), - asset_a, - asset_b, - initial_shares_amount: shares_added, - share_token, - pool: pair_account.clone(), - }); - - T::Currency::transfer(asset_a, &who, &pair_account, amount_a)?; - T::Currency::transfer(asset_b, &who, &pair_account, amount_b)?; - - T::Currency::deposit(share_token, &who, shares_added)?; - - >::insert(&pair_account, shares_added); - - Ok(()) - } - - /// Add liquidity to previously created asset pair pool. - /// - /// Shares are issued with current price. - /// - /// Emits `LiquidityAdded` event when successful. - #[pallet::call_index(1)] - #[pallet::weight( - ::WeightInfo::add_liquidity() - .saturating_add(T::AMMHandler::on_liquidity_changed_weight()) - )] - #[transactional] - pub fn add_liquidity( - origin: OriginFor, - asset_a: AssetId, - asset_b: AssetId, - amount_a: Balance, - amount_b_max_limit: Balance, - ) -> DispatchResult { - let who = ensure_signed(origin)?; - - let asset_pair = AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }; - - ensure!(Self::exists(asset_pair), Error::::TokenPoolNotFound); - - ensure!( - amount_a >= T::MinTradingLimit::get(), - Error::::InsufficientTradingAmount - ); - - ensure!(!amount_b_max_limit.is_zero(), Error::::ZeroLiquidity); - - ensure!( - T::Currency::free_balance(asset_a, &who) >= amount_a, - Error::::InsufficientAssetBalance - ); - - let pair_account = Self::get_pair_id(asset_pair); - - let share_token = Self::share_token(&pair_account); - - let account_shares = T::Currency::free_balance(share_token, &who); - - let asset_a_reserve = T::Currency::free_balance(asset_a, &pair_account); - let asset_b_reserve = T::Currency::free_balance(asset_b, &pair_account); - let share_issuance = Self::total_liquidity(&pair_account); - - let amount_b = hydra_dx_math::xyk::calculate_liquidity_in(asset_a_reserve, asset_b_reserve, amount_a) - .map_err(|_| Error::::AddAssetAmountInvalid)?; - - ensure!( - T::Currency::free_balance(asset_b, &who) >= amount_b, - Error::::InsufficientAssetBalance - ); - - ensure!(amount_b <= amount_b_max_limit, Error::::AssetAmountExceededLimit); - - let shares_added = hydra_dx_math::xyk::calculate_shares(asset_a_reserve, amount_a, share_issuance) - .ok_or(Error::::Overflow)?; - - ensure!(!shares_added.is_zero(), Error::::InvalidMintedLiquidity); - - // Make sure that account share liquidity is at least MinPoolLiquidity - ensure!( - account_shares - .checked_add(shares_added) - .ok_or(Error::::InvalidMintedLiquidity)? - >= T::MinPoolLiquidity::get(), - Error::::InsufficientLiquidity - ); - - let liquidity_amount = share_issuance - .checked_add(shares_added) - .ok_or(Error::::InvalidLiquidityAmount)?; - - T::Currency::transfer(asset_a, &who, &pair_account, amount_a)?; - T::Currency::transfer(asset_b, &who, &pair_account, amount_b)?; - - T::Currency::deposit(share_token, &who, shares_added)?; - - >::insert(&pair_account, liquidity_amount); - - let liquidity_a = T::Currency::total_balance(asset_a, &pair_account); - let liquidity_b = T::Currency::total_balance(asset_b, &pair_account); - T::AMMHandler::on_liquidity_changed( - T::OracleSource::get(), - asset_a, - asset_b, - amount_a, - amount_b, - liquidity_a, - liquidity_b, - Ratio::new(liquidity_a, liquidity_b), - ) - .map_err(|(_w, e)| e)?; - - Self::deposit_event(Event::LiquidityAdded { - who, - asset_a, - asset_b, - amount_a, - amount_b, - }); - - Ok(()) - } - - /// Remove liquidity from specific liquidity pool in the form of burning shares. - /// - /// If liquidity in the pool reaches 0, it is destroyed. - /// - /// Emits 'LiquidityRemoved' when successful. - /// Emits 'PoolDestroyed' when pool is destroyed. - #[pallet::call_index(2)] - #[pallet::weight( - ::WeightInfo::remove_liquidity() - .saturating_add(T::AMMHandler::on_liquidity_changed_weight()) - )] - #[transactional] - pub fn remove_liquidity( - origin: OriginFor, - asset_a: AssetId, - asset_b: AssetId, - liquidity_amount: Balance, - ) -> DispatchResult { - let who = ensure_signed(origin)?; - - let asset_pair = AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }; - - ensure!(!liquidity_amount.is_zero(), Error::::ZeroLiquidity); - - ensure!(Self::exists(asset_pair), Error::::TokenPoolNotFound); - - let pair_account = Self::get_pair_id(asset_pair); - - let share_token = Self::share_token(&pair_account); - - let total_shares = Self::total_liquidity(&pair_account); - - let account_shares = T::Currency::free_balance(share_token, &who); - - ensure!(total_shares >= liquidity_amount, Error::::InsufficientLiquidity); - - ensure!(account_shares >= liquidity_amount, Error::::InsufficientAssetBalance); - - // Account's liquidity left should be either 0 or at least MinPoolLiquidity - ensure!( - (account_shares.saturating_sub(liquidity_amount)) >= T::MinPoolLiquidity::get() - || (account_shares == liquidity_amount), - Error::::InsufficientLiquidity - ); - - let asset_a_reserve = T::Currency::free_balance(asset_a, &pair_account); - let asset_b_reserve = T::Currency::free_balance(asset_b, &pair_account); - - let liquidity_out = hydra_dx_math::xyk::calculate_liquidity_out( - asset_a_reserve, - asset_b_reserve, - liquidity_amount, - total_shares, - ) - .map_err(|_| Error::::RemoveAssetAmountInvalid)?; - - let (remove_amount_a, remove_amount_b) = liquidity_out; - - ensure!( - T::Currency::free_balance(asset_a, &pair_account) >= remove_amount_a, - Error::::InsufficientPoolAssetBalance - ); - ensure!( - T::Currency::free_balance(asset_b, &pair_account) >= remove_amount_b, - Error::::InsufficientPoolAssetBalance - ); - - let liquidity_left = total_shares - .checked_sub(liquidity_amount) - .ok_or(Error::::InvalidLiquidityAmount)?; - - T::Currency::transfer(asset_a, &pair_account, &who, remove_amount_a)?; - T::Currency::transfer(asset_b, &pair_account, &who, remove_amount_b)?; - - T::Currency::withdraw(share_token, &who, liquidity_amount)?; - - >::insert(&pair_account, liquidity_left); - - let liquidity_a = T::Currency::total_balance(asset_a, &pair_account); - let liquidity_b = T::Currency::total_balance(asset_b, &pair_account); - T::AMMHandler::on_liquidity_changed( - T::OracleSource::get(), - asset_a, - asset_b, - remove_amount_a, - remove_amount_b, - liquidity_a, - liquidity_b, - Ratio::new(liquidity_a, liquidity_b), - ) - .map_err(|(_w, e)| e)?; - - Self::deposit_event(Event::LiquidityRemoved { - who: who.clone(), - asset_a, - asset_b, - shares: liquidity_amount, - }); - - if liquidity_left == 0 { - >::remove(&pair_account); - >::remove(&pair_account); - >::remove(&pair_account); - - // Ignore the failure, this cant stop liquidity removal - let r = T::NonDustableWhitelistHandler::remove_account(&pair_account); - - if r.is_err() { - log::trace!( - target: "xyk::remova_liquidity", "XYK: Failed to remove account {:?} from dust-removal whitelist. Reason {:?}", - pair_account, - r - ); - } - - Self::deposit_event(Event::PoolDestroyed { - who, - asset_a, - asset_b, - share_token, - pool: pair_account, - }); - } - - Ok(()) - } - - /// Trade asset in for asset out. - /// - /// Executes a swap of `asset_in` for `asset_out`. Price is determined by the liquidity pool. - /// - /// `max_limit` - minimum amount of `asset_out` / amount of asset_out to be obtained from the pool in exchange for `asset_in`. - /// - /// Emits `SellExecuted` when successful. - #[pallet::call_index(3)] - #[pallet::weight(::WeightInfo::sell() + ::AMMHandler::on_trade_weight())] - pub fn sell( - origin: OriginFor, - asset_in: AssetId, - asset_out: AssetId, - amount: Balance, - max_limit: Balance, - discount: bool, - ) -> DispatchResult { - let who = ensure_signed(origin)?; - - >::sell(&who, AssetPair { asset_in, asset_out }, amount, max_limit, discount)?; - - Ok(()) - } - - /// Trade asset in for asset out. - /// - /// Executes a swap of `asset_in` for `asset_out`. Price is determined by the liquidity pool. - /// - /// `max_limit` - maximum amount of `asset_in` to be sold in exchange for `asset_out`. - /// - /// Emits `BuyExecuted` when successful. - #[pallet::call_index(4)] - #[pallet::weight(::WeightInfo::buy() + ::AMMHandler::on_trade_weight())] - pub fn buy( - origin: OriginFor, - asset_out: AssetId, - asset_in: AssetId, - amount: Balance, - max_limit: Balance, - discount: bool, - ) -> DispatchResult { - let who = ensure_signed(origin)?; - - >::buy(&who, AssetPair { asset_in, asset_out }, amount, max_limit, discount)?; - - Ok(()) - } - } -} - -impl Pallet { - /// Return balance of each asset in selected liquidity pool. - pub fn get_pool_balances(pool_address: T::AccountId) -> Option> { - let mut balances = Vec::new(); - - if let Some(assets) = Self::get_pool_assets(&pool_address) { - for item in &assets { - let reserve = T::Currency::free_balance(*item, &pool_address); - balances.push((*item, reserve)); - } - } - Some(balances) - } - /// Calculate discounted trade fee - fn calculate_discounted_fee(amount: Balance) -> Result { - Ok( - hydra_dx_math::fee::calculate_pool_trade_fee(amount, T::DiscountedFee::get()) - .ok_or::>(Error::::FeeAmountInvalid)?, - ) - } - - /// Calculate trade fee - fn calculate_fee(amount: Balance) -> Result { - let fee = T::GetExchangeFee::get(); - Ok(hydra_dx_math::fee::calculate_pool_trade_fee(amount, (fee.0, fee.1)) - .ok_or::>(Error::::FeeAmountInvalid)?) - } - - pub fn pair_account_from_assets(asset_a: AssetId, asset_b: AssetId) -> T::AccountId { - T::AssetPairAccountId::from_assets(asset_a, asset_b, "xyk") - } -} - -// Implementation of AMM API which makes possible to plug the AMM pool into the exchange pallet. -impl AMM for Pallet { - fn exists(assets: AssetPair) -> bool { - >::contains_key(&Self::get_pair_id(assets)) - } - - fn get_pair_id(assets: AssetPair) -> T::AccountId { - Self::pair_account_from_assets(assets.asset_in, assets.asset_out) - } - - fn get_share_token(assets: AssetPair) -> AssetId { - let pair_account = Self::get_pair_id(assets); - Self::share_token(&pair_account) - } - - fn get_pool_assets(pool_account_id: &T::AccountId) -> Option> { - let maybe_assets = >::get(pool_account_id); - maybe_assets.map(|assets| vec![assets.0, assets.1]) - } - - fn get_spot_price_unchecked(asset_a: AssetId, asset_b: AssetId, amount: Balance) -> Balance { - let pair_account = Self::get_pair_id(AssetPair { - asset_out: asset_a, - asset_in: asset_b, - }); - - let asset_a_reserve = T::Currency::free_balance(asset_a, &pair_account); - let asset_b_reserve = T::Currency::free_balance(asset_b, &pair_account); - - hydra_dx_math::xyk::calculate_spot_price(asset_a_reserve, asset_b_reserve, amount) - .unwrap_or_else(|_| Balance::zero()) - } - - /// Validate a sell. Perform all necessary checks and calculations. - /// No storage changes are performed yet. - /// - /// Return `AMMTransfer` with all info needed to execute the transaction. - fn validate_sell( - who: &T::AccountId, - assets: AssetPair, - amount: Balance, - min_bought: Balance, - discount: bool, - ) -> Result, sp_runtime::DispatchError> { - ensure!( - amount >= T::MinTradingLimit::get(), - Error::::InsufficientTradingAmount - ); - - ensure!(Self::exists(assets), Error::::TokenPoolNotFound); - - ensure!( - T::Currency::free_balance(assets.asset_in, who) >= amount, - Error::::InsufficientAssetBalance - ); - - // If discount, pool for Sell asset and native asset must exist - if discount { - ensure!( - Self::exists(AssetPair { - asset_in: assets.asset_in, - asset_out: T::NativeAssetId::get() - }), - Error::::CannotApplyDiscount - ); - } - - let pair_account = Self::get_pair_id(assets); - - let asset_in_reserve = T::Currency::free_balance(assets.asset_in, &pair_account); - let asset_out_reserve = T::Currency::free_balance(assets.asset_out, &pair_account); - - ensure!( - amount - <= asset_in_reserve - .checked_div(T::MaxInRatio::get()) - .ok_or(Error::::Overflow)?, - Error::::MaxInRatioExceeded - ); - - let amount_out = hydra_dx_math::xyk::calculate_out_given_in(asset_in_reserve, asset_out_reserve, amount) - .map_err(|_| Error::::SellAssetAmountInvalid)?; - - ensure!( - amount_out - <= asset_out_reserve - .checked_div(T::MaxOutRatio::get()) - .ok_or(Error::::Overflow)?, - Error::::MaxOutRatioExceeded - ); - - let transfer_fee = if discount { - Self::calculate_discounted_fee(amount_out)? - } else { - Self::calculate_fee(amount_out)? - }; - - let amount_out_without_fee = amount_out - .checked_sub(transfer_fee) - .ok_or(Error::::SellAssetAmountInvalid)?; - - ensure!(asset_out_reserve > amount_out, Error::::InsufficientAssetBalance); - - ensure!( - min_bought <= amount_out_without_fee, - Error::::AssetAmountNotReachedLimit - ); - - let discount_fee = if discount { - let native_asset = T::NativeAssetId::get(); - - let native_pair_account = Self::get_pair_id(AssetPair { - asset_in: assets.asset_in, - asset_out: native_asset, - }); - - let native_reserve = T::Currency::free_balance(native_asset, &native_pair_account); - let asset_reserve = T::Currency::free_balance(assets.asset_in, &native_pair_account); - - let native_fee_spot_price = - hydra_dx_math::xyk::calculate_spot_price(asset_reserve, native_reserve, transfer_fee) - .map_err(|_| Error::::CannotApplyDiscount)?; - - ensure!( - T::Currency::free_balance(native_asset, who) >= native_fee_spot_price, - Error::::InsufficientNativeCurrencyBalance - ); - - native_fee_spot_price - } else { - Balance::zero() - }; - - let transfer = AMMTransfer { - origin: who.clone(), - assets, - amount, - amount_b: amount_out_without_fee, - discount, - discount_amount: discount_fee, - fee: (assets.asset_out, transfer_fee), - }; - - Ok(transfer) - } - - /// Execute sell. validate_sell must be called first. - /// Perform necessary storage/state changes. - /// Note : the execution should not return error as everything was previously verified and validated. - #[transactional] - fn execute_sell(transfer: &AMMTransfer) -> DispatchResult { - let pair_account = Self::get_pair_id(transfer.assets); - - if transfer.discount && transfer.discount_amount > 0u128 { - let native_asset = T::NativeAssetId::get(); - T::Currency::withdraw(native_asset, &transfer.origin, transfer.discount_amount)?; - } - - T::Currency::transfer( - transfer.assets.asset_in, - &transfer.origin, - &pair_account, - transfer.amount, - )?; - T::Currency::transfer( - transfer.assets.asset_out, - &pair_account, - &transfer.origin, - transfer.amount_b, - )?; - - let liquidity_in = T::Currency::total_balance(transfer.assets.asset_in, &pair_account); - let liquidity_out = T::Currency::total_balance(transfer.assets.asset_out, &pair_account); - T::AMMHandler::on_trade( - T::OracleSource::get(), - transfer.assets.asset_in, - transfer.assets.asset_out, - transfer.amount, - transfer.amount_b, - liquidity_in, - liquidity_out, - Ratio::new(liquidity_in, liquidity_out), - ) - .map_err(|(_w, e)| e)?; - - Self::deposit_event(Event::::SellExecuted { - who: transfer.origin.clone(), - asset_in: transfer.assets.asset_in, - asset_out: transfer.assets.asset_out, - amount: transfer.amount, - sale_price: transfer.amount_b, - fee_asset: transfer.fee.0, - fee_amount: transfer.fee.1, - pool: pair_account, - }); - - Ok(()) - } - - /// Validate a buy. Perform all necessary checks and calculations. - /// No storage changes are performed yet. - /// - /// Return `AMMTransfer` with all info needed to execute the transaction. - fn validate_buy( - who: &T::AccountId, - assets: AssetPair, - amount: Balance, - max_limit: Balance, - discount: bool, - ) -> Result, DispatchError> { - ensure!( - amount >= T::MinTradingLimit::get(), - Error::::InsufficientTradingAmount - ); - - ensure!(Self::exists(assets), Error::::TokenPoolNotFound); - - let pair_account = Self::get_pair_id(assets); - - let asset_out_reserve = T::Currency::free_balance(assets.asset_out, &pair_account); - let asset_in_reserve = T::Currency::free_balance(assets.asset_in, &pair_account); - - ensure!(asset_out_reserve > amount, Error::::InsufficientPoolAssetBalance); - - ensure!( - amount - <= asset_out_reserve - .checked_div(T::MaxOutRatio::get()) - .ok_or(Error::::Overflow)?, - Error::::MaxOutRatioExceeded - ); - - // If discount, pool for Sell asset and native asset must exist - if discount { - ensure!( - Self::exists(AssetPair { - asset_in: assets.asset_out, - asset_out: T::NativeAssetId::get() - }), - Error::::CannotApplyDiscount - ); - } - - let buy_price = hydra_dx_math::xyk::calculate_in_given_out(asset_out_reserve, asset_in_reserve, amount) - .map_err(|_| Error::::BuyAssetAmountInvalid)?; - - ensure!( - buy_price - <= asset_in_reserve - .checked_div(T::MaxInRatio::get()) - .ok_or(Error::::Overflow)?, - Error::::MaxInRatioExceeded - ); - - let transfer_fee = if discount { - Self::calculate_discounted_fee(buy_price)? - } else { - Self::calculate_fee(buy_price)? - }; - - let buy_price_with_fee = buy_price - .checked_add(transfer_fee) - .ok_or(Error::::BuyAssetAmountInvalid)?; - - ensure!(max_limit >= buy_price_with_fee, Error::::AssetAmountExceededLimit); - - ensure!( - T::Currency::free_balance(assets.asset_in, who) >= buy_price_with_fee, - Error::::InsufficientAssetBalance - ); - - let discount_fee = if discount { - let native_asset = T::NativeAssetId::get(); - - let native_pair_account = Self::get_pair_id(AssetPair { - asset_in: assets.asset_out, - asset_out: native_asset, - }); - - let native_reserve = T::Currency::free_balance(native_asset, &native_pair_account); - let asset_reserve = T::Currency::free_balance(assets.asset_out, &native_pair_account); - - let native_fee_spot_price = - hydra_dx_math::xyk::calculate_spot_price(asset_reserve, native_reserve, transfer_fee) - .map_err(|_| Error::::CannotApplyDiscount)?; - - ensure!( - T::Currency::free_balance(native_asset, who) >= native_fee_spot_price, - Error::::InsufficientNativeCurrencyBalance - ); - native_fee_spot_price - } else { - Balance::zero() - }; - - let transfer = AMMTransfer { - origin: who.clone(), - assets, - amount, - amount_b: buy_price, - discount, - discount_amount: discount_fee, - fee: (assets.asset_in, transfer_fee), - }; - - Ok(transfer) - } - - /// Execute buy. validate_buy must be called first. - /// Perform necessary storage/state changes. - /// Note : the execution should not return error as everything was previously verified and validated. - #[transactional] - fn execute_buy(transfer: &AMMTransfer) -> DispatchResult { - let pair_account = Self::get_pair_id(transfer.assets); - - if transfer.discount && transfer.discount_amount > 0 { - let native_asset = T::NativeAssetId::get(); - T::Currency::withdraw(native_asset, &transfer.origin, transfer.discount_amount)?; - } - - T::Currency::transfer( - transfer.assets.asset_out, - &pair_account, - &transfer.origin, - transfer.amount, - )?; - T::Currency::transfer( - transfer.assets.asset_in, - &transfer.origin, - &pair_account, - transfer.amount_b + transfer.fee.1, - )?; - - let liquidity_in = T::Currency::total_balance(transfer.assets.asset_in, &pair_account); - let liquidity_out = T::Currency::total_balance(transfer.assets.asset_out, &pair_account); - T::AMMHandler::on_trade( - T::OracleSource::get(), - transfer.assets.asset_in, - transfer.assets.asset_out, - transfer.amount, - transfer.amount_b, - liquidity_in, - liquidity_out, - Ratio::new(liquidity_in, liquidity_out), - ) - .map_err(|(_w, e)| e)?; - - Self::deposit_event(Event::::BuyExecuted { - who: transfer.origin.clone(), - asset_out: transfer.assets.asset_out, - asset_in: transfer.assets.asset_in, - amount: transfer.amount, - buy_price: transfer.amount_b, - fee_asset: transfer.fee.0, - fee_amount: transfer.fee.1, - pool: pair_account, - }); - - Ok(()) - } - - fn get_min_trading_limit() -> Balance { - T::MinTradingLimit::get() - } - - fn get_min_pool_liquidity() -> Balance { - T::MinPoolLiquidity::get() - } - - fn get_max_in_ratio() -> u128 { - T::MaxInRatio::get() - } - - fn get_max_out_ratio() -> u128 { - T::MaxOutRatio::get() - } - - fn get_fee(_pool_account_id: &T::AccountId) -> (u32, u32) { - T::GetExchangeFee::get() - } -} - -pub struct AllowAllPools(); - -impl CanCreatePool for AllowAllPools { - fn can_create(_asset_a: AssetId, _asset_b: AssetId) -> bool { - true - } -} - -impl AMMPosition for Pallet { - type Error = DispatchError; - - fn get_liquidity_behind_shares( - asset_a: AssetId, - asset_b: AssetId, - shares_amount: Balance, - ) -> Result<(Balance, Balance), Self::Error> { - let asset_pair = AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }; - - let pair_account = Self::get_pair_id(asset_pair); - - let total_shares = Self::total_liquidity(&pair_account); - - let asset_a_reserve = T::Currency::free_balance(asset_a, &pair_account); - let asset_b_reserve = T::Currency::free_balance(asset_b, &pair_account); - - hydra_dx_math::xyk::calculate_liquidity_out(asset_a_reserve, asset_b_reserve, shares_amount, total_shares) - .map_err(|_| Error::::RemoveAssetAmountInvalid.into()) - } -} diff --git a/pallets/xyk/src/tests/amm_position.rs b/pallets/xyk/src/tests/amm_position.rs deleted file mode 100644 index 65196d4d306..00000000000 --- a/pallets/xyk/src/tests/amm_position.rs +++ /dev/null @@ -1,53 +0,0 @@ -use super::mock::*; -use crate::types::AssetPair; -use crate::*; -use frame_support::assert_ok; - -#[test] -fn get_liquidity_behind_shares_should_return_both_assets_value_when_pool_exists() { - let asset_a = ACA; - let asset_b = DOT; - - ExtBuilder::default() - .with_accounts(vec![(ALICE, asset_a, 1_000 * ONE), (ALICE, asset_b, 1_000 * ONE)]) - .build() - .execute_with(|| { - //arange - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 100 * ONE, - asset_b, - 10 * ONE - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - let share_token = XYK::share_token(pair_account); - - let shares_amount = Currency::free_balance(share_token, &ALICE); - - assert_eq!( - XYK::get_liquidity_behind_shares(asset_a, asset_b, shares_amount).unwrap(), - (100 * ONE, 10 * ONE) - ); - - assert_eq!( - XYK::get_liquidity_behind_shares(asset_b, asset_a, shares_amount).unwrap(), - (10 * ONE, 100 * ONE) - ); - - assert_eq!( - XYK::get_liquidity_behind_shares(asset_b, asset_a, shares_amount / 2).unwrap(), - (5 * ONE, 50 * ONE) - ); - - assert_eq!( - XYK::get_liquidity_behind_shares(asset_a, asset_b, shares_amount / 2).unwrap(), - (50 * ONE, 5 * ONE) - ); - }); -} diff --git a/pallets/xyk/src/tests/creation.rs b/pallets/xyk/src/tests/creation.rs deleted file mode 100644 index cfe47439b8b..00000000000 --- a/pallets/xyk/src/tests/creation.rs +++ /dev/null @@ -1,425 +0,0 @@ -pub use super::mock::*; -use crate::{Error, Event}; -use frame_support::{assert_noop, assert_ok, BoundedVec}; -use pallet_asset_registry::traits::Registry; -use hydradx_traits::AMM as AmmPool; -use orml_traits::MultiCurrency; -use pallet_asset_registry::AssetType; -use sp_std::convert::TryInto; - -use crate::types::AssetPair; - -#[test] -fn create_pool_should_work() { - new_test_ext().execute_with(|| { - let asset_a = HDX; - let asset_b = ACA; - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 100_000_000_000_000, - asset_b, - 10 * 100_000_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(XYK::get_pool_assets(&pair_account), Some(vec![asset_a, asset_b])); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 100000000000000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 1000000000000000); - assert_eq!(Currency::free_balance(asset_a, &ALICE), 900000000000000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 0); - assert_eq!(Currency::free_balance(share_token, &ALICE), 100000000000000); - assert_eq!(XYK::total_liquidity(pair_account), 100000000000000); - - let name: Vec = vec![232, 3, 0, 0, 72, 68, 84, 184, 11, 0, 0]; - let bounded_name: BoundedVec::StringLimit> = - name.try_into().unwrap(); - - expect_events(vec![ - pallet_asset_registry::Event::Registered { - asset_id: share_token, - asset_name: bounded_name, - asset_type: AssetType::PoolShare(HDX, ACA), - } - .into(), - Event::PoolCreated { - who: ALICE, - asset_a, - asset_b, - initial_shares_amount: 100000000000000, - share_token, - pool: pair_account, - } - .into(), - frame_system::Event::NewAccount { account: pair_account }.into(), - orml_tokens::Event::Endowed { - currency_id: asset_a, - who: pair_account, - amount: 100000000000000, - } - .into(), - orml_tokens::Event::Endowed { - currency_id: asset_b, - who: pair_account, - amount: 1000000000000000, - } - .into(), - orml_tokens::Event::Endowed { - currency_id: share_token, - who: ALICE, - amount: 100000000000000, - } - .into(), - ]); - }); -} - -#[test] -fn create_same_pool_should_not_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = HDX; - let asset_b = ACA; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_b, - 1000, - asset_a, - 2000, - )); - assert_noop!( - XYK::create_pool(RuntimeOrigin::signed(user), asset_b, 999, asset_a, 2 * 999), - Error::::InsufficientLiquidity - ); - assert_noop!( - XYK::create_pool(RuntimeOrigin::signed(user), asset_b, 1000, asset_a, 0), - Error::::InsufficientLiquidity - ); - assert_noop!( - XYK::create_pool(RuntimeOrigin::signed(user), asset_a, 1000, asset_a, 2000), - Error::::CannotCreatePoolWithSameAssets - ); - assert_noop!( - XYK::create_pool(RuntimeOrigin::signed(user), asset_b, 1000, asset_a, 2000), - Error::::TokenPoolAlreadyExists - ); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - expect_events(vec![Event::PoolCreated { - who: ALICE, - asset_a: asset_b, - asset_b: asset_a, - initial_shares_amount: 2000, - share_token, - pool: pair_account, - } - .into()]); - }); -} - -#[test] -fn create_pool_with_insufficient_balance_should_not_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = HDX; - - assert_noop!( - XYK::create_pool( - RuntimeOrigin::signed(user), - 4000, - 100_000_000_000_000, - asset_a, - 10 * 100_000_000_000_000, - ), - Error::::InsufficientAssetBalance - ); - - assert_noop!( - XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 100_000_000_000_000, - 4000, - 10 * 100_000_000_000_000, - ), - Error::::InsufficientAssetBalance - ); - }); -} - -#[test] -fn create_pool_with_insufficient_liquidity_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - XYK::create_pool(RuntimeOrigin::signed(ALICE), ACA, 500, HDX, 5000), - Error::::InsufficientLiquidity - ); - - assert_noop!( - XYK::create_pool(RuntimeOrigin::signed(ALICE), ACA, 5000, HDX, 500), - Error::::InsufficientLiquidity - ); - }); -} - -#[test] -fn create_pool_small_fixed_point_amount_should_work() { - new_test_ext().execute_with(|| { - let asset_a = HDX; - let asset_b = ACA; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 100_000_000_000_000, - asset_b, - 1_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 100000000000000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 1000000000); - assert_eq!(Currency::free_balance(asset_a, &ALICE), 900000000000000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 999999000000000); - assert_eq!(Currency::free_balance(share_token, &ALICE), 100000000000000); - assert_eq!(XYK::total_liquidity(pair_account), 100000000000000); - - expect_events(vec![Event::PoolCreated { - who: ALICE, - asset_a, - asset_b, - initial_shares_amount: 100000000000000, - share_token, - pool: pair_account, - } - .into()]); - }); -} - -#[test] -fn destroy_pool_on_remove_liquidity_and_recreate_should_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = HDX; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 100_000_000, - asset_b, - 1_000_000_000_000, - )); - - let asset_pair = AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }; - - let pair_account = XYK::get_pair_id(asset_pair); - let share_token = XYK::share_token(pair_account); - - assert!(XYK::exists(asset_pair)); - - assert_ok!(XYK::remove_liquidity( - RuntimeOrigin::signed(user), - asset_a, - asset_b, - 100_000_000 - )); - - assert_eq!(XYK::total_liquidity(pair_account), 0); - - assert!(!XYK::exists(asset_pair)); - - // It should be possible to recreate the pool again - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 100_000_000, - asset_b, - 1_000_000_000_000 - )); - - expect_events(vec![ - Event::PoolCreated { - who: user, - asset_a, - asset_b, - initial_shares_amount: 100_000_000, - share_token, - pool: pair_account, - } - .into(), - frame_system::Event::KilledAccount { account: pair_account }.into(), - Event::LiquidityRemoved { - who: user, - asset_a, - asset_b, - shares: 100_000_000, - } - .into(), - Event::PoolDestroyed { - who: user, - asset_a, - asset_b, - share_token, - pool: pair_account, - } - .into(), - frame_system::Event::NewAccount { account: pair_account }.into(), - orml_tokens::Event::Endowed { - currency_id: asset_a, - who: pair_account, - amount: 100000000, - } - .into(), - orml_tokens::Event::Endowed { - currency_id: asset_b, - who: pair_account, - amount: 1000000000000, - } - .into(), - orml_tokens::Event::Endowed { - currency_id: share_token, - who: ALICE, - amount: 100000000, - } - .into(), - Event::PoolCreated { - who: user, - asset_a, - asset_b, - initial_shares_amount: 100_000_000, - share_token, - pool: pair_account, - } - .into(), - ]); - }); -} - -#[test] -fn create_pool_with_same_assets_should_not_be_allowed() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = HDX; - - assert_noop!( - XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 100_000_000, - asset_a, - 100_000_000_000_000_000_000 - ), - Error::::CannotCreatePoolWithSameAssets - ); - }) -} - -#[test] -fn can_create_pool_should_work() { - new_test_ext().execute_with(|| { - let asset_a = 10u32; - let asset_b = 10u32; - assert_noop!( - XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 100_000_000_000_000, - asset_b, - 1_000_000_000_000_000, - ), - Error::::CannotCreatePool - ); - }); -} - -#[test] -fn share_asset_id_should_be_offset() { - // Check that pools are created correctly with offset IDs. - new_test_ext().execute_with(|| { - // Arrange - let asset_pair = AssetPair { - asset_in: HDX, - asset_out: ACA, - }; - - // Next available asset id within the range of reserved IDs - let next_asset_id = AssetRegistry::next_asset_id() - .unwrap() - .checked_sub(::SequentialIdStartAt::get()) - .unwrap(); - - // Register the share token within the range of reserved IDs. - // This is how share tokens were registered before the offset was introduced. - assert_ok!(AssetRegistry::register( - RuntimeOrigin::signed(ALICE), - asset_pair.name(), - AssetType::PoolShare(HDX, ACA), - ::MinPoolLiquidity::get(), - Some(next_asset_id), - None, - None, - None, - )); - - // Create_pool doesn't register new share token if it already exists - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - HDX, - 100_000_000_000_000, - ACA, - 10 * 100_000_000_000_000, - )); - - let pair_account = XYK::get_pair_id(asset_pair); - let share_token = XYK::share_token(pair_account); - - assert_eq!(share_token, next_asset_id); - assert_eq!(AssetRegistry::retrieve_asset(&asset_pair.name()).unwrap(), share_token); - - // Act - let next_asset_id = AssetRegistry::next_asset_id().unwrap(); - - // Create new pool. The share token should be created with offset ID. - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - HDX, - 100_000_000_000_000, - DOT, - 10 * 100_000_000_000_000, - )); - - let asset_pair = AssetPair { - asset_in: HDX, - asset_out: DOT, - }; - - let pair_account = XYK::get_pair_id(asset_pair); - let share_token = XYK::share_token(pair_account); - - // Assert - assert_eq!(share_token, next_asset_id); - assert_eq!(AssetRegistry::retrieve_asset(&asset_pair.name()).unwrap(), share_token); - }); -} diff --git a/pallets/xyk/src/tests/fees.rs b/pallets/xyk/src/tests/fees.rs deleted file mode 100644 index 49937e3a8a5..00000000000 --- a/pallets/xyk/src/tests/fees.rs +++ /dev/null @@ -1,498 +0,0 @@ -pub use super::mock::*; -use crate::{Error, Event}; -use frame_support::{assert_noop, assert_ok}; -use hydradx_traits::AMM as AmmPool; -use orml_traits::MultiCurrency; - -use crate::types::AssetPair; - -#[test] -fn fee_calculation() { - ExtBuilder::default().build().execute_with(|| { - assert_eq!(XYK::calculate_fee(100_000), Ok(200)); - assert_eq!(XYK::calculate_fee(10_000), Ok(20)); - - assert_eq!(XYK::calculate_discounted_fee(9_999), Ok(0)); - assert_eq!(XYK::calculate_discounted_fee(10_000), Ok(7)); - assert_eq!(XYK::calculate_discounted_fee(100_000), Ok(70)); - }); - ExtBuilder::default() - .with_exchange_fee((10, 1000)) - .with_discounted_fee((10, 1000)) - .build() - .execute_with(|| { - assert_eq!(XYK::calculate_fee(100_000), Ok(1_000)); - assert_eq!(XYK::calculate_fee(10_000), Ok(100)); - - assert_eq!(XYK::calculate_discounted_fee(999), Ok(0)); - assert_eq!(XYK::calculate_discounted_fee(1_000), Ok(10)); - assert_eq!(XYK::calculate_discounted_fee(10_000), Ok(100)); - }); - - ExtBuilder::default() - .with_exchange_fee((10, 0)) - .build() - .execute_with(|| { - assert_eq!(XYK::calculate_fee(100000), Ok(0)); - }); - - ExtBuilder::default() - .with_exchange_fee((10, 1)) - .build() - .execute_with(|| { - assert_noop!(XYK::calculate_fee(u128::MAX), Error::::FeeAmountInvalid); - }); -} - -#[test] -fn get_fee_should_work() { - new_test_ext().execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - HDX, - 1_000_000_000, - DOT, - 2_000_000_000, - )); - - // existing pool - let fee = XYK::get_fee(&HDX_DOT_POOL_ID); - assert_eq!(fee, (2, 1_000)); - // non existing pool - let fee = XYK::get_fee(&1_234); - assert_eq!(fee, (2, 1_000)); - }); -} - -#[test] -fn discount_sell_fees_should_work() { - let accounts = vec![ - (ALICE, HDX, 1_000_000_000_000_000u128), - (ALICE, ACA, 1_000_000_000_000_000u128), - (ALICE, DOT, 1_000_000_000_000_000u128), - ]; - - let asset_a = ACA; - let asset_b = DOT; - - let mut ext: sp_io::TestExternalities = ExtBuilder::default().with_accounts(accounts.clone()).build(); - ext.execute_with(|| System::set_block_number(1)); - ext.execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 1_000_000_000_000, - HDX, - 2_000_000_000_000, - )); - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 200_000_000_000_000, - asset_b, - 400_000_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let native_pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: HDX, - }); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); - assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &ALICE), 998_000_000_000_000); - - assert_ok!(XYK::sell( - RuntimeOrigin::signed(ALICE), - asset_a, - asset_b, - 10_000_000, - 1_500, - true, - )); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_010_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 399_999_980_013_994); - assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 798_999_990_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_019_986_006); - assert_eq!(Currency::free_balance(HDX, &ALICE), 997_999_999_972_014); - - expect_events(vec![Event::SellExecuted { - who: ALICE, - asset_in: asset_a, - asset_out: asset_b, - amount: 10_000_000, - sale_price: 19_986_006, - fee_asset: asset_b, - fee_amount: 13_993, - pool: pair_account, - } - .into()]); - }); - - // 0.1% discount fee - let mut ext: sp_io::TestExternalities = ExtBuilder::default() - .with_accounts(accounts.clone()) - .with_discounted_fee((10, 10_000)) - .build(); - ext.execute_with(|| System::set_block_number(1)); - ext.execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 1_000_000_000_000, - HDX, - 2_000_000_000_000, - )); - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 200_000_000_000_000, - asset_b, - 400_000_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let native_pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: HDX, - }); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); - assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &ALICE), 998_000_000_000_000); - - assert_ok!(XYK::sell( - RuntimeOrigin::signed(ALICE), - asset_a, - asset_b, - 10_000_000, - 1_500, - true, - )); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_010_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 399_999_980_019_991); - assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 798_999_990_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_019_980_009); - assert_eq!(Currency::free_balance(HDX, &ALICE), 997_999_999_960_020); - - expect_events(vec![Event::SellExecuted { - who: ALICE, - asset_in: asset_a, - asset_out: asset_b, - amount: 10_000_000, - sale_price: 19_980_009, - fee_asset: asset_b, - fee_amount: 19_990, - pool: pair_account, - } - .into()]); - }); - - // zero discount fee - let mut ext: sp_io::TestExternalities = ExtBuilder::default() - .with_accounts(accounts) - .with_discounted_fee((0, 0)) - .build(); - ext.execute_with(|| System::set_block_number(1)); - ext.execute_with(|| { - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 1_000_000_000_000, - HDX, - 2_000_000_000_000, - )); - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 200_000_000_000_000, - asset_b, - 400_000_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); - - assert_ok!(XYK::sell( - RuntimeOrigin::signed(ALICE), - asset_a, - asset_b, - 10_000_000, - 1_500, - true, - )); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_010_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 399_999_980_000_001); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 798_999_990_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_019_999_999); - - expect_events(vec![Event::SellExecuted { - who: ALICE, - asset_in: asset_a, - asset_out: asset_b, - amount: 10_000_000, - sale_price: 19_999_999, - fee_asset: asset_b, - fee_amount: 0, - pool: pair_account, - } - .into()]); - }); -} - -#[test] -fn discount_buy_fees_should_work() { - let accounts = vec![ - (ALICE, HDX, 1_000_000_000_000_000u128), - (ALICE, ACA, 1_000_000_000_000_000u128), - (ALICE, DOT, 1_000_000_000_000_000u128), - ]; - - let asset_a = ACA; - let asset_b = DOT; - - let mut ext: sp_io::TestExternalities = ExtBuilder::default().with_accounts(accounts.clone()).build(); - ext.execute_with(|| System::set_block_number(1)); - ext.execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 1_000_000_000_000, - HDX, - 2_000_000_000_000, - )); - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 200_000_000_000_000, - asset_b, - 400_000_000_000_000, - )); - - let native_pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: HDX, - }); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); - assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &ALICE), 998_000_000_000_000); - - assert_ok!(XYK::buy( - RuntimeOrigin::signed(ALICE), - asset_a, - asset_b, - 10_000_000, - 1_000_000_000_000, - true, - )); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 199_999_990_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_020_014_002); - assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_010_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 599_999_979_985_998); // compare to values in previous test to see difference! - assert_eq!(Currency::free_balance(HDX, &ALICE), 997_999_999_972_000); - - expect_events(vec![Event::BuyExecuted { - who: ALICE, - asset_out: asset_a, - asset_in: asset_b, - amount: 10_000_000, - buy_price: 20_000_002, - fee_asset: asset_b, - fee_amount: 14_000, - pool: pair_account, - } - .into()]); - }); - - // 0.1% discount fee - let mut ext: sp_io::TestExternalities = ExtBuilder::default() - .with_accounts(accounts.clone()) - .with_discounted_fee((10, 10_000)) - .build(); - ext.execute_with(|| System::set_block_number(1)); - ext.execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 1_000_000_000_000, - HDX, - 2_000_000_000_000, - )); - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 200_000_000_000_000, - asset_b, - 400_000_000_000_000, - )); - - let native_pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: HDX, - }); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); - assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &ALICE), 998_000_000_000_000); - - assert_ok!(XYK::buy( - RuntimeOrigin::signed(ALICE), - asset_a, - asset_b, - 10_000_000, - 1_000_000_000_000, - true, - )); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 199_999_990_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_020_020_002); - assert_eq!(Currency::free_balance(asset_a, &native_pair_account), 1_000_000_000_000); - assert_eq!(Currency::free_balance(HDX, &native_pair_account), 2_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_010_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 599_999_979_979_998); // compare to values in previous test to see difference! - assert_eq!(Currency::free_balance(HDX, &ALICE), 997_999_999_960_000); - - expect_events(vec![Event::BuyExecuted { - who: ALICE, - asset_out: asset_a, - asset_in: asset_b, - amount: 10_000_000, - buy_price: 20_000_002, - fee_asset: asset_b, - fee_amount: 20_000, - pool: pair_account, - } - .into()]); - }); - - // zero discount fee - let mut ext: sp_io::TestExternalities = ExtBuilder::default() - .with_accounts(accounts) - .with_discounted_fee((0, 0)) - .build(); - ext.execute_with(|| System::set_block_number(1)); - ext.execute_with(|| { - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 1_000_000_000_000, - HDX, - 2_000_000_000_000, - )); - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 200_000_000_000_000, - asset_b, - 400_000_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 600_000_000_000_000); - - assert_ok!(XYK::buy( - RuntimeOrigin::signed(ALICE), - asset_a, - asset_b, - 10_000_000, - 1_000_000_000, - true, - )); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 199_999_990_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 400_000_020_000_002); - - assert_eq!(Currency::free_balance(asset_a, &ALICE), 799_000_010_000_000); - assert_eq!(Currency::free_balance(asset_b, &ALICE), 599_999_979_999_998); - - expect_events(vec![Event::BuyExecuted { - who: ALICE, - asset_out: asset_a, - asset_in: asset_b, - amount: 10_000_000, - buy_price: 20_000_002, - fee_asset: asset_b, - fee_amount: 0, - pool: pair_account, - } - .into()]); - }); -} diff --git a/pallets/xyk/src/tests/invariants.rs b/pallets/xyk/src/tests/invariants.rs deleted file mode 100644 index f552e7598df..00000000000 --- a/pallets/xyk/src/tests/invariants.rs +++ /dev/null @@ -1,560 +0,0 @@ -use super::mock::*; -use crate::*; - -use proptest::prelude::*; - -use frame_support::assert_ok; -use primitive_types::U256; -use sp_runtime::{FixedPointNumber, FixedU128}; - -const TOLERANCE: Balance = 1_000; - -#[macro_export] -macro_rules! assert_eq_approx { - ( $x:expr, $y:expr, $z:expr, $r:expr) => {{ - let diff = if $x >= $y { $x - $y } else { $y - $x }; - if diff > $z { - panic!("\n{} not equal\n left: {:?}\nright: {:?}\n", $r, $x, $y); - } - }}; -} - -fn asset_reserve() -> impl Strategy { - 1000 * ONE..10_000_000 * ONE -} - -fn trade_amount() -> impl Strategy { - ONE..100 * ONE -} - -fn price() -> impl Strategy { - 0.1f64..2f64 -} - -fn assert_asset_invariant( - old_state: (Balance, Balance), - new_state: (Balance, Balance), - tolerance: FixedU128, - desc: &str, -) { - let new_s = U256::from(new_state.0) * U256::from(new_state.1); - let s1 = new_s.integer_sqrt(); - - let old_s = U256::from(old_state.0) * U256::from(old_state.1); - let s2 = old_s.integer_sqrt(); - - assert!(new_s >= old_s, "Invariant decreased for {desc}"); - - let s1_u128 = Balance::try_from(s1).unwrap(); - let s2_u128 = Balance::try_from(s2).unwrap(); - - let invariant = FixedU128::from((s1_u128, ONE)) / FixedU128::from((s2_u128, ONE)); - assert_eq_approx!(invariant, FixedU128::from(1u128), tolerance, desc); -} - -proptest! { - #![proptest_config(ProptestConfig::with_cases(1000))] - #[test] - fn add_liquidity(initial_liquidity in asset_reserve(), - added_liquidity in asset_reserve(), - price in price(), - ) { - let asset_a = HDX; - let asset_b = DOT; - - ExtBuilder::default() - .with_exchange_fee((0, 0)) - .with_accounts(vec![ - (ALICE, asset_a,initial_liquidity), - (ALICE, asset_b,initial_liquidity * 1000), - (BOB, asset_a, added_liquidity), - (BOB, asset_b, added_liquidity * 1_000_000), - ]) - .build() - .execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - initial_liquidity, - asset_b, - FixedU128::from_float(price).saturating_mul_int(initial_liquidity), - )); - - let pool_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pool_account); - - let pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - let bob_balance_a = Currency::free_balance(asset_a, &BOB); - let bob_balance_b = Currency::free_balance(asset_b, &BOB); - - let issuance = XYK::total_liquidity(pool_account); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(BOB), - asset_a, - asset_b, - added_liquidity, - added_liquidity * 1_000_000, // do not care about the limit here - )); - - let new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - let new_bob_balance_a = Currency::free_balance(asset_a, &BOB); - let new_bob_balance_b = Currency::free_balance(asset_b, &BOB); - - let bob_shares = Currency::free_balance(share_token, &BOB); - - let p0 = FixedU128::from((pool_balance_a, pool_balance_b)); - let p1 = FixedU128::from((new_pool_balance_a, new_pool_balance_b)); - - // Price should not change - assert_eq_approx!( - p0, - p1, - FixedU128::from_float(0.0000000001), - "Price has changed after add liquidity" - ); - - // The following must hold when adding liquidity. - // delta_S / S <= delta_X / X - // delta_S / S <= delta_Y / Y - // where S is total share issuance, X is asset a and Y is asset b - - let s = U256::from(issuance); - let delta_s = U256::from(bob_shares); - let delta_x = U256::from(bob_balance_a - new_bob_balance_a); - let delta_y = U256::from(bob_balance_b - new_bob_balance_b); - let x = U256::from(pool_balance_a); - let y = U256::from(pool_balance_b); - - let left = delta_s * x; - let right = s * delta_x; - - assert!(left <= right); - - let l = FixedU128::from((bob_shares, issuance)); - let r = FixedU128::from((bob_balance_a - new_bob_balance_a, pool_balance_a)); - - let diff = r - l; - - assert!(diff <= FixedU128::from_float(0.000000001)); - - let left = delta_s * y; - let right = s * delta_y; - - assert!(left <= right); - - let l = FixedU128::from((bob_shares, issuance)); - let r = FixedU128::from((bob_balance_b - new_bob_balance_b, pool_balance_b)); - - let diff = r - l; - - assert!(diff <= FixedU128::from_float(0.000000001)); - }); - } -} - -proptest! { - #![proptest_config(ProptestConfig::with_cases(1000))] - #[test] - fn remove_liquidity(initial_liquidity in asset_reserve(), - added_liquidity in asset_reserve(), - price in price(), - ) { - let asset_a = HDX; - let asset_b = DOT; - - ExtBuilder::default() - .with_exchange_fee((0, 0)) - .with_accounts(vec![ - (ALICE, asset_a,initial_liquidity), - (ALICE, asset_b,initial_liquidity * 1000), - (BOB, asset_a, added_liquidity), - (BOB, asset_b, added_liquidity * 1_000_000), - ]) - .build() - .execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - initial_liquidity, - asset_b, - FixedU128::from_float(price).saturating_mul_int(initial_liquidity), - )); - - let pool_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pool_account); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(BOB), - asset_a, - asset_b, - added_liquidity, - added_liquidity * 1_000_000, // do not care about the limit here - )); - let pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - let bob_balance_a = Currency::free_balance(asset_a, &BOB); - let bob_balance_b = Currency::free_balance(asset_b, &BOB); - - let bob_shares = Currency::free_balance(share_token, &BOB); - - let issuance = XYK::total_liquidity(pool_account); - - assert_ok!(XYK::remove_liquidity( - RuntimeOrigin::signed(BOB), - asset_a, - asset_b, - bob_shares, - )); - - let new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - let new_bob_balance_a = Currency::free_balance(asset_a, &BOB); - let new_bob_balance_b = Currency::free_balance(asset_b, &BOB); - - let p0 = FixedU128::from((pool_balance_a, pool_balance_b)); - let p1 = FixedU128::from((new_pool_balance_a, new_pool_balance_b)); - - // Price should not change - assert_eq_approx!( - p0, - p1, - FixedU128::from_float(0.0000000001), - "Price has changed after remove liquidity" - ); - - let s = U256::from(issuance); - let delta_s = U256::from(bob_shares); - let delta_x = U256::from(new_bob_balance_a - bob_balance_a); - let delta_y = U256::from(new_bob_balance_b - bob_balance_b); - let x = U256::from(pool_balance_a); - let y = U256::from(pool_balance_b); - - let left = delta_s * x; - let right = s * delta_x; - - assert!(left >= right); - - let l = FixedU128::from((bob_shares, issuance)); - let r = FixedU128::from((new_bob_balance_a - bob_balance_a, pool_balance_a)); - - let diff = l - r; - - assert!(diff <= FixedU128::from_float(0.000000001)); - - let left = delta_s * y; - let right = s * delta_y; - - assert!(left >= right); - - let l = FixedU128::from((bob_shares, issuance)); - let r = FixedU128::from((new_bob_balance_b - bob_balance_b, pool_balance_b)); - - let diff = l - r; - - assert!(diff <= FixedU128::from_float(0.000000001)) - }); - } -} - -proptest! { - #![proptest_config(ProptestConfig::with_cases(1000))] - #[test] - fn sell_invariant(initial_liquidity in asset_reserve(), - added_liquidity in asset_reserve(), - amount in trade_amount(), - price in price(), - ) { - let asset_a = HDX; - let asset_b = DOT; - - ExtBuilder::default() - .with_exchange_fee((0, 0)) - .with_accounts(vec![ - (ALICE, asset_a,initial_liquidity), - (ALICE, asset_b,initial_liquidity * 1000), - (BOB, asset_a, added_liquidity), - (BOB, asset_b, added_liquidity * 1_000_000), - (CHARLIE, asset_a, amount), - ]) - .build() - .execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - initial_liquidity, - asset_b, - FixedU128::from_float(price).saturating_mul_int(initial_liquidity), - )); - - let pool_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(BOB), - asset_a, - asset_b, - added_liquidity, - added_liquidity * 1_000_000, // do not care about the limit here - )); - let pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - assert_ok!(XYK::sell( - RuntimeOrigin::signed(CHARLIE), - asset_a, - asset_b, - amount, - 0u128, // limit not interesting here, - false, - )); - - let new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - assert_asset_invariant((pool_balance_a, pool_balance_b), - (new_pool_balance_a, new_pool_balance_b), - FixedU128::from((TOLERANCE,ONE)), - "sell" - ); - - }); - } -} - -proptest! { - #![proptest_config(ProptestConfig::with_cases(1000))] - #[test] - fn buy_invariant(initial_liquidity in asset_reserve(), - added_liquidity in asset_reserve(), - amount in trade_amount(), - price in price(), - ) { - let asset_a = ACA; - let asset_b = DOT; - - ExtBuilder::default() - .with_exchange_fee((0, 0)) - .with_accounts(vec![ - (ALICE, asset_a,initial_liquidity * 1000), - (ALICE, HDX,initial_liquidity), - (ALICE, asset_b,initial_liquidity * 1000), - (BOB, asset_a, added_liquidity), - (BOB, asset_b, added_liquidity * 1_000_000), - (CHARLIE, asset_a, amount * 1_000), - (CHARLIE, HDX, amount * 1_000), - ]) - .build() - .execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - initial_liquidity, - asset_b, - FixedU128::from_float(price).saturating_mul_int(initial_liquidity), - )); - - let pool_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(BOB), - asset_a, - asset_b, - added_liquidity, - added_liquidity * 1_000_000, // do not care about the limit here - )); - let pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - assert_ok!(XYK::buy( - RuntimeOrigin::signed(CHARLIE), - asset_b, - asset_a, - amount, - u128::MAX, // limit not interesting here, - false, - )); - - let new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - assert_asset_invariant((pool_balance_a, pool_balance_b), - (new_pool_balance_a, new_pool_balance_b), - FixedU128::from((TOLERANCE,ONE)), - "buy" - ); - - }); - } -} - -proptest! { - #![proptest_config(ProptestConfig::with_cases(1000))] - #[test] - fn buy_invariant_with_discount(initial_liquidity in asset_reserve(), - added_liquidity in asset_reserve(), - amount in trade_amount(), - price in price(), - ) { - let asset_a = ACA; - let asset_b = DOT; - - ExtBuilder::default() - .with_exchange_fee((0, 0)) - .with_discounted_fee((0,0)) - .with_accounts(vec![ - (ALICE, asset_a,initial_liquidity * 1000), - (ALICE, HDX,initial_liquidity), - (ALICE, asset_b,initial_liquidity * 1000), - (BOB, asset_a, added_liquidity), - (BOB, asset_b, added_liquidity * 1_000_000), - (CHARLIE, asset_a, amount * 1_000), - (CHARLIE, HDX, amount * 1_000), - ]) - .build() - .execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - initial_liquidity, - asset_b, - FixedU128::from_float(price).saturating_mul_int(initial_liquidity), - )); - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_b, - 10 * ONE, - HDX, - 10 * ONE, - )); - - let pool_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(BOB), - asset_a, - asset_b, - added_liquidity, - added_liquidity * 1_000_000, // do not care about the limit here - )); - let _pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let _pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - assert_ok!(XYK::buy( - RuntimeOrigin::signed(CHARLIE), - asset_b, - asset_a, - amount, - u128::MAX, // limit not interesting here, - true, - )); - - let _new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let _new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - assert_asset_invariant((_pool_balance_a, _pool_balance_b), - (_new_pool_balance_a, _new_pool_balance_b), - FixedU128::from((TOLERANCE,ONE)), - "buy with discount" - ); - }); - } -} - -proptest! { - #![proptest_config(ProptestConfig::with_cases(1000))] - #[test] - fn sell_invariant_with_discount(initial_liquidity in asset_reserve(), - added_liquidity in asset_reserve(), - amount in trade_amount(), - price in price(), - ) { - let asset_a = ACA; - let asset_b = DOT; - - ExtBuilder::default() - .with_exchange_fee((0, 0)) - .with_discounted_fee((0,0)) - .with_accounts(vec![ - (ALICE, asset_a,initial_liquidity * 1000), - (ALICE, HDX,initial_liquidity), - (ALICE, asset_b,initial_liquidity * 1000), - (BOB, asset_a, added_liquidity), - (BOB, asset_b, added_liquidity * 1_000_000), - (CHARLIE, asset_a, amount * 1_000), - (CHARLIE, HDX, amount * 1_000), - ]) - .build() - .execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - initial_liquidity, - asset_b, - FixedU128::from_float(price).saturating_mul_int(initial_liquidity), - )); - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 10 * ONE, - HDX, - 10 * ONE, - )); - - let pool_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(BOB), - asset_a, - asset_b, - added_liquidity, - added_liquidity * 1_000_000, // do not care about the limit here - )); - let _pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let _pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - assert_ok!(XYK::sell( - RuntimeOrigin::signed(CHARLIE), - asset_a, - asset_b, - amount, - 0u128, // limit not interesting here, - true, - )); - - let _new_pool_balance_a = Currency::free_balance(asset_a, &pool_account); - let _new_pool_balance_b = Currency::free_balance(asset_b, &pool_account); - - assert_asset_invariant((_pool_balance_a, _pool_balance_b), - (_new_pool_balance_a, _new_pool_balance_b), - FixedU128::from((TOLERANCE,ONE)), - "sell with discount" - ); - }); - } -} diff --git a/pallets/xyk/src/tests/liquidity.rs b/pallets/xyk/src/tests/liquidity.rs deleted file mode 100644 index efe0f7833ce..00000000000 --- a/pallets/xyk/src/tests/liquidity.rs +++ /dev/null @@ -1,689 +0,0 @@ -pub use super::mock::*; -use crate::types::{AssetPair, Balance}; -use crate::{Error, Event}; -use frame_support::{assert_noop, assert_ok}; -use hydradx_traits::AMM as AmmPool; -use orml_traits::MultiCurrency; - -#[test] -fn add_liquidity_should_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = DOT; - let asset_b = HDX; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 100_000_000, - asset_b, - 65_400_000 - )); - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(asset_b, &pair_account), 65_400_000); - assert_eq!(XYK::total_liquidity(pair_account), 65400000); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(user), - asset_a, - asset_b, - 400_000, - 1_000_000_000_000 - )); - - assert_eq!(Currency::free_balance(share_token, &user), 65661600); - - assert_eq!(Currency::free_balance(asset_b, &pair_account), 65_661_601); - assert_eq!(Currency::free_balance(asset_a, &pair_account), 100400000); - assert_eq!(Currency::free_balance(asset_a, &user), 999999899600000); - assert_eq!(XYK::total_liquidity(pair_account), 65661600); - - expect_events(vec![ - Event::PoolCreated { - who: ALICE, - asset_a, - asset_b, - initial_shares_amount: 65400000, - share_token, - pool: pair_account, - } - .into(), - Event::LiquidityAdded { - who: ALICE, - asset_a, - asset_b, - amount_a: 400000, - amount_b: 261601, - } - .into(), - ]); - }); -} - -#[test] -fn add_liquidity_mints_correct_shares() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = DOT; - let asset_b = HDX; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 100_000_000, - asset_b, - 65_400_000 - )); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(user), - asset_b, - asset_a, - 261600, - 1_000_000_000_000 - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(share_token, &user), 65661600); - }); -} - -#[test] -fn add_liquidity_as_another_user_should_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = HDX; - let asset_b = ACA; - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_b, - 100_000_000, - asset_a, - 1_000_000_000_000 - )); - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(user), - asset_b, - asset_a, - 400_000, - 1_000_000_000_000 - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 1004000000001); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 100400000); - assert_eq!(Currency::free_balance(asset_b, &user), 999999899600000); - assert_eq!(Currency::free_balance(share_token, &user), 1004000000000); - assert_eq!(XYK::total_liquidity(pair_account), 1004000000000); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(BOB), - asset_b, - asset_a, - 1_000_000, - 1_000_000_000_000 - )); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 1014000000002); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 101400000); - assert_eq!(Currency::free_balance(asset_b, &user), 999999899600000); - assert_eq!(Currency::free_balance(asset_b, &BOB), 999999999000000); - assert_eq!(Currency::free_balance(share_token, &user), 1004000000000); - assert_eq!(Currency::free_balance(share_token, &BOB), 10000000000); - assert_eq!(XYK::total_liquidity(pair_account), 1014000000000); - - expect_events(vec![ - Event::PoolCreated { - who: ALICE, - asset_a: asset_b, - asset_b: asset_a, - initial_shares_amount: 1000000000000, - share_token, - pool: pair_account, - } - .into(), - Event::LiquidityAdded { - who: ALICE, - asset_a: asset_b, - asset_b: asset_a, - amount_a: 400000, - amount_b: 4000000001, - } - .into(), - orml_tokens::Event::Endowed { - currency_id: share_token, - who: 2, - amount: 10000000000, - } - .into(), - Event::LiquidityAdded { - who: BOB, - asset_a: asset_b, - asset_b: asset_a, - amount_a: 1000000, - amount_b: 10000000001, - } - .into(), - ]); - }); -} - -#[test] -fn add_liquidity_should_work_when_limit_is_set_above_account_balance() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = DOT; - let asset_b = HDX; - let amount_b_max_limit = 2_000_000_000_000_000; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 100_000_000, - asset_b, - 100_000_000, - )); - - assert!(Currency::free_balance(asset_b, &user) < amount_b_max_limit); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(user), - asset_a, - asset_b, - 400_000, - amount_b_max_limit, - )); - }); -} - -#[test] -fn remove_liquidity_should_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = HDX; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 100_000_000, - asset_b, - 1_000_000_000_000 - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(share_token, &user), 100000000); - assert_eq!(Currency::free_balance(asset_a, &user), 999999900000000); - assert_eq!(Currency::free_balance(asset_a, &pair_account), 100000000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 1000000000000); - - assert_ok!(XYK::remove_liquidity( - RuntimeOrigin::signed(user), - asset_a, - asset_b, - 355_000 - )); - - assert_eq!(Currency::free_balance(asset_b, &pair_account), 996450000000); - assert_eq!(Currency::free_balance(asset_a, &user), 999999900355000); - - assert_eq!(Currency::free_balance(share_token, &user), 99645000); - assert_eq!(XYK::total_liquidity(pair_account), 99645000); - - expect_events(vec![ - Event::PoolCreated { - who: ALICE, - asset_a, - asset_b, - initial_shares_amount: 100000000, - share_token, - pool: pair_account, - } - .into(), - Event::LiquidityRemoved { - who: ALICE, - asset_a, - asset_b, - shares: 355_000, - } - .into(), - ]); - }); -} - -#[test] -fn remove_liquidity_without_shares_should_not_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = HDX; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 100_000_000, - asset_b, - 100_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - let shares = Currency::free_balance(share_token, &user); - - assert_ok!(Currency::transfer( - RuntimeOrigin::signed(ALICE), - BOB, - share_token, - shares - )); - - assert_noop!( - XYK::remove_liquidity(RuntimeOrigin::signed(user), asset_a, asset_b, 355_000), - Error::::InsufficientAssetBalance - ); - - expect_events(vec![ - Event::PoolCreated { - who: ALICE, - asset_a, - asset_b, - initial_shares_amount: 100000000, - share_token, - pool: pair_account, - } - .into(), - orml_tokens::Event::Endowed { - currency_id: share_token, - who: BOB, - amount: shares, - } - .into(), - orml_tokens::Event::Transfer { - currency_id: share_token, - from: ALICE, - to: BOB, - amount: shares, - } - .into(), - ]); - }); -} - -// events in the following test do not occur during standard chain operation -#[test] -fn remove_liquidity_from_reduced_pool_should_not_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = HDX; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 100_000_000, - asset_b, - 100_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - // remove some amount from the pool - assert_ok!(Currency::transfer( - RuntimeOrigin::signed(pair_account), - BOB, - asset_a, - 90_000_000 - )); - - assert_noop!( - XYK::remove_liquidity(RuntimeOrigin::signed(user), asset_a, asset_b, 200_000_000), - Error::::InsufficientLiquidity - ); - - // return it back to the pool - assert_ok!(Currency::transfer( - RuntimeOrigin::signed(BOB), - pair_account, - asset_a, - 90_000_000 - )); - // do it again with asset_b - assert_ok!(Currency::transfer( - RuntimeOrigin::signed(pair_account), - BOB, - asset_b, - 90_000_000 - )); - - assert_noop!( - XYK::remove_liquidity(RuntimeOrigin::signed(user), asset_a, asset_b, 200_000_000), - Error::::InsufficientLiquidity - ); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - expect_events(vec![ - Event::PoolCreated { - who: ALICE, - asset_a, - asset_b, - initial_shares_amount: 100000000, - share_token, - pool: pair_account, - } - .into(), - orml_tokens::Event::Transfer { - currency_id: asset_a, - from: pair_account, - to: BOB, - amount: 90_000_000, - } - .into(), - orml_tokens::Event::Transfer { - currency_id: asset_a, - from: BOB, - to: pair_account, - amount: 90_000_000, - } - .into(), - orml_tokens::Event::Transfer { - currency_id: asset_b, - from: pair_account, - to: BOB, - amount: 90_000_000, - } - .into(), - ]); - }); -} - -#[test] -fn add_liquidity_more_than_owner_should_not_work() { - new_test_ext().execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - HDX, - 200_000_000, - ACA, - 600_000_000_000_000, - )); - - assert_eq!(Currency::free_balance(ACA, &ALICE), 400_000_000_000_000); - - assert_noop!( - XYK::add_liquidity( - RuntimeOrigin::signed(ALICE), - HDX, - ACA, - 200_000_000_000_000_000, - 600_000_000 - ), - Error::::InsufficientAssetBalance - ); - - assert_noop!( - XYK::add_liquidity( - RuntimeOrigin::signed(ALICE), - HDX, - ACA, - 600_000_000, - 200_000_000_000_000_000 - ), - Error::::InsufficientAssetBalance - ); - }); -} - -#[test] -fn add_insufficient_liquidity_should_not_work() { - new_test_ext().execute_with(|| { - assert_ok!(XYK::create_pool(RuntimeOrigin::signed(ALICE), HDX, 1000, ACA, 1500,)); - - assert_noop!( - XYK::add_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 0, 0), - Error::::InsufficientTradingAmount - ); - - assert_noop!( - XYK::add_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 1000, 0), - Error::::ZeroLiquidity - ); - - assert_noop!( - XYK::add_liquidity(RuntimeOrigin::signed(BOB), ACA, HDX, 1000, 2000), - Error::::InsufficientLiquidity - ); - }); -} - -#[test] -fn add_liquidity_exceeding_max_limit_should_not_work() { - new_test_ext().execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - HDX, - 100_000_000_000_000, - ACA, - 100_000_000_000_000, - )); - - assert_noop!( - XYK::add_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 10_000_000, 1_000_000), - Error::::AssetAmountExceededLimit - ); - }); -} -#[test] -fn remove_liquidity_should_respect_min_pool_limit() { - new_test_ext().execute_with(|| { - assert_ok!(XYK::create_pool(RuntimeOrigin::signed(ALICE), HDX, 1000, ACA, 1500,)); - - assert_ok!(XYK::add_liquidity(RuntimeOrigin::signed(BOB), ACA, HDX, 2000, 2000)); - - assert_noop!( - XYK::remove_liquidity(RuntimeOrigin::signed(BOB), ACA, HDX, 500), - Error::::InsufficientLiquidity - ); - }); -} - -#[test] -fn remove_zero_liquidity_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - XYK::remove_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 0), - Error::::ZeroLiquidity - ); - }); -} - -#[test] -fn add_liquidity_to_non_existing_pool_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - XYK::add_liquidity( - RuntimeOrigin::signed(ALICE), - HDX, - ACA, - 200_000_000_000_000_000, - 600_000_000 - ), - Error::::TokenPoolNotFound - ); - }); -} - -#[test] -fn remove_zero_liquidity_from_non_existing_pool_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - XYK::remove_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 100), - Error::::TokenPoolNotFound - ); - }); -} - -#[test] -fn add_liquidity_overflow_work() { - let user = ALICE; - let asset_a = DOT; - let asset_b = HDX; - ExtBuilder::default() - .with_accounts(vec![(ALICE, DOT, Balance::MAX), (ALICE, HDX, Balance::MAX)]) - .build() - .execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 100_000, - asset_b, - 10_u128.pow(38) - )); - - assert_noop!( - XYK::add_liquidity( - RuntimeOrigin::signed(user), - asset_a, - asset_b, - 10_u128.pow(33), - 1_000_000_000_000 - ), - Error::::AddAssetAmountInvalid - ); - }); -} - -#[test] -fn share_ratio_calculations_are_correct() { - ExtBuilder::default() - .with_exchange_fee((0, 0)) - .build() - .execute_with(|| { - let asset_a = HDX; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - 100 * ONE, - asset_b, - 65_440_000_000_000, - )); - - assert_eq!(Currency::free_balance(asset_a, &BOB), 1_000 * ONE); - assert_eq!(Currency::free_balance(asset_b, &BOB), 1_000 * ONE); - - let balance_a = Currency::free_balance(asset_a, &BOB); - let balance_b = Currency::free_balance(asset_b, &BOB); - - let bob_initial_balance = balance_a + balance_b; - - assert_eq!(bob_initial_balance, 2000 * ONE); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(BOB), - asset_b, - asset_a, - 10 * ONE, - 200 * ONE - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - let expected_shares = 15_281_173_594_132u128; - - assert_eq!(Currency::free_balance(share_token, &BOB), expected_shares); - - assert_ok!(XYK::sell( - RuntimeOrigin::signed(CHARLIE), - asset_a, - asset_b, - 10 * ONE, - 0u128, - false, - )); - - assert_ok!(XYK::remove_liquidity( - RuntimeOrigin::signed(BOB), - asset_a, - asset_b, - expected_shares - )); - - assert_eq!(Currency::free_balance(share_token, &BOB), 0); - - for _ in 0..10 { - let balance_a = Currency::free_balance(asset_a, &BOB); - let balance_b = Currency::free_balance(asset_b, &BOB); - - let bob_previous_balance = balance_a + balance_b; - - let balance_pool_a = Currency::free_balance(asset_a, &pair_account); - let balance_pool_b = Currency::free_balance(asset_a, &pair_account); - - let initial_pool_liquidity = balance_pool_a + balance_pool_b; - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(BOB), - asset_b, - asset_a, - 10 * ONE, - 200 * ONE - )); - - let shares = Currency::free_balance(share_token, &BOB); - - assert_ok!(XYK::remove_liquidity( - RuntimeOrigin::signed(BOB), - asset_a, - asset_b, - shares - )); - let balance_a = Currency::free_balance(asset_a, &BOB); - let balance_b = Currency::free_balance(asset_b, &BOB); - let bob_new_balance = balance_a + balance_b; - - let balance_pool_a = Currency::free_balance(asset_a, &pair_account); - let balance_pool_b = Currency::free_balance(asset_a, &pair_account); - - let total_pool_liquidity = balance_pool_a + balance_pool_b; - - assert!(bob_new_balance <= bob_previous_balance); - assert!(initial_pool_liquidity <= total_pool_liquidity); - } - }); -} diff --git a/pallets/xyk/src/tests/mock.rs b/pallets/xyk/src/tests/mock.rs deleted file mode 100644 index e2211540d4b..00000000000 --- a/pallets/xyk/src/tests/mock.rs +++ /dev/null @@ -1,289 +0,0 @@ -// This file is part of HydraDX-node. - -// 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 as xyk; -use crate::Config; -use crate::*; -use frame_support::parameter_types; -use frame_system as system; -use orml_traits::parameter_type_with_key; -use sp_core::H256; -use sp_runtime::{ - traits::{BlakeTwo256, IdentityLookup, One}, - BuildStorage, -}; - -use crate::types::{AssetId, Balance}; -use frame_support::traits::{Everything, Get, Nothing}; -use hydradx_traits::{AssetPairAccountIdFor, CanCreatePool, Source}; - -use frame_system::EnsureSigned; -use hydradx_traits::pools::DustRemovalAccountWhitelist; -use std::cell::RefCell; - -pub type Amount = i128; -pub type AccountId = u64; - -pub const ALICE: AccountId = 1; -pub const BOB: AccountId = 2; -pub const CHARLIE: AccountId = 3; - -pub const HDX: AssetId = 1000; -pub const DOT: AssetId = 2000; -pub const ACA: AssetId = 3000; - -pub const HDX_DOT_POOL_ID: AccountId = 1_002_000; - -pub const ONE: Balance = 1_000_000_000_000; - -type Block = frame_system::mocking::MockBlock; - -frame_support::construct_runtime!( - pub enum Test - { - System: frame_system, - XYK: xyk, - Currency: orml_tokens, - AssetRegistry: pallet_asset_registry, - } - -); - -thread_local! { - static EXCHANGE_FEE: RefCell<(u32, u32)> = RefCell::new((2, 1_000)); - static DISCOUNTED_FEE: RefCell<(u32, u32)> = RefCell::new((7, 10_000)); - static MAX_OUT_RATIO: RefCell = RefCell::new(3); -} - -struct ExchangeFee; -impl Get<(u32, u32)> for ExchangeFee { - fn get() -> (u32, u32) { - EXCHANGE_FEE.with(|v| *v.borrow()) - } -} - -struct DiscountedFee; -impl Get<(u32, u32)> for DiscountedFee { - fn get() -> (u32, u32) { - DISCOUNTED_FEE.with(|v| *v.borrow()) - } -} - -struct MaximumOutRatio; -impl Get for MaximumOutRatio { - fn get() -> u128 { - MAX_OUT_RATIO.with(|v| *v.borrow()) - } -} - -parameter_types! { - pub const BlockHashCount: u64 = 250; - pub const SS58Prefix: u8 = 63; - pub const NativeAssetId: AssetId = HDX; - pub RegistryStringLimit: u32 = 100; - pub const SequentialIdOffset: u32 = 1_000_000; -} - -impl pallet_asset_registry::Config for Test { - type RuntimeEvent = RuntimeEvent; - type RegistryOrigin = EnsureSigned; - type AssetId = AssetId; - type Balance = Balance; - type AssetNativeLocation = u8; - type StringLimit = RegistryStringLimit; - type SequentialIdStartAt = SequentialIdOffset; - type NativeAssetId = NativeAssetId; - type WeightInfo = (); -} - -impl system::Config for Test { - type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - type RuntimeTask = RuntimeTask; - type Nonce = u64; - type Block = Block; - type Hash = H256; - type Hashing = BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type DbWeight = (); - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = (); - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; -} - -parameter_type_with_key! { - pub ExistentialDeposits: |_currency_id: AssetId| -> Balance { - One::one() - }; -} - -impl orml_tokens::Config for Test { - type RuntimeEvent = RuntimeEvent; - type Balance = Balance; - type Amount = Amount; - type CurrencyId = AssetId; - type WeightInfo = (); - type ExistentialDeposits = ExistentialDeposits; - type MaxLocks = (); - type DustRemovalWhitelist = Nothing; - type ReserveIdentifier = (); - type MaxReserves = (); - type CurrencyHooks = (); -} - -pub struct AssetPairAccountIdTest(); - -impl AssetPairAccountIdFor for AssetPairAccountIdTest { - fn from_assets(asset_a: AssetId, asset_b: AssetId, _: &str) -> u64 { - let mut a = asset_a as u128; - let mut b = asset_b as u128; - if a > b { - std::mem::swap(&mut a, &mut b) - } - (a * 1000 + b) as u64 - } -} - -parameter_types! { - pub const MinTradingLimit: Balance = 1_000; - pub const MinPoolLiquidity: Balance = 1_000; - pub const MaxInRatio: u128 = 3; - pub MaxOutRatio: u128 = MaximumOutRatio::get(); - pub ExchangeFeeRate: (u32, u32) = ExchangeFee::get(); - pub DiscountedFeeRate: (u32, u32) = DiscountedFee::get(); - pub const OracleSourceIdentifier: Source = *b"hydraxyk"; -} - -pub struct Disallow10_10Pool(); - -impl CanCreatePool for Disallow10_10Pool { - fn can_create(asset_a: AssetId, asset_b: AssetId) -> bool { - !matches!((asset_a, asset_b), (10u32, 10u32)) - } -} - -impl Config for Test { - type RuntimeEvent = RuntimeEvent; - type AssetRegistry = AssetRegistry; - type AssetPairAccountId = AssetPairAccountIdTest; - type Currency = Currency; - type NativeAssetId = NativeAssetId; - type WeightInfo = (); - type GetExchangeFee = ExchangeFeeRate; - type MinTradingLimit = MinTradingLimit; - type MinPoolLiquidity = MinPoolLiquidity; - type MaxInRatio = MaxInRatio; - type MaxOutRatio = MaxOutRatio; - type CanCreatePool = Disallow10_10Pool; - type AMMHandler = (); - type DiscountedFee = DiscountedFeeRate; - type NonDustableWhitelistHandler = Whitelist; - type OracleSource = OracleSourceIdentifier; -} - -pub struct ExtBuilder { - endowed_accounts: Vec<(AccountId, AssetId, Balance)>, -} - -// Returns default values for genesis config -impl Default for ExtBuilder { - fn default() -> Self { - Self { - endowed_accounts: vec![ - (ALICE, HDX, 1_000_000_000_000_000u128), - (BOB, HDX, 1_000_000_000_000_000u128), - (ALICE, ACA, 1_000_000_000_000_000u128), - (BOB, ACA, 1_000_000_000_000_000u128), - (ALICE, DOT, 1_000_000_000_000_000u128), - (BOB, DOT, 1_000_000_000_000_000u128), - (CHARLIE, HDX, 1_000_000_000_000_000u128), - ], - } - } -} - -impl ExtBuilder { - // builds genesis config - - pub fn with_accounts(mut self, accounts: Vec<(AccountId, AssetId, Balance)>) -> Self { - self.endowed_accounts = accounts; - self - } - - pub fn with_exchange_fee(self, f: (u32, u32)) -> Self { - EXCHANGE_FEE.with(|v| *v.borrow_mut() = f); - self - } - - pub fn with_discounted_fee(self, f: (u32, u32)) -> Self { - DISCOUNTED_FEE.with(|v| *v.borrow_mut() = f); - self - } - - pub fn with_max_out_ratio(self, f: u128) -> Self { - MAX_OUT_RATIO.with(|v| *v.borrow_mut() = f); - self - } - - pub fn build(self) -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - - orml_tokens::GenesisConfig:: { - balances: self.endowed_accounts, - } - .assimilate_storage(&mut t) - .unwrap(); - - t.into() - } -} - -pub fn new_test_ext() -> sp_io::TestExternalities { - let mut ext = ExtBuilder::default().build(); - ext.execute_with(|| System::set_block_number(1)); - ext -} - -pub fn expect_events(e: Vec) { - e.into_iter().for_each(frame_system::Pallet::::assert_has_event); -} - -pub struct Whitelist; - -impl DustRemovalAccountWhitelist for Whitelist { - type Error = DispatchError; - - fn add_account(_account: &AccountId) -> Result<(), Self::Error> { - Ok(()) - } - - fn remove_account(_account: &AccountId) -> Result<(), Self::Error> { - Ok(()) - } -} diff --git a/pallets/xyk/src/tests/mod.rs b/pallets/xyk/src/tests/mod.rs deleted file mode 100644 index 1bc9a4421b9..00000000000 --- a/pallets/xyk/src/tests/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -mod amm_position; -mod creation; -mod fees; -mod invariants; -mod liquidity; -pub(crate) mod mock; -mod spot_price; -mod trades; diff --git a/pallets/xyk/src/tests/spot_price.rs b/pallets/xyk/src/tests/spot_price.rs deleted file mode 100644 index b24eea24e84..00000000000 --- a/pallets/xyk/src/tests/spot_price.rs +++ /dev/null @@ -1,83 +0,0 @@ -use super::mock::*; -use crate::types::{AssetPair, Price}; -use crate::XYKSpotPrice; -use crate::*; -use frame_support::assert_ok; -use frame_support::dispatch::RawOrigin; -use hydradx_traits::pools::SpotPriceProvider; - -#[test] -fn spot_price_provider_should_return_correct_price_when_pool_exists() { - let asset_a = ACA; - let asset_b = DOT; - - let initial = 99_000_000_000_000u128; - - ExtBuilder::default() - .with_accounts(vec![(ALICE, asset_a, initial), (ALICE, asset_b, initial)]) - .build() - .execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - initial, - asset_b, - 39_600_000_000_000 - )); - - let price = XYKSpotPrice::::spot_price(asset_a, asset_b); - - assert_eq!(price, Some(Price::from_float(2.5))); // 99_000 / 39_600 = 2.5 - }); -} - -#[test] -fn spot_price_provider_should_return_none_when_pool_does_not_exist() { - let asset_a = ACA; - let asset_b = DOT; - - ExtBuilder::default().build().execute_with(|| { - let price = XYKSpotPrice::::spot_price(asset_a, asset_b); - - assert_eq!(price, None); - }); -} - -#[test] -fn spot_price_provider_should_return_none_when_asset_reserve_is_zero() { - let asset_a = ACA; - let asset_b = DOT; - - let initial = 99_000_000_000_000u128; - - ExtBuilder::default() - .with_accounts(vec![(ALICE, asset_a, initial), (ALICE, asset_b, initial)]) - .build() - .execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - asset_a, - initial, - asset_b, - 39_600_000_000_000 - )); - - let pool_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - // Force the pool balance to be zero in this test - assert_ok!(Currency::set_balance( - RawOrigin::Root.into(), - pool_account, - asset_b, - 0u128, - 0u128 - )); - - let price = XYKSpotPrice::::spot_price(asset_a, asset_b); - - assert_eq!(price, None); - }); -} diff --git a/pallets/xyk/src/tests/trades.rs b/pallets/xyk/src/tests/trades.rs deleted file mode 100644 index 5369bb9ea4c..00000000000 --- a/pallets/xyk/src/tests/trades.rs +++ /dev/null @@ -1,1085 +0,0 @@ -pub use super::mock::*; -use crate::{Error, Event}; -use frame_support::{assert_noop, assert_ok}; -use hydradx_traits::AMM as AmmPool; -use orml_traits::MultiCurrency; - -use crate::types::AssetPair; - -#[test] -fn sell_test() { - new_test_ext().execute_with(|| { - let user_1 = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 200_000_000_000, - asset_b, - 600_000_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); - assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); - - assert_ok!(XYK::sell( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 456_444_678, - 1000000000000, - false, - )); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999799543555322); - assert_eq!(Currency::free_balance(asset_b, &user_1), 401363483591788); - assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200456444678); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 598636516408212); - - expect_events(vec![ - Event::PoolCreated { - who: ALICE, - asset_a, - asset_b, - initial_shares_amount: 600000000000000, - share_token, - pool: pair_account, - } - .into(), - Event::SellExecuted { - who: ALICE, - asset_in: asset_a, - asset_out: asset_b, - amount: 456444678, - sale_price: 1363483591788, - fee_asset: asset_b, - fee_amount: 2732432046, - pool: pair_account, - } - .into(), - ]); - }); -} - -#[test] -fn work_flow_happy_path_should_work() { - new_test_ext().execute_with(|| { - let user_1 = ALICE; - let user_2 = BOB; - let asset_a = HDX; - let asset_b = ACA; - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - // Check initial balances - - assert_eq!(Currency::free_balance(asset_a, &user_1), 1000000000000000); - assert_eq!(Currency::free_balance(asset_b, &user_2), 1000000000000000); - assert_eq!(Currency::free_balance(asset_a, &pair_account), 0); - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 350_000_000_000, - asset_b, - 14_000_000_000_000, - )); - - // User 1 really tries! - assert_noop!( - XYK::add_liquidity( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 800_000_000_000_000_000, - 100 - ), - Error::::InsufficientAssetBalance - ); - - // Total liquidity - assert_eq!(XYK::total_liquidity(pair_account), 350_000_000_000); - - let share_token = XYK::share_token(pair_account); - - // Check balance after add liquidity for user 1 and user 2 - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999_650_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 986_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &user_2), 1_000_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &user_2), 1_000_000_000_000_000); - - assert_eq!(Currency::free_balance(share_token, &user_1), 350_000_000_000); - assert_eq!(Currency::free_balance(share_token, &user_2), 0); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 350_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 14_000_000_000_000); - - // User 2 adds liquidity - let current_b_balance = Currency::free_balance(asset_b, &user_2); - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(user_2), - asset_a, - asset_b, - 300_000_000_000, - current_b_balance - )); - - assert_eq!(XYK::total_liquidity(pair_account), 650_000_000_000); - - // Check balance after add liquidity for user 1 and user 2 - assert_eq!(Currency::free_balance(asset_a, &user_1), 999_650_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 986_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &user_2), 999_700_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &user_2), 988_000_000_000_000 - 1); // - 1 because of liquidity_in rounds up in favor of pool - - assert_eq!(Currency::free_balance(share_token, &user_1), 350_000_000_000); - assert_eq!(Currency::free_balance(share_token, &user_2), 300_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 650_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 26_000_000_000_001); - - // User 2 SELLs - assert_ok!(XYK::sell( - RuntimeOrigin::signed(user_2), - asset_a, - asset_b, - 216_666_666_666, - 100_000_000_000, - false, - )); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999_650_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 986_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &user_2), 999_483_333_333_334); - assert_eq!(Currency::free_balance(asset_b, &user_2), 994_486_999_999_986); - - assert_eq!(Currency::free_balance(share_token, &user_1), 350_000_000_000); - assert_eq!(Currency::free_balance(share_token, &user_2), 300_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 866_666_666_666); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 19_513_000_000_014); - - // User 1 SELLs - assert_ok!(XYK::sell( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 288_888_888_888, - 100_000_000_000, - false, - )); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999_361_111_111_112); - assert_eq!(Currency::free_balance(asset_b, &user_1), 990_868_493_499_997); - - let user_2_original_balance_1 = Currency::free_balance(asset_a, &user_2); - let user_2_original_balance_2 = Currency::free_balance(asset_b, &user_2); - - assert_eq!(user_2_original_balance_1, 999_483_333_333_334); - assert_eq!(user_2_original_balance_2, 994_486_999_999_986); - - assert_eq!(Currency::free_balance(share_token, &user_1), 350_000_000_000); - assert_eq!(Currency::free_balance(share_token, &user_2), 300_000_000_000); - - // User 2 removes liquidity - - assert_ok!(XYK::remove_liquidity( - RuntimeOrigin::signed(user_2), - asset_a, - asset_b, - 10_000 - )); - - let user_2_remove_1_balance_1 = Currency::free_balance(asset_a, &user_2); - let user_2_remove_1_balance_2 = Currency::free_balance(asset_b, &user_2); - - assert_eq!(user_2_remove_1_balance_1, 999_483_333_351_111); - assert_eq!(user_2_remove_1_balance_2, 994_487_000_225_286); - assert_eq!(Currency::free_balance(share_token, &user_2), 299_999_990_000); - - assert_ok!(XYK::remove_liquidity( - RuntimeOrigin::signed(user_2), - asset_b, - asset_a, - 10_000 - )); - - let user_2_remove_2_balance_1 = Currency::free_balance(asset_a, &user_2); - let user_2_remove_2_balance_2 = Currency::free_balance(asset_b, &user_2); - - assert_eq!(user_2_remove_2_balance_1, 999_483_333_368_888); - assert_eq!(user_2_remove_2_balance_2, 994_487_000_450_586); - assert_eq!(Currency::free_balance(share_token, &user_2), 299_999_980_000); - - // The two removes should be equal (this could slip by 1 because of rounding error) - - assert_eq!( - user_2_remove_1_balance_1 - user_2_original_balance_1, - user_2_remove_2_balance_1 - user_2_remove_1_balance_1 - ); - - assert_eq!( - user_2_remove_1_balance_2 - user_2_original_balance_2, - user_2_remove_2_balance_2 - user_2_remove_1_balance_2 - ); - - assert_eq!(XYK::total_liquidity(pair_account), 649_999_980_000); - - assert_ok!(XYK::remove_liquidity( - RuntimeOrigin::signed(user_2), - asset_a, - asset_b, - 18_000 - )); - assert_eq!(Currency::free_balance(share_token, &user_2), 299_999_962_000); - - assert_eq!(XYK::total_liquidity(pair_account), 649_999_962_000); - - expect_events(vec![ - Event::PoolCreated { - who: user_1, - asset_a, - asset_b, - initial_shares_amount: 350_000_000_000, - share_token, - pool: pair_account, - } - .into(), - orml_tokens::Event::Endowed { - currency_id: share_token, - who: 2, - amount: 300000000000, - } - .into(), - Event::LiquidityAdded { - who: user_2, - asset_a, - asset_b, - amount_a: 300_000_000_000, - amount_b: 12_000_000_000_001, - } - .into(), - ]); - }); -} - -#[test] -fn sell_with_correct_fees_should_work() { - let accounts = vec![ - (ALICE, HDX, 1_000_000_000_000_000u128), - (BOB, HDX, 1_000_000_000_000_000u128), - (ALICE, ACA, 1_000_000_000_000_000u128), - (BOB, ACA, 1_000_000_000_000_000u128), - (ALICE, DOT, 1_000_000_000_000_000u128), - (BOB, DOT, 1_000_000_000_000_000u128), - ]; - - let mut ext: sp_io::TestExternalities = ExtBuilder::default().with_accounts(accounts).build(); - ext.execute_with(|| System::set_block_number(1)); - ext.execute_with(|| { - let user_1 = ALICE; - let user_2 = BOB; - let asset_a = ACA; - let asset_b = HDX; - - // Verify initial balances - assert_eq!(Currency::free_balance(asset_a, &user_1), 1_000_000_000_000_000); - assert_eq!(Currency::free_balance(asset_a, &user_2), 1_000_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_b, &user_1), 1_000_000_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &user_2), 1_000_000_000_000_000); - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 10_000_000, - asset_b, - 2_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999999990000000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 999998000000000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 10000000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 2000000000); - - assert_eq!(Currency::free_balance(share_token, &user_1), 2000000000); - - assert_ok!(XYK::sell( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 100_000, - 1_000_000, - false, - )); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 10100000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 1980237622); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999999989900000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 999998019762378); - expect_events(vec![ - Event::PoolCreated { - who: user_1, - asset_a, - asset_b, - initial_shares_amount: 2000000000, - share_token, - pool: pair_account, - } - .into(), - Event::SellExecuted { - who: user_1, - asset_in: asset_a, - asset_out: asset_b, - amount: 100_000, - sale_price: 19_762_378, - fee_asset: asset_b, - fee_amount: 39_602, - pool: pair_account, - } - .into(), - ]); - }); -} - -#[test] -fn sell_without_sufficient_balance_should_not_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 1_000_000_000, - asset_b, - 1_000_000_000, - )); - - assert_ok!(Currency::transfer( - RuntimeOrigin::signed(user), - BOB, - ACA, - 999_998_999_999_999 - )); - - assert_noop!( - XYK::sell(RuntimeOrigin::signed(user), ACA, DOT, 1_000, 100, false), - Error::::InsufficientAssetBalance - ); - }); -} - -#[test] -fn sell_without_sufficient_discount_balance_should_not_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 1_000_000_000_000, - asset_b, - 1_000_000_000_000, - )); - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 1_000_000_000_000, - HDX, - 1_000_000_000_000, - )); - - assert_ok!(Currency::transfer( - RuntimeOrigin::signed(user), - BOB, - HDX, - 998_999_999_999_999 - )); - - assert_noop!( - XYK::sell(RuntimeOrigin::signed(user), ACA, DOT, 1_000_000_000, 100, true), - Error::::InsufficientNativeCurrencyBalance - ); - }); -} - -#[test] -fn buy_without_sufficient_balance_should_not_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 1_000_000_000, - asset_b, - 1_000_000_000, - )); - - assert_ok!(Currency::transfer( - RuntimeOrigin::signed(user), - BOB, - ACA, - 999_998_999_999_999 - )); - - assert_noop!( - XYK::buy(RuntimeOrigin::signed(user), DOT, ACA, 1_000, 10_000, false), - Error::::InsufficientAssetBalance - ); - }); -} - -#[test] -fn buy_without_sufficient_discount_balance_should_not_work() { - new_test_ext().execute_with(|| { - let user = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_a, - 1_000_000_000_000, - asset_b, - 1_000_000_000_000, - )); - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user), - asset_b, - 1_000_000_000_000, - HDX, - 1_000_000_000_000, - )); - - assert_ok!(Currency::transfer( - RuntimeOrigin::signed(user), - BOB, - HDX, - 998_999_999_999_999 - )); - - assert_noop!( - XYK::buy( - RuntimeOrigin::signed(user), - DOT, - ACA, - 1_000_000_000, - 10_000_000_000, - true - ), - Error::::InsufficientNativeCurrencyBalance - ); - }); -} - -#[test] -fn single_buy_should_work() { - new_test_ext().execute_with(|| { - let user_1 = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 200_000_000, - asset_b, - 640_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999_999_800_000_000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 999_360_000_000_000); - assert_eq!(Currency::free_balance(share_token, &user_1), 640_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 640_000_000_000); - - assert_ok!(XYK::buy( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 6_666_666, - 1_000_000_000_000, - false, - )); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999_999_806_666_666); - assert_eq!(Currency::free_balance(asset_b, &user_1), 999_337_886_898_839); - assert_eq!(Currency::free_balance(share_token, &user_1), 640_000_000_000); - assert_eq!(Currency::free_balance(asset_a, &pair_account), 193_333_334); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 662_113_101_161); - - expect_events(vec![ - Event::PoolCreated { - who: user_1, - asset_a, - asset_b, - initial_shares_amount: 640_000_000_000, - share_token, - pool: pair_account, - } - .into(), - Event::BuyExecuted { - who: user_1, - asset_out: asset_a, - asset_in: asset_b, - amount: 6_666_666, - buy_price: 22_068_963_235, - fee_asset: asset_b, - fee_amount: 44_137_926, - pool: pair_account, - } - .into(), - ]); - }); -} - -#[test] -fn create_pool_with_insufficient_liquidity_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - XYK::create_pool(RuntimeOrigin::signed(ALICE), ACA, 500, HDX, 1_600_000), - Error::::InsufficientLiquidity - ); - - assert_noop!( - XYK::create_pool(RuntimeOrigin::signed(ALICE), ACA, 5000, HDX, 500), - Error::::InsufficientLiquidity - ); - }); -} - -#[test] -fn add_liquidity_to_non_existing_pool_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - XYK::add_liquidity( - RuntimeOrigin::signed(ALICE), - HDX, - ACA, - 200_000_000_000_000_000, - 600_000_000 - ), - Error::::TokenPoolNotFound - ); - }); -} - -#[test] -fn remove_zero_liquidity_from_non_existing_pool_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - XYK::remove_liquidity(RuntimeOrigin::signed(ALICE), HDX, ACA, 100), - Error::::TokenPoolNotFound - ); - }); -} - -#[test] -fn sell_with_non_existing_pool_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - XYK::sell(RuntimeOrigin::signed(ALICE), HDX, DOT, 456_444_678, 1_000_000, false), - Error::::TokenPoolNotFound - ); - }); -} - -#[test] -fn discount_sell_with_no_native_pool_should_not_work() { - new_test_ext().execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - ACA, - 1000, - DOT, - 3_200_000 - )); - - assert_noop!( - XYK::sell(RuntimeOrigin::signed(ALICE), ACA, DOT, 456_444_678, 1_000_000, true), - Error::::CannotApplyDiscount - ); - }); -} - -#[test] -fn buy_with_non_existing_pool_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - XYK::buy( - RuntimeOrigin::signed(ALICE), - HDX, - DOT, - 456_444_678, - 1_000_000_000, - false - ), - Error::::TokenPoolNotFound - ); - }); -} - -#[test] -fn discount_buy_with_no_native_pool_should_not_work() { - new_test_ext().execute_with(|| { - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(ALICE), - ACA, - 10_000, - DOT, - 32_000_000 - )); - - assert_noop!( - XYK::buy(RuntimeOrigin::signed(ALICE), ACA, DOT, 1000, 1_000_000_000, true), - Error::::CannotApplyDiscount - ); - }); -} - -#[test] -fn money_in_sell_money_out_should_leave_the_same_balance() { - new_test_ext().execute_with(|| { - let user_1 = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - let user_1_balance_a_before = Currency::free_balance(asset_a, &user_1); - let user_1_balance_b_before = Currency::free_balance(asset_b, &user_1); - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 200_000_000_000, - asset_b, - 600_000_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); - assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); - - assert_ok!(XYK::sell( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 456_444_678, - 1000000000000, - false, - )); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999799543555322); - assert_eq!(Currency::free_balance(asset_b, &user_1), 401363483591788); - assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200456444678); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 598636516408212); - - assert_ok!(XYK::remove_liquidity( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 600000000000000 - )); - - let user_1_balance_a_after = Currency::free_balance(asset_a, &user_1); - let user_1_balance_b_after = Currency::free_balance(asset_b, &user_1); - - assert_eq!(user_1_balance_a_before, user_1_balance_a_after); - assert_eq!(user_1_balance_b_before, user_1_balance_b_after); - }); -} - -#[test] -fn money_in_money_out_should_leave_the_same_balance_for_both_accounts() { - new_test_ext().execute_with(|| { - let user_1 = ALICE; - let user_2 = BOB; - let asset_a = HDX; - let asset_b = DOT; - - let user_1_balance_a_before = Currency::free_balance(asset_a, &user_1); - let user_1_balance_b_before = Currency::free_balance(asset_b, &user_1); - let user_2_balance_a_before = Currency::free_balance(asset_a, &user_2); - let user_2_balance_b_before = Currency::free_balance(asset_b, &user_2); - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 100_000_000, - asset_b, - 1_000_000_000_000, - )); - - let asset_pair = AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }; - - let pair_account = XYK::get_pair_id(asset_pair); - let share_token = XYK::share_token(pair_account); - - assert!(XYK::exists(asset_pair)); - - assert_ok!(XYK::add_liquidity( - RuntimeOrigin::signed(user_2), - asset_a, - asset_b, - 100_000_000, - 1_100_000_000_000 - )); - - assert_eq!(Currency::free_balance(share_token, &user_1), 100_000_000); - assert_eq!(Currency::free_balance(share_token, &user_2), 100_000_000); - - assert_ok!(XYK::remove_liquidity( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 100_000_000 - )); - - assert_ok!(XYK::remove_liquidity( - RuntimeOrigin::signed(user_2), - asset_a, - asset_b, - 100_000_000 - )); - - assert_eq!(XYK::total_liquidity(pair_account), 0); - - let user_1_balance_a_after = Currency::free_balance(asset_a, &user_1); - let user_1_balance_b_after = Currency::free_balance(asset_b, &user_1); - let user_2_balance_a_after = Currency::free_balance(asset_a, &user_2); - let user_2_balance_b_after = Currency::free_balance(asset_b, &user_2); - - assert_eq!(user_1_balance_a_before, user_1_balance_a_after); - assert_eq!(user_1_balance_b_before, user_1_balance_b_after); - assert_eq!(user_2_balance_a_before, user_2_balance_a_after); - assert_eq!(user_2_balance_b_before, user_2_balance_b_after); - - assert!(!XYK::exists(asset_pair)); - }); -} - -#[test] -fn sell_test_not_reaching_limit() { - ExtBuilder::default().build().execute_with(|| { - let user_1 = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 200_000_000_000, - asset_b, - 600_000_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); - assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); - - assert_noop!( - XYK::sell( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 456_444_678, - 1_000_000_000_000_000, - false, - ), - Error::::AssetAmountNotReachedLimit - ); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); - }); -} - -#[test] -fn buy_test_exceeding_max_limit() { - ExtBuilder::default().build().execute_with(|| { - let user_1 = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 200_000_000_000, - asset_b, - 600_000_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); - assert_eq!(Currency::free_balance(share_token, &user_1), 600000000000000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); - - assert_noop!( - XYK::buy( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 456_444_678, - 1_000_000_000, - false, - ), - Error::::AssetAmountExceededLimit - ); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999800000000000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 400000000000000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200000000000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 600000000000000); - }); -} - -#[test] -fn single_buy_more_than_ratio_out_should_not_work() { - new_test_ext().execute_with(|| { - let user_1 = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 200_000_000, - asset_b, - 640_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999_999_800_000_000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 999_360_000_000_000); - assert_eq!(Currency::free_balance(share_token, &user_1), 640_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 640_000_000_000); - - assert_noop!( - XYK::buy( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 66_666_667, - 1_000_000_000_000, - false, - ), - Error::::MaxOutRatioExceeded - ); - }); -} - -#[test] -fn single_buy_more_than_ratio_in_should_not_work() { - new_test_ext().execute_with(|| { - let user_1 = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 100_000_000_000, - asset_b, - 100_000_000_000 - )); - - assert_noop!( - XYK::buy( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 33_333_333_333, - 1_000_000_000_000, - false, - ), - Error::::MaxInRatioExceeded - ); - }); -} - -#[test] -fn single_sell_more_than_ratio_in_should_not_work() { - new_test_ext().execute_with(|| { - let user_1 = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 200_000_000_000, - asset_b, - 600_000_000_000_000, - )); - - let pair_account = XYK::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - let share_token = XYK::share_token(pair_account); - - assert_eq!(Currency::free_balance(asset_a, &user_1), 999_800_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &user_1), 400_000_000_000_000); - assert_eq!(Currency::free_balance(share_token, &user_1), 600_000_000_000_000); - - assert_eq!(Currency::free_balance(asset_a, &pair_account), 200_000_000_000); - assert_eq!(Currency::free_balance(asset_b, &pair_account), 600_000_000_000_000); - - assert_noop!( - XYK::sell( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 66_666_666_667, - 10_000_000, - false, - ), - Error::::MaxInRatioExceeded - ); - }); -} - -#[test] -fn single_sell_more_than_ratio_out_should_not_work() { - ExtBuilder::default().with_max_out_ratio(5).build().execute_with(|| { - let user_1 = ALICE; - let asset_a = ACA; - let asset_b = DOT; - - assert_ok!(XYK::create_pool( - RuntimeOrigin::signed(user_1), - asset_a, - 100_000_000_000, - asset_b, - 100_000_000_000 - )); - - assert_noop!( - XYK::sell( - RuntimeOrigin::signed(user_1), - asset_a, - asset_b, - 33_333_333_333, - 10_000_000, - false, - ), - Error::::MaxOutRatioExceeded - ); - }); -} - -#[test] -fn sell_with_low_amount_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - XYK::sell(RuntimeOrigin::signed(ALICE), HDX, DOT, 1, 1_000_000, false), - Error::::InsufficientTradingAmount - ); - }); -} - -#[test] -fn buy_with_low_amount_should_not_work() { - new_test_ext().execute_with(|| { - assert_noop!( - XYK::buy(RuntimeOrigin::signed(ALICE), HDX, DOT, 1, 1_000_000, false), - Error::::InsufficientTradingAmount - ); - }); -} - -#[test] -fn buy_with_excesive_amount_should_not_work() { - new_test_ext().execute_with(|| { - assert_ok!(XYK::create_pool(RuntimeOrigin::signed(ALICE), HDX, 10_000, DOT, 10_000,)); - - assert_noop!( - XYK::buy(RuntimeOrigin::signed(ALICE), HDX, DOT, 20_000, 1_000_000, false), - Error::::InsufficientPoolAssetBalance - ); - }); -} diff --git a/pallets/xyk/src/trade_execution.rs b/pallets/xyk/src/trade_execution.rs deleted file mode 100644 index ae405227091..00000000000 --- a/pallets/xyk/src/trade_execution.rs +++ /dev/null @@ -1,143 +0,0 @@ -use crate::types::{AssetId, AssetPair, Balance}; -use crate::{Config, Error, Pallet}; -use frame_support::ensure; -use frame_support::traits::Get; -use hydradx_traits::router::{ExecutorError, PoolType, TradeExecution}; -use hydradx_traits::AMM; -use orml_traits::MultiCurrency; -use sp_runtime::DispatchError; - -impl TradeExecution for Pallet { - type Error = DispatchError; - - fn calculate_sell( - pool_type: PoolType, - asset_in: AssetId, - asset_out: AssetId, - amount_in: Balance, - ) -> Result> { - if pool_type != PoolType::XYK { - return Err(ExecutorError::NotSupported); - } - - let assets = AssetPair { asset_in, asset_out }; - - if !Self::exists(assets) { - return Err(ExecutorError::Error(Error::::TokenPoolNotFound.into())); - } - - let pair_account = Self::get_pair_id(assets); - - let asset_in_reserve = T::Currency::free_balance(assets.asset_in, &pair_account); - let asset_out_reserve = T::Currency::free_balance(assets.asset_out, &pair_account); - - let amount_out = hydra_dx_math::xyk::calculate_out_given_in(asset_in_reserve, asset_out_reserve, amount_in) - .map_err(|_| ExecutorError::Error(Error::::SellAssetAmountInvalid.into()))?; - - ensure!( - asset_out_reserve > amount_out, - ExecutorError::Error(Error::::InsufficientPoolAssetBalance.into()) - ); - - let transfer_fee = Self::calculate_fee(amount_out).map_err(ExecutorError::Error)?; - - let amount_out_without_fee = amount_out - .checked_sub(transfer_fee) - .ok_or_else(|| ExecutorError::Error(Error::::SellAssetAmountInvalid.into()))?; - - Ok(amount_out_without_fee) - } - - fn calculate_buy( - pool_type: PoolType, - asset_in: AssetId, - asset_out: AssetId, - amount_out: Balance, - ) -> Result> { - if pool_type != PoolType::XYK { - return Err(ExecutorError::NotSupported); - } - - let assets = AssetPair { asset_in, asset_out }; - - ensure!( - Self::exists(assets), - ExecutorError::Error(Error::::TokenPoolNotFound.into()) - ); - - let pair_account = Self::get_pair_id(assets); - - let asset_out_reserve = T::Currency::free_balance(assets.asset_out, &pair_account); - let asset_in_reserve = T::Currency::free_balance(assets.asset_in, &pair_account); - - ensure!( - asset_out_reserve > amount_out, - ExecutorError::Error(Error::::InsufficientPoolAssetBalance.into()) - ); - - ensure!( - amount_out >= T::MinTradingLimit::get(), - ExecutorError::Error(Error::::InsufficientTradingAmount.into()) - ); - - let amount_in = hydra_dx_math::xyk::calculate_in_given_out(asset_out_reserve, asset_in_reserve, amount_out) - .map_err(|_| ExecutorError::Error(Error::::BuyAssetAmountInvalid.into()))?; - - let transfer_fee = Self::calculate_fee(amount_in).map_err(ExecutorError::Error)?; - - let amount_in_with_fee = amount_in - .checked_add(transfer_fee) - .ok_or_else(|| ExecutorError::Error(Error::::BuyAssetAmountInvalid.into()))?; - - Ok(amount_in_with_fee) - } - - fn execute_sell( - who: T::RuntimeOrigin, - pool_type: PoolType, - asset_in: AssetId, - asset_out: AssetId, - amount_in: Balance, - min_limit: Balance, - ) -> Result<(), ExecutorError> { - if pool_type != PoolType::XYK { - return Err(ExecutorError::NotSupported); - } - - Self::sell(who, asset_in, asset_out, amount_in, min_limit, false).map_err(ExecutorError::Error) - } - - fn execute_buy( - who: T::RuntimeOrigin, - pool_type: PoolType, - asset_in: AssetId, - asset_out: AssetId, - amount_out: Balance, - max_limit: Balance, - ) -> Result<(), ExecutorError> { - if pool_type != PoolType::XYK { - return Err(ExecutorError::NotSupported); - } - - Self::buy(who, asset_out, asset_in, amount_out, max_limit, false).map_err(ExecutorError::Error) - } - - fn get_liquidity_depth( - pool_type: PoolType, - asset_a: AssetId, - asset_b: AssetId, - ) -> Result> { - if pool_type != PoolType::XYK { - return Err(ExecutorError::NotSupported); - } - - let pair_account = Self::get_pair_id(AssetPair { - asset_in: asset_a, - asset_out: asset_b, - }); - - let liquidty = T::Currency::free_balance(asset_a, &pair_account); - - Ok(liquidty) - } -} diff --git a/pallets/xyk/src/types.rs b/pallets/xyk/src/types.rs deleted file mode 100644 index ce20f6aa35d..00000000000 --- a/pallets/xyk/src/types.rs +++ /dev/null @@ -1,69 +0,0 @@ -// This file is part of Basilisk-node. - -// 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 type AssetId = u32; -pub type Amount = i128; -pub type Balance = u128; -pub type Price = FixedU128; - -use codec::{Decode, Encode}; -use scale_info::TypeInfo; -use sp_runtime::FixedU128; -use sp_std::vec::Vec; - -#[cfg(feature = "std")] -use serde::{Deserialize, Serialize}; - -/// Asset Pair representation for AMM trades -/// ( asset_a, asset_b ) combination where asset_a is meant to be exchanged for asset_b -/// -/// asset_in represents asset coming into the pool -/// asset_out represents asset coming out of the pool -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -#[derive(Debug, Encode, Decode, Copy, Clone, PartialEq, Eq, Default, TypeInfo)] -pub struct AssetPair { - pub asset_in: AssetId, - pub asset_out: AssetId, -} - -impl AssetPair { - pub fn new(asset_in: AssetId, asset_out: AssetId) -> Self { - Self { asset_in, asset_out } - } - - /// Return ordered asset tuple (A,B) where A < B - /// Used in storage - pub fn ordered_pair(&self) -> (AssetId, AssetId) { - match self.asset_in <= self.asset_out { - true => (self.asset_in, self.asset_out), - false => (self.asset_out, self.asset_in), - } - } - - /// Return share token name - pub fn name(&self) -> Vec { - let mut buf: Vec = Vec::new(); - - let (asset_a, asset_b) = self.ordered_pair(); - - buf.extend_from_slice(&asset_a.to_le_bytes()); - buf.extend_from_slice(b"HDT"); - buf.extend_from_slice(&asset_b.to_le_bytes()); - - buf - } -} diff --git a/pallets/xyk/src/weights.rs b/pallets/xyk/src/weights.rs deleted file mode 100644 index 1eb9c21a156..00000000000 --- a/pallets/xyk/src/weights.rs +++ /dev/null @@ -1,368 +0,0 @@ -// This file is part of HydraDX. - -// Copyright (C) 2020-2023 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_xyk -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-10-06, STEPS: 10, REPEAT: 30, LOW RANGE: [], HIGH RANGE: [] -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 - -// Executed Command: -// target/release/hydradx -// benchmark -// pallet -// --chain=dev -// --steps=10 -// --repeat=30 -// --execution=wasm -// --wasm-execution=compiled -// --heap-pages=4096 -// --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-xyk -// --output=xyk.rs -// --extrinsic=* - -#![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_xyk. -pub trait WeightInfo { - fn create_pool() -> Weight; - fn add_liquidity() -> Weight; - fn remove_liquidity() -> Weight; - fn sell() -> Weight; - fn buy() -> Weight; - fn router_execution_sell(c: u32, e: u32) -> Weight; - fn router_execution_buy(c: u32, e: u32) -> Weight; -} - -/// Weights for amm using the hydraDX node and recommended hardware. -pub struct HydraWeight(PhantomData); - -impl WeightInfo for HydraWeight { - // Storage: LBP PoolData (r:1 w:0) - // Proof: LBP PoolData (max_values: None, max_size: Some(163), added: 2638, mode: MaxEncodedLen) - // Storage: XYK ShareToken (r:1 w:1) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:5 w:5) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry AssetIds (r:1 w:1) - // Proof: AssetRegistry AssetIds (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) - // Storage: AssetRegistry NextAssetId (r:1 w:1) - // Proof: AssetRegistry NextAssetId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:2 w:1) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:2 w:2) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: MultiTransactionPayment AccountCurrencyMap (r:2 w:1) - // Proof: MultiTransactionPayment AccountCurrencyMap (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: MultiTransactionPayment AcceptedCurrencies (r:1 w:0) - // Proof: MultiTransactionPayment AcceptedCurrencies (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) - // Storage: Duster AccountBlacklist (r:0 w:1) - // Proof: Duster AccountBlacklist (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) - // Storage: XYK TotalLiquidity (r:0 w:1) - // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) - // Storage: XYK PoolAssets (r:0 w:1) - // Proof: XYK PoolAssets (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) - fn create_pool() -> Weight { - // Minimum execution time: 190_185 nanoseconds. - Weight::from_parts(192_567_000, 0) - .saturating_add(T::DbWeight::get().reads(17 as u64)) - .saturating_add(T::DbWeight::get().writes(16 as u64)) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:5 w:5) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: XYK TotalLiquidity (r:1 w:1) - // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:3 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:1 w:1) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) - // Storage: MultiTransactionPayment AccountCurrencyMap (r:1 w:0) - // Proof: MultiTransactionPayment AccountCurrencyMap (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - fn add_liquidity() -> Weight { - // Minimum execution time: 164_323 nanoseconds. - Weight::from_parts(165_841_000, 0) - .saturating_add(T::DbWeight::get().reads(14 as u64)) - .saturating_add(T::DbWeight::get().writes(9 as u64)) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: XYK TotalLiquidity (r:1 w:1) - // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:5 w:5) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:3 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:1 w:0) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - fn remove_liquidity() -> Weight { - // Minimum execution time: 155_404 nanoseconds. - Weight::from_parts(156_560_000, 0) - .saturating_add(T::DbWeight::get().reads(13 as u64)) - .saturating_add(T::DbWeight::get().writes(8 as u64)) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:4 w:4) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:2 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:2 w:0) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - fn sell() -> Weight { - // Minimum execution time: 119_610 nanoseconds. - Weight::from_parts(120_418_000, 0) - .saturating_add(T::DbWeight::get().reads(10 as u64)) - .saturating_add(T::DbWeight::get().writes(5 as u64)) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:4 w:4) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:2 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:2 w:0) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - fn buy() -> Weight { - // Minimum execution time: 119_865 nanoseconds. - Weight::from_parts(120_541_000, 0) - .saturating_add(T::DbWeight::get().reads(10 as u64)) - .saturating_add(T::DbWeight::get().writes(5 as u64)) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:4 w:4) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:2 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:2 w:0) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - /// The range of component `c` is `[1, 2]`. - /// The range of component `e` is `[0, 1]`. - fn router_execution_sell(c: u32, e: u32) -> Weight { - // Minimum execution time: 20_906 nanoseconds. - Weight::from_parts(8_365_948, 0) // Standard Error: 43_229 - .saturating_add(Weight::from_parts(6_554_981, 0).saturating_mul(c as u64)) - // Standard Error: 43_229 - .saturating_add(Weight::from_parts(105_218_621, 0).saturating_mul(e as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().reads((7 as u64).saturating_mul(e as u64))) - .saturating_add(T::DbWeight::get().writes((5 as u64).saturating_mul(e as u64))) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:4 w:4) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:2 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:2 w:0) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - /// The range of component `c` is `[1, 3]`. - /// The range of component `e` is `[0, 1]`. - fn router_execution_buy(c: u32, e: u32) -> Weight { - // Minimum execution time: 27_261 nanoseconds. - Weight::from_parts(7_044_054, 0) // Standard Error: 46_197 - .saturating_add(Weight::from_parts(7_022_106, 0).saturating_mul(c as u64)) - // Standard Error: 78_379 - .saturating_add(Weight::from_parts(105_927_586, 0).saturating_mul(e as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().reads((7 as u64).saturating_mul(e as u64))) - .saturating_add(T::DbWeight::get().writes((5 as u64).saturating_mul(e as u64))) - } -} - -// For backwards compatibility and tests -impl WeightInfo for () { - // Storage: LBP PoolData (r:1 w:0) - // Proof: LBP PoolData (max_values: None, max_size: Some(163), added: 2638, mode: MaxEncodedLen) - // Storage: XYK ShareToken (r:1 w:1) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:5 w:5) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry AssetIds (r:1 w:1) - // Proof: AssetRegistry AssetIds (max_values: None, max_size: Some(53), added: 2528, mode: MaxEncodedLen) - // Storage: AssetRegistry NextAssetId (r:1 w:1) - // Proof: AssetRegistry NextAssetId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:2 w:1) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:2 w:2) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: MultiTransactionPayment AccountCurrencyMap (r:2 w:1) - // Proof: MultiTransactionPayment AccountCurrencyMap (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: MultiTransactionPayment AcceptedCurrencies (r:1 w:0) - // Proof: MultiTransactionPayment AcceptedCurrencies (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) - // Storage: Duster AccountBlacklist (r:0 w:1) - // Proof: Duster AccountBlacklist (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) - // Storage: XYK TotalLiquidity (r:0 w:1) - // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) - // Storage: XYK PoolAssets (r:0 w:1) - // Proof: XYK PoolAssets (max_values: None, max_size: Some(56), added: 2531, mode: MaxEncodedLen) - fn create_pool() -> Weight { - // Minimum execution time: 190_185 nanoseconds. - Weight::from_parts(192_567_000, 0) - .saturating_add(RocksDbWeight::get().reads(17 as u64)) - .saturating_add(RocksDbWeight::get().writes(16 as u64)) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:5 w:5) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: XYK TotalLiquidity (r:1 w:1) - // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:3 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:1 w:1) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) - // Storage: MultiTransactionPayment AccountCurrencyMap (r:1 w:0) - // Proof: MultiTransactionPayment AccountCurrencyMap (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - fn add_liquidity() -> Weight { - // Minimum execution time: 164_323 nanoseconds. - Weight::from_parts(165_841_000, 0) - .saturating_add(RocksDbWeight::get().reads(14 as u64)) - .saturating_add(RocksDbWeight::get().writes(9 as u64)) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: XYK TotalLiquidity (r:1 w:1) - // Proof: XYK TotalLiquidity (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:5 w:5) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:3 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:1 w:0) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: Tokens TotalIssuance (r:1 w:1) - // Proof: Tokens TotalIssuance (max_values: None, max_size: Some(28), added: 2503, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - fn remove_liquidity() -> Weight { - // Minimum execution time: 155_404 nanoseconds. - Weight::from_parts(156_560_000, 0) - .saturating_add(RocksDbWeight::get().reads(13 as u64)) - .saturating_add(RocksDbWeight::get().writes(8 as u64)) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:4 w:4) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:2 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:2 w:0) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - fn sell() -> Weight { - // Minimum execution time: 119_610 nanoseconds. - Weight::from_parts(120_418_000, 0) - .saturating_add(RocksDbWeight::get().reads(10 as u64)) - .saturating_add(RocksDbWeight::get().writes(5 as u64)) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:4 w:4) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:2 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:2 w:0) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - fn buy() -> Weight { - // Minimum execution time: 119_865 nanoseconds. - Weight::from_parts(120_541_000, 0) - .saturating_add(RocksDbWeight::get().reads(10 as u64)) - .saturating_add(RocksDbWeight::get().writes(5 as u64)) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:4 w:4) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:2 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:2 w:0) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - /// The range of component `c` is `[1, 2]`. - /// The range of component `e` is `[0, 1]`. - fn router_execution_sell(c: u32, e: u32) -> Weight { - // Minimum execution time: 20_906 nanoseconds. - Weight::from_parts(8_365_948, 0) // Standard Error: 43_229 - .saturating_add(Weight::from_parts(6_554_981, 0).saturating_mul(c as u64)) - // Standard Error: 43_229 - .saturating_add(Weight::from_parts(105_218_621, 0).saturating_mul(e as u64)) - .saturating_add(RocksDbWeight::get().reads(3 as u64)) - .saturating_add(RocksDbWeight::get().reads((7 as u64).saturating_mul(e as u64))) - .saturating_add(RocksDbWeight::get().writes((5 as u64).saturating_mul(e as u64))) - } - // Storage: XYK ShareToken (r:1 w:0) - // Proof: XYK ShareToken (max_values: None, max_size: Some(52), added: 2527, mode: MaxEncodedLen) - // Storage: Tokens Accounts (r:4 w:4) - // Proof: Tokens Accounts (max_values: None, max_size: Some(108), added: 2583, mode: MaxEncodedLen) - // Storage: AssetRegistry Assets (r:2 w:0) - // Proof: AssetRegistry Assets (max_values: None, max_size: Some(87), added: 2562, mode: MaxEncodedLen) - // Storage: System Account (r:2 w:0) - // Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - // Storage: EmaOracle Accumulator (r:1 w:1) - // Proof: EmaOracle Accumulator (max_values: Some(1), max_size: Some(5921), added: 6416, mode: MaxEncodedLen) - /// The range of component `c` is `[1, 3]`. - /// The range of component `e` is `[0, 1]`. - fn router_execution_buy(c: u32, e: u32) -> Weight { - // Minimum execution time: 27_261 nanoseconds. - Weight::from_parts(7_044_054, 0) // Standard Error: 46_197 - .saturating_add(Weight::from_parts(7_022_106, 0).saturating_mul(c as u64)) - // Standard Error: 78_379 - .saturating_add(Weight::from_parts(105_927_586, 0).saturating_mul(e as u64)) - .saturating_add(RocksDbWeight::get().reads(3 as u64)) - .saturating_add(RocksDbWeight::get().reads((7 as u64).saturating_mul(e as u64))) - .saturating_add(RocksDbWeight::get().writes((5 as u64).saturating_mul(e as u64))) - } -} From ea973d8aacf4d2bcaaabbd281c238f94de14efcc Mon Sep 17 00:00:00 2001 From: dmoka Date: Mon, 22 Apr 2024 13:14:49 +0200 Subject: [PATCH 13/56] fix compilation errors of integration tests due to new update --- Cargo.lock | 10 +- integration-tests/src/cross_chain_transfer.rs | 136 +++++---- integration-tests/src/exchange_asset.rs | 116 +++++--- integration-tests/src/kusama_test_net.rs | 68 +++-- integration-tests/src/lib.rs | 1 - integration-tests/src/non_native_fee.rs | 23 +- integration-tests/src/oracle.rs | 1 + integration-tests/src/router.rs | 34 +-- integration-tests/src/transact_call_filter.rs | 183 +++++++------ integration-tests/src/xcm_rate_limiter.rs | 259 ------------------ runtime/basilisk/src/weights/xcmp_queue.rs | 20 +- runtime/basilisk/src/xcm.rs | 3 +- 12 files changed, 347 insertions(+), 507 deletions(-) delete mode 100644 integration-tests/src/xcm_rate_limiter.rs diff --git a/Cargo.lock b/Cargo.lock index 7ec158c232d..b0433cf8262 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15970,6 +15970,11 @@ dependencies = [ "pkg-config", ] +[[patch.unused]] +name = "orml-currencies" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" + [[patch.unused]] name = "sp-core-hashing" version = "15.0.0" @@ -15979,8 +15984,3 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot name = "sp-crypto-ec-utils" version = "0.10.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" - -[[patch.unused]] -name = "orml-currencies" -version = "0.8.0" -source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/integration-tests/src/cross_chain_transfer.rs b/integration-tests/src/cross_chain_transfer.rs index 519132c72a7..ed11822329c 100644 --- a/integration-tests/src/cross_chain_transfer.rs +++ b/integration-tests/src/cross_chain_transfer.rs @@ -4,7 +4,7 @@ use crate::kusama_test_net::*; use frame_support::{assert_noop, assert_ok}; -use polkadot_xcm::{v3::prelude::*, VersionedAssets,VersionedXcm}; +use polkadot_xcm::{v4::prelude::*, VersionedAssets, VersionedLocation, VersionedXcm}; use cumulus_primitives_core::ParaId; use frame_support::weights::Weight; @@ -13,13 +13,20 @@ use orml_traits::currency::MultiCurrency; use sp_core::H256; use sp_runtime::traits::{AccountIdConversion, BlakeTwo256, Hash}; use xcm_emulator::TestExt; +use polkadot_xcm::opaque::lts::Assets; +use polkadot_xcm::opaque::v3::MultiLocation; +use polkadot_xcm::opaque::v3::MultiAssets; +use polkadot_xcm::opaque::v3::Junctions::{X1, X2}; +use polkadot_xcm::opaque::v3::Junction; +use polkadot_xcm::opaque::v3::MultiAsset; +use polkadot_xcm::opaque::v3; + +use sp_std::sync::Arc; // Determine the hash for assets expected to be have been trapped. -fn determine_hash(origin: &MultiLocation, assets: M) -> H256 -where - M: Into, +fn determine_hash(origin: &MultiLocation, assets: Vec) -> H256 { - let versioned = VersionedAssets::from(assets.into()); + let versioned = VersionedAssets::from(Assets::from(assets)); BlakeTwo256::hash_of(&(origin, &versioned)) } @@ -29,7 +36,7 @@ fn basilisk_should_receive_asset_when_transferred_from_relaychain() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::parent()) + basilisk_runtime::AssetLocation(MultiLocation::parent().into()) )); }); Kusama::execute_with(|| { @@ -70,11 +77,13 @@ fn relaychain_should_receive_asset_when_transferred_from_basilisk() { basilisk_runtime::AssetLocation(MultiLocation::parent()) )); + let dest = MultiLocation::new(1, X1(Junction::AccountId32 { id: BOB, network: None })).into_versioned(); + assert_ok!(basilisk_runtime::XTokens::transfer( basilisk_runtime::RuntimeOrigin::signed(ALICE.into()), 1, 3 * UNITS, - Box::new(MultiLocation::new(1, X1(Junction::AccountId32 { id: BOB, network: None })).into()), + Box::new(dest), WeightLimit::Limited(Weight::from_parts(4_600_000_000, 10_000)) )); assert_eq!( @@ -86,7 +95,7 @@ fn relaychain_should_receive_asset_when_transferred_from_basilisk() { Kusama::execute_with(|| { assert_eq!( rococo_runtime::Balances::free_balance(AccountId::from(BOB)), - 2999918220455 // 3 * BSX - fee + 2999989698923 // 3 * BSX - fee ); }); } @@ -101,7 +110,7 @@ fn basilisk_should_receive_asset_when_sent_from_other_parachain() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(OTHER_PARA_ID), GeneralIndex(0)))) + basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0))).into()) )); }); @@ -151,7 +160,7 @@ fn other_parachain_should_receive_asset_when_sent_from_basilisk() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(BASILISK_PARA_ID), GeneralIndex(0)))) + basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(BASILISK_PARA_ID), Junction::GeneralIndex(0)))) )); }); @@ -173,7 +182,7 @@ fn other_parachain_should_receive_asset_when_sent_from_basilisk() { Junction::AccountId32 { id: BOB, network: None } ) ) - .into() + .into_versioned() ), WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) )); @@ -207,7 +216,7 @@ fn transfer_from_other_parachain_and_back() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(OTHER_PARA_ID), GeneralIndex(0)))) + basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)))) )); }); @@ -224,7 +233,7 @@ fn transfer_from_other_parachain_and_back() { Junction::AccountId32 { id: BOB, network: None } ) ) - .into() + .into_versioned() ), WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) )); @@ -266,7 +275,7 @@ fn transfer_from_other_parachain_and_back() { } ) ) - .into() + .into_versioned() ), WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) )); @@ -296,7 +305,7 @@ fn other_parachain_should_fail_to_send_asset_to_basilisk_when_insufficient_amoun assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(OTHER_PARA_ID), GeneralIndex(0)))) + basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)))) )); }); @@ -320,7 +329,7 @@ fn other_parachain_should_fail_to_send_asset_to_basilisk_when_insufficient_amoun Junction::AccountId32 { id: BOB, network: None } ) ) - .into() + .into_versioned() ), WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) ), @@ -341,7 +350,6 @@ fn other_parachain_should_fail_to_send_asset_to_basilisk_when_insufficient_amoun ); }); } - #[test] fn fee_currency_set_on_xcm_transfer() { TestNet::reset(); @@ -354,7 +362,7 @@ fn fee_currency_set_on_xcm_transfer() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(OTHER_PARA_ID), GeneralIndex(0)))) + basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)))) )); // fee currency is not set before XCM transfer @@ -380,7 +388,7 @@ fn fee_currency_set_on_xcm_transfer() { } ) ) - .into() + .into_versioned() ), WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) )); @@ -425,7 +433,7 @@ fn assets_should_be_trapped_when_assets_are_unknown() { Junction::AccountId32 { id: BOB, network: None } ) ) - .into() + .into_versioned() ), WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) )); @@ -436,23 +444,12 @@ fn assets_should_be_trapped_when_assets_are_unknown() { }); Basilisk::execute_with(|| { - expect_basilisk_events(vec![ - cumulus_pallet_xcmp_queue::Event::Fail { - message_hash: hex!["30291d1dfb68ae6f66d4c841facb78f44e7611ab2a25c84f4fb7347f448d2944"], - message_id: hex!["30291d1dfb68ae6f66d4c841facb78f44e7611ab2a25c84f4fb7347f448d2944"], - error: XcmError::AssetNotFound, - weight: Weight::from_parts(300_000_000, 0), - } - .into(), - pallet_relaychain_info::Event::CurrentBlockNumbers { - parachain_block_number: 3, - relaychain_block_number: 5, - } - .into(), - ]); - let origin = MultiLocation::new(1, X1(Parachain(OTHER_PARA_ID))); - let loc = MultiLocation::new(1, X2(Parachain(OTHER_PARA_ID), GeneralIndex(0))); - let asset: MultiAsset = (loc, 30 * UNITS).into(); + assert_xcm_message_processing_failed(); + let origin = MultiLocation::new(1, X1(Junction::Parachain(OTHER_PARA_ID))); + let asset: Asset = Asset { + id: cumulus_primitives_core::AssetId(Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(OTHER_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), + fun: Fungible(30 * UNITS) + }; let hash = determine_hash(&origin, vec![asset]); assert_eq!(basilisk_runtime::PolkadotXcm::asset_trap(hash), 1); }); @@ -470,11 +467,18 @@ fn claim_trapped_asset_should_work() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(OTHER_PARA_ID), GeneralIndex(0)))) + basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)))) )); }); - claim_asset(asset.clone(), BOB); + let bob_loc = Location::new( + 0, + cumulus_primitives_core::Junctions::X1(Arc::new(vec![ + cumulus_primitives_core::Junction::AccountId32 { id: BOB, network: None }].try_into().unwrap() + )) + ); + + claim_asset(asset.clone(), bob_loc); Basilisk::execute_with(|| { assert_eq!( @@ -482,13 +486,13 @@ fn claim_trapped_asset_should_work() { 1000 * UNITS + 29_999_992_361_112u128 ); - let origin = MultiLocation::new(1, X1(Parachain(OTHER_PARA_ID))); + let origin = MultiLocation::new(1, X1(Junction::Parachain(OTHER_PARA_ID))); let hash = determine_hash(&origin, vec![asset]); assert_eq!(basilisk_runtime::PolkadotXcm::asset_trap(hash), 0); }); } -fn trap_asset() -> MultiAsset { +fn trap_asset() -> Asset { OtherParachain::execute_with(|| { assert_eq!( basilisk_runtime::Balances::free_balance(AccountId::from(ALICE)), @@ -506,7 +510,7 @@ fn trap_asset() -> MultiAsset { Junction::AccountId32 { id: BOB, network: None } ) ) - .into() + .into_versioned() ), WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) )); @@ -516,43 +520,26 @@ fn trap_asset() -> MultiAsset { ); }); - let loc = MultiLocation::new(1, X2(Parachain(OTHER_PARA_ID), GeneralIndex(0))); - let asset: MultiAsset = (loc, 30 * UNITS).into(); + let asset: Asset = Asset { + id: cumulus_primitives_core::AssetId(Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(OTHER_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), + fun: Fungible(30 * UNITS) + }; + Basilisk::execute_with(|| { - expect_basilisk_events(vec![ - cumulus_pallet_xcmp_queue::Event::Fail { - message_hash: hex!["30291d1dfb68ae6f66d4c841facb78f44e7611ab2a25c84f4fb7347f448d2944"], - message_id: hex!["30291d1dfb68ae6f66d4c841facb78f44e7611ab2a25c84f4fb7347f448d2944"], - error: XcmError::AssetNotFound, - weight: Weight::from_parts(300_000_000, 0), - } - .into(), - pallet_relaychain_info::Event::CurrentBlockNumbers { - parachain_block_number: 3, - relaychain_block_number: 5, - } - .into(), - ]); - let origin = MultiLocation::new(1, X1(Parachain(OTHER_PARA_ID))); - let loc = MultiLocation::new(1, X2(Parachain(OTHER_PARA_ID), GeneralIndex(0))); - let asset: MultiAsset = (loc, 30 * UNITS).into(); - let hash = determine_hash(&origin, vec![asset]); + assert_xcm_message_processing_failed(); + let origin = MultiLocation::new(1, X1(Junction::Parachain(OTHER_PARA_ID))); + let hash = determine_hash(&origin, vec![asset.clone()]); assert_eq!(basilisk_runtime::PolkadotXcm::asset_trap(hash), 1); }); asset } -fn claim_asset(asset: MultiAsset, recipient: [u8; 32]) { + +fn claim_asset(asset: Asset, recipient: Location) { + OtherParachain::execute_with(|| { - let recipient = MultiLocation::new( - 0, - X1(Junction::AccountId32 { - network: None, - id: recipient, - }), - ); let xcm_msg = Xcm(vec![ ClaimAsset { assets: vec![asset.clone()].into(), @@ -569,7 +556,7 @@ fn claim_asset(asset: MultiAsset, recipient: [u8; 32]) { ]); assert_ok!(basilisk_runtime::PolkadotXcm::send( basilisk_runtime::RuntimeOrigin::root(), - Box::new(MultiLocation::new(1, X1(Parachain(BASILISK_PARA_ID))).into()), + Box::new(MultiLocation::new(1, X1(Junction::Parachain(BASILISK_PARA_ID))).into_versioned()), Box::new(VersionedXcm::from(xcm_msg)) )); }); @@ -580,19 +567,20 @@ fn polkadot_xcm_execute_extrinsic_should_not_be_allowed() { TestNet::reset(); Basilisk::execute_with(|| { - let message = VersionedXcm::V3(Xcm(vec![ + + let xcm_msg = Xcm(vec![ WithdrawAsset((Here, 410000000000u128).into()), BuyExecution { fees: (Here, 400000000000u128).into(), weight_limit: Unlimited, }, ClearError, - ])); + ]); assert_noop!( basilisk_runtime::PolkadotXcm::execute( basilisk_runtime::RuntimeOrigin::signed(ALICE.into()), - Box::new(message), + Box::new(VersionedXcm::from(xcm_msg)), Weight::from_parts(400_000_000_000, 0) ), pallet_xcm::Error::::Filtered diff --git a/integration-tests/src/exchange_asset.rs b/integration-tests/src/exchange_asset.rs index bcec0866dea..5ac3060ec16 100644 --- a/integration-tests/src/exchange_asset.rs +++ b/integration-tests/src/exchange_asset.rs @@ -11,12 +11,23 @@ use hydradx_traits::router::AssetPair; use hydradx_traits::router::PoolType; use hydradx_traits::router::Trade; use orml_traits::currency::MultiCurrency; -use polkadot_xcm::{v3::prelude::*, VersionedXcm}; use pretty_assertions::assert_eq; use primitives::constants::chain::CORE_ASSET_ID; use sp_runtime::FixedU128; use xcm_emulator::TestExt; +use polkadot_xcm::{v4::prelude::*, VersionedAssets, VersionedLocation, VersionedXcm}; + +use xcm_emulator::{pallet_message_queue}; + +use polkadot_xcm::opaque::lts::Assets; +use polkadot_xcm::opaque::v3::MultiLocation; +use polkadot_xcm::opaque::v3::MultiAssets; +use polkadot_xcm::opaque::v3::Junctions::{X1, X2}; +use polkadot_xcm::opaque::v3::Junction; +use polkadot_xcm::opaque::v3::MultiAsset; +use sp_std::sync::Arc; + pub const SELL: bool = true; pub const BUY: bool = false; @@ -34,9 +45,19 @@ fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_sell() { }); OtherParachain::execute_with(|| { + let sell_amount: Asset = Asset { + id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), + fun: Fungible(5 * UNITS) + }; + + let min_amount_out: Asset = Asset { + id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(CORE_ASSET_ID.into())].try_into().unwrap())))), + fun: Fungible(2 * UNITS) + }; + let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>( - MultiAsset::from((GeneralIndex(0), 5 * UNITS)), - MultiAsset::from((GeneralIndex(CORE_ASSET_ID.into()), 2 * UNITS)), + sell_amount, + min_amount_out, SELL, ); //Act @@ -76,6 +97,7 @@ fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_sell() { }); } + #[test] fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_buy() { //Arrange @@ -98,9 +120,19 @@ fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_buy() { let amount_out = 20 * UNITS; OtherParachain::execute_with(|| { + let max_amount_in: Asset = Asset { + id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), + fun: Fungible(70 * UNITS) + }; + + let amount_out_asset: Asset = Asset { + id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(CORE_ASSET_ID.into())].try_into().unwrap())))), + fun: Fungible(amount_out) + }; + let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>( - MultiAsset::from((GeneralIndex(0), 70 * UNITS)), - MultiAsset::from((GeneralIndex(CORE_ASSET_ID.into()), amount_out)), + max_amount_in, + amount_out_asset, BUY, ); //Act @@ -125,23 +157,14 @@ fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_buy() { )); }); - let fees = 27_500_000_000_000; - let amount_in = 41_791_666_666_665; - Basilisk::execute_with(|| { - assert_eq!( - basilisk_runtime::Tokens::free_balance(KAR, &AccountId::from(BOB)), - 100 * UNITS - amount_in - fees - ); + let fees = basilisk_runtime::Tokens::free_balance(KAR, &basilisk_runtime::Treasury::account_id()); + assert!(fees > 0, "Fees are not sent to treasury"); assert_eq!( basilisk_runtime::Balances::free_balance(AccountId::from(BOB)), BOB_INITIAL_BSX_BALANCE + amount_out ); - assert_eq!( - basilisk_runtime::Tokens::free_balance(KAR, &basilisk_runtime::Treasury::account_id()), - fees - ); }); } @@ -160,7 +183,7 @@ fn basilisk_should_swap_assets_coming_from_karura_when_onchain_route_present() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), KSM, - basilisk_runtime::AssetLocation(MultiLocation::new(0, X1(GeneralIndex(3)))) + basilisk_runtime::AssetLocation(MultiLocation::new(0, polkadot_xcm::opaque::v3::Junctions::X1(polkadot_xcm::opaque::v3::Junction::GeneralIndex(3)))) )); //Register onchain route from KAR to KSM @@ -185,9 +208,19 @@ fn basilisk_should_swap_assets_coming_from_karura_when_onchain_route_present() { }); OtherParachain::execute_with(|| { + let amount_in: Asset = Asset { + id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), + fun: Fungible(5 * UNITS) + }; + + let min_amount_out: Asset = Asset { + id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(KSM.into())].try_into().unwrap())))), + fun: Fungible(2 * UNITS) + }; + let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>( - MultiAsset::from((GeneralIndex(0), 5 * UNITS)), - MultiAsset::from((GeneralIndex(KSM.into()), 2 * UNITS)), + amount_in, + min_amount_out, SELL, ); //Act @@ -231,6 +264,8 @@ fn basilisk_should_swap_assets_coming_from_karura_when_onchain_route_present() { } fn register_kar() { + let kar_loc = Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(OTHER_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap()))); + assert_ok!(basilisk_runtime::AssetRegistry::register( basilisk_runtime::RuntimeOrigin::root(), b"KAR".to_vec(), @@ -240,7 +275,7 @@ fn register_kar() { None, Some(basilisk_runtime::AssetLocation(MultiLocation::new( 1, - X2(Parachain(OTHER_PARA_ID), GeneralIndex(0)) + X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)) ))), None )); @@ -257,8 +292,9 @@ fn add_currency_price(asset_id: u32, price: FixedU128) { basilisk_runtime::MultiTransactionPayment::on_initialize(basilisk_runtime::System::block_number()); } -fn craft_exchange_asset_xcm, RC: Decode + GetDispatchInfo>( - give: MultiAsset, + +fn craft_exchange_asset_xcm, RC: Decode + GetDispatchInfo>( + give: Asset, want: M, is_sell: bool, ) -> VersionedXcm { @@ -268,19 +304,37 @@ fn craft_exchange_asset_xcm, RC: Decode + GetDispatchInfo>( type Weigher = FixedWeightBounds>; - let dest = MultiLocation::new(1, Parachain(BASILISK_PARA_ID)); - let beneficiary = Junction::AccountId32 { id: BOB, network: None }.into(); - let assets: MultiAssets = MultiAsset::from((GeneralIndex(0), 100 * UNITS)).into(); // hardcoded + let dest = Location::new( + 1, + cumulus_primitives_core::Junctions::X1(Arc::new(vec![ + cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)].try_into().unwrap() + )) + ); + + let beneficiary = Location::new( + 0, + cumulus_primitives_core::Junctions::X1(Arc::new(vec![ + cumulus_primitives_core::Junction::AccountId32 { id: BOB, network: None }].try_into().unwrap() + )) + ); + + let assets: Assets = Asset { + id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), + fun: Fungible(100 * UNITS) + }.into(); + + //let assets: MultiAssets = MultiAsset::from((cumulus_primitives_core::Junction::GeneralIndex(0), 100 * UNITS)).into(); // hardcoded let max_assets = assets.len() as u32 + 1; - let context = X2(GlobalConsensus(NetworkId::Polkadot), Parachain(OTHER_PARA_ID)); + let context = cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::GlobalConsensus(NetworkId::Polkadot), cumulus_primitives_core::Junction::Parachain(OTHER_PARA_ID)].try_into().unwrap())); + let fees = assets .get(0) .expect("should have at least 1 asset") .clone() - .reanchored(&dest, context) + .reanchored(&dest, &context) .expect("should reanchor"); - let give = give.reanchored(&dest, context).expect("should reanchor give"); - let give: MultiAssetFilter = Definite(give.into()); + let give = give.reanchored(&dest, &context).expect("should reanchor give"); + let give: AssetFilter = Definite(give.into()); let want = want.into(); let weight_limit = { let fees = fees.clone(); @@ -298,7 +352,7 @@ fn craft_exchange_asset_xcm, RC: Decode + GetDispatchInfo>( }, DepositAsset { assets: Wild(AllCounted(max_assets)), - beneficiary, + beneficiary: beneficiary.clone(), }, ]); // use local weight for remote message and hope for the best. @@ -323,7 +377,7 @@ fn craft_exchange_asset_xcm, RC: Decode + GetDispatchInfo>( SetFeesMode { jit_withdraw: true }, TransferReserveAsset { assets, dest, xcm }, ]); - VersionedXcm::V3(message) + VersionedXcm::from(message) } pub fn last_other_para_events(n: usize) -> Vec { diff --git a/integration-tests/src/kusama_test_net.rs b/integration-tests/src/kusama_test_net.rs index 2ef136227d3..6f26ed51298 100644 --- a/integration-tests/src/kusama_test_net.rs +++ b/integration-tests/src/kusama_test_net.rs @@ -41,6 +41,8 @@ pub fn parachain_reserve_account() -> AccountId { polkadot_parachain::primitives::Sibling::from(OTHER_PARA_ID).into_account_truncating() } +use polkadot_primitives::runtime_api::runtime_decl_for_parachain_host::ParachainHostV10; + pub use basilisk_runtime::{AccountId, VestingPalletId}; use cumulus_primitives_core::ParaId; use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; @@ -59,9 +61,24 @@ use primitives::constants::chain::CORE_ASSET_ID; pub use xcm_emulator::Network; use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains ,TestExt}; +pub type Kusama = KusamaRelayChain; +pub type Basilisk = BasiliskParachain; +pub type OtherParachain = OtherPara; + +decl_test_networks! { + pub struct TestNet { + relay_chain = KusamaRelayChain, + parachains = vec![ + OtherPara, + BasiliskParachain, + ], + bridge = () + }, +} + decl_test_relay_chains! { - #[api_version(5)] - pub struct Kusama { + #[api_version(10)] + pub struct KusamaRelayChain { genesis = kusama::genesis(), on_init = (), runtime = rococo_runtime, @@ -77,7 +94,7 @@ decl_test_relay_chains! { } decl_test_parachains! { - pub struct Basilisk { + pub struct BasiliskParachain { genesis = basilisk::genesis(), on_init = { basilisk_runtime::System::set_block_number(1); @@ -96,7 +113,7 @@ decl_test_parachains! { Balances: basilisk_runtime::Balances, } }, - pub struct OtherParachain { + pub struct OtherPara { genesis = other_parachain::genesis(), on_init = { basilisk_runtime::System::set_block_number(1); @@ -117,17 +134,6 @@ decl_test_parachains! { } } -decl_test_networks! { - pub struct TestNet { - relay_chain = Kusama, - parachains = vec![ - OtherParachain, - Basilisk, - ], - bridge = () - }, -} - pub mod kusama { use super::*; @@ -185,7 +191,6 @@ pub mod kusama { fn session_keys( babe: BabeId, grandpa: GrandpaId, - im_online: ImOnlineId, para_validator: ValidatorId, para_assignment: AssignmentId, authority_discovery: AuthorityDiscoveryId, @@ -194,7 +199,6 @@ pub mod kusama { rococo_runtime::SessionKeys { babe, grandpa, - im_online, para_validator, para_assignment, authority_discovery, @@ -207,12 +211,14 @@ pub mod kusama { AccountId, BabeId, GrandpaId, - ImOnlineId, ValidatorId, AssignmentId, AuthorityDiscoveryId, + BeefyId )> { - vec![get_authority_keys_from_seed_no_beefy("Alice")] + let no_beefy =get_authority_keys_from_seed_no_beefy("Alice"); + let with_beefy = (no_beefy.0, no_beefy.1, no_beefy.2, no_beefy.3, no_beefy.4, no_beefy.5, no_beefy.6, get_from_seed::("Alice")); + vec![with_beefy] } pub fn genesis() -> Storage { @@ -237,7 +243,6 @@ pub mod kusama { x.5.clone(), x.6.clone(), x.7.clone(), - get_from_seed::("Alice"), ), ) }) @@ -523,3 +528,26 @@ pub fn kusama_run_to_block(to: BlockNumber) { rococo_runtime::System::set_block_number(b + 1); } } + +use cumulus_pallet_dmp_queue::Event; +use xcm_emulator::pallet_message_queue; + +pub fn assert_xcm_message_processing_failed() { + assert!(basilisk_runtime::System::events().iter().any(|r| matches!( + r.event, + basilisk_runtime::RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { + success: false, + .. + }) + ))); +} + +pub fn assert_xcm_message_processing_passed() { + assert!(basilisk_runtime::System::events().iter().any(|r| matches!( + r.event, + basilisk_runtime::RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { + success: true, + .. + }) + ))); +} \ No newline at end of file diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index 01fa8b5128d..1a05d15f31b 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -13,5 +13,4 @@ mod oracle; mod router; mod transact_call_filter; mod vesting; -//mod xcm_rate_limiter; mod xyk; diff --git a/integration-tests/src/non_native_fee.rs b/integration-tests/src/non_native_fee.rs index be98b2dc9cb..22df68a5e4b 100644 --- a/integration-tests/src/non_native_fee.rs +++ b/integration-tests/src/non_native_fee.rs @@ -15,6 +15,7 @@ use frame_support::{ weights::Weight, }; use hydradx_traits::AMM; +use hydradx_traits::router::{PoolType, Trade}; use orml_traits::currency::MultiCurrency; use pallet_asset_registry::AssetType; use pallet_transaction_multi_payment::Price; @@ -25,12 +26,12 @@ pub fn basilisk_run_to_next_block() { let b = basilisk_runtime::System::block_number(); basilisk_runtime::System::on_finalize(b); - basilisk_runtime::MultiTransactionPayment::on_finalize(b); basilisk_runtime::EmaOracle::on_finalize(b); + basilisk_runtime::MultiTransactionPayment::on_finalize(b); basilisk_runtime::System::on_initialize(b + 1); - basilisk_runtime::MultiTransactionPayment::on_initialize(b + 1); basilisk_runtime::EmaOracle::on_initialize(b + 1); + basilisk_runtime::MultiTransactionPayment::on_initialize(b + 1); basilisk_runtime::System::set_block_number(b + 1); } @@ -64,6 +65,10 @@ fn non_native_fee_payment_works_with_configured_price() { }); } +use hydradx_traits::registry::{AssetKind, Create}; + +//TODO: it will only work once we had OracleWhiteList properly set, as we don't have oracle data for the BSX/NET_TOKEN, +// so no new price is calculated in on_init of multi-payment-pallet #[test] fn non_native_fee_payment_works_with_oracle_price_based_on_onchain_route() { TestNet::reset(); @@ -154,6 +159,20 @@ fn non_native_fee_payment_works_with_oracle_price_based_on_onchain_route() { false, )); + let route = vec![Trade { + pool: PoolType::XYK, + asset_in: BSX, + asset_out: NEW_TOKEN + }]; + + let route_asset_pair = hydradx_traits::router::AssetPair { + asset_in: BSX, + asset_out: NEW_TOKEN, + }; + //assert!(basilisk_runtime::Router::get_route(route_asset_pair).is_some()); + + //assert_ok!(basilisk_runtime::Router::set_route(basilisk_runtime::RuntimeOrigin::signed(ALICE.into()),route_asset_pair, route )); + basilisk_run_to_next_block(); // pay with the new token diff --git a/integration-tests/src/oracle.rs b/integration-tests/src/oracle.rs index 72e97bc25b6..dc5f4de8227 100644 --- a/integration-tests/src/oracle.rs +++ b/integration-tests/src/oracle.rs @@ -23,6 +23,7 @@ pub fn basilisk_run_to_next_block() { basilisk_runtime::System::set_block_number(b + 1); } +//TODO: this will only work once we have have OracleWhiteList properly set #[test] fn xyk_trades_are_ingested_into_oracle() { TestNet::reset(); diff --git a/integration-tests/src/router.rs b/integration-tests/src/router.rs index a89d85301b0..3bc7c31d07e 100644 --- a/integration-tests/src/router.rs +++ b/integration-tests/src/router.rs @@ -82,7 +82,7 @@ mod router_different_pools_tests { assert_trader_non_native_balance!(BOB_INITIAL_NEW_BOOTSTRAPPED_TOKEN_BALANCE, NEW_BOOTSTRAPPED_TOKEN); assert_trader_non_native_balance!(amount_out, KSM); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: AUSD, asset_out: KSM, amount_in: amount_to_sell, @@ -142,7 +142,7 @@ mod router_different_pools_tests { assert_trader_non_native_balance!(BOB_INITIAL_NEW_BOOTSTRAPPED_TOKEN_BALANCE, NEW_BOOTSTRAPPED_TOKEN); assert_trader_non_native_balance!(amount_to_buy, KSM); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: AUSD, asset_out: KSM, amount_in, @@ -200,7 +200,7 @@ mod xyk_router_tests { assert_trader_bsx_balance!(BOB_INITIAL_BSX_BALANCE - amount_to_sell); assert_trader_non_native_balance!(amount_out, KSM); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: KSM, amount_in: amount_to_sell, @@ -262,7 +262,7 @@ mod xyk_router_tests { assert_trader_non_native_balance!(BOB_INITIAL_AUSD_BALANCE, AUSD); assert_trader_non_native_balance!(0, MOVR); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: KSM, amount_in: amount_to_sell, @@ -484,7 +484,7 @@ mod xyk_router_tests { assert_trader_bsx_balance!(BOB_INITIAL_BSX_BALANCE - amount_in); assert_trader_non_native_balance!(amount_to_buy, KSM); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: KSM, amount_in, @@ -539,7 +539,7 @@ mod xyk_router_tests { assert_trader_non_native_balance!(BOB_INITIAL_AUSD_BALANCE + amount_to_buy, AUSD); assert_trader_non_native_balance!(0, KSM); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: AUSD, amount_in, @@ -602,7 +602,7 @@ mod xyk_router_tests { assert_trader_non_native_balance!(0, MOVR); assert_trader_non_native_balance!(0, KSM); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: AUSD, amount_in, @@ -840,7 +840,7 @@ mod lbp_router_tests { NEW_BOOTSTRAPPED_TOKEN ); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: NEW_BOOTSTRAPPED_TOKEN, amount_in: amount_to_sell, @@ -887,7 +887,7 @@ mod lbp_router_tests { ); assert_trader_bsx_balance!(BOB_INITIAL_BSX_BALANCE + amount_out); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: NEW_BOOTSTRAPPED_TOKEN, asset_out: BSX, amount_in: amount_to_sell, @@ -940,7 +940,7 @@ mod lbp_router_tests { assert_trader_non_native_balance!(BOB_INITIAL_NEW_BOOTSTRAPPED_TOKEN_BALANCE, NEW_BOOTSTRAPPED_TOKEN); assert_trader_non_native_balance!(amount_out, KSM); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: KSM, amount_in: amount_to_sell, @@ -993,7 +993,7 @@ mod lbp_router_tests { assert_trader_non_native_balance!(BOB_INITIAL_NEW_BOOTSTRAPPED_TOKEN_BALANCE, NEW_BOOTSTRAPPED_TOKEN); assert_trader_non_native_balance!(amount_out, KSM); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: KSM, amount_in: amount_to_sell, @@ -1040,7 +1040,7 @@ mod lbp_router_tests { NEW_BOOTSTRAPPED_TOKEN ); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: NEW_BOOTSTRAPPED_TOKEN, amount_in: amount_to_sell, @@ -1112,7 +1112,7 @@ mod lbp_router_tests { NEW_BOOTSTRAPPED_TOKEN ); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: NEW_BOOTSTRAPPED_TOKEN, amount_in, @@ -1159,7 +1159,7 @@ mod lbp_router_tests { NEW_BOOTSTRAPPED_TOKEN ); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: NEW_BOOTSTRAPPED_TOKEN, asset_out: BSX, amount_in, @@ -1212,7 +1212,7 @@ mod lbp_router_tests { assert_trader_non_native_balance!(BOB_INITIAL_NEW_BOOTSTRAPPED_TOKEN_BALANCE, NEW_BOOTSTRAPPED_TOKEN); assert_trader_non_native_balance!(amount_to_buy, KSM); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: KSM, amount_in, @@ -1265,7 +1265,7 @@ mod lbp_router_tests { assert_trader_non_native_balance!(BOB_INITIAL_NEW_BOOTSTRAPPED_TOKEN_BALANCE, NEW_BOOTSTRAPPED_TOKEN); assert_trader_non_native_balance!(amount_to_buy, KSM); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: KSM, amount_in, @@ -1312,7 +1312,7 @@ mod lbp_router_tests { NEW_BOOTSTRAPPED_TOKEN ); - expect_basilisk_events(vec![pallet_route_executor::Event::RouteExecuted { + expect_basilisk_events(vec![pallet_route_executor::Event::Executed { asset_in: BSX, asset_out: NEW_BOOTSTRAPPED_TOKEN, amount_in: spent_amount_in, diff --git a/integration-tests/src/transact_call_filter.rs b/integration-tests/src/transact_call_filter.rs index 7a3543de033..c0a6867e543 100644 --- a/integration-tests/src/transact_call_filter.rs +++ b/integration-tests/src/transact_call_filter.rs @@ -2,62 +2,69 @@ use crate::kusama_test_net::*; use frame_support::{assert_ok, dispatch::GetDispatchInfo, weights::Weight}; +use frame_support::traits::ProcessMessageError; use sp_runtime::codec::Encode; -use polkadot_xcm::v3::prelude::*; -use xcm_emulator::TestExt; +//use polkadot_xcm::v3::prelude::*; +use polkadot_xcm::{v4::prelude::*, VersionedAssets, VersionedLocation, VersionedXcm}; +use xcm_emulator::{pallet_message_queue, TestExt}; + +use polkadot_xcm::opaque::lts::Assets; +use polkadot_xcm::opaque::v3::MultiLocation; +use polkadot_xcm::opaque::v3::MultiAssets; +use polkadot_xcm::opaque::v3::Junctions::{X1, X2}; +use polkadot_xcm::opaque::v3::Junction; +use polkadot_xcm::opaque::v3::MultiAsset; +use sp_std::sync::Arc; #[test] fn allowed_transact_call_should_pass_filter() { // Arrange TestNet::reset(); Basilisk::execute_with(|| { - assert_ok!(basilisk_runtime::Balances::transfer( + assert_ok!(basilisk_runtime::Currencies::transfer( basilisk_runtime::RuntimeOrigin::signed(ALICE.into()), parachain_reserve_account(), + BSX, 1_000 * UNITS, )); }); OtherParachain::execute_with(|| { // allowed by SafeCallFilter and the runtime call filter - let call = pallet_balances::Call::::transfer { + let call = pallet_currencies::Call::::transfer { dest: BOB.into(), - value: UNITS, + currency_id: 0, + amount: UNITS, + }; + let bsx_loc = Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap()))); + let asset_to_withdraw: Asset = Asset { + id: cumulus_primitives_core::AssetId(bsx_loc.clone()), + fun: Fungible(900 * UNITS) + }; + + let asset_for_buy_execution: Asset = Asset { + id: cumulus_primitives_core::AssetId(bsx_loc), + fun: Fungible(800 * UNITS) }; + let message = Xcm(vec![ - WithdrawAsset( - ( - MultiLocation { - parents: 1, - interior: X2(Parachain(BASILISK_PARA_ID), GeneralIndex(0)), - }, - 900 * UNITS, - ) - .into(), - ), + WithdrawAsset(asset_to_withdraw.into()), BuyExecution { - fees: ( - MultiLocation { - parents: 1, - interior: X2(Parachain(BASILISK_PARA_ID), GeneralIndex(0)), - }, - 800 * UNITS, - ) - .into(), + fees: asset_for_buy_execution.into(), weight_limit: Unlimited, }, Transact { require_weight_at_most: call.get_dispatch_info().weight, origin_kind: OriginKind::SovereignAccount, - call: basilisk_runtime::RuntimeCall::Balances(call).encode().into(), + call: basilisk_runtime::RuntimeCall::Currencies(call).encode().into(), }, ExpectTransactStatus(MaybeErrorCode::Success), RefundSurplus, DepositAsset { assets: All.into(), - beneficiary: Junction::AccountId32 { + beneficiary: cumulus_primitives_core::Junction::AccountId32 { id: parachain_reserve_account().into(), network: None, } @@ -66,19 +73,23 @@ fn allowed_transact_call_should_pass_filter() { ]); // Act + let dest = Location::new( + 1, + cumulus_primitives_core::Junctions::X1(Arc::new(vec![ + cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)].try_into().unwrap() + )) + ); + assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm( - Here, - MultiLocation::new(1, X1(Parachain(BASILISK_PARA_ID))), + cumulus_primitives_core::Junctions::Here, + dest, message )); }); + // Assert Basilisk::execute_with(|| { - // Assert - assert!(basilisk_runtime::System::events().iter().any(|r| matches!( - r.event, - basilisk_runtime::RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Success { .. }) - ))); + assert_xcm_message_processing_passed(); assert_eq!( basilisk_runtime::Balances::free_balance(AccountId::from(BOB)), BOB_INITIAL_BSX_BALANCE + UNITS @@ -92,9 +103,10 @@ fn blocked_transact_calls_should_not_pass_filter() { TestNet::reset(); Basilisk::execute_with(|| { - assert_ok!(basilisk_runtime::Balances::transfer( + assert_ok!(basilisk_runtime::Currencies::transfer( basilisk_runtime::RuntimeOrigin::signed(ALICE.into()), parachain_reserve_account(), + BSX, 1_000 * UNITS, )); }); @@ -105,26 +117,20 @@ fn blocked_transact_calls_should_not_pass_filter() { reason: vec![0, 10], who: BOB.into(), }; + let bsx_loc = Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap()))); + let asset_to_withdraw: Asset = Asset { + id: cumulus_primitives_core::AssetId(bsx_loc.clone()), + fun: Fungible(900 * UNITS) + }; + + let asset_for_buy_execution: Asset = Asset { + id: cumulus_primitives_core::AssetId(bsx_loc), + fun: Fungible(800 * UNITS) + }; let message = Xcm(vec![ - WithdrawAsset( - ( - MultiLocation { - parents: 1, - interior: X2(Parachain(BASILISK_PARA_ID), GeneralIndex(0)), - }, - 900 * UNITS, - ) - .into(), - ), + WithdrawAsset(asset_to_withdraw.into()), BuyExecution { - fees: ( - MultiLocation { - parents: 1, - interior: X2(Parachain(BASILISK_PARA_ID), GeneralIndex(0)), - }, - 800 * UNITS, - ) - .into(), + fees: asset_for_buy_execution, weight_limit: Unlimited, }, Transact { @@ -136,7 +142,7 @@ fn blocked_transact_calls_should_not_pass_filter() { RefundSurplus, DepositAsset { assets: All.into(), - beneficiary: Junction::AccountId32 { + beneficiary: cumulus_primitives_core::Junction::AccountId32 { id: parachain_reserve_account().into(), network: None, } @@ -144,23 +150,24 @@ fn blocked_transact_calls_should_not_pass_filter() { }, ]); + let dest_basilisk = Location::new( + 1, + cumulus_primitives_core::Junctions::X1(Arc::new(vec![ + cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)].try_into().unwrap() + )) + ); + // Act assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm( Here, - MultiLocation::new(1, X1(Parachain(BASILISK_PARA_ID))), + dest_basilisk, message )); }); Basilisk::execute_with(|| { // Assert - assert!(basilisk_runtime::System::events().iter().any(|r| matches!( - r.event, - basilisk_runtime::RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Fail { - error: cumulus_primitives_core::XcmError::NoPermission, - .. - }) - ))); + assert_xcm_message_processing_failed() }); } @@ -170,9 +177,10 @@ fn safe_call_filter_should_respect_runtime_call_filter() { TestNet::reset(); Basilisk::execute_with(|| { - assert_ok!(basilisk_runtime::Balances::transfer( + assert_ok!(basilisk_runtime::Currencies::transfer( basilisk_runtime::RuntimeOrigin::signed(ALICE.into()), parachain_reserve_account(), + BSX, 1_000 * UNITS, )); }); @@ -183,26 +191,21 @@ fn safe_call_filter_should_respect_runtime_call_filter() { collection: 1u128, admin: ALICE.into(), }; + let bsx_loc = Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap()))); + let asset_to_withdraw: Asset = Asset { + id: cumulus_primitives_core::AssetId(bsx_loc.clone()), + fun: Fungible(900 * UNITS) + }; + + let asset_for_buy_execution: Asset = Asset { + id: cumulus_primitives_core::AssetId(bsx_loc), + fun: Fungible(800 * UNITS) + }; + let message = Xcm(vec![ - WithdrawAsset( - ( - MultiLocation { - parents: 1, - interior: X2(Parachain(BASILISK_PARA_ID), GeneralIndex(0)), - }, - 900 * UNITS, - ) - .into(), - ), + WithdrawAsset(asset_to_withdraw.into()), BuyExecution { - fees: ( - MultiLocation { - parents: 1, - interior: X2(Parachain(BASILISK_PARA_ID), GeneralIndex(0)), - }, - 800 * UNITS, - ) - .into(), + fees: asset_for_buy_execution, weight_limit: Unlimited, }, Transact { @@ -214,7 +217,7 @@ fn safe_call_filter_should_respect_runtime_call_filter() { RefundSurplus, DepositAsset { assets: All.into(), - beneficiary: Junction::AccountId32 { + beneficiary: cumulus_primitives_core::Junction::AccountId32 { id: parachain_reserve_account().into(), network: None, } @@ -222,22 +225,24 @@ fn safe_call_filter_should_respect_runtime_call_filter() { }, ]); + let dest_basilisk = Location::new( + 1, + cumulus_primitives_core::Junctions::X1(Arc::new(vec![ + cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)].try_into().unwrap() + )) + ); + // Act assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm( Here, - MultiLocation::new(1, X1(Parachain(BASILISK_PARA_ID))), + dest_basilisk, message )); }); + //Assert Basilisk::execute_with(|| { - // Assert - assert!(basilisk_runtime::System::events().iter().any(|r| matches!( - r.event, - basilisk_runtime::RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Fail { - error: cumulus_primitives_core::XcmError::NoPermission, - .. - }) - ))); + assert_xcm_message_processing_failed() }); } + diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs deleted file mode 100644 index 8e3421cdfb0..00000000000 --- a/integration-tests/src/xcm_rate_limiter.rs +++ /dev/null @@ -1,259 +0,0 @@ -#![cfg(test)] - -use crate::kusama_test_net::*; - -use frame_support::assert_ok; -use frame_support::weights::Weight; -use orml_traits::currency::MultiCurrency; -use pallet_asset_registry::AssetType; -use polkadot_xcm::prelude::*; -use xcm_emulator::TestExt; - -pub const EVE: [u8; 32] = [8u8; 32]; - -/// 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 basilisk_runtime::RuntimeEvent; - use cumulus_pallet_xcmp_queue::Event; - let RuntimeEvent::XcmpQueue(Event::XcmpMessageSent { message_hash }) = &last_parachain_events(n)[0] else { - panic!("expecting to find message sent event"); - }; - Some(*message_hash) -} - -// NOTE: Tests disabled until toggling the `runtime-benchmarks` feature no longer fails these tests. -// Github issue: https://github.com/galacticcouncil/Basilisk-node/issues/637 -#[ignore] -#[test] -fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { - // Arrange - TestNet::reset(); - - Basilisk::execute_with(|| { - assert_ok!(basilisk_runtime::AssetRegistry::set_location( - basilisk_runtime::RuntimeOrigin::root(), - AUSD, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(OTHER_PARA_ID), GeneralIndex(0)))) - )); - - // set an xcm rate limit - assert_ok!(basilisk_runtime::AssetRegistry::update( - basilisk_runtime::RuntimeOrigin::root(), - AUSD, - b"AUSD".to_vec(), - AssetType::Token, - None, - Some(50 * UNITS), - )); - - assert_eq!(basilisk_runtime::Tokens::free_balance(AUSD, &AccountId::from(EVE)), 0); - }); - - let amount = 100 * UNITS; - let mut message_hash = None; - OtherParachain::execute_with(|| { - assert!(basilisk_runtime::Balances::free_balance(AccountId::from(ALICE)) >= amount); - // Act - assert_ok!(basilisk_runtime::XTokens::transfer( - basilisk_runtime::RuntimeOrigin::signed(ALICE.into()), - 0, - amount, - Box::new( - MultiLocation::new( - 1, - X2( - Junction::Parachain(BASILISK_PARA_ID), - Junction::AccountId32 { id: EVE, network: None } - ) - ) - .into() - ), - WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) - )); - - // Assert - assert_eq!( - basilisk_runtime::Balances::free_balance(AccountId::from(ALICE)), - ALICE_INITIAL_NATIVE_BALANCE_ON_OTHER_PARACHAIN - amount - ); - - message_hash = get_message_hash_from_event(2); - }); - - Basilisk::execute_with(|| { - expect_basilisk_events(vec![ - cumulus_pallet_xcmp_queue::Event::XcmDeferred { - sender: OTHER_PARA_ID.into(), - sent_at: 3, - deferred_to: basilisk_runtime::DeferDuration::get() + 4, - index: (1, 1), - position: 1, - message_hash, - } - .into(), - pallet_relaychain_info::Event::CurrentBlockNumbers { - parachain_block_number: 1, - relaychain_block_number: 5, - } - .into(), - ]); - assert_eq!(basilisk_runtime::Tokens::free_balance(AUSD, &AccountId::from(EVE)), 0); - }); -} - -#[test] -#[ignore] -fn xcm_rate_limiter_should_not_limit_aca_when_limit_is_not_exceeded() { - // Arrange - TestNet::reset(); - - Basilisk::execute_with(|| { - assert_ok!(basilisk_runtime::AssetRegistry::set_location( - basilisk_runtime::RuntimeOrigin::root(), - AUSD, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(OTHER_PARA_ID), GeneralIndex(0)))) - )); - - // set an xcm rate limit - assert_ok!(basilisk_runtime::AssetRegistry::update( - basilisk_runtime::RuntimeOrigin::root(), - AUSD, - b"AUSD".to_vec(), - AssetType::Token, - None, - Some(101 * UNITS), - )); - }); - - let amount = 100 * UNITS; - OtherParachain::execute_with(|| { - // Act - assert_ok!(basilisk_runtime::XTokens::transfer( - basilisk_runtime::RuntimeOrigin::signed(ALICE.into()), - 0, - amount, - Box::new( - MultiLocation::new( - 1, - X2( - Junction::Parachain(BASILISK_PARA_ID), - Junction::AccountId32 { id: EVE, network: None } - ) - ) - .into() - ), - WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) - )); - - // Assert - assert_eq!( - basilisk_runtime::Balances::free_balance(AccountId::from(ALICE)), - ALICE_INITIAL_NATIVE_BALANCE_ON_OTHER_PARACHAIN - amount - ); - }); - - Basilisk::execute_with(|| { - let fee = basilisk_runtime::Tokens::free_balance(AUSD, &basilisk_runtime::Treasury::account_id()); - assert_eq!( - basilisk_runtime::Tokens::free_balance(AUSD, &AccountId::from(EVE)), - amount - fee - ); - }); -} - -#[test] -#[ignore] -fn deferred_messages_should_be_executable_by_root() { - // Arrange - TestNet::reset(); - - Basilisk::execute_with(|| { - assert_ok!(basilisk_runtime::AssetRegistry::set_location( - basilisk_runtime::RuntimeOrigin::root(), - AUSD, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(OTHER_PARA_ID), GeneralIndex(0)))) - )); - - // set an xcm rate limit - assert_ok!(basilisk_runtime::AssetRegistry::update( - basilisk_runtime::RuntimeOrigin::root(), - AUSD, - b"AUSD".to_vec(), - AssetType::Token, - None, - Some(50 * UNITS), - )); - - assert_eq!(basilisk_runtime::Tokens::free_balance(AUSD, &AccountId::from(EVE)), 0); - }); - - let amount = 100 * UNITS; - let mut message_hash = None; - let max_weight = Weight::from_parts(399_600_000_000, 0); - - OtherParachain::execute_with(|| { - assert!(basilisk_runtime::Balances::free_balance(AccountId::from(ALICE)) >= amount); - // Act - assert_ok!(basilisk_runtime::XTokens::transfer( - basilisk_runtime::RuntimeOrigin::signed(ALICE.into()), - 0, - amount, - Box::new( - MultiLocation::new( - 1, - X2( - Junction::Parachain(BASILISK_PARA_ID), - Junction::AccountId32 { id: EVE, network: None } - ) - ) - .into() - ), - WeightLimit::Limited(Weight::from_parts(399_600_000_000, 0)) - )); - - // Assert - assert_eq!( - basilisk_runtime::Balances::free_balance(AccountId::from(ALICE)), - ALICE_INITIAL_NATIVE_BALANCE_ON_OTHER_PARACHAIN - amount - ); - - message_hash = get_message_hash_from_event(2); - }); - - Basilisk::execute_with(|| { - expect_basilisk_events(vec![ - cumulus_pallet_xcmp_queue::Event::XcmDeferred { - sender: OTHER_PARA_ID.into(), - sent_at: 3, - deferred_to: basilisk_runtime::DeferDuration::get() + 4, - index: (1, 1), - position: 1, - message_hash, - } - .into(), - pallet_relaychain_info::Event::CurrentBlockNumbers { - parachain_block_number: 1, - relaychain_block_number: 5, - } - .into(), - ]); - assert_eq!(basilisk_runtime::Tokens::free_balance(AUSD, &AccountId::from(EVE)), 0); - - set_relaychain_block_number(basilisk_runtime::DeferDuration::get() + 4); - - assert_eq!(basilisk_runtime::Tokens::free_balance(AUSD, &AccountId::from(EVE)), 0); - assert_ok!(basilisk_runtime::XcmpQueue::service_deferred( - basilisk_runtime::RuntimeOrigin::root(), - max_weight, - OTHER_PARA_ID.into(), - basilisk_runtime::MaxBucketsProcessed::get(), - )); - - let fee = basilisk_runtime::Tokens::free_balance(AUSD, &basilisk_runtime::Treasury::account_id()); - assert_eq!( - basilisk_runtime::Tokens::free_balance(AUSD, &AccountId::from(EVE)), - amount - fee - ); - }); -} diff --git a/runtime/basilisk/src/weights/xcmp_queue.rs b/runtime/basilisk/src/weights/xcmp_queue.rs index d52118f4848..39f4dd445a4 100644 --- a/runtime/basilisk/src/weights/xcmp_queue.rs +++ b/runtime/basilisk/src/weights/xcmp_queue.rs @@ -65,26 +65,30 @@ impl WeightInfo for BasiliskWeight { } fn enqueue_xcmp_message() -> Weight { - todo!() + //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT + Weight::from_parts(9999999, 9999) } fn suspend_channel() -> Weight { - todo!() - } + //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT + Weight::from_parts(9999999, 9999) } fn resume_channel() -> Weight { - todo!() + //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT + Weight::from_parts(9999999, 9999) } fn take_first_concatenated_xcm() -> Weight { - todo!() + //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT + Weight::from_parts(9999999, 9999) } fn on_idle_good_msg() -> Weight { - todo!() - } + //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT + Weight::from_parts(9999999, 9999) } fn on_idle_large_msg() -> Weight { - todo!() + //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT + Weight::from_parts(9999999, 9999) } } diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index 41c78a0838d..09a6e3b0683 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -101,8 +101,9 @@ pub type Barrier = ( >, ); +use sp_std::sync::Arc; parameter_types! { - pub SelfLocation: Location = Location::here(); + pub SelfLocation: Location = Location::new(1, cumulus_primitives_core::Junctions::X1(Arc::new([cumulus_primitives_core::Junction::Parachain(ParachainInfo::get().into());1]))); } parameter_types! { From ea4e7d297143f84feaa55ced3eac714bfa18513f Mon Sep 17 00:00:00 2001 From: dmoka Date: Mon, 22 Apr 2024 13:22:15 +0200 Subject: [PATCH 14/56] remove warnings --- integration-tests/src/cross_chain_transfer.rs | 8 +------- integration-tests/src/exchange_asset.rs | 11 ++--------- integration-tests/src/kusama_test_net.rs | 8 +++----- integration-tests/src/non_native_fee.rs | 6 ++---- integration-tests/src/router.rs | 6 +++--- integration-tests/src/transact_call_filter.rs | 13 +++---------- 6 files changed, 14 insertions(+), 38 deletions(-) diff --git a/integration-tests/src/cross_chain_transfer.rs b/integration-tests/src/cross_chain_transfer.rs index ed11822329c..f27036ebb77 100644 --- a/integration-tests/src/cross_chain_transfer.rs +++ b/integration-tests/src/cross_chain_transfer.rs @@ -4,22 +4,16 @@ use crate::kusama_test_net::*; use frame_support::{assert_noop, assert_ok}; -use polkadot_xcm::{v4::prelude::*, VersionedAssets, VersionedLocation, VersionedXcm}; +use polkadot_xcm::{v4::prelude::*, VersionedAssets, VersionedXcm}; use cumulus_primitives_core::ParaId; -use frame_support::weights::Weight; -use hex_literal::hex; use orml_traits::currency::MultiCurrency; use sp_core::H256; use sp_runtime::traits::{AccountIdConversion, BlakeTwo256, Hash}; use xcm_emulator::TestExt; -use polkadot_xcm::opaque::lts::Assets; use polkadot_xcm::opaque::v3::MultiLocation; -use polkadot_xcm::opaque::v3::MultiAssets; use polkadot_xcm::opaque::v3::Junctions::{X1, X2}; use polkadot_xcm::opaque::v3::Junction; -use polkadot_xcm::opaque::v3::MultiAsset; -use polkadot_xcm::opaque::v3; use sp_std::sync::Arc; diff --git a/integration-tests/src/exchange_asset.rs b/integration-tests/src/exchange_asset.rs index 5ac3060ec16..68d0389f883 100644 --- a/integration-tests/src/exchange_asset.rs +++ b/integration-tests/src/exchange_asset.rs @@ -5,7 +5,6 @@ use basilisk_runtime::Currencies; use basilisk_runtime::RuntimeOrigin; use basilisk_runtime::XYK; use frame_support::dispatch::GetDispatchInfo; -use frame_support::weights::Weight; use frame_support::{assert_ok, pallet_prelude::*}; use hydradx_traits::router::AssetPair; use hydradx_traits::router::PoolType; @@ -16,16 +15,12 @@ use primitives::constants::chain::CORE_ASSET_ID; use sp_runtime::FixedU128; use xcm_emulator::TestExt; -use polkadot_xcm::{v4::prelude::*, VersionedAssets, VersionedLocation, VersionedXcm}; +use polkadot_xcm::{v4::prelude::*, VersionedXcm}; -use xcm_emulator::{pallet_message_queue}; -use polkadot_xcm::opaque::lts::Assets; use polkadot_xcm::opaque::v3::MultiLocation; -use polkadot_xcm::opaque::v3::MultiAssets; -use polkadot_xcm::opaque::v3::Junctions::{X1, X2}; +use polkadot_xcm::opaque::v3::Junctions::{ X2}; use polkadot_xcm::opaque::v3::Junction; -use polkadot_xcm::opaque::v3::MultiAsset; use sp_std::sync::Arc; pub const SELL: bool = true; @@ -264,8 +259,6 @@ fn basilisk_should_swap_assets_coming_from_karura_when_onchain_route_present() { } fn register_kar() { - let kar_loc = Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(OTHER_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap()))); - assert_ok!(basilisk_runtime::AssetRegistry::register( basilisk_runtime::RuntimeOrigin::root(), b"KAR".to_vec(), diff --git a/integration-tests/src/kusama_test_net.rs b/integration-tests/src/kusama_test_net.rs index 6f26ed51298..edc436d6bd1 100644 --- a/integration-tests/src/kusama_test_net.rs +++ b/integration-tests/src/kusama_test_net.rs @@ -41,8 +41,6 @@ pub fn parachain_reserve_account() -> AccountId { polkadot_parachain::primitives::Sibling::from(OTHER_PARA_ID).into_account_truncating() } -use polkadot_primitives::runtime_api::runtime_decl_for_parachain_host::ParachainHostV10; - pub use basilisk_runtime::{AccountId, VestingPalletId}; use cumulus_primitives_core::ParaId; use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; @@ -59,7 +57,7 @@ use sp_runtime::{traits::AccountIdConversion, BuildStorage}; use primitives::constants::chain::CORE_ASSET_ID; pub use xcm_emulator::Network; -use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains ,TestExt}; +use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains}; pub type Kusama = KusamaRelayChain; pub type Basilisk = BasiliskParachain; @@ -171,7 +169,6 @@ pub mod kusama { } } - use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use polkadot_primitives::{AssignmentId, ValidatorId}; use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy; use sc_consensus_grandpa::AuthorityId as GrandpaId; @@ -474,10 +471,12 @@ pub fn last_basilisk_events(n: usize) -> Vec { .collect() } +#[allow(dead_code)] pub fn expect_basilisk_events(e: Vec) { assert_eq!(last_basilisk_events(e.len()), e); } +#[allow(dead_code)] pub fn last_parachain_events(n: usize) -> Vec { frame_system::Pallet::::events() .into_iter() @@ -529,7 +528,6 @@ pub fn kusama_run_to_block(to: BlockNumber) { } } -use cumulus_pallet_dmp_queue::Event; use xcm_emulator::pallet_message_queue; pub fn assert_xcm_message_processing_failed() { diff --git a/integration-tests/src/non_native_fee.rs b/integration-tests/src/non_native_fee.rs index 22df68a5e4b..5cec3ef58a1 100644 --- a/integration-tests/src/non_native_fee.rs +++ b/integration-tests/src/non_native_fee.rs @@ -15,7 +15,6 @@ use frame_support::{ weights::Weight, }; use hydradx_traits::AMM; -use hydradx_traits::router::{PoolType, Trade}; use orml_traits::currency::MultiCurrency; use pallet_asset_registry::AssetType; use pallet_transaction_multi_payment::Price; @@ -65,7 +64,6 @@ fn non_native_fee_payment_works_with_configured_price() { }); } -use hydradx_traits::registry::{AssetKind, Create}; //TODO: it will only work once we had OracleWhiteList properly set, as we don't have oracle data for the BSX/NET_TOKEN, // so no new price is calculated in on_init of multi-payment-pallet @@ -159,7 +157,7 @@ fn non_native_fee_payment_works_with_oracle_price_based_on_onchain_route() { false, )); - let route = vec![Trade { + /*let route = vec![Trade { pool: PoolType::XYK, asset_in: BSX, asset_out: NEW_TOKEN @@ -168,7 +166,7 @@ fn non_native_fee_payment_works_with_oracle_price_based_on_onchain_route() { let route_asset_pair = hydradx_traits::router::AssetPair { asset_in: BSX, asset_out: NEW_TOKEN, - }; + };*/ //assert!(basilisk_runtime::Router::get_route(route_asset_pair).is_some()); //assert_ok!(basilisk_runtime::Router::set_route(basilisk_runtime::RuntimeOrigin::signed(ALICE.into()),route_asset_pair, route )); diff --git a/integration-tests/src/router.rs b/integration-tests/src/router.rs index 3bc7c31d07e..e460e22ffd3 100644 --- a/integration-tests/src/router.rs +++ b/integration-tests/src/router.rs @@ -23,7 +23,7 @@ pub const SALE_END: Option = Some(40); mod router_different_pools_tests { use crate::kusama_test_net::*; - use basilisk_runtime::{Router, RuntimeOrigin}; + use basilisk_runtime::{Router}; use xcm_emulator::TestExt; use frame_support::assert_ok; @@ -156,7 +156,7 @@ mod router_different_pools_tests { mod xyk_router_tests { use crate::kusama_test_net::*; - use basilisk_runtime::{Router, RuntimeOrigin}; + use basilisk_runtime::{Router}; use xcm_emulator::TestExt; use frame_support::{assert_noop, assert_ok}; @@ -794,7 +794,7 @@ mod xyk_router_tests { mod lbp_router_tests { use crate::kusama_test_net::*; - use basilisk_runtime::{Router, RuntimeOrigin, LBP}; + use basilisk_runtime::{Router}; use xcm_emulator::TestExt; use frame_support::assert_ok; diff --git a/integration-tests/src/transact_call_filter.rs b/integration-tests/src/transact_call_filter.rs index c0a6867e543..a7ab9ca92d4 100644 --- a/integration-tests/src/transact_call_filter.rs +++ b/integration-tests/src/transact_call_filter.rs @@ -1,21 +1,14 @@ #![cfg(test)] use crate::kusama_test_net::*; -use frame_support::{assert_ok, dispatch::GetDispatchInfo, weights::Weight}; -use frame_support::traits::ProcessMessageError; +use frame_support::{assert_ok, dispatch::GetDispatchInfo}; use sp_runtime::codec::Encode; //use polkadot_xcm::v3::prelude::*; -use polkadot_xcm::{v4::prelude::*, VersionedAssets, VersionedLocation, VersionedXcm}; +use polkadot_xcm::{v4::prelude::*}; -use xcm_emulator::{pallet_message_queue, TestExt}; +use xcm_emulator::{TestExt}; -use polkadot_xcm::opaque::lts::Assets; -use polkadot_xcm::opaque::v3::MultiLocation; -use polkadot_xcm::opaque::v3::MultiAssets; -use polkadot_xcm::opaque::v3::Junctions::{X1, X2}; -use polkadot_xcm::opaque::v3::Junction; -use polkadot_xcm::opaque::v3::MultiAsset; use sp_std::sync::Arc; #[test] fn allowed_transact_call_should_pass_filter() { From 853cc132bd74ff46e8857f7e797198c2b8a915a3 Mon Sep 17 00:00:00 2001 From: dmoka Date: Mon, 22 Apr 2024 13:49:07 +0200 Subject: [PATCH 15/56] allo every assets for oracle --- Cargo.lock | 10 +++++----- runtime/basilisk/src/assets.rs | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b0433cf8262..7ec158c232d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15970,11 +15970,6 @@ dependencies = [ "pkg-config", ] -[[patch.unused]] -name = "orml-currencies" -version = "0.8.0" -source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" - [[patch.unused]] name = "sp-core-hashing" version = "15.0.0" @@ -15984,3 +15979,8 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot name = "sp-crypto-ec-utils" version = "0.10.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" + +[[patch.unused]] +name = "orml-currencies" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/runtime/basilisk/src/assets.rs b/runtime/basilisk/src/assets.rs index 0638510fa82..33717388f19 100644 --- a/runtime/basilisk/src/assets.rs +++ b/runtime/basilisk/src/assets.rs @@ -272,6 +272,7 @@ impl pallet_lbp::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] use codec::Decode; +use frame_support::traits::Everything; pub struct RootAsVestingPallet; impl EnsureOrigin for RootAsVestingPallet { @@ -658,7 +659,7 @@ impl pallet_ema_oracle::Config for Runtime { type AuthorityOrigin = SuperMajorityTechCommitteeOrRoot; type BlockNumberProvider = RelayChainBlockNumberProvider; type SupportedPeriods = SupportedPeriods; - type OracleWhitelist = (); // TODO: What do here ? + type OracleWhitelist = Everything; type MaxUniqueEntries = MaxUniqueOracleEntries; #[cfg(feature = "runtime-benchmarks")] type BenchmarkHelper = (); //TODO: implement helper From 20dc5cb72d7e41f3e3e52a5648951f8c4f55fdd7 Mon Sep 17 00:00:00 2001 From: dmoka Date: Mon, 22 Apr 2024 13:54:00 +0200 Subject: [PATCH 16/56] cleaning up --- integration-tests/src/non_native_fee.rs | 17 ----------------- integration-tests/src/oracle.rs | 1 - 2 files changed, 18 deletions(-) diff --git a/integration-tests/src/non_native_fee.rs b/integration-tests/src/non_native_fee.rs index 5cec3ef58a1..7415109052e 100644 --- a/integration-tests/src/non_native_fee.rs +++ b/integration-tests/src/non_native_fee.rs @@ -64,9 +64,6 @@ fn non_native_fee_payment_works_with_configured_price() { }); } - -//TODO: it will only work once we had OracleWhiteList properly set, as we don't have oracle data for the BSX/NET_TOKEN, -// so no new price is calculated in on_init of multi-payment-pallet #[test] fn non_native_fee_payment_works_with_oracle_price_based_on_onchain_route() { TestNet::reset(); @@ -157,20 +154,6 @@ fn non_native_fee_payment_works_with_oracle_price_based_on_onchain_route() { false, )); - /*let route = vec![Trade { - pool: PoolType::XYK, - asset_in: BSX, - asset_out: NEW_TOKEN - }]; - - let route_asset_pair = hydradx_traits::router::AssetPair { - asset_in: BSX, - asset_out: NEW_TOKEN, - };*/ - //assert!(basilisk_runtime::Router::get_route(route_asset_pair).is_some()); - - //assert_ok!(basilisk_runtime::Router::set_route(basilisk_runtime::RuntimeOrigin::signed(ALICE.into()),route_asset_pair, route )); - basilisk_run_to_next_block(); // pay with the new token diff --git a/integration-tests/src/oracle.rs b/integration-tests/src/oracle.rs index dc5f4de8227..72e97bc25b6 100644 --- a/integration-tests/src/oracle.rs +++ b/integration-tests/src/oracle.rs @@ -23,7 +23,6 @@ pub fn basilisk_run_to_next_block() { basilisk_runtime::System::set_block_number(b + 1); } -//TODO: this will only work once we have have OracleWhiteList properly set #[test] fn xyk_trades_are_ingested_into_oracle() { TestNet::reset(); From 38106480e9be7b24931a284cd07e3e3b5aa9ce07 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 22 Apr 2024 14:27:14 +0200 Subject: [PATCH 17/56] Add migrations --- Cargo.lock | 10 +- integration-tests/src/cross_chain_transfer.rs | 78 +++++++--- integration-tests/src/exchange_asset.rs | 139 ++++++++++++------ integration-tests/src/kusama_test_net.rs | 35 +++-- integration-tests/src/router.rs | 6 +- integration-tests/src/transact_call_filter.rs | 93 +++++++----- node/src/command.rs | 12 +- pallets/asset-registry/src/lib.rs | 33 ++--- pallets/asset-registry/src/types.rs | 1 - runtime/basilisk/src/lib.rs | 2 + runtime/basilisk/src/weights/xcmp_queue.rs | 6 +- 11 files changed, 263 insertions(+), 152 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ec158c232d..b0433cf8262 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15970,6 +15970,11 @@ dependencies = [ "pkg-config", ] +[[patch.unused]] +name = "orml-currencies" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" + [[patch.unused]] name = "sp-core-hashing" version = "15.0.0" @@ -15979,8 +15984,3 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot name = "sp-crypto-ec-utils" version = "0.10.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" - -[[patch.unused]] -name = "orml-currencies" -version = "0.8.0" -source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/integration-tests/src/cross_chain_transfer.rs b/integration-tests/src/cross_chain_transfer.rs index f27036ebb77..b36c4c176bd 100644 --- a/integration-tests/src/cross_chain_transfer.rs +++ b/integration-tests/src/cross_chain_transfer.rs @@ -8,18 +8,17 @@ use polkadot_xcm::{v4::prelude::*, VersionedAssets, VersionedXcm}; use cumulus_primitives_core::ParaId; use orml_traits::currency::MultiCurrency; +use polkadot_xcm::opaque::v3::Junction; +use polkadot_xcm::opaque::v3::Junctions::{X1, X2}; +use polkadot_xcm::opaque::v3::MultiLocation; use sp_core::H256; use sp_runtime::traits::{AccountIdConversion, BlakeTwo256, Hash}; use xcm_emulator::TestExt; -use polkadot_xcm::opaque::v3::MultiLocation; -use polkadot_xcm::opaque::v3::Junctions::{X1, X2}; -use polkadot_xcm::opaque::v3::Junction; use sp_std::sync::Arc; // Determine the hash for assets expected to be have been trapped. -fn determine_hash(origin: &MultiLocation, assets: Vec) -> H256 -{ +fn determine_hash(origin: &MultiLocation, assets: Vec) -> H256 { let versioned = VersionedAssets::from(Assets::from(assets)); BlakeTwo256::hash_of(&(origin, &versioned)) } @@ -104,7 +103,9 @@ fn basilisk_should_receive_asset_when_sent_from_other_parachain() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0))).into()) + basilisk_runtime::AssetLocation( + MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0))).into() + ) )); }); @@ -154,7 +155,10 @@ fn other_parachain_should_receive_asset_when_sent_from_basilisk() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(BASILISK_PARA_ID), Junction::GeneralIndex(0)))) + basilisk_runtime::AssetLocation(MultiLocation::new( + 1, + X2(Junction::Parachain(BASILISK_PARA_ID), Junction::GeneralIndex(0)) + )) )); }); @@ -210,7 +214,10 @@ fn transfer_from_other_parachain_and_back() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)))) + basilisk_runtime::AssetLocation(MultiLocation::new( + 1, + X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)) + )) )); }); @@ -299,7 +306,10 @@ fn other_parachain_should_fail_to_send_asset_to_basilisk_when_insufficient_amoun assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)))) + basilisk_runtime::AssetLocation(MultiLocation::new( + 1, + X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)) + )) )); }); @@ -356,7 +366,10 @@ fn fee_currency_set_on_xcm_transfer() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)))) + basilisk_runtime::AssetLocation(MultiLocation::new( + 1, + X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)) + )) )); // fee currency is not set before XCM transfer @@ -441,8 +454,18 @@ fn assets_should_be_trapped_when_assets_are_unknown() { assert_xcm_message_processing_failed(); let origin = MultiLocation::new(1, X1(Junction::Parachain(OTHER_PARA_ID))); let asset: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(OTHER_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), - fun: Fungible(30 * UNITS) + id: cumulus_primitives_core::AssetId(Location::new( + 1, + cumulus_primitives_core::Junctions::X2(Arc::new( + vec![ + cumulus_primitives_core::Junction::Parachain(OTHER_PARA_ID), + cumulus_primitives_core::Junction::GeneralIndex(0), + ] + .try_into() + .unwrap(), + )), + )), + fun: Fungible(30 * UNITS), }; let hash = determine_hash(&origin, vec![asset]); assert_eq!(basilisk_runtime::PolkadotXcm::asset_trap(hash), 1); @@ -461,15 +484,20 @@ fn claim_trapped_asset_should_work() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), 1, - basilisk_runtime::AssetLocation(MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)))) + basilisk_runtime::AssetLocation(MultiLocation::new( + 1, + X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0)) + )) )); }); let bob_loc = Location::new( 0, - cumulus_primitives_core::Junctions::X1(Arc::new(vec![ - cumulus_primitives_core::Junction::AccountId32 { id: BOB, network: None }].try_into().unwrap() - )) + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::AccountId32 { id: BOB, network: None }] + .try_into() + .unwrap(), + )), ); claim_asset(asset.clone(), bob_loc); @@ -515,11 +543,20 @@ fn trap_asset() -> Asset { }); let asset: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(OTHER_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), - fun: Fungible(30 * UNITS) + id: cumulus_primitives_core::AssetId(Location::new( + 1, + cumulus_primitives_core::Junctions::X2(Arc::new( + vec![ + cumulus_primitives_core::Junction::Parachain(OTHER_PARA_ID), + cumulus_primitives_core::Junction::GeneralIndex(0), + ] + .try_into() + .unwrap(), + )), + )), + fun: Fungible(30 * UNITS), }; - Basilisk::execute_with(|| { assert_xcm_message_processing_failed(); let origin = MultiLocation::new(1, X1(Junction::Parachain(OTHER_PARA_ID))); @@ -530,9 +567,7 @@ fn trap_asset() -> Asset { asset } - fn claim_asset(asset: Asset, recipient: Location) { - OtherParachain::execute_with(|| { let xcm_msg = Xcm(vec![ ClaimAsset { @@ -561,7 +596,6 @@ fn polkadot_xcm_execute_extrinsic_should_not_be_allowed() { TestNet::reset(); Basilisk::execute_with(|| { - let xcm_msg = Xcm(vec![ WithdrawAsset((Here, 410000000000u128).into()), BuyExecution { diff --git a/integration-tests/src/exchange_asset.rs b/integration-tests/src/exchange_asset.rs index 68d0389f883..109f208826d 100644 --- a/integration-tests/src/exchange_asset.rs +++ b/integration-tests/src/exchange_asset.rs @@ -15,12 +15,11 @@ use primitives::constants::chain::CORE_ASSET_ID; use sp_runtime::FixedU128; use xcm_emulator::TestExt; -use polkadot_xcm::{v4::prelude::*, VersionedXcm}; +use polkadot_xcm::{v4::prelude::*, VersionedXcm}; - -use polkadot_xcm::opaque::v3::MultiLocation; -use polkadot_xcm::opaque::v3::Junctions::{ X2}; use polkadot_xcm::opaque::v3::Junction; +use polkadot_xcm::opaque::v3::Junctions::X2; +use polkadot_xcm::opaque::v3::MultiLocation; use sp_std::sync::Arc; pub const SELL: bool = true; @@ -41,20 +40,30 @@ fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_sell() { OtherParachain::execute_with(|| { let sell_amount: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), - fun: Fungible(5 * UNITS) + id: cumulus_primitives_core::AssetId(Location::new( + 0, + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::GeneralIndex(0)] + .try_into() + .unwrap(), + )), + )), + fun: Fungible(5 * UNITS), }; let min_amount_out: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(CORE_ASSET_ID.into())].try_into().unwrap())))), - fun: Fungible(2 * UNITS) + id: cumulus_primitives_core::AssetId(Location::new( + 0, + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::GeneralIndex(CORE_ASSET_ID.into())] + .try_into() + .unwrap(), + )), + )), + fun: Fungible(2 * UNITS), }; - let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>( - sell_amount, - min_amount_out, - SELL, - ); + let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>(sell_amount, min_amount_out, SELL); //Act let res = basilisk_runtime::PolkadotXcm::execute( basilisk_runtime::RuntimeOrigin::signed(ALICE.into()), @@ -92,7 +101,6 @@ fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_sell() { }); } - #[test] fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_buy() { //Arrange @@ -116,20 +124,30 @@ fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_buy() { let amount_out = 20 * UNITS; OtherParachain::execute_with(|| { let max_amount_in: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), - fun: Fungible(70 * UNITS) + id: cumulus_primitives_core::AssetId(Location::new( + 0, + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::GeneralIndex(0)] + .try_into() + .unwrap(), + )), + )), + fun: Fungible(70 * UNITS), }; let amount_out_asset: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(CORE_ASSET_ID.into())].try_into().unwrap())))), - fun: Fungible(amount_out) + id: cumulus_primitives_core::AssetId(Location::new( + 0, + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::GeneralIndex(CORE_ASSET_ID.into())] + .try_into() + .unwrap(), + )), + )), + fun: Fungible(amount_out), }; - let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>( - max_amount_in, - amount_out_asset, - BUY, - ); + let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>(max_amount_in, amount_out_asset, BUY); //Act let res = basilisk_runtime::PolkadotXcm::execute( basilisk_runtime::RuntimeOrigin::signed(ALICE.into()), @@ -153,7 +171,7 @@ fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_buy() { }); Basilisk::execute_with(|| { - let fees = basilisk_runtime::Tokens::free_balance(KAR, &basilisk_runtime::Treasury::account_id()); + let fees = basilisk_runtime::Tokens::free_balance(KAR, &basilisk_runtime::Treasury::account_id()); assert!(fees > 0, "Fees are not sent to treasury"); assert_eq!( @@ -178,7 +196,10 @@ fn basilisk_should_swap_assets_coming_from_karura_when_onchain_route_present() { assert_ok!(basilisk_runtime::AssetRegistry::set_location( basilisk_runtime::RuntimeOrigin::root(), KSM, - basilisk_runtime::AssetLocation(MultiLocation::new(0, polkadot_xcm::opaque::v3::Junctions::X1(polkadot_xcm::opaque::v3::Junction::GeneralIndex(3)))) + basilisk_runtime::AssetLocation(MultiLocation::new( + 0, + polkadot_xcm::opaque::v3::Junctions::X1(polkadot_xcm::opaque::v3::Junction::GeneralIndex(3)) + )) )); //Register onchain route from KAR to KSM @@ -204,20 +225,30 @@ fn basilisk_should_swap_assets_coming_from_karura_when_onchain_route_present() { OtherParachain::execute_with(|| { let amount_in: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), - fun: Fungible(5 * UNITS) + id: cumulus_primitives_core::AssetId(Location::new( + 0, + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::GeneralIndex(0)] + .try_into() + .unwrap(), + )), + )), + fun: Fungible(5 * UNITS), }; let min_amount_out: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(KSM.into())].try_into().unwrap())))), - fun: Fungible(2 * UNITS) + id: cumulus_primitives_core::AssetId(Location::new( + 0, + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::GeneralIndex(KSM.into())] + .try_into() + .unwrap(), + )), + )), + fun: Fungible(2 * UNITS), }; - let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>( - amount_in, - min_amount_out, - SELL, - ); + let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>(amount_in, min_amount_out, SELL); //Act let res = basilisk_runtime::PolkadotXcm::execute( basilisk_runtime::RuntimeOrigin::signed(ALICE.into()), @@ -285,7 +316,6 @@ fn add_currency_price(asset_id: u32, price: FixedU128) { basilisk_runtime::MultiTransactionPayment::on_initialize(basilisk_runtime::System::block_number()); } - fn craft_exchange_asset_xcm, RC: Decode + GetDispatchInfo>( give: Asset, want: M, @@ -299,26 +329,45 @@ fn craft_exchange_asset_xcm, RC: Decode + GetDispatchInfo>( let dest = Location::new( 1, - cumulus_primitives_core::Junctions::X1(Arc::new(vec![ - cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)].try_into().unwrap() - )) + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)] + .try_into() + .unwrap(), + )), ); let beneficiary = Location::new( 0, - cumulus_primitives_core::Junctions::X1(Arc::new(vec![ - cumulus_primitives_core::Junction::AccountId32 { id: BOB, network: None }].try_into().unwrap() - )) + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::AccountId32 { id: BOB, network: None }] + .try_into() + .unwrap(), + )), ); let assets: Assets = Asset { - id: cumulus_primitives_core::AssetId(Location::new(0, cumulus_primitives_core::Junctions::X1(Arc::new(vec![cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap())))), - fun: Fungible(100 * UNITS) - }.into(); + id: cumulus_primitives_core::AssetId(Location::new( + 0, + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::GeneralIndex(0)] + .try_into() + .unwrap(), + )), + )), + fun: Fungible(100 * UNITS), + } + .into(); //let assets: MultiAssets = MultiAsset::from((cumulus_primitives_core::Junction::GeneralIndex(0), 100 * UNITS)).into(); // hardcoded let max_assets = assets.len() as u32 + 1; - let context = cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::GlobalConsensus(NetworkId::Polkadot), cumulus_primitives_core::Junction::Parachain(OTHER_PARA_ID)].try_into().unwrap())); + let context = cumulus_primitives_core::Junctions::X2(Arc::new( + vec![ + cumulus_primitives_core::Junction::GlobalConsensus(NetworkId::Polkadot), + cumulus_primitives_core::Junction::Parachain(OTHER_PARA_ID), + ] + .try_into() + .unwrap(), + )); let fees = assets .get(0) diff --git a/integration-tests/src/kusama_test_net.rs b/integration-tests/src/kusama_test_net.rs index edc436d6bd1..0f5aa617e85 100644 --- a/integration-tests/src/kusama_test_net.rs +++ b/integration-tests/src/kusama_test_net.rs @@ -211,10 +211,19 @@ pub mod kusama { ValidatorId, AssignmentId, AuthorityDiscoveryId, - BeefyId + BeefyId, )> { - let no_beefy =get_authority_keys_from_seed_no_beefy("Alice"); - let with_beefy = (no_beefy.0, no_beefy.1, no_beefy.2, no_beefy.3, no_beefy.4, no_beefy.5, no_beefy.6, get_from_seed::("Alice")); + let no_beefy = get_authority_keys_from_seed_no_beefy("Alice"); + let with_beefy = ( + no_beefy.0, + no_beefy.1, + no_beefy.2, + no_beefy.3, + no_beefy.4, + no_beefy.5, + no_beefy.6, + get_from_seed::("Alice"), + ); vec![with_beefy] } @@ -532,20 +541,14 @@ use xcm_emulator::pallet_message_queue; pub fn assert_xcm_message_processing_failed() { assert!(basilisk_runtime::System::events().iter().any(|r| matches!( - r.event, - basilisk_runtime::RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { - success: false, - .. - }) - ))); + r.event, + basilisk_runtime::RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: false, .. }) + ))); } pub fn assert_xcm_message_processing_passed() { assert!(basilisk_runtime::System::events().iter().any(|r| matches!( - r.event, - basilisk_runtime::RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { - success: true, - .. - }) - ))); -} \ No newline at end of file + r.event, + basilisk_runtime::RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: true, .. }) + ))); +} diff --git a/integration-tests/src/router.rs b/integration-tests/src/router.rs index e460e22ffd3..c5a774c025d 100644 --- a/integration-tests/src/router.rs +++ b/integration-tests/src/router.rs @@ -23,7 +23,7 @@ pub const SALE_END: Option = Some(40); mod router_different_pools_tests { use crate::kusama_test_net::*; - use basilisk_runtime::{Router}; + use basilisk_runtime::Router; use xcm_emulator::TestExt; use frame_support::assert_ok; @@ -156,7 +156,7 @@ mod router_different_pools_tests { mod xyk_router_tests { use crate::kusama_test_net::*; - use basilisk_runtime::{Router}; + use basilisk_runtime::Router; use xcm_emulator::TestExt; use frame_support::{assert_noop, assert_ok}; @@ -794,7 +794,7 @@ mod xyk_router_tests { mod lbp_router_tests { use crate::kusama_test_net::*; - use basilisk_runtime::{Router}; + use basilisk_runtime::Router; use xcm_emulator::TestExt; use frame_support::assert_ok; diff --git a/integration-tests/src/transact_call_filter.rs b/integration-tests/src/transact_call_filter.rs index a7ab9ca92d4..1af30a9d43a 100644 --- a/integration-tests/src/transact_call_filter.rs +++ b/integration-tests/src/transact_call_filter.rs @@ -5,9 +5,9 @@ use frame_support::{assert_ok, dispatch::GetDispatchInfo}; use sp_runtime::codec::Encode; //use polkadot_xcm::v3::prelude::*; -use polkadot_xcm::{v4::prelude::*}; +use polkadot_xcm::v4::prelude::*; -use xcm_emulator::{TestExt}; +use xcm_emulator::TestExt; use sp_std::sync::Arc; #[test] @@ -31,15 +31,25 @@ fn allowed_transact_call_should_pass_filter() { currency_id: 0, amount: UNITS, }; - let bsx_loc = Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap()))); + let bsx_loc = Location::new( + 1, + cumulus_primitives_core::Junctions::X2(Arc::new( + vec![ + cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID), + cumulus_primitives_core::Junction::GeneralIndex(0), + ] + .try_into() + .unwrap(), + )), + ); let asset_to_withdraw: Asset = Asset { id: cumulus_primitives_core::AssetId(bsx_loc.clone()), - fun: Fungible(900 * UNITS) + fun: Fungible(900 * UNITS), }; let asset_for_buy_execution: Asset = Asset { id: cumulus_primitives_core::AssetId(bsx_loc), - fun: Fungible(800 * UNITS) + fun: Fungible(800 * UNITS), }; let message = Xcm(vec![ @@ -68,9 +78,11 @@ fn allowed_transact_call_should_pass_filter() { // Act let dest = Location::new( 1, - cumulus_primitives_core::Junctions::X1(Arc::new(vec![ - cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)].try_into().unwrap() - )) + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)] + .try_into() + .unwrap(), + )), ); assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm( @@ -110,15 +122,25 @@ fn blocked_transact_calls_should_not_pass_filter() { reason: vec![0, 10], who: BOB.into(), }; - let bsx_loc = Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap()))); + let bsx_loc = Location::new( + 1, + cumulus_primitives_core::Junctions::X2(Arc::new( + vec![ + cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID), + cumulus_primitives_core::Junction::GeneralIndex(0), + ] + .try_into() + .unwrap(), + )), + ); let asset_to_withdraw: Asset = Asset { id: cumulus_primitives_core::AssetId(bsx_loc.clone()), - fun: Fungible(900 * UNITS) + fun: Fungible(900 * UNITS), }; let asset_for_buy_execution: Asset = Asset { id: cumulus_primitives_core::AssetId(bsx_loc), - fun: Fungible(800 * UNITS) + fun: Fungible(800 * UNITS), }; let message = Xcm(vec![ WithdrawAsset(asset_to_withdraw.into()), @@ -145,17 +167,15 @@ fn blocked_transact_calls_should_not_pass_filter() { let dest_basilisk = Location::new( 1, - cumulus_primitives_core::Junctions::X1(Arc::new(vec![ - cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)].try_into().unwrap() - )) + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)] + .try_into() + .unwrap(), + )), ); // Act - assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm( - Here, - dest_basilisk, - message - )); + assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm(Here, dest_basilisk, message)); }); Basilisk::execute_with(|| { @@ -184,15 +204,25 @@ fn safe_call_filter_should_respect_runtime_call_filter() { collection: 1u128, admin: ALICE.into(), }; - let bsx_loc = Location::new(1, cumulus_primitives_core::Junctions::X2(Arc::new(vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID), cumulus_primitives_core::Junction::GeneralIndex(0)].try_into().unwrap()))); + let bsx_loc = Location::new( + 1, + cumulus_primitives_core::Junctions::X2(Arc::new( + vec![ + cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID), + cumulus_primitives_core::Junction::GeneralIndex(0), + ] + .try_into() + .unwrap(), + )), + ); let asset_to_withdraw: Asset = Asset { id: cumulus_primitives_core::AssetId(bsx_loc.clone()), - fun: Fungible(900 * UNITS) + fun: Fungible(900 * UNITS), }; let asset_for_buy_execution: Asset = Asset { id: cumulus_primitives_core::AssetId(bsx_loc), - fun: Fungible(800 * UNITS) + fun: Fungible(800 * UNITS), }; let message = Xcm(vec![ @@ -220,22 +250,17 @@ fn safe_call_filter_should_respect_runtime_call_filter() { let dest_basilisk = Location::new( 1, - cumulus_primitives_core::Junctions::X1(Arc::new(vec![ - cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)].try_into().unwrap() - )) + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)] + .try_into() + .unwrap(), + )), ); // Act - assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm( - Here, - dest_basilisk, - message - )); + assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm(Here, dest_basilisk, message)); }); //Assert - Basilisk::execute_with(|| { - assert_xcm_message_processing_failed() - }); + Basilisk::execute_with(|| assert_xcm_message_processing_failed()); } - diff --git a/node/src/command.rs b/node/src/command.rs index 65f5aab3d99..88349c28d19 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -31,12 +31,12 @@ use sc_cli::{ use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; use sc_service::config::{BasePath, PrometheusConfig}; use sp_core::hexdisplay::HexDisplay; -use sp_runtime::traits::{AccountIdConversion, Zero}; use sp_runtime::traits::Block as BlockT; -use sp_runtime::traits::Header as HeaderT; use sp_runtime::traits::Hash as HashT; -use std::io::Write; +use sp_runtime::traits::Header as HeaderT; +use sp_runtime::traits::{AccountIdConversion, Zero}; use sp_storage::StateVersion; +use std::io::Write; fn load_spec(id: &str) -> std::result::Result, String> { Ok(match id { @@ -475,10 +475,8 @@ pub fn generate_genesis_block( genesis_state_version, ); - let extrinsics_root = <<::Header as HeaderT>::Hashing as HashT>::trie_root( - Vec::new(), - genesis_state_version, - ); + let extrinsics_root = + <<::Header as HeaderT>::Hashing as HashT>::trie_root(Vec::new(), genesis_state_version); Ok(Block::new( <::Header as HeaderT>::new( diff --git a/pallets/asset-registry/src/lib.rs b/pallets/asset-registry/src/lib.rs index df512ecef5f..0db39a2d26d 100644 --- a/pallets/asset-registry/src/lib.rs +++ b/pallets/asset-registry/src/lib.rs @@ -600,9 +600,9 @@ impl ShareTokenRegistry, T::Balance, DispatchErro } } +use crate::types::{Name, Symbol}; use orml_traits::GetByKey; use sp_arithmetic::traits::Bounded; -use crate::types::{Name, Symbol}; // Return Existential deposit of an asset impl GetByKey for Pallet { @@ -698,7 +698,7 @@ pub const DEFAULT_ED: u128 = 1; // Dev note: this comes from new version of asset registry, but in order to support new xyk, we need to implement it here // but we can ignore the new fields for now -impl> Create for Pallet{ +impl> Create for Pallet { type Error = DispatchError; type Name = Name; type Symbol = Symbol; @@ -718,13 +718,13 @@ impl> Create for Pallet{ return Err(Error::::TooLong.into()); }; - Self::register_asset(asset_name, - kind.into(), - existential_deposit.unwrap_or(DEFAULT_ED), - asset_id, - xcm_rate_limit, + Self::register_asset( + asset_name, + kind.into(), + existential_deposit.unwrap_or(DEFAULT_ED), + asset_id, + xcm_rate_limit, ) - } fn get_or_register_asset( @@ -739,14 +739,13 @@ impl> Create for Pallet{ ) -> Result { match Self::asset_ids(&name) { Some(id) => Ok(id), - None => { - Self::register_asset(name, - kind.into(), - existential_deposit.unwrap_or(DEFAULT_ED), - None, - xcm_rate_limit, - ) - } + None => Self::register_asset( + name, + kind.into(), + existential_deposit.unwrap_or(DEFAULT_ED), + None, + xcm_rate_limit, + ), } } -} \ No newline at end of file +} diff --git a/pallets/asset-registry/src/types.rs b/pallets/asset-registry/src/types.rs index d5cb837b58c..f54679b6389 100644 --- a/pallets/asset-registry/src/types.rs +++ b/pallets/asset-registry/src/types.rs @@ -23,7 +23,6 @@ use hydradx_traits::AssetKind; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; - pub type Name = BoundedVec; pub type Symbol = BoundedVec; diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index cbb02925c71..cad14813cdb 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -267,6 +267,8 @@ pub type Executive = frame_executive::Executive< ( frame_support::migrations::RemovePallet::DbWeight>, frame_support::migrations::RemovePallet::DbWeight>, + cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, + pallet_identity::migration::versioned::V0ToV1, migrations::OnRuntimeUpgradeMigration, ), >; diff --git a/runtime/basilisk/src/weights/xcmp_queue.rs b/runtime/basilisk/src/weights/xcmp_queue.rs index 39f4dd445a4..d8dfd5a52ee 100644 --- a/runtime/basilisk/src/weights/xcmp_queue.rs +++ b/runtime/basilisk/src/weights/xcmp_queue.rs @@ -71,7 +71,8 @@ impl WeightInfo for BasiliskWeight { fn suspend_channel() -> Weight { //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT - Weight::from_parts(9999999, 9999) } + Weight::from_parts(9999999, 9999) + } fn resume_channel() -> Weight { //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT @@ -85,7 +86,8 @@ impl WeightInfo for BasiliskWeight { fn on_idle_good_msg() -> Weight { //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT - Weight::from_parts(9999999, 9999) } + Weight::from_parts(9999999, 9999) + } fn on_idle_large_msg() -> Weight { //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT From e1aa12938780dfcb63c9dcb9241a2ee875822988 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 22 Apr 2024 15:45:54 +0200 Subject: [PATCH 18/56] Add migrations --- Cargo.lock | 10 +++++----- pallets/xyk-liquidity-mining/src/lib.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b0433cf8262..7ec158c232d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15970,11 +15970,6 @@ dependencies = [ "pkg-config", ] -[[patch.unused]] -name = "orml-currencies" -version = "0.8.0" -source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" - [[patch.unused]] name = "sp-core-hashing" version = "15.0.0" @@ -15984,3 +15979,8 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot name = "sp-crypto-ec-utils" version = "0.10.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" + +[[patch.unused]] +name = "orml-currencies" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/pallets/xyk-liquidity-mining/src/lib.rs b/pallets/xyk-liquidity-mining/src/lib.rs index 0be69c6ac96..c665b2dc50a 100644 --- a/pallets/xyk-liquidity-mining/src/lib.rs +++ b/pallets/xyk-liquidity-mining/src/lib.rs @@ -77,7 +77,7 @@ pub mod pallet { use frame_system::pallet_prelude::BlockNumberFor; use hydradx_traits::pools::DustRemovalAccountWhitelist; - const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); #[pallet::pallet] #[pallet::storage_version(STORAGE_VERSION)] From 2a2cd42372be5feeba5de500cd0eaad8dce05f1b Mon Sep 17 00:00:00 2001 From: dmoka Date: Mon, 22 Apr 2024 16:01:40 +0200 Subject: [PATCH 19/56] disallow xyk pool creation for share tokens --- Cargo.lock | 10 ++--- integration-tests/src/xyk.rs | 69 +++++++++++++++++++++++++++++++++- runtime/basilisk/src/assets.rs | 2 +- 3 files changed, 74 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ec158c232d..b0433cf8262 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15970,6 +15970,11 @@ dependencies = [ "pkg-config", ] +[[patch.unused]] +name = "orml-currencies" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" + [[patch.unused]] name = "sp-core-hashing" version = "15.0.0" @@ -15979,8 +15984,3 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot name = "sp-crypto-ec-utils" version = "0.10.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" - -[[patch.unused]] -name = "orml-currencies" -version = "0.8.0" -source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/integration-tests/src/xyk.rs b/integration-tests/src/xyk.rs index 3e244dccc8d..1b46ade0c31 100644 --- a/integration-tests/src/xyk.rs +++ b/integration-tests/src/xyk.rs @@ -6,8 +6,9 @@ use basilisk_runtime::{DustRemovalWhitelist, RuntimeOrigin, XYK}; use hydradx_traits::AMM; use pallet_xyk::types::AssetId; use xcm_emulator::TestExt; - +use frame_support::assert_noop; use frame_support::{assert_ok, traits::Contains}; +use basilisk_runtime::Currencies; fn pair_account(asset_a: AssetId, asset_b: AssetId) -> AccountId { let asset_pair = AssetPair { @@ -127,3 +128,69 @@ fn share_asset_id_should_be_offset() { assert!(share_token >= offset); }); } + +#[test] +fn creating_xyk_pool_should_fail_when_asset_is_pool_share_asset() { + TestNet::reset(); + let asset_a = 1; + let asset_b = 2; + + Basilisk::execute_with(|| { + assert_ok!(Currencies::update_balance( + RuntimeOrigin::root(), + ALICE.into(), + asset_a, + 1000 * UNITS as i128, + )); + + assert_ok!(Currencies::update_balance( + RuntimeOrigin::root(), + ALICE.into(), + asset_b, + 1000 * UNITS as i128, + )); + + assert_ok!( + XYK::create_pool( + RuntimeOrigin::signed(ALICE.into()), + asset_a, + 100 * UNITS, + asset_b, + 200 * UNITS, + ) + ); + + let share_token = XYK::get_share_token(AssetPair { + asset_in: asset_a, + asset_out: asset_b, + }); + assert_ok!(Currencies::update_balance( + RuntimeOrigin::root(), + ALICE.into(), + share_token, + 1000 * UNITS as i128, + )); + + assert_noop!( + XYK::create_pool( + RuntimeOrigin::signed(ALICE.into()), + share_token, + 100 * UNITS, + asset_b, + 200 * UNITS, + ), + pallet_xyk::Error::::CannotCreatePool + ); + + assert_noop!( + XYK::create_pool( + RuntimeOrigin::signed(ALICE.into()), + asset_a, + 100 * UNITS, + share_token, + 200 * UNITS, + ), + pallet_xyk::Error::::CannotCreatePool + ); + }); +} diff --git a/runtime/basilisk/src/assets.rs b/runtime/basilisk/src/assets.rs index 33717388f19..1f8b71742f0 100644 --- a/runtime/basilisk/src/assets.rs +++ b/runtime/basilisk/src/assets.rs @@ -215,7 +215,7 @@ impl pallet_xyk::Config for Runtime { type MaxInRatio = MaxInRatio; type MaxOutRatio = MaxOutRatio; type OracleSource = XYKOracleSourceIdentifier; - type CanCreatePool = pallet_lbp::DisallowWhenLBPPoolRunning; + type CanCreatePool = hydradx_adapters::xyk::AllowPoolCreation; type AMMHandler = pallet_ema_oracle::OnActivityHandler; type DiscountedFee = DiscountedFee; type NonDustableWhitelistHandler = Duster; From d523167bcf176957f099f3bc12e78ffd2519b0a8 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 23 Apr 2024 11:22:41 +0200 Subject: [PATCH 20/56] fix benchmark tests --- pallets/xyk-liquidity-mining/benchmarking/src/mock.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pallets/xyk-liquidity-mining/benchmarking/src/mock.rs b/pallets/xyk-liquidity-mining/benchmarking/src/mock.rs index 8bedff22248..a4ae4e691c1 100644 --- a/pallets/xyk-liquidity-mining/benchmarking/src/mock.rs +++ b/pallets/xyk-liquidity-mining/benchmarking/src/mock.rs @@ -113,6 +113,7 @@ impl system::Config for Test { type SS58Prefix = (); type OnSetCode = (); type MaxConsumers = frame_support::traits::ConstU32<16>; + type RuntimeTask = RuntimeTask; } impl crate::Config for Test {} @@ -204,8 +205,8 @@ impl pallet_balances::Config for Test { type ReserveIdentifier = (); type FreezeIdentifier = (); type MaxFreezes = (); - type MaxHolds = (); type RuntimeHoldReason = (); + type RuntimeFreezeReason = (); } parameter_types! { From 3a8b0562c049f91b08e7ca5c8255b0fd7a75685e Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Tue, 23 Apr 2024 21:46:33 +0200 Subject: [PATCH 21/56] fix benchmark chainspecs --- Cargo.lock | 10 +++++----- node/src/chain_spec.rs | 14 +++++++------- runtime/basilisk/src/lib.rs | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b0433cf8262..7ec158c232d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15970,11 +15970,6 @@ dependencies = [ "pkg-config", ] -[[patch.unused]] -name = "orml-currencies" -version = "0.8.0" -source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" - [[patch.unused]] name = "sp-core-hashing" version = "15.0.0" @@ -15984,3 +15979,8 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot name = "sp-crypto-ec-utils" version = "0.10.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" + +[[patch.unused]] +name = "orml-currencies" +version = "0.8.0" +source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 3e7c3e42045..52751cc1884 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -184,7 +184,7 @@ pub fn kusama_staging_parachain_config() -> Result { relay_chain: "kusama".into(), para_id: PARA_ID, }, - vec![].as_slice(), + wasm_binary, )) } @@ -266,7 +266,7 @@ pub fn testnet_parachain_config() -> Result { relay_chain: "westend".into(), para_id: PARA_ID, }, - vec![].as_slice(), + wasm_binary, )) } @@ -338,7 +338,7 @@ pub fn parachain_development_config() -> Result { relay_chain: "rococo-dev".into(), para_id: PARA_ID, }, - vec![].as_slice(), + wasm_binary, )) } @@ -415,7 +415,7 @@ pub fn rococo_parachain_config() -> Result { relay_chain: "rococo".into(), para_id: PARA_ID, }, - vec![].as_slice(), + wasm_binary, )) } @@ -488,7 +488,7 @@ pub fn karura_testnet_parachain_config() -> Result { relay_chain: "kusama-local".into(), para_id: PARA_ID, }, - vec![].as_slice(), + wasm_binary, )) } @@ -559,7 +559,7 @@ pub fn benchmarks_development_config() -> Result { relay_chain: "rococo-dev".into(), para_id: PARA_ID, }, - vec![].as_slice(), + wasm_binary, )) } @@ -639,7 +639,7 @@ pub fn local_parachain_config() -> Result { relay_chain: "rococo-local".into(), para_id: PARA_ID, }, - vec![].as_slice(), + wasm_binary, )) } diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index cad14813cdb..dc0dd2b4056 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -435,7 +435,7 @@ impl_runtime_apis! { let mut list = Vec::::new(); - list_benchmark!(list, extra, pallet_xyk, XYK); + //list_benchmark!(list, extra, pallet_xyk, XYK); list_benchmark!(list, extra, pallet_lbp, LBP); list_benchmark!(list, extra, pallet_nft, NFT); list_benchmark!(list, extra, pallet_asset_registry, AssetRegistry); @@ -456,7 +456,7 @@ impl_runtime_apis! { list_benchmark!(list, extra, pallet_identity, Identity); list_benchmark!(list, extra, pallet_collective, TechnicalCommittee); list_benchmark!(list, extra, pallet_state_trie_migration, StateTrieMigration); - list_benchmark!(list, extra, pallet_preimage, Preimage); + //list_benchmark!(list, extra, pallet_preimage, Preimage); list_benchmark!(list, extra, cumulus_pallet_xcmp_queue, XcmpQueue); list_benchmark!(list, extra, pallet_message_queue, MessageQueue); @@ -517,7 +517,7 @@ impl_runtime_apis! { let params = (&config, &whitelist); // Basilisk pallets - add_benchmark!(params, batches, pallet_xyk, XYK); + //add_benchmark!(params, batches, pallet_xyk, XYK); add_benchmark!(params, batches, pallet_lbp, LBP); add_benchmark!(params, batches, pallet_nft, NFT); add_benchmark!(params, batches, pallet_asset_registry, AssetRegistry); @@ -539,7 +539,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_identity, Identity); add_benchmark!(params, batches, pallet_collective, TechnicalCommittee); add_benchmark!(params, batches, pallet_state_trie_migration, StateTrieMigration); - add_benchmark!(params, batches, pallet_preimage, Preimage); + //add_benchmark!(params, batches, pallet_preimage, Preimage); add_benchmark!(params, batches, cumulus_pallet_xcmp_queue, XcmpQueue); add_benchmark!(params, batches, pallet_message_queue, MessageQueue); From ef2f384916b458f4a54587398a49d16ac5a8988a Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 24 Apr 2024 16:40:36 +0200 Subject: [PATCH 22/56] benchmarks weights refactor --- .gitignore | 1 + .maintain/pallet-weight-template-no-back.hbs | 18 +- Cargo.lock | 132 +++--- Cargo.toml | 10 - integration-tests/src/xyk.rs | 22 +- pallets/asset-registry/src/lib.rs | 2 +- pallets/marketplace/src/lib.rs | 2 +- pallets/xyk-liquidity-mining/src/lib.rs | 2 +- runtime/basilisk/src/assets.rs | 52 +-- runtime/basilisk/src/benchmarking/helper.rs | 15 + runtime/basilisk/src/benchmarking/mod.rs | 3 + .../src/benchmarking/multi_payment.rs | 64 ++- .../src/benchmarking/route_executor.rs | 178 ++++++-- runtime/basilisk/src/governance.rs | 82 +++- runtime/basilisk/src/lib.rs | 10 +- runtime/basilisk/src/system.rs | 18 +- .../src/weights/cumulus_pallet_xcmp_queue.rs | 165 +++++++ .../weights/{system.rs => frame_system.rs} | 142 +++--- runtime/basilisk/src/weights/mod.rs | 50 ++- .../src/weights/{tokens.rs => orml_tokens.rs} | 79 ++-- .../weights/{vesting.rs => orml_vesting.rs} | 77 ++-- ...t_registry.rs => pallet_asset_registry.rs} | 73 +-- .../{balances.rs => pallet_balances.rs} | 99 +++-- .../{collective.rs => pallet_collective.rs} | 217 +++++---- .../{currencies.rs => pallet_currencies.rs} | 79 ++-- .../{democracy.rs => pallet_democracy.rs} | 236 +++++----- .../weights/{duster.rs => pallet_duster.rs} | 64 +-- ...ctions.rs => pallet_elections_phragmen.rs} | 154 ++++--- .../{ema_oracle.rs => pallet_ema_oracle.rs} | 123 ++++-- .../basilisk/src/weights/pallet_identity.rs | 418 ++++++++++++++++++ .../src/weights/{lbp.rs => pallet_lbp.rs} | 128 +++--- .../{marketplace.rs => pallet_marketplace.rs} | 85 ++-- .../src/weights/pallet_message_queue.rs | 183 ++++++++ .../src/weights/{nft.rs => pallet_nft.rs} | 83 ++-- ...e_executor.rs => pallet_route_executor.rs} | 85 ++-- .../{scheduler.rs => pallet_scheduler.rs} | 146 +++--- .../{timestamp.rs => pallet_timestamp.rs} | 57 +-- .../src/weights/{tips.rs => pallet_tips.rs} | 89 ++-- ...rs => pallet_transaction_multi_payment.rs} | 66 +-- ...n_pause.rs => pallet_transaction_pause.rs} | 61 +-- .../basilisk/src/weights/pallet_treasury.rs | 201 +++++++++ .../weights/{utility.rs => pallet_utility.rs} | 87 ++-- ...ning.rs => pallet_xyk_liquidity_mining.rs} | 115 ++--- runtime/basilisk/src/weights/treasury.rs | 156 ------- runtime/basilisk/src/weights/xcmp_queue.rs | 96 ---- runtime/basilisk/src/xcm.rs | 10 +- scripts/benchmark.all.sh | 44 -- scripts/benchmarking.sh | 91 ++++ 48 files changed, 2744 insertions(+), 1626 deletions(-) create mode 100644 runtime/basilisk/src/benchmarking/helper.rs create mode 100644 runtime/basilisk/src/weights/cumulus_pallet_xcmp_queue.rs rename runtime/basilisk/src/weights/{system.rs => frame_system.rs} (52%) rename runtime/basilisk/src/weights/{tokens.rs => orml_tokens.rs} (83%) rename runtime/basilisk/src/weights/{vesting.rs => orml_vesting.rs} (72%) rename runtime/basilisk/src/weights/{asset_registry.rs => pallet_asset_registry.rs} (76%) rename runtime/basilisk/src/weights/{balances.rs => pallet_balances.rs} (67%) rename runtime/basilisk/src/weights/{collective.rs => pallet_collective.rs} (66%) rename runtime/basilisk/src/weights/{currencies.rs => pallet_currencies.rs} (76%) rename runtime/basilisk/src/weights/{democracy.rs => pallet_democracy.rs} (79%) rename runtime/basilisk/src/weights/{duster.rs => pallet_duster.rs} (73%) rename runtime/basilisk/src/weights/{elections.rs => pallet_elections_phragmen.rs} (78%) rename runtime/basilisk/src/weights/{ema_oracle.rs => pallet_ema_oracle.rs} (50%) create mode 100644 runtime/basilisk/src/weights/pallet_identity.rs rename runtime/basilisk/src/weights/{lbp.rs => pallet_lbp.rs} (79%) rename runtime/basilisk/src/weights/{marketplace.rs => pallet_marketplace.rs} (85%) create mode 100644 runtime/basilisk/src/weights/pallet_message_queue.rs rename runtime/basilisk/src/weights/{nft.rs => pallet_nft.rs} (83%) rename runtime/basilisk/src/weights/{route_executor.rs => pallet_route_executor.rs} (75%) rename runtime/basilisk/src/weights/{scheduler.rs => pallet_scheduler.rs} (62%) rename runtime/basilisk/src/weights/{timestamp.rs => pallet_timestamp.rs} (61%) rename runtime/basilisk/src/weights/{tips.rs => pallet_tips.rs} (72%) rename runtime/basilisk/src/weights/{payment.rs => pallet_transaction_multi_payment.rs} (71%) rename runtime/basilisk/src/weights/{transaction_pause.rs => pallet_transaction_pause.rs} (64%) create mode 100644 runtime/basilisk/src/weights/pallet_treasury.rs rename runtime/basilisk/src/weights/{utility.rs => pallet_utility.rs} (52%) rename runtime/basilisk/src/weights/{xyk_liquidity_mining.rs => pallet_xyk_liquidity_mining.rs} (89%) delete mode 100644 runtime/basilisk/src/weights/treasury.rs delete mode 100644 runtime/basilisk/src/weights/xcmp_queue.rs delete mode 100644 scripts/benchmark.all.sh create mode 100644 scripts/benchmarking.sh diff --git a/.gitignore b/.gitignore index d75a43f93ed..a2b2abe4141 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ lcov.info /basilisk tmp/ +raw.json \ No newline at end of file diff --git a/.maintain/pallet-weight-template-no-back.hbs b/.maintain/pallet-weight-template-no-back.hbs index 7211afb55c9..e0345239b95 100644 --- a/.maintain/pallet-weight-template-no-back.hbs +++ b/.maintain/pallet-weight-template-no-back.hbs @@ -37,24 +37,12 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use core::marker::PhantomData; -/// Weight functions needed for `{{pallet}}`. -pub trait WeightInfo { - {{#each benchmarks as |benchmark|}} - fn {{benchmark.name~}} - ( - {{~#each benchmark.components as |c| ~}} - {{c.name}}: u32, {{/each~}} - ) -> Weight; - {{/each}} -} +/// Weights for `{{pallet}}`. +pub struct WeightInfo(PhantomData); /// Weights for `{{pallet}}` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); -{{#if (eq pallet "frame_system")}} -impl WeightInfo for BasiliskWeight { -{{else}} -impl WeightInfo for BasiliskWeight { -{{/if}} +impl {{pallet}}::WeightInfo for BasiliskWeight { {{#each benchmarks as |benchmark|}} {{#each benchmark.comments as |comment|}} /// {{comment}} diff --git a/Cargo.lock b/Cargo.lock index 7ec158c232d..8fe17ae37e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -663,8 +663,8 @@ dependencies = [ "futures-io", "futures-lite 2.3.0", "parking", - "polling 3.6.0", - "rustix 0.38.33", + "polling 3.7.0", + "rustix 0.38.34", "slab", "tracing", "windows-sys 0.52.0", @@ -714,7 +714,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.33", + "rustix 0.38.34", "windows-sys 0.48.0", ] @@ -730,7 +730,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.33", + "rustix 0.38.34", "signal-hook-registry", "slab", "windows-sys 0.52.0", @@ -3400,9 +3400,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c007b1ae3abe1cb6f85a16305acd418b7ca6343b953633fee2b76d8f108b830f" +checksum = "38793c55593b33412e3ae40c2c9781ffaa6f438f6f8c10f24e71846fbd7ae01e" [[package]] name = "file-per-thread-logger" @@ -3519,7 +3519,7 @@ dependencies = [ [[package]] name = "fp-account" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#5d6bf0c78d1d325d4eea6f9593e9a11da18a1ea8" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#ea9becfa1885a4ce7d63558620b5367cbc4e9289" dependencies = [ "hex", "impl-serde", @@ -3538,7 +3538,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#5d6bf0c78d1d325d4eea6f9593e9a11da18a1ea8" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#ea9becfa1885a4ce7d63558620b5367cbc4e9289" dependencies = [ "evm", "frame-support", @@ -3873,7 +3873,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29f9df8a11882c4e3335eb2d18a0137c505d9ca927470b0cac9c6f0ae07d28f7" dependencies = [ - "rustix 0.38.33", + "rustix 0.38.34", "windows-sys 0.48.0", ] @@ -4379,7 +4379,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hydra-dx-build-script-utils" version = "1.0.3" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "cargo-lock", "platforms 1.1.0", @@ -4388,7 +4388,7 @@ dependencies = [ [[package]] name = "hydra-dx-math" version = "8.0.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "fixed", "num-traits", @@ -4403,7 +4403,7 @@ dependencies = [ [[package]] name = "hydradx-adapters" version = "1.3.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -4451,7 +4451,7 @@ dependencies = [ [[package]] name = "hydradx-traits" version = "3.2.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -4795,9 +4795,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685a7d121ee3f65ae4fddd72b25a04bb36b6af81bc0828f7d5434c0fe60fa3a2" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] @@ -5776,7 +5776,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.33", + "rustix 0.38.34", ] [[package]] @@ -6697,7 +6697,7 @@ dependencies = [ [[package]] name = "pallet-asset-registry" version = "3.2.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6908,7 +6908,7 @@ dependencies = [ [[package]] name = "pallet-bonds" version = "2.2.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -6984,7 +6984,7 @@ dependencies = [ [[package]] name = "pallet-circuit-breaker" version = "1.1.21" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "frame-system", @@ -7000,7 +7000,7 @@ dependencies = [ [[package]] name = "pallet-collator-rewards" version = "1.0.6" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "frame-system", @@ -7072,7 +7072,7 @@ dependencies = [ [[package]] name = "pallet-currencies" version = "2.1.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "frame-system", @@ -7089,7 +7089,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.1.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "frame-system", @@ -7123,7 +7123,7 @@ dependencies = [ [[package]] name = "pallet-duster" version = "3.2.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -7142,7 +7142,7 @@ dependencies = [ [[package]] name = "pallet-dynamic-fees" version = "1.0.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "frame-system", @@ -7214,7 +7214,7 @@ dependencies = [ [[package]] name = "pallet-ema-oracle" version = "1.3.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -7234,7 +7234,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#5d6bf0c78d1d325d4eea6f9593e9a11da18a1ea8" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#ea9becfa1885a4ce7d63558620b5367cbc4e9289" dependencies = [ "environmental", "evm", @@ -7356,7 +7356,7 @@ dependencies = [ [[package]] name = "pallet-lbp" version = "4.7.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -7378,7 +7378,7 @@ dependencies = [ [[package]] name = "pallet-liquidity-mining" version = "4.3.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "frame-system", @@ -7488,7 +7488,7 @@ dependencies = [ [[package]] name = "pallet-nft" version = "7.1.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -7614,7 +7614,7 @@ dependencies = [ [[package]] name = "pallet-omnipool" version = "4.1.5" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "bitflags 1.3.2", "frame-benchmarking", @@ -7638,7 +7638,7 @@ dependencies = [ [[package]] name = "pallet-omnipool-liquidity-mining" version = "2.1.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "frame-system", @@ -7748,7 +7748,7 @@ dependencies = [ [[package]] name = "pallet-referrals" version = "1.2.3" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "frame-system", @@ -7766,7 +7766,7 @@ dependencies = [ [[package]] name = "pallet-relaychain-info" version = "0.3.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -7796,7 +7796,7 @@ dependencies = [ [[package]] name = "pallet-route-executor" version = "2.2.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "frame-system", @@ -7888,7 +7888,7 @@ dependencies = [ [[package]] name = "pallet-stableswap" version = "3.5.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "bitflags 1.3.2", "frame-support", @@ -7907,7 +7907,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "frame-system", @@ -8051,7 +8051,7 @@ dependencies = [ [[package]] name = "pallet-transaction-multi-payment" version = "9.5.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "frame-system", @@ -8073,7 +8073,7 @@ dependencies = [ [[package]] name = "pallet-transaction-pause" version = "1.0.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -8254,7 +8254,7 @@ dependencies = [ [[package]] name = "pallet-xyk" version = "6.4.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-benchmarking", "frame-support", @@ -9781,15 +9781,15 @@ dependencies = [ [[package]] name = "polling" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c976a60b2d7e99d6f229e414670a9b85d13ac305cc6d1e9c134de58c5aaaf6" +checksum = "645493cf344456ef24219d02a768cf1fb92ddf8c92161679ae3d91b91a637be3" dependencies = [ "cfg-if", "concurrent-queue", "hermit-abi", "pin-project-lite 0.2.14", - "rustix 0.38.33", + "rustix 0.38.34", "tracing", "windows-sys 0.52.0", ] @@ -9922,7 +9922,7 @@ dependencies = [ [[package]] name = "primitives" version = "6.0.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-support", "hex-literal 0.3.4", @@ -10880,9 +10880,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.33" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3cc72858054fcff6d7dea32df2aeaee6a7c24227366d7ea429aada2f26b16ad" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.5.0", "errno", @@ -12990,7 +12990,7 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" +source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -13052,7 +13052,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" +source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" dependencies = [ "proc-macro2", "quote", @@ -13073,7 +13073,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" +source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" dependencies = [ "environmental", "parity-scale-codec", @@ -13291,7 +13291,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" +source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -13323,7 +13323,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" +source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" dependencies = [ "Inflector", "expander 2.1.0", @@ -13416,7 +13416,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" +source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" [[package]] name = "sp-storage" @@ -13434,7 +13434,7 @@ dependencies = [ [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" +source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13471,7 +13471,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" +source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" dependencies = [ "parity-scale-codec", "tracing", @@ -13571,7 +13571,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#253778c94dd64e6bc174ed1e03ac7e0b43990129" +source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" dependencies = [ "impl-trait-for-tuples", "log", @@ -14006,7 +14006,7 @@ checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand 2.0.2", - "rustix 0.38.33", + "rustix 0.38.34", "windows-sys 0.52.0", ] @@ -14025,7 +14025,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ - "rustix 0.38.33", + "rustix 0.38.34", "windows-sys 0.48.0", ] @@ -14071,7 +14071,7 @@ dependencies = [ [[package]] name = "test-utils" version = "1.1.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#3754130b70aa34e7b97d8b31f20903c5b1eeaa1d" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" dependencies = [ "frame-system", "pretty_assertions", @@ -15447,7 +15447,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.33", + "rustix 0.38.34", ] [[package]] @@ -15484,11 +15484,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "134306a13c5647ad6453e8deaec55d3a44d6021970129e6188735e74bf546697" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -15974,13 +15974,3 @@ dependencies = [ name = "sp-core-hashing" version = "15.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" - -[[patch.unused]] -name = "sp-crypto-ec-utils" -version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" - -[[patch.unused]] -name = "orml-currencies" -version = "0.8.0" -source = "git+https://github.com/galacticcouncil/open-runtime-module-library?branch=polkadot-v1.7.2#c1fbd5a34168830e3614a1cd4724135e7a3c1236" diff --git a/Cargo.toml b/Cargo.toml index f4927976649..b797777c9fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,7 @@ members = [ 'node', 'runtime/basilisk', 'pallets/marketplace', - #'pallets/xyk', 'pallets/asset-registry', - #'pallets/liquidity-mining', 'pallets/xyk-liquidity-mining', 'pallets/xyk-liquidity-mining/benchmarking', 'integration-tests', @@ -23,11 +21,8 @@ log = "0.4.20" basilisk-runtime = { path = "runtime/basilisk", default-features = false } pallet-marketplace = { path = "pallets/marketplace", default-features = false} -#pallet-xyk = { path = "pallets/xyk", default-features = false} pallet-asset-registry = { path = "pallets/asset-registry", default-features = false} pallet-xyk-liquidity-mining = { path = "pallets/xyk-liquidity-mining", default-features = false} -#warehouse-liquidity-mining = { package = "pallet-liquidity-mining", path = "pallets/liquidity-mining", default-features = false} -#pallet-liquidity-mining = { path = "pallets/liquidity-mining", default-features = false} pallet-xyk-liquidity-mining-benchmarking = { path = "pallets/xyk-liquidity-mining/benchmarking", default-features = false} hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-node", branch ="polkadot-v1.7.2", default-features = false } @@ -185,7 +180,6 @@ pallet-mmr = { git = "https://github.com/paritytech/polkadot-sdk", branch ="rele sp-mmr-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } substrate-state-trie-migration-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2" } -#kusama-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch ="release-polkadot-v1.7.2", default-features = false } @@ -251,7 +245,6 @@ orml-xtokens = { git = "https://github.com/galacticcouncil/open-runtime-module-l [patch."https://github.com/moonbeam-foundation/open-runtime-module-library"] # ORML dependencies orml-benchmarking = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} -orml-currencies = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} orml-tokens = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} orml-traits = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} orml-utilities = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-v1.7.2"} @@ -328,7 +321,6 @@ sc-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "relea sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} sp-crypto-hashing= { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} -sp-crypto-ec-utils= { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} sp-core-hashing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} # Substrate Pallets @@ -393,14 +385,12 @@ polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "r polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } polkadot-parachain = { package = "polkadot-parachain-primitives", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } -#polkadot-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } -#kusama-runtime = { package = "staging-kusama-runtime", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } polkadot-node-network-protocol = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } polkadot-node-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } diff --git a/integration-tests/src/xyk.rs b/integration-tests/src/xyk.rs index 1b46ade0c31..d03ac990253 100644 --- a/integration-tests/src/xyk.rs +++ b/integration-tests/src/xyk.rs @@ -2,13 +2,13 @@ use crate::kusama_test_net::*; +use basilisk_runtime::Currencies; use basilisk_runtime::{DustRemovalWhitelist, RuntimeOrigin, XYK}; +use frame_support::assert_noop; +use frame_support::{assert_ok, traits::Contains}; use hydradx_traits::AMM; use pallet_xyk::types::AssetId; use xcm_emulator::TestExt; -use frame_support::assert_noop; -use frame_support::{assert_ok, traits::Contains}; -use basilisk_runtime::Currencies; fn pair_account(asset_a: AssetId, asset_b: AssetId) -> AccountId { let asset_pair = AssetPair { @@ -150,15 +150,13 @@ fn creating_xyk_pool_should_fail_when_asset_is_pool_share_asset() { 1000 * UNITS as i128, )); - assert_ok!( - XYK::create_pool( - RuntimeOrigin::signed(ALICE.into()), - asset_a, - 100 * UNITS, - asset_b, - 200 * UNITS, - ) - ); + assert_ok!(XYK::create_pool( + RuntimeOrigin::signed(ALICE.into()), + asset_a, + 100 * UNITS, + asset_b, + 200 * UNITS, + )); let share_token = XYK::get_share_token(AssetPair { asset_in: asset_a, diff --git a/pallets/asset-registry/src/lib.rs b/pallets/asset-registry/src/lib.rs index 0db39a2d26d..057646b6a35 100644 --- a/pallets/asset-registry/src/lib.rs +++ b/pallets/asset-registry/src/lib.rs @@ -38,7 +38,7 @@ pub mod traits; mod types; pub mod weights; -use weights::WeightInfo; +pub use weights::WeightInfo; pub use types::AssetType; diff --git a/pallets/marketplace/src/lib.rs b/pallets/marketplace/src/lib.rs index 8830901e4c8..e6ebc83bfeb 100644 --- a/pallets/marketplace/src/lib.rs +++ b/pallets/marketplace/src/lib.rs @@ -32,7 +32,7 @@ use sp_runtime::{ use sp_std::convert::TryInto; use types::*; -use weights::WeightInfo; +pub use weights::WeightInfo; mod types; pub mod weights; diff --git a/pallets/xyk-liquidity-mining/src/lib.rs b/pallets/xyk-liquidity-mining/src/lib.rs index c665b2dc50a..8537d6016ea 100644 --- a/pallets/xyk-liquidity-mining/src/lib.rs +++ b/pallets/xyk-liquidity-mining/src/lib.rs @@ -51,6 +51,7 @@ use hydradx_traits::liquidity_mining::{GlobalFarmId, Mutate as LiquidityMiningMu use pallet_liquidity_mining::{FarmMultiplier, LoyaltyCurve}; use pallet_xyk::types::{AssetId, AssetPair, Balance}; +pub use crate::weights::WeightInfo; use frame_support::{pallet_prelude::*, sp_runtime::traits::AccountIdConversion}; use frame_system::{ensure_signed, pallet_prelude::OriginFor}; use hydradx_traits::{ @@ -73,7 +74,6 @@ type PeriodOf = BlockNumberFor; #[allow(clippy::too_many_arguments)] pub mod pallet { use super::*; - use crate::weights::WeightInfo; use frame_system::pallet_prelude::BlockNumberFor; use hydradx_traits::pools::DustRemovalAccountWhitelist; diff --git a/runtime/basilisk/src/assets.rs b/runtime/basilisk/src/assets.rs index 1f8b71742f0..c0fd28e5b50 100644 --- a/runtime/basilisk/src/assets.rs +++ b/runtime/basilisk/src/assets.rs @@ -86,7 +86,7 @@ impl pallet_balances::Config for Runtime { /// The ubiquitous event type. type ExistentialDeposit = NativeExistentialDeposit; type AccountStore = System; - type WeightInfo = weights::balances::BasiliskWeight; + type WeightInfo = weights::pallet_balances::BasiliskWeight; type MaxLocks = MaxLocks; type MaxReserves = MaxReserves; type ReserveIdentifier = (); @@ -120,7 +120,7 @@ impl orml_tokens::Config for Runtime { type Balance = Balance; type Amount = Amount; type CurrencyId = AssetId; - type WeightInfo = weights::tokens::BasiliskWeight; + type WeightInfo = weights::orml_tokens::BasiliskWeight; type ExistentialDeposits = AssetRegistry; type CurrencyHooks = CurrencyHooks; type MaxLocks = MaxLocks; @@ -137,7 +137,7 @@ impl pallet_currencies::Config for Runtime { type MultiCurrency = Tokens; type NativeCurrency = BasicCurrencyAdapter; type GetNativeCurrencyId = NativeAssetId; - type WeightInfo = weights::currencies::BasiliskWeight; + type WeightInfo = weights::pallet_currencies::BasiliskWeight; } parameter_types! { @@ -152,7 +152,7 @@ impl pallet_asset_registry::Config for Runtime { type StringLimit = RegistryStrLimit; type SequentialIdStartAt = SequentialIdOffset; type NativeAssetId = NativeAssetId; - type WeightInfo = weights::asset_registry::BasiliskWeight; + type WeightInfo = weights::pallet_asset_registry::BasiliskWeight; } parameter_types! { @@ -169,7 +169,7 @@ impl pallet_duster::Config for Runtime { type Reward = DustingReward; type NativeCurrencyId = NativeAssetId; type BlacklistUpdateOrigin = MajorityTechCommitteeOrRoot; - type WeightInfo = weights::duster::BasiliskWeight; + type WeightInfo = weights::pallet_duster::BasiliskWeight; } pub struct AssetPairAccountId(PhantomData); @@ -208,7 +208,7 @@ impl pallet_xyk::Config for Runtime { type AssetPairAccountId = AssetPairAccountId; type Currency = Currencies; type NativeAssetId = NativeAssetId; - type WeightInfo = weights::xyk::BasiliskWeight; + type WeightInfo = weights::xyk::BasiliskWeight; //TODO: add benchmakrs type GetExchangeFee = ExchangeFee; type MinTradingLimit = MinTradingLimit; type MinPoolLiquidity = MinPoolLiquidity; @@ -262,7 +262,7 @@ impl pallet_lbp::Config for Runtime { type CreatePoolOrigin = SuperMajorityTechCommitteeOrRoot; type LBPWeightFunction = pallet_lbp::LBPWeightFunction; type AssetPairAccountId = AssetPairAccountId; - type WeightInfo = weights::lbp::BasiliskWeight; + type WeightInfo = weights::pallet_lbp::BasiliskWeight; type MinTradingLimit = MinTradingLimit; type MinPoolLiquidity = MinPoolLiquidity; type MaxInRatio = MaxInRatio; @@ -304,7 +304,7 @@ impl orml_vesting::Config for Runtime { type Currency = Balances; type MinVestedTransfer = MinVestedTransfer; type VestedTransferOrigin = RootAsVestingPallet; - type WeightInfo = weights::vesting::BasiliskWeight; + type WeightInfo = weights::orml_vesting::BasiliskWeight; type MaxVestingSchedules = MaxVestingSchedules; type BlockNumberProvider = RelayChainBlockNumberProvider; } @@ -317,7 +317,7 @@ parameter_types! { impl pallet_marketplace::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Currency = KusamaCurrency; - type WeightInfo = pallet_marketplace::weights::BasiliskWeight; + type WeightInfo = weights::pallet_marketplace::BasiliskWeight; type MinimumOfferAmount = MinimumOfferAmount; type RoyaltyBondAmount = RoyaltyBondAmount; } @@ -381,7 +381,7 @@ impl pallet_xyk_liquidity_mining::Config for Runtime { type NFTHandler = NFT; type LiquidityMiningHandler = XYKWarehouseLM; type NonDustableWhitelistHandler = Duster; - type WeightInfo = weights::xyk_liquidity_mining::BasiliskWeight; + type WeightInfo = weights::pallet_xyk_liquidity_mining::BasiliskWeight; } parameter_types! { @@ -419,8 +419,8 @@ impl RouterWeightInfo { num_of_calc_sell: u32, num_of_execute_sell: u32, ) -> Weight { - weights::route_executor::BasiliskWeight::::calculate_and_execute_sell_in_lbp(num_of_calc_sell) - .saturating_sub(weights::lbp::BasiliskWeight::::router_execution_sell( + weights::pallet_route_executor::BasiliskWeight::::calculate_and_execute_sell_in_lbp(num_of_calc_sell) + .saturating_sub(weights::pallet_lbp::BasiliskWeight::::router_execution_sell( num_of_calc_sell.saturating_add(num_of_execute_sell), num_of_execute_sell, )) @@ -430,15 +430,15 @@ impl RouterWeightInfo { num_of_calc_buy: u32, num_of_execute_buy: u32, ) -> Weight { - let router_weight = weights::route_executor::BasiliskWeight::::calculate_and_execute_buy_in_lbp( + let router_weight = weights::pallet_route_executor::BasiliskWeight::::calculate_and_execute_buy_in_lbp( num_of_calc_buy, num_of_execute_buy, ); // Handle this case separately. router_execution_buy provides incorrect weight for the case when only calculate_buy is executed. let lbp_weight = if (num_of_calc_buy, num_of_execute_buy) == (1, 0) { - weights::lbp::BasiliskWeight::::calculate_buy() + weights::pallet_lbp::BasiliskWeight::::calculate_buy() } else { - weights::lbp::BasiliskWeight::::router_execution_buy( + weights::pallet_lbp::BasiliskWeight::::router_execution_buy( num_of_calc_buy.saturating_add(num_of_execute_buy), num_of_execute_buy, ) @@ -450,7 +450,7 @@ impl RouterWeightInfo { let number_of_times_calculate_sell_amounts_executed = 5; //4 calculations + in the validation let number_of_times_execute_sell_amounts_executed = 0; //We do have it once executed in the validation of the route, but it is without writing to database (as rolled back), and since we pay back successful set_route, we just keep this overhead - let set_route_overweight = weights::route_executor::BasiliskWeight::::set_route_for_xyk(); + let set_route_overweight = weights::pallet_route_executor::BasiliskWeight::::set_route_for_xyk(); set_route_overweight.saturating_sub(weights::xyk::BasiliskWeight::::router_execution_sell( number_of_times_calculate_sell_amounts_executed, @@ -469,7 +469,7 @@ impl AmmTradeWeights> for RouterWeightInfo { for trade in route { weight.saturating_accrue(Self::sell_and_calculate_sell_trade_amounts_overhead_weight(0, 1)); - let lbp_weight = weights::lbp::BasiliskWeight::::router_execution_sell(c, e); + let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_sell(c, e); let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_sell(c, e) .saturating_add(::AMMHandler::on_trade_weight()); @@ -493,7 +493,7 @@ impl AmmTradeWeights> for RouterWeightInfo { for trade in route { weight.saturating_accrue(Self::buy_and_calculate_buy_trade_amounts_overhead_weight(0, 1)); - let lbp_weight = weights::lbp::BasiliskWeight::::router_execution_buy(c, e); + let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_buy(c, e); let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_buy(c, e) .saturating_add(::AMMHandler::on_trade_weight()); @@ -517,7 +517,7 @@ impl AmmTradeWeights> for RouterWeightInfo { for trade in route { weight.saturating_accrue(Self::buy_and_calculate_buy_trade_amounts_overhead_weight(1, 0)); - let lbp_weight = weights::lbp::BasiliskWeight::::router_execution_buy(c, e); + let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_buy(c, e); let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_buy(c, e) .saturating_add(::AMMHandler::on_trade_weight()); @@ -541,7 +541,7 @@ impl AmmTradeWeights> for RouterWeightInfo { for trade in route { weight.saturating_accrue(Self::sell_and_calculate_sell_trade_amounts_overhead_weight(1, 1)); - let lbp_weight = weights::lbp::BasiliskWeight::::router_execution_sell(c, e); + let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_sell(c, e); let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_sell(c, e) .saturating_add(::AMMHandler::on_trade_weight()); @@ -565,7 +565,7 @@ impl AmmTradeWeights> for RouterWeightInfo { for trade in route { weight.saturating_accrue(Self::buy_and_calculate_buy_trade_amounts_overhead_weight(2, 1)); - let lbp_weight = weights::lbp::BasiliskWeight::::router_execution_buy(c, e); + let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_buy(c, e); let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_buy(c, e) .saturating_add(::AMMHandler::on_trade_weight()); @@ -593,10 +593,10 @@ impl AmmTradeWeights> for RouterWeightInfo { //For the stored route we expect a worst case with max number of trades in the most expensive pool which is LBP //We have have two sell calculation for that, normal and inverse - weights::lbp::BasiliskWeight::::router_execution_sell(2, 0) + weights::pallet_lbp::BasiliskWeight::::router_execution_sell(2, 0) .checked_mul(pallet_route_executor::MAX_NUMBER_OF_TRADES.into()); - let lbp_weight = weights::lbp::BasiliskWeight::::router_execution_sell(1, 0); + let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_sell(1, 0); let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_sell(1, 0); //Calculate sell amounts for the new route @@ -624,7 +624,7 @@ impl AmmTradeWeights> for RouterWeightInfo { fn force_insert_route_weight() -> Weight { //Since we don't have any AMM specific thing in the extrinsic, we just return the plain weight - weights::route_executor::BasiliskWeight::::force_insert_route() + weights::pallet_route_executor::BasiliskWeight::::force_insert_route() } } @@ -655,7 +655,7 @@ parameter_types! { impl pallet_ema_oracle::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::ema_oracle::BasiliskWeight; + type WeightInfo = weights::pallet_ema_oracle::BasiliskWeight; type AuthorityOrigin = SuperMajorityTechCommitteeOrRoot; type BlockNumberProvider = RelayChainBlockNumberProvider; type SupportedPeriods = SupportedPeriods; @@ -671,7 +671,7 @@ parameter_types! { impl pallet_nft::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::nft::BasiliskWeight; + type WeightInfo = weights::pallet_nft::BasiliskWeight; type NftCollectionId = CollectionId; type NftItemId = ItemId; type CollectionType = pallet_nft::CollectionType; diff --git a/runtime/basilisk/src/benchmarking/helper.rs b/runtime/basilisk/src/benchmarking/helper.rs new file mode 100644 index 00000000000..b83e2ec9dbd --- /dev/null +++ b/runtime/basilisk/src/benchmarking/helper.rs @@ -0,0 +1,15 @@ +use pallet_treasury::ArgumentsFactory; +use primitives::AccountId; + +pub struct BenchmarkHelper; + +// Support for pallet treasury benchmarking +impl ArgumentsFactory<(), AccountId> for BenchmarkHelper { + fn create_asset_kind(_seed: u32) -> () { + () + } + + fn create_beneficiary(seed: [u8; 32]) -> AccountId { + AccountId::from(seed) + } +} diff --git a/runtime/basilisk/src/benchmarking/mod.rs b/runtime/basilisk/src/benchmarking/mod.rs index 881b47b8512..cecb6a1a3de 100644 --- a/runtime/basilisk/src/benchmarking/mod.rs +++ b/runtime/basilisk/src/benchmarking/mod.rs @@ -2,12 +2,15 @@ pub mod currencies; pub mod duster; +mod helper; pub mod marketplace; pub mod multi_payment; pub mod route_executor; pub mod tokens; pub mod vesting; +pub use helper::BenchmarkHelper; + use crate::AssetRegistry; use crate::Currencies; diff --git a/runtime/basilisk/src/benchmarking/multi_payment.rs b/runtime/basilisk/src/benchmarking/multi_payment.rs index 0cfec81ebb5..809ba5d7cb7 100644 --- a/runtime/basilisk/src/benchmarking/multi_payment.rs +++ b/runtime/basilisk/src/benchmarking/multi_payment.rs @@ -1,6 +1,6 @@ // This file is part of Basilisk-node -// Copyright (C) 2020-2022 Intergalactic, Limited (GIB). +// Copyright (C) 2020-2021 Intergalactic, Limited (GIB). // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,28 +17,49 @@ use super::*; use crate::{AccountId, AssetId, Balance, Currencies, EmaOracle, Runtime, System}; -use hydradx_traits::{ - router::{AssetPair, PoolType, RouteProvider, Trade}, - OraclePeriod, PriceOracle, -}; -use pallet_route_executor::MAX_NUMBER_OF_TRADES; -use primitives::{constants::currency::UNITS, BlockNumber, Price}; - -use frame_benchmarking::{account, BenchmarkError}; -use frame_support::{ - assert_ok, - traits::{OnFinalize, OnInitialize}, -}; +use frame_benchmarking::account; +use frame_benchmarking::BenchmarkError; +use frame_support::traits::{OnFinalize, OnInitialize}; +use frame_support::{assert_ok, parameter_types}; use frame_system::RawOrigin; +use hydradx_traits::evm::InspectEvmAccounts; +use hydradx_traits::router::PoolType; +use hydradx_traits::router::RouteProvider; +use hydradx_traits::PriceOracle; use orml_benchmarking::runtime_benchmarks; -use sp_runtime::FixedU128; +use orml_traits::MultiCurrencyExtended; +use pallet_route_executor::MAX_NUMBER_OF_TRADES; +use primitives::{BlockNumber, Price}; +use sp_core::Get; +use sp_runtime::traits::SaturatedConversion; +use sp_runtime::{FixedPointNumber, FixedU128}; type MultiPaymentPallet = pallet_transaction_multi_payment::Pallet; type XykPallet = pallet_xyk::Pallet; type Router = pallet_route_executor::Pallet; +use hydradx_traits::router::AssetPair; +use hydradx_traits::router::Trade; +use hydradx_traits::OraclePeriod; + +parameter_types! { + //NOTE: This should always be > 1 otherwise we will payout more than we collected as ED for + //insufficient assets. + pub InsufficientEDinHDX: Balance = FixedU128::from_rational(11, 10) + .saturating_mul_int(::ExistentialDeposit::get()); +} const SEED: u32 = 1; +const UNITS: Balance = 1_000_000_000_000; + +pub fn update_balance(currency_id: AssetId, who: &AccountId, balance: Balance) { + assert_ok!(>::update_balance( + currency_id, + who, + balance.saturated_into() + )); +} + runtime_benchmarks! { { Runtime, pallet_transaction_multi_payment} @@ -59,6 +80,7 @@ runtime_benchmarks! { set_currency { let maker: AccountId = account("maker", 0, SEED); let caller: AccountId = account("caller", 0, SEED); + let fallback_account: AccountId = account("fallback_account", 1, SEED); let asset_id = register_asset(b"TST".to_vec(), 100u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; @@ -140,6 +162,13 @@ runtime_benchmarks! { verify{ assert!(_price.is_some()); } + + reset_payment_currency { + let caller: AccountId = account("caller", 0, SEED); + }: { MultiPaymentPallet::::reset_payment_currency(RawOrigin::Root.into(), caller.clone())? } + verify{ + assert_eq!(MultiPaymentPallet::::get_currency(caller), None); + } } fn create_xyk_pool(asset_a: AssetId, amount_a: Balance, asset_b: AssetId, amount_b: Balance) @@ -148,6 +177,13 @@ where { let maker: AccountId = account("xyk-maker", 0, SEED); + assert_ok!(Currencies::update_balance( + RawOrigin::Root.into(), + maker.clone(), + 0_u32, + InsufficientEDinHDX::get() as i128, + )); + assert_ok!(Currencies::update_balance( RawOrigin::Root.into(), maker.clone(), diff --git a/runtime/basilisk/src/benchmarking/route_executor.rs b/runtime/basilisk/src/benchmarking/route_executor.rs index 95cb74c7c85..3709c8b37d0 100644 --- a/runtime/basilisk/src/benchmarking/route_executor.rs +++ b/runtime/basilisk/src/benchmarking/route_executor.rs @@ -1,4 +1,4 @@ -// This file is part of Basilisk-node +// This file is part of HydraDX-node // Copyright (C) 2020-2022 Intergalactic, Limited (GIB). // SPDX-License-Identifier: Apache-2.0 @@ -16,25 +16,37 @@ // limitations under the License. #![allow(clippy::result_large_err)] -use crate::{AccountId, AssetId, AssetRegistry, Balance, Currencies, Router, Runtime, RuntimeOrigin, System, LBP, XYK}; +use crate::{AccountId, AssetId, Balance, Currencies, Router, Runtime, RuntimeOrigin, System, LBP, XYK}; -use frame_benchmarking::account; +use super::*; +use frame_benchmarking::{account, BenchmarkError}; use frame_support::dispatch::DispatchResult; -use frame_support::sp_runtime::traits::One; -use frame_support::{assert_ok, ensure}; +use frame_support::{assert_ok, ensure, parameter_types}; use frame_system::RawOrigin; +use hydradx_traits::router::inverse_route; use hydradx_traits::router::AssetPair; use hydradx_traits::router::{PoolType, RouterT, Trade}; use orml_benchmarking::runtime_benchmarks; use orml_traits::{MultiCurrency, MultiCurrencyExtended}; -use pallet_asset_registry::traits::Registry; use primitives::constants::currency::UNITS; +use sp_runtime::{FixedPointNumber, FixedU128}; use sp_std::vec; - pub const INITIAL_BALANCE: Balance = 10_000_000 * UNITS; +const HDX: AssetId = 0; + +parameter_types! { + //NOTE: This should always be > 1 otherwise we will payout more than we collected as ED for + //insufficient assets. + pub InsufficientEDinHDX: Balance = FixedU128::from_rational(11, 10) + .saturating_mul_int(::ExistentialDeposit::get()); +} + fn funded_account(name: &'static str, index: u32, assets: &[AssetId]) -> AccountId { let account: AccountId = account(name, index, 0); + //Necessary to pay ED for insufficient assets. + >::update_balance(0, &account, INITIAL_BALANCE as i128).unwrap(); + for asset in assets { assert_ok!(>::update_balance( *asset, @@ -96,7 +108,14 @@ fn setup_lbp(caller: AccountId, asset_in: AssetId, asset_out: AssetId) -> Dispat } fn create_xyk_pool(asset_a: u32, asset_b: u32) { - let caller: AccountId = funded_account("caller", 0, &[asset_a, asset_b]); + let caller: AccountId = funded_account("caller", 3, &[asset_a, asset_b]); + + assert_ok!(Currencies::update_balance( + RawOrigin::Root.into(), + caller.clone(), + 0_u32, + InsufficientEDinHDX::get() as i128, + )); let amount = 100000 * UNITS; assert_ok!(Currencies::update_balance( @@ -129,8 +148,8 @@ runtime_benchmarks! { calculate_and_execute_sell_in_lbp { let c in 0..1; // if c == 1, calculate_sell_trade_amounts is executed - let asset_in = 1u32; - let asset_out = 2u32; + let asset_in = register_asset(b"FCA".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_out = register_asset(b"FCB".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; let caller: AccountId = funded_account("caller", 7, &[asset_in, asset_out]); let seller: AccountId = funded_account("seller", 8, &[asset_in, asset_out]); @@ -162,8 +181,8 @@ runtime_benchmarks! { let c in 1..2; // number of times `calculate_buy_trade_amounts` is executed let b in 0..1; // if e == 1, buy is executed - let asset_in = 1u32; - let asset_out = 2u32; + let asset_in = register_asset(b"FCA".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_out = register_asset(b"FCB".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; let caller: AccountId = funded_account("caller", 0, &[asset_in, asset_out]); let buyer: AccountId = funded_account("buyer", 1, &[asset_in, asset_out]); @@ -196,21 +215,35 @@ runtime_benchmarks! { // Calculates the weight of xyk set route. Used in the calculation to determine the weight of the overhead. set_route_for_xyk { - let asset_1 = 1u32; - let asset_2 = AssetRegistry::create_asset(&b"FCA".to_vec(), Balance::one())?; - let asset_3 = AssetRegistry::create_asset(&b"FCB".to_vec(), Balance::one())?; - let asset_4 = AssetRegistry::create_asset(&b"FCC".to_vec(), Balance::one())?; - - let caller: AccountId = funded_account("caller", 0, &[asset_1, asset_2, asset_3, asset_4]); - let buyer: AccountId = funded_account("buyer", 1, &[asset_1, asset_2, asset_3, asset_4]); - create_xyk_pool(asset_1, asset_2); + let asset_1 = register_asset(b"AS1".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_2 = register_asset(b"AS2".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_3 = register_asset(b"AS3".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_4 = register_asset(b"AS4".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_5 = register_asset(b"AS5".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_6 = register_asset(b"AS6".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + + let caller: AccountId = funded_account("caller", 0, &[asset_1, asset_2,asset_3]); + create_xyk_pool(HDX, asset_2); create_xyk_pool(asset_2, asset_3); create_xyk_pool(asset_3, asset_4); - create_xyk_pool(asset_1, asset_3); + create_xyk_pool(asset_4, asset_5); + create_xyk_pool(asset_5, asset_6); + create_xyk_pool(HDX, asset_6); + + //INIT OMNIPOOL + /*let acc = Omnipool::protocol_account(); + crate::benchmarking::omnipool::init()?; + // Create account for token provider and set balance + let owner: AccountId = account("owner", 0, 1); + let token_price = FixedU128::from((5,1)); + let token_amount = 100000 * UNITS; + update_balance(asset_6, &acc, token_amount); + // Add the token to the pool + Omnipool::add_token(RawOrigin::Root.into(), asset_6, token_price, Permill::from_percent(100), owner)?;*/ let route = vec![Trade { pool: PoolType::XYK, - asset_in: asset_1, + asset_in: HDX, asset_out: asset_2 },Trade { pool: PoolType::XYK, @@ -220,35 +253,88 @@ runtime_benchmarks! { pool: PoolType::XYK, asset_in: asset_3, asset_out: asset_4 + },Trade { + pool: PoolType::XYK, + asset_in: asset_4, + asset_out: asset_5 + },Trade { + pool: PoolType::XYK, + asset_in: asset_5, + asset_out: asset_6 }]; - Router::set_route( RawOrigin::Signed(caller.clone()).into(), - AssetPair::new(asset_1, asset_4), + AssetPair::new(HDX, asset_6), route, )?; let better_route = vec![Trade { pool: PoolType::XYK, - asset_in: asset_1, - asset_out: asset_3 - },Trade { - pool: PoolType::XYK, - asset_in: asset_3, - asset_out: asset_4 - }]; + asset_in: HDX, + asset_out: asset_6 + },]; }: { Router::set_route( RawOrigin::Signed(caller.clone()).into(), - AssetPair::new(asset_1, asset_4), + AssetPair::new(HDX, asset_6), better_route.clone(), )?; } verify { - let stored_route = Router::route(AssetPair::new(asset_1, asset_4)).unwrap(); + let stored_route = Router::route(AssetPair::new(HDX, asset_6)).unwrap(); assert_eq!(stored_route, better_route); } + + force_insert_route { + let asset_1 = register_asset(b"AS1".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_2 = register_asset(b"AS2".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_3 = register_asset(b"AS3".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_4 = register_asset(b"AS4".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_5 = register_asset(b"AS5".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_6 = register_asset(b"AS6".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + + let caller: AccountId = funded_account("caller", 0, &[asset_1, asset_2,asset_3]); + create_xyk_pool(HDX, asset_2); + create_xyk_pool(asset_2, asset_3); + create_xyk_pool(asset_3, asset_4); + create_xyk_pool(asset_4, asset_5); + create_xyk_pool(asset_5, asset_6); + create_xyk_pool(HDX, asset_6); + + let route = vec![Trade { + pool: PoolType::XYK, + asset_in: asset_6, + asset_out: asset_5 + },Trade { + pool: PoolType::XYK, + asset_in: asset_5, + asset_out: asset_4 + },Trade { + pool: PoolType::XYK, + asset_in: asset_4, + asset_out: asset_3 + },Trade { + pool: PoolType::XYK, + asset_in: asset_3, + asset_out: asset_2 + },Trade { + pool: PoolType::XYK, + asset_in: asset_2, + asset_out: HDX + }]; + }: { + Router::force_insert_route( + RawOrigin::Root.into(), + AssetPair::new(asset_6, HDX), + route.clone(), + )?; + } + verify { + + let stored_route = Router::route(AssetPair::new(HDX, asset_6)).unwrap(); + assert_eq!(inverse_route(stored_route.to_vec()), route); + } } #[cfg(test)] @@ -263,13 +349,31 @@ mod tests { .build_storage() .unwrap(); - pallet_asset_registry::GenesisConfig:: { + pallet_asset_registry::GenesisConfig:: { registered_assets: vec![ - (b"LRNA".to_vec(), 1_000u128, Some(1)), - (b"DAI".to_vec(), 1_000u128, Some(2)), + ( + Some(1), + Some(b"LRNA".to_vec().try_into().unwrap()), + 1_000u128, + None, + None, + None, + true, + ), + ( + Some(2), + Some(b"DAI".to_vec().try_into().unwrap()), + 1_000u128, + None, + None, + None, + true, + ), ], - native_asset_name: b"BSX".to_vec(), + native_asset_name: b"HDX".to_vec().try_into().unwrap(), native_existential_deposit: NativeExistentialDeposit::get(), + native_decimals: 12, + native_symbol: b"HDX".to_vec().try_into().unwrap(), } .assimilate_storage(&mut t) .unwrap(); diff --git a/runtime/basilisk/src/governance.rs b/runtime/basilisk/src/governance.rs index 5cf4ec1a7dc..e32bd8f09e4 100644 --- a/runtime/basilisk/src/governance.rs +++ b/runtime/basilisk/src/governance.rs @@ -22,8 +22,8 @@ use primitives::constants::{ }; use frame_support::traits::fungible::HoldConsideration; -use frame_support::traits::tokens::{PayFromAccount, UnityAssetBalanceConversion}; -use frame_support::traits::LinearStoragePrice; +use frame_support::traits::tokens::{Pay, PayFromAccount, PaymentStatus, Preservation, UnityAssetBalanceConversion}; +use frame_support::traits::{fungible, LinearStoragePrice}; use frame_support::{ parameter_types, sp_runtime::{Perbill, Percent, Permill}, @@ -33,6 +33,7 @@ use frame_support::{ use frame_system::{EnsureRoot, EnsureSigned}; use pallet_collective::EnsureProportionAtLeast; use sp_runtime::traits::IdentityLookup; +use sp_runtime::DispatchError; use sp_staking::currency_to_vote::U128CurrencyToVote; pub type MajorityCouncilOrRoot = @@ -63,7 +64,7 @@ parameter_types! { } impl pallet_democracy::Config for Runtime { - type WeightInfo = weights::democracy::BasiliskWeight; + type WeightInfo = weights::pallet_democracy::BasiliskWeight; type RuntimeEvent = RuntimeEvent; type Scheduler = Scheduler; type Preimages = Preimage; @@ -139,7 +140,7 @@ impl pallet_elections_phragmen::Config for Runtime { type MaxCandidates = MaxElectionCandidates; type MaxVoters = MaxElectionVoters; type MaxVotesPerVoter = MaxVotesPerVoter; - type WeightInfo = weights::elections::BasiliskWeight; + type WeightInfo = weights::pallet_elections_phragmen::BasiliskWeight; } parameter_types! { @@ -158,7 +159,7 @@ impl pallet_collective::Config for Runtime { type MaxProposals = CouncilMaxProposals; type MaxMembers = CouncilMaxMembers; type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = weights::collective::BasiliskWeight; // use the weights from TechnicalCommittee because we are not able to benchmark both pallets + type WeightInfo = weights::pallet_collective::BasiliskWeight; // use the weights from TechnicalCommittee because we are not able to benchmark both pallets type MaxProposalWeight = MaxProposalWeight; type SetMembersOrigin = EnsureRoot; } @@ -178,7 +179,7 @@ impl pallet_collective::Config for Runtime { type MaxProposals = TechnicalMaxProposals; type MaxMembers = TechnicalMaxMembers; type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = weights::collective::BasiliskWeight; + type WeightInfo = weights::pallet_collective::BasiliskWeight; type MaxProposalWeight = MaxProposalWeight; type SetMembersOrigin = EnsureRoot; } @@ -202,7 +203,7 @@ impl pallet_tips::Config for Runtime { type TipReportDepositBase = TipReportDepositBase; type MaxTipAmount = MaxTipAmount; type Tippers = Elections; - type WeightInfo = weights::tips::BasiliskWeight; + type WeightInfo = weights::pallet_tips::BasiliskWeight; } parameter_types! { @@ -239,7 +240,7 @@ impl pallet_scheduler::Config for Runtime { type ScheduleOrigin = EnsureRoot; type OriginPrivilegeCmp = EqualPrivilegeOnly; type MaxScheduledPerBlock = MaxScheduledPerBlock; - type WeightInfo = weights::scheduler::BasiliskWeight; + type WeightInfo = weights::pallet_scheduler::BasiliskWeight; type Preimages = Preimage; } @@ -253,6 +254,58 @@ parameter_types! { pub const MaxApprovals: u32 = 100; pub TreasuryAccount: AccountId = Treasury::account_id(); pub const TreasuryPayoutPeriod: u32 = 30 * DAYS; + + #[cfg(feature = "runtime-benchmarks")] + pub const BenchmarkMaxBalance: Balance = Balance::max_value(); +} + +pub struct PayFromTreasuryAccount; + +impl Pay for PayFromTreasuryAccount { + type Balance = Balance; + type Beneficiary = AccountId; + type AssetKind = (); + type Id = (); + type Error = DispatchError; + + #[cfg(not(feature = "runtime-benchmarks"))] + fn pay( + who: &Self::Beneficiary, + _asset_kind: Self::AssetKind, + amount: Self::Balance, + ) -> Result { + let r = + >::transfer(&TreasuryAccount::get(), who, amount, Preservation::Expendable); + Ok(()) + } + + #[cfg(feature = "runtime-benchmarks")] + fn pay( + who: &Self::Beneficiary, + _asset_kind: Self::AssetKind, + amount: Self::Balance, + ) -> Result { + // In case of benchmarks, we adjust the value by multiplying it by 1_000_000_000_000, otherwise it fails with BelowMinimum limit error, because + // treasury benchmarks uses only 100 as the amount. + let r = >::transfer( + &TreasuryAccount::get(), + who, + amount * 1_000_000_000_000, + Preservation::Expendable, + ); + Ok(()) + } + + fn check_payment(_id: Self::Id) -> PaymentStatus { + PaymentStatus::Success + } + + #[cfg(feature = "runtime-benchmarks")] + fn ensure_successful(_: &Self::Beneficiary, _: Self::AssetKind, amount: Self::Balance) { + >::mint_into(&TreasuryAccount::get(), amount * 1_000_000_000_000).unwrap(); + } + #[cfg(feature = "runtime-benchmarks")] + fn ensure_concluded(_: Self::Id) {} } impl pallet_treasury::Config for Runtime { @@ -268,16 +321,19 @@ impl pallet_treasury::Config for Runtime { type Burn = Burn; type PalletId = TreasuryPalletId; type BurnDestination = (); - type WeightInfo = weights::treasury::BasiliskWeight; + type WeightInfo = weights::pallet_treasury::BasiliskWeight; type SpendFunds = (); type MaxApprovals = MaxApprovals; - type SpendOrigin = NeverEnsureOrigin; + #[cfg(not(feature = "runtime-benchmarks"))] + type SpendOrigin = NeverEnsureOrigin; // Disabled, no spending + #[cfg(feature = "runtime-benchmarks")] + type SpendOrigin = frame_system::EnsureWithSuccess, AccountId, BenchmarkMaxBalance>; type AssetKind = (); type Beneficiary = AccountId; type BeneficiaryLookup = IdentityLookup; - type Paymaster = PayFromAccount; // TODO: check what this means - type BalanceConverter = UnityAssetBalanceConversion; //TODO: check this + type Paymaster = PayFromTreasuryAccount; + type BalanceConverter = UnityAssetBalanceConversion; type PayoutPeriod = TreasuryPayoutPeriod; #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); //TODO: implement helper! + type BenchmarkHelper = benchmarking::BenchmarkHelper; } diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index dc0dd2b4056..cbdc96dd46c 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -435,6 +435,8 @@ impl_runtime_apis! { let mut list = Vec::::new(); + // Mising: XYK, uniques, primage, proxy, cumulus parachain system , collator selection, session, multisig, state trie, palle-xcm + //list_benchmark!(list, extra, pallet_xyk, XYK); list_benchmark!(list, extra, pallet_lbp, LBP); list_benchmark!(list, extra, pallet_nft, NFT); @@ -445,7 +447,7 @@ impl_runtime_apis! { list_benchmark!(list, extra, frame_system, SystemBench::); list_benchmark!(list, extra, pallet_balances, Balances); - list_benchmark!(list, extra, pallet_collator_selection, CollatorSelection); + //list_benchmark!(list, extra, pallet_collator_selection, CollatorSelection); list_benchmark!(list, extra, pallet_timestamp, Timestamp); list_benchmark!(list, extra, pallet_democracy, Democracy); list_benchmark!(list, extra, pallet_elections_phragmen, Elections); @@ -455,7 +457,7 @@ impl_runtime_apis! { list_benchmark!(list, extra, pallet_tips, Tips); list_benchmark!(list, extra, pallet_identity, Identity); list_benchmark!(list, extra, pallet_collective, TechnicalCommittee); - list_benchmark!(list, extra, pallet_state_trie_migration, StateTrieMigration); + //list_benchmark!(list, extra, pallet_state_trie_migration, StateTrieMigration); //list_benchmark!(list, extra, pallet_preimage, Preimage); list_benchmark!(list, extra, cumulus_pallet_xcmp_queue, XcmpQueue); @@ -528,7 +530,7 @@ impl_runtime_apis! { // Substrate pallets add_benchmark!(params, batches, frame_system, SystemBench::); add_benchmark!(params, batches, pallet_balances, Balances); - add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection); + //add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection); add_benchmark!(params, batches, pallet_timestamp, Timestamp); add_benchmark!(params, batches, pallet_democracy, Democracy); add_benchmark!(params, batches, pallet_elections_phragmen, Elections); @@ -538,7 +540,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_tips, Tips); add_benchmark!(params, batches, pallet_identity, Identity); add_benchmark!(params, batches, pallet_collective, TechnicalCommittee); - add_benchmark!(params, batches, pallet_state_trie_migration, StateTrieMigration); + //add_benchmark!(params, batches, pallet_state_trie_migration, StateTrieMigration); //add_benchmark!(params, batches, pallet_preimage, Preimage); add_benchmark!(params, batches, cumulus_pallet_xcmp_queue, XcmpQueue); diff --git a/runtime/basilisk/src/system.rs b/runtime/basilisk/src/system.rs index b2ab4f24143..4bc55df011d 100644 --- a/runtime/basilisk/src/system.rs +++ b/runtime/basilisk/src/system.rs @@ -155,7 +155,7 @@ impl frame_system::Config for Runtime { /// What to do if an account is fully reaped from the system. type OnKilledAccount = (); /// Weight information for the extrinsics of this pallet. - type SystemWeightInfo = weights::system::BasiliskWeight; + type SystemWeightInfo = weights::frame_system::BasiliskWeight; type SS58Prefix = SS58Prefix; type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; @@ -171,7 +171,7 @@ impl pallet_timestamp::Config for Runtime { type Moment = u64; type OnTimestampSet = (); type MinimumPeriod = MinimumPeriod; - type WeightInfo = weights::timestamp::BasiliskWeight; + type WeightInfo = weights::pallet_timestamp::BasiliskWeight; } pub struct WeightToFee; @@ -272,7 +272,7 @@ impl pallet_transaction_multi_payment::Config for Runtime { type Currencies = Currencies; type RouteProvider = Router; type OraclePriceProvider = adapter::OraclePriceProvider; - type WeightInfo = weights::payment::BasiliskWeight; + type WeightInfo = weights::pallet_transaction_multi_payment::BasiliskWeight; type WeightToFee = WeightToFee; type NativeAssetId = NativeAssetId; type EvmAssetId = WethAssetId; @@ -366,7 +366,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type ReservedXcmpWeight = ReservedXcmpWeight; type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; type DmpQueue = frame_support::traits::EnqueueWithOrigin; // TODO: what to set here ?! - type WeightInfo = (); + type WeightInfo = (); //TODO: add benchmarks } parameter_types! { @@ -384,7 +384,7 @@ impl pallet_utility::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; type PalletsOrigin = OriginCaller; - type WeightInfo = weights::utility::BasiliskWeight; + type WeightInfo = weights::pallet_utility::BasiliskWeight; } parameter_types! { @@ -414,7 +414,7 @@ impl pallet_collator_selection::Config for Runtime { type ValidatorId = ::AccountId; type ValidatorIdOf = pallet_collator_selection::IdentityCollator; type ValidatorRegistration = Session; - type WeightInfo = weights::collator_selection::BasiliskWeight; + type WeightInfo = weights::collator_selection::BasiliskWeight; //TODO: do benchmakrs type MinEligibleCollators = ConstU32<4>; } @@ -449,7 +449,7 @@ impl pallet_relaychain_info::Config for Runtime { impl pallet_transaction_pause::Config for Runtime { type RuntimeEvent = RuntimeEvent; type UpdateOrigin = MajorityTechCommitteeOrRoot; - type WeightInfo = weights::transaction_pause::BasiliskWeight; + type WeightInfo = weights::pallet_transaction_pause::BasiliskWeight; } parameter_types! { @@ -505,7 +505,7 @@ impl pallet_identity::Config for Runtime { type PendingUsernameExpiration = PendingUserNameExpiration; type MaxSuffixLength = MaxSuffixLength; type MaxUsernameLength = MaxUsernameLength; - type WeightInfo = (); + type WeightInfo = weights::pallet_identity::BasiliskWeight; } parameter_types! { @@ -547,5 +547,5 @@ impl pallet_state_trie_migration::Config for Runtime { type MaxKeyLen = MaxKeyLen; type SignedDepositPerItem = MigrationSignedDepositPerItem; type SignedDepositBase = MigrationSignedDepositBase; - type WeightInfo = weights::state_trie::BasiliskWeight; + type WeightInfo = weights::state_trie::BasiliskWeight; //TODO: do benchmarks } diff --git a/runtime/basilisk/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/basilisk/src/weights/cumulus_pallet_xcmp_queue.rs new file mode 100644 index 00000000000..1e1bcfbe6fe --- /dev/null +++ b/runtime/basilisk/src/weights/cumulus_pallet_xcmp_queue.rs @@ -0,0 +1,165 @@ +// This file is part of Basilisk. + +// Copyright (C) 2020-2023 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 `cumulus_pallet_xcmp_queue` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` + +// Executed Command: +// ./target/release/basilisk +// benchmark +// pallet +// --wasm-execution=compiled +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --template=.maintain/pallet-weight-template-no-back.hbs +// --json-file +// raw.json +// --output +// weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weights for `cumulus_pallet_xcmp_queue`. +pub struct WeightInfo(PhantomData); + +/// Weights for `cumulus_pallet_xcmp_queue` using the Basilisk node and recommended hardware. +pub struct BasiliskWeight(PhantomData); +impl cumulus_pallet_xcmp_queue::WeightInfo for BasiliskWeight { + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:1) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn set_config_with_u32() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `1594` + // Minimum execution time: 5_100_000 picoseconds. + Weight::from_parts(5_390_000, 1594) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `MessageQueue::Pages` (r:0 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(134193), added: 136668, mode: `MaxEncodedLen`) + fn enqueue_xcmp_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `189` + // Estimated: `3517` + // Minimum execution time: 22_960_000 picoseconds. + Weight::from_parts(24_821_000, 3517) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn suspend_channel() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `1594` + // Minimum execution time: 3_280_000 picoseconds. + Weight::from_parts(3_490_000, 1594) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1) + /// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn resume_channel() -> Weight { + // Proof Size summary in bytes: + // Measured: `144` + // Estimated: `1629` + // Minimum execution time: 4_410_000 picoseconds. + Weight::from_parts(6_320_000, 1629) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + fn take_first_concatenated_xcm() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 8_630_000 picoseconds. + Weight::from_parts(8_910_000, 0) + } + /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) + /// Proof: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) + /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6bedc49980ba3aa32b0a189290fd036649` (r:1 w:1) + /// Proof: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6bedc49980ba3aa32b0a189290fd036649` (r:1 w:1) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `MessageQueue::Pages` (r:0 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(134193), added: 136668, mode: `MaxEncodedLen`) + fn on_idle_good_msg() -> Weight { + // Proof Size summary in bytes: + // Measured: `134426` + // Estimated: `137891` + // Minimum execution time: 257_233_000 picoseconds. + Weight::from_parts(277_302_000, 137891) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) + /// Proof: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) + /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6bedc49980ba3aa32b0a189290fd036649` (r:1 w:1) + /// Proof: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6bedc49980ba3aa32b0a189290fd036649` (r:1 w:1) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `XcmpQueue::QueueConfig` (r:1 w:0) + /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0) + /// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `MessageQueue::Pages` (r:0 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(134193), added: 136668, mode: `MaxEncodedLen`) + fn on_idle_large_msg() -> Weight { + // Proof Size summary in bytes: + // Measured: `65823` + // Estimated: `69288` + // Minimum execution time: 90_740_000 picoseconds. + Weight::from_parts(162_641_000, 69288) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/system.rs b/runtime/basilisk/src/weights/frame_system.rs similarity index 52% rename from runtime/basilisk/src/weights/system.rs rename to runtime/basilisk/src/weights/frame_system.rs index c34a05f4ee2..a4a476e5bc0 100644 --- a/runtime/basilisk/src/weights/system.rs +++ b/runtime/basilisk/src/weights/frame_system.rs @@ -15,62 +15,67 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `frame_system` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=frame-system -// --output=weights-1.1.0/system.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use frame_system::weights::WeightInfo; +/// Weights for `frame_system`. +pub struct WeightInfo(PhantomData); +/// Weights for `frame_system` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl frame_system::WeightInfo for BasiliskWeight { /// The range of component `b` is `[0, 3932160]`. - fn remark(b: u32) -> Weight { + fn remark(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_616_000 picoseconds. - Weight::from_parts(3_685_000, 0) + // Minimum execution time: 2_400_000 picoseconds. + Weight::from_parts(2_344_404, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(410, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(217, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 3932160]`. - fn remark_with_event(b: u32) -> Weight { + fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_748_000 picoseconds. - Weight::from_parts(11_887_000, 0) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_408, 0).saturating_mul(b.into())) + // Minimum execution time: 5_810_000 picoseconds. + Weight::from_parts(23_945_595, 0) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_144, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -80,8 +85,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 6_909_000 picoseconds. - Weight::from_parts(7_056_000, 1485) + // Minimum execution time: 3_930_000 picoseconds. + Weight::from_parts(4_150_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -101,58 +106,83 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `198` // Estimated: `1683` - // Minimum execution time: 118_445_234_000 picoseconds. - Weight::from_parts(121_210_429_000, 1683) + // Minimum execution time: 106_129_535_000 picoseconds. + Weight::from_parts(109_865_673_000, 1683) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[0, 1000]`. - fn set_storage(i: u32) -> Weight { + fn set_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_890_000 picoseconds. - Weight::from_parts(4_013_000, 0) - // Standard Error: 4_442 - .saturating_add(Weight::from_parts(944_461, 0).saturating_mul(i.into())) + // Minimum execution time: 2_370_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 1_571 + .saturating_add(Weight::from_parts(767_124, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `i` is `[0, 1000]`. - fn kill_storage(i: u32) -> Weight { + fn kill_storage(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_984_000 picoseconds. - Weight::from_parts(4_015_000, 0) - // Standard Error: 1_473 - .saturating_add(Weight::from_parts(634_355, 0).saturating_mul(i.into())) + // Minimum execution time: 2_330_000 picoseconds. + Weight::from_parts(2_450_000, 0) + // Standard Error: 727 + .saturating_add(Weight::from_parts(520_280, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `p` is `[0, 1000]`. - fn kill_prefix(p: u32) -> Weight { + fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `96 + p * (69 ±0)` - // Estimated: `84 + p * (70 ±0)` - // Minimum execution time: 7_026_000 picoseconds. - Weight::from_parts(7_078_000, 84) - // Standard Error: 1_506 - .saturating_add(Weight::from_parts(1_097_197, 0).saturating_mul(p.into())) + // Measured: `130 + p * (69 ±0)` + // Estimated: `120 + p * (70 ±0)` + // Minimum execution time: 4_540_000 picoseconds. + Weight::from_parts(4_631_000, 120) + // Standard Error: 1_232 + .saturating_add(Weight::from_parts(919_382, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) } - + /// Storage: `System::AuthorizedUpgrade` (r:0 w:1) + /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) fn authorize_upgrade() -> Weight { - todo!() + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 9_180_000 picoseconds. + Weight::from_parts(9_510_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - + /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) + /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `ParachainSystem::ValidationData` (r:1 w:0) + /// Proof: `ParachainSystem::ValidationData` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::UpgradeRestrictionSignal` (r:1 w:0) + /// Proof: `ParachainSystem::UpgradeRestrictionSignal` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::PendingValidationCode` (r:1 w:1) + /// Proof: `ParachainSystem::PendingValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0) + /// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::NewValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::NewValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ParachainSystem::DidSetValidationCode` (r:0 w:1) + /// Proof: `ParachainSystem::DidSetValidationCode` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn apply_authorized_upgrade() -> Weight { - todo!() + // Proof Size summary in bytes: + // Measured: `220` + // Estimated: `1705` + // Minimum execution time: 111_846_617_000 picoseconds. + Weight::from_parts(115_367_613_000, 1705) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/mod.rs b/runtime/basilisk/src/weights/mod.rs index a7ed2c33318..75aeb7586b7 100644 --- a/runtime/basilisk/src/weights/mod.rs +++ b/runtime/basilisk/src/weights/mod.rs @@ -1,28 +1,30 @@ -pub mod asset_registry; -pub mod balances; pub mod collator_selection; -pub mod collective; -pub mod currencies; -pub mod democracy; -pub mod duster; -pub mod elections; -pub mod ema_oracle; -pub mod lbp; -pub mod marketplace; -pub mod nft; -pub mod payment; -pub mod route_executor; -pub mod scheduler; +pub mod cumulus_pallet_xcmp_queue; +pub mod frame_system; +pub mod orml_tokens; +pub mod orml_vesting; +pub mod pallet_asset_registry; +pub mod pallet_balances; +pub mod pallet_collective; +pub mod pallet_currencies; +pub mod pallet_democracy; +pub mod pallet_duster; +pub mod pallet_elections_phragmen; +pub mod pallet_ema_oracle; +pub mod pallet_identity; +pub mod pallet_lbp; +pub mod pallet_marketplace; +pub mod pallet_message_queue; +pub mod pallet_nft; +pub mod pallet_route_executor; +pub mod pallet_scheduler; +pub mod pallet_timestamp; +pub mod pallet_tips; +pub mod pallet_transaction_multi_payment; +pub mod pallet_transaction_pause; +pub mod pallet_treasury; +pub mod pallet_utility; +pub mod pallet_xyk_liquidity_mining; pub mod state_trie; -pub mod system; -pub mod timestamp; -pub mod tips; -pub mod tokens; -pub mod transaction_pause; -pub mod treasury; -pub mod utility; -pub mod vesting; pub mod xcm; -pub mod xcmp_queue; pub mod xyk; -pub mod xyk_liquidity_mining; diff --git a/runtime/basilisk/src/weights/tokens.rs b/runtime/basilisk/src/weights/orml_tokens.rs similarity index 83% rename from runtime/basilisk/src/weights/tokens.rs rename to runtime/basilisk/src/weights/orml_tokens.rs index 2eea647dc06..93440e899bb 100644 --- a/runtime/basilisk/src/weights/tokens.rs +++ b/runtime/basilisk/src/weights/orml_tokens.rs @@ -15,43 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `orml_tokens` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=orml-tokens -// --output=weights-1.1.0/tokens.rs -// --extrinsic=** +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use orml_tokens::WeightInfo; +/// Weights for `orml_tokens`. +pub struct WeightInfo(PhantomData); +/// Weights for `orml_tokens` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl orml_tokens::WeightInfo for BasiliskWeight { /// Storage: `Tokens::Accounts` (r:2 w:2) /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::Assets` (r:1 w:0) @@ -64,10 +69,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `2106` + // Measured: `2139` // Estimated: `6156` - // Minimum execution time: 87_635_000 picoseconds. - Weight::from_parts(88_923_000, 6156) + // Minimum execution time: 88_221_000 picoseconds. + Weight::from_parts(92_851_000, 6156) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -83,10 +88,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn transfer_all() -> Weight { // Proof Size summary in bytes: - // Measured: `2106` + // Measured: `2139` // Estimated: `6156` - // Minimum execution time: 91_552_000 picoseconds. - Weight::from_parts(92_683_000, 6156) + // Minimum execution time: 92_411_000 picoseconds. + Weight::from_parts(97_421_000, 6156) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -102,10 +107,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `1966` + // Measured: `1999` // Estimated: `6156` - // Minimum execution time: 72_439_000 picoseconds. - Weight::from_parts(72_911_000, 6156) + // Minimum execution time: 73_270_000 picoseconds. + Weight::from_parts(78_691_000, 6156) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -121,10 +126,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `2099` + // Measured: `2132` // Estimated: `6196` - // Minimum execution time: 75_225_000 picoseconds. - Weight::from_parts(76_079_000, 6196) + // Minimum execution time: 77_470_000 picoseconds. + Weight::from_parts(82_690_000, 6196) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -142,11 +147,11 @@ impl WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn set_balance() -> Weight { // Proof Size summary in bytes: - // Measured: `1897` + // Measured: `1930` // Estimated: `3593` - // Minimum execution time: 64_677_000 picoseconds. - Weight::from_parts(65_382_000, 3593) + // Minimum execution time: 45_050_000 picoseconds. + Weight::from_parts(50_250_000, 3593) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/vesting.rs b/runtime/basilisk/src/weights/orml_vesting.rs similarity index 72% rename from runtime/basilisk/src/weights/vesting.rs rename to runtime/basilisk/src/weights/orml_vesting.rs index e2511268bf7..53913d5ec6a 100644 --- a/runtime/basilisk/src/weights/vesting.rs +++ b/runtime/basilisk/src/weights/orml_vesting.rs @@ -15,43 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `orml_vesting` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=orml-vesting -// --output=weights-1.1.0/vesting.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use orml_vesting::WeightInfo; +/// Weights for `orml_vesting`. +pub struct WeightInfo(PhantomData); +/// Weights for `orml_vesting` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl orml_vesting::WeightInfo for BasiliskWeight { /// Storage: `Vesting::VestingSchedules` (r:1 w:1) /// Proof: `Vesting::VestingSchedules` (`max_values`: None, `max_size`: Some(469), added: 2944, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:2 w:2) @@ -62,10 +67,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) fn vested_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `1699` + // Measured: `1665` // Estimated: `6196` - // Minimum execution time: 126_454_000 picoseconds. - Weight::from_parts(127_586_000, 6196) + // Minimum execution time: 85_591_000 picoseconds. + Weight::from_parts(95_061_000, 6196) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -76,14 +81,12 @@ impl WeightInfo for BasiliskWeight { /// Storage: `Balances::Freezes` (r:1 w:0) /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) /// The range of component `i` is `[1, 15]`. - fn claim(i: u32) -> Weight { + fn claim(_i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1840 + i * (18 ±0)` + // Measured: `1806 + i * (18 ±0)` // Estimated: `4764` - // Minimum execution time: 70_242_000 picoseconds. - Weight::from_parts(72_046_048, 4764) - // Standard Error: 8_526 - .saturating_add(Weight::from_parts(113_690, 0).saturating_mul(i.into())) + // Minimum execution time: 47_431_000 picoseconds. + Weight::from_parts(75_070_546, 4764) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -96,15 +99,15 @@ impl WeightInfo for BasiliskWeight { /// Storage: `Vesting::VestingSchedules` (r:0 w:1) /// Proof: `Vesting::VestingSchedules` (`max_values`: None, `max_size`: Some(469), added: 2944, mode: `MaxEncodedLen`) /// The range of component `i` is `[1, 15]`. - fn update_vesting_schedules(i: u32) -> Weight { + fn update_vesting_schedules(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1492` + // Measured: `1458` // Estimated: `4764` - // Minimum execution time: 60_347_000 picoseconds. - Weight::from_parts(61_015_266, 4764) - // Standard Error: 3_669 - .saturating_add(Weight::from_parts(96_340, 0).saturating_mul(i.into())) + // Minimum execution time: 37_421_000 picoseconds. + Weight::from_parts(36_443_624, 4764) + // Standard Error: 74_387 + .saturating_add(Weight::from_parts(944_826, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/asset_registry.rs b/runtime/basilisk/src/weights/pallet_asset_registry.rs similarity index 76% rename from runtime/basilisk/src/weights/asset_registry.rs rename to runtime/basilisk/src/weights/pallet_asset_registry.rs index 7899805e181..70f9880b1ef 100644 --- a/runtime/basilisk/src/weights/asset_registry.rs +++ b/runtime/basilisk/src/weights/pallet_asset_registry.rs @@ -15,43 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_asset_registry` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-asset-registry -// --output=weights-1.1.0/asset_registry.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_asset_registry::weights::WeightInfo; +/// Weights for `pallet_asset_registry`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_asset_registry` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_asset_registry::WeightInfo for BasiliskWeight { /// Storage: `AssetRegistry::AssetIds` (r:1 w:1) /// Proof: `AssetRegistry::AssetIds` (`max_values`: None, `max_size`: Some(53), added: 2528, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::NextAssetId` (r:1 w:1) @@ -66,10 +71,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn register() -> Weight { // Proof Size summary in bytes: - // Measured: `305` + // Measured: `338` // Estimated: `4087` - // Minimum execution time: 46_391_000 picoseconds. - Weight::from_parts(47_096_000, 4087) + // Minimum execution time: 27_560_000 picoseconds. + Weight::from_parts(27_910_000, 4087) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -79,10 +84,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `AssetRegistry::AssetIds` (`max_values`: None, `max_size`: Some(53), added: 2528, mode: `MaxEncodedLen`) fn update() -> Weight { // Proof Size summary in bytes: - // Measured: `372` + // Measured: `405` // Estimated: `3552` - // Minimum execution time: 28_884_000 picoseconds. - Weight::from_parts(29_304_000, 3552) + // Minimum execution time: 18_800_000 picoseconds. + Weight::from_parts(19_330_000, 3552) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -92,10 +97,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `AssetRegistry::AssetMetadataMap` (`max_values`: None, `max_size`: Some(46), added: 2521, mode: `MaxEncodedLen`) fn set_metadata() -> Weight { // Proof Size summary in bytes: - // Measured: `300` + // Measured: `333` // Estimated: `3552` - // Minimum execution time: 21_653_000 picoseconds. - Weight::from_parts(21_923_000, 3552) + // Minimum execution time: 13_700_000 picoseconds. + Weight::from_parts(14_060_000, 3552) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -107,11 +112,11 @@ impl WeightInfo for BasiliskWeight { /// Proof: `AssetRegistry::AssetLocations` (`max_values`: None, `max_size`: Some(614), added: 3089, mode: `MaxEncodedLen`) fn set_location() -> Weight { // Proof Size summary in bytes: - // Measured: `274` + // Measured: `307` // Estimated: `4087` - // Minimum execution time: 26_980_000 picoseconds. - Weight::from_parts(27_406_000, 4087) + // Minimum execution time: 17_221_000 picoseconds. + Weight::from_parts(17_960_000, 4087) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/balances.rs b/runtime/basilisk/src/weights/pallet_balances.rs similarity index 67% rename from runtime/basilisk/src/weights/balances.rs rename to runtime/basilisk/src/weights/pallet_balances.rs index c772c975fe0..2fc4549c483 100644 --- a/runtime/basilisk/src/weights/balances.rs +++ b/runtime/basilisk/src/weights/pallet_balances.rs @@ -15,51 +15,56 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_balances` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-balances -// --output=weights-1.1.0/balances.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_balances::weights::WeightInfo; +/// Weights for `pallet_balances`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_balances` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_balances::WeightInfo for BasiliskWeight { /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_allow_death() -> Weight { // Proof Size summary in bytes: // Measured: `52` // Estimated: `3593` - // Minimum execution time: 97_341_000 picoseconds. - Weight::from_parts(98_092_000, 3593) + // Minimum execution time: 59_420_000 picoseconds. + Weight::from_parts(61_941_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -69,8 +74,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `52` // Estimated: `3593` - // Minimum execution time: 60_573_000 picoseconds. - Weight::from_parts(61_238_000, 3593) + // Minimum execution time: 39_251_000 picoseconds. + Weight::from_parts(39_850_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -80,8 +85,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 23_050_000 picoseconds. - Weight::from_parts(23_439_000, 3593) + // Minimum execution time: 14_090_000 picoseconds. + Weight::from_parts(14_881_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -91,8 +96,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 33_216_000 picoseconds. - Weight::from_parts(33_836_000, 3593) + // Minimum execution time: 19_101_000 picoseconds. + Weight::from_parts(19_770_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -102,8 +107,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `155` // Estimated: `6196` - // Minimum execution time: 100_377_000 picoseconds. - Weight::from_parts(100_813_000, 6196) + // Minimum execution time: 60_850_000 picoseconds. + Weight::from_parts(62_291_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -113,8 +118,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `52` // Estimated: `3593` - // Minimum execution time: 74_755_000 picoseconds. - Weight::from_parts(75_577_000, 3593) + // Minimum execution time: 48_820_000 picoseconds. + Weight::from_parts(49_780_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -124,28 +129,34 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 26_716_000 picoseconds. - Weight::from_parts(27_432_000, 3593) + // Minimum execution time: 17_490_000 picoseconds. + Weight::from_parts(18_020_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - /// Storage: `System::Account` (r:1000 w:1000) + /// Storage: `System::Account` (r:999 w:999) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// The range of component `u` is `[1, 1000]`. - fn upgrade_accounts(u: u32) -> Weight { + fn upgrade_accounts(u: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + u * (135 ±0)` // Estimated: `990 + u * (2603 ±0)` - // Minimum execution time: 26_372_000 picoseconds. - Weight::from_parts(26_734_000, 990) - // Standard Error: 19_513 - .saturating_add(Weight::from_parts(19_513_626, 0).saturating_mul(u.into())) + // Minimum execution time: 17_380_000 picoseconds. + Weight::from_parts(17_480_000, 990) + // Standard Error: 11_849 + .saturating_add(Weight::from_parts(13_979_661, 0).saturating_mul(u.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) } - + /// Storage: `Balances::InactiveIssuance` (r:1 w:0) + /// Proof: `Balances::InactiveIssuance` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) fn force_adjust_total_issuance() -> Weight { - todo!() + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1501` + // Minimum execution time: 6_560_000 picoseconds. + Weight::from_parts(6_820_000, 1501) + .saturating_add(T::DbWeight::get().reads(1_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/collective.rs b/runtime/basilisk/src/weights/pallet_collective.rs similarity index 66% rename from runtime/basilisk/src/weights/collective.rs rename to runtime/basilisk/src/weights/pallet_collective.rs index 66e20f44708..eb25e577fd4 100644 --- a/runtime/basilisk/src/weights/collective.rs +++ b/runtime/basilisk/src/weights/pallet_collective.rs @@ -15,43 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_collective` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-collective -// --output=weights-1.1.0/collective.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_collective::weights::WeightInfo; +/// Weights for `pallet_collective`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_collective` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_collective::WeightInfo for BasiliskWeight { /// Storage: `TechnicalCommittee::Members` (r:1 w:1) /// Proof: `TechnicalCommittee::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `TechnicalCommittee::Proposals` (r:1 w:0) @@ -63,37 +68,35 @@ impl WeightInfo for BasiliskWeight { /// The range of component `m` is `[0, 10]`. /// The range of component `n` is `[0, 10]`. /// The range of component `p` is `[0, 20]`. - fn set_members(m: u32, _n: u32, p: u32) -> Weight { + fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + m * (672 ±0) + p * (310 ±0)` - // Estimated: `7085 + m * (396 ±7) + p * (2539 ±3)` - // Minimum execution time: 14_131_000 picoseconds. - Weight::from_parts(14_533_000, 7085) - // Standard Error: 152_332 - .saturating_add(Weight::from_parts(2_671_121, 0).saturating_mul(m.into())) - // Standard Error: 76_518 - .saturating_add(Weight::from_parts(4_088_462, 0).saturating_mul(p.into())) + // Estimated: `4294 + m * (398 ±4) + p * (2602 ±2)` + // Minimum execution time: 10_441_000 picoseconds. + Weight::from_parts(13_200_000, 4294) + // Standard Error: 146_710 + .saturating_add(Weight::from_parts(2_234_681, 0).saturating_mul(m.into())) + // Standard Error: 74_190 + .saturating_add(Weight::from_parts(4_228_360, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) - .saturating_add(Weight::from_parts(0, 396).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 2539).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 398).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 2602).saturating_mul(p.into())) } /// Storage: `TechnicalCommittee::Members` (r:1 w:0) /// Proof: `TechnicalCommittee::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// The range of component `b` is `[2, 1024]`. /// The range of component `m` is `[1, 10]`. - fn execute(b: u32, m: u32) -> Weight { + fn execute(b: u32, m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `70 + m * (32 ±0)` - // Estimated: `1555 + m * (32 ±0)` - // Minimum execution time: 21_477_000 picoseconds. - Weight::from_parts(21_571_584, 1555) - // Standard Error: 27 - .saturating_add(Weight::from_parts(1_340, 0).saturating_mul(b.into())) - // Standard Error: 3_076 - .saturating_add(Weight::from_parts(28_991, 0).saturating_mul(m.into())) + // Estimated: `1554 + m * (32 ±0)` + // Minimum execution time: 12_880_000 picoseconds. + Weight::from_parts(15_971_362, 1554) + // Standard Error: 178 + .saturating_add(Weight::from_parts(750, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) } @@ -103,16 +106,14 @@ impl WeightInfo for BasiliskWeight { /// Proof: `TechnicalCommittee::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `b` is `[2, 1024]`. /// The range of component `m` is `[1, 10]`. - fn propose_execute(b: u32, m: u32) -> Weight { + fn propose_execute(b: u32, m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `70 + m * (32 ±0)` - // Estimated: `3535 + m * (32 ±0)` - // Minimum execution time: 25_333_000 picoseconds. - Weight::from_parts(25_044_584, 3535) - // Standard Error: 60 - .saturating_add(Weight::from_parts(1_891, 0).saturating_mul(b.into())) - // Standard Error: 6_890 - .saturating_add(Weight::from_parts(71_568, 0).saturating_mul(m.into())) + // Estimated: `3534 + m * (32 ±0)` + // Minimum execution time: 15_360_000 picoseconds. + Weight::from_parts(17_393_689, 3534) + // Standard Error: 118 + .saturating_add(Weight::from_parts(884, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) } @@ -129,21 +130,17 @@ impl WeightInfo for BasiliskWeight { /// The range of component `b` is `[2, 1024]`. /// The range of component `m` is `[2, 10]`. /// The range of component `p` is `[1, 20]`. - fn propose_proposed(b: u32, m: u32, p: u32) -> Weight { + fn propose_proposed(_b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `128 + m * (32 ±0) + p * (52 ±0)` - // Estimated: `3529 + m * (36 ±0) + p * (54 ±0)` - // Minimum execution time: 33_376_000 picoseconds. - Weight::from_parts(33_502_707, 3529) - // Standard Error: 106 - .saturating_add(Weight::from_parts(1_928, 0).saturating_mul(b.into())) - // Standard Error: 12_618 - .saturating_add(Weight::from_parts(29_934, 0).saturating_mul(m.into())) - // Standard Error: 5_629 - .saturating_add(Weight::from_parts(335_390, 0).saturating_mul(p.into())) + // Measured: `60 + m * (32 ±0) + p * (55 ±0)` + // Estimated: `3486 + m * (38 ±0) + p * (54 ±0)` + // Minimum execution time: 19_431_000 picoseconds. + Weight::from_parts(27_674_033, 3486) + // Standard Error: 15_838 + .saturating_add(Weight::from_parts(279_495, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) - .saturating_add(Weight::from_parts(0, 36).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 38).saturating_mul(m.into())) .saturating_add(Weight::from_parts(0, 54).saturating_mul(p.into())) } /// Storage: `TechnicalCommittee::Members` (r:1 w:0) @@ -151,14 +148,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `TechnicalCommittee::Voting` (r:1 w:1) /// Proof: `TechnicalCommittee::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `m` is `[5, 10]`. - fn vote(m: u32) -> Weight { + fn vote(m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `610 + m * (64 ±0)` // Estimated: `4075 + m * (64 ±0)` - // Minimum execution time: 26_938_000 picoseconds. - Weight::from_parts(27_018_173, 4075) - // Standard Error: 6_530 - .saturating_add(Weight::from_parts(72_199, 0).saturating_mul(m.into())) + // Minimum execution time: 17_150_000 picoseconds. + Weight::from_parts(18_370_755, 4075) + // Standard Error: 11_823 + .saturating_add(Weight::from_parts(43_034, 0).saturating_mul(m.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) @@ -173,16 +170,16 @@ impl WeightInfo for BasiliskWeight { /// Proof: `TechnicalCommittee::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `m` is `[4, 10]`. /// The range of component `p` is `[1, 20]`. - fn close_early_disapproved(m: u32, p: u32) -> Weight { + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `164 + m * (64 ±0) + p * (55 ±0)` - // Estimated: `3623 + m * (66 ±0) + p * (55 ±0)` - // Minimum execution time: 34_392_000 picoseconds. - Weight::from_parts(34_795_912, 3623) - // Standard Error: 13_268 - .saturating_add(Weight::from_parts(67_179, 0).saturating_mul(m.into())) - // Standard Error: 4_357 - .saturating_add(Weight::from_parts(290_784, 0).saturating_mul(p.into())) + // Measured: `155 + m * (64 ±0) + p * (55 ±0)` + // Estimated: `3620 + m * (66 ±0) + p * (55 ±0)` + // Minimum execution time: 20_080_000 picoseconds. + Weight::from_parts(21_109_557, 3620) + // Standard Error: 10_690 + .saturating_add(Weight::from_parts(40_794, 0).saturating_mul(m.into())) + // Standard Error: 3_602 + .saturating_add(Weight::from_parts(294_570, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 66).saturating_mul(m.into())) @@ -199,21 +196,21 @@ impl WeightInfo for BasiliskWeight { /// The range of component `b` is `[2, 1024]`. /// The range of component `m` is `[4, 10]`. /// The range of component `p` is `[1, 20]`. - fn close_early_approved(b: u32, m: u32, p: u32) -> Weight { + fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `66 + b * (1 ±0) + m * (64 ±0) + p * (79 ±0)` - // Estimated: `3612 + b * (1 ±0) + m * (59 ±1) + p * (76 ±0)` - // Minimum execution time: 50_177_000 picoseconds. - Weight::from_parts(50_853_069, 3612) - // Standard Error: 196 - .saturating_add(Weight::from_parts(3_771, 0).saturating_mul(b.into())) - // Standard Error: 10_427 - .saturating_add(Weight::from_parts(530_034, 0).saturating_mul(p.into())) + // Measured: `100 + b * (1 ±0) + m * (64 ±0) + p * (78 ±0)` + // Estimated: `3694 + b * (1 ±0) + m * (55 ±1) + p * (74 ±0)` + // Minimum execution time: 29_780_000 picoseconds. + Weight::from_parts(34_133_141, 3694) + // Standard Error: 121 + .saturating_add(Weight::from_parts(2_139, 0).saturating_mul(b.into())) + // Standard Error: 6_328 + .saturating_add(Weight::from_parts(442_219, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) - .saturating_add(Weight::from_parts(0, 59).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 76).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 55).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 74).saturating_mul(p.into())) } /// Storage: `TechnicalCommittee::Voting` (r:1 w:1) /// Proof: `TechnicalCommittee::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -227,16 +224,16 @@ impl WeightInfo for BasiliskWeight { /// Proof: `TechnicalCommittee::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `m` is `[4, 10]`. /// The range of component `p` is `[1, 20]`. - fn close_disapproved(m: u32, p: u32) -> Weight { + fn close_disapproved(m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `184 + m * (64 ±0) + p * (55 ±0)` - // Estimated: `3643 + m * (66 ±0) + p * (55 ±0)` - // Minimum execution time: 37_715_000 picoseconds. - Weight::from_parts(38_659_831, 3643) - // Standard Error: 13_755 - .saturating_add(Weight::from_parts(37_343, 0).saturating_mul(m.into())) - // Standard Error: 4_516 - .saturating_add(Weight::from_parts(283_261, 0).saturating_mul(p.into())) + // Measured: `175 + m * (64 ±0) + p * (55 ±0)` + // Estimated: `3640 + m * (66 ±0) + p * (55 ±0)` + // Minimum execution time: 21_660_000 picoseconds. + Weight::from_parts(22_385_803, 3640) + // Standard Error: 12_073 + .saturating_add(Weight::from_parts(65_241, 0).saturating_mul(m.into())) + // Standard Error: 4_067 + .saturating_add(Weight::from_parts(304_671, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 66).saturating_mul(m.into())) @@ -255,21 +252,23 @@ impl WeightInfo for BasiliskWeight { /// The range of component `b` is `[2, 1024]`. /// The range of component `m` is `[4, 10]`. /// The range of component `p` is `[1, 20]`. - fn close_approved(b: u32, m: u32, p: u32) -> Weight { + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `86 + b * (1 ±0) + m * (64 ±0) + p * (79 ±0)` - // Estimated: `3632 + b * (1 ±0) + m * (59 ±1) + p * (76 ±0)` - // Minimum execution time: 54_060_000 picoseconds. - Weight::from_parts(54_211_560, 3632) - // Standard Error: 216 - .saturating_add(Weight::from_parts(3_907, 0).saturating_mul(b.into())) - // Standard Error: 11_493 - .saturating_add(Weight::from_parts(539_109, 0).saturating_mul(p.into())) + // Measured: `120 + b * (1 ±0) + m * (64 ±0) + p * (78 ±0)` + // Estimated: `3714 + b * (1 ±0) + m * (55 ±1) + p * (74 ±0)` + // Minimum execution time: 32_810_000 picoseconds. + Weight::from_parts(34_006_791, 3714) + // Standard Error: 880 + .saturating_add(Weight::from_parts(10_693, 0).saturating_mul(b.into())) + // Standard Error: 135_896 + .saturating_add(Weight::from_parts(424_660, 0).saturating_mul(m.into())) + // Standard Error: 45_893 + .saturating_add(Weight::from_parts(54_768, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) - .saturating_add(Weight::from_parts(0, 59).saturating_mul(m.into())) - .saturating_add(Weight::from_parts(0, 76).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(0, 55).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 74).saturating_mul(p.into())) } /// Storage: `TechnicalCommittee::Proposals` (r:1 w:1) /// Proof: `TechnicalCommittee::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -278,16 +277,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `TechnicalCommittee::ProposalOf` (r:0 w:1) /// Proof: `TechnicalCommittee::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `p` is `[1, 20]`. - fn disapprove_proposal(p: u32) -> Weight { + fn disapprove_proposal(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `226 + p * (32 ±0)` // Estimated: `1711 + p * (32 ±0)` - // Minimum execution time: 22_209_000 picoseconds. - Weight::from_parts(22_780_540, 1711) - // Standard Error: 3_594 - .saturating_add(Weight::from_parts(225_594, 0).saturating_mul(p.into())) + // Minimum execution time: 14_580_000 picoseconds. + Weight::from_parts(23_548_101, 1711) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(p.into())) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/currencies.rs b/runtime/basilisk/src/weights/pallet_currencies.rs similarity index 76% rename from runtime/basilisk/src/weights/currencies.rs rename to runtime/basilisk/src/weights/pallet_currencies.rs index 5a31bbbddea..64320fd18a5 100644 --- a/runtime/basilisk/src/weights/currencies.rs +++ b/runtime/basilisk/src/weights/pallet_currencies.rs @@ -15,43 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_currencies` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-currencies -// --output=weights-1.1.0/currencies.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_currencies::WeightInfo; +/// Weights for `pallet_currencies`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_currencies` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_currencies::WeightInfo for BasiliskWeight { /// Storage: `Tokens::Accounts` (r:2 w:2) /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::Assets` (r:1 w:0) @@ -64,10 +69,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn transfer_non_native_currency() -> Weight { // Proof Size summary in bytes: - // Measured: `2106` + // Measured: `2139` // Estimated: `6156` - // Minimum execution time: 95_273_000 picoseconds. - Weight::from_parts(95_988_000, 6156) + // Minimum execution time: 91_400_000 picoseconds. + Weight::from_parts(96_681_000, 6156) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -75,10 +80,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn transfer_native_currency() -> Weight { // Proof Size summary in bytes: - // Measured: `1444` + // Measured: `1410` // Estimated: `3593` - // Minimum execution time: 92_596_000 picoseconds. - Weight::from_parts(93_466_000, 3593) + // Minimum execution time: 92_311_000 picoseconds. + Weight::from_parts(97_281_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -96,10 +101,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn update_balance_non_native_currency() -> Weight { // Proof Size summary in bytes: - // Measured: `1897` + // Measured: `1930` // Estimated: `3593` - // Minimum execution time: 71_703_000 picoseconds. - Weight::from_parts(72_244_000, 3593) + // Minimum execution time: 66_141_000 picoseconds. + Weight::from_parts(69_680_000, 3593) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -107,10 +112,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn update_balance_native_currency_creating() -> Weight { // Proof Size summary in bytes: - // Measured: `1304` + // Measured: `1270` // Estimated: `3593` - // Minimum execution time: 53_642_000 picoseconds. - Weight::from_parts(54_216_000, 3593) + // Minimum execution time: 46_320_000 picoseconds. + Weight::from_parts(48_720_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -118,11 +123,11 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn update_balance_native_currency_killing() -> Weight { // Proof Size summary in bytes: - // Measured: `1440` + // Measured: `1406` // Estimated: `3593` - // Minimum execution time: 53_388_000 picoseconds. - Weight::from_parts(53_917_000, 3593) + // Minimum execution time: 35_420_000 picoseconds. + Weight::from_parts(50_640_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/democracy.rs b/runtime/basilisk/src/weights/pallet_democracy.rs similarity index 79% rename from runtime/basilisk/src/weights/democracy.rs rename to runtime/basilisk/src/weights/pallet_democracy.rs index 1aef2c4c17b..542bf839f21 100644 --- a/runtime/basilisk/src/weights/democracy.rs +++ b/runtime/basilisk/src/weights/pallet_democracy.rs @@ -15,43 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_democracy` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-democracy -// --output=democracy.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_democracy::weights::WeightInfo; +/// Weights for `pallet_democracy`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_democracy` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_democracy::WeightInfo for BasiliskWeight { /// Storage: `Democracy::PublicPropCount` (r:1 w:1) /// Proof: `Democracy::PublicPropCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Democracy::PublicProps` (r:1 w:1) @@ -64,8 +69,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `4688` // Estimated: `18187` - // Minimum execution time: 52_114_000 picoseconds. - Weight::from_parts(52_489_000, 18187) + // Minimum execution time: 35_700_000 picoseconds. + Weight::from_parts(37_690_000, 18187) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -75,8 +80,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `3443` // Estimated: `6695` - // Minimum execution time: 45_776_000 picoseconds. - Weight::from_parts(46_532_000, 6695) + // Minimum execution time: 31_490_000 picoseconds. + Weight::from_parts(33_051_000, 6695) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -92,8 +97,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `3388` // Estimated: `7260` - // Minimum execution time: 59_494_000 picoseconds. - Weight::from_parts(60_347_000, 7260) + // Minimum execution time: 45_591_000 picoseconds. + Weight::from_parts(46_600_000, 7260) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -109,8 +114,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `3410` // Estimated: `7260` - // Minimum execution time: 66_633_000 picoseconds. - Weight::from_parts(66_980_000, 7260) + // Minimum execution time: 48_151_000 picoseconds. + Weight::from_parts(50_811_000, 7260) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -124,8 +129,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `249` // Estimated: `3666` - // Minimum execution time: 35_212_000 picoseconds. - Weight::from_parts(35_695_000, 3666) + // Minimum execution time: 21_940_000 picoseconds. + Weight::from_parts(22_591_000, 3666) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -147,8 +152,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `5819` // Estimated: `18187` - // Minimum execution time: 128_837_000 picoseconds. - Weight::from_parts(129_578_000, 18187) + // Minimum execution time: 89_101_000 picoseconds. + Weight::from_parts(94_800_000, 18187) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -160,8 +165,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `3276` // Estimated: `6703` - // Minimum execution time: 16_235_000 picoseconds. - Weight::from_parts(16_657_000, 6703) + // Minimum execution time: 10_550_000 picoseconds. + Weight::from_parts(10_970_000, 6703) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -171,8 +176,9 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_641_000 picoseconds. - Weight::from_parts(5_763_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 3_180_000 picoseconds. + Weight::from_parts(3_310_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Democracy::NextExternal` (r:0 w:1) /// Proof: `Democracy::NextExternal` (`max_values`: Some(1), `max_size`: Some(132), added: 627, mode: `MaxEncodedLen`) @@ -180,8 +186,9 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_600_000 picoseconds. - Weight::from_parts(5_786_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 3_150_000 picoseconds. + Weight::from_parts(3_280_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Democracy::NextExternal` (r:1 w:1) /// Proof: `Democracy::NextExternal` (`max_values`: Some(1), `max_size`: Some(132), added: 627, mode: `MaxEncodedLen`) @@ -195,8 +202,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `147` // Estimated: `3518` - // Minimum execution time: 35_335_000 picoseconds. - Weight::from_parts(35_694_000, 3518) + // Minimum execution time: 20_250_000 picoseconds. + Weight::from_parts(20_700_000, 3518) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -210,8 +217,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `3377` // Estimated: `6703` - // Minimum execution time: 36_757_000 picoseconds. - Weight::from_parts(37_171_000, 6703) + // Minimum execution time: 21_901_000 picoseconds. + Weight::from_parts(23_250_000, 6703) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -227,8 +234,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `5704` // Estimated: `18187` - // Minimum execution time: 100_500_000 picoseconds. - Weight::from_parts(101_121_000, 18187) + // Minimum execution time: 68_991_000 picoseconds. + Weight::from_parts(73_230_000, 18187) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -240,8 +247,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `181` // Estimated: `3518` - // Minimum execution time: 27_472_000 picoseconds. - Weight::from_parts(27_813_000, 3518) + // Minimum execution time: 15_710_000 picoseconds. + Weight::from_parts(16_400_000, 3518) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -252,14 +259,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `Democracy::ReferendumInfoOf` (r:99 w:0) /// Proof: `Democracy::ReferendumInfoOf` (`max_values`: None, `max_size`: Some(201), added: 2676, mode: `MaxEncodedLen`) /// The range of component `r` is `[0, 99]`. - fn on_initialize_base(r: u32) -> Weight { + fn on_initialize_base(r: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `125 + r * (86 ±0)` + // Measured: `127 + r * (86 ±0)` // Estimated: `1489 + r * (2676 ±0)` - // Minimum execution time: 7_324_000 picoseconds. - Weight::from_parts(10_018_029, 1489) - // Standard Error: 7_493 - .saturating_add(Weight::from_parts(3_483_961, 0).saturating_mul(r.into())) + // Minimum execution time: 3_640_000 picoseconds. + Weight::from_parts(4_833_885, 1489) + // Standard Error: 6_318 + .saturating_add(Weight::from_parts(2_975_970, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -278,14 +285,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `Democracy::ReferendumInfoOf` (r:99 w:0) /// Proof: `Democracy::ReferendumInfoOf` (`max_values`: None, `max_size`: Some(201), added: 2676, mode: `MaxEncodedLen`) /// The range of component `r` is `[0, 99]`. - fn on_initialize_base_with_launch_period(r: u32) -> Weight { + fn on_initialize_base_with_launch_period(r: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `125 + r * (86 ±0)` + // Measured: `127 + r * (86 ±0)` // Estimated: `18187 + r * (2676 ±0)` - // Minimum execution time: 11_931_000 picoseconds. - Weight::from_parts(14_585_511, 18187) - // Standard Error: 9_076 - .saturating_add(Weight::from_parts(3_497_355, 0).saturating_mul(r.into())) + // Minimum execution time: 6_280_000 picoseconds. + Weight::from_parts(9_653_253, 18187) + // Standard Error: 8_208 + .saturating_add(Weight::from_parts(2_937_580, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -300,14 +307,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `Balances::Freezes` (r:1 w:0) /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) /// The range of component `r` is `[0, 99]`. - fn delegate(r: u32) -> Weight { + fn delegate(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `748 + r * (108 ±0)` // Estimated: `19800 + r * (2676 ±0)` - // Minimum execution time: 52_854_000 picoseconds. - Weight::from_parts(54_745_296, 19800) - // Standard Error: 11_445 - .saturating_add(Weight::from_parts(4_550_546, 0).saturating_mul(r.into())) + // Minimum execution time: 34_960_000 picoseconds. + Weight::from_parts(39_523_094, 19800) + // Standard Error: 10_896 + .saturating_add(Weight::from_parts(3_741_548, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) @@ -319,14 +326,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `Democracy::ReferendumInfoOf` (r:99 w:99) /// Proof: `Democracy::ReferendumInfoOf` (`max_values`: None, `max_size`: Some(201), added: 2676, mode: `MaxEncodedLen`) /// The range of component `r` is `[0, 99]`. - fn undelegate(r: u32) -> Weight { + fn undelegate(r: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `373 + r * (108 ±0)` + // Measured: `374 + r * (108 ±0)` // Estimated: `13530 + r * (2676 ±0)` - // Minimum execution time: 25_365_000 picoseconds. - Weight::from_parts(22_654_244, 13530) - // Standard Error: 20_918 - .saturating_add(Weight::from_parts(4_586_941, 0).saturating_mul(r.into())) + // Minimum execution time: 15_810_000 picoseconds. + Weight::from_parts(15_665_531, 13530) + // Standard Error: 7_400 + .saturating_add(Weight::from_parts(3_707_968, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -339,8 +346,9 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_687_000 picoseconds. - Weight::from_parts(5_836_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 3_130_000 picoseconds. + Weight::from_parts(3_270_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Democracy::VotingOf` (r:1 w:1) /// Proof: `Democracy::VotingOf` (`max_values`: None, `max_size`: Some(3795), added: 6270, mode: `MaxEncodedLen`) @@ -351,14 +359,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// The range of component `r` is `[0, 99]`. - fn unlock_remove(r: u32) -> Weight { + fn unlock_remove(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `504` // Estimated: `7260` - // Minimum execution time: 31_996_000 picoseconds. - Weight::from_parts(43_490_743, 7260) - // Standard Error: 11_023 - .saturating_add(Weight::from_parts(105_337, 0).saturating_mul(r.into())) + // Minimum execution time: 20_831_000 picoseconds. + Weight::from_parts(31_529_422, 7260) + // Standard Error: 2_464 + .saturating_add(Weight::from_parts(57_802, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -371,14 +379,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// The range of component `r` is `[0, 99]`. - fn unlock_set(r: u32) -> Weight { + fn unlock_set(r: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `504 + r * (22 ±0)` + // Measured: `505 + r * (22 ±0)` // Estimated: `7260` - // Minimum execution time: 45_808_000 picoseconds. - Weight::from_parts(46_797_619, 7260) - // Standard Error: 1_606 - .saturating_add(Weight::from_parts(45_847, 0).saturating_mul(r.into())) + // Minimum execution time: 28_640_000 picoseconds. + Weight::from_parts(31_225_615, 7260) + // Standard Error: 1_045 + .saturating_add(Weight::from_parts(76_924, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -387,14 +395,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `Democracy::VotingOf` (r:1 w:1) /// Proof: `Democracy::VotingOf` (`max_values`: None, `max_size`: Some(3795), added: 6270, mode: `MaxEncodedLen`) /// The range of component `r` is `[1, 100]`. - fn remove_vote(r: u32) -> Weight { + fn remove_vote(r: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `644 + r * (25 ±0)` + // Measured: `609 + r * (26 ±0)` // Estimated: `7260` - // Minimum execution time: 18_965_000 picoseconds. - Weight::from_parts(21_382_331, 7260) - // Standard Error: 2_463 - .saturating_add(Weight::from_parts(65_052, 0).saturating_mul(r.into())) + // Minimum execution time: 13_440_000 picoseconds. + Weight::from_parts(16_074_656, 7260) + // Standard Error: 1_175 + .saturating_add(Weight::from_parts(79_051, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -403,14 +411,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `Democracy::VotingOf` (r:1 w:1) /// Proof: `Democracy::VotingOf` (`max_values`: None, `max_size`: Some(3795), added: 6270, mode: `MaxEncodedLen`) /// The range of component `r` is `[1, 100]`. - fn remove_other_vote(r: u32) -> Weight { + fn remove_other_vote(r: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `644 + r * (25 ±0)` + // Measured: `609 + r * (26 ±0)` // Estimated: `7260` - // Minimum execution time: 19_147_000 picoseconds. - Weight::from_parts(21_637_991, 7260) - // Standard Error: 2_623 - .saturating_add(Weight::from_parts(66_432, 0).saturating_mul(r.into())) + // Minimum execution time: 13_620_000 picoseconds. + Weight::from_parts(15_975_322, 7260) + // Standard Error: 1_285 + .saturating_add(Weight::from_parts(87_387, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -418,15 +426,17 @@ impl WeightInfo for BasiliskWeight { /// Proof: `Democracy::NextExternal` (`max_values`: Some(1), `max_size`: Some(132), added: 627, mode: `MaxEncodedLen`) /// Storage: `Preimage::StatusFor` (r:1 w:0) /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:0) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) /// Storage: `Democracy::MetadataOf` (r:0 w:1) /// Proof: `Democracy::MetadataOf` (`max_values`: None, `max_size`: Some(53), added: 2528, mode: `MaxEncodedLen`) fn set_external_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `287` // Estimated: `3556` - // Minimum execution time: 23_679_000 picoseconds. - Weight::from_parts(24_310_000, 3556) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Minimum execution time: 16_560_000 picoseconds. + Weight::from_parts(17_271_000, 3556) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Democracy::NextExternal` (r:1 w:0) @@ -437,8 +447,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `147` // Estimated: `3518` - // Minimum execution time: 21_263_000 picoseconds. - Weight::from_parts(21_643_000, 3518) + // Minimum execution time: 12_450_000 picoseconds. + Weight::from_parts(13_080_000, 3518) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -446,15 +456,17 @@ impl WeightInfo for BasiliskWeight { /// Proof: `Democracy::PublicProps` (`max_values`: Some(1), `max_size`: Some(16702), added: 17197, mode: `MaxEncodedLen`) /// Storage: `Preimage::StatusFor` (r:1 w:0) /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:0) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) /// Storage: `Democracy::MetadataOf` (r:0 w:1) /// Proof: `Democracy::MetadataOf` (`max_values`: None, `max_size`: Some(53), added: 2528, mode: `MaxEncodedLen`) fn set_proposal_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `4842` // Estimated: `18187` - // Minimum execution time: 48_066_000 picoseconds. - Weight::from_parts(48_647_000, 18187) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Minimum execution time: 38_250_000 picoseconds. + Weight::from_parts(40_580_000, 18187) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Democracy::PublicProps` (r:1 w:0) @@ -465,22 +477,24 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `4706` // Estimated: `18187` - // Minimum execution time: 44_044_000 picoseconds. - Weight::from_parts(44_772_000, 18187) + // Minimum execution time: 33_210_000 picoseconds. + Weight::from_parts(35_520_000, 18187) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Preimage::StatusFor` (r:1 w:0) /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:0) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) /// Storage: `Democracy::MetadataOf` (r:0 w:1) /// Proof: `Democracy::MetadataOf` (`max_values`: None, `max_size`: Some(53), added: 2528, mode: `MaxEncodedLen`) fn set_referendum_metadata() -> Weight { // Proof Size summary in bytes: // Measured: `211` // Estimated: `3556` - // Minimum execution time: 20_942_000 picoseconds. - Weight::from_parts(21_152_000, 3556) - .saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 14_340_000 picoseconds. + Weight::from_parts(15_181_000, 3556) + .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Democracy::ReferendumInfoOf` (r:1 w:0) @@ -491,9 +505,9 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `159` // Estimated: `3666` - // Minimum execution time: 23_243_000 picoseconds. - Weight::from_parts(23_579_000, 3666) + // Minimum execution time: 14_520_000 picoseconds. + Weight::from_parts(15_110_000, 3666) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/duster.rs b/runtime/basilisk/src/weights/pallet_duster.rs similarity index 73% rename from runtime/basilisk/src/weights/duster.rs rename to runtime/basilisk/src/weights/pallet_duster.rs index 3bcba2212b1..45a1709e78c 100644 --- a/runtime/basilisk/src/weights/duster.rs +++ b/runtime/basilisk/src/weights/pallet_duster.rs @@ -15,43 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_duster` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-duster -// --output=weights-1.1.0/duster.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_duster::weights::WeightInfo; +/// Weights for `pallet_duster`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_duster` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_duster::WeightInfo for BasiliskWeight { /// Storage: `Duster::AccountBlacklist` (r:1 w:0) /// Proof: `Duster::AccountBlacklist` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::Assets` (r:1 w:0) @@ -68,10 +73,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) fn dust_account() -> Weight { // Proof Size summary in bytes: - // Measured: `2389` + // Measured: `2422` // Estimated: `6156` - // Minimum execution time: 90_423_000 picoseconds. - Weight::from_parts(91_336_000, 6156) + // Minimum execution time: 63_791_000 picoseconds. + Weight::from_parts(110_271_000, 6156) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -81,8 +86,9 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `967` // Estimated: `0` - // Minimum execution time: 21_334_000 picoseconds. - Weight::from_parts(21_802_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 22_380_000 picoseconds. + Weight::from_parts(23_621_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Duster::AccountBlacklist` (r:1 w:1) /// Proof: `Duster::AccountBlacklist` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) @@ -90,9 +96,9 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `1288` // Estimated: `3513` - // Minimum execution time: 26_321_000 picoseconds. - Weight::from_parts(26_849_000, 3513) + // Minimum execution time: 29_380_000 picoseconds. + Weight::from_parts(31_850_000, 3513) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/elections.rs b/runtime/basilisk/src/weights/pallet_elections_phragmen.rs similarity index 78% rename from runtime/basilisk/src/weights/elections.rs rename to runtime/basilisk/src/weights/pallet_elections_phragmen.rs index eecdd6e2160..0371ffc793b 100644 --- a/runtime/basilisk/src/weights/elections.rs +++ b/runtime/basilisk/src/weights/pallet_elections_phragmen.rs @@ -18,38 +18,45 @@ //! Autogenerated weights for `pallet_elections_phragmen` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-02-26, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-elections-phragmen -// --output=weights-1.1.0/elections.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use core::marker::PhantomData; -use pallet_elections_phragmen::WeightInfo; + +/// Weights for `pallet_elections_phragmen`. +pub struct WeightInfo(PhantomData); /// Weights for `pallet_elections_phragmen` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); -impl WeightInfo for BasiliskWeight { +impl pallet_elections_phragmen::WeightInfo for BasiliskWeight { /// Storage: `Elections::Candidates` (r:1 w:0) /// Proof: `Elections::Candidates` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `Elections::Members` (r:1 w:0) @@ -65,12 +72,10 @@ impl WeightInfo for BasiliskWeight { /// The range of component `v` is `[1, 10]`. fn vote_equal(v: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `472 + v * (80 ±0)` + // Measured: `471 + v * (80 ±0)` // Estimated: `4764 + v * (80 ±0)` - // Minimum execution time: 43_136_000 picoseconds. - Weight::from_parts(43_696_491, 4764) - // Standard Error: 4_226 - .saturating_add(Weight::from_parts(64_143, 0).saturating_mul(v.into())) + // Minimum execution time: 30_020_000 picoseconds. + Weight::from_parts(31_606_956, 4764) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) @@ -92,10 +97,10 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `441 + v * (80 ±0)` // Estimated: `4764 + v * (80 ±0)` - // Minimum execution time: 59_040_000 picoseconds. - Weight::from_parts(59_382_598, 4764) - // Standard Error: 4_622 - .saturating_add(Weight::from_parts(102_861, 0).saturating_mul(v.into())) + // Minimum execution time: 40_130_000 picoseconds. + Weight::from_parts(41_945_276, 4764) + // Standard Error: 9_953 + .saturating_add(Weight::from_parts(108_461, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) @@ -117,10 +122,10 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `473 + v * (80 ±0)` // Estimated: `4764 + v * (80 ±0)` - // Minimum execution time: 58_817_000 picoseconds. - Weight::from_parts(59_624_831, 4764) - // Standard Error: 5_672 - .saturating_add(Weight::from_parts(67_682, 0).saturating_mul(v.into())) + // Minimum execution time: 40_210_000 picoseconds. + Weight::from_parts(41_557_779, 4764) + // Standard Error: 10_321 + .saturating_add(Weight::from_parts(161_908, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) @@ -135,8 +140,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `803` // Estimated: `4764` - // Minimum execution time: 61_277_000 picoseconds. - Weight::from_parts(62_036_000, 4764) + // Minimum execution time: 42_291_000 picoseconds. + Weight::from_parts(43_940_000, 4764) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -149,12 +154,12 @@ impl WeightInfo for BasiliskWeight { /// The range of component `c` is `[1, 100]`. fn submit_candidacy(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1346 + c * (48 ±0)` - // Estimated: `2831 + c * (48 ±0)` - // Minimum execution time: 42_509_000 picoseconds. - Weight::from_parts(43_368_729, 2831) - // Standard Error: 719 - .saturating_add(Weight::from_parts(56_486, 0).saturating_mul(c.into())) + // Measured: `1347 + c * (48 ±0)` + // Estimated: `2832 + c * (48 ±0)` + // Minimum execution time: 29_730_000 picoseconds. + Weight::from_parts(30_941_820, 2832) + // Standard Error: 1_864 + .saturating_add(Weight::from_parts(63_832, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 48).saturating_mul(c.into())) @@ -165,11 +170,11 @@ impl WeightInfo for BasiliskWeight { fn renounce_candidacy_candidate(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `317 + c * (48 ±0)` - // Estimated: `1795 + c * (48 ±0)` - // Minimum execution time: 38_867_000 picoseconds. - Weight::from_parts(39_751_572, 1795) - // Standard Error: 1_016 - .saturating_add(Weight::from_parts(26_999, 0).saturating_mul(c.into())) + // Estimated: `1794 + c * (48 ±0)` + // Minimum execution time: 26_030_000 picoseconds. + Weight::from_parts(27_019_508, 1794) + // Standard Error: 1_689 + .saturating_add(Weight::from_parts(59_408, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 48).saturating_mul(c.into())) @@ -188,8 +193,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `1494` // Estimated: `2979` - // Minimum execution time: 55_052_000 picoseconds. - Weight::from_parts(55_529_000, 2979) + // Minimum execution time: 35_451_000 picoseconds. + Weight::from_parts(37_431_000, 2979) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -199,8 +204,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `957` // Estimated: `2442` - // Minimum execution time: 38_957_000 picoseconds. - Weight::from_parts(39_432_000, 2442) + // Minimum execution time: 26_170_000 picoseconds. + Weight::from_parts(27_220_000, 2442) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -229,12 +234,12 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `1494` // Estimated: `3593` - // Minimum execution time: 78_532_000 picoseconds. - Weight::from_parts(79_151_000, 3593) + // Minimum execution time: 48_020_000 picoseconds. + Weight::from_parts(49_761_000, 3593) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } - /// Storage: `Elections::Voting` (r:769 w:768) + /// Storage: `Elections::Voting` (r:385 w:384) /// Proof: `Elections::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Elections::Members` (r:1 w:0) /// Proof: `Elections::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -242,26 +247,29 @@ impl WeightInfo for BasiliskWeight { /// Proof: `Elections::RunnersUp` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `Elections::Candidates` (r:1 w:0) /// Proof: `Elections::Candidates` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `Balances::Locks` (r:768 w:768) + /// Storage: `Balances::Locks` (r:384 w:384) /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) - /// Storage: `Balances::Freezes` (r:768 w:0) + /// Storage: `Balances::Freezes` (r:384 w:0) /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:768 w:768) + /// Storage: `System::Account` (r:384 w:384) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// The range of component `v` is `[384, 768]`. /// The range of component `d` is `[0, 384]`. - fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight { + fn clean_defunct_voters(v: u32, d: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2801 + v * (618 ±0)` - // Estimated: `6203 + v * (3774 ±0)` - // Minimum execution time: 30_165_011_000 picoseconds. - Weight::from_parts(30_322_012_000, 6203) - // Standard Error: 624_076 - .saturating_add(Weight::from_parts(47_261_830, 0).saturating_mul(v.into())) + // Measured: `0 + d * (631 ±0) + v * (56 ±0)` + // Estimated: `32188 + d * (3774 ±0) + v * (24 ±0)` + // Minimum execution time: 5_950_000 picoseconds. + Weight::from_parts(6_540_000, 32188) + // Standard Error: 18_350 + .saturating_add(Weight::from_parts(194_912, 0).saturating_mul(v.into())) + // Standard Error: 39_960 + .saturating_add(Weight::from_parts(47_481_975, 0).saturating_mul(d.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(v.into()))) - .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into()))) - .saturating_add(Weight::from_parts(0, 3774).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(d.into()))) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(d.into()))) + .saturating_add(Weight::from_parts(0, 3774).saturating_mul(d.into())) + .saturating_add(Weight::from_parts(0, 24).saturating_mul(v.into())) } /// Storage: `Elections::Candidates` (r:1 w:1) /// Proof: `Elections::Candidates` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -286,21 +294,21 @@ impl WeightInfo for BasiliskWeight { /// The range of component `e` is `[768, 7680]`. fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + e * (27 ±0) + v * (412 ±0)` - // Estimated: `278823 + c * (2317 ±9) + e * (11 ±0) + v * (2543 ±7)` - // Minimum execution time: 3_796_278_000 picoseconds. - Weight::from_parts(3_800_497_000, 278823) - // Standard Error: 520_739 - .saturating_add(Weight::from_parts(12_240_585, 0).saturating_mul(v.into())) - // Standard Error: 54_339 - .saturating_add(Weight::from_parts(616_870, 0).saturating_mul(e.into())) - .saturating_add(T::DbWeight::get().reads(48_u64)) + // Measured: `0 + c * (10 ±0) + e * (27 ±0) + v * (414 ±0)` + // Estimated: `278823 + c * (2405 ±3) + e * (14 ±0) + v * (2572 ±3)` + // Minimum execution time: 2_455_242_000 picoseconds. + Weight::from_parts(2_472_693_000, 278823) + // Standard Error: 196_438 + .saturating_add(Weight::from_parts(10_492_545, 0).saturating_mul(v.into())) + // Standard Error: 20_493 + .saturating_add(Weight::from_parts(594_486, 0).saturating_mul(e.into())) + .saturating_add(T::DbWeight::get().reads(32_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) .saturating_add(T::DbWeight::get().writes(6_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 2317).saturating_mul(c.into())) - .saturating_add(Weight::from_parts(0, 11).saturating_mul(e.into())) - .saturating_add(Weight::from_parts(0, 2543).saturating_mul(v.into())) + .saturating_add(Weight::from_parts(0, 2405).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 14).saturating_mul(e.into())) + .saturating_add(Weight::from_parts(0, 2572).saturating_mul(v.into())) } } \ No newline at end of file diff --git a/runtime/basilisk/src/weights/ema_oracle.rs b/runtime/basilisk/src/weights/pallet_ema_oracle.rs similarity index 50% rename from runtime/basilisk/src/weights/ema_oracle.rs rename to runtime/basilisk/src/weights/pallet_ema_oracle.rs index 76f97cb461b..f0523789424 100644 --- a/runtime/basilisk/src/weights/ema_oracle.rs +++ b/runtime/basilisk/src/weights/pallet_ema_oracle.rs @@ -15,73 +15,97 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_ema_oracle` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-ema-oracle -// --output=weights-1.1.0/ema_oracle.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_ema_oracle::weights::WeightInfo; +/// Weights for `pallet_ema_oracle`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_ema_oracle` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_ema_oracle::WeightInfo for BasiliskWeight { + /// Storage: `EmaOracle::WhitelistedAssets` (r:1 w:1) + /// Proof: `EmaOracle::WhitelistedAssets` (`max_values`: Some(1), `max_size`: Some(481), added: 976, mode: `MaxEncodedLen`) fn add_oracle() -> Weight { - todo!() + // Proof Size summary in bytes: + // Measured: `601` + // Estimated: `1966` + // Minimum execution time: 11_980_000 picoseconds. + Weight::from_parts(12_301_000, 1966) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } - + /// Storage: `EmaOracle::WhitelistedAssets` (r:1 w:1) + /// Proof: `EmaOracle::WhitelistedAssets` (`max_values`: Some(1), `max_size`: Some(481), added: 976, mode: `MaxEncodedLen`) + /// Storage: `EmaOracle::Accumulator` (r:1 w:1) + /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) + /// Storage: `EmaOracle::Oracles` (r:0 w:5) + /// Proof: `EmaOracle::Oracles` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) fn remove_oracle() -> Weight { - todo!() + // Proof Size summary in bytes: + // Measured: `617` + // Estimated: `5926` + // Minimum execution time: 33_650_000 picoseconds. + Weight::from_parts(35_430_000, 5926) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(7_u64)) } - /// Storage: `EmaOracle::Accumulator` (r:1 w:0) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) fn on_finalize_no_entry() -> Weight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `5926` - // Minimum execution time: 3_917_000 picoseconds. - Weight::from_parts(4_081_000, 5926).saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 2_580_000 picoseconds. + Weight::from_parts(2_720_000, 5926) + .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `EmaOracle::Accumulator` (r:1 w:1) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) /// Storage: `EmaOracle::Oracles` (r:145 w:145) /// Proof: `EmaOracle::Oracles` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) /// The range of component `b` is `[1, 29]`. - fn on_finalize_multiple_tokens(b: u32) -> Weight { + fn on_finalize_multiple_tokens(b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `170 + b * (933 ±0)` + // Measured: `204 + b * (933 ±0)` // Estimated: `5926 + b * (13260 ±0)` - // Minimum execution time: 75_545_000 picoseconds. - Weight::from_parts(14_265_997, 5926) - // Standard Error: 32_211 - .saturating_add(Weight::from_parts(62_973_426, 0).saturating_mul(b.into())) + // Minimum execution time: 58_130_000 picoseconds. + Weight::from_parts(9_776_517, 5926) + // Standard Error: 35_627 + .saturating_add(Weight::from_parts(50_802_493, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -91,28 +115,28 @@ impl WeightInfo for BasiliskWeight { /// Storage: `EmaOracle::Accumulator` (r:1 w:1) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) /// The range of component `b` is `[1, 29]`. - fn on_trade_multiple_tokens(b: u32) -> Weight { + fn on_trade_multiple_tokens(b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `171 + b * (148 ±0)` + // Measured: `204 + b * (148 ±0)` // Estimated: `5926` - // Minimum execution time: 9_626_000 picoseconds. - Weight::from_parts(9_727_215, 5926) - // Standard Error: 2_561 - .saturating_add(Weight::from_parts(398_934, 0).saturating_mul(b.into())) + // Minimum execution time: 5_970_000 picoseconds. + Weight::from_parts(5_906_836, 5926) + // Standard Error: 2_063 + .saturating_add(Weight::from_parts(361_436, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `EmaOracle::Accumulator` (r:1 w:1) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) /// The range of component `b` is `[1, 29]`. - fn on_liquidity_changed_multiple_tokens(b: u32) -> Weight { + fn on_liquidity_changed_multiple_tokens(b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `171 + b * (148 ±0)` + // Measured: `204 + b * (148 ±0)` // Estimated: `5926` - // Minimum execution time: 9_684_000 picoseconds. - Weight::from_parts(9_869_189, 5926) - // Standard Error: 2_507 - .saturating_add(Weight::from_parts(395_300, 0).saturating_mul(b.into())) + // Minimum execution time: 5_800_000 picoseconds. + Weight::from_parts(5_836_765, 5926) + // Standard Error: 1_944 + .saturating_add(Weight::from_parts(369_199, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,9 +144,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `EmaOracle::Oracles` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) fn get_entry() -> Weight { // Proof Size summary in bytes: - // Measured: `575` + // Measured: `609` // Estimated: `6294` - // Minimum execution time: 20_401_000 picoseconds. - Weight::from_parts(20_592_000, 6294).saturating_add(T::DbWeight::get().reads(2_u64)) + // Minimum execution time: 15_340_000 picoseconds. + Weight::from_parts(15_850_000, 6294) + .saturating_add(T::DbWeight::get().reads(2_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_identity.rs b/runtime/basilisk/src/weights/pallet_identity.rs new file mode 100644 index 00000000000..e24d113d434 --- /dev/null +++ b/runtime/basilisk/src/weights/pallet_identity.rs @@ -0,0 +1,418 @@ +// This file is part of Basilisk. + +// Copyright (C) 2020-2023 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_identity` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` + +// Executed Command: +// ./target/release/basilisk +// benchmark +// pallet +// --wasm-execution=compiled +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --template=.maintain/pallet-weight-template-no-back.hbs +// --json-file +// raw.json +// --output +// weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weights for `pallet_identity`. +pub struct WeightInfo(PhantomData); + +/// Weights for `pallet_identity` using the Basilisk node and recommended hardware. +pub struct BasiliskWeight(PhantomData); +impl pallet_identity::WeightInfo for BasiliskWeight { + /// Storage: `Identity::Registrars` (r:1 w:1) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 19]`. + fn add_registrar(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `31 + r * (57 ±0)` + // Estimated: `2626` + // Minimum execution time: 8_590_000 picoseconds. + Weight::from_parts(9_409_352, 2626) + // Standard Error: 2_298 + .saturating_add(Weight::from_parts(87_668, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 20]`. + fn set_identity(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `6977 + r * (5 ±0)` + // Estimated: `11037` + // Minimum execution time: 131_971_000 picoseconds. + Weight::from_parts(140_640_181, 11037) + // Standard Error: 14_252 + .saturating_add(Weight::from_parts(79_210, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:100 w:100) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 100]`. + fn set_subs_new(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `100` + // Estimated: `11037 + s * (2589 ±0)` + // Minimum execution time: 9_750_000 picoseconds. + Weight::from_parts(21_852_535, 11037) + // Standard Error: 6_364 + .saturating_add(Weight::from_parts(3_621_609, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(s.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + .saturating_add(Weight::from_parts(0, 2589).saturating_mul(s.into())) + } + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:0 w:100) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// The range of component `p` is `[0, 100]`. + fn set_subs_old(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `193 + p * (32 ±0)` + // Estimated: `11037` + // Minimum execution time: 9_370_000 picoseconds. + Weight::from_parts(21_694_518, 11037) + // Standard Error: 3_966 + .saturating_add(Weight::from_parts(1_442_774, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + } + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:0 w:100) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[0, 100]`. + fn clear_identity(r: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `7069 + r * (5 ±0) + s * (32 ±0)` + // Estimated: `11037` + // Minimum execution time: 59_211_000 picoseconds. + Weight::from_parts(5_812_993, 11037) + // Standard Error: 212_425 + .saturating_add(Weight::from_parts(2_642_723, 0).saturating_mul(r.into())) + // Standard Error: 41_448 + .saturating_add(Weight::from_parts(1_813_885, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + /// Storage: `Identity::Registrars` (r:1 w:0) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 20]`. + fn request_judgement(_r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `6967 + r * (57 ±0)` + // Estimated: `11037` + // Minimum execution time: 86_951_000 picoseconds. + Weight::from_parts(117_664_766, 11037) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 20]`. + fn cancel_request(_r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `6998` + // Estimated: `11037` + // Minimum execution time: 90_071_000 picoseconds. + Weight::from_parts(135_516_116, 11037) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::Registrars` (r:1 w:1) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 19]`. + fn set_fee(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `88 + r * (57 ±0)` + // Estimated: `2626` + // Minimum execution time: 7_040_000 picoseconds. + Weight::from_parts(9_447_426, 2626) + // Standard Error: 17_970 + .saturating_add(Weight::from_parts(70_907, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::Registrars` (r:1 w:1) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 19]`. + fn set_account_id(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `88 + r * (57 ±0)` + // Estimated: `2626` + // Minimum execution time: 6_600_000 picoseconds. + Weight::from_parts(8_983_936, 2626) + // Standard Error: 17_024 + .saturating_add(Weight::from_parts(143_428, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::Registrars` (r:1 w:1) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 19]`. + fn set_fields(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `88 + r * (57 ±0)` + // Estimated: `2626` + // Minimum execution time: 6_250_000 picoseconds. + Weight::from_parts(6_922_634, 2626) + // Standard Error: 13_506 + .saturating_add(Weight::from_parts(332_350, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::Registrars` (r:1 w:0) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 19]`. + fn provide_judgement(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `7045 + r * (57 ±0)` + // Estimated: `11037` + // Minimum execution time: 115_601_000 picoseconds. + Weight::from_parts(143_150_259, 11037) + // Standard Error: 232_952 + .saturating_add(Weight::from_parts(569_782, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:0 w:100) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 20]`. + /// The range of component `s` is `[0, 100]`. + fn kill_identity(r: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `7209 + r * (5 ±0) + s * (32 ±0)` + // Estimated: `11037` + // Minimum execution time: 71_021_000 picoseconds. + Weight::from_parts(11_436_639, 11037) + // Standard Error: 316_934 + .saturating_add(Weight::from_parts(2_936_028, 0).saturating_mul(r.into())) + // Standard Error: 61_840 + .saturating_add(Weight::from_parts(2_440_903, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:1 w:1) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 99]`. + fn add_sub(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `474 + s * (36 ±0)` + // Estimated: `11037` + // Minimum execution time: 25_870_000 picoseconds. + Weight::from_parts(25_549_728, 11037) + // Standard Error: 10_500 + .saturating_add(Weight::from_parts(289_615, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:1 w:1) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 100]`. + fn rename_sub(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `590 + s * (3 ±0)` + // Estimated: `11037` + // Minimum execution time: 14_960_000 picoseconds. + Weight::from_parts(21_725_362, 11037) + // Standard Error: 6_155 + .saturating_add(Weight::from_parts(10_420, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:1 w:1) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 100]`. + fn remove_sub(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `637 + s * (35 ±0)` + // Estimated: `11037` + // Minimum execution time: 30_461_000 picoseconds. + Weight::from_parts(38_867_163, 11037) + // Standard Error: 12_608 + .saturating_add(Weight::from_parts(32_403, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Identity::SuperOf` (r:1 w:1) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 99]`. + fn quit_sub(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `666 + s * (37 ±0)` + // Estimated: `6723` + // Minimum execution time: 22_621_000 picoseconds. + Weight::from_parts(25_138_030, 6723) + // Standard Error: 7_726 + .saturating_add(Weight::from_parts(85_145, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Identity::UsernameAuthorities` (r:0 w:1) + /// Proof: `Identity::UsernameAuthorities` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn add_username_authority() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 7_760_000 picoseconds. + Weight::from_parts(9_620_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::UsernameAuthorities` (r:1 w:1) + /// Proof: `Identity::UsernameAuthorities` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn remove_username_authority() -> Weight { + // Proof Size summary in bytes: + // Measured: `79` + // Estimated: `3517` + // Minimum execution time: 16_650_000 picoseconds. + Weight::from_parts(17_501_000, 3517) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::UsernameAuthorities` (r:1 w:1) + /// Proof: `Identity::UsernameAuthorities` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Identity::AccountOfUsername` (r:1 w:1) + /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) + /// Storage: `Identity::PendingUsernames` (r:1 w:0) + /// Proof: `Identity::PendingUsernames` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + fn set_username_for() -> Weight { + // Proof Size summary in bytes: + // Measured: `79` + // Estimated: `11037` + // Minimum execution time: 70_501_000 picoseconds. + Weight::from_parts(97_871_000, 11037) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Identity::PendingUsernames` (r:1 w:1) + /// Proof: `Identity::PendingUsernames` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + /// Storage: `Identity::AccountOfUsername` (r:0 w:1) + /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) + fn accept_username() -> Weight { + // Proof Size summary in bytes: + // Measured: `114` + // Estimated: `11037` + // Minimum execution time: 32_011_000 picoseconds. + Weight::from_parts(33_770_000, 11037) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Identity::PendingUsernames` (r:1 w:1) + /// Proof: `Identity::PendingUsernames` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + fn remove_expired_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `114` + // Estimated: `3550` + // Minimum execution time: 20_070_000 picoseconds. + Weight::from_parts(44_740_000, 3550) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::AccountOfUsername` (r:1 w:0) + /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + fn set_primary_username() -> Weight { + // Proof Size summary in bytes: + // Measured: `256` + // Estimated: `11037` + // Minimum execution time: 25_821_000 picoseconds. + Weight::from_parts(27_841_000, 11037) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Identity::AccountOfUsername` (r:1 w:1) + /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) + fn remove_dangling_username() -> Weight { + // Proof Size summary in bytes: + // Measured: `97` + // Estimated: `11037` + // Minimum execution time: 18_410_000 picoseconds. + Weight::from_parts(19_740_000, 11037) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/lbp.rs b/runtime/basilisk/src/weights/pallet_lbp.rs similarity index 79% rename from runtime/basilisk/src/weights/lbp.rs rename to runtime/basilisk/src/weights/pallet_lbp.rs index 93d87af5c4a..55fe45f4d3b 100644 --- a/runtime/basilisk/src/weights/lbp.rs +++ b/runtime/basilisk/src/weights/pallet_lbp.rs @@ -15,43 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_lbp` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-lbp -// --output=weights-1.1.0/lbp.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_lbp::weights::WeightInfo; +/// Weights for `pallet_lbp`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_lbp` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_lbp::WeightInfo for BasiliskWeight { /// Storage: `LBP::PoolData` (r:1 w:1) /// Proof: `LBP::PoolData` (`max_values`: None, `max_size`: Some(163), added: 2638, mode: `MaxEncodedLen`) /// Storage: `LBP::FeeCollectorWithAsset` (r:1 w:1) @@ -68,10 +73,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn create_pool() -> Weight { // Proof Size summary in bytes: - // Measured: `930` + // Measured: `964` // Estimated: `11322` - // Minimum execution time: 144_594_000 picoseconds. - Weight::from_parts(145_577_000, 11322) + // Minimum execution time: 90_460_000 picoseconds. + Weight::from_parts(92_531_000, 11322) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -81,10 +86,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `LBP::FeeCollectorWithAsset` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) fn update_pool_data() -> Weight { // Proof Size summary in bytes: - // Measured: `351` + // Measured: `384` // Estimated: `3628` - // Minimum execution time: 30_652_000 picoseconds. - Weight::from_parts(31_114_000, 3628) + // Minimum execution time: 18_790_000 picoseconds. + Weight::from_parts(19_280_000, 3628) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -98,10 +103,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn add_liquidity() -> Weight { // Proof Size summary in bytes: - // Measured: `1170` + // Measured: `1204` // Estimated: `11322` - // Minimum execution time: 100_856_000 picoseconds. - Weight::from_parts(101_975_000, 11322) + // Minimum execution time: 66_040_000 picoseconds. + Weight::from_parts(69_420_000, 11322) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -121,10 +126,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `LBP::FeeCollectorWithAsset` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) fn remove_liquidity() -> Weight { // Proof Size summary in bytes: - // Measured: `1359` + // Measured: `1393` // Estimated: `11322` - // Minimum execution time: 133_431_000 picoseconds. - Weight::from_parts(134_355_000, 11322) + // Minimum execution time: 88_031_000 picoseconds. + Weight::from_parts(91_910_000, 11322) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -140,10 +145,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn sell() -> Weight { // Proof Size summary in bytes: - // Measured: `1538` + // Measured: `1572` // Estimated: `13905` - // Minimum execution time: 216_160_000 picoseconds. - Weight::from_parts(218_332_000, 13905) + // Minimum execution time: 150_981_000 picoseconds. + Weight::from_parts(155_692_000, 13905) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -159,10 +164,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn buy() -> Weight { // Proof Size summary in bytes: - // Measured: `1538` + // Measured: `1572` // Estimated: `13905` - // Minimum execution time: 216_459_000 picoseconds. - Weight::from_parts(217_991_000, 13905) + // Minimum execution time: 150_432_000 picoseconds. + Weight::from_parts(153_552_000, 13905) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -178,16 +183,16 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// The range of component `c` is `[1, 2]`. /// The range of component `e` is `[0, 1]`. - fn router_execution_sell(c: u32, e: u32) -> Weight { + fn router_execution_sell(c: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `784 + e * (754 ±0)` - // Estimated: `6156 + e * (7749 ±34_606_984_459_695_172)` - // Minimum execution time: 65_605_000 picoseconds. - Weight::from_parts(66_090_000, 6156) - // Standard Error: 614_731 - .saturating_add(Weight::from_parts(2_364_398, 0).saturating_mul(c.into())) - // Standard Error: 1_349_510 - .saturating_add(Weight::from_parts(158_869_336, 0).saturating_mul(e.into())) + // Measured: `817 + e * (755 ±0)` + // Estimated: `6156 + e * (7749 ±10_308_707_831_848_054)` + // Minimum execution time: 51_181_000 picoseconds. + Weight::from_parts(52_700_000, 6156) + // Standard Error: 133_283 + .saturating_add(Weight::from_parts(847_260, 0).saturating_mul(c.into())) + // Standard Error: 296_860 + .saturating_add(Weight::from_parts(103_508_329, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((9_u64).saturating_mul(e.into()))) .saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(e.into()))) @@ -205,16 +210,16 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// The range of component `c` is `[1, 3]`. /// The range of component `e` is `[0, 1]`. - fn router_execution_buy(c: u32, e: u32) -> Weight { + fn router_execution_buy(c: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `784 + e * (754 ±0)` - // Estimated: `6156 + e * (7749 ±0)` - // Minimum execution time: 116_794_000 picoseconds. - Weight::from_parts(117_321_000, 6156) - // Standard Error: 759_399 - .saturating_add(Weight::from_parts(3_773_334, 0).saturating_mul(c.into())) - // Standard Error: 2_507_585 - .saturating_add(Weight::from_parts(131_536_809, 0).saturating_mul(e.into())) + // Measured: `817 + e * (755 ±0)` + // Estimated: `6156 + e * (7749 ±4_848_321_430_572_248)` + // Minimum execution time: 92_001_000 picoseconds. + Weight::from_parts(93_820_000, 6156) + // Standard Error: 255_692 + .saturating_add(Weight::from_parts(1_913_461, 0).saturating_mul(c.into())) + // Standard Error: 862_277 + .saturating_add(Weight::from_parts(80_689_079, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((9_u64).saturating_mul(e.into()))) .saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(e.into()))) @@ -226,9 +231,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) fn calculate_buy() -> Weight { // Proof Size summary in bytes: - // Measured: `784` + // Measured: `817` // Estimated: `6156` - // Minimum execution time: 65_901_000 picoseconds. - Weight::from_parts(66_148_000, 6156).saturating_add(T::DbWeight::get().reads(3_u64)) + // Minimum execution time: 51_540_000 picoseconds. + Weight::from_parts(52_680_000, 6156) + .saturating_add(T::DbWeight::get().reads(3_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/marketplace.rs b/runtime/basilisk/src/weights/pallet_marketplace.rs similarity index 85% rename from runtime/basilisk/src/weights/marketplace.rs rename to runtime/basilisk/src/weights/pallet_marketplace.rs index 8a45520042b..05af2ecdfac 100644 --- a/runtime/basilisk/src/weights/marketplace.rs +++ b/runtime/basilisk/src/weights/pallet_marketplace.rs @@ -15,43 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_marketplace` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-marketplace -// --output=weights-1.1.0/marketplace.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_marketplace::weights::WeightInfo; +/// Weights for `pallet_marketplace`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_marketplace` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_marketplace::WeightInfo for BasiliskWeight { /// Storage: `Uniques::Asset` (r:1 w:1) /// Proof: `Uniques::Asset` (`max_values`: None, `max_size`: Some(146), added: 2621, mode: `MaxEncodedLen`) /// Storage: `Marketplace::Prices` (r:1 w:1) @@ -76,10 +81,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(113), added: 2588, mode: `MaxEncodedLen`) fn buy() -> Weight { // Proof Size summary in bytes: - // Measured: `2859` + // Measured: `2930` // Estimated: `6156` - // Minimum execution time: 130_029_000 picoseconds. - Weight::from_parts(130_806_000, 6156) + // Minimum execution time: 90_241_000 picoseconds. + Weight::from_parts(91_441_000, 6156) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -89,10 +94,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `Marketplace::Prices` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`) fn set_price() -> Weight { // Proof Size summary in bytes: - // Measured: `1360` + // Measured: `1398` // Estimated: `3611` - // Minimum execution time: 35_699_000 picoseconds. - Weight::from_parts(36_340_000, 3611) + // Minimum execution time: 24_400_000 picoseconds. + Weight::from_parts(25_650_000, 3611) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -108,10 +113,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn make_offer() -> Weight { // Proof Size summary in bytes: - // Measured: `1797` + // Measured: `1868` // Estimated: `4087` - // Minimum execution time: 64_370_000 picoseconds. - Weight::from_parts(65_044_000, 4087) + // Minimum execution time: 43_990_000 picoseconds. + Weight::from_parts(46_031_000, 4087) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -129,10 +134,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn withdraw_offer() -> Weight { // Proof Size summary in bytes: - // Measured: `2288` + // Measured: `2359` // Estimated: `4087` - // Minimum execution time: 65_488_000 picoseconds. - Weight::from_parts(66_451_000, 4087) + // Minimum execution time: 44_501_000 picoseconds. + Weight::from_parts(46_461_000, 4087) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -162,10 +167,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(113), added: 2588, mode: `MaxEncodedLen`) fn accept_offer() -> Weight { // Proof Size summary in bytes: - // Measured: `2929` + // Measured: `3000` // Estimated: `6156` - // Minimum execution time: 158_110_000 picoseconds. - Weight::from_parts(159_121_000, 6156) + // Minimum execution time: 105_641_000 picoseconds. + Weight::from_parts(108_271_000, 6156) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -179,11 +184,11 @@ impl WeightInfo for BasiliskWeight { /// Proof: `AssetRegistry::LocationAssets` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) fn add_royalty() -> Weight { // Proof Size summary in bytes: - // Measured: `1610` + // Measured: `1681` // Estimated: `4087` - // Minimum execution time: 47_308_000 picoseconds. - Weight::from_parts(47_795_000, 4087) + // Minimum execution time: 33_180_000 picoseconds. + Weight::from_parts(34_290_000, 4087) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_message_queue.rs b/runtime/basilisk/src/weights/pallet_message_queue.rs new file mode 100644 index 00000000000..5ed3651c051 --- /dev/null +++ b/runtime/basilisk/src/weights/pallet_message_queue.rs @@ -0,0 +1,183 @@ +// This file is part of Basilisk. + +// Copyright (C) 2020-2023 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_message_queue` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` + +// Executed Command: +// ./target/release/basilisk +// benchmark +// pallet +// --wasm-execution=compiled +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --template=.maintain/pallet-weight-template-no-back.hbs +// --json-file +// raw.json +// --output +// weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weights for `pallet_message_queue`. +pub struct WeightInfo(PhantomData); + +/// Weights for `pallet_message_queue` using the Basilisk node and recommended hardware. +pub struct BasiliskWeight(PhantomData); +impl pallet_message_queue::WeightInfo for BasiliskWeight { + /// Storage: `MessageQueue::ServiceHead` (r:1 w:0) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:2 w:2) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn ready_ring_knit() -> Weight { + // Proof Size summary in bytes: + // Measured: `298` + // Estimated: `6044` + // Minimum execution time: 13_840_000 picoseconds. + Weight::from_parts(19_300_000, 6044) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `MessageQueue::BookStateFor` (r:2 w:2) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + fn ready_ring_unknit() -> Weight { + // Proof Size summary in bytes: + // Measured: `293` + // Estimated: `6044` + // Minimum execution time: 12_280_000 picoseconds. + Weight::from_parts(12_760_000, 6044) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn service_queue_base() -> Weight { + // Proof Size summary in bytes: + // Measured: `80` + // Estimated: `3517` + // Minimum execution time: 8_460_000 picoseconds. + Weight::from_parts(8_981_000, 3517) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(134193), added: 136668, mode: `MaxEncodedLen`) + fn service_page_base_completion() -> Weight { + // Proof Size summary in bytes: + // Measured: `147` + // Estimated: `137658` + // Minimum execution time: 10_870_000 picoseconds. + Weight::from_parts(11_650_000, 137658) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(134193), added: 136668, mode: `MaxEncodedLen`) + fn service_page_base_no_completion() -> Weight { + // Proof Size summary in bytes: + // Measured: `147` + // Estimated: `137658` + // Minimum execution time: 8_730_000 picoseconds. + Weight::from_parts(12_420_000, 137658) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `MessageQueue::BookStateFor` (r:0 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:0 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(134193), added: 136668, mode: `MaxEncodedLen`) + fn service_page_item() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 258_302_000 picoseconds. + Weight::from_parts(377_824_000, 0) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:0) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn bump_service_head() -> Weight { + // Proof Size summary in bytes: + // Measured: `246` + // Estimated: `3517` + // Minimum execution time: 10_930_000 picoseconds. + Weight::from_parts(11_660_000, 3517) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(134193), added: 136668, mode: `MaxEncodedLen`) + fn reap_page() -> Weight { + // Proof Size summary in bytes: + // Measured: `134349` + // Estimated: `137658` + // Minimum execution time: 115_211_000 picoseconds. + Weight::from_parts(144_261_000, 137658) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(134193), added: 136668, mode: `MaxEncodedLen`) + fn execute_overweight_page_removed() -> Weight { + // Proof Size summary in bytes: + // Measured: `134349` + // Estimated: `137658` + // Minimum execution time: 116_461_000 picoseconds. + Weight::from_parts(236_392_000, 137658) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::Pages` (r:1 w:1) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(134193), added: 136668, mode: `MaxEncodedLen`) + fn execute_overweight_page_updated() -> Weight { + // Proof Size summary in bytes: + // Measured: `134349` + // Estimated: `137658` + // Minimum execution time: 181_681_000 picoseconds. + Weight::from_parts(330_363_000, 137658) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/nft.rs b/runtime/basilisk/src/weights/pallet_nft.rs similarity index 83% rename from runtime/basilisk/src/weights/nft.rs rename to runtime/basilisk/src/weights/pallet_nft.rs index faad1ca806d..5e2d4a5612f 100644 --- a/runtime/basilisk/src/weights/nft.rs +++ b/runtime/basilisk/src/weights/pallet_nft.rs @@ -15,47 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_nft` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-nft -// --output=weights-1.1.0/nft.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_nft::weights::WeightInfo; +/// Weights for `pallet_nft`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_nft` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -//This consts are here to make `create_collection()` and `mint()` more expensive. -const CREATE_COLLECTION_OFFSET: u64 = 180 * 2; -const MINT_OFFSET: u64 = 140 * 2; - -impl WeightInfo for BasiliskWeight { +impl pallet_nft::WeightInfo for BasiliskWeight { /// Storage: `Uniques::Class` (r:1 w:1) /// Proof: `Uniques::Class` (`max_values`: None, `max_size`: Some(190), added: 2665, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::NextAssetId` (r:1 w:0) @@ -68,11 +69,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `NFT::Collections` (`max_values`: None, `max_size`: Some(99), added: 2574, mode: `MaxEncodedLen`) fn create_collection() -> Weight { // Proof Size summary in bytes: - // Measured: `467` + // Measured: `500` // Estimated: `4087` - // Minimum execution time: 36_542_000 picoseconds. - Weight::from_parts(36_999_000, 4087) - .saturating_mul(CREATE_COLLECTION_OFFSET) + // Minimum execution time: 22_190_000 picoseconds. + Weight::from_parts(22_880_000, 4087) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -94,11 +94,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `NFT::Items` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`) fn mint() -> Weight { // Proof Size summary in bytes: - // Measured: `903` + // Measured: `936` // Estimated: `4087` - // Minimum execution time: 58_112_000 picoseconds. - Weight::from_parts(58_800_000, 4087) - .saturating_mul(MINT_OFFSET) + // Minimum execution time: 39_131_000 picoseconds. + Weight::from_parts(39_891_000, 4087) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -116,8 +115,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `873` // Estimated: `3655` - // Minimum execution time: 53_329_000 picoseconds. - Weight::from_parts(54_155_000, 3655) + // Minimum execution time: 35_711_000 picoseconds. + Weight::from_parts(36_860_000, 3655) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -139,10 +138,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `Uniques::CollectionMaxSupply` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) fn destroy_collection() -> Weight { // Proof Size summary in bytes: - // Measured: `945` + // Measured: `978` // Estimated: `4087` - // Minimum execution time: 67_374_000 picoseconds. - Weight::from_parts(68_041_000, 4087) + // Minimum execution time: 44_930_000 picoseconds. + Weight::from_parts(46_200_000, 4087) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -164,11 +163,11 @@ impl WeightInfo for BasiliskWeight { /// Proof: `NFT::Items` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`) fn burn() -> Weight { // Proof Size summary in bytes: - // Measured: `1108` + // Measured: `1141` // Estimated: `4087` - // Minimum execution time: 57_449_000 picoseconds. - Weight::from_parts(58_046_000, 4087) + // Minimum execution time: 38_370_000 picoseconds. + Weight::from_parts(39_591_000, 4087) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/route_executor.rs b/runtime/basilisk/src/weights/pallet_route_executor.rs similarity index 75% rename from runtime/basilisk/src/weights/route_executor.rs rename to runtime/basilisk/src/weights/pallet_route_executor.rs index 192a4a77c0d..074d20854f6 100644 --- a/runtime/basilisk/src/weights/route_executor.rs +++ b/runtime/basilisk/src/weights/pallet_route_executor.rs @@ -15,43 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_route_executor` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-07, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-route-executor -// --output=weights-1.1.0/route_executor.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_route_executor::weights::WeightInfo; +/// Weights for `pallet_route_executor`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_route_executor` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_route_executor::WeightInfo for BasiliskWeight { /// Storage: `LBP::PoolData` (r:1 w:0) /// Proof: `LBP::PoolData` (`max_values`: None, `max_size`: Some(163), added: 2638, mode: `MaxEncodedLen`) /// Storage: `Tokens::Accounts` (r:5 w:5) @@ -63,14 +68,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `AssetRegistry::Assets` (r:2 w:0) /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) /// The range of component `c` is `[0, 1]`. - fn calculate_and_execute_sell_in_lbp(c: u32) -> Weight { + fn calculate_and_execute_sell_in_lbp(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2792` + // Measured: `2826` // Estimated: `13905` - // Minimum execution time: 311_089_000 picoseconds. - Weight::from_parts(313_538_367, 13905) - // Standard Error: 135_932 - .saturating_add(Weight::from_parts(51_727_507, 0).saturating_mul(c.into())) + // Minimum execution time: 223_582_000 picoseconds. + Weight::from_parts(237_153_622, 13905) + // Standard Error: 1_455_589 + .saturating_add(Weight::from_parts(40_711_777, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -86,16 +91,16 @@ impl WeightInfo for BasiliskWeight { /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) /// The range of component `c` is `[1, 2]`. /// The range of component `b` is `[0, 1]`. - fn calculate_and_execute_buy_in_lbp(c: u32, b: u32) -> Weight { + fn calculate_and_execute_buy_in_lbp(c: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1534 + b * (1274 ±0)` - // Estimated: `6156 + b * (7749 ±99_524_913_928_918_768)` - // Minimum execution time: 73_124_000 picoseconds. - Weight::from_parts(73_641_000, 6156) - // Standard Error: 603_015 - .saturating_add(Weight::from_parts(2_335_052, 0).saturating_mul(c.into())) - // Standard Error: 1_323_790 - .saturating_add(Weight::from_parts(245_212_503, 0).saturating_mul(b.into())) + // Measured: `1567 + b * (1275 ±0)` + // Estimated: `6156 + b * (7749 ±0)` + // Minimum execution time: 56_551_000 picoseconds. + Weight::from_parts(57_780_000, 6156) + // Standard Error: 161_147 + .saturating_add(Weight::from_parts(961_389, 0).saturating_mul(c.into())) + // Standard Error: 358_921 + .saturating_add(Weight::from_parts(175_218_965, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((9_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(b.into()))) @@ -121,10 +126,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) fn set_route_for_xyk() -> Weight { // Proof Size summary in bytes: - // Measured: `4396` + // Measured: `4429` // Estimated: `31986` - // Minimum execution time: 1_640_100_000 picoseconds. - Weight::from_parts(1_648_958_000, 31986) + // Minimum execution time: 1_181_351_000 picoseconds. + Weight::from_parts(1_203_741_000, 31986) .saturating_add(T::DbWeight::get().reads(34_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -132,4 +137,4 @@ impl WeightInfo for BasiliskWeight { fn force_insert_route() -> Weight { todo!() } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/scheduler.rs b/runtime/basilisk/src/weights/pallet_scheduler.rs similarity index 62% rename from runtime/basilisk/src/weights/scheduler.rs rename to runtime/basilisk/src/weights/pallet_scheduler.rs index 2b11409240a..9b253b87a7a 100644 --- a/runtime/basilisk/src/weights/scheduler.rs +++ b/runtime/basilisk/src/weights/pallet_scheduler.rs @@ -15,65 +15,70 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_scheduler` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-scheduler -// --output=weights-1.1.0/scheduler.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_scheduler::weights::WeightInfo; +/// Weights for `pallet_scheduler`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_scheduler` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_scheduler::WeightInfo for BasiliskWeight { /// Storage: `Scheduler::IncompleteSince` (r:1 w:1) /// Proof: `Scheduler::IncompleteSince` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) fn service_agendas_base() -> Weight { // Proof Size summary in bytes: // Measured: `31` // Estimated: `1489` - // Minimum execution time: 4_587_000 picoseconds. - Weight::from_parts(4_667_000, 1489) + // Minimum execution time: 2_590_000 picoseconds. + Weight::from_parts(2_700_000, 1489) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Scheduler::Agenda` (r:1 w:1) /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) /// The range of component `s` is `[0, 50]`. - fn service_agenda_base(s: u32) -> Weight { + fn service_agenda_base(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `78 + s * (177 ±0)` // Estimated: `42428` - // Minimum execution time: 4_573_000 picoseconds. - Weight::from_parts(7_765_796, 42428) - // Standard Error: 6_034 - .saturating_add(Weight::from_parts(919_183, 0).saturating_mul(s.into())) + // Minimum execution time: 3_530_000 picoseconds. + Weight::from_parts(6_024_408, 42428) + // Standard Error: 2_720 + .saturating_add(Weight::from_parts(439_995, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -81,23 +86,25 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_192_000 picoseconds. - Weight::from_parts(8_344_000, 0) + // Minimum execution time: 3_440_000 picoseconds. + Weight::from_parts(3_560_000, 0) } /// Storage: `Preimage::PreimageFor` (r:1 w:1) /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) - /// Storage: `Preimage::StatusFor` (r:1 w:1) + /// Storage: `Preimage::StatusFor` (r:1 w:0) /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) /// The range of component `s` is `[128, 4194304]`. - fn service_task_fetched(s: u32) -> Weight { + fn service_task_fetched(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `246 + s * (1 ±0)` - // Estimated: `3709 + s * (1 ±0)` - // Minimum execution time: 27_177_000 picoseconds. - Weight::from_parts(27_454_000, 3709) - // Standard Error: 4 - .saturating_add(Weight::from_parts(1_161, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Estimated: `3711 + s * (1 ±0)` + // Minimum execution time: 17_790_000 picoseconds. + Weight::from_parts(18_050_000, 3711) + // Standard Error: 1 + .saturating_add(Weight::from_parts(761, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(s.into())) } @@ -107,41 +114,42 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_288_000 picoseconds. - Weight::from_parts(10_607_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 5_180_000 picoseconds. + Weight::from_parts(5_370_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) } fn service_task_periodic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_217_000 picoseconds. - Weight::from_parts(8_355_000, 0) + // Minimum execution time: 3_430_000 picoseconds. + Weight::from_parts(3_580_000, 0) } fn execute_dispatch_signed() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_572_000 picoseconds. - Weight::from_parts(4_670_000, 0) + // Minimum execution time: 2_820_000 picoseconds. + Weight::from_parts(2_951_000, 0) } fn execute_dispatch_unsigned() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_400_000 picoseconds. - Weight::from_parts(4_513_000, 0) + // Minimum execution time: 2_670_000 picoseconds. + Weight::from_parts(2_870_000, 0) } /// Storage: `Scheduler::Agenda` (r:1 w:1) /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) /// The range of component `s` is `[0, 49]`. - fn schedule(s: u32) -> Weight { + fn schedule(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `78 + s * (177 ±0)` // Estimated: `42428` - // Minimum execution time: 18_375_000 picoseconds. - Weight::from_parts(21_573_549, 42428) - // Standard Error: 5_764 - .saturating_add(Weight::from_parts(922_228, 0).saturating_mul(s.into())) + // Minimum execution time: 10_750_000 picoseconds. + Weight::from_parts(13_150_807, 42428) + // Standard Error: 2_791 + .saturating_add(Weight::from_parts(469_412, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -150,14 +158,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `Scheduler::Lookup` (r:0 w:1) /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) /// The range of component `s` is `[1, 50]`. - fn cancel(s: u32) -> Weight { + fn cancel(s: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `78 + s * (177 ±0)` // Estimated: `42428` - // Minimum execution time: 24_061_000 picoseconds. - Weight::from_parts(22_976_505, 42428) - // Standard Error: 1_824 - .saturating_add(Weight::from_parts(1_634_940, 0).saturating_mul(s.into())) + // Minimum execution time: 14_860_000 picoseconds. + Weight::from_parts(13_136_918, 42428) + // Standard Error: 3_751 + .saturating_add(Weight::from_parts(722_052, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -166,14 +174,14 @@ impl WeightInfo for BasiliskWeight { /// Storage: `Scheduler::Agenda` (r:1 w:1) /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) /// The range of component `s` is `[0, 49]`. - fn schedule_named(s: u32) -> Weight { + fn schedule_named(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `192 + s * (187 ±0)` + // Measured: `255 + s * (185 ±0)` // Estimated: `42428` - // Minimum execution time: 22_951_000 picoseconds. - Weight::from_parts(26_389_660, 42428) - // Standard Error: 6_664 - .saturating_add(Weight::from_parts(980_392, 0).saturating_mul(s.into())) + // Minimum execution time: 14_030_000 picoseconds. + Weight::from_parts(17_768_924, 42428) + // Standard Error: 4_126 + .saturating_add(Weight::from_parts(482_578, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -182,15 +190,15 @@ impl WeightInfo for BasiliskWeight { /// Storage: `Scheduler::Agenda` (r:1 w:1) /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) /// The range of component `s` is `[1, 50]`. - fn cancel_named(s: u32) -> Weight { + fn cancel_named(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `263 + s * (186 ±0)` + // Measured: `281 + s * (185 ±0)` // Estimated: `42428` - // Minimum execution time: 26_389_000 picoseconds. - Weight::from_parts(25_843_381, 42428) - // Standard Error: 2_318 - .saturating_add(Weight::from_parts(1_657_000, 0).saturating_mul(s.into())) + // Minimum execution time: 16_900_000 picoseconds. + Weight::from_parts(15_864_942, 42428) + // Standard Error: 3_468 + .saturating_add(Weight::from_parts(739_611, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/timestamp.rs b/runtime/basilisk/src/weights/pallet_timestamp.rs similarity index 61% rename from runtime/basilisk/src/weights/timestamp.rs rename to runtime/basilisk/src/weights/pallet_timestamp.rs index e8c4a958256..4523a0c1fb5 100644 --- a/runtime/basilisk/src/weights/timestamp.rs +++ b/runtime/basilisk/src/weights/pallet_timestamp.rs @@ -15,51 +15,56 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_timestamp` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-timestamp -// --output=weights-1.1.0/timestamp.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_timestamp::weights::WeightInfo; +/// Weights for `pallet_timestamp`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_timestamp` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_timestamp::WeightInfo for BasiliskWeight { /// Storage: `Timestamp::Now` (r:1 w:1) /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) fn set() -> Weight { // Proof Size summary in bytes: // Measured: `42` // Estimated: `1493` - // Minimum execution time: 10_265_000 picoseconds. - Weight::from_parts(10_513_000, 1493) + // Minimum execution time: 5_870_000 picoseconds. + Weight::from_parts(6_220_000, 1493) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -67,7 +72,7 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `94` // Estimated: `0` - // Minimum execution time: 5_546_000 picoseconds. - Weight::from_parts(5_705_000, 0) + // Minimum execution time: 3_920_000 picoseconds. + Weight::from_parts(4_220_000, 0) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/tips.rs b/runtime/basilisk/src/weights/pallet_tips.rs similarity index 72% rename from runtime/basilisk/src/weights/tips.rs rename to runtime/basilisk/src/weights/pallet_tips.rs index ba5009ec661..f114af830b5 100644 --- a/runtime/basilisk/src/weights/tips.rs +++ b/runtime/basilisk/src/weights/pallet_tips.rs @@ -18,38 +18,45 @@ //! Autogenerated weights for `pallet_tips` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-02-26, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-tips -// --output=weights-1.1.0/tips.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use core::marker::PhantomData; -use pallet_tips::WeightInfo; + +/// Weights for `pallet_tips`. +pub struct WeightInfo(PhantomData); /// Weights for `pallet_tips` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); -impl WeightInfo for BasiliskWeight { +impl pallet_tips::WeightInfo for BasiliskWeight { /// Storage: `Tips::Reasons` (r:1 w:1) /// Proof: `Tips::Reasons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Tips::Tips` (r:1 w:1) @@ -59,10 +66,10 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `3` // Estimated: `3468` - // Minimum execution time: 39_914_000 picoseconds. - Weight::from_parts(40_759_457, 3468) - // Standard Error: 51 - .saturating_add(Weight::from_parts(1_534, 0).saturating_mul(r.into())) + // Minimum execution time: 25_590_000 picoseconds. + Weight::from_parts(26_538_856, 3468) + // Standard Error: 66 + .saturating_add(Weight::from_parts(1_565, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -74,8 +81,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `220` // Estimated: `3685` - // Minimum execution time: 37_195_000 picoseconds. - Weight::from_parts(37_632_000, 3685) + // Minimum execution time: 24_900_000 picoseconds. + Weight::from_parts(25_470_000, 3685) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -91,12 +98,12 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `238 + t * (64 ±0)` // Estimated: `3703 + t * (64 ±0)` - // Minimum execution time: 26_974_000 picoseconds. - Weight::from_parts(26_937_982, 3703) - // Standard Error: 37 - .saturating_add(Weight::from_parts(1_790, 0).saturating_mul(r.into())) - // Standard Error: 6_024 - .saturating_add(Weight::from_parts(97_556, 0).saturating_mul(t.into())) + // Minimum execution time: 17_180_000 picoseconds. + Weight::from_parts(17_986_609, 3703) + // Standard Error: 76 + .saturating_add(Weight::from_parts(1_017, 0).saturating_mul(r.into())) + // Standard Error: 11_903 + .saturating_add(Weight::from_parts(23_479, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 64).saturating_mul(t.into())) @@ -110,10 +117,10 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `459 + t * (112 ±0)` // Estimated: `3924 + t * (112 ±0)` - // Minimum execution time: 21_124_000 picoseconds. - Weight::from_parts(21_367_368, 3924) - // Standard Error: 5_283 - .saturating_add(Weight::from_parts(197_604, 0).saturating_mul(t.into())) + // Minimum execution time: 14_120_000 picoseconds. + Weight::from_parts(14_906_539, 3924) + // Standard Error: 4_734 + .saturating_add(Weight::from_parts(79_677, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 112).saturating_mul(t.into())) @@ -130,26 +137,28 @@ impl WeightInfo for BasiliskWeight { fn close_tip(t: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `459 + t * (112 ±0)` - // Estimated: `3956 + t * (108 ±0)` - // Minimum execution time: 80_021_000 picoseconds. - Weight::from_parts(81_286_488, 3956) - // Standard Error: 19_506 - .saturating_add(Weight::from_parts(63_273, 0).saturating_mul(t.into())) + // Estimated: `3959 + t * (107 ±0)` + // Minimum execution time: 53_530_000 picoseconds. + Weight::from_parts(56_297_054, 3959) + // Standard Error: 20_348 + .saturating_add(Weight::from_parts(48_923, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 108).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 107).saturating_mul(t.into())) } /// Storage: `Tips::Tips` (r:1 w:1) /// Proof: `Tips::Tips` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Tips::Reasons` (r:0 w:1) /// Proof: `Tips::Reasons` (`max_values`: None, `max_size`: None, mode: `Measured`) /// The range of component `t` is `[1, 7]`. - fn slash_tip(_t: u32, ) -> Weight { + fn slash_tip(t: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `268` // Estimated: `3733` - // Minimum execution time: 20_188_000 picoseconds. - Weight::from_parts(20_632_387, 3733) + // Minimum execution time: 12_050_000 picoseconds. + Weight::from_parts(12_827_372, 3733) + // Standard Error: 5_321 + .saturating_add(Weight::from_parts(23_869, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } diff --git a/runtime/basilisk/src/weights/payment.rs b/runtime/basilisk/src/weights/pallet_transaction_multi_payment.rs similarity index 71% rename from runtime/basilisk/src/weights/payment.rs rename to runtime/basilisk/src/weights/pallet_transaction_multi_payment.rs index ad0a6112f7e..209f420b63c 100644 --- a/runtime/basilisk/src/weights/payment.rs +++ b/runtime/basilisk/src/weights/pallet_transaction_multi_payment.rs @@ -15,51 +15,56 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_transaction_multi_payment` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-transaction-multi-payment -// --output=weights-1.1.0/payment.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_transaction_multi_payment::weights::WeightInfo; +/// Weights for `pallet_transaction_multi_payment`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_transaction_multi_payment` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_transaction_multi_payment::WeightInfo for BasiliskWeight { /// Storage: `MultiTransactionPayment::AcceptedCurrencies` (r:1 w:1) /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn add_currency() -> Weight { // Proof Size summary in bytes: // Measured: `1131` // Estimated: `3493` - // Minimum execution time: 25_024_000 picoseconds. - Weight::from_parts(25_413_000, 3493) + // Minimum execution time: 30_270_000 picoseconds. + Weight::from_parts(35_271_000, 3493) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -69,8 +74,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `1162` // Estimated: `3493` - // Minimum execution time: 25_032_000 picoseconds. - Weight::from_parts(25_501_000, 3493) + // Minimum execution time: 17_730_000 picoseconds. + Weight::from_parts(18_460_000, 3493) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -82,8 +87,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `1196` // Estimated: `3493` - // Minimum execution time: 30_094_000 picoseconds. - Weight::from_parts(30_402_000, 3493) + // Minimum execution time: 21_290_000 picoseconds. + Weight::from_parts(21_760_000, 3493) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -95,11 +100,12 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `3346` // Estimated: `27510` - // Minimum execution time: 96_786_000 picoseconds. - Weight::from_parts(97_647_000, 27510).saturating_add(T::DbWeight::get().reads(11_u64)) + // Minimum execution time: 79_881_000 picoseconds. + Weight::from_parts(83_091_000, 27510) + .saturating_add(T::DbWeight::get().reads(11_u64)) } fn reset_payment_currency() -> Weight { todo!() } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/transaction_pause.rs b/runtime/basilisk/src/weights/pallet_transaction_pause.rs similarity index 64% rename from runtime/basilisk/src/weights/transaction_pause.rs rename to runtime/basilisk/src/weights/pallet_transaction_pause.rs index 2925a268914..742c0a2cb12 100644 --- a/runtime/basilisk/src/weights/transaction_pause.rs +++ b/runtime/basilisk/src/weights/pallet_transaction_pause.rs @@ -15,51 +15,56 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_transaction_pause` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-transaction-pause -// --output=weights-1.1.0/transaction_pause.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_transaction_pause::weights::WeightInfo; +/// Weights for `pallet_transaction_pause`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_transaction_pause` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_transaction_pause::WeightInfo for BasiliskWeight { /// Storage: `TransactionPause::PausedTransactions` (r:1 w:1) /// Proof: `TransactionPause::PausedTransactions` (`max_values`: None, `max_size`: Some(90), added: 2565, mode: `MaxEncodedLen`) fn pause_transaction() -> Weight { // Proof Size summary in bytes: - // Measured: `147` + // Measured: `109` // Estimated: `3555` - // Minimum execution time: 16_518_000 picoseconds. - Weight::from_parts(17_068_000, 3555) + // Minimum execution time: 9_360_000 picoseconds. + Weight::from_parts(9_601_000, 3555) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -67,11 +72,11 @@ impl WeightInfo for BasiliskWeight { /// Proof: `TransactionPause::PausedTransactions` (`max_values`: None, `max_size`: Some(90), added: 2565, mode: `MaxEncodedLen`) fn unpause_transaction() -> Weight { // Proof Size summary in bytes: - // Measured: `198` + // Measured: `160` // Estimated: `3555` - // Minimum execution time: 18_239_000 picoseconds. - Weight::from_parts(18_522_000, 3555) + // Minimum execution time: 10_460_000 picoseconds. + Weight::from_parts(10_780_000, 3555) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_treasury.rs b/runtime/basilisk/src/weights/pallet_treasury.rs new file mode 100644 index 00000000000..c1dd9560c08 --- /dev/null +++ b/runtime/basilisk/src/weights/pallet_treasury.rs @@ -0,0 +1,201 @@ +// This file is part of Basilisk. + +// Copyright (C) 2020-2023 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_treasury` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` + +// Executed Command: +// ./target/release/basilisk +// benchmark +// pallet +// --wasm-execution=compiled +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --template=.maintain/pallet-weight-template-no-back.hbs +// --json-file +// raw.json +// --output +// weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weights for `pallet_treasury`. +pub struct WeightInfo(PhantomData); + +/// Weights for `pallet_treasury` using the Basilisk node and recommended hardware. +pub struct BasiliskWeight(PhantomData); +impl pallet_treasury::WeightInfo for BasiliskWeight { + /// Storage: `Treasury::ProposalCount` (r:1 w:1) + /// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Approvals` (r:1 w:1) + /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Proposals` (r:0 w:1) + /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) + fn spend_local() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `1887` + // Minimum execution time: 11_460_000 picoseconds. + Weight::from_parts(11_890_000, 1887) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Treasury::ProposalCount` (r:1 w:1) + /// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Proposals` (r:0 w:1) + /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) + fn propose_spend() -> Weight { + // Proof Size summary in bytes: + // Measured: `210` + // Estimated: `1489` + // Minimum execution time: 23_720_000 picoseconds. + Weight::from_parts(24_571_000, 1489) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Treasury::Proposals` (r:1 w:1) + /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn reject_proposal() -> Weight { + // Proof Size summary in bytes: + // Measured: `368` + // Estimated: `3593` + // Minimum execution time: 33_980_000 picoseconds. + Weight::from_parts(35_130_000, 3593) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Treasury::Proposals` (r:1 w:0) + /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Approvals` (r:1 w:1) + /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + /// The range of component `p` is `[0, 99]`. + fn approve_proposal(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `537 + p * (8 ±0)` + // Estimated: `3573` + // Minimum execution time: 8_950_000 picoseconds. + Weight::from_parts(11_766_225, 3573) + // Standard Error: 1_201 + .saturating_add(Weight::from_parts(47_533, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Treasury::Approvals` (r:1 w:1) + /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + fn remove_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `194` + // Estimated: `1887` + // Minimum execution time: 6_850_000 picoseconds. + Weight::from_parts(7_100_000, 1887) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Treasury::Deactivated` (r:1 w:1) + /// Proof: `Treasury::Deactivated` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Balances::InactiveIssuance` (r:1 w:1) + /// Proof: `Balances::InactiveIssuance` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Approvals` (r:1 w:1) + /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Proposals` (r:99 w:99) + /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:198 w:198) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `p` is `[0, 99]`. + fn on_initialize_proposals(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `44 + p * (250 ±0)` + // Estimated: `1887 + p * (5206 ±0)` + // Minimum execution time: 17_031_000 picoseconds. + Weight::from_parts(12_036_751, 1887) + // Standard Error: 26_772 + .saturating_add(Weight::from_parts(33_070_250, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(p.into()))) + .saturating_add(Weight::from_parts(0, 5206).saturating_mul(p.into())) + } + /// Storage: `Treasury::SpendCount` (r:1 w:1) + /// Proof: `Treasury::SpendCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Treasury::Spends` (r:0 w:1) + /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn spend() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `1489` + // Minimum execution time: 10_380_000 picoseconds. + Weight::from_parts(11_140_000, 1489) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Treasury::Spends` (r:1 w:1) + /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn payout() -> Weight { + // Proof Size summary in bytes: + // Measured: `227` + // Estimated: `3593` + // Minimum execution time: 48_070_000 picoseconds. + Weight::from_parts(49_191_000, 3593) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Treasury::Spends` (r:1 w:1) + /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn check_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `227` + // Estimated: `3534` + // Minimum execution time: 11_950_000 picoseconds. + Weight::from_parts(12_290_000, 3534) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Treasury::Spends` (r:1 w:1) + /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn void_spend() -> Weight { + // Proof Size summary in bytes: + // Measured: `227` + // Estimated: `3534` + // Minimum execution time: 10_790_000 picoseconds. + Weight::from_parts(11_160_000, 3534) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/utility.rs b/runtime/basilisk/src/weights/pallet_utility.rs similarity index 52% rename from runtime/basilisk/src/weights/utility.rs rename to runtime/basilisk/src/weights/pallet_utility.rs index f2485d2f988..f09e7d966c3 100644 --- a/runtime/basilisk/src/weights/utility.rs +++ b/runtime/basilisk/src/weights/pallet_utility.rs @@ -15,85 +15,90 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_utility` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-utility -// --output=weights-1.1.0/utility.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_utility::weights::WeightInfo; +/// Weights for `pallet_utility`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_utility` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_utility::WeightInfo for BasiliskWeight { /// The range of component `c` is `[0, 1000]`. - fn batch(c: u32) -> Weight { + fn batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_682_000 picoseconds. - Weight::from_parts(11_477_983, 0) - // Standard Error: 8_381 - .saturating_add(Weight::from_parts(6_924_986, 0).saturating_mul(c.into())) + // Minimum execution time: 5_110_000 picoseconds. + Weight::from_parts(13_801_786, 0) + // Standard Error: 4_068 + .saturating_add(Weight::from_parts(3_451_079, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_012_000 picoseconds. - Weight::from_parts(8_236_000, 0) + // Minimum execution time: 5_080_000 picoseconds. + Weight::from_parts(5_290_000, 0) } /// The range of component `c` is `[0, 1000]`. - fn batch_all(c: u32) -> Weight { + fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_691_000 picoseconds. - Weight::from_parts(17_408_249, 0) - // Standard Error: 5_637 - .saturating_add(Weight::from_parts(7_299_736, 0).saturating_mul(c.into())) + // Minimum execution time: 5_070_000 picoseconds. + Weight::from_parts(3_220_873, 0) + // Standard Error: 3_696 + .saturating_add(Weight::from_parts(3_725_556, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 13_764_000 picoseconds. - Weight::from_parts(14_038_000, 0) + // Minimum execution time: 7_620_000 picoseconds. + Weight::from_parts(7_841_000, 0) } /// The range of component `c` is `[0, 1000]`. - fn force_batch(c: u32) -> Weight { + fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_754_000 picoseconds. - Weight::from_parts(8_816_518, 0) - // Standard Error: 4_938 - .saturating_add(Weight::from_parts(6_883_918, 0).saturating_mul(c.into())) + // Minimum execution time: 5_240_000 picoseconds. + Weight::from_parts(5_470_000, 0) + // Standard Error: 2_496 + .saturating_add(Weight::from_parts(3_499_415, 0).saturating_mul(c.into())) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/xyk_liquidity_mining.rs b/runtime/basilisk/src/weights/pallet_xyk_liquidity_mining.rs similarity index 89% rename from runtime/basilisk/src/weights/xyk_liquidity_mining.rs rename to runtime/basilisk/src/weights/pallet_xyk_liquidity_mining.rs index 761251e72f8..2e4ccf7ba1b 100644 --- a/runtime/basilisk/src/weights/xyk_liquidity_mining.rs +++ b/runtime/basilisk/src/weights/pallet_xyk_liquidity_mining.rs @@ -15,43 +15,48 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_xyk_liquidity_mining` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-xyk-liquidity-mining -// --output=weights-1.1.0/xyk_liquidity_mining.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_xyk_liquidity_mining::weights::WeightInfo; +/// Weights for `pallet_xyk_liquidity_mining`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_xyk_liquidity_mining` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_xyk_liquidity_mining::WeightInfo for BasiliskWeight { /// Storage: `AssetRegistry::Assets` (r:1 w:0) /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:2 w:2) @@ -64,10 +69,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `XYKWarehouseLM::GlobalFarm` (`max_values`: None, `max_size`: Some(205), added: 2680, mode: `MaxEncodedLen`) fn create_global_farm() -> Weight { // Proof Size summary in bytes: - // Measured: `473` + // Measured: `506` // Estimated: `6196` - // Minimum execution time: 96_296_000 picoseconds. - Weight::from_parts(97_159_000, 6196) + // Minimum execution time: 61_440_000 picoseconds. + Weight::from_parts(62_870_000, 6196) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -79,10 +84,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn update_global_farm() -> Weight { // Proof Size summary in bytes: - // Measured: `879` + // Measured: `912` // Estimated: `6196` - // Minimum execution time: 100_686_000 picoseconds. - Weight::from_parts(101_525_000, 6196) + // Minimum execution time: 65_421_000 picoseconds. + Weight::from_parts(68_121_000, 6196) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -96,8 +101,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `1002` // Estimated: `6196` - // Minimum execution time: 97_204_000 picoseconds. - Weight::from_parts(97_998_000, 6196) + // Minimum execution time: 66_030_000 picoseconds. + Weight::from_parts(68_460_000, 6196) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -117,10 +122,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `XYKWarehouseLM::YieldFarm` (`max_values`: None, `max_size`: Some(226), added: 2701, mode: `MaxEncodedLen`) fn create_yield_farm() -> Weight { // Proof Size summary in bytes: - // Measured: `1213` + // Measured: `1246` // Estimated: `6196` - // Minimum execution time: 125_043_000 picoseconds. - Weight::from_parts(126_608_000, 6196) + // Minimum execution time: 83_390_000 picoseconds. + Weight::from_parts(85_850_000, 6196) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -138,10 +143,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn update_yield_farm() -> Weight { // Proof Size summary in bytes: - // Measured: `1361` + // Measured: `1394` // Estimated: `6196` - // Minimum execution time: 132_512_000 picoseconds. - Weight::from_parts(133_771_000, 6196) + // Minimum execution time: 86_861_000 picoseconds. + Weight::from_parts(90_321_000, 6196) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -157,10 +162,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn stop_yield_farm() -> Weight { // Proof Size summary in bytes: - // Measured: `1195` + // Measured: `1228` // Estimated: `6196` - // Minimum execution time: 127_486_000 picoseconds. - Weight::from_parts(128_704_000, 6196) + // Minimum execution time: 82_601_000 picoseconds. + Weight::from_parts(84_770_000, 6196) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -176,8 +181,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `904` // Estimated: `6196` - // Minimum execution time: 102_124_000 picoseconds. - Weight::from_parts(102_690_000, 6196) + // Minimum execution time: 69_931_000 picoseconds. + Weight::from_parts(71_261_000, 6196) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -221,10 +226,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `XYKWarehouseLM::Deposit` (`max_values`: None, `max_size`: Some(413), added: 2888, mode: `MaxEncodedLen`) fn deposit_shares() -> Weight { // Proof Size summary in bytes: - // Measured: `3236` + // Measured: `3259` // Estimated: `11402` - // Minimum execution time: 262_054_000 picoseconds. - Weight::from_parts(265_093_000, 11402) + // Minimum execution time: 176_811_000 picoseconds. + Weight::from_parts(183_301_000, 11402) .saturating_add(T::DbWeight::get().reads(22_u64)) .saturating_add(T::DbWeight::get().writes(13_u64)) } @@ -250,8 +255,8 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `2363` // Estimated: `3878` - // Minimum execution time: 82_532_000 picoseconds. - Weight::from_parts(83_433_000, 3878) + // Minimum execution time: 60_040_000 picoseconds. + Weight::from_parts(62_021_000, 3878) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -269,10 +274,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn claim_rewards() -> Weight { // Proof Size summary in bytes: - // Measured: `2097` + // Measured: `2130` // Estimated: `8799` - // Minimum execution time: 181_069_000 picoseconds. - Weight::from_parts(182_671_000, 8799) + // Minimum execution time: 122_691_000 picoseconds. + Weight::from_parts(128_671_000, 8799) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -312,10 +317,10 @@ impl WeightInfo for BasiliskWeight { /// Proof: `NFT::Items` (`max_values`: None, `max_size`: Some(122), added: 2597, mode: `MaxEncodedLen`) fn withdraw_shares() -> Weight { // Proof Size summary in bytes: - // Measured: `2928` + // Measured: `2951` // Estimated: `11402` - // Minimum execution time: 388_459_000 picoseconds. - Weight::from_parts(391_305_000, 11402) + // Minimum execution time: 266_432_000 picoseconds. + Weight::from_parts(273_772_000, 11402) .saturating_add(T::DbWeight::get().reads(19_u64)) .saturating_add(T::DbWeight::get().writes(15_u64)) } @@ -333,11 +338,11 @@ impl WeightInfo for BasiliskWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn resume_yield_farm() -> Weight { // Proof Size summary in bytes: - // Measured: `1469` + // Measured: `1502` // Estimated: `6196` - // Minimum execution time: 127_081_000 picoseconds. - Weight::from_parts(128_240_000, 6196) + // Minimum execution time: 87_741_000 picoseconds. + Weight::from_parts(89_331_000, 6196) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/treasury.rs b/runtime/basilisk/src/weights/treasury.rs deleted file mode 100644 index 7ec59b05d09..00000000000 --- a/runtime/basilisk/src/weights/treasury.rs +++ /dev/null @@ -1,156 +0,0 @@ -// This file is part of Basilisk. - -// Copyright (C) 2020-2023 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_treasury` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` - -// Executed Command: -// target/release/basilisk -// benchmark -// pallet -// --chain=dev -// --steps=10 -// --repeat=30 -// --wasm-execution=compiled -// --heap-pages=4096 -// --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-treasury -// --output=weights-1.1.0/treasury.rs -// --extrinsic=* - -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] - -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; - -use pallet_treasury::weights::WeightInfo; - -pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { - fn spend() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 386_000 picoseconds. - Weight::from_parts(414_000, 0) - } - /// Storage: `Treasury::ProposalCount` (r:1 w:1) - /// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `Treasury::Proposals` (r:0 w:1) - /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) - fn propose_spend() -> Weight { - // Proof Size summary in bytes: - // Measured: `210` - // Estimated: `1489` - // Minimum execution time: 37_957_000 picoseconds. - Weight::from_parts(38_297_000, 1489) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// Storage: `Treasury::Proposals` (r:1 w:1) - /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn reject_proposal() -> Weight { - // Proof Size summary in bytes: - // Measured: `368` - // Estimated: `3593` - // Minimum execution time: 55_324_000 picoseconds. - Weight::from_parts(55_652_000, 3593) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// Storage: `Treasury::Proposals` (r:1 w:0) - /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) - /// Storage: `Treasury::Approvals` (r:1 w:1) - /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) - /// The range of component `p` is `[0, 99]`. - fn approve_proposal(p: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `571 + p * (7 ±0)` - // Estimated: `3573` - // Minimum execution time: 14_071_000 picoseconds. - Weight::from_parts(17_014_032, 3573) - // Standard Error: 2_942 - .saturating_add(Weight::from_parts(35_852, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: `Treasury::Approvals` (r:1 w:1) - /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) - fn remove_approval() -> Weight { - // Proof Size summary in bytes: - // Measured: `194` - // Estimated: `1887` - // Minimum execution time: 10_612_000 picoseconds. - Weight::from_parts(10_968_000, 1887) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: `Treasury::Deactivated` (r:1 w:1) - /// Proof: `Treasury::Deactivated` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// Storage: `Balances::InactiveIssuance` (r:1 w:1) - /// Proof: `Balances::InactiveIssuance` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// Storage: `Treasury::Approvals` (r:1 w:1) - /// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) - /// Storage: `Treasury::Proposals` (r:100 w:100) - /// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:200 w:200) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// The range of component `p` is `[0, 100]`. - fn on_initialize_proposals(p: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `43 + p * (250 ±0)` - // Estimated: `1887 + p * (5206 ±0)` - // Minimum execution time: 37_755_000 picoseconds. - Weight::from_parts(42_881_231, 1887) - // Standard Error: 38_744 - .saturating_add(Weight::from_parts(51_567_452, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(p.into()))) - .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(p.into()))) - .saturating_add(Weight::from_parts(0, 5206).saturating_mul(p.into())) - } - - fn spend_local() -> Weight { - todo!() - } - - fn payout() -> Weight { - todo!() - } - - fn check_status() -> Weight { - todo!() - } - - fn void_spend() -> Weight { - todo!() - } -} diff --git a/runtime/basilisk/src/weights/xcmp_queue.rs b/runtime/basilisk/src/weights/xcmp_queue.rs deleted file mode 100644 index d8dfd5a52ee..00000000000 --- a/runtime/basilisk/src/weights/xcmp_queue.rs +++ /dev/null @@ -1,96 +0,0 @@ -// This file is part of Basilisk. - -// Copyright (C) 2020-2023 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 `cumulus_pallet_xcmp_queue` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` - -// Executed Command: -// target/release/basilisk -// benchmark -// pallet -// --chain=dev -// --steps=10 -// --repeat=30 -// --wasm-execution=compiled -// --heap-pages=4096 -// --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=cumulus-pallet-xcmp-queue -// --output=weights-1.1.0/xcmp_queue.rs -// --extrinsic=* - -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] - -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; - -use cumulus_pallet_xcmp_queue::weights::WeightInfo; - -pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { - /// Storage: `XcmpQueue::QueueConfig` (r:1 w:1) - /// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn set_config_with_u32() -> Weight { - // Proof Size summary in bytes: - // Measured: `109` - // Estimated: `1594` - // Minimum execution time: 8_755_000 picoseconds. - Weight::from_parts(8_941_000, 1594) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - - fn enqueue_xcmp_message() -> Weight { - //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT - Weight::from_parts(9999999, 9999) - } - - fn suspend_channel() -> Weight { - //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT - Weight::from_parts(9999999, 9999) - } - - fn resume_channel() -> Weight { - //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT - Weight::from_parts(9999999, 9999) - } - - fn take_first_concatenated_xcm() -> Weight { - //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT - Weight::from_parts(9999999, 9999) - } - - fn on_idle_good_msg() -> Weight { - //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT - Weight::from_parts(9999999, 9999) - } - - fn on_idle_large_msg() -> Weight { - //TODO:THIS WEIGHT IS ADDED FOR TESTING PURPOSES, ADD PROPER WEIGHT - Weight::from_parts(9999999, 9999) - } -} diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index 09a6e3b0683..16524c185c0 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -206,7 +206,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = MajorityTechCommitteeOrRoot; type ControllerOriginConverter = XcmOriginToCallOrigin; type PriceForSiblingDelivery = polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery; - type WeightInfo = weights::xcmp_queue::BasiliskWeight; + type WeightInfo = weights::cumulus_pallet_xcmp_queue::BasiliskWeight; type XcmpQueue = TransformOrigin; type MaxInboundSuspended = MaxInboundSuspended; } @@ -275,7 +275,7 @@ impl pallet_xcm::Config for Runtime { type TrustedLockers = (); type SovereignAccountOf = (); type MaxLockers = ConstU32<8>; - type WeightInfo = weights::xcm::BasiliskWeight; + type WeightInfo = weights::xcm::BasiliskWeight; //TODO: add benchmarks type AdminOrigin = SuperMajorityTechCommitteeOrRoot; type MaxRemoteLockConsumers = ConstU32<0>; type RemoteLockConsumerIdentifier = (); @@ -310,7 +310,11 @@ parameter_types! { impl pallet_message_queue::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_message_queue::BasiliskWeight; + #[cfg(feature = "runtime-benchmarks")] + type MessageProcessor = + pallet_message_queue::mock_helpers::NoopMessageProcessor; + #[cfg(not(feature = "runtime-benchmarks"))] type MessageProcessor = xcm_builder::ProcessXcmMessage, RuntimeCall>; type Size = u32; type QueueChangeHandler = NarrowOriginToSibling; diff --git a/scripts/benchmark.all.sh b/scripts/benchmark.all.sh deleted file mode 100644 index 764b66e1cca..00000000000 --- a/scripts/benchmark.all.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -pallets=("pallet-xyk:xyk" -"pallet-lbp:lbp" -"pallet-nft:nft" -"pallet-asset-registry:asset_registry" -"pallet-xyk-liquidity-mining:xyk_liquidity_mining" -"pallet-transaction-pause:transaction_pause" -"frame-system:system" -"pallet-balances:balances" -"pallet-collator-selection:collator_selection" -"pallet-timestamp:timestamp" -"pallet-democracy:democracy" -"pallet-treasury:treasury" -"pallet-scheduler:scheduler" -"pallet-utility:utility" -"pallet-tips:tips" -"pallet-xcm:xcm" -"cumulus-pallet-xcmp-queue:xcmp_queue" -"pallet-currencies:currencies" -"orml-tokens:tokens" -"orml-vesting:vesting" -"pallet-duster:duster" -"pallet-transaction-multi-payment:payment" -"pallet-route-executor:route_executor" -"pallet-marketplace:marketplace" -) - -command="cargo run --release --features=runtime-benchmarks -- benchmark pallet --pallet=[pallet] --chain=dev --extrinsic='*' --steps=5 --repeat=20 --output [output].rs --template .maintain/pallet-weight-template-no-back.hbs" - -for string in "${pallets[@]}"; do - - IFS=':' read -ra subvalues <<< "$string" - - pallet="${subvalues[0]}" - output="${subvalues[1]}" - - echo "Running benchmark for ${pallet}" - - replaced_command="${command/\[pallet\]/$pallet}" - replaced_command="${replaced_command/\[output\]/$output}" - - eval "$replaced_command" -done diff --git a/scripts/benchmarking.sh b/scripts/benchmarking.sh new file mode 100644 index 00000000000..2ecebff845d --- /dev/null +++ b/scripts/benchmarking.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash +# Created by Moonbeam/Purestake Developers. Shamelessly copied from Moonbeam's benchmarking script +# Original repository: https://github.com/moonbeam-foundation/moonbeam + +# This script can be used for running Basilisk's benchmarks. +# +# The basilisk binary is required to be compiled with --features=runtime-benchmarks +# in release mode. + +set -e + +BINARY="./target/release/basilisk" +STEPS=50 +REPEAT=20 + +if [[ ! -f "${BINARY}" ]]; then + echo "binary '${BINARY}' does not exist." + echo "ensure that the basilisk binary is compiled with '--features=runtime-benchmarks' and in release mode." + exit 1 +fi + +function help { + echo "USAGE:" + echo " ${0} [ ] [--check]" + echo "" + echo "EXAMPLES:" + echo " ${0} " "list all benchmarks and provide a selection to choose from" + echo " ${0} --check " "list all benchmarks and provide a selection to choose from, runs in 'check' mode (reduced steps and repetitions)" + echo " ${0} foo bar " "run a benchmark for pallet 'foo' and benchmark 'bar'" + echo " ${0} foo bar --check " "run a benchmark for pallet 'foo' and benchmark 'bar' in 'check' mode (reduced steps and repetitions)" + echo " ${0} foo bar --all " "run a benchmark for all pallets" + echo " ${0} foo bar --all --check " "run a benchmark for all pallets in 'check' mode (reduced steps and repetitions)" +} + +function choose_and_bench { + readarray -t options < <(${BINARY} benchmark pallet --list | sed 1d) + options+=('EXIT') + + select opt in "${options[@]}"; do + IFS=', ' read -ra parts <<< "${opt}" + [[ "${opt}" == 'EXIT' ]] && exit 0 + + bench "${parts[0]}" "${parts[1]}" "${1}" + break + done +} + +function bench { + OUTPUT=${4:-weights.rs} + echo "benchmarking '${1}::${2}' --check=${3}, writing results to '${OUTPUT}'" + + # Check enabled + if [[ "${3}" -eq 1 ]]; then + STEPS=16 + REPEAT=1 + fi + + WASMTIME_BACKTRACE_DETAILS=1 ${BINARY} benchmark pallet \ + --wasm-execution=compiled \ + --pallet "${1}" \ + --extrinsic "${2}" \ + --steps "${STEPS}" \ + --repeat "${REPEAT}" \ + --template=.maintain/pallet-weight-template-no-back.hbs \ + --json-file raw.json \ + --output "${OUTPUT}" +} + +if [[ "${@}" =~ "--help" ]]; then + help +else + CHECK=0 + if [[ "${@}" =~ "--check" ]]; then + CHECK=1 + set -o noglob && set -- ${@/'--check'} && set +o noglob + fi + + ALL=0 + if [[ "${@}" =~ "--all" ]]; then + ALL=1 + fi + + if [[ "${ALL}" -eq 1 ]]; then + mkdir -p weights/ + bench '*' '*' "${CHECK}" "weights/" + elif [[ $# -ne 2 ]]; then + choose_and_bench "${CHECK}" + else + bench "${1}" "${2}" "${CHECK}" + fi +fi \ No newline at end of file From dc9ef818358a7304af6876cb29d9dd1d47c963ba Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Wed, 24 Apr 2024 18:33:22 +0200 Subject: [PATCH 23/56] use define benchmakrs --- runtime/basilisk/src/lib.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index cbdc96dd46c..3369ad852d0 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -519,6 +519,7 @@ impl_runtime_apis! { let params = (&config, &whitelist); // Basilisk pallets + /* //add_benchmark!(params, batches, pallet_xyk, XYK); add_benchmark!(params, batches, pallet_lbp, LBP); add_benchmark!(params, batches, pallet_nft, NFT); @@ -547,6 +548,8 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_message_queue, MessageQueue); //add_benchmark!(params, batches, pallet_xcm, PolkadotXcm); + */ + orml_add_benchmark!(params, batches, pallet_currencies, benchmarking::currencies); orml_add_benchmark!(params, batches, orml_tokens, benchmarking::tokens); orml_add_benchmark!(params, batches, orml_vesting, benchmarking::vesting); @@ -561,6 +564,33 @@ impl_runtime_apis! { } } +#[cfg(feature = "runtime-benchmarks")] +mod benches { + frame_benchmarking::define_benchmarks!( + [pallet_lbp, LBP] + [pallet_nft, NFT] + [pallet_asset_registry, AssetRegistry] + [allet_xyk_liquidity_mining, XYKLiquidityMiningBench::] + [pallet_transaction_pause, TransactionPause] + [pallet_ema_oracle, EmaOracle] + [frame_system, SystemBench::] + [pallet_balances, Balances] + [pallet_timestamp, Timestamp] + [pallet_democracy, Democracy] + [pallet_elections_phragmen, Elections] + [pallet_treasury, Treasury] + [pallet_scheduler, Scheduler] + [pallet_utility, Utility] + [pallet_tips, Tips] + [pallet_identity, Identity] + [pallet_collective, TechnicalCommittee] + [cumulus_pallet_xcmp_queue, XcmpQueue] + [pallet_message_queue, MessageQueue] + //[pallet_preimage, Preimage] + //[pallet_multisig, Multisig] + ); +} + struct CheckInherents; impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { From a7d079d16548cca90516983c53917b5a8dfc86d3 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 10:18:07 +0200 Subject: [PATCH 24/56] add xyk benchmarks --- runtime/basilisk/src/benchmarking/mod.rs | 1 + runtime/basilisk/src/benchmarking/xyk.rs | 286 +++++++++++++++++++++++ runtime/basilisk/src/lib.rs | 68 +----- 3 files changed, 295 insertions(+), 60 deletions(-) create mode 100644 runtime/basilisk/src/benchmarking/xyk.rs diff --git a/runtime/basilisk/src/benchmarking/mod.rs b/runtime/basilisk/src/benchmarking/mod.rs index cecb6a1a3de..e4fe75d5442 100644 --- a/runtime/basilisk/src/benchmarking/mod.rs +++ b/runtime/basilisk/src/benchmarking/mod.rs @@ -8,6 +8,7 @@ pub mod multi_payment; pub mod route_executor; pub mod tokens; pub mod vesting; +pub mod xyk; pub use helper::BenchmarkHelper; diff --git a/runtime/basilisk/src/benchmarking/xyk.rs b/runtime/basilisk/src/benchmarking/xyk.rs new file mode 100644 index 00000000000..aef3a014072 --- /dev/null +++ b/runtime/basilisk/src/benchmarking/xyk.rs @@ -0,0 +1,286 @@ +use crate::{AccountId, AssetId, Balance, Currencies, MultiTransactionPayment, Price, Runtime, RuntimeOrigin, XYK}; + +use super::*; + +use frame_benchmarking::{account, BenchmarkError}; +use frame_system::RawOrigin; +use orml_benchmarking::runtime_benchmarks; +use orml_traits::{MultiCurrency, MultiCurrencyExtended}; +use sp_std::prelude::*; + +use hydradx_traits::router::{PoolType, TradeExecution}; + +const SEED: u32 = 1; + +const INITIAL_BALANCE: Balance = 1_000_000_000_000_000; + +fn funded_account(name: &'static str, index: u32, assets: &[AssetId]) -> T::AccountId { + let caller: T::AccountId = account(name, index, SEED); + //Necessary for ED for insufficient assets. + T::Currency::update_balance(0, &caller, INITIAL_BALANCE as i128).unwrap(); + + for a in assets { + T::Currency::update_balance(*a, &caller, INITIAL_BALANCE as i128).unwrap(); + } + + caller +} + +#[allow(clippy::result_large_err)] +fn init_fee_asset(fee_asset: AssetId) -> Result<(), BenchmarkError> { + MultiTransactionPayment::add_currency(RawOrigin::Root.into(), fee_asset, Price::from(1)) + .map_err(|_| BenchmarkError::Stop("Failed to add fee asset as supported currency"))?; + + pallet_transaction_multi_payment::pallet::AcceptedCurrencyPrice::::insert(fee_asset, Price::from(1)); + + Ok(()) +} + +runtime_benchmarks! { + { Runtime, pallet_xyk } + + create_pool { + let asset_a = register_asset(b"TKNA".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_b = register_asset(b"TKNB".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let fee_asset = register_asset(b"FEE".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + + let caller = funded_account::("caller", 0, &[asset_a, asset_b, fee_asset]); + + init_fee_asset(fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(caller.clone()).into(), fee_asset)?; + + let amount_a : Balance = INITIAL_BALANCE; + let amount_b : Balance = INITIAL_BALANCE; + + assert_eq!(frame_system::Pallet::::account(caller.clone()).sufficients, 0); + }: _(RawOrigin::Signed(caller.clone()), asset_a, amount_a, asset_b, amount_b) + verify { + assert_eq!(Currencies::free_balance(asset_a, &caller), 0); + assert_eq!(Currencies::free_balance(asset_b, &caller), 0); + + assert!(!orml_tokens::Accounts::::contains_key(caller.clone(), asset_a)); + assert!(!orml_tokens::Accounts::::contains_key(caller.clone(), asset_b)); + + //NOTE: xyk shares are insufficinet so that's why not 0. + assert_eq!(frame_system::Pallet::::account(caller).sufficients, 0); + } + + add_liquidity { + + let asset_a = register_asset(b"TKNA".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_b = register_asset(b"TKNB".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let fee_asset = register_asset(b"FEE".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + + let caller = funded_account::("caller", 0, &[asset_a, asset_b, fee_asset]); + let maker = funded_account::("maker", 1, &[asset_a, asset_b, fee_asset]); + + init_fee_asset(fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(maker.clone()).into(), fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(caller.clone()).into(), fee_asset)?; + + let amount_a : Balance = INITIAL_BALANCE; + let amount_b : Balance = INITIAL_BALANCE; + + let amount : Balance = INITIAL_BALANCE/2; + let max_limit : Balance = INITIAL_BALANCE; + + + XYK::create_pool(RawOrigin::Signed(maker.clone()).into(), asset_a, INITIAL_BALANCE - 10, asset_b, INITIAL_BALANCE - 10)?; + + >::transfer(asset_a, &caller, &maker, INITIAL_BALANCE - amount)?; + + assert_eq!(frame_system::Pallet::::account(caller.clone()).sufficients, 0); + }: _(RawOrigin::Signed(caller.clone()), asset_a, asset_b, amount, max_limit) + verify { + assert_eq!(Currencies::free_balance(asset_a, &caller), 0); + assert_eq!(Currencies::free_balance(asset_b, &caller), 499_999_999_999_999_u128);// Due to rounding in favor of pool + + //NOTE: xyk shares are insufficinet. + assert_eq!(frame_system::Pallet::::account(caller).sufficients, 0); + } + + remove_liquidity { + + let asset_a = register_asset(b"TKNA".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_b = register_asset(b"TKNB".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let fee_asset = register_asset(b"FEE".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + + let maker = funded_account::("maker", 0, &[asset_a, asset_b, fee_asset]); + + + init_fee_asset(fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(maker.clone()).into(), fee_asset)?; + + XYK::create_pool(RawOrigin::Signed(maker.clone()).into(), asset_a, INITIAL_BALANCE, asset_b, INITIAL_BALANCE)?; + + //Only for XYK shares + assert_eq!(frame_system::Pallet::::account(maker.clone()).sufficients, 0); + }: _(RawOrigin::Signed(maker.clone()), asset_a, asset_b, INITIAL_BALANCE) + verify { + assert_eq!(Currencies::free_balance(asset_a, &maker), INITIAL_BALANCE); + assert_eq!(Currencies::free_balance(asset_b, &maker), INITIAL_BALANCE); + + assert_eq!(frame_system::Pallet::::account(maker).sufficients, 0); + } + + sell { + let asset_a = register_asset(b"TKNA".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_b = register_asset(b"TKNB".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let fee_asset = register_asset(b"FEE".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + + let maker = funded_account::("maker", 0, &[asset_a, asset_b, fee_asset]); + let caller = funded_account::("caller", 1, &[asset_a, fee_asset]); + + + init_fee_asset(fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(maker.clone()).into(), fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(caller.clone()).into(), fee_asset)?; + + let discount = false; + let amount: Balance = 250_000_000_000_000; + let min_bought: Balance = 1; + + XYK::create_pool(RawOrigin::Signed(maker.clone()).into(), asset_a, INITIAL_BALANCE, asset_b, INITIAL_BALANCE)?; + + >::transfer(asset_a, &caller, &maker, INITIAL_BALANCE - amount)?; + + assert_eq!(frame_system::Pallet::::account(caller.clone()).sufficients, 0); + }: _(RawOrigin::Signed(caller.clone()), asset_a, asset_b, amount, min_bought, discount) + verify{ + assert_eq!(Currencies::free_balance(asset_a, &caller), 0); + assert_eq!(Currencies::free_balance(asset_b, &caller), 199400000000000); + + //NOTE: `asset_a`'s ED was released `asset_b`'s ED was collected. + assert_eq!(frame_system::Pallet::::account(caller).sufficients, 0); + } + + buy { + let asset_a = register_asset(b"TKNA".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_b = register_asset(b"TKNB".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let fee_asset = register_asset(b"FEE".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + + let maker = funded_account::("maker", 0, &[asset_a, asset_b, fee_asset]); + let caller = funded_account::("caller", 1, &[asset_a, fee_asset]); + + + init_fee_asset(fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(maker.clone()).into(), fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(caller.clone()).into(), fee_asset)?; + + let discount = false; + let amount: Balance = 200_000_000_000_000; + let max_sold: Balance = INITIAL_BALANCE; + + XYK::create_pool(RawOrigin::Signed(maker.clone()).into(), asset_a, INITIAL_BALANCE, asset_b, INITIAL_BALANCE)?; + + >::transfer(asset_a, &caller, &maker, 749_249_999_999_999_u128)?; + + assert_eq!(frame_system::Pallet::::account(caller.clone()).sufficients, 0); + }: _(RawOrigin::Signed(caller.clone()), asset_b, asset_a, amount, max_sold, discount) + verify{ + assert_eq!(Currencies::free_balance(asset_a, &caller), 0); + assert_eq!(Currencies::free_balance(asset_b, &caller), amount); + + assert_eq!(frame_system::Pallet::::account(caller).sufficients, 0); + } + + router_execution_sell { + let c in 1..2; // if c == 1, calculate_sell is executed + let e in 0..1; // if e == 1, execute_sell is executed + + let asset_a = register_asset(b"TKNA".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_b = register_asset(b"TKNB".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + + let fee_asset = register_asset(b"FEE".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + + let maker = funded_account::("maker", 0, &[asset_a, asset_b, fee_asset]); + let caller = funded_account::("caller", 1, &[asset_a, fee_asset]); + + + init_fee_asset(fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(maker.clone()).into(), fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(caller.clone()).into(), fee_asset)?; + + let discount = false; + let amount: Balance = 250_000_000_000_000; + let min_bought: Balance = 1; + + XYK::create_pool(RawOrigin::Signed(maker.clone()).into(), asset_a, INITIAL_BALANCE, asset_b, INITIAL_BALANCE)?; + + >::transfer(asset_a, &caller, &maker, INITIAL_BALANCE - amount)?; + assert_eq!(frame_system::Pallet::::account(caller.clone()).sufficients, 0); + }: { + for _ in 1..c { + assert!(>::calculate_sell(PoolType::XYK, asset_a, asset_b, amount).is_ok()); + } + if e != 0 { + assert!(>::execute_sell(RawOrigin::Signed(caller.clone()).into(), PoolType::XYK, asset_a, asset_b, amount, min_bought).is_ok()); + } + } + verify{ + if e != 0 { + assert_eq!(Currencies::free_balance(asset_a, &caller), 0); + assert_eq!(Currencies::free_balance(asset_b, &caller), 199400000000000); + + assert_eq!(frame_system::Pallet::::account(caller).sufficients, 0); + } + } + + router_execution_buy { + let c in 1..3; // number of times calculate_buy is executed + let e in 0..1; // if e == 1, execute_buy is executed + + let asset_a = register_asset(b"TKNA".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let asset_b = register_asset(b"TKNB".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + let fee_asset = register_asset(b"FEE".to_vec(), 1u128).map_err(|_| BenchmarkError::Stop("Failed to register asset"))?; + + let maker = funded_account::("maker", 0, &[asset_a, asset_b, fee_asset]); + let caller = funded_account::("caller", 1, &[asset_a, fee_asset]); + + + init_fee_asset(fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(maker.clone()).into(), fee_asset)?; + MultiTransactionPayment::set_currency(RawOrigin::Signed(caller.clone()).into(), fee_asset)?; + + let discount = false; + let amount: Balance = 200_000_000_000_000; + let max_sold: Balance = INITIAL_BALANCE; + + XYK::create_pool(RawOrigin::Signed(maker.clone()).into(), asset_a, INITIAL_BALANCE, asset_b, INITIAL_BALANCE)?; + + >::transfer(asset_a, &caller, &maker, 749_249_999_999_999_u128)?; + + assert_eq!(frame_system::Pallet::::account(caller.clone()).sufficients, 0); + }: { + for _ in 1..c { + assert!(>::calculate_buy(PoolType::XYK, asset_a, asset_b, amount).is_ok()); + } + if e != 0 { + assert!(>::execute_buy(RawOrigin::Signed(caller.clone()).into(), PoolType::XYK, asset_a, asset_b, amount, max_sold).is_ok()); + } + } + verify{ + if e != 0 { + assert_eq!(Currencies::free_balance(asset_a, &caller), 0); + assert_eq!(Currencies::free_balance(asset_b, &caller), amount); + + assert_eq!(frame_system::Pallet::::account(caller).sufficients, 0); + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use orml_benchmarking::impl_benchmark_test_suite; + use sp_runtime::BuildStorage; + + fn new_test_ext() -> sp_io::TestExternalities { + frame_system::GenesisConfig::::default() + .build_storage() + .unwrap() + .into() + } + + impl_benchmark_test_suite!(new_test_ext(),); +} diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 3369ad852d0..7473e82334e 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -434,44 +434,17 @@ impl_runtime_apis! { use pallet_xyk_liquidity_mining_benchmarking::Pallet as XYKLiquidityMiningBench; let mut list = Vec::::new(); + list_benchmarks!(list, extra); // Mising: XYK, uniques, primage, proxy, cumulus parachain system , collator selection, session, multisig, state trie, palle-xcm - - //list_benchmark!(list, extra, pallet_xyk, XYK); - list_benchmark!(list, extra, pallet_lbp, LBP); - list_benchmark!(list, extra, pallet_nft, NFT); - list_benchmark!(list, extra, pallet_asset_registry, AssetRegistry); - list_benchmark!(list, extra, pallet_xyk_liquidity_mining, XYKLiquidityMiningBench::); - list_benchmark!(list, extra, pallet_transaction_pause, TransactionPause); - list_benchmark!(list, extra, pallet_ema_oracle, EmaOracle); - - list_benchmark!(list, extra, frame_system, SystemBench::); - list_benchmark!(list, extra, pallet_balances, Balances); - //list_benchmark!(list, extra, pallet_collator_selection, CollatorSelection); - list_benchmark!(list, extra, pallet_timestamp, Timestamp); - list_benchmark!(list, extra, pallet_democracy, Democracy); - list_benchmark!(list, extra, pallet_elections_phragmen, Elections); - list_benchmark!(list, extra, pallet_treasury, Treasury); - list_benchmark!(list, extra, pallet_scheduler, Scheduler); - list_benchmark!(list, extra, pallet_utility, Utility); - list_benchmark!(list, extra, pallet_tips, Tips); - list_benchmark!(list, extra, pallet_identity, Identity); - list_benchmark!(list, extra, pallet_collective, TechnicalCommittee); - //list_benchmark!(list, extra, pallet_state_trie_migration, StateTrieMigration); - //list_benchmark!(list, extra, pallet_preimage, Preimage); - - list_benchmark!(list, extra, cumulus_pallet_xcmp_queue, XcmpQueue); - list_benchmark!(list, extra, pallet_message_queue, MessageQueue); - //list_benchmark!(list, extra, pallet_xcm, PolkadotXcm); - orml_list_benchmark!(list, extra, pallet_currencies, benchmarking::currencies); + orml_list_benchmark!(list, extra, pallet_xyk, benchmarking::xyk); orml_list_benchmark!(list, extra, orml_tokens, benchmarking::tokens); orml_list_benchmark!(list, extra, orml_vesting, benchmarking::vesting); orml_list_benchmark!(list, extra, pallet_duster, benchmarking::duster); orml_list_benchmark!(list, extra, pallet_transaction_multi_payment, benchmarking::multi_payment); orml_list_benchmark!(list, extra, pallet_route_executor, benchmarking::route_executor); orml_list_benchmark!(list, extra, pallet_marketplace, benchmarking::marketplace); - let storage_info = AllPalletsWithSystem::storage_info(); (list, storage_info) @@ -517,39 +490,10 @@ impl_runtime_apis! { let mut batches = Vec::::new(); let params = (&config, &whitelist); + add_benchmarks!(params, batches); // Basilisk pallets - /* - //add_benchmark!(params, batches, pallet_xyk, XYK); - add_benchmark!(params, batches, pallet_lbp, LBP); - add_benchmark!(params, batches, pallet_nft, NFT); - add_benchmark!(params, batches, pallet_asset_registry, AssetRegistry); - add_benchmark!(params, batches, pallet_xyk_liquidity_mining, XYKLiquidityMiningBench::); - add_benchmark!(params, batches, pallet_transaction_pause, TransactionPause); - add_benchmark!(params, batches, pallet_ema_oracle, EmaOracle); - - // Substrate pallets - add_benchmark!(params, batches, frame_system, SystemBench::); - add_benchmark!(params, batches, pallet_balances, Balances); - //add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection); - add_benchmark!(params, batches, pallet_timestamp, Timestamp); - add_benchmark!(params, batches, pallet_democracy, Democracy); - add_benchmark!(params, batches, pallet_elections_phragmen, Elections); - add_benchmark!(params, batches, pallet_treasury, Treasury); - add_benchmark!(params, batches, pallet_scheduler, Scheduler); - add_benchmark!(params, batches, pallet_utility, Utility); - add_benchmark!(params, batches, pallet_tips, Tips); - add_benchmark!(params, batches, pallet_identity, Identity); - add_benchmark!(params, batches, pallet_collective, TechnicalCommittee); - //add_benchmark!(params, batches, pallet_state_trie_migration, StateTrieMigration); - //add_benchmark!(params, batches, pallet_preimage, Preimage); - - add_benchmark!(params, batches, cumulus_pallet_xcmp_queue, XcmpQueue); - add_benchmark!(params, batches, pallet_message_queue, MessageQueue); - //add_benchmark!(params, batches, pallet_xcm, PolkadotXcm); - - */ - + orml_add_benchmark!(params, batches, pallet_xyk, benchmarking::xyk); orml_add_benchmark!(params, batches, pallet_currencies, benchmarking::currencies); orml_add_benchmark!(params, batches, orml_tokens, benchmarking::tokens); orml_add_benchmark!(params, batches, orml_vesting, benchmarking::vesting); @@ -564,6 +508,10 @@ impl_runtime_apis! { } } +#[cfg(feature = "runtime-benchmarks")] +#[macro_use] +extern crate orml_benchmarking; + #[cfg(feature = "runtime-benchmarks")] mod benches { frame_benchmarking::define_benchmarks!( From f10b03c82ac6771668ebd3f560e9ca1f088f3204 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 11:13:26 +0200 Subject: [PATCH 25/56] add additional benchmarks --- runtime/basilisk/Cargo.toml | 2 ++ runtime/basilisk/src/lib.rs | 51 ++++++++++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/runtime/basilisk/Cargo.toml b/runtime/basilisk/Cargo.toml index acc5165c4f8..dbead241d78 100644 --- a/runtime/basilisk/Cargo.toml +++ b/runtime/basilisk/Cargo.toml @@ -155,6 +155,7 @@ runtime-benchmarks = [ "pallet-tips/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", "pallet-xyk-liquidity-mining-benchmarking/runtime-benchmarks", "pallet-uniques/runtime-benchmarks", "orml-benchmarking", @@ -165,6 +166,7 @@ runtime-benchmarks = [ "pallet-elections-phragmen/runtime-benchmarks", "pallet-state-trie-migration/runtime-benchmarks", "pallet-message-queue/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", ] std = [ "codec/std", diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 7473e82334e..6bc96b1b810 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -432,11 +432,12 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; use pallet_xyk_liquidity_mining_benchmarking::Pallet as XYKLiquidityMiningBench; + use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsiscsBenchmark; let mut list = Vec::::new(); list_benchmarks!(list, extra); - // Mising: XYK, uniques, primage, proxy, cumulus parachain system , collator selection, session, multisig, state trie, palle-xcm + // Mising: collator selection, state trie, palle-xcm orml_list_benchmark!(list, extra, pallet_currencies, benchmarking::currencies); orml_list_benchmark!(list, extra, pallet_xyk, benchmarking::xyk); orml_list_benchmark!(list, extra, orml_tokens, benchmarking::tokens); @@ -460,6 +461,7 @@ impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; use pallet_xyk_liquidity_mining_benchmarking::Pallet as XYKLiquidityMiningBench; + use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsiscsBenchmark; impl frame_system_benchmarking::Config for Runtime { fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { @@ -471,6 +473,46 @@ impl_runtime_apis! { System::assert_last_event(cumulus_pallet_parachain_system::Event::::ValidationFunctionStored.into()); } } + + parameter_types! { + pub const RandomParaId: ParaId = ParaId::new(22222222); + pub const ExistentialDeposit: u128= 0; + } + + use cumulus_primitives_core::ParaId; + use polkadot_xcm::latest::prelude::{ + GeneralIndex, Junction, Junctions, Location, Response, NetworkId, AssetId, + Assets as XcmAssets, Fungible, Asset, ParentThen, Parachain, Parent + }; + + impl pallet_xcm::benchmarking::Config for Runtime { + fn reachable_dest() -> Option { + Some(Parent.into()) + } + + fn teleportable_asset_and_dest() -> Option<(Asset, Location)> { + // Relay/native token can be teleported between AH and Relay. + Some(( + Asset { + fun: Fungible(ExistentialDeposit::get()), + id: AssetId(Parent.into()) + }, + Parent.into(), + )) + } + + fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> { + Some(( + Asset { + fun: Fungible(ExistentialDeposit::get()), + id: AssetId(Parent.into()) + }, + // AH can reserve transfer native token to some random parachain. + ParentThen(Parachain(RandomParaId::get().into()).into()).into(), + )) + } + } + impl pallet_xyk_liquidity_mining_benchmarking::Config for Runtime {} let whitelist: Vec = vec![ @@ -534,8 +576,11 @@ mod benches { [pallet_collective, TechnicalCommittee] [cumulus_pallet_xcmp_queue, XcmpQueue] [pallet_message_queue, MessageQueue] - //[pallet_preimage, Preimage] - //[pallet_multisig, Multisig] + [pallet_preimage, Preimage] + [pallet_multisig, Multisig] + [pallet_proxy, Proxy] + [cumulus_pallet_parachain_system, ParachainSystem] + //[pallet_xcm, PalletXcmExtrinsiscsBenchmark::] ); } From 6db66b12d69fae71cbefc3594f18bc330fef5ec0 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 12:20:36 +0200 Subject: [PATCH 26/56] update benchmark script --- scripts/benchmarking.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/benchmarking.sh b/scripts/benchmarking.sh index 2ecebff845d..4eb77d5bb4a 100644 --- a/scripts/benchmarking.sh +++ b/scripts/benchmarking.sh @@ -59,6 +59,7 @@ function bench { --wasm-execution=compiled \ --pallet "${1}" \ --extrinsic "${2}" \ + --heap-pages 4096 \ --steps "${STEPS}" \ --repeat "${REPEAT}" \ --template=.maintain/pallet-weight-template-no-back.hbs \ From c2c3b10d9d6ef90462614458a7bdab5568269280 Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 25 Apr 2024 14:11:43 +0200 Subject: [PATCH 27/56] fixed route executor benchmark tests --- .../src/benchmarking/route_executor.rs | 35 +++---------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/runtime/basilisk/src/benchmarking/route_executor.rs b/runtime/basilisk/src/benchmarking/route_executor.rs index 3709c8b37d0..b3aecca00a8 100644 --- a/runtime/basilisk/src/benchmarking/route_executor.rs +++ b/runtime/basilisk/src/benchmarking/route_executor.rs @@ -228,18 +228,7 @@ runtime_benchmarks! { create_xyk_pool(asset_3, asset_4); create_xyk_pool(asset_4, asset_5); create_xyk_pool(asset_5, asset_6); - create_xyk_pool(HDX, asset_6); - //INIT OMNIPOOL - /*let acc = Omnipool::protocol_account(); - crate::benchmarking::omnipool::init()?; - // Create account for token provider and set balance - let owner: AccountId = account("owner", 0, 1); - let token_price = FixedU128::from((5,1)); - let token_amount = 100000 * UNITS; - update_balance(asset_6, &acc, token_amount); - // Add the token to the pool - Omnipool::add_token(RawOrigin::Root.into(), asset_6, token_price, Permill::from_percent(100), owner)?;*/ let route = vec![Trade { pool: PoolType::XYK, @@ -262,12 +251,15 @@ runtime_benchmarks! { asset_in: asset_5, asset_out: asset_6 }]; + Router::set_route( RawOrigin::Signed(caller.clone()).into(), AssetPair::new(HDX, asset_6), route, )?; + create_xyk_pool(HDX, asset_6); + let better_route = vec![Trade { pool: PoolType::XYK, asset_in: HDX, @@ -351,29 +343,10 @@ mod tests { pallet_asset_registry::GenesisConfig:: { registered_assets: vec![ - ( - Some(1), - Some(b"LRNA".to_vec().try_into().unwrap()), - 1_000u128, - None, - None, - None, - true, - ), - ( - Some(2), - Some(b"DAI".to_vec().try_into().unwrap()), - 1_000u128, - None, - None, - None, - true, - ), + (b"DAI".to_vec(), 1_000, Some(2)), ], native_asset_name: b"HDX".to_vec().try_into().unwrap(), native_existential_deposit: NativeExistentialDeposit::get(), - native_decimals: 12, - native_symbol: b"HDX".to_vec().try_into().unwrap(), } .assimilate_storage(&mut t) .unwrap(); From eef048ba1ae2f5e04bb7378d4b2b2efbdb619982 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 13:00:08 +0200 Subject: [PATCH 28/56] add state-trie to benchmarks --- runtime/basilisk/src/lib.rs | 1 + runtime/basilisk/src/system.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 6bc96b1b810..e5158c94350 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -580,6 +580,7 @@ mod benches { [pallet_multisig, Multisig] [pallet_proxy, Proxy] [cumulus_pallet_parachain_system, ParachainSystem] + [pallet_state_trie_migration, StateTrieMigration] //[pallet_xcm, PalletXcmExtrinsiscsBenchmark::] ); } diff --git a/runtime/basilisk/src/system.rs b/runtime/basilisk/src/system.rs index 4bc55df011d..a6b06a2c179 100644 --- a/runtime/basilisk/src/system.rs +++ b/runtime/basilisk/src/system.rs @@ -538,8 +538,14 @@ parameter_types! { pub const MaxKeyLen: u32 = 512; // 144, but use the default value } +#[cfg(feature = "runtime-benchmarks")] +use frame_system::EnsureSigned; + impl pallet_state_trie_migration::Config for Runtime { type ControlOrigin = SuperMajorityTechCommitteeOrRoot; + #[cfg(feature = "runtime-benchmarks")] + type SignedFilter = EnsureSigned; + #[cfg(not(feature = "runtime-benchmarks"))] type SignedFilter = EnsureSignedBy; type RuntimeEvent = RuntimeEvent; type Currency = Balances; From d7ce84868cf8060a4fd271ea77f0d9d22bb66bc3 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 14:29:26 +0200 Subject: [PATCH 29/56] benchmakrs update --- Cargo.lock | 93 +++--- runtime/basilisk/src/assets.rs | 16 +- runtime/basilisk/src/governance.rs | 2 +- runtime/basilisk/src/lib.rs | 68 ++--- runtime/basilisk/src/system.rs | 15 +- .../src/weights/collator_selection.rs | 224 -------------- .../cumulus_pallet_parachain_system.rs | 85 ++++++ .../src/weights/cumulus_pallet_xcmp_queue.rs | 32 +- runtime/basilisk/src/weights/frame_system.rs | 56 ++-- runtime/basilisk/src/weights/mod.rs | 10 +- runtime/basilisk/src/weights/orml_tokens.rs | 34 ++- runtime/basilisk/src/weights/orml_vesting.rs | 30 +- .../src/weights/pallet_asset_registry.rs | 20 +- .../basilisk/src/weights/pallet_balances.rs | 44 +-- .../src/weights/pallet_collator_selection.rs | 283 ++++++++++++++++++ .../basilisk/src/weights/pallet_collective.rs | 110 +++---- .../basilisk/src/weights/pallet_currencies.rs | 34 ++- .../basilisk/src/weights/pallet_democracy.rs | 148 ++++----- runtime/basilisk/src/weights/pallet_duster.rs | 22 +- .../src/weights/pallet_elections_phragmen.rs | 84 +++--- .../basilisk/src/weights/pallet_ema_oracle.rs | 44 +-- .../basilisk/src/weights/pallet_identity.rs | 168 ++++++----- runtime/basilisk/src/weights/pallet_lbp.rs | 60 ++-- .../src/weights/pallet_marketplace.rs | 40 +-- .../src/weights/pallet_message_queue.rs | 44 +-- .../basilisk/src/weights/pallet_multisig.rs | 167 +++++++++++ runtime/basilisk/src/weights/pallet_nft.rs | 24 +- .../basilisk/src/weights/pallet_preimage.rs | 264 ++++++++++++++++ runtime/basilisk/src/weights/pallet_proxy.rs | 225 ++++++++++++++ .../basilisk/src/weights/pallet_scheduler.rs | 74 ++--- ...trie.rs => pallet_state_trie_migration.rs} | 111 ++++--- .../basilisk/src/weights/pallet_timestamp.rs | 12 +- runtime/basilisk/src/weights/pallet_tips.rs | 50 ++-- .../pallet_transaction_multi_payment.rs | 38 ++- .../src/weights/pallet_transaction_pause.rs | 12 +- .../basilisk/src/weights/pallet_treasury.rs | 52 ++-- .../basilisk/src/weights/pallet_utility.rs | 36 +-- .../src/weights/{xyk.rs => pallet_xyk.rs} | 209 +++++++------ .../weights/pallet_xyk_liquidity_mining.rs | 52 ++-- 39 files changed, 1997 insertions(+), 1095 deletions(-) delete mode 100644 runtime/basilisk/src/weights/collator_selection.rs create mode 100644 runtime/basilisk/src/weights/cumulus_pallet_parachain_system.rs create mode 100644 runtime/basilisk/src/weights/pallet_collator_selection.rs create mode 100644 runtime/basilisk/src/weights/pallet_multisig.rs create mode 100644 runtime/basilisk/src/weights/pallet_preimage.rs create mode 100644 runtime/basilisk/src/weights/pallet_proxy.rs rename runtime/basilisk/src/weights/{state_trie.rs => pallet_state_trie_migration.rs} (55%) rename runtime/basilisk/src/weights/{xyk.rs => pallet_xyk.rs} (63%) diff --git a/Cargo.lock b/Cargo.lock index 8fe17ae37e8..9c71082ed71 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3519,7 +3519,7 @@ dependencies = [ [[package]] name = "fp-account" version = "1.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#ea9becfa1885a4ce7d63558620b5367cbc4e9289" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#2c05f9d4d951efacf504d610286da6ac908b1302" dependencies = [ "hex", "impl-serde", @@ -3538,7 +3538,7 @@ dependencies = [ [[package]] name = "fp-evm" version = "3.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#ea9becfa1885a4ce7d63558620b5367cbc4e9289" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#2c05f9d4d951efacf504d610286da6ac908b1302" dependencies = [ "evm", "frame-support", @@ -4379,7 +4379,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hydra-dx-build-script-utils" version = "1.0.3" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "cargo-lock", "platforms 1.1.0", @@ -4388,7 +4388,7 @@ dependencies = [ [[package]] name = "hydra-dx-math" version = "8.0.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "fixed", "num-traits", @@ -4403,7 +4403,7 @@ dependencies = [ [[package]] name = "hydradx-adapters" version = "1.3.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -4451,7 +4451,7 @@ dependencies = [ [[package]] name = "hydradx-traits" version = "3.2.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -4513,7 +4513,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core 0.52.0", + "windows-core", ] [[package]] @@ -6697,7 +6697,7 @@ dependencies = [ [[package]] name = "pallet-asset-registry" version = "3.2.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-benchmarking", "frame-support", @@ -6908,7 +6908,7 @@ dependencies = [ [[package]] name = "pallet-bonds" version = "2.2.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-benchmarking", "frame-support", @@ -6984,7 +6984,7 @@ dependencies = [ [[package]] name = "pallet-circuit-breaker" version = "1.1.21" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "frame-system", @@ -7000,7 +7000,7 @@ dependencies = [ [[package]] name = "pallet-collator-rewards" version = "1.0.6" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "frame-system", @@ -7072,7 +7072,7 @@ dependencies = [ [[package]] name = "pallet-currencies" version = "2.1.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "frame-system", @@ -7089,7 +7089,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.1.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "frame-system", @@ -7123,7 +7123,7 @@ dependencies = [ [[package]] name = "pallet-duster" version = "3.2.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-benchmarking", "frame-support", @@ -7142,7 +7142,7 @@ dependencies = [ [[package]] name = "pallet-dynamic-fees" version = "1.0.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "frame-system", @@ -7214,7 +7214,7 @@ dependencies = [ [[package]] name = "pallet-ema-oracle" version = "1.3.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-benchmarking", "frame-support", @@ -7234,7 +7234,7 @@ dependencies = [ [[package]] name = "pallet-evm" version = "6.0.0-dev" -source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#ea9becfa1885a4ce7d63558620b5367cbc4e9289" +source = "git+https://github.com/moonbeam-foundation/frontier?branch=moonbeam-polkadot-v1.7.2#2c05f9d4d951efacf504d610286da6ac908b1302" dependencies = [ "environmental", "evm", @@ -7356,7 +7356,7 @@ dependencies = [ [[package]] name = "pallet-lbp" version = "4.7.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-benchmarking", "frame-support", @@ -7378,7 +7378,7 @@ dependencies = [ [[package]] name = "pallet-liquidity-mining" version = "4.3.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "frame-system", @@ -7488,7 +7488,7 @@ dependencies = [ [[package]] name = "pallet-nft" version = "7.1.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-benchmarking", "frame-support", @@ -7614,7 +7614,7 @@ dependencies = [ [[package]] name = "pallet-omnipool" version = "4.1.5" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "bitflags 1.3.2", "frame-benchmarking", @@ -7638,7 +7638,7 @@ dependencies = [ [[package]] name = "pallet-omnipool-liquidity-mining" version = "2.1.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "frame-system", @@ -7748,7 +7748,7 @@ dependencies = [ [[package]] name = "pallet-referrals" version = "1.2.3" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "frame-system", @@ -7766,7 +7766,7 @@ dependencies = [ [[package]] name = "pallet-relaychain-info" version = "0.3.4" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -7796,7 +7796,7 @@ dependencies = [ [[package]] name = "pallet-route-executor" version = "2.2.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "frame-system", @@ -7888,7 +7888,7 @@ dependencies = [ [[package]] name = "pallet-stableswap" version = "3.5.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "bitflags 1.3.2", "frame-support", @@ -7907,7 +7907,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "frame-system", @@ -8051,7 +8051,7 @@ dependencies = [ [[package]] name = "pallet-transaction-multi-payment" version = "9.5.0" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "frame-system", @@ -8073,7 +8073,7 @@ dependencies = [ [[package]] name = "pallet-transaction-pause" version = "1.0.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-benchmarking", "frame-support", @@ -8254,7 +8254,7 @@ dependencies = [ [[package]] name = "pallet-xyk" version = "6.4.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-benchmarking", "frame-support", @@ -9922,7 +9922,7 @@ dependencies = [ [[package]] name = "primitives" version = "6.0.2" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-support", "hex-literal 0.3.4", @@ -12990,7 +12990,7 @@ dependencies = [ [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" +source = "git+https://github.com/paritytech/polkadot-sdk#c26cf3f6f2d2b7f7783703308ece440c338459f8" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -13052,7 +13052,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" +source = "git+https://github.com/paritytech/polkadot-sdk#c26cf3f6f2d2b7f7783703308ece440c338459f8" dependencies = [ "proc-macro2", "quote", @@ -13073,7 +13073,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" +source = "git+https://github.com/paritytech/polkadot-sdk#c26cf3f6f2d2b7f7783703308ece440c338459f8" dependencies = [ "environmental", "parity-scale-codec", @@ -13291,7 +13291,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" +source = "git+https://github.com/paritytech/polkadot-sdk#c26cf3f6f2d2b7f7783703308ece440c338459f8" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -13323,7 +13323,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" +source = "git+https://github.com/paritytech/polkadot-sdk#c26cf3f6f2d2b7f7783703308ece440c338459f8" dependencies = [ "Inflector", "expander 2.1.0", @@ -13416,7 +13416,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" +source = "git+https://github.com/paritytech/polkadot-sdk#c26cf3f6f2d2b7f7783703308ece440c338459f8" [[package]] name = "sp-storage" @@ -13434,7 +13434,7 @@ dependencies = [ [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" +source = "git+https://github.com/paritytech/polkadot-sdk#c26cf3f6f2d2b7f7783703308ece440c338459f8" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13471,7 +13471,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" +source = "git+https://github.com/paritytech/polkadot-sdk#c26cf3f6f2d2b7f7783703308ece440c338459f8" dependencies = [ "parity-scale-codec", "tracing", @@ -13571,7 +13571,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk#8dc0b337889ef0d227c0a95681b340ee0e80a297" +source = "git+https://github.com/paritytech/polkadot-sdk#c26cf3f6f2d2b7f7783703308ece440c338459f8" dependencies = [ "impl-trait-for-tuples", "log", @@ -14071,7 +14071,7 @@ dependencies = [ [[package]] name = "test-utils" version = "1.1.1" -source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#54a0f9f8aefdad43f3b165e43f6a0c8130779c7a" +source = "git+https://github.com/galacticcouncil/HydraDX-node?branch=polkadot-v1.7.2#4e946130da2063d95ab97298b75645603de4e3a7" dependencies = [ "frame-system", "pretty_assertions", @@ -15503,7 +15503,7 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" dependencies = [ - "windows-core 0.51.1", + "windows-core", "windows-targets 0.48.5", ] @@ -15516,15 +15516,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.5", -] - [[package]] name = "windows-sys" version = "0.45.0" diff --git a/runtime/basilisk/src/assets.rs b/runtime/basilisk/src/assets.rs index c0fd28e5b50..179da243821 100644 --- a/runtime/basilisk/src/assets.rs +++ b/runtime/basilisk/src/assets.rs @@ -208,7 +208,7 @@ impl pallet_xyk::Config for Runtime { type AssetPairAccountId = AssetPairAccountId; type Currency = Currencies; type NativeAssetId = NativeAssetId; - type WeightInfo = weights::xyk::BasiliskWeight; //TODO: add benchmakrs + type WeightInfo = weights::pallet_xyk::BasiliskWeight; //TODO: add benchmakrs type GetExchangeFee = ExchangeFee; type MinTradingLimit = MinTradingLimit; type MinPoolLiquidity = MinPoolLiquidity; @@ -452,7 +452,7 @@ impl RouterWeightInfo { let set_route_overweight = weights::pallet_route_executor::BasiliskWeight::::set_route_for_xyk(); - set_route_overweight.saturating_sub(weights::xyk::BasiliskWeight::::router_execution_sell( + set_route_overweight.saturating_sub(weights::pallet_xyk::BasiliskWeight::::router_execution_sell( number_of_times_calculate_sell_amounts_executed, number_of_times_execute_sell_amounts_executed, )) @@ -470,7 +470,7 @@ impl AmmTradeWeights> for RouterWeightInfo { weight.saturating_accrue(Self::sell_and_calculate_sell_trade_amounts_overhead_weight(0, 1)); let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_sell(c, e); - let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_sell(c, e) + let xyk_weight = weights::pallet_xyk::BasiliskWeight::::router_execution_sell(c, e) .saturating_add(::AMMHandler::on_trade_weight()); let amm_weight = match trade.pool { @@ -494,7 +494,7 @@ impl AmmTradeWeights> for RouterWeightInfo { weight.saturating_accrue(Self::buy_and_calculate_buy_trade_amounts_overhead_weight(0, 1)); let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_buy(c, e); - let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_buy(c, e) + let xyk_weight = weights::pallet_xyk::BasiliskWeight::::router_execution_buy(c, e) .saturating_add(::AMMHandler::on_trade_weight()); let amm_weight = match trade.pool { @@ -518,7 +518,7 @@ impl AmmTradeWeights> for RouterWeightInfo { weight.saturating_accrue(Self::buy_and_calculate_buy_trade_amounts_overhead_weight(1, 0)); let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_buy(c, e); - let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_buy(c, e) + let xyk_weight = weights::pallet_xyk::BasiliskWeight::::router_execution_buy(c, e) .saturating_add(::AMMHandler::on_trade_weight()); let amm_weight = match trade.pool { @@ -542,7 +542,7 @@ impl AmmTradeWeights> for RouterWeightInfo { weight.saturating_accrue(Self::sell_and_calculate_sell_trade_amounts_overhead_weight(1, 1)); let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_sell(c, e); - let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_sell(c, e) + let xyk_weight = weights::pallet_xyk::BasiliskWeight::::router_execution_sell(c, e) .saturating_add(::AMMHandler::on_trade_weight()); let amm_weight = match trade.pool { @@ -566,7 +566,7 @@ impl AmmTradeWeights> for RouterWeightInfo { weight.saturating_accrue(Self::buy_and_calculate_buy_trade_amounts_overhead_weight(2, 1)); let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_buy(c, e); - let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_buy(c, e) + let xyk_weight = weights::pallet_xyk::BasiliskWeight::::router_execution_buy(c, e) .saturating_add(::AMMHandler::on_trade_weight()); let amm_weight = match trade.pool { @@ -597,7 +597,7 @@ impl AmmTradeWeights> for RouterWeightInfo { .checked_mul(pallet_route_executor::MAX_NUMBER_OF_TRADES.into()); let lbp_weight = weights::pallet_lbp::BasiliskWeight::::router_execution_sell(1, 0); - let xyk_weight = weights::xyk::BasiliskWeight::::router_execution_sell(1, 0); + let xyk_weight = weights::pallet_xyk::BasiliskWeight::::router_execution_sell(1, 0); //Calculate sell amounts for the new route for trade in route { diff --git a/runtime/basilisk/src/governance.rs b/runtime/basilisk/src/governance.rs index e32bd8f09e4..218ce6c74ba 100644 --- a/runtime/basilisk/src/governance.rs +++ b/runtime/basilisk/src/governance.rs @@ -215,7 +215,7 @@ parameter_types! { impl pallet_preimage::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); + type WeightInfo = weights::pallet_preimage::BasiliskWeight; type Currency = Balances; type ManagerOrigin = EnsureRoot; type Consideration = HoldConsideration< diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index e5158c94350..e8796e347ad 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -179,9 +179,10 @@ construct_runtime!( Proxy: pallet_proxy = 12, Tips: pallet_tips = 13, + // The order of next 4 is important, and it cannot change. Authorship: pallet_authorship = 14, CollatorSelection: pallet_collator_selection = 15, - Session: pallet_session = 16, // Session must be after collator and before aura + Session: pallet_session = 16, Aura: pallet_aura = 17, AuraExt: cumulus_pallet_aura_ext exclude_parts { Storage } = 18, Preimage: pallet_preimage = 19, @@ -268,7 +269,7 @@ pub type Executive = frame_executive::Executive< frame_support::migrations::RemovePallet::DbWeight>, frame_support::migrations::RemovePallet::DbWeight>, cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, - pallet_identity::migration::versioned::V0ToV1, + pallet_identity::migration::versioned::V0ToV1, // We have currently 89 identities in basllisk, so limit of 200 should be enough migrations::OnRuntimeUpgradeMigration, ), >; @@ -437,14 +438,13 @@ impl_runtime_apis! { let mut list = Vec::::new(); list_benchmarks!(list, extra); - // Mising: collator selection, state trie, palle-xcm orml_list_benchmark!(list, extra, pallet_currencies, benchmarking::currencies); orml_list_benchmark!(list, extra, pallet_xyk, benchmarking::xyk); orml_list_benchmark!(list, extra, orml_tokens, benchmarking::tokens); orml_list_benchmark!(list, extra, orml_vesting, benchmarking::vesting); orml_list_benchmark!(list, extra, pallet_duster, benchmarking::duster); orml_list_benchmark!(list, extra, pallet_transaction_multi_payment, benchmarking::multi_payment); - orml_list_benchmark!(list, extra, pallet_route_executor, benchmarking::route_executor); + //orml_list_benchmark!(list, extra, pallet_route_executor, benchmarking::route_executor); orml_list_benchmark!(list, extra, pallet_marketplace, benchmarking::marketplace); let storage_info = AllPalletsWithSystem::storage_info(); @@ -486,32 +486,30 @@ impl_runtime_apis! { }; impl pallet_xcm::benchmarking::Config for Runtime { - fn reachable_dest() -> Option { - Some(Parent.into()) - } - - fn teleportable_asset_and_dest() -> Option<(Asset, Location)> { - // Relay/native token can be teleported between AH and Relay. - Some(( - Asset { - fun: Fungible(ExistentialDeposit::get()), - id: AssetId(Parent.into()) - }, - Parent.into(), - )) - } - - fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> { - Some(( - Asset { - fun: Fungible(ExistentialDeposit::get()), - id: AssetId(Parent.into()) - }, - // AH can reserve transfer native token to some random parachain. - ParentThen(Parachain(RandomParaId::get().into()).into()).into(), - )) - } - } + fn reachable_dest() -> Option { + Some(Parent.into()) + } + + fn teleportable_asset_and_dest() -> Option<(Asset, Location)> { + Some(( + Asset { + fun: Fungible(ExistentialDeposit::get()), + id: AssetId(Parent.into()) + }, + Parent.into(), + )) + } + + fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> { + Some(( + Asset { + fun: Fungible(ExistentialDeposit::get()), + id: AssetId(Parent.into()) + }, + ParentThen(Parachain(RandomParaId::get().into()).into()).into(), + )) + } + } impl pallet_xyk_liquidity_mining_benchmarking::Config for Runtime {} @@ -534,14 +532,13 @@ impl_runtime_apis! { let params = (&config, &whitelist); add_benchmarks!(params, batches); - // Basilisk pallets orml_add_benchmark!(params, batches, pallet_xyk, benchmarking::xyk); orml_add_benchmark!(params, batches, pallet_currencies, benchmarking::currencies); orml_add_benchmark!(params, batches, orml_tokens, benchmarking::tokens); orml_add_benchmark!(params, batches, orml_vesting, benchmarking::vesting); orml_add_benchmark!(params, batches, pallet_duster, benchmarking::duster); orml_add_benchmark!(params, batches, pallet_transaction_multi_payment, benchmarking::multi_payment); - orml_add_benchmark!(params, batches, pallet_route_executor, benchmarking::route_executor); + //orml_add_benchmark!(params, batches, pallet_route_executor, benchmarking::route_executor); orml_add_benchmark!(params, batches, pallet_marketplace, benchmarking::marketplace); if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } @@ -550,17 +547,13 @@ impl_runtime_apis! { } } -#[cfg(feature = "runtime-benchmarks")] -#[macro_use] -extern crate orml_benchmarking; - #[cfg(feature = "runtime-benchmarks")] mod benches { frame_benchmarking::define_benchmarks!( [pallet_lbp, LBP] [pallet_nft, NFT] [pallet_asset_registry, AssetRegistry] - [allet_xyk_liquidity_mining, XYKLiquidityMiningBench::] + [pallet_xyk_liquidity_mining, XYKLiquidityMiningBench::] [pallet_transaction_pause, TransactionPause] [pallet_ema_oracle, EmaOracle] [frame_system, SystemBench::] @@ -581,6 +574,7 @@ mod benches { [pallet_proxy, Proxy] [cumulus_pallet_parachain_system, ParachainSystem] [pallet_state_trie_migration, StateTrieMigration] + [pallet_collator_selection, CollatorSelection] //[pallet_xcm, PalletXcmExtrinsiscsBenchmark::] ); } diff --git a/runtime/basilisk/src/system.rs b/runtime/basilisk/src/system.rs index a6b06a2c179..b97a8a0e46c 100644 --- a/runtime/basilisk/src/system.rs +++ b/runtime/basilisk/src/system.rs @@ -344,7 +344,7 @@ impl pallet_proxy::Config for Runtime { type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; type MaxProxies = MaxProxies; - type WeightInfo = (); + type WeightInfo = weights::pallet_proxy::BasiliskWeight; type MaxPending = MaxPending; type CallHasher = BlakeTwo256; type AnnouncementDepositBase = AnnouncementDepositBase; @@ -365,8 +365,8 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type XcmpMessageHandler = XcmpQueue; type ReservedXcmpWeight = ReservedXcmpWeight; type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; - type DmpQueue = frame_support::traits::EnqueueWithOrigin; // TODO: what to set here ?! - type WeightInfo = (); //TODO: add benchmarks + type DmpQueue = frame_support::traits::EnqueueWithOrigin; + type WeightInfo = weights::cumulus_pallet_parachain_system::BasiliskWeight; } parameter_types! { @@ -414,7 +414,10 @@ impl pallet_collator_selection::Config for Runtime { type ValidatorId = ::AccountId; type ValidatorIdOf = pallet_collator_selection::IdentityCollator; type ValidatorRegistration = Session; - type WeightInfo = weights::collator_selection::BasiliskWeight; //TODO: do benchmakrs + #[cfg(feature = "runtime-benchmarks")] + type WeightInfo = (); + #[cfg(not(feature = "runtime-benchmarks"))] + type WeightInfo = weights::pallet_collator_selection::BasiliskWeight; type MinEligibleCollators = ConstU32<4>; } @@ -521,7 +524,7 @@ impl pallet_multisig::Config for Runtime { type DepositBase = DepositBase; type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; - type WeightInfo = (); + type WeightInfo = weights::pallet_multisig::BasiliskWeight; } pub struct TechCommAccounts; @@ -553,5 +556,5 @@ impl pallet_state_trie_migration::Config for Runtime { type MaxKeyLen = MaxKeyLen; type SignedDepositPerItem = MigrationSignedDepositPerItem; type SignedDepositBase = MigrationSignedDepositBase; - type WeightInfo = weights::state_trie::BasiliskWeight; //TODO: do benchmarks + type WeightInfo = weights::pallet_state_trie_migration::BasiliskWeight; } diff --git a/runtime/basilisk/src/weights/collator_selection.rs b/runtime/basilisk/src/weights/collator_selection.rs deleted file mode 100644 index b0aa6a38cd1..00000000000 --- a/runtime/basilisk/src/weights/collator_selection.rs +++ /dev/null @@ -1,224 +0,0 @@ -// This file is part of Basilisk. - -// Copyright (C) 2020-2023 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_collator_selection` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` - -// Executed Command: -// target/release/basilisk -// benchmark -// pallet -// --chain=dev -// --steps=10 -// --repeat=30 -// --wasm-execution=compiled -// --heap-pages=4096 -// --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-collator-selection -// --output=weights-1.1.0/collator_selection.rs -// --extrinsic=* - -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] - -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; - -use pallet_collator_selection::weights::WeightInfo; - -pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { - /// Storage: `Session::NextKeys` (r:50 w:0) - /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `CollatorSelection::Invulnerables` (r:0 w:1) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) - /// The range of component `b` is `[1, 50]`. - fn set_invulnerables(b: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `205 + b * (79 ±0)` - // Estimated: `1194 + b * (2554 ±0)` - // Minimum execution time: 20_642_000 picoseconds. - Weight::from_parts(19_678_835, 1194) - // Standard Error: 8_717 - .saturating_add(Weight::from_parts(3_466_810, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) - .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 2554).saturating_mul(b.into())) - } - /// Storage: `Session::NextKeys` (r:1 w:0) - /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `CollatorSelection::Invulnerables` (r:1 w:1) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::Candidates` (r:1 w:1) - /// Proof: `CollatorSelection::Candidates` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// The range of component `b` is `[1, 49]`. - /// The range of component `c` is `[1, 19]`. - fn add_invulnerable(b: u32, c: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `853 + b * (42 ±0) + c * (48 ±0)` - // Estimated: `4355 + b * (42 ±0) + c * (46 ±0)` - // Minimum execution time: 59_791_000 picoseconds. - Weight::from_parts(58_869_820, 4355) - // Standard Error: 4_211 - .saturating_add(Weight::from_parts(159_294, 0).saturating_mul(b.into())) - // Standard Error: 11_302 - .saturating_add(Weight::from_parts(46_107, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 42).saturating_mul(b.into())) - .saturating_add(Weight::from_parts(0, 46).saturating_mul(c.into())) - } - /// Storage: `CollatorSelection::Candidates` (r:1 w:0) - /// Proof: `CollatorSelection::Candidates` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::Invulnerables` (r:1 w:1) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) - /// The range of component `b` is `[5, 50]`. - fn remove_invulnerable(b: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `186 + b * (32 ±0)` - // Estimated: `3086` - // Minimum execution time: 21_930_000 picoseconds. - Weight::from_parts(22_391_375, 3086) - // Standard Error: 1_204 - .saturating_add(Weight::from_parts(46_963, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: `CollatorSelection::DesiredCandidates` (r:0 w:1) - /// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - fn set_desired_candidates() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 11_158_000 picoseconds. - Weight::from_parts(11_428_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: `CollatorSelection::CandidacyBond` (r:0 w:1) - /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - fn set_candidacy_bond(_: u32, _: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 11_250_000 picoseconds. - Weight::from_parts(11_503_000, 0).saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: `CollatorSelection::Candidates` (r:1 w:1) - /// Proof: `CollatorSelection::Candidates` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::DesiredCandidates` (r:1 w:0) - /// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) - /// Storage: `Session::NextKeys` (r:1 w:0) - /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) - /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) - /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - /// The range of component `c` is `[1, 19]`. - fn register_as_candidate(c: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `621 + c * (61 ±0)` - // Estimated: `4091 + c * (61 ±0)` - // Minimum execution time: 57_862_000 picoseconds. - Weight::from_parts(58_635_556, 4091) - // Standard Error: 4_827 - .saturating_add(Weight::from_parts(158_468, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 61).saturating_mul(c.into())) - } - /// Storage: `CollatorSelection::Candidates` (r:1 w:1) - /// Proof: `CollatorSelection::Candidates` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) - /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - /// The range of component `c` is `[3, 20]`. - fn leave_intent(c: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `448 + c * (47 ±0)` - // Estimated: `3086` - // Minimum execution time: 45_364_000 picoseconds. - Weight::from_parts(46_297_183, 3086) - // Standard Error: 6_548 - .saturating_add(Weight::from_parts(81_304, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - - fn update_bond(_c: u32) -> Weight { - todo!() - } - - fn take_candidate_slot(_c: u32) -> Weight { - todo!() - } - - /// Storage: `System::Account` (r:2 w:2) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `System::BlockWeight` (r:1 w:1) - /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) - /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - fn note_author() -> Weight { - // Proof Size summary in bytes: - // Measured: `102` - // Estimated: `6196` - // Minimum execution time: 62_641_000 picoseconds. - Weight::from_parts(63_217_000, 6196) - .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) - } - /// Storage: `CollatorSelection::Candidates` (r:1 w:0) - /// Proof: `CollatorSelection::Candidates` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::LastAuthoredBlock` (r:20 w:0) - /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) - /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) - /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) - /// Storage: `System::BlockWeight` (r:1 w:1) - /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:17 w:17) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 20]`. - /// The range of component `c` is `[1, 20]`. - fn new_session(r: u32, c: u32) -> Weight { - // Proof Size summary in bytes: - // Measured: `312 + c * (98 ±0) + r * (117 ±0)` - // Estimated: `3086 + c * (2519 ±0) + r * (2603 ±0)` - // Minimum execution time: 28_271_000 picoseconds. - Weight::from_parts(28_435_000, 3086) - // Standard Error: 692_426 - .saturating_add(Weight::from_parts(17_239_787, 0).saturating_mul(c.into())) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) - .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) - .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) - .saturating_add(Weight::from_parts(0, 2603).saturating_mul(r.into())) - } -} diff --git a/runtime/basilisk/src/weights/cumulus_pallet_parachain_system.rs b/runtime/basilisk/src/weights/cumulus_pallet_parachain_system.rs new file mode 100644 index 00000000000..d74908eae25 --- /dev/null +++ b/runtime/basilisk/src/weights/cumulus_pallet_parachain_system.rs @@ -0,0 +1,85 @@ +// This file is part of Basilisk. + +// Copyright (C) 2020-2023 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 `cumulus_pallet_parachain_system` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` + +// Executed Command: +// ./target/release/basilisk +// benchmark +// pallet +// --wasm-execution=compiled +// --pallet +// * +// --extrinsic +// * +// --heap-pages +// 4096 +// --steps +// 50 +// --repeat +// 20 +// --template=.maintain/pallet-weight-template-no-back.hbs +// --json-file +// raw.json +// --output +// weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weights for `cumulus_pallet_parachain_system`. +pub struct WeightInfo(PhantomData); + +/// Weights for `cumulus_pallet_parachain_system` using the Basilisk node and recommended hardware. +pub struct BasiliskWeight(PhantomData); +impl cumulus_pallet_parachain_system::WeightInfo for BasiliskWeight { + /// Storage: `ParachainSystem::LastDmqMqcHead` (r:1 w:1) + /// Proof: `ParachainSystem::LastDmqMqcHead` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `MessageQueue::BookStateFor` (r:1 w:1) + /// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) + /// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `ParachainSystem::ProcessedDownwardMessages` (r:0 w:1) + /// Proof: `ParachainSystem::ProcessedDownwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `MessageQueue::Pages` (r:0 w:1000) + /// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(134193), added: 136668, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 1000]`. + fn enqueue_inbound_downward_messages(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `156` + // Estimated: `3517` + // Minimum execution time: 2_740_000 picoseconds. + Weight::from_parts(7_630_634_002, 3517) + // Standard Error: 1_392_681 + .saturating_add(Weight::from_parts(274_384_874, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + } +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/basilisk/src/weights/cumulus_pallet_xcmp_queue.rs index 1e1bcfbe6fe..60dc8bf1d65 100644 --- a/runtime/basilisk/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/basilisk/src/weights/cumulus_pallet_xcmp_queue.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `cumulus_pallet_xcmp_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -63,8 +65,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `109` // Estimated: `1594` - // Minimum execution time: 5_100_000 picoseconds. - Weight::from_parts(5_390_000, 1594) + // Minimum execution time: 6_560_000 picoseconds. + Weight::from_parts(6_920_000, 1594) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -82,8 +84,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `189` // Estimated: `3517` - // Minimum execution time: 22_960_000 picoseconds. - Weight::from_parts(24_821_000, 3517) + // Minimum execution time: 13_570_000 picoseconds. + Weight::from_parts(14_390_000, 3517) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -93,8 +95,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `109` // Estimated: `1594` - // Minimum execution time: 3_280_000 picoseconds. - Weight::from_parts(3_490_000, 1594) + // Minimum execution time: 3_230_000 picoseconds. + Weight::from_parts(3_480_000, 1594) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -104,8 +106,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `144` // Estimated: `1629` - // Minimum execution time: 4_410_000 picoseconds. - Weight::from_parts(6_320_000, 1629) + // Minimum execution time: 4_190_000 picoseconds. + Weight::from_parts(4_420_000, 1629) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -113,8 +115,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_630_000 picoseconds. - Weight::from_parts(8_910_000, 0) + // Minimum execution time: 8_340_000 picoseconds. + Weight::from_parts(8_491_000, 0) } /// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) /// Proof: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1) @@ -134,8 +136,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `134426` // Estimated: `137891` - // Minimum execution time: 257_233_000 picoseconds. - Weight::from_parts(277_302_000, 137891) + // Minimum execution time: 150_231_000 picoseconds. + Weight::from_parts(153_131_000, 137891) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -157,8 +159,8 @@ impl cumulus_pallet_xcmp_queue::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `65823` // Estimated: `69288` - // Minimum execution time: 90_740_000 picoseconds. - Weight::from_parts(162_641_000, 69288) + // Minimum execution time: 85_311_000 picoseconds. + Weight::from_parts(89_330_000, 69288) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } diff --git a/runtime/basilisk/src/weights/frame_system.rs b/runtime/basilisk/src/weights/frame_system.rs index a4a476e5bc0..27cefe21b4a 100644 --- a/runtime/basilisk/src/weights/frame_system.rs +++ b/runtime/basilisk/src/weights/frame_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `frame_system` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -62,8 +64,8 @@ impl frame_system::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_400_000 picoseconds. - Weight::from_parts(2_344_404, 0) + // Minimum execution time: 2_290_000 picoseconds. + Weight::from_parts(4_217_175, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(217, 0).saturating_mul(b.into())) } @@ -72,10 +74,10 @@ impl frame_system::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_810_000 picoseconds. - Weight::from_parts(23_945_595, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_144, 0).saturating_mul(b.into())) + // Minimum execution time: 5_611_000 picoseconds. + Weight::from_parts(24_068_250, 0) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_142, 0).saturating_mul(b.into())) } /// Storage: `System::Digest` (r:1 w:1) /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -85,8 +87,8 @@ impl frame_system::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_930_000 picoseconds. - Weight::from_parts(4_150_000, 1485) + // Minimum execution time: 3_690_000 picoseconds. + Weight::from_parts(3_920_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -106,8 +108,8 @@ impl frame_system::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `198` // Estimated: `1683` - // Minimum execution time: 106_129_535_000 picoseconds. - Weight::from_parts(109_865_673_000, 1683) + // Minimum execution time: 111_713_366_000 picoseconds. + Weight::from_parts(114_232_690_000, 1683) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -118,10 +120,10 @@ impl frame_system::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_370_000 picoseconds. - Weight::from_parts(2_420_000, 0) - // Standard Error: 1_571 - .saturating_add(Weight::from_parts(767_124, 0).saturating_mul(i.into())) + // Minimum execution time: 2_160_000 picoseconds. + Weight::from_parts(2_340_000, 0) + // Standard Error: 1_638 + .saturating_add(Weight::from_parts(781_946, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -131,10 +133,10 @@ impl frame_system::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_330_000 picoseconds. - Weight::from_parts(2_450_000, 0) - // Standard Error: 727 - .saturating_add(Weight::from_parts(520_280, 0).saturating_mul(i.into())) + // Minimum execution time: 2_280_000 picoseconds. + Weight::from_parts(2_350_000, 0) + // Standard Error: 763 + .saturating_add(Weight::from_parts(510_910, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -144,10 +146,10 @@ impl frame_system::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `130 + p * (69 ±0)` // Estimated: `120 + p * (70 ±0)` - // Minimum execution time: 4_540_000 picoseconds. - Weight::from_parts(4_631_000, 120) - // Standard Error: 1_232 - .saturating_add(Weight::from_parts(919_382, 0).saturating_mul(p.into())) + // Minimum execution time: 4_350_000 picoseconds. + Weight::from_parts(4_490_000, 120) + // Standard Error: 1_080 + .saturating_add(Weight::from_parts(920_441, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -158,8 +160,8 @@ impl frame_system::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 9_180_000 picoseconds. - Weight::from_parts(9_510_000, 0) + // Minimum execution time: 8_700_000 picoseconds. + Weight::from_parts(9_320_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) @@ -180,8 +182,8 @@ impl frame_system::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `220` // Estimated: `1705` - // Minimum execution time: 111_846_617_000 picoseconds. - Weight::from_parts(115_367_613_000, 1705) + // Minimum execution time: 115_999_484_000 picoseconds. + Weight::from_parts(118_079_575_000, 1705) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } diff --git a/runtime/basilisk/src/weights/mod.rs b/runtime/basilisk/src/weights/mod.rs index 75aeb7586b7..724974844c9 100644 --- a/runtime/basilisk/src/weights/mod.rs +++ b/runtime/basilisk/src/weights/mod.rs @@ -1,4 +1,3 @@ -pub mod collator_selection; pub mod cumulus_pallet_xcmp_queue; pub mod frame_system; pub mod orml_tokens; @@ -25,6 +24,11 @@ pub mod pallet_transaction_pause; pub mod pallet_treasury; pub mod pallet_utility; pub mod pallet_xyk_liquidity_mining; -pub mod state_trie; pub mod xcm; -pub mod xyk; +pub mod pallet_xyk; +pub mod pallet_preimage; +pub mod pallet_multisig; +pub mod pallet_state_trie_migration; +pub mod pallet_proxy; +pub mod cumulus_pallet_parachain_system; +pub mod pallet_collator_selection; diff --git a/runtime/basilisk/src/weights/orml_tokens.rs b/runtime/basilisk/src/weights/orml_tokens.rs index 93440e899bb..0e879e0898c 100644 --- a/runtime/basilisk/src/weights/orml_tokens.rs +++ b/runtime/basilisk/src/weights/orml_tokens.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `orml_tokens` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -69,10 +71,10 @@ impl orml_tokens::WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `2139` + // Measured: `2135` // Estimated: `6156` - // Minimum execution time: 88_221_000 picoseconds. - Weight::from_parts(92_851_000, 6156) + // Minimum execution time: 58_701_000 picoseconds. + Weight::from_parts(60_741_000, 6156) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -88,10 +90,10 @@ impl orml_tokens::WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn transfer_all() -> Weight { // Proof Size summary in bytes: - // Measured: `2139` + // Measured: `2135` // Estimated: `6156` - // Minimum execution time: 92_411_000 picoseconds. - Weight::from_parts(97_421_000, 6156) + // Minimum execution time: 62_261_000 picoseconds. + Weight::from_parts(63_620_000, 6156) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -107,10 +109,10 @@ impl orml_tokens::WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn transfer_keep_alive() -> Weight { // Proof Size summary in bytes: - // Measured: `1999` + // Measured: `1995` // Estimated: `6156` - // Minimum execution time: 73_270_000 picoseconds. - Weight::from_parts(78_691_000, 6156) + // Minimum execution time: 48_860_000 picoseconds. + Weight::from_parts(49_881_000, 6156) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -126,10 +128,10 @@ impl orml_tokens::WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn force_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `2132` + // Measured: `2128` // Estimated: `6196` - // Minimum execution time: 77_470_000 picoseconds. - Weight::from_parts(82_690_000, 6196) + // Minimum execution time: 51_291_000 picoseconds. + Weight::from_parts(52_661_000, 6196) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -147,10 +149,10 @@ impl orml_tokens::WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn set_balance() -> Weight { // Proof Size summary in bytes: - // Measured: `1930` + // Measured: `1926` // Estimated: `3593` - // Minimum execution time: 45_050_000 picoseconds. - Weight::from_parts(50_250_000, 3593) + // Minimum execution time: 42_550_000 picoseconds. + Weight::from_parts(43_950_000, 3593) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } diff --git a/runtime/basilisk/src/weights/orml_vesting.rs b/runtime/basilisk/src/weights/orml_vesting.rs index 53913d5ec6a..79235058035 100644 --- a/runtime/basilisk/src/weights/orml_vesting.rs +++ b/runtime/basilisk/src/weights/orml_vesting.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `orml_vesting` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -67,10 +69,10 @@ impl orml_vesting::WeightInfo for BasiliskWeight { /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) fn vested_transfer() -> Weight { // Proof Size summary in bytes: - // Measured: `1665` + // Measured: `1661` // Estimated: `6196` - // Minimum execution time: 85_591_000 picoseconds. - Weight::from_parts(95_061_000, 6196) + // Minimum execution time: 80_650_000 picoseconds. + Weight::from_parts(83_291_000, 6196) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -81,12 +83,14 @@ impl orml_vesting::WeightInfo for BasiliskWeight { /// Storage: `Balances::Freezes` (r:1 w:0) /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) /// The range of component `i` is `[1, 15]`. - fn claim(_i: u32, ) -> Weight { + fn claim(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1806 + i * (18 ±0)` + // Measured: `1802 + i * (18 ±0)` // Estimated: `4764` - // Minimum execution time: 47_431_000 picoseconds. - Weight::from_parts(75_070_546, 4764) + // Minimum execution time: 44_440_000 picoseconds. + Weight::from_parts(46_242_717, 4764) + // Standard Error: 7_730 + .saturating_add(Weight::from_parts(168_492, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -101,12 +105,12 @@ impl orml_vesting::WeightInfo for BasiliskWeight { /// The range of component `i` is `[1, 15]`. fn update_vesting_schedules(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1458` + // Measured: `1454` // Estimated: `4764` - // Minimum execution time: 37_421_000 picoseconds. - Weight::from_parts(36_443_624, 4764) - // Standard Error: 74_387 - .saturating_add(Weight::from_parts(944_826, 0).saturating_mul(i.into())) + // Minimum execution time: 37_180_000 picoseconds. + Weight::from_parts(38_449_462, 4764) + // Standard Error: 4_718 + .saturating_add(Weight::from_parts(66_299, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_asset_registry.rs b/runtime/basilisk/src/weights/pallet_asset_registry.rs index 70f9880b1ef..8d9fc4d3d25 100644 --- a/runtime/basilisk/src/weights/pallet_asset_registry.rs +++ b/runtime/basilisk/src/weights/pallet_asset_registry.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_asset_registry` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -73,8 +75,8 @@ impl pallet_asset_registry::WeightInfo for BasiliskWeig // Proof Size summary in bytes: // Measured: `338` // Estimated: `4087` - // Minimum execution time: 27_560_000 picoseconds. - Weight::from_parts(27_910_000, 4087) + // Minimum execution time: 28_370_000 picoseconds. + Weight::from_parts(29_210_000, 4087) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -86,8 +88,8 @@ impl pallet_asset_registry::WeightInfo for BasiliskWeig // Proof Size summary in bytes: // Measured: `405` // Estimated: `3552` - // Minimum execution time: 18_800_000 picoseconds. - Weight::from_parts(19_330_000, 3552) + // Minimum execution time: 18_680_000 picoseconds. + Weight::from_parts(19_361_000, 3552) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -99,8 +101,8 @@ impl pallet_asset_registry::WeightInfo for BasiliskWeig // Proof Size summary in bytes: // Measured: `333` // Estimated: `3552` - // Minimum execution time: 13_700_000 picoseconds. - Weight::from_parts(14_060_000, 3552) + // Minimum execution time: 13_800_000 picoseconds. + Weight::from_parts(14_220_000, 3552) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -114,8 +116,8 @@ impl pallet_asset_registry::WeightInfo for BasiliskWeig // Proof Size summary in bytes: // Measured: `307` // Estimated: `4087` - // Minimum execution time: 17_221_000 picoseconds. - Weight::from_parts(17_960_000, 4087) + // Minimum execution time: 18_070_000 picoseconds. + Weight::from_parts(18_691_000, 4087) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_balances.rs b/runtime/basilisk/src/weights/pallet_balances.rs index 2fc4549c483..380f9098e27 100644 --- a/runtime/basilisk/src/weights/pallet_balances.rs +++ b/runtime/basilisk/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_balances` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -63,8 +65,8 @@ impl pallet_balances::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `52` // Estimated: `3593` - // Minimum execution time: 59_420_000 picoseconds. - Weight::from_parts(61_941_000, 3593) + // Minimum execution time: 59_921_000 picoseconds. + Weight::from_parts(61_911_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -74,8 +76,8 @@ impl pallet_balances::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `52` // Estimated: `3593` - // Minimum execution time: 39_251_000 picoseconds. - Weight::from_parts(39_850_000, 3593) + // Minimum execution time: 40_260_000 picoseconds. + Weight::from_parts(41_070_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -85,8 +87,8 @@ impl pallet_balances::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 14_090_000 picoseconds. - Weight::from_parts(14_881_000, 3593) + // Minimum execution time: 14_120_000 picoseconds. + Weight::from_parts(14_450_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -96,8 +98,8 @@ impl pallet_balances::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 19_101_000 picoseconds. - Weight::from_parts(19_770_000, 3593) + // Minimum execution time: 18_890_000 picoseconds. + Weight::from_parts(19_941_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -107,8 +109,8 @@ impl pallet_balances::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `155` // Estimated: `6196` - // Minimum execution time: 60_850_000 picoseconds. - Weight::from_parts(62_291_000, 6196) + // Minimum execution time: 62_050_000 picoseconds. + Weight::from_parts(63_100_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -118,8 +120,8 @@ impl pallet_balances::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `52` // Estimated: `3593` - // Minimum execution time: 48_820_000 picoseconds. - Weight::from_parts(49_780_000, 3593) + // Minimum execution time: 50_600_000 picoseconds. + Weight::from_parts(51_440_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -129,8 +131,8 @@ impl pallet_balances::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 17_490_000 picoseconds. - Weight::from_parts(18_020_000, 3593) + // Minimum execution time: 17_370_000 picoseconds. + Weight::from_parts(18_110_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -141,10 +143,10 @@ impl pallet_balances::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `0 + u * (135 ±0)` // Estimated: `990 + u * (2603 ±0)` - // Minimum execution time: 17_380_000 picoseconds. - Weight::from_parts(17_480_000, 990) - // Standard Error: 11_849 - .saturating_add(Weight::from_parts(13_979_661, 0).saturating_mul(u.into())) + // Minimum execution time: 17_060_000 picoseconds. + Weight::from_parts(17_350_000, 990) + // Standard Error: 10_383 + .saturating_add(Weight::from_parts(14_348_343, 0).saturating_mul(u.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) @@ -155,8 +157,8 @@ impl pallet_balances::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `1501` - // Minimum execution time: 6_560_000 picoseconds. - Weight::from_parts(6_820_000, 1501) + // Minimum execution time: 6_110_000 picoseconds. + Weight::from_parts(6_390_000, 1501) .saturating_add(T::DbWeight::get().reads(1_u64)) } } \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_collator_selection.rs b/runtime/basilisk/src/weights/pallet_collator_selection.rs new file mode 100644 index 00000000000..ae0858e4524 --- /dev/null +++ b/runtime/basilisk/src/weights/pallet_collator_selection.rs @@ -0,0 +1,283 @@ +// This file is part of Basilisk. + +// Copyright (C) 2020-2023 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_collator_selection` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` + +// Executed Command: +// ./target/release/basilisk +// benchmark +// pallet +// --wasm-execution=compiled +// --pallet +// * +// --extrinsic +// * +// --heap-pages +// 4096 +// --steps +// 50 +// --repeat +// 20 +// --template=.maintain/pallet-weight-template-no-back.hbs +// --json-file +// raw.json +// --output +// weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weights for `pallet_collator_selection`. +pub struct WeightInfo(PhantomData); + +/// Weights for `pallet_collator_selection` using the Basilisk node and recommended hardware. +pub struct BasiliskWeight(PhantomData); +impl pallet_collator_selection::WeightInfo for BasiliskWeight { + /// Storage: `Session::NextKeys` (r:50 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::Invulnerables` (r:0 w:1) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) + /// The range of component `b` is `[1, 50]`. + fn set_invulnerables(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `208 + b * (79 ±0)` + // Estimated: `1196 + b * (2554 ±0)` + // Minimum execution time: 12_240_000 picoseconds. + Weight::from_parts(11_347_235, 1196) + // Standard Error: 6_043 + .saturating_add(Weight::from_parts(2_931_655, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(Weight::from_parts(0, 2554).saturating_mul(b.into())) + } + /// Storage: `Session::NextKeys` (r:1 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:1) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `b` is `[1, 49]`. + /// The range of component `c` is `[1, 19]`. + fn add_invulnerable(b: u32, c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `870 + b * (40 ±0) + c * (48 ±0)` + // Estimated: `4383 + b * (42 ±0) + c * (44 ±0)` + // Minimum execution time: 38_110_000 picoseconds. + Weight::from_parts(38_314_047, 4383) + // Standard Error: 2_548 + .saturating_add(Weight::from_parts(140_704, 0).saturating_mul(b.into())) + // Standard Error: 6_713 + .saturating_add(Weight::from_parts(26_773, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 42).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 44).saturating_mul(c.into())) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:0) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:1) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) + /// The range of component `b` is `[5, 50]`. + fn remove_invulnerable(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `186 + b * (32 ±0)` + // Estimated: `3086` + // Minimum execution time: 11_550_000 picoseconds. + Weight::from_parts(12_594_896, 3086) + // Standard Error: 1_627 + .saturating_add(Weight::from_parts(67_798, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `CollatorSelection::DesiredCandidates` (r:0 w:1) + /// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn set_desired_candidates() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 5_050_000 picoseconds. + Weight::from_parts(5_220_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:1) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:20 w:20) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:20) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[0, 20]`. + /// The range of component `k` is `[0, 20]`. + fn set_candidacy_bond(c: u32, k: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + c * (168 ±0) + k * (119 ±0)` + // Estimated: `3593 + c * (848 ±30) + k * (848 ±30)` + // Minimum execution time: 9_450_000 picoseconds. + Weight::from_parts(9_770_000, 3593) + // Standard Error: 161_573 + .saturating_add(Weight::from_parts(5_432_825, 0).saturating_mul(c.into())) + // Standard Error: 161_573 + .saturating_add(Weight::from_parts(5_209_781, 0).saturating_mul(k.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) + .saturating_add(Weight::from_parts(0, 848).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 848).saturating_mul(k.into())) + } + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) + /// The range of component `c` is `[3, 20]`. + fn update_bond(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `396 + c * (47 ±0)` + // Estimated: `2446` + // Minimum execution time: 23_970_000 picoseconds. + Weight::from_parts(25_146_327, 2446) + // Standard Error: 4_873 + .saturating_add(Weight::from_parts(154_276, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) + /// Storage: `Session::NextKeys` (r:1 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[1, 19]`. + fn register_as_candidate(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `617 + c * (61 ±0)` + // Estimated: `4082 + c * (61 ±0)` + // Minimum execution time: 32_280_000 picoseconds. + Weight::from_parts(33_192_934, 4082) + // Standard Error: 7_668 + .saturating_add(Weight::from_parts(400_903, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 61).saturating_mul(c.into())) + } + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0) + /// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Session::NextKeys` (r:1 w:0) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:2) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[3, 20]`. + fn take_candidate_slot(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `717 + c * (61 ±0)` + // Estimated: `4182 + c * (61 ±0)` + // Minimum execution time: 50_530_000 picoseconds. + Weight::from_parts(52_887_528, 4182) + // Standard Error: 7_318 + .saturating_add(Weight::from_parts(198_882, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(Weight::from_parts(0, 61).saturating_mul(c.into())) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:1) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `c` is `[3, 20]`. + fn leave_intent(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `408 + c * (48 ±0)` + // Estimated: `3086` + // Minimum execution time: 28_231_000 picoseconds. + Weight::from_parts(29_751_583, 3086) + // Standard Error: 5_387 + .saturating_add(Weight::from_parts(184_583, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + fn note_author() -> Weight { + // Proof Size summary in bytes: + // Measured: `102` + // Estimated: `6196` + // Minimum execution time: 44_410_000 picoseconds. + Weight::from_parts(45_270_000, 6196) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `CollatorSelection::CandidateList` (r:1 w:0) + /// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(961), added: 1456, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::LastAuthoredBlock` (r:20 w:0) + /// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::Invulnerables` (r:1 w:0) + /// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(1601), added: 2096, mode: `MaxEncodedLen`) + /// Storage: `CollatorSelection::DesiredCandidates` (r:1 w:0) + /// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::BlockWeight` (r:1 w:1) + /// Proof: `System::BlockWeight` (`max_values`: Some(1), `max_size`: Some(48), added: 543, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:18 w:18) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 20]`. + /// The range of component `c` is `[1, 20]`. + fn new_session(r: u32, c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `391 + c * (98 ±0) + r * (118 ±0)` + // Estimated: `2188621418662104 + c * (2519 ±0) + r * (2571 ±5)` + // Minimum execution time: 19_150_000 picoseconds. + Weight::from_parts(19_770_000, 2188621418662104) + // Standard Error: 271_834 + .saturating_add(Weight::from_parts(12_365_193, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes(1_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 2571).saturating_mul(r.into())) + } +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_collective.rs b/runtime/basilisk/src/weights/pallet_collective.rs index eb25e577fd4..5f29c55ee06 100644 --- a/runtime/basilisk/src/weights/pallet_collective.rs +++ b/runtime/basilisk/src/weights/pallet_collective.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_collective` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -72,12 +74,12 @@ impl pallet_collective::WeightInfo for BasiliskWeight pallet_collective::WeightInfo for BasiliskWeight pallet_collective::WeightInfo for BasiliskWeight Weight { + fn propose_execute(_b: u32, m: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `70 + m * (32 ±0)` // Estimated: `3534 + m * (32 ±0)` - // Minimum execution time: 15_360_000 picoseconds. - Weight::from_parts(17_393_689, 3534) - // Standard Error: 118 - .saturating_add(Weight::from_parts(884, 0).saturating_mul(b.into())) + // Minimum execution time: 15_620_000 picoseconds. + Weight::from_parts(20_815_556, 3534) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) } @@ -130,14 +132,18 @@ impl pallet_collective::WeightInfo for BasiliskWeight Weight { + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `60 + m * (32 ±0) + p * (55 ±0)` // Estimated: `3486 + m * (38 ±0) + p * (54 ±0)` - // Minimum execution time: 19_431_000 picoseconds. - Weight::from_parts(27_674_033, 3486) - // Standard Error: 15_838 - .saturating_add(Weight::from_parts(279_495, 0).saturating_mul(p.into())) + // Minimum execution time: 19_770_000 picoseconds. + Weight::from_parts(17_760_614, 3486) + // Standard Error: 139 + .saturating_add(Weight::from_parts(2_808, 0).saturating_mul(b.into())) + // Standard Error: 16_461 + .saturating_add(Weight::from_parts(122_243, 0).saturating_mul(m.into())) + // Standard Error: 7_251 + .saturating_add(Weight::from_parts(388_188, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) .saturating_add(Weight::from_parts(0, 38).saturating_mul(m.into())) @@ -152,10 +158,10 @@ impl pallet_collective::WeightInfo for BasiliskWeight pallet_collective::WeightInfo for BasiliskWeight pallet_collective::WeightInfo for BasiliskWeight pallet_collective::WeightInfo for BasiliskWeight pallet_collective::WeightInfo for BasiliskWeight pallet_collective::WeightInfo for BasiliskWeight pallet_currencies::WeightInfo for BasiliskWeight Weight { // Proof Size summary in bytes: - // Measured: `2139` + // Measured: `2135` // Estimated: `6156` - // Minimum execution time: 91_400_000 picoseconds. - Weight::from_parts(96_681_000, 6156) + // Minimum execution time: 63_010_000 picoseconds. + Weight::from_parts(65_450_000, 6156) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -80,10 +82,10 @@ impl pallet_currencies::WeightInfo for BasiliskWeight Weight { // Proof Size summary in bytes: - // Measured: `1410` + // Measured: `1406` // Estimated: `3593` - // Minimum execution time: 92_311_000 picoseconds. - Weight::from_parts(97_281_000, 3593) + // Minimum execution time: 61_321_000 picoseconds. + Weight::from_parts(62_271_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -101,10 +103,10 @@ impl pallet_currencies::WeightInfo for BasiliskWeight Weight { // Proof Size summary in bytes: - // Measured: `1930` + // Measured: `1926` // Estimated: `3593` - // Minimum execution time: 66_141_000 picoseconds. - Weight::from_parts(69_680_000, 3593) + // Minimum execution time: 44_320_000 picoseconds. + Weight::from_parts(45_950_000, 3593) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -112,10 +114,10 @@ impl pallet_currencies::WeightInfo for BasiliskWeight Weight { // Proof Size summary in bytes: - // Measured: `1270` + // Measured: `1266` // Estimated: `3593` - // Minimum execution time: 46_320_000 picoseconds. - Weight::from_parts(48_720_000, 3593) + // Minimum execution time: 31_010_000 picoseconds. + Weight::from_parts(31_781_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -123,10 +125,10 @@ impl pallet_currencies::WeightInfo for BasiliskWeight Weight { // Proof Size summary in bytes: - // Measured: `1406` + // Measured: `1402` // Estimated: `3593` - // Minimum execution time: 35_420_000 picoseconds. - Weight::from_parts(50_640_000, 3593) + // Minimum execution time: 32_190_000 picoseconds. + Weight::from_parts(33_370_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_democracy.rs b/runtime/basilisk/src/weights/pallet_democracy.rs index 542bf839f21..4ed4fd08a5f 100644 --- a/runtime/basilisk/src/weights/pallet_democracy.rs +++ b/runtime/basilisk/src/weights/pallet_democracy.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_democracy` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -69,8 +71,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `4688` // Estimated: `18187` - // Minimum execution time: 35_700_000 picoseconds. - Weight::from_parts(37_690_000, 18187) + // Minimum execution time: 35_370_000 picoseconds. + Weight::from_parts(37_570_000, 18187) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -80,8 +82,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `3443` // Estimated: `6695` - // Minimum execution time: 31_490_000 picoseconds. - Weight::from_parts(33_051_000, 6695) + // Minimum execution time: 31_831_000 picoseconds. + Weight::from_parts(34_121_000, 6695) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -97,8 +99,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `3388` // Estimated: `7260` - // Minimum execution time: 45_591_000 picoseconds. - Weight::from_parts(46_600_000, 7260) + // Minimum execution time: 46_231_000 picoseconds. + Weight::from_parts(48_061_000, 7260) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -114,8 +116,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `3410` // Estimated: `7260` - // Minimum execution time: 48_151_000 picoseconds. - Weight::from_parts(50_811_000, 7260) + // Minimum execution time: 48_651_000 picoseconds. + Weight::from_parts(50_141_000, 7260) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -129,8 +131,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `249` // Estimated: `3666` - // Minimum execution time: 21_940_000 picoseconds. - Weight::from_parts(22_591_000, 3666) + // Minimum execution time: 21_080_000 picoseconds. + Weight::from_parts(21_790_000, 3666) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -152,8 +154,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `5819` // Estimated: `18187` - // Minimum execution time: 89_101_000 picoseconds. - Weight::from_parts(94_800_000, 18187) + // Minimum execution time: 89_581_000 picoseconds. + Weight::from_parts(92_121_000, 18187) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -165,8 +167,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `3276` // Estimated: `6703` - // Minimum execution time: 10_550_000 picoseconds. - Weight::from_parts(10_970_000, 6703) + // Minimum execution time: 9_580_000 picoseconds. + Weight::from_parts(9_911_000, 6703) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -176,8 +178,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_180_000 picoseconds. - Weight::from_parts(3_310_000, 0) + // Minimum execution time: 2_850_000 picoseconds. + Weight::from_parts(2_990_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Democracy::NextExternal` (r:0 w:1) @@ -186,8 +188,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_150_000 picoseconds. - Weight::from_parts(3_280_000, 0) + // Minimum execution time: 2_920_000 picoseconds. + Weight::from_parts(3_091_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Democracy::NextExternal` (r:1 w:1) @@ -202,8 +204,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `147` // Estimated: `3518` - // Minimum execution time: 20_250_000 picoseconds. - Weight::from_parts(20_700_000, 3518) + // Minimum execution time: 19_721_000 picoseconds. + Weight::from_parts(20_160_000, 3518) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -217,8 +219,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `3377` // Estimated: `6703` - // Minimum execution time: 21_901_000 picoseconds. - Weight::from_parts(23_250_000, 6703) + // Minimum execution time: 21_930_000 picoseconds. + Weight::from_parts(22_731_000, 6703) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -234,8 +236,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `5704` // Estimated: `18187` - // Minimum execution time: 68_991_000 picoseconds. - Weight::from_parts(73_230_000, 18187) + // Minimum execution time: 71_080_000 picoseconds. + Weight::from_parts(72_180_000, 18187) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -247,8 +249,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `181` // Estimated: `3518` - // Minimum execution time: 15_710_000 picoseconds. - Weight::from_parts(16_400_000, 3518) + // Minimum execution time: 15_530_000 picoseconds. + Weight::from_parts(16_220_000, 3518) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -263,10 +265,10 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `127 + r * (86 ±0)` // Estimated: `1489 + r * (2676 ±0)` - // Minimum execution time: 3_640_000 picoseconds. - Weight::from_parts(4_833_885, 1489) - // Standard Error: 6_318 - .saturating_add(Weight::from_parts(2_975_970, 0).saturating_mul(r.into())) + // Minimum execution time: 3_810_000 picoseconds. + Weight::from_parts(6_007_042, 1489) + // Standard Error: 5_405 + .saturating_add(Weight::from_parts(2_997_448, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -289,10 +291,10 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `127 + r * (86 ±0)` // Estimated: `18187 + r * (2676 ±0)` - // Minimum execution time: 6_280_000 picoseconds. - Weight::from_parts(9_653_253, 18187) - // Standard Error: 8_208 - .saturating_add(Weight::from_parts(2_937_580, 0).saturating_mul(r.into())) + // Minimum execution time: 6_360_000 picoseconds. + Weight::from_parts(8_746_416, 18187) + // Standard Error: 6_198 + .saturating_add(Weight::from_parts(3_027_914, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -311,10 +313,10 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `748 + r * (108 ±0)` // Estimated: `19800 + r * (2676 ±0)` - // Minimum execution time: 34_960_000 picoseconds. - Weight::from_parts(39_523_094, 19800) - // Standard Error: 10_896 - .saturating_add(Weight::from_parts(3_741_548, 0).saturating_mul(r.into())) + // Minimum execution time: 35_420_000 picoseconds. + Weight::from_parts(38_413_028, 19800) + // Standard Error: 9_014 + .saturating_add(Weight::from_parts(3_836_274, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) @@ -330,10 +332,10 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `374 + r * (108 ±0)` // Estimated: `13530 + r * (2676 ±0)` - // Minimum execution time: 15_810_000 picoseconds. - Weight::from_parts(15_665_531, 13530) - // Standard Error: 7_400 - .saturating_add(Weight::from_parts(3_707_968, 0).saturating_mul(r.into())) + // Minimum execution time: 15_800_000 picoseconds. + Weight::from_parts(16_158_605, 13530) + // Standard Error: 8_209 + .saturating_add(Weight::from_parts(3_748_780, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(r.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -346,8 +348,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_130_000 picoseconds. - Weight::from_parts(3_270_000, 0) + // Minimum execution time: 2_950_000 picoseconds. + Weight::from_parts(3_140_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Democracy::VotingOf` (r:1 w:1) @@ -363,10 +365,10 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `504` // Estimated: `7260` - // Minimum execution time: 20_831_000 picoseconds. - Weight::from_parts(31_529_422, 7260) - // Standard Error: 2_464 - .saturating_add(Weight::from_parts(57_802, 0).saturating_mul(r.into())) + // Minimum execution time: 21_560_000 picoseconds. + Weight::from_parts(32_238_851, 7260) + // Standard Error: 2_698 + .saturating_add(Weight::from_parts(63_805, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -383,10 +385,10 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `505 + r * (22 ±0)` // Estimated: `7260` - // Minimum execution time: 28_640_000 picoseconds. - Weight::from_parts(31_225_615, 7260) - // Standard Error: 1_045 - .saturating_add(Weight::from_parts(76_924, 0).saturating_mul(r.into())) + // Minimum execution time: 29_550_000 picoseconds. + Weight::from_parts(31_814_574, 7260) + // Standard Error: 2_240 + .saturating_add(Weight::from_parts(90_749, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -399,10 +401,10 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `609 + r * (26 ±0)` // Estimated: `7260` - // Minimum execution time: 13_440_000 picoseconds. - Weight::from_parts(16_074_656, 7260) - // Standard Error: 1_175 - .saturating_add(Weight::from_parts(79_051, 0).saturating_mul(r.into())) + // Minimum execution time: 13_471_000 picoseconds. + Weight::from_parts(16_249_036, 7260) + // Standard Error: 1_159 + .saturating_add(Weight::from_parts(81_434, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -415,10 +417,10 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `609 + r * (26 ±0)` // Estimated: `7260` - // Minimum execution time: 13_620_000 picoseconds. - Weight::from_parts(15_975_322, 7260) - // Standard Error: 1_285 - .saturating_add(Weight::from_parts(87_387, 0).saturating_mul(r.into())) + // Minimum execution time: 13_590_000 picoseconds. + Weight::from_parts(16_651_895, 7260) + // Standard Error: 1_323 + .saturating_add(Weight::from_parts(78_776, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -434,8 +436,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `287` // Estimated: `3556` - // Minimum execution time: 16_560_000 picoseconds. - Weight::from_parts(17_271_000, 3556) + // Minimum execution time: 16_410_000 picoseconds. + Weight::from_parts(16_910_000, 3556) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -447,8 +449,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `147` // Estimated: `3518` - // Minimum execution time: 12_450_000 picoseconds. - Weight::from_parts(13_080_000, 3518) + // Minimum execution time: 12_860_000 picoseconds. + Weight::from_parts(13_241_000, 3518) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -464,8 +466,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `4842` // Estimated: `18187` - // Minimum execution time: 38_250_000 picoseconds. - Weight::from_parts(40_580_000, 18187) + // Minimum execution time: 38_660_000 picoseconds. + Weight::from_parts(40_210_000, 18187) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -477,8 +479,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `4706` // Estimated: `18187` - // Minimum execution time: 33_210_000 picoseconds. - Weight::from_parts(35_520_000, 18187) + // Minimum execution time: 32_621_000 picoseconds. + Weight::from_parts(34_771_000, 18187) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -492,8 +494,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `211` // Estimated: `3556` - // Minimum execution time: 14_340_000 picoseconds. - Weight::from_parts(15_181_000, 3556) + // Minimum execution time: 14_570_000 picoseconds. + Weight::from_parts(15_340_000, 3556) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -505,8 +507,8 @@ impl pallet_democracy::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `159` // Estimated: `3666` - // Minimum execution time: 14_520_000 picoseconds. - Weight::from_parts(15_110_000, 3666) + // Minimum execution time: 14_580_000 picoseconds. + Weight::from_parts(15_040_000, 3666) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_duster.rs b/runtime/basilisk/src/weights/pallet_duster.rs index 45a1709e78c..e4aba40b9dc 100644 --- a/runtime/basilisk/src/weights/pallet_duster.rs +++ b/runtime/basilisk/src/weights/pallet_duster.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_duster` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -73,10 +75,10 @@ impl pallet_duster::WeightInfo for BasiliskWeight { /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) fn dust_account() -> Weight { // Proof Size summary in bytes: - // Measured: `2422` + // Measured: `2418` // Estimated: `6156` - // Minimum execution time: 63_791_000 picoseconds. - Weight::from_parts(110_271_000, 6156) + // Minimum execution time: 59_241_000 picoseconds. + Weight::from_parts(61_621_000, 6156) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -84,20 +86,20 @@ impl pallet_duster::WeightInfo for BasiliskWeight { /// Proof: `Duster::AccountBlacklist` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) fn add_nondustable_account() -> Weight { // Proof Size summary in bytes: - // Measured: `967` + // Measured: `963` // Estimated: `0` - // Minimum execution time: 22_380_000 picoseconds. - Weight::from_parts(23_621_000, 0) + // Minimum execution time: 13_220_000 picoseconds. + Weight::from_parts(13_640_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Duster::AccountBlacklist` (r:1 w:1) /// Proof: `Duster::AccountBlacklist` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) fn remove_nondustable_account() -> Weight { // Proof Size summary in bytes: - // Measured: `1288` + // Measured: `1284` // Estimated: `3513` - // Minimum execution time: 29_380_000 picoseconds. - Weight::from_parts(31_850_000, 3513) + // Minimum execution time: 17_020_000 picoseconds. + Weight::from_parts(17_450_000, 3513) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_elections_phragmen.rs b/runtime/basilisk/src/weights/pallet_elections_phragmen.rs index 0371ffc793b..bd414423ae1 100644 --- a/runtime/basilisk/src/weights/pallet_elections_phragmen.rs +++ b/runtime/basilisk/src/weights/pallet_elections_phragmen.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_elections_phragmen` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -74,8 +76,10 @@ impl pallet_elections_phragmen::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `471 + v * (80 ±0)` // Estimated: `4764 + v * (80 ±0)` - // Minimum execution time: 30_020_000 picoseconds. - Weight::from_parts(31_606_956, 4764) + // Minimum execution time: 29_730_000 picoseconds. + Weight::from_parts(31_218_012, 4764) + // Standard Error: 6_406 + .saturating_add(Weight::from_parts(87_093, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) @@ -97,10 +101,10 @@ impl pallet_elections_phragmen::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `441 + v * (80 ±0)` // Estimated: `4764 + v * (80 ±0)` - // Minimum execution time: 40_130_000 picoseconds. - Weight::from_parts(41_945_276, 4764) - // Standard Error: 9_953 - .saturating_add(Weight::from_parts(108_461, 0).saturating_mul(v.into())) + // Minimum execution time: 40_860_000 picoseconds. + Weight::from_parts(42_250_701, 4764) + // Standard Error: 12_760 + .saturating_add(Weight::from_parts(141_034, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) @@ -122,10 +126,10 @@ impl pallet_elections_phragmen::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `473 + v * (80 ±0)` // Estimated: `4764 + v * (80 ±0)` - // Minimum execution time: 40_210_000 picoseconds. - Weight::from_parts(41_557_779, 4764) - // Standard Error: 10_321 - .saturating_add(Weight::from_parts(161_908, 0).saturating_mul(v.into())) + // Minimum execution time: 40_750_000 picoseconds. + Weight::from_parts(42_060_982, 4764) + // Standard Error: 11_619 + .saturating_add(Weight::from_parts(179_617, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 80).saturating_mul(v.into())) @@ -140,8 +144,8 @@ impl pallet_elections_phragmen::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `803` // Estimated: `4764` - // Minimum execution time: 42_291_000 picoseconds. - Weight::from_parts(43_940_000, 4764) + // Minimum execution time: 41_790_000 picoseconds. + Weight::from_parts(43_580_000, 4764) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -156,10 +160,10 @@ impl pallet_elections_phragmen::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `1347 + c * (48 ±0)` // Estimated: `2832 + c * (48 ±0)` - // Minimum execution time: 29_730_000 picoseconds. - Weight::from_parts(30_941_820, 2832) - // Standard Error: 1_864 - .saturating_add(Weight::from_parts(63_832, 0).saturating_mul(c.into())) + // Minimum execution time: 29_930_000 picoseconds. + Weight::from_parts(31_074_762, 2832) + // Standard Error: 1_111 + .saturating_add(Weight::from_parts(65_730, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 48).saturating_mul(c.into())) @@ -171,10 +175,10 @@ impl pallet_elections_phragmen::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `317 + c * (48 ±0)` // Estimated: `1794 + c * (48 ±0)` - // Minimum execution time: 26_030_000 picoseconds. - Weight::from_parts(27_019_508, 1794) - // Standard Error: 1_689 - .saturating_add(Weight::from_parts(59_408, 0).saturating_mul(c.into())) + // Minimum execution time: 26_300_000 picoseconds. + Weight::from_parts(27_977_501, 1794) + // Standard Error: 983 + .saturating_add(Weight::from_parts(36_669, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 48).saturating_mul(c.into())) @@ -193,8 +197,8 @@ impl pallet_elections_phragmen::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `1494` // Estimated: `2979` - // Minimum execution time: 35_451_000 picoseconds. - Weight::from_parts(37_431_000, 2979) + // Minimum execution time: 35_770_000 picoseconds. + Weight::from_parts(37_260_000, 2979) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -204,8 +208,8 @@ impl pallet_elections_phragmen::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `957` // Estimated: `2442` - // Minimum execution time: 26_170_000 picoseconds. - Weight::from_parts(27_220_000, 2442) + // Minimum execution time: 26_360_000 picoseconds. + Weight::from_parts(28_110_000, 2442) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -234,8 +238,8 @@ impl pallet_elections_phragmen::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `1494` // Estimated: `3593` - // Minimum execution time: 48_020_000 picoseconds. - Weight::from_parts(49_761_000, 3593) + // Minimum execution time: 48_770_000 picoseconds. + Weight::from_parts(50_911_000, 3593) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -258,13 +262,13 @@ impl pallet_elections_phragmen::WeightInfo for Basilisk fn clean_defunct_voters(v: u32, d: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0 + d * (631 ±0) + v * (56 ±0)` - // Estimated: `32188 + d * (3774 ±0) + v * (24 ±0)` - // Minimum execution time: 5_950_000 picoseconds. - Weight::from_parts(6_540_000, 32188) - // Standard Error: 18_350 - .saturating_add(Weight::from_parts(194_912, 0).saturating_mul(v.into())) - // Standard Error: 39_960 - .saturating_add(Weight::from_parts(47_481_975, 0).saturating_mul(d.into())) + // Estimated: `32188 + d * (3774 ±1) + v * (24 ±0)` + // Minimum execution time: 5_780_000 picoseconds. + Weight::from_parts(6_480_000, 32188) + // Standard Error: 17_262 + .saturating_add(Weight::from_parts(163_655, 0).saturating_mul(v.into())) + // Standard Error: 37_590 + .saturating_add(Weight::from_parts(48_373_194, 0).saturating_mul(d.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(d.into()))) .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(d.into()))) @@ -296,12 +300,12 @@ impl pallet_elections_phragmen::WeightInfo for Basilisk // Proof Size summary in bytes: // Measured: `0 + c * (10 ±0) + e * (27 ±0) + v * (414 ±0)` // Estimated: `278823 + c * (2405 ±3) + e * (14 ±0) + v * (2572 ±3)` - // Minimum execution time: 2_455_242_000 picoseconds. - Weight::from_parts(2_472_693_000, 278823) - // Standard Error: 196_438 - .saturating_add(Weight::from_parts(10_492_545, 0).saturating_mul(v.into())) - // Standard Error: 20_493 - .saturating_add(Weight::from_parts(594_486, 0).saturating_mul(e.into())) + // Minimum execution time: 2_522_186_000 picoseconds. + Weight::from_parts(2_546_425_000, 278823) + // Standard Error: 204_707 + .saturating_add(Weight::from_parts(10_945_132, 0).saturating_mul(v.into())) + // Standard Error: 21_355 + .saturating_add(Weight::from_parts(513_013, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(32_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) diff --git a/runtime/basilisk/src/weights/pallet_ema_oracle.rs b/runtime/basilisk/src/weights/pallet_ema_oracle.rs index f0523789424..c3499871f9e 100644 --- a/runtime/basilisk/src/weights/pallet_ema_oracle.rs +++ b/runtime/basilisk/src/weights/pallet_ema_oracle.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_ema_oracle` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -63,8 +65,8 @@ impl pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `31 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 8_590_000 picoseconds. - Weight::from_parts(9_409_352, 2626) - // Standard Error: 2_298 - .saturating_add(Weight::from_parts(87_668, 0).saturating_mul(r.into())) + // Minimum execution time: 8_710_000 picoseconds. + Weight::from_parts(9_443_931, 2626) + // Standard Error: 2_499 + .saturating_add(Weight::from_parts(80_557, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -78,10 +80,10 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `6977 + r * (5 ±0)` // Estimated: `11037` - // Minimum execution time: 131_971_000 picoseconds. - Weight::from_parts(140_640_181, 11037) - // Standard Error: 14_252 - .saturating_add(Weight::from_parts(79_210, 0).saturating_mul(r.into())) + // Minimum execution time: 134_221_000 picoseconds. + Weight::from_parts(139_988_186, 11037) + // Standard Error: 12_767 + .saturating_add(Weight::from_parts(136_396, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -96,10 +98,10 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `100` // Estimated: `11037 + s * (2589 ±0)` - // Minimum execution time: 9_750_000 picoseconds. - Weight::from_parts(21_852_535, 11037) - // Standard Error: 6_364 - .saturating_add(Weight::from_parts(3_621_609, 0).saturating_mul(s.into())) + // Minimum execution time: 9_520_000 picoseconds. + Weight::from_parts(22_514_789, 11037) + // Standard Error: 6_645 + .saturating_add(Weight::from_parts(3_791_272, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(s.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -117,10 +119,10 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `193 + p * (32 ±0)` // Estimated: `11037` - // Minimum execution time: 9_370_000 picoseconds. - Weight::from_parts(21_694_518, 11037) - // Standard Error: 3_966 - .saturating_add(Weight::from_parts(1_442_774, 0).saturating_mul(p.into())) + // Minimum execution time: 9_440_000 picoseconds. + Weight::from_parts(21_879_116, 11037) + // Standard Error: 4_715 + .saturating_add(Weight::from_parts(1_534_721, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) @@ -137,12 +139,12 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `7069 + r * (5 ±0) + s * (32 ±0)` // Estimated: `11037` - // Minimum execution time: 59_211_000 picoseconds. - Weight::from_parts(5_812_993, 11037) - // Standard Error: 212_425 - .saturating_add(Weight::from_parts(2_642_723, 0).saturating_mul(r.into())) - // Standard Error: 41_448 - .saturating_add(Weight::from_parts(1_813_885, 0).saturating_mul(s.into())) + // Minimum execution time: 58_951_000 picoseconds. + Weight::from_parts(62_283_319, 11037) + // Standard Error: 17_567 + .saturating_add(Weight::from_parts(22_897, 0).saturating_mul(r.into())) + // Standard Error: 3_427 + .saturating_add(Weight::from_parts(1_477_105, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) @@ -152,24 +154,28 @@ impl pallet_identity::WeightInfo for BasiliskWeight /// Storage: `Identity::IdentityOf` (r:1 w:1) /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) /// The range of component `r` is `[1, 20]`. - fn request_judgement(_r: u32, ) -> Weight { + fn request_judgement(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `6967 + r * (57 ±0)` // Estimated: `11037` - // Minimum execution time: 86_951_000 picoseconds. - Weight::from_parts(117_664_766, 11037) + // Minimum execution time: 86_331_000 picoseconds. + Weight::from_parts(89_757_905, 11037) + // Standard Error: 10_571 + .saturating_add(Weight::from_parts(128_154, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Identity::IdentityOf` (r:1 w:1) /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) /// The range of component `r` is `[1, 20]`. - fn cancel_request(_r: u32, ) -> Weight { + fn cancel_request(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `6998` // Estimated: `11037` - // Minimum execution time: 90_071_000 picoseconds. - Weight::from_parts(135_516_116, 11037) + // Minimum execution time: 83_111_000 picoseconds. + Weight::from_parts(86_968_199, 11037) + // Standard Error: 7_753 + .saturating_add(Weight::from_parts(59_608, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -180,10 +186,10 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `88 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 7_040_000 picoseconds. - Weight::from_parts(9_447_426, 2626) - // Standard Error: 17_970 - .saturating_add(Weight::from_parts(70_907, 0).saturating_mul(r.into())) + // Minimum execution time: 6_530_000 picoseconds. + Weight::from_parts(6_970_369, 2626) + // Standard Error: 1_385 + .saturating_add(Weight::from_parts(65_495, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -194,10 +200,10 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `88 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 6_600_000 picoseconds. - Weight::from_parts(8_983_936, 2626) - // Standard Error: 17_024 - .saturating_add(Weight::from_parts(143_428, 0).saturating_mul(r.into())) + // Minimum execution time: 5_860_000 picoseconds. + Weight::from_parts(6_339_078, 2626) + // Standard Error: 1_427 + .saturating_add(Weight::from_parts(62_408, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -208,10 +214,10 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `88 + r * (57 ±0)` // Estimated: `2626` - // Minimum execution time: 6_250_000 picoseconds. - Weight::from_parts(6_922_634, 2626) - // Standard Error: 13_506 - .saturating_add(Weight::from_parts(332_350, 0).saturating_mul(r.into())) + // Minimum execution time: 5_730_000 picoseconds. + Weight::from_parts(6_453_402, 2626) + // Standard Error: 1_293 + .saturating_add(Weight::from_parts(50_492, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -224,10 +230,10 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `7045 + r * (57 ±0)` // Estimated: `11037` - // Minimum execution time: 115_601_000 picoseconds. - Weight::from_parts(143_150_259, 11037) - // Standard Error: 232_952 - .saturating_add(Weight::from_parts(569_782, 0).saturating_mul(r.into())) + // Minimum execution time: 114_311_000 picoseconds. + Weight::from_parts(118_989_129, 11037) + // Standard Error: 9_371 + .saturating_add(Weight::from_parts(55_305, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -245,12 +251,12 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `7209 + r * (5 ±0) + s * (32 ±0)` // Estimated: `11037` - // Minimum execution time: 71_021_000 picoseconds. - Weight::from_parts(11_436_639, 11037) - // Standard Error: 316_934 - .saturating_add(Weight::from_parts(2_936_028, 0).saturating_mul(r.into())) - // Standard Error: 61_840 - .saturating_add(Weight::from_parts(2_440_903, 0).saturating_mul(s.into())) + // Minimum execution time: 76_341_000 picoseconds. + Weight::from_parts(82_411_000, 11037) + // Standard Error: 117_451 + .saturating_add(Weight::from_parts(408_319, 0).saturating_mul(r.into())) + // Standard Error: 23_476 + .saturating_add(Weight::from_parts(1_630_731, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) @@ -266,10 +272,10 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `474 + s * (36 ±0)` // Estimated: `11037` - // Minimum execution time: 25_870_000 picoseconds. - Weight::from_parts(25_549_728, 11037) - // Standard Error: 10_500 - .saturating_add(Weight::from_parts(289_615, 0).saturating_mul(s.into())) + // Minimum execution time: 27_000_000 picoseconds. + Weight::from_parts(28_612_918, 11037) + // Standard Error: 12_122 + .saturating_add(Weight::from_parts(174_462, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -282,10 +288,10 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `590 + s * (3 ±0)` // Estimated: `11037` - // Minimum execution time: 14_960_000 picoseconds. - Weight::from_parts(21_725_362, 11037) - // Standard Error: 6_155 - .saturating_add(Weight::from_parts(10_420, 0).saturating_mul(s.into())) + // Minimum execution time: 13_210_000 picoseconds. + Weight::from_parts(14_750_424, 11037) + // Standard Error: 737 + .saturating_add(Weight::from_parts(26_727, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -300,10 +306,10 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `637 + s * (35 ±0)` // Estimated: `11037` - // Minimum execution time: 30_461_000 picoseconds. - Weight::from_parts(38_867_163, 11037) - // Standard Error: 12_608 - .saturating_add(Weight::from_parts(32_403, 0).saturating_mul(s.into())) + // Minimum execution time: 29_141_000 picoseconds. + Weight::from_parts(28_766_415, 11037) + // Standard Error: 10_961 + .saturating_add(Weight::from_parts(197_341, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -318,10 +324,10 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `666 + s * (37 ±0)` // Estimated: `6723` - // Minimum execution time: 22_621_000 picoseconds. - Weight::from_parts(25_138_030, 6723) - // Standard Error: 7_726 - .saturating_add(Weight::from_parts(85_145, 0).saturating_mul(s.into())) + // Minimum execution time: 24_190_000 picoseconds. + Weight::from_parts(37_585_619, 6723) + // Standard Error: 11_928 + .saturating_add(Weight::from_parts(76_202, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -331,8 +337,8 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_760_000 picoseconds. - Weight::from_parts(9_620_000, 0) + // Minimum execution time: 14_930_000 picoseconds. + Weight::from_parts(16_500_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Identity::UsernameAuthorities` (r:1 w:1) @@ -341,8 +347,8 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `79` // Estimated: `3517` - // Minimum execution time: 16_650_000 picoseconds. - Weight::from_parts(17_501_000, 3517) + // Minimum execution time: 20_570_000 picoseconds. + Weight::from_parts(22_690_000, 3517) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -358,8 +364,8 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `79` // Estimated: `11037` - // Minimum execution time: 70_501_000 picoseconds. - Weight::from_parts(97_871_000, 11037) + // Minimum execution time: 68_201_000 picoseconds. + Weight::from_parts(98_761_000, 11037) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -373,8 +379,8 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `114` // Estimated: `11037` - // Minimum execution time: 32_011_000 picoseconds. - Weight::from_parts(33_770_000, 11037) + // Minimum execution time: 23_331_000 picoseconds. + Weight::from_parts(38_561_000, 11037) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -384,8 +390,8 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `114` // Estimated: `3550` - // Minimum execution time: 20_070_000 picoseconds. - Weight::from_parts(44_740_000, 3550) + // Minimum execution time: 38_071_000 picoseconds. + Weight::from_parts(42_001_000, 3550) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -397,8 +403,8 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `256` // Estimated: `11037` - // Minimum execution time: 25_821_000 picoseconds. - Weight::from_parts(27_841_000, 11037) + // Minimum execution time: 18_220_000 picoseconds. + Weight::from_parts(18_940_000, 11037) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -410,8 +416,8 @@ impl pallet_identity::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `97` // Estimated: `11037` - // Minimum execution time: 18_410_000 picoseconds. - Weight::from_parts(19_740_000, 11037) + // Minimum execution time: 12_560_000 picoseconds. + Weight::from_parts(13_070_000, 11037) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_lbp.rs b/runtime/basilisk/src/weights/pallet_lbp.rs index 55fe45f4d3b..e3debc8c5fd 100644 --- a/runtime/basilisk/src/weights/pallet_lbp.rs +++ b/runtime/basilisk/src/weights/pallet_lbp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_lbp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -75,8 +77,8 @@ impl pallet_lbp::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `964` // Estimated: `11322` - // Minimum execution time: 90_460_000 picoseconds. - Weight::from_parts(92_531_000, 11322) + // Minimum execution time: 92_101_000 picoseconds. + Weight::from_parts(96_241_000, 11322) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -88,8 +90,8 @@ impl pallet_lbp::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `384` // Estimated: `3628` - // Minimum execution time: 18_790_000 picoseconds. - Weight::from_parts(19_280_000, 3628) + // Minimum execution time: 19_190_000 picoseconds. + Weight::from_parts(19_690_000, 3628) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -105,8 +107,8 @@ impl pallet_lbp::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `1204` // Estimated: `11322` - // Minimum execution time: 66_040_000 picoseconds. - Weight::from_parts(69_420_000, 11322) + // Minimum execution time: 67_340_000 picoseconds. + Weight::from_parts(69_681_000, 11322) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -128,8 +130,8 @@ impl pallet_lbp::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `1393` // Estimated: `11322` - // Minimum execution time: 88_031_000 picoseconds. - Weight::from_parts(91_910_000, 11322) + // Minimum execution time: 90_761_000 picoseconds. + Weight::from_parts(94_581_000, 11322) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -147,8 +149,8 @@ impl pallet_lbp::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `1572` // Estimated: `13905` - // Minimum execution time: 150_981_000 picoseconds. - Weight::from_parts(155_692_000, 13905) + // Minimum execution time: 154_791_000 picoseconds. + Weight::from_parts(160_502_000, 13905) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -166,8 +168,8 @@ impl pallet_lbp::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `1572` // Estimated: `13905` - // Minimum execution time: 150_432_000 picoseconds. - Weight::from_parts(153_552_000, 13905) + // Minimum execution time: 154_702_000 picoseconds. + Weight::from_parts(161_012_000, 13905) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -186,13 +188,13 @@ impl pallet_lbp::WeightInfo for BasiliskWeight { fn router_execution_sell(c: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `817 + e * (755 ±0)` - // Estimated: `6156 + e * (7749 ±10_308_707_831_848_054)` - // Minimum execution time: 51_181_000 picoseconds. - Weight::from_parts(52_700_000, 6156) - // Standard Error: 133_283 - .saturating_add(Weight::from_parts(847_260, 0).saturating_mul(c.into())) - // Standard Error: 296_860 - .saturating_add(Weight::from_parts(103_508_329, 0).saturating_mul(e.into())) + // Estimated: `6156 + e * (7749 ±6_801_226_166_572_765)` + // Minimum execution time: 52_880_000 picoseconds. + Weight::from_parts(54_061_000, 6156) + // Standard Error: 140_496 + .saturating_add(Weight::from_parts(766_543, 0).saturating_mul(c.into())) + // Standard Error: 312_925 + .saturating_add(Weight::from_parts(106_100_719, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((9_u64).saturating_mul(e.into()))) .saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(e.into()))) @@ -213,13 +215,13 @@ impl pallet_lbp::WeightInfo for BasiliskWeight { fn router_execution_buy(c: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `817 + e * (755 ±0)` - // Estimated: `6156 + e * (7749 ±4_848_321_430_572_248)` - // Minimum execution time: 92_001_000 picoseconds. - Weight::from_parts(93_820_000, 6156) - // Standard Error: 255_692 - .saturating_add(Weight::from_parts(1_913_461, 0).saturating_mul(c.into())) - // Standard Error: 862_277 - .saturating_add(Weight::from_parts(80_689_079, 0).saturating_mul(e.into())) + // Estimated: `6156 + e * (7749 ±1_398_712_020_157_493)` + // Minimum execution time: 95_671_000 picoseconds. + Weight::from_parts(96_911_000, 6156) + // Standard Error: 262_021 + .saturating_add(Weight::from_parts(1_997_955, 0).saturating_mul(c.into())) + // Standard Error: 883_620 + .saturating_add(Weight::from_parts(82_292_049, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((9_u64).saturating_mul(e.into()))) .saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(e.into()))) @@ -233,8 +235,8 @@ impl pallet_lbp::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `817` // Estimated: `6156` - // Minimum execution time: 51_540_000 picoseconds. - Weight::from_parts(52_680_000, 6156) + // Minimum execution time: 52_810_000 picoseconds. + Weight::from_parts(53_830_000, 6156) .saturating_add(T::DbWeight::get().reads(3_u64)) } } \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_marketplace.rs b/runtime/basilisk/src/weights/pallet_marketplace.rs index 05af2ecdfac..43cb074fbbd 100644 --- a/runtime/basilisk/src/weights/pallet_marketplace.rs +++ b/runtime/basilisk/src/weights/pallet_marketplace.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_marketplace` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -81,10 +83,10 @@ impl pallet_marketplace::WeightInfo for BasiliskWeight< /// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(113), added: 2588, mode: `MaxEncodedLen`) fn buy() -> Weight { // Proof Size summary in bytes: - // Measured: `2930` + // Measured: `2926` // Estimated: `6156` - // Minimum execution time: 90_241_000 picoseconds. - Weight::from_parts(91_441_000, 6156) + // Minimum execution time: 91_431_000 picoseconds. + Weight::from_parts(94_601_000, 6156) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -94,10 +96,10 @@ impl pallet_marketplace::WeightInfo for BasiliskWeight< /// Proof: `Marketplace::Prices` (`max_values`: None, `max_size`: Some(80), added: 2555, mode: `MaxEncodedLen`) fn set_price() -> Weight { // Proof Size summary in bytes: - // Measured: `1398` + // Measured: `1394` // Estimated: `3611` - // Minimum execution time: 24_400_000 picoseconds. - Weight::from_parts(25_650_000, 3611) + // Minimum execution time: 24_080_000 picoseconds. + Weight::from_parts(25_370_000, 3611) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -113,10 +115,10 @@ impl pallet_marketplace::WeightInfo for BasiliskWeight< /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn make_offer() -> Weight { // Proof Size summary in bytes: - // Measured: `1868` + // Measured: `1864` // Estimated: `4087` - // Minimum execution time: 43_990_000 picoseconds. - Weight::from_parts(46_031_000, 4087) + // Minimum execution time: 44_071_000 picoseconds. + Weight::from_parts(46_530_000, 4087) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -134,10 +136,10 @@ impl pallet_marketplace::WeightInfo for BasiliskWeight< /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) fn withdraw_offer() -> Weight { // Proof Size summary in bytes: - // Measured: `2359` + // Measured: `2355` // Estimated: `4087` - // Minimum execution time: 44_501_000 picoseconds. - Weight::from_parts(46_461_000, 4087) + // Minimum execution time: 44_961_000 picoseconds. + Weight::from_parts(46_860_000, 4087) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -167,10 +169,10 @@ impl pallet_marketplace::WeightInfo for BasiliskWeight< /// Proof: `Uniques::ItemPriceOf` (`max_values`: None, `max_size`: Some(113), added: 2588, mode: `MaxEncodedLen`) fn accept_offer() -> Weight { // Proof Size summary in bytes: - // Measured: `3000` + // Measured: `2996` // Estimated: `6156` - // Minimum execution time: 105_641_000 picoseconds. - Weight::from_parts(108_271_000, 6156) + // Minimum execution time: 107_540_000 picoseconds. + Weight::from_parts(110_771_000, 6156) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -184,10 +186,10 @@ impl pallet_marketplace::WeightInfo for BasiliskWeight< /// Proof: `AssetRegistry::LocationAssets` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) fn add_royalty() -> Weight { // Proof Size summary in bytes: - // Measured: `1681` + // Measured: `1677` // Estimated: `4087` - // Minimum execution time: 33_180_000 picoseconds. - Weight::from_parts(34_290_000, 4087) + // Minimum execution time: 32_401_000 picoseconds. + Weight::from_parts(33_600_000, 4087) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_message_queue.rs b/runtime/basilisk/src/weights/pallet_message_queue.rs index 5ed3651c051..e9c70357ee8 100644 --- a/runtime/basilisk/src/weights/pallet_message_queue.rs +++ b/runtime/basilisk/src/weights/pallet_message_queue.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_message_queue` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -65,8 +67,8 @@ impl pallet_message_queue::WeightInfo for BasiliskWeigh // Proof Size summary in bytes: // Measured: `298` // Estimated: `6044` - // Minimum execution time: 13_840_000 picoseconds. - Weight::from_parts(19_300_000, 6044) + // Minimum execution time: 13_220_000 picoseconds. + Weight::from_parts(13_570_000, 6044) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -78,8 +80,8 @@ impl pallet_message_queue::WeightInfo for BasiliskWeigh // Proof Size summary in bytes: // Measured: `293` // Estimated: `6044` - // Minimum execution time: 12_280_000 picoseconds. - Weight::from_parts(12_760_000, 6044) + // Minimum execution time: 11_450_000 picoseconds. + Weight::from_parts(11_810_000, 6044) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -89,8 +91,8 @@ impl pallet_message_queue::WeightInfo for BasiliskWeigh // Proof Size summary in bytes: // Measured: `80` // Estimated: `3517` - // Minimum execution time: 8_460_000 picoseconds. - Weight::from_parts(8_981_000, 3517) + // Minimum execution time: 5_710_000 picoseconds. + Weight::from_parts(5_970_000, 3517) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -100,8 +102,8 @@ impl pallet_message_queue::WeightInfo for BasiliskWeigh // Proof Size summary in bytes: // Measured: `147` // Estimated: `137658` - // Minimum execution time: 10_870_000 picoseconds. - Weight::from_parts(11_650_000, 137658) + // Minimum execution time: 7_200_000 picoseconds. + Weight::from_parts(7_550_000, 137658) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -111,8 +113,8 @@ impl pallet_message_queue::WeightInfo for BasiliskWeigh // Proof Size summary in bytes: // Measured: `147` // Estimated: `137658` - // Minimum execution time: 8_730_000 picoseconds. - Weight::from_parts(12_420_000, 137658) + // Minimum execution time: 7_510_000 picoseconds. + Weight::from_parts(7_721_000, 137658) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -124,8 +126,8 @@ impl pallet_message_queue::WeightInfo for BasiliskWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 258_302_000 picoseconds. - Weight::from_parts(377_824_000, 0) + // Minimum execution time: 244_592_000 picoseconds. + Weight::from_parts(257_093_000, 0) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: `MessageQueue::ServiceHead` (r:1 w:1) @@ -136,8 +138,8 @@ impl pallet_message_queue::WeightInfo for BasiliskWeigh // Proof Size summary in bytes: // Measured: `246` // Estimated: `3517` - // Minimum execution time: 10_930_000 picoseconds. - Weight::from_parts(11_660_000, 3517) + // Minimum execution time: 7_370_000 picoseconds. + Weight::from_parts(7_630_000, 3517) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -149,8 +151,8 @@ impl pallet_message_queue::WeightInfo for BasiliskWeigh // Proof Size summary in bytes: // Measured: `134349` // Estimated: `137658` - // Minimum execution time: 115_211_000 picoseconds. - Weight::from_parts(144_261_000, 137658) + // Minimum execution time: 69_251_000 picoseconds. + Weight::from_parts(70_801_000, 137658) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -162,8 +164,8 @@ impl pallet_message_queue::WeightInfo for BasiliskWeigh // Proof Size summary in bytes: // Measured: `134349` // Estimated: `137658` - // Minimum execution time: 116_461_000 picoseconds. - Weight::from_parts(236_392_000, 137658) + // Minimum execution time: 103_801_000 picoseconds. + Weight::from_parts(106_321_000, 137658) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -175,8 +177,8 @@ impl pallet_message_queue::WeightInfo for BasiliskWeigh // Proof Size summary in bytes: // Measured: `134349` // Estimated: `137658` - // Minimum execution time: 181_681_000 picoseconds. - Weight::from_parts(330_363_000, 137658) + // Minimum execution time: 163_081_000 picoseconds. + Weight::from_parts(168_422_000, 137658) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_multisig.rs b/runtime/basilisk/src/weights/pallet_multisig.rs new file mode 100644 index 00000000000..68d0fb32e28 --- /dev/null +++ b/runtime/basilisk/src/weights/pallet_multisig.rs @@ -0,0 +1,167 @@ +// This file is part of Basilisk. + +// Copyright (C) 2020-2023 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_multisig` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` + +// Executed Command: +// ./target/release/basilisk +// benchmark +// pallet +// --wasm-execution=compiled +// --pallet +// * +// --extrinsic +// * +// --heap-pages +// 4096 +// --steps +// 50 +// --repeat +// 20 +// --template=.maintain/pallet-weight-template-no-back.hbs +// --json-file +// raw.json +// --output +// weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weights for `pallet_multisig`. +pub struct WeightInfo(PhantomData); + +/// Weights for `pallet_multisig` using the Basilisk node and recommended hardware. +pub struct BasiliskWeight(PhantomData); +impl pallet_multisig::WeightInfo for BasiliskWeight { + /// The range of component `z` is `[0, 10000]`. + fn as_multi_threshold_1(z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 12_280_000 picoseconds. + Weight::from_parts(13_287_659, 0) + // Standard Error: 4 + .saturating_add(Weight::from_parts(361, 0).saturating_mul(z.into())) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_create(s: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `295 + s * (2 ±0)` + // Estimated: `6811` + // Minimum execution time: 37_760_000 picoseconds. + Weight::from_parts(35_205_121, 6811) + // Standard Error: 2_877 + .saturating_add(Weight::from_parts(45_382, 0).saturating_mul(s.into())) + // Standard Error: 28 + .saturating_add(Weight::from_parts(1_037, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[3, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_approve(s: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `315` + // Estimated: `6811` + // Minimum execution time: 23_250_000 picoseconds. + Weight::from_parts(18_464_695, 6811) + // Standard Error: 764 + .saturating_add(Weight::from_parts(63_228, 0).saturating_mul(s.into())) + // Standard Error: 7 + .saturating_add(Weight::from_parts(1_065, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_complete(s: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `418 + s * (33 ±0)` + // Estimated: `6811` + // Minimum execution time: 42_221_000 picoseconds. + Weight::from_parts(35_756_970, 6811) + // Standard Error: 1_137 + .saturating_add(Weight::from_parts(81_681, 0).saturating_mul(s.into())) + // Standard Error: 11 + .saturating_add(Weight::from_parts(1_138, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_create(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `296 + s * (2 ±0)` + // Estimated: `6811` + // Minimum execution time: 27_930_000 picoseconds. + Weight::from_parts(30_269_183, 6811) + // Standard Error: 1_126 + .saturating_add(Weight::from_parts(72_408, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_approve(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `315` + // Estimated: `6811` + // Minimum execution time: 15_780_000 picoseconds. + Weight::from_parts(16_640_325, 6811) + // Standard Error: 862 + .saturating_add(Weight::from_parts(64_428, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn cancel_as_multi(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `487 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 28_471_000 picoseconds. + Weight::from_parts(30_511_852, 6811) + // Standard Error: 2_097 + .saturating_add(Weight::from_parts(75_044, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_nft.rs b/runtime/basilisk/src/weights/pallet_nft.rs index 5e2d4a5612f..b625ee33b4d 100644 --- a/runtime/basilisk/src/weights/pallet_nft.rs +++ b/runtime/basilisk/src/weights/pallet_nft.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_nft` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -71,8 +73,8 @@ impl pallet_nft::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `500` // Estimated: `4087` - // Minimum execution time: 22_190_000 picoseconds. - Weight::from_parts(22_880_000, 4087) + // Minimum execution time: 21_440_000 picoseconds. + Weight::from_parts(22_950_000, 4087) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -96,8 +98,8 @@ impl pallet_nft::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `936` // Estimated: `4087` - // Minimum execution time: 39_131_000 picoseconds. - Weight::from_parts(39_891_000, 4087) + // Minimum execution time: 38_970_000 picoseconds. + Weight::from_parts(40_021_000, 4087) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -115,8 +117,8 @@ impl pallet_nft::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `873` // Estimated: `3655` - // Minimum execution time: 35_711_000 picoseconds. - Weight::from_parts(36_860_000, 3655) + // Minimum execution time: 36_170_000 picoseconds. + Weight::from_parts(38_671_000, 3655) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -140,8 +142,8 @@ impl pallet_nft::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `978` // Estimated: `4087` - // Minimum execution time: 44_930_000 picoseconds. - Weight::from_parts(46_200_000, 4087) + // Minimum execution time: 45_351_000 picoseconds. + Weight::from_parts(46_690_000, 4087) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -165,8 +167,8 @@ impl pallet_nft::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `1141` // Estimated: `4087` - // Minimum execution time: 38_370_000 picoseconds. - Weight::from_parts(39_591_000, 4087) + // Minimum execution time: 39_440_000 picoseconds. + Weight::from_parts(41_081_000, 4087) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_preimage.rs b/runtime/basilisk/src/weights/pallet_preimage.rs new file mode 100644 index 00000000000..847534cfad5 --- /dev/null +++ b/runtime/basilisk/src/weights/pallet_preimage.rs @@ -0,0 +1,264 @@ +// This file is part of Basilisk. + +// Copyright (C) 2020-2023 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_preimage` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` + +// Executed Command: +// ./target/release/basilisk +// benchmark +// pallet +// --wasm-execution=compiled +// --pallet +// * +// --extrinsic +// * +// --heap-pages +// 4096 +// --steps +// 50 +// --repeat +// 20 +// --template=.maintain/pallet-weight-template-no-back.hbs +// --json-file +// raw.json +// --output +// weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weights for `pallet_preimage`. +pub struct WeightInfo(PhantomData); + +/// Weights for `pallet_preimage` using the Basilisk node and recommended hardware. +pub struct BasiliskWeight(PhantomData); +impl pallet_preimage::WeightInfo for BasiliskWeight { + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 4194304]`. + fn note_preimage(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `3556` + // Minimum execution time: 49_460_000 picoseconds. + Weight::from_parts(50_131_000, 3556) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_663, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 4194304]`. + fn note_requested_preimage(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `173` + // Estimated: `3556` + // Minimum execution time: 15_220_000 picoseconds. + Weight::from_parts(24_026_943, 3556) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_618, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 4194304]`. + fn note_no_deposit_preimage(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `173` + // Estimated: `3556` + // Minimum execution time: 15_200_000 picoseconds. + Weight::from_parts(15_670_000, 3556) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_614, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + fn unnote_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `311` + // Estimated: `3556` + // Minimum execution time: 54_881_000 picoseconds. + Weight::from_parts(56_271_000, 3556) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + fn unnote_no_deposit_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `211` + // Estimated: `3556` + // Minimum execution time: 25_030_000 picoseconds. + Weight::from_parts(28_930_000, 3556) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `255` + // Estimated: `3556` + // Minimum execution time: 19_380_000 picoseconds. + Weight::from_parts(22_400_000, 3556) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_no_deposit_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `211` + // Estimated: `3556` + // Minimum execution time: 14_950_000 picoseconds. + Weight::from_parts(16_710_000, 3556) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_unnoted_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `3556` + // Minimum execution time: 15_291_000 picoseconds. + Weight::from_parts(16_320_000, 3556) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_requested_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `173` + // Estimated: `3556` + // Minimum execution time: 10_710_000 picoseconds. + Weight::from_parts(11_370_000, 3556) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + fn unrequest_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `211` + // Estimated: `3556` + // Minimum execution time: 22_911_000 picoseconds. + Weight::from_parts(26_451_000, 3556) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn unrequest_unnoted_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `173` + // Estimated: `3556` + // Minimum execution time: 10_960_000 picoseconds. + Weight::from_parts(11_380_000, 3556) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn unrequest_multi_referenced_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `173` + // Estimated: `3556` + // Minimum execution time: 11_140_000 picoseconds. + Weight::from_parts(11_450_000, 3556) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Preimage::StatusFor` (r:1023 w:1023) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1023 w:1023) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1023 w:1023) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:0 w:1023) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 1024]`. + fn ensure_updated(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + n * (227 ±0)` + // Estimated: `990 + n * (2603 ±0)` + // Minimum execution time: 53_550_000 picoseconds. + Weight::from_parts(54_331_000, 990) + // Standard Error: 493_174 + .saturating_add(Weight::from_parts(60_728_567, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) + } +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_proxy.rs b/runtime/basilisk/src/weights/pallet_proxy.rs new file mode 100644 index 00000000000..199a0ae4f11 --- /dev/null +++ b/runtime/basilisk/src/weights/pallet_proxy.rs @@ -0,0 +1,225 @@ +// This file is part of Basilisk. + +// Copyright (C) 2020-2023 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_proxy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` + +// Executed Command: +// ./target/release/basilisk +// benchmark +// pallet +// --wasm-execution=compiled +// --pallet +// * +// --extrinsic +// * +// --heap-pages +// 4096 +// --steps +// 50 +// --repeat +// 20 +// --template=.maintain/pallet-weight-template-no-back.hbs +// --json-file +// raw.json +// --output +// weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; + +/// Weights for `pallet_proxy`. +pub struct WeightInfo(PhantomData); + +/// Weights for `pallet_proxy` using the Basilisk node and recommended hardware. +pub struct BasiliskWeight(PhantomData); +impl pallet_proxy::WeightInfo for BasiliskWeight { + /// Storage: `Proxy::Proxies` (r:1 w:0) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn proxy(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `194 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 13_060_000 picoseconds. + Weight::from_parts(13_836_892, 4706) + // Standard Error: 2_136 + .saturating_add(Weight::from_parts(47_435, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + } + /// Storage: `Proxy::Proxies` (r:1 w:0) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn proxy_announced(a: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `521 + a * (68 ±0) + p * (37 ±0)` + // Estimated: `5698` + // Minimum execution time: 32_841_000 picoseconds. + Weight::from_parts(32_879_068, 5698) + // Standard Error: 2_407 + .saturating_add(Weight::from_parts(175_388, 0).saturating_mul(a.into())) + // Standard Error: 2_487 + .saturating_add(Weight::from_parts(55_873, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn remove_announcement(a: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `436 + a * (68 ±0)` + // Estimated: `5698` + // Minimum execution time: 22_000_000 picoseconds. + Weight::from_parts(23_493_605, 5698) + // Standard Error: 1_846 + .saturating_add(Weight::from_parts(153_557, 0).saturating_mul(a.into())) + // Standard Error: 1_908 + .saturating_add(Weight::from_parts(12_905, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn reject_announcement(a: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `436 + a * (68 ±0)` + // Estimated: `5698` + // Minimum execution time: 21_960_000 picoseconds. + Weight::from_parts(23_108_597, 5698) + // Standard Error: 1_937 + .saturating_add(Weight::from_parts(163_494, 0).saturating_mul(a.into())) + // Standard Error: 2_001 + .saturating_add(Weight::from_parts(10_529, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Proxy::Proxies` (r:1 w:0) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn announce(a: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `453 + a * (68 ±0) + p * (37 ±0)` + // Estimated: `5698` + // Minimum execution time: 29_211_000 picoseconds. + Weight::from_parts(29_294_988, 5698) + // Standard Error: 1_783 + .saturating_add(Weight::from_parts(161_774, 0).saturating_mul(a.into())) + // Standard Error: 1_842 + .saturating_add(Weight::from_parts(44_272, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn add_proxy(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `194 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 21_110_000 picoseconds. + Weight::from_parts(22_073_066, 4706) + // Standard Error: 2_258 + .saturating_add(Weight::from_parts(60_700, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn remove_proxy(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `194 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 20_950_000 picoseconds. + Weight::from_parts(22_457_790, 4706) + // Standard Error: 3_317 + .saturating_add(Weight::from_parts(47_329, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn remove_proxies(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `194 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 19_960_000 picoseconds. + Weight::from_parts(21_169_089, 4706) + // Standard Error: 1_947 + .saturating_add(Weight::from_parts(64_614, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn create_pure(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `206` + // Estimated: `4706` + // Minimum execution time: 22_741_000 picoseconds. + Weight::from_parts(23_674_536, 4706) + // Standard Error: 2_215 + .saturating_add(Weight::from_parts(54_930, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[0, 30]`. + fn kill_pure(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `231 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 21_321_000 picoseconds. + Weight::from_parts(22_661_788, 4706) + // Standard Error: 2_743 + .saturating_add(Weight::from_parts(50_427, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_scheduler.rs b/runtime/basilisk/src/weights/pallet_scheduler.rs index 9b253b87a7a..c50fe1f21a3 100644 --- a/runtime/basilisk/src/weights/pallet_scheduler.rs +++ b/runtime/basilisk/src/weights/pallet_scheduler.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_scheduler` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -63,8 +65,8 @@ impl pallet_scheduler::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `31` // Estimated: `1489` - // Minimum execution time: 2_590_000 picoseconds. - Weight::from_parts(2_700_000, 1489) + // Minimum execution time: 2_600_000 picoseconds. + Weight::from_parts(2_760_000, 1489) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -75,10 +77,10 @@ impl pallet_scheduler::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `78 + s * (177 ±0)` // Estimated: `42428` - // Minimum execution time: 3_530_000 picoseconds. - Weight::from_parts(6_024_408, 42428) - // Standard Error: 2_720 - .saturating_add(Weight::from_parts(439_995, 0).saturating_mul(s.into())) + // Minimum execution time: 3_590_000 picoseconds. + Weight::from_parts(5_975_558, 42428) + // Standard Error: 2_787 + .saturating_add(Weight::from_parts(450_967, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -86,8 +88,8 @@ impl pallet_scheduler::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_440_000 picoseconds. - Weight::from_parts(3_560_000, 0) + // Minimum execution time: 3_470_000 picoseconds. + Weight::from_parts(3_610_000, 0) } /// Storage: `Preimage::PreimageFor` (r:1 w:1) /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) @@ -100,10 +102,10 @@ impl pallet_scheduler::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `246 + s * (1 ±0)` // Estimated: `3711 + s * (1 ±0)` - // Minimum execution time: 17_790_000 picoseconds. - Weight::from_parts(18_050_000, 3711) + // Minimum execution time: 17_911_000 picoseconds. + Weight::from_parts(18_060_000, 3711) // Standard Error: 1 - .saturating_add(Weight::from_parts(761, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(772, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(s.into())) @@ -114,30 +116,30 @@ impl pallet_scheduler::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_180_000 picoseconds. - Weight::from_parts(5_370_000, 0) + // Minimum execution time: 5_070_000 picoseconds. + Weight::from_parts(5_250_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } fn service_task_periodic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_430_000 picoseconds. - Weight::from_parts(3_580_000, 0) + // Minimum execution time: 3_370_000 picoseconds. + Weight::from_parts(3_470_000, 0) } fn execute_dispatch_signed() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_820_000 picoseconds. - Weight::from_parts(2_951_000, 0) + // Minimum execution time: 2_760_000 picoseconds. + Weight::from_parts(2_870_000, 0) } fn execute_dispatch_unsigned() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_670_000 picoseconds. - Weight::from_parts(2_870_000, 0) + // Minimum execution time: 2_640_000 picoseconds. + Weight::from_parts(2_740_000, 0) } /// Storage: `Scheduler::Agenda` (r:1 w:1) /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(38963), added: 41438, mode: `MaxEncodedLen`) @@ -146,10 +148,10 @@ impl pallet_scheduler::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `78 + s * (177 ±0)` // Estimated: `42428` - // Minimum execution time: 10_750_000 picoseconds. - Weight::from_parts(13_150_807, 42428) - // Standard Error: 2_791 - .saturating_add(Weight::from_parts(469_412, 0).saturating_mul(s.into())) + // Minimum execution time: 10_360_000 picoseconds. + Weight::from_parts(13_060_730, 42428) + // Standard Error: 3_232 + .saturating_add(Weight::from_parts(473_762, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -162,10 +164,10 @@ impl pallet_scheduler::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `78 + s * (177 ±0)` // Estimated: `42428` - // Minimum execution time: 14_860_000 picoseconds. - Weight::from_parts(13_136_918, 42428) - // Standard Error: 3_751 - .saturating_add(Weight::from_parts(722_052, 0).saturating_mul(s.into())) + // Minimum execution time: 14_840_000 picoseconds. + Weight::from_parts(13_169_507, 42428) + // Standard Error: 4_166 + .saturating_add(Weight::from_parts(733_142, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -178,10 +180,10 @@ impl pallet_scheduler::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `255 + s * (185 ±0)` // Estimated: `42428` - // Minimum execution time: 14_030_000 picoseconds. - Weight::from_parts(17_768_924, 42428) - // Standard Error: 4_126 - .saturating_add(Weight::from_parts(482_578, 0).saturating_mul(s.into())) + // Minimum execution time: 13_380_000 picoseconds. + Weight::from_parts(17_008_802, 42428) + // Standard Error: 3_328 + .saturating_add(Weight::from_parts(498_329, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -194,10 +196,10 @@ impl pallet_scheduler::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `281 + s * (185 ±0)` // Estimated: `42428` - // Minimum execution time: 16_900_000 picoseconds. - Weight::from_parts(15_864_942, 42428) - // Standard Error: 3_468 - .saturating_add(Weight::from_parts(739_611, 0).saturating_mul(s.into())) + // Minimum execution time: 15_860_000 picoseconds. + Weight::from_parts(15_298_490, 42428) + // Standard Error: 4_632 + .saturating_add(Weight::from_parts(750_412, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } diff --git a/runtime/basilisk/src/weights/state_trie.rs b/runtime/basilisk/src/weights/pallet_state_trie_migration.rs similarity index 55% rename from runtime/basilisk/src/weights/state_trie.rs rename to runtime/basilisk/src/weights/pallet_state_trie_migration.rs index 863068a8ce8..ca4643e6c35 100644 --- a/runtime/basilisk/src/weights/state_trie.rs +++ b/runtime/basilisk/src/weights/pallet_state_trie_migration.rs @@ -15,51 +15,63 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_state_trie_migration` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-01-26, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --heap-pages +// 4096 +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-state-trie-migration -// --output=weights-1.1.0/state_trie.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_state_trie_migration::weights::WeightInfo; +/// Weights for `pallet_state_trie_migration`. +pub struct WeightInfo(PhantomData); /// Weights for `pallet_state_trie_migration` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); -impl WeightInfo for BasiliskWeight { +impl pallet_state_trie_migration::WeightInfo for BasiliskWeight { /// Storage: `StateTrieMigration::SignedMigrationMaxLimits` (r:1 w:0) /// Proof: `StateTrieMigration::SignedMigrationMaxLimits` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) /// Storage: `StateTrieMigration::MigrationProcess` (r:1 w:1) /// Proof: `StateTrieMigration::MigrationProcess` (`max_values`: Some(1), `max_size`: Some(1042), added: 1537, mode: `MaxEncodedLen`) fn continue_migrate() -> Weight { // Proof Size summary in bytes: // Measured: `141` - // Estimated: `2527` - // Minimum execution time: 23_654_000 picoseconds. - Weight::from_parts(24_101_000, 2527) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Estimated: `3550` + // Minimum execution time: 19_200_000 picoseconds. + Weight::from_parts(20_090_000, 3550) + .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `StateTrieMigration::SignedMigrationMaxLimits` (r:1 w:0) @@ -68,58 +80,69 @@ impl WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `109` // Estimated: `1493` - // Minimum execution time: 7_170_000 picoseconds. - Weight::from_parts(7_487_000, 1493).saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 4_830_000 picoseconds. + Weight::from_parts(5_070_000, 1493) + .saturating_add(T::DbWeight::get().reads(1_u64)) } + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) fn migrate_custom_top_success() -> Weight { // Proof Size summary in bytes: // Measured: `0` - // Estimated: `0` - // Minimum execution time: 13_335_000 picoseconds. - Weight::from_parts(13_596_000, 0) + // Estimated: `3550` + // Minimum execution time: 11_510_000 picoseconds. + Weight::from_parts(12_190_000, 3550) + .saturating_add(T::DbWeight::get().reads(1_u64)) } + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x666f6f` (r:1 w:1) /// Proof: UNKNOWN KEY `0x666f6f` (r:1 w:1) fn migrate_custom_top_fail() -> Weight { // Proof Size summary in bytes: // Measured: `146` // Estimated: `3611` - // Minimum execution time: 40_202_000 picoseconds. - Weight::from_parts(40_793_000, 3611) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 68_381_000 picoseconds. + Weight::from_parts(71_370_000, 3611) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } + /// Storage: `Balances::Holds` (r:1 w:0) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) fn migrate_custom_child_success() -> Weight { // Proof Size summary in bytes: // Measured: `0` - // Estimated: `0` - // Minimum execution time: 13_441_000 picoseconds. - Weight::from_parts(13_910_000, 0) + // Estimated: `3550` + // Minimum execution time: 12_120_000 picoseconds. + Weight::from_parts(12_680_000, 3550) + .saturating_add(T::DbWeight::get().reads(1_u64)) } + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) /// Storage: UNKNOWN KEY `0x666f6f` (r:1 w:1) /// Proof: UNKNOWN KEY `0x666f6f` (r:1 w:1) fn migrate_custom_child_fail() -> Weight { // Proof Size summary in bytes: // Measured: `106` // Estimated: `3571` - // Minimum execution time: 39_284_000 picoseconds. - Weight::from_parts(39_823_000, 3571) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 70_851_000 picoseconds. + Weight::from_parts(72_610_000, 3571) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } /// Storage: UNKNOWN KEY `0x6b6579` (r:1 w:1) /// Proof: UNKNOWN KEY `0x6b6579` (r:1 w:1) /// The range of component `v` is `[1, 4194304]`. - fn process_top_key(v: u32) -> Weight { + fn process_top_key(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `262 + v * (1 ±0)` - // Estimated: `3725 + v * (1 ±0)` - // Minimum execution time: 6_940_000 picoseconds. - Weight::from_parts(7_084_000, 3725) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_372, 0).saturating_mul(v.into())) + // Estimated: `3727 + v * (1 ±0)` + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(5_080_000, 3727) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_081, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(v.into())) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_timestamp.rs b/runtime/basilisk/src/weights/pallet_timestamp.rs index 4523a0c1fb5..050b2708fc4 100644 --- a/runtime/basilisk/src/weights/pallet_timestamp.rs +++ b/runtime/basilisk/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_timestamp` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -63,8 +65,8 @@ impl pallet_timestamp::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `42` // Estimated: `1493` - // Minimum execution time: 5_870_000 picoseconds. - Weight::from_parts(6_220_000, 1493) + // Minimum execution time: 5_520_000 picoseconds. + Weight::from_parts(5_860_000, 1493) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -72,7 +74,7 @@ impl pallet_timestamp::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `94` // Estimated: `0` - // Minimum execution time: 3_920_000 picoseconds. - Weight::from_parts(4_220_000, 0) + // Minimum execution time: 3_750_000 picoseconds. + Weight::from_parts(4_000_000, 0) } } \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_tips.rs b/runtime/basilisk/src/weights/pallet_tips.rs index f114af830b5..23b2391b75d 100644 --- a/runtime/basilisk/src/weights/pallet_tips.rs +++ b/runtime/basilisk/src/weights/pallet_tips.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_tips` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -66,10 +68,10 @@ impl pallet_tips::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `3` // Estimated: `3468` - // Minimum execution time: 25_590_000 picoseconds. - Weight::from_parts(26_538_856, 3468) - // Standard Error: 66 - .saturating_add(Weight::from_parts(1_565, 0).saturating_mul(r.into())) + // Minimum execution time: 26_051_000 picoseconds. + Weight::from_parts(27_276_448, 3468) + // Standard Error: 75 + .saturating_add(Weight::from_parts(939, 0).saturating_mul(r.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -81,7 +83,7 @@ impl pallet_tips::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `220` // Estimated: `3685` - // Minimum execution time: 24_900_000 picoseconds. + // Minimum execution time: 24_430_000 picoseconds. Weight::from_parts(25_470_000, 3685) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -98,12 +100,12 @@ impl pallet_tips::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `238 + t * (64 ±0)` // Estimated: `3703 + t * (64 ±0)` - // Minimum execution time: 17_180_000 picoseconds. - Weight::from_parts(17_986_609, 3703) - // Standard Error: 76 - .saturating_add(Weight::from_parts(1_017, 0).saturating_mul(r.into())) - // Standard Error: 11_903 - .saturating_add(Weight::from_parts(23_479, 0).saturating_mul(t.into())) + // Minimum execution time: 16_460_000 picoseconds. + Weight::from_parts(17_165_076, 3703) + // Standard Error: 66 + .saturating_add(Weight::from_parts(1_672, 0).saturating_mul(r.into())) + // Standard Error: 10_339 + .saturating_add(Weight::from_parts(28_106, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 64).saturating_mul(t.into())) @@ -117,10 +119,10 @@ impl pallet_tips::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `459 + t * (112 ±0)` // Estimated: `3924 + t * (112 ±0)` - // Minimum execution time: 14_120_000 picoseconds. - Weight::from_parts(14_906_539, 3924) - // Standard Error: 4_734 - .saturating_add(Weight::from_parts(79_677, 0).saturating_mul(t.into())) + // Minimum execution time: 14_211_000 picoseconds. + Weight::from_parts(14_878_422, 3924) + // Standard Error: 5_899 + .saturating_add(Weight::from_parts(95_139, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 112).saturating_mul(t.into())) @@ -138,10 +140,10 @@ impl pallet_tips::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `459 + t * (112 ±0)` // Estimated: `3959 + t * (107 ±0)` - // Minimum execution time: 53_530_000 picoseconds. - Weight::from_parts(56_297_054, 3959) - // Standard Error: 20_348 - .saturating_add(Weight::from_parts(48_923, 0).saturating_mul(t.into())) + // Minimum execution time: 55_141_000 picoseconds. + Weight::from_parts(57_753_885, 3959) + // Standard Error: 19_515 + .saturating_add(Weight::from_parts(54_368, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) .saturating_add(Weight::from_parts(0, 107).saturating_mul(t.into())) @@ -155,10 +157,10 @@ impl pallet_tips::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `268` // Estimated: `3733` - // Minimum execution time: 12_050_000 picoseconds. - Weight::from_parts(12_827_372, 3733) - // Standard Error: 5_321 - .saturating_add(Weight::from_parts(23_869, 0).saturating_mul(t.into())) + // Minimum execution time: 11_980_000 picoseconds. + Weight::from_parts(12_871_619, 3733) + // Standard Error: 4_640 + .saturating_add(Weight::from_parts(1_814, 0).saturating_mul(t.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_transaction_multi_payment.rs b/runtime/basilisk/src/weights/pallet_transaction_multi_payment.rs index 209f420b63c..e1e5347bb18 100644 --- a/runtime/basilisk/src/weights/pallet_transaction_multi_payment.rs +++ b/runtime/basilisk/src/weights/pallet_transaction_multi_payment.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_transaction_multi_payment` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -61,10 +63,10 @@ impl pallet_transaction_multi_payment::WeightInfo for B /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn add_currency() -> Weight { // Proof Size summary in bytes: - // Measured: `1131` + // Measured: `1127` // Estimated: `3493` - // Minimum execution time: 30_270_000 picoseconds. - Weight::from_parts(35_271_000, 3493) + // Minimum execution time: 16_640_000 picoseconds. + Weight::from_parts(17_310_000, 3493) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -72,10 +74,10 @@ impl pallet_transaction_multi_payment::WeightInfo for B /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn remove_currency() -> Weight { // Proof Size summary in bytes: - // Measured: `1162` + // Measured: `1158` // Estimated: `3493` - // Minimum execution time: 17_730_000 picoseconds. - Weight::from_parts(18_460_000, 3493) + // Minimum execution time: 17_040_000 picoseconds. + Weight::from_parts(17_660_000, 3493) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -85,10 +87,10 @@ impl pallet_transaction_multi_payment::WeightInfo for B /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) fn set_currency() -> Weight { // Proof Size summary in bytes: - // Measured: `1196` + // Measured: `1192` // Estimated: `3493` - // Minimum execution time: 21_290_000 picoseconds. - Weight::from_parts(21_760_000, 3493) + // Minimum execution time: 19_541_000 picoseconds. + Weight::from_parts(20_540_000, 3493) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -98,14 +100,20 @@ impl pallet_transaction_multi_payment::WeightInfo for B /// Proof: `EmaOracle::Oracles` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) fn get_oracle_price() -> Weight { // Proof Size summary in bytes: - // Measured: `3346` + // Measured: `3342` // Estimated: `27510` - // Minimum execution time: 79_881_000 picoseconds. - Weight::from_parts(83_091_000, 27510) + // Minimum execution time: 77_460_000 picoseconds. + Weight::from_parts(79_771_000, 27510) .saturating_add(T::DbWeight::get().reads(11_u64)) } - + /// Storage: `MultiTransactionPayment::AccountCurrencyMap` (r:0 w:1) + /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) fn reset_payment_currency() -> Weight { - todo!() + // Proof Size summary in bytes: + // Measured: `963` + // Estimated: `0` + // Minimum execution time: 13_920_000 picoseconds. + Weight::from_parts(14_490_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_transaction_pause.rs b/runtime/basilisk/src/weights/pallet_transaction_pause.rs index 742c0a2cb12..9cbaacf3c31 100644 --- a/runtime/basilisk/src/weights/pallet_transaction_pause.rs +++ b/runtime/basilisk/src/weights/pallet_transaction_pause.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_transaction_pause` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -63,8 +65,8 @@ impl pallet_transaction_pause::WeightInfo for BasiliskW // Proof Size summary in bytes: // Measured: `109` // Estimated: `3555` - // Minimum execution time: 9_360_000 picoseconds. - Weight::from_parts(9_601_000, 3555) + // Minimum execution time: 9_020_000 picoseconds. + Weight::from_parts(9_270_000, 3555) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -74,8 +76,8 @@ impl pallet_transaction_pause::WeightInfo for BasiliskW // Proof Size summary in bytes: // Measured: `160` // Estimated: `3555` - // Minimum execution time: 10_460_000 picoseconds. - Weight::from_parts(10_780_000, 3555) + // Minimum execution time: 10_230_000 picoseconds. + Weight::from_parts(10_660_000, 3555) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_treasury.rs b/runtime/basilisk/src/weights/pallet_treasury.rs index c1dd9560c08..4c20b741c67 100644 --- a/runtime/basilisk/src/weights/pallet_treasury.rs +++ b/runtime/basilisk/src/weights/pallet_treasury.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_treasury` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -67,8 +69,8 @@ impl pallet_treasury::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `109` // Estimated: `1887` - // Minimum execution time: 11_460_000 picoseconds. - Weight::from_parts(11_890_000, 1887) + // Minimum execution time: 11_330_000 picoseconds. + Weight::from_parts(12_380_000, 1887) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -80,8 +82,8 @@ impl pallet_treasury::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `210` // Estimated: `1489` - // Minimum execution time: 23_720_000 picoseconds. - Weight::from_parts(24_571_000, 1489) + // Minimum execution time: 23_130_000 picoseconds. + Weight::from_parts(23_910_000, 1489) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -93,8 +95,8 @@ impl pallet_treasury::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `368` // Estimated: `3593` - // Minimum execution time: 33_980_000 picoseconds. - Weight::from_parts(35_130_000, 3593) + // Minimum execution time: 34_300_000 picoseconds. + Weight::from_parts(35_410_000, 3593) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -107,10 +109,10 @@ impl pallet_treasury::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `537 + p * (8 ±0)` // Estimated: `3573` - // Minimum execution time: 8_950_000 picoseconds. - Weight::from_parts(11_766_225, 3573) - // Standard Error: 1_201 - .saturating_add(Weight::from_parts(47_533, 0).saturating_mul(p.into())) + // Minimum execution time: 8_800_000 picoseconds. + Weight::from_parts(11_666_696, 3573) + // Standard Error: 1_137 + .saturating_add(Weight::from_parts(48_763, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,8 +122,8 @@ impl pallet_treasury::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `194` // Estimated: `1887` - // Minimum execution time: 6_850_000 picoseconds. - Weight::from_parts(7_100_000, 1887) + // Minimum execution time: 6_630_000 picoseconds. + Weight::from_parts(6_960_000, 1887) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -140,10 +142,10 @@ impl pallet_treasury::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `44 + p * (250 ±0)` // Estimated: `1887 + p * (5206 ±0)` - // Minimum execution time: 17_031_000 picoseconds. - Weight::from_parts(12_036_751, 1887) - // Standard Error: 26_772 - .saturating_add(Weight::from_parts(33_070_250, 0).saturating_mul(p.into())) + // Minimum execution time: 16_810_000 picoseconds. + Weight::from_parts(20_191_570, 1887) + // Standard Error: 28_181 + .saturating_add(Weight::from_parts(33_762_459, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -158,8 +160,8 @@ impl pallet_treasury::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `109` // Estimated: `1489` - // Minimum execution time: 10_380_000 picoseconds. - Weight::from_parts(11_140_000, 1489) + // Minimum execution time: 10_560_000 picoseconds. + Weight::from_parts(10_800_000, 1489) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -171,8 +173,8 @@ impl pallet_treasury::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `227` // Estimated: `3593` - // Minimum execution time: 48_070_000 picoseconds. - Weight::from_parts(49_191_000, 3593) + // Minimum execution time: 50_131_000 picoseconds. + Weight::from_parts(51_510_000, 3593) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -182,8 +184,8 @@ impl pallet_treasury::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `227` // Estimated: `3534` - // Minimum execution time: 11_950_000 picoseconds. - Weight::from_parts(12_290_000, 3534) + // Minimum execution time: 12_250_000 picoseconds. + Weight::from_parts(12_701_000, 3534) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -193,8 +195,8 @@ impl pallet_treasury::WeightInfo for BasiliskWeight // Proof Size summary in bytes: // Measured: `227` // Estimated: `3534` - // Minimum execution time: 10_790_000 picoseconds. - Weight::from_parts(11_160_000, 3534) + // Minimum execution time: 11_290_000 picoseconds. + Weight::from_parts(11_600_000, 3534) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } diff --git a/runtime/basilisk/src/weights/pallet_utility.rs b/runtime/basilisk/src/weights/pallet_utility.rs index f09e7d966c3..8950c68080e 100644 --- a/runtime/basilisk/src/weights/pallet_utility.rs +++ b/runtime/basilisk/src/weights/pallet_utility.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_utility` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -62,43 +64,43 @@ impl pallet_utility::WeightInfo for BasiliskWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_110_000 picoseconds. - Weight::from_parts(13_801_786, 0) - // Standard Error: 4_068 - .saturating_add(Weight::from_parts(3_451_079, 0).saturating_mul(c.into())) + // Minimum execution time: 4_840_000 picoseconds. + Weight::from_parts(5_598_611, 0) + // Standard Error: 3_829 + .saturating_add(Weight::from_parts(3_430_267, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_080_000 picoseconds. - Weight::from_parts(5_290_000, 0) + // Minimum execution time: 5_060_000 picoseconds. + Weight::from_parts(5_300_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_070_000 picoseconds. - Weight::from_parts(3_220_873, 0) - // Standard Error: 3_696 - .saturating_add(Weight::from_parts(3_725_556, 0).saturating_mul(c.into())) + // Minimum execution time: 4_740_000 picoseconds. + Weight::from_parts(200_861, 0) + // Standard Error: 3_841 + .saturating_add(Weight::from_parts(3_712_542, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_620_000 picoseconds. - Weight::from_parts(7_841_000, 0) + // Minimum execution time: 7_100_000 picoseconds. + Weight::from_parts(7_320_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_240_000 picoseconds. - Weight::from_parts(5_470_000, 0) - // Standard Error: 2_496 - .saturating_add(Weight::from_parts(3_499_415, 0).saturating_mul(c.into())) + // Minimum execution time: 4_740_000 picoseconds. + Weight::from_parts(4_890_000, 0) + // Standard Error: 2_098 + .saturating_add(Weight::from_parts(3_418_311, 0).saturating_mul(c.into())) } } \ No newline at end of file diff --git a/runtime/basilisk/src/weights/xyk.rs b/runtime/basilisk/src/weights/pallet_xyk.rs similarity index 63% rename from runtime/basilisk/src/weights/xyk.rs rename to runtime/basilisk/src/weights/pallet_xyk.rs index 0793385c1e9..e6b65cbf871 100644 --- a/runtime/basilisk/src/weights/xyk.rs +++ b/runtime/basilisk/src/weights/pallet_xyk.rs @@ -15,60 +15,67 @@ // See the License for the specific language governing permissions and // limitations under the License. + //! Autogenerated weights for `pallet_xyk` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-12-06, STEPS: `10`, REPEAT: `30`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bench-bot`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// target/release/basilisk +// ./target/release/basilisk // benchmark // pallet -// --chain=dev -// --steps=10 -// --repeat=30 // --wasm-execution=compiled -// --heap-pages=4096 +// --pallet +// * +// --extrinsic +// * +// --heap-pages +// 4096 +// --steps +// 50 +// --repeat +// 20 // --template=.maintain/pallet-weight-template-no-back.hbs -// --pallet=pallet-xyk -// --output=weights-1.1.0/xyk.rs -// --extrinsic=* +// --json-file +// raw.json +// --output +// weights/ +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] +#![allow(missing_docs)] -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use core::marker::PhantomData; -use pallet_xyk::weights::WeightInfo; +/// Weights for `pallet_xyk`. +pub struct WeightInfo(PhantomData); +/// Weights for `pallet_xyk` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); - -impl WeightInfo for BasiliskWeight { +impl pallet_xyk::WeightInfo for BasiliskWeight { + /// Storage: `AssetRegistry::Assets` (r:2 w:1) + /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) /// Storage: `LBP::PoolData` (r:1 w:0) /// Proof: `LBP::PoolData` (`max_values`: None, `max_size`: Some(163), added: 2638, mode: `MaxEncodedLen`) /// Storage: `XYK::ShareToken` (r:1 w:1) /// Proof: `XYK::ShareToken` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `Tokens::Accounts` (r:5 w:5) + /// Storage: `Tokens::Accounts` (r:6 w:5) /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::AssetIds` (r:1 w:1) /// Proof: `AssetRegistry::AssetIds` (`max_values`: None, `max_size`: Some(53), added: 2528, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::NextAssetId` (r:1 w:1) /// Proof: `AssetRegistry::NextAssetId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `AssetRegistry::Assets` (r:2 w:1) - /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `MultiTransactionPayment::AccountCurrencyMap` (r:2 w:1) + /// Storage: `MultiTransactionPayment::AccountCurrencyMap` (r:2 w:0) /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MultiTransactionPayment::AcceptedCurrencies` (r:1 w:0) + /// Storage: `MultiTransactionPayment::AcceptedCurrencies` (r:2 w:0) /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) /// Storage: `Tokens::TotalIssuance` (r:1 w:1) /// Proof: `Tokens::TotalIssuance` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) @@ -80,16 +87,16 @@ impl WeightInfo for BasiliskWeight { /// Proof: `XYK::PoolAssets` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) fn create_pool() -> Weight { // Proof Size summary in bytes: - // Measured: `1166` - // Estimated: `13905` - // Minimum execution time: 203_748_000 picoseconds. - Weight::from_parts(204_681_000, 13905) - .saturating_add(T::DbWeight::get().reads(17_u64)) - .saturating_add(T::DbWeight::get().writes(16_u64)) + // Measured: `2940` + // Estimated: `16488` + // Minimum execution time: 156_821_000 picoseconds. + Weight::from_parts(160_771_000, 16488) + .saturating_add(T::DbWeight::get().reads(19_u64)) + .saturating_add(T::DbWeight::get().writes(15_u64)) } /// Storage: `XYK::ShareToken` (r:1 w:0) /// Proof: `XYK::ShareToken` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `Tokens::Accounts` (r:5 w:5) + /// Storage: `Tokens::Accounts` (r:6 w:5) /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) /// Storage: `XYK::TotalLiquidity` (r:1 w:1) /// Proof: `XYK::TotalLiquidity` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`) @@ -97,134 +104,148 @@ impl WeightInfo for BasiliskWeight { /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Tokens::TotalIssuance` (r:1 w:1) - /// Proof: `Tokens::TotalIssuance` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) /// Storage: `MultiTransactionPayment::AccountCurrencyMap` (r:1 w:0) /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Tokens::TotalIssuance` (r:1 w:1) + /// Proof: `Tokens::TotalIssuance` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) /// Storage: `EmaOracle::Accumulator` (r:1 w:1) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) fn add_liquidity() -> Weight { // Proof Size summary in bytes: - // Measured: `1731` - // Estimated: `13905` - // Minimum execution time: 175_371_000 picoseconds. - Weight::from_parts(176_317_000, 13905) - .saturating_add(T::DbWeight::get().reads(14_u64)) + // Measured: `3179` + // Estimated: `16488` + // Minimum execution time: 139_101_000 picoseconds. + Weight::from_parts(144_001_000, 16488) + .saturating_add(T::DbWeight::get().reads(15_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) } - /// Storage: `XYK::ShareToken` (r:1 w:0) + /// Storage: `XYK::ShareToken` (r:1 w:1) /// Proof: `XYK::ShareToken` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `XYK::TotalLiquidity` (r:1 w:1) /// Proof: `XYK::TotalLiquidity` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`) - /// Storage: `Tokens::Accounts` (r:5 w:5) + /// Storage: `Tokens::Accounts` (r:6 w:5) /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::Assets` (r:3 w:0) /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:0) + /// Storage: `System::Account` (r:2 w:2) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `MultiTransactionPayment::AccountCurrencyMap` (r:2 w:1) + /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `Tokens::TotalIssuance` (r:1 w:1) /// Proof: `Tokens::TotalIssuance` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) /// Storage: `EmaOracle::Accumulator` (r:1 w:1) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) + /// Storage: `Duster::AccountBlacklist` (r:1 w:1) + /// Proof: `Duster::AccountBlacklist` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `XYK::PoolAssets` (r:0 w:1) + /// Proof: `XYK::PoolAssets` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) fn remove_liquidity() -> Weight { // Proof Size summary in bytes: - // Measured: `1715` - // Estimated: `13905` - // Minimum execution time: 166_551_000 picoseconds. - Weight::from_parts(168_056_000, 13905) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(8_u64)) + // Measured: `3462` + // Estimated: `16488` + // Minimum execution time: 169_081_000 picoseconds. + Weight::from_parts(175_092_000, 16488) + .saturating_add(T::DbWeight::get().reads(18_u64)) + .saturating_add(T::DbWeight::get().writes(14_u64)) } /// Storage: `XYK::ShareToken` (r:1 w:0) /// Proof: `XYK::ShareToken` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `Tokens::Accounts` (r:4 w:4) + /// Storage: `Tokens::Accounts` (r:5 w:4) /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::Assets` (r:2 w:0) /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:0) + /// Storage: `System::Account` (r:2 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `MultiTransactionPayment::AccountCurrencyMap` (r:1 w:0) + /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `EmaOracle::Accumulator` (r:1 w:1) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) fn sell() -> Weight { // Proof Size summary in bytes: - // Measured: `1420` - // Estimated: `11322` - // Minimum execution time: 124_550_000 picoseconds. - Weight::from_parts(125_458_000, 11322) - .saturating_add(T::DbWeight::get().reads(10_u64)) - .saturating_add(T::DbWeight::get().writes(5_u64)) + // Measured: `3036` + // Estimated: `13905` + // Minimum execution time: 111_741_000 picoseconds. + Weight::from_parts(116_010_000, 13905) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: `XYK::ShareToken` (r:1 w:0) /// Proof: `XYK::ShareToken` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `Tokens::Accounts` (r:4 w:4) + /// Storage: `Tokens::Accounts` (r:5 w:4) /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::Assets` (r:2 w:0) /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:0) + /// Storage: `System::Account` (r:2 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `MultiTransactionPayment::AccountCurrencyMap` (r:1 w:0) + /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `EmaOracle::Accumulator` (r:1 w:1) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) fn buy() -> Weight { // Proof Size summary in bytes: - // Measured: `1420` - // Estimated: `11322` - // Minimum execution time: 123_553_000 picoseconds. - Weight::from_parts(124_848_000, 11322) - .saturating_add(T::DbWeight::get().reads(10_u64)) - .saturating_add(T::DbWeight::get().writes(5_u64)) + // Measured: `3036` + // Estimated: `13905` + // Minimum execution time: 111_821_000 picoseconds. + Weight::from_parts(115_791_000, 13905) + .saturating_add(T::DbWeight::get().reads(12_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: `XYK::ShareToken` (r:1 w:0) /// Proof: `XYK::ShareToken` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `Tokens::Accounts` (r:4 w:4) + /// Storage: `Tokens::Accounts` (r:5 w:4) /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::Assets` (r:2 w:0) /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:0) + /// Storage: `System::Account` (r:2 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `MultiTransactionPayment::AccountCurrencyMap` (r:1 w:0) + /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `EmaOracle::Accumulator` (r:1 w:1) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) /// The range of component `c` is `[1, 2]`. /// The range of component `e` is `[0, 1]`. - fn router_execution_sell(c: u32, e: u32) -> Weight { + fn router_execution_sell(c: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `648 + e * (772 ±0)` - // Estimated: `6156 + e * (5166 ±213_489_293_787_578_112)` - // Minimum execution time: 21_419_000 picoseconds. - Weight::from_parts(5_368_826, 6156) - // Standard Error: 43_472 - .saturating_add(Weight::from_parts(8_257_461, 0).saturating_mul(c.into())) - // Standard Error: 43_472 - .saturating_add(Weight::from_parts(111_328_550, 0).saturating_mul(e.into())) + // Measured: `1186 + e * (1850 ±0)` + // Estimated: `6156 + e * (7749 ±2_594_596_928_286_404)` + // Minimum execution time: 17_920_000 picoseconds. + Weight::from_parts(6_703_871, 6156) + // Standard Error: 294_808 + .saturating_add(Weight::from_parts(6_262_722, 0).saturating_mul(c.into())) + // Standard Error: 294_808 + .saturating_add(Weight::from_parts(102_737_983, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(e.into()))) - .saturating_add(T::DbWeight::get().writes((5_u64).saturating_mul(e.into()))) - .saturating_add(Weight::from_parts(0, 5166).saturating_mul(e.into())) + .saturating_add(T::DbWeight::get().reads((9_u64).saturating_mul(e.into()))) + .saturating_add(T::DbWeight::get().writes((6_u64).saturating_mul(e.into()))) + .saturating_add(Weight::from_parts(0, 7749).saturating_mul(e.into())) } /// Storage: `XYK::ShareToken` (r:1 w:0) /// Proof: `XYK::ShareToken` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `Tokens::Accounts` (r:4 w:4) + /// Storage: `Tokens::Accounts` (r:5 w:4) /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::Assets` (r:2 w:0) /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:0) + /// Storage: `System::Account` (r:2 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `MultiTransactionPayment::AccountCurrencyMap` (r:1 w:0) + /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `EmaOracle::Accumulator` (r:1 w:1) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) /// The range of component `c` is `[1, 3]`. /// The range of component `e` is `[0, 1]`. - fn router_execution_buy(c: u32, e: u32) -> Weight { + fn router_execution_buy(c: u32, e: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `648 + e * (772 ±0)` - // Estimated: `6156 + e * (5166 ±0)` - // Minimum execution time: 28_991_000 picoseconds. - Weight::from_parts(6_265_074, 6156) - // Standard Error: 32_211 - .saturating_add(Weight::from_parts(7_766_482, 0).saturating_mul(c.into())) - // Standard Error: 54_650 - .saturating_add(Weight::from_parts(110_694_702, 0).saturating_mul(e.into())) + // Measured: `1186 + e * (1850 ±0)` + // Estimated: `6156 + e * (7749 ±3_757_244_018_954_750)` + // Minimum execution time: 24_280_000 picoseconds. + Weight::from_parts(3_573_959, 6156) + // Standard Error: 102_191 + .saturating_add(Weight::from_parts(7_363_230, 0).saturating_mul(c.into())) + // Standard Error: 170_101 + .saturating_add(Weight::from_parts(103_932_450, 0).saturating_mul(e.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(e.into()))) - .saturating_add(T::DbWeight::get().writes((5_u64).saturating_mul(e.into()))) - .saturating_add(Weight::from_parts(0, 5166).saturating_mul(e.into())) + .saturating_add(T::DbWeight::get().reads((9_u64).saturating_mul(e.into()))) + .saturating_add(T::DbWeight::get().writes((6_u64).saturating_mul(e.into()))) + .saturating_add(Weight::from_parts(0, 7749).saturating_mul(e.into())) } -} +} \ No newline at end of file diff --git a/runtime/basilisk/src/weights/pallet_xyk_liquidity_mining.rs b/runtime/basilisk/src/weights/pallet_xyk_liquidity_mining.rs index 2e4ccf7ba1b..06ff83ace05 100644 --- a/runtime/basilisk/src/weights/pallet_xyk_liquidity_mining.rs +++ b/runtime/basilisk/src/weights/pallet_xyk_liquidity_mining.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for `pallet_xyk_liquidity_mining` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-04-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-04-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `ubuntu`, CPU: `AMD Ryzen 9 5900X 12-Core Processor` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` @@ -33,6 +33,8 @@ // * // --extrinsic // * +// --heap-pages +// 4096 // --steps // 50 // --repeat @@ -71,8 +73,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `506` // Estimated: `6196` - // Minimum execution time: 61_440_000 picoseconds. - Weight::from_parts(62_870_000, 6196) + // Minimum execution time: 63_200_000 picoseconds. + Weight::from_parts(65_850_000, 6196) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -86,8 +88,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `912` // Estimated: `6196` - // Minimum execution time: 65_421_000 picoseconds. - Weight::from_parts(68_121_000, 6196) + // Minimum execution time: 68_080_000 picoseconds. + Weight::from_parts(71_150_000, 6196) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -101,8 +103,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `1002` // Estimated: `6196` - // Minimum execution time: 66_030_000 picoseconds. - Weight::from_parts(68_460_000, 6196) + // Minimum execution time: 68_771_000 picoseconds. + Weight::from_parts(70_911_000, 6196) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -124,8 +126,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `1246` // Estimated: `6196` - // Minimum execution time: 83_390_000 picoseconds. - Weight::from_parts(85_850_000, 6196) + // Minimum execution time: 86_101_000 picoseconds. + Weight::from_parts(89_641_000, 6196) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -145,8 +147,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `1394` // Estimated: `6196` - // Minimum execution time: 86_861_000 picoseconds. - Weight::from_parts(90_321_000, 6196) + // Minimum execution time: 91_961_000 picoseconds. + Weight::from_parts(96_431_000, 6196) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -164,8 +166,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `1228` // Estimated: `6196` - // Minimum execution time: 82_601_000 picoseconds. - Weight::from_parts(84_770_000, 6196) + // Minimum execution time: 87_911_000 picoseconds. + Weight::from_parts(89_611_000, 6196) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -181,8 +183,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `904` // Estimated: `6196` - // Minimum execution time: 69_931_000 picoseconds. - Weight::from_parts(71_261_000, 6196) + // Minimum execution time: 72_831_000 picoseconds. + Weight::from_parts(76_331_000, 6196) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -228,8 +230,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `3259` // Estimated: `11402` - // Minimum execution time: 176_811_000 picoseconds. - Weight::from_parts(183_301_000, 11402) + // Minimum execution time: 182_692_000 picoseconds. + Weight::from_parts(189_742_000, 11402) .saturating_add(T::DbWeight::get().reads(22_u64)) .saturating_add(T::DbWeight::get().writes(13_u64)) } @@ -255,8 +257,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `2363` // Estimated: `3878` - // Minimum execution time: 60_040_000 picoseconds. - Weight::from_parts(62_021_000, 3878) + // Minimum execution time: 61_481_000 picoseconds. + Weight::from_parts(66_390_000, 3878) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -276,8 +278,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `2130` // Estimated: `8799` - // Minimum execution time: 122_691_000 picoseconds. - Weight::from_parts(128_671_000, 8799) + // Minimum execution time: 126_781_000 picoseconds. + Weight::from_parts(131_841_000, 8799) .saturating_add(T::DbWeight::get().reads(8_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -319,8 +321,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `2951` // Estimated: `11402` - // Minimum execution time: 266_432_000 picoseconds. - Weight::from_parts(273_772_000, 11402) + // Minimum execution time: 269_572_000 picoseconds. + Weight::from_parts(284_533_000, 11402) .saturating_add(T::DbWeight::get().reads(19_u64)) .saturating_add(T::DbWeight::get().writes(15_u64)) } @@ -340,8 +342,8 @@ impl pallet_xyk_liquidity_mining::WeightInfo for Basili // Proof Size summary in bytes: // Measured: `1502` // Estimated: `6196` - // Minimum execution time: 87_741_000 picoseconds. - Weight::from_parts(89_331_000, 6196) + // Minimum execution time: 88_080_000 picoseconds. + Weight::from_parts(91_241_000, 6196) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } From a2ba56e3fcf55e89f8792ba201bb0bfb34a78845 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 14:44:12 +0200 Subject: [PATCH 30/56] benchmakrs update --- runtime/basilisk/src/assets.rs | 2 +- runtime/basilisk/src/benchmarking/helper.rs | 25 ++++++- .../src/benchmarking/route_executor.rs | 4 +- runtime/basilisk/src/lib.rs | 4 +- runtime/basilisk/src/weights/mod.rs | 14 ++-- .../basilisk/src/weights/pallet_ema_oracle.rs | 44 ++++++------ .../src/weights/pallet_route_executor.rs | 72 ++++++++++--------- 7 files changed, 97 insertions(+), 68 deletions(-) diff --git a/runtime/basilisk/src/assets.rs b/runtime/basilisk/src/assets.rs index 179da243821..f82c00d1212 100644 --- a/runtime/basilisk/src/assets.rs +++ b/runtime/basilisk/src/assets.rs @@ -662,7 +662,7 @@ impl pallet_ema_oracle::Config for Runtime { type OracleWhitelist = Everything; type MaxUniqueEntries = MaxUniqueOracleEntries; #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = (); //TODO: implement helper + type BenchmarkHelper = benchmarking::BenchmarkHelper; //TODO: implement helper } parameter_types! { diff --git a/runtime/basilisk/src/benchmarking/helper.rs b/runtime/basilisk/src/benchmarking/helper.rs index b83e2ec9dbd..07dd9317f7e 100644 --- a/runtime/basilisk/src/benchmarking/helper.rs +++ b/runtime/basilisk/src/benchmarking/helper.rs @@ -1,5 +1,9 @@ +use crate::AssetRegistry; +use frame_support::dispatch::DispatchResult; +use pallet_asset_registry::traits::InspectRegistry; +use pallet_ema_oracle::BenchmarkHelper as EmaOracleBenchmarkHelper; use pallet_treasury::ArgumentsFactory; -use primitives::AccountId; +use primitives::{AccountId, AssetId}; pub struct BenchmarkHelper; @@ -13,3 +17,22 @@ impl ArgumentsFactory<(), AccountId> for BenchmarkHelper { AccountId::from(seed) } } + +// Ema oracle helper +impl EmaOracleBenchmarkHelper for BenchmarkHelper { + fn register_asset(asset_id: AssetId) -> DispatchResult { + if AssetRegistry::exists(asset_id) { + return Ok(()); + } + + let name = asset_id.to_ne_bytes().to_vec(); + let _ = AssetRegistry::register_asset( + AssetRegistry::to_bounded_name(name)?, + pallet_asset_registry::AssetType::::Token, + 1u128, + Some(asset_id), + None, + )?; + Ok(()) + } +} diff --git a/runtime/basilisk/src/benchmarking/route_executor.rs b/runtime/basilisk/src/benchmarking/route_executor.rs index b3aecca00a8..d48edac63f0 100644 --- a/runtime/basilisk/src/benchmarking/route_executor.rs +++ b/runtime/basilisk/src/benchmarking/route_executor.rs @@ -342,9 +342,7 @@ mod tests { .unwrap(); pallet_asset_registry::GenesisConfig:: { - registered_assets: vec![ - (b"DAI".to_vec(), 1_000, Some(2)), - ], + registered_assets: vec![(b"DAI".to_vec(), 1_000, Some(2))], native_asset_name: b"HDX".to_vec().try_into().unwrap(), native_existential_deposit: NativeExistentialDeposit::get(), } diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index e8796e347ad..cdc397ed56a 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -444,7 +444,7 @@ impl_runtime_apis! { orml_list_benchmark!(list, extra, orml_vesting, benchmarking::vesting); orml_list_benchmark!(list, extra, pallet_duster, benchmarking::duster); orml_list_benchmark!(list, extra, pallet_transaction_multi_payment, benchmarking::multi_payment); - //orml_list_benchmark!(list, extra, pallet_route_executor, benchmarking::route_executor); + orml_list_benchmark!(list, extra, pallet_route_executor, benchmarking::route_executor); orml_list_benchmark!(list, extra, pallet_marketplace, benchmarking::marketplace); let storage_info = AllPalletsWithSystem::storage_info(); @@ -538,7 +538,7 @@ impl_runtime_apis! { orml_add_benchmark!(params, batches, orml_vesting, benchmarking::vesting); orml_add_benchmark!(params, batches, pallet_duster, benchmarking::duster); orml_add_benchmark!(params, batches, pallet_transaction_multi_payment, benchmarking::multi_payment); - //orml_add_benchmark!(params, batches, pallet_route_executor, benchmarking::route_executor); + orml_add_benchmark!(params, batches, pallet_route_executor, benchmarking::route_executor); orml_add_benchmark!(params, batches, pallet_marketplace, benchmarking::marketplace); if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } diff --git a/runtime/basilisk/src/weights/mod.rs b/runtime/basilisk/src/weights/mod.rs index 724974844c9..2d07344bb28 100644 --- a/runtime/basilisk/src/weights/mod.rs +++ b/runtime/basilisk/src/weights/mod.rs @@ -1,9 +1,11 @@ +pub mod cumulus_pallet_parachain_system; pub mod cumulus_pallet_xcmp_queue; pub mod frame_system; pub mod orml_tokens; pub mod orml_vesting; pub mod pallet_asset_registry; pub mod pallet_balances; +pub mod pallet_collator_selection; pub mod pallet_collective; pub mod pallet_currencies; pub mod pallet_democracy; @@ -14,21 +16,19 @@ pub mod pallet_identity; pub mod pallet_lbp; pub mod pallet_marketplace; pub mod pallet_message_queue; +pub mod pallet_multisig; pub mod pallet_nft; +pub mod pallet_preimage; +pub mod pallet_proxy; pub mod pallet_route_executor; pub mod pallet_scheduler; +pub mod pallet_state_trie_migration; pub mod pallet_timestamp; pub mod pallet_tips; pub mod pallet_transaction_multi_payment; pub mod pallet_transaction_pause; pub mod pallet_treasury; pub mod pallet_utility; +pub mod pallet_xyk; pub mod pallet_xyk_liquidity_mining; pub mod xcm; -pub mod pallet_xyk; -pub mod pallet_preimage; -pub mod pallet_multisig; -pub mod pallet_state_trie_migration; -pub mod pallet_proxy; -pub mod cumulus_pallet_parachain_system; -pub mod pallet_collator_selection; diff --git a/runtime/basilisk/src/weights/pallet_ema_oracle.rs b/runtime/basilisk/src/weights/pallet_ema_oracle.rs index c3499871f9e..0f21923473a 100644 --- a/runtime/basilisk/src/weights/pallet_ema_oracle.rs +++ b/runtime/basilisk/src/weights/pallet_ema_oracle.rs @@ -30,7 +30,7 @@ // pallet // --wasm-execution=compiled // --pallet -// * +// pallet-ema-oracle // --extrinsic // * // --heap-pages @@ -43,7 +43,7 @@ // --json-file // raw.json // --output -// weights/ +// weights.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -65,8 +65,8 @@ impl pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_ema_oracle::WeightInfo for BasiliskWeight pallet_route_executor::WeightInfo for BasiliskWeig /// The range of component `c` is `[0, 1]`. fn calculate_and_execute_sell_in_lbp(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2826` + // Measured: `2920` // Estimated: `13905` - // Minimum execution time: 223_582_000 picoseconds. - Weight::from_parts(237_153_622, 13905) - // Standard Error: 1_455_589 - .saturating_add(Weight::from_parts(40_711_777, 0).saturating_mul(c.into())) + // Minimum execution time: 233_581_000 picoseconds. + Weight::from_parts(245_887_677, 13905) + // Standard Error: 2_192_620 + .saturating_add(Weight::from_parts(39_324_522, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -93,14 +95,14 @@ impl pallet_route_executor::WeightInfo for BasiliskWeig /// The range of component `b` is `[0, 1]`. fn calculate_and_execute_buy_in_lbp(c: u32, b: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1567 + b * (1275 ±0)` - // Estimated: `6156 + b * (7749 ±0)` - // Minimum execution time: 56_551_000 picoseconds. - Weight::from_parts(57_780_000, 6156) - // Standard Error: 161_147 - .saturating_add(Weight::from_parts(961_389, 0).saturating_mul(c.into())) - // Standard Error: 358_921 - .saturating_add(Weight::from_parts(175_218_965, 0).saturating_mul(b.into())) + // Measured: `1563 + b * (1367 ±0)` + // Estimated: `6156 + b * (7749 ±7_072_116_491_613_192)` + // Minimum execution time: 58_351_000 picoseconds. + Weight::from_parts(59_930_000, 6156) + // Standard Error: 171_790 + .saturating_add(Weight::from_parts(1_239_175, 0).saturating_mul(c.into())) + // Standard Error: 382_625 + .saturating_add(Weight::from_parts(180_872_519, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((9_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes((7_u64).saturating_mul(b.into()))) @@ -108,33 +110,39 @@ impl pallet_route_executor::WeightInfo for BasiliskWeig } /// Storage: `Router::Routes` (r:1 w:1) /// Proof: `Router::Routes` (`max_values`: None, `max_size`: Some(90), added: 2565, mode: `MaxEncodedLen`) - /// Storage: `Tokens::Accounts` (r:12 w:0) + /// Storage: `System::Account` (r:7 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Tokens::Accounts` (r:15 w:0) /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`) - /// Storage: `Tokens::TotalIssuance` (r:2 w:0) - /// Proof: `Tokens::TotalIssuance` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) - /// Storage: `AssetRegistry::Assets` (r:4 w:0) + /// Storage: `XYK::ShareToken` (r:6 w:0) + /// Proof: `XYK::ShareToken` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `AssetRegistry::Assets` (r:5 w:0) /// Proof: `AssetRegistry::Assets` (`max_values`: None, `max_size`: Some(87), added: 2562, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:5 w:0) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `MultiTransactionPayment::AccountCurrencyMap` (r:1 w:0) /// Proof: `MultiTransactionPayment::AccountCurrencyMap` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `MultiTransactionPayment::AcceptedCurrencies` (r:4 w:0) + /// Storage: `MultiTransactionPayment::AcceptedCurrencies` (r:5 w:0) /// Proof: `MultiTransactionPayment::AcceptedCurrencies` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) - /// Storage: `XYK::ShareToken` (r:4 w:0) - /// Proof: `XYK::ShareToken` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) /// Storage: `EmaOracle::Accumulator` (r:1 w:0) /// Proof: `EmaOracle::Accumulator` (`max_values`: Some(1), `max_size`: Some(4441), added: 4936, mode: `MaxEncodedLen`) + /// Storage: `Tokens::TotalIssuance` (r:1 w:0) + /// Proof: `Tokens::TotalIssuance` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) fn set_route_for_xyk() -> Weight { // Proof Size summary in bytes: - // Measured: `4429` - // Estimated: `31986` - // Minimum execution time: 1_181_351_000 picoseconds. - Weight::from_parts(1_203_741_000, 31986) - .saturating_add(T::DbWeight::get().reads(34_u64)) + // Measured: `5244` + // Estimated: `39735` + // Minimum execution time: 1_518_883_000 picoseconds. + Weight::from_parts(2_317_410_000, 39735) + .saturating_add(T::DbWeight::get().reads(42_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } - + /// Storage: `Router::Routes` (r:0 w:1) + /// Proof: `Router::Routes` (`max_values`: None, `max_size`: Some(90), added: 2565, mode: `MaxEncodedLen`) fn force_insert_route() -> Weight { - todo!() + // Proof Size summary in bytes: + // Measured: `963` + // Estimated: `0` + // Minimum execution time: 23_221_000 picoseconds. + Weight::from_parts(38_020_000, 0) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } \ No newline at end of file From 617fc6ce21f5d0c55caf3fbd2efe6c21c8d9e301 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 15:12:47 +0200 Subject: [PATCH 31/56] update xcm weights --- runtime/basilisk/src/lib.rs | 2 +- runtime/basilisk/src/weights/mod.rs | 2 +- .../src/weights/{xcm.rs => pallet_xcm.rs} | 24 +++++++++++++++---- runtime/basilisk/src/xcm.rs | 2 +- 4 files changed, 23 insertions(+), 7 deletions(-) rename runtime/basilisk/src/weights/{xcm.rs => pallet_xcm.rs} (94%) diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index cdc397ed56a..85ac30a7649 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -575,7 +575,7 @@ mod benches { [cumulus_pallet_parachain_system, ParachainSystem] [pallet_state_trie_migration, StateTrieMigration] [pallet_collator_selection, CollatorSelection] - //[pallet_xcm, PalletXcmExtrinsiscsBenchmark::] + [pallet_xcm, PalletXcmExtrinsiscsBenchmark::] ); } diff --git a/runtime/basilisk/src/weights/mod.rs b/runtime/basilisk/src/weights/mod.rs index 2d07344bb28..53f8c668108 100644 --- a/runtime/basilisk/src/weights/mod.rs +++ b/runtime/basilisk/src/weights/mod.rs @@ -29,6 +29,6 @@ pub mod pallet_transaction_multi_payment; pub mod pallet_transaction_pause; pub mod pallet_treasury; pub mod pallet_utility; +pub mod pallet_xcm; pub mod pallet_xyk; pub mod pallet_xyk_liquidity_mining; -pub mod xcm; diff --git a/runtime/basilisk/src/weights/xcm.rs b/runtime/basilisk/src/weights/pallet_xcm.rs similarity index 94% rename from runtime/basilisk/src/weights/xcm.rs rename to runtime/basilisk/src/weights/pallet_xcm.rs index 24e8a90d0e3..665ce30cb3f 100644 --- a/runtime/basilisk/src/weights/xcm.rs +++ b/runtime/basilisk/src/weights/pallet_xcm.rs @@ -34,7 +34,7 @@ // --heap-pages=4096 // --template=.maintain/pallet-weight-template-no-back.hbs // --pallet=pallet-xcm -// --output=weights-1.1.0/xcm.rs +// --output=weights-1.1.0/pallet_xcm.rs // --extrinsic=* #![allow(unused_parens)] @@ -91,7 +91,11 @@ impl WeightInfo for BasiliskWeight { } fn transfer_assets() -> Weight { - todo!() + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_446_744_073_709_551_000 picoseconds. + Weight::from_parts(18_446_744_073_709_551_000, 0) } fn execute() -> Weight { @@ -271,10 +275,22 @@ impl WeightInfo for BasiliskWeight { } fn new_query() -> Weight { - todo!() + // Proof Size summary in bytes: + // Measured: `69` + // Estimated: `1554` + // Minimum execution time: 4_930_000 picoseconds. + Weight::from_parts(5_220_000, 1554) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } fn take_response() -> Weight { - todo!() + // Proof Size summary in bytes: + // Measured: `7706` + // Estimated: `11171` + // Minimum execution time: 32_740_000 picoseconds. + Weight::from_parts(33_280_000, 11171) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index 16524c185c0..d535bd1305f 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -275,7 +275,7 @@ impl pallet_xcm::Config for Runtime { type TrustedLockers = (); type SovereignAccountOf = (); type MaxLockers = ConstU32<8>; - type WeightInfo = weights::xcm::BasiliskWeight; //TODO: add benchmarks + type WeightInfo = weights::pallet_xcm::BasiliskWeight; type AdminOrigin = SuperMajorityTechCommitteeOrRoot; type MaxRemoteLockConsumers = ConstU32<0>; type RemoteLockConsumerIdentifier = (); From 38f7bf77238060339c730af809bebd4181759f9e Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 15:38:18 +0200 Subject: [PATCH 32/56] resolve compilation warnings --- .maintain/basilisk-bench-data.json | 23 --- .maintain/pallet-weight-template.hbs | 138 ------------------ Cargo.lock | 5 - Cargo.toml | 3 +- node/src/chain_spec.rs | 16 +- node/src/rpc.rs | 1 - runtime/basilisk/src/governance.rs | 20 +-- runtime/basilisk/src/lib.rs | 5 +- runtime/basilisk/src/migrations.rs | 61 -------- runtime/basilisk/src/xcm.rs | 75 +--------- scripts/benchmarking.sh | 3 +- scripts/check_performance.sh | 97 ------------ .../pallet-weight-template.hbs | 0 13 files changed, 27 insertions(+), 420 deletions(-) delete mode 100644 .maintain/basilisk-bench-data.json delete mode 100644 .maintain/pallet-weight-template.hbs delete mode 100644 runtime/basilisk/src/migrations.rs delete mode 100755 scripts/check_performance.sh rename .maintain/pallet-weight-template-no-back.hbs => scripts/pallet-weight-template.hbs (100%) diff --git a/.maintain/basilisk-bench-data.json b/.maintain/basilisk-bench-data.json deleted file mode 100644 index fd7f4432174..00000000000 --- a/.maintain/basilisk-bench-data.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "pallet-xyk": { - "create_pool": 203.5, - "add_liquidity": 163.8, - "remove_liquidity": 156.9, - "sell": 120.0, - "buy": 120.0 - }, - "pallet-exchange": { - "sell_intention": 93.0, - "buy_intention": 92.0, - "sell_extrinsic": 121.0, - "on_finalize_for_one_sell_extrinsic": 160.0, - "buy_extrinsic": 121.0, - "on_finalize_for_one_buy_extrinsic": 169.0 - }, - "pallet-transaction-multi-payment": { - "withdraw_fee_non_native": 87.0, - "set_currency": 106.0, - "add_currency": 17.0, - "remove_currency": 18.0 - } -} diff --git a/.maintain/pallet-weight-template.hbs b/.maintain/pallet-weight-template.hbs deleted file mode 100644 index 53bb8464761..00000000000 --- a/.maintain/pallet-weight-template.hbs +++ /dev/null @@ -1,138 +0,0 @@ -// This file is part of Basilisk. - -// Copyright (C) 2020-2023 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. - -{{header}} -//! Autogenerated weights for `{{pallet}}` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}} -//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: `{{cmd.repeat}}`, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}` -//! WORST CASE MAP SIZE: `{{cmd.worst_case_map_values}}` -//! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}` -//! WASM-EXECUTION: `{{cmd.wasm_execution}}`, CHAIN: `{{cmd.chain}}`, DB CACHE: `{{cmd.db_cache}}` - -// Executed Command: -{{#each args as |arg|}} -// {{arg}} -{{/each}} - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use core::marker::PhantomData; - -/// Weight functions needed for `{{pallet}}`. -pub trait WeightInfo { - {{#each benchmarks as |benchmark|}} - fn {{benchmark.name~}} - ( - {{~#each benchmark.components as |c| ~}} - {{c.name}}: u32, {{/each~}} - ) -> Weight; - {{/each}} -} - -/// Weights for `{{pallet}}` using the Basilisk node and recommended hardware. -pub struct BasiliskWeight(PhantomData); -{{#if (eq pallet "frame_system")}} -impl WeightInfo for BasiliskWeight { -{{else}} -impl WeightInfo for BasiliskWeight { -{{/if}} - {{#each benchmarks as |benchmark|}} - {{#each benchmark.comments as |comment|}} - /// {{comment}} - {{/each}} - {{#each benchmark.component_ranges as |range|}} - /// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`. - {{/each}} - fn {{benchmark.name~}} - ( - {{~#each benchmark.components as |c| ~}} - {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}} - ) -> Weight { - // Proof Size summary in bytes: - // Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` - // Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` - // Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds. - Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}}) - {{#each benchmark.component_weight as |cw|}} - // Standard Error: {{underscore cw.error}} - .saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into())) - {{/each}} - {{#if (ne benchmark.base_reads "0")}} - .saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}_u64)) - {{/if}} - {{#each benchmark.component_reads as |cr|}} - .saturating_add(T::DbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into()))) - {{/each}} - {{#if (ne benchmark.base_writes "0")}} - .saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}_u64)) - {{/if}} - {{#each benchmark.component_writes as |cw|}} - .saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into()))) - {{/each}} - {{#each benchmark.component_calculated_proof_size as |cp|}} - .saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into())) - {{/each}} - } - {{/each}} -} - -// For backwards compatibility and tests. -impl WeightInfo for () { - {{#each benchmarks as |benchmark|}} - {{#each benchmark.comments as |comment|}} - /// {{comment}} - {{/each}} - {{#each benchmark.component_ranges as |range|}} - /// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`. - {{/each}} - fn {{benchmark.name~}} - ( - {{~#each benchmark.components as |c| ~}} - {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}} - ) -> Weight { - // Proof Size summary in bytes: - // Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` - // Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}` - // Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds. - Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}}) - {{#each benchmark.component_weight as |cw|}} - // Standard Error: {{underscore cw.error}} - .saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into())) - {{/each}} - {{#if (ne benchmark.base_reads "0")}} - .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64)) - {{/if}} - {{#each benchmark.component_reads as |cr|}} - .saturating_add(RocksDbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into()))) - {{/each}} - {{#if (ne benchmark.base_writes "0")}} - .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}}_u64)) - {{/if}} - {{#each benchmark.component_writes as |cw|}} - .saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into()))) - {{/each}} - {{#each benchmark.component_calculated_proof_size as |cp|}} - .saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into())) - {{/each}} - } - {{/each}} -} diff --git a/Cargo.lock b/Cargo.lock index 9c71082ed71..ce881db8385 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15960,8 +15960,3 @@ dependencies = [ "cc", "pkg-config", ] - -[[patch.unused]] -name = "sp-core-hashing" -version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.7.2#0d7ca59fd4b4d15f9400971f32bc6a51b2fe837f" diff --git a/Cargo.toml b/Cargo.toml index b797777c9fa..e51e266f484 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -320,8 +320,7 @@ sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", branch = "rel sc-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} -sp-crypto-hashing= { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} -sp-core-hashing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} +sp-crypto-hashing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2"} # Substrate Pallets pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.7.2" } diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 52751cc1884..dca9d915e37 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -114,6 +114,7 @@ pub fn kusama_staging_parachain_config() -> Result { properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into()); properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into()); + #[allow(deprecated)] Ok(ChainSpec::from_genesis( // Name "Basilisk", @@ -122,7 +123,6 @@ pub fn kusama_staging_parachain_config() -> Result { ChainType::Live, move || { parachain_genesis( - wasm_binary, //initial authorities & invulnerables vec![ ( @@ -194,6 +194,7 @@ pub fn testnet_parachain_config() -> Result { properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into()); properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into()); + #[allow(deprecated)] Ok(ChainSpec::from_genesis( // Name "Basilisk Egg", @@ -202,7 +203,6 @@ pub fn testnet_parachain_config() -> Result { ChainType::Live, move || { testnet_parachain_genesis( - wasm_binary, //initial authorities & invulnerables vec![ ( @@ -276,6 +276,7 @@ pub fn parachain_development_config() -> Result { properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into()); properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into()); + #[allow(deprecated)] Ok(ChainSpec::from_genesis( // Name "Basilisk Development", @@ -284,7 +285,6 @@ pub fn parachain_development_config() -> Result { ChainType::Development, move || { testnet_parachain_genesis( - wasm_binary, //initial authorities & invulnerables vec![ ( @@ -348,6 +348,7 @@ pub fn rococo_parachain_config() -> Result { properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into()); properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into()); + #[allow(deprecated)] Ok(ChainSpec::from_genesis( // Name "Basilisk testnet", @@ -356,7 +357,6 @@ pub fn rococo_parachain_config() -> Result { ChainType::Live, move || { testnet_parachain_genesis( - wasm_binary, //initial authorities & invulnerables vec![ ( @@ -425,6 +425,7 @@ pub fn karura_testnet_parachain_config() -> Result { properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into()); properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into()); + #[allow(deprecated)] Ok(ChainSpec::from_genesis( // Name "Basilisk testnet", @@ -433,7 +434,6 @@ pub fn karura_testnet_parachain_config() -> Result { ChainType::Live, move || { testnet_parachain_genesis( - wasm_binary, //initial authorities & invulnerables vec![ ( @@ -500,6 +500,7 @@ pub fn benchmarks_development_config() -> Result { properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into()); properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into()); + #[allow(deprecated)] Ok(ChainSpec::from_genesis( // Name "Basilisk Benchmarks", @@ -508,7 +509,6 @@ pub fn benchmarks_development_config() -> Result { ChainType::Development, move || { testnet_parachain_genesis( - wasm_binary, //initial authorities & invulnerables vec![ ( @@ -570,6 +570,7 @@ pub fn local_parachain_config() -> Result { properties.insert("tokenDecimals".into(), TOKEN_DECIMALS.into()); properties.insert("tokenSymbol".into(), TOKEN_SYMBOL.into()); + #[allow(deprecated)] Ok(ChainSpec::from_genesis( // Name "Basilisk Local Testnet", @@ -578,7 +579,6 @@ pub fn local_parachain_config() -> Result { ChainType::Local, move || { testnet_parachain_genesis( - wasm_binary, //initial authorities & invulnerables vec![ ( @@ -645,7 +645,6 @@ pub fn local_parachain_config() -> Result { /// Configure initial storage state for FRAME modules. fn parachain_genesis( - wasm_binary: &[u8], initial_authorities: Vec<(AccountId, AuraId)>, _endowed_accounts: Vec, _enable_println: bool, @@ -747,7 +746,6 @@ fn parachain_genesis( } fn testnet_parachain_genesis( - wasm_binary: &[u8], initial_authorities: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, _enable_println: bool, diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 35f3a3bec7f..ba274b1901c 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -8,7 +8,6 @@ use std::sync::Arc; use basilisk_runtime::{opaque::Block, AccountId, Balance, Index}; -pub use sc_rpc::SubscriptionTaskExecutor; pub use sc_rpc_api::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; diff --git a/runtime/basilisk/src/governance.rs b/runtime/basilisk/src/governance.rs index 218ce6c74ba..007bb488e0b 100644 --- a/runtime/basilisk/src/governance.rs +++ b/runtime/basilisk/src/governance.rs @@ -22,7 +22,7 @@ use primitives::constants::{ }; use frame_support::traits::fungible::HoldConsideration; -use frame_support::traits::tokens::{Pay, PayFromAccount, PaymentStatus, Preservation, UnityAssetBalanceConversion}; +use frame_support::traits::tokens::{Pay, PaymentStatus, Preservation, UnityAssetBalanceConversion}; use frame_support::traits::{fungible, LinearStoragePrice}; use frame_support::{ parameter_types, @@ -254,9 +254,6 @@ parameter_types! { pub const MaxApprovals: u32 = 100; pub TreasuryAccount: AccountId = Treasury::account_id(); pub const TreasuryPayoutPeriod: u32 = 30 * DAYS; - - #[cfg(feature = "runtime-benchmarks")] - pub const BenchmarkMaxBalance: Balance = Balance::max_value(); } pub struct PayFromTreasuryAccount; @@ -274,8 +271,12 @@ impl Pay for PayFromTreasuryAccount { _asset_kind: Self::AssetKind, amount: Self::Balance, ) -> Result { - let r = - >::transfer(&TreasuryAccount::get(), who, amount, Preservation::Expendable); + let _ = >::transfer( + &TreasuryAccount::get(), + who, + amount, + Preservation::Expendable, + )?; Ok(()) } @@ -287,12 +288,12 @@ impl Pay for PayFromTreasuryAccount { ) -> Result { // In case of benchmarks, we adjust the value by multiplying it by 1_000_000_000_000, otherwise it fails with BelowMinimum limit error, because // treasury benchmarks uses only 100 as the amount. - let r = >::transfer( + let _ = >::transfer( &TreasuryAccount::get(), who, amount * 1_000_000_000_000, Preservation::Expendable, - ); + )?; Ok(()) } @@ -327,7 +328,8 @@ impl pallet_treasury::Config for Runtime { #[cfg(not(feature = "runtime-benchmarks"))] type SpendOrigin = NeverEnsureOrigin; // Disabled, no spending #[cfg(feature = "runtime-benchmarks")] - type SpendOrigin = frame_system::EnsureWithSuccess, AccountId, BenchmarkMaxBalance>; + type SpendOrigin = + frame_system::EnsureWithSuccess, AccountId, crate::benches::BenchmarkMaxBalance>; type AssetKind = (); type Beneficiary = AccountId; type BeneficiaryLookup = IdentityLookup; diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 85ac30a7649..4270f9d5ca5 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -33,7 +33,6 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod tests; mod benchmarking; -mod migrations; pub mod weights; mod adapter; @@ -270,7 +269,6 @@ pub type Executive = frame_executive::Executive< frame_support::migrations::RemovePallet::DbWeight>, cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4, pallet_identity::migration::versioned::V0ToV1, // We have currently 89 identities in basllisk, so limit of 200 should be enough - migrations::OnRuntimeUpgradeMigration, ), >; @@ -549,6 +547,9 @@ impl_runtime_apis! { #[cfg(feature = "runtime-benchmarks")] mod benches { + frame_support::parameter_types! { + pub const BenchmarkMaxBalance: crate::Balance = crate::Balance::max_value(); + } frame_benchmarking::define_benchmarks!( [pallet_lbp, LBP] [pallet_nft, NFT] diff --git a/runtime/basilisk/src/migrations.rs b/runtime/basilisk/src/migrations.rs deleted file mode 100644 index b1a506638f2..00000000000 --- a/runtime/basilisk/src/migrations.rs +++ /dev/null @@ -1,61 +0,0 @@ -use crate::Runtime; -use frame_support::{traits::OnRuntimeUpgrade, weights::Weight}; -#[cfg(feature = "try-runtime")] -use sp_std::prelude::*; - -pub struct OnRuntimeUpgradeMigration; -impl OnRuntimeUpgrade for OnRuntimeUpgradeMigration { - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, sp_runtime::DispatchError> { - /* - log::info!("PreMigrate Collator Selection Pallet start"); - let number_of_invulnerables = pallet_collator_selection::migration::v1::MigrateToV1::::pre_upgrade()?; - log::info!("PreMigrate Collator Selection Pallet end"); - - log::info!("PreMigrate Collator Rewards Pallet start"); - pallet_collator_rewards::migration::v1::pre_migrate::(); - log::info!("PreMigrate Collator Rewards Pallet end"); - - Ok(number_of_invulnerables) - */ - Ok(vec![]) - } - - fn on_runtime_upgrade() -> Weight { - let mut weight: Weight = Weight::zero(); - - /* - log::info!("Migrate Collator Selection Pallet to v1 start"); - weight = weight - .saturating_add(pallet_collator_selection::migration::v1::MigrateToV1::::on_runtime_upgrade()); - log::info!("Migrate Collator Selection Pallet to v1 end"); - - log::info!("Migrate Collator Rewards Pallet to v1 start"); - weight = weight.saturating_add(pallet_collator_rewards::migration::v1::migrate::()); - log::info!("Migrate Collator Rewards Pallet to v1 end"); - - log::info!("Migrate Unknown Tokens Pallet to v2 start"); - weight = weight.saturating_add(orml_unknown_tokens::Migration::::on_runtime_upgrade()); - log::info!("Migrate Unknown Tokens Pallet to v2 end"); - - */ - - weight - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), sp_runtime::DispatchError> { - /* - log::info!("PostMigrate Collator Selection Pallet start"); - let migration_result = pallet_collator_selection::migration::v1::MigrateToV1::::post_upgrade(state); - log::info!("PostMigrate Collator Selection Pallet end"); - - log::info!("PostMigrate Collator Rewards Pallet start"); - pallet_collator_rewards::migration::v1::post_migrate::(); - log::info!("PostMigrate Collator Rewards Pallet end"); - - migration_result - */ - Ok(()) - } -} diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index d535bd1305f..f8ba8c48cf8 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -28,7 +28,6 @@ use frame_support::{ traits::{Contains, Everything, Get, Nothing}, PalletId, }; -use frame_system::EnsureRoot; use hydradx_adapters::xcm_exchange::XcmAssetExchanger; use hydradx_adapters::xcm_execute_filter::AllowTransferAndSwap; use hydradx_adapters::{MultiCurrencyTrader, ToFeeReceiver}; @@ -42,8 +41,8 @@ use polkadot_parachain::primitives::{RelayChainBlockNumber, Sibling}; use polkadot_xcm::latest::{Asset, Junctions, Location}; use polkadot_xcm::prelude::InteriorLocation; use polkadot_xcm::v3::{ - prelude::{AccountId32, Concrete, GeneralIndex, GlobalConsensus, Here, NetworkId, Parachain, X1, X2, X3}, - MultiAsset, MultiLocation, Weight as XcmWeight, + prelude::{Here, NetworkId, Parachain}, + MultiLocation, Weight as XcmWeight, }; use primitives::AssetId; use scale_info::TypeInfo; @@ -376,37 +375,13 @@ impl Convert> for CurrencyIdConvert { } } } - - // Note: keeping the original code for reference until tests are successful - /* - match location { - Location { - parents: p, - interior: [Parachain(id), GeneralIndex(index)].into(), - } if p == 1 && ParaId::from(id) == ParachainInfo::get() && (index as u32) == CORE_ASSET_ID => { - // Handling native asset for this parachain - Some(CORE_ASSET_ID) - } - // handle reanchor canonical location: https://github.com/paritytech/polkadot/pull/4470 - Location { - parents: 0, - interior: [GeneralIndex(index)].into(), - } if (index as u32) == CORE_ASSET_ID => Some(CORE_ASSET_ID), - // delegate to asset-registry - _ => AssetRegistry::location_to_asset(AssetLocation(location)), - } - - */ } } impl Convert> for CurrencyIdConvert { fn convert(asset: Asset) -> Option { - if let Asset { id: asset_id, .. } = asset { - Self::convert(asset_id.0) - } else { - None - } + let Asset { id: asset_id, .. } = asset; + Self::convert(asset_id.0) } } @@ -421,48 +396,6 @@ impl Convert for AccountIdToMultiLocation { } } -/* -impl Convert> for CurrencyIdConvert { - fn convert(location: polkadot_xcm::latest::Location) -> Option { - let polkadot_xcm::latest::Location { parents, interior } = location.clone(); - - match interior { - polkadot_xcm::latest::Junctions::X2(a) - if parents == 1 - && a.contains(&polkadot_xcm::prelude::GeneralIndex(CORE_ASSET_ID.into())) - && a.contains(&polkadot_xcm::prelude::Parachain(ParachainInfo::get().into())) => - { - Some(CORE_ASSET_ID) - } - polkadot_xcm::latest::Junctions::X1(a) if parents == 0 && a.contains(&polkadot_xcm::prelude::GeneralIndex(CORE_ASSET_ID.into())) => Some(CORE_ASSET_ID), - _ => AssetRegistry::location_to_asset(AssetLocation(location.into())), - } - - // Note: keeping the original code for reference until tests are successful - /* - match location { - Location { - parents: p, - interior: [Parachain(id), GeneralIndex(index)].into(), - } if p == 1 && ParaId::from(id) == ParachainInfo::get() && (index as u32) == CORE_ASSET_ID => { - // Handling native asset for this parachain - Some(CORE_ASSET_ID) - } - // handle reanchor canonical location: https://github.com/paritytech/polkadot/pull/4470 - Location { - parents: 0, - interior: [GeneralIndex(index)].into(), - } if (index as u32) == CORE_ASSET_ID => Some(CORE_ASSET_ID), - // delegate to asset-registry - _ => AssetRegistry::location_to_asset(AssetLocation(location)), - } - - */ - } -} - - */ - /// The means for routing XCM messages which are not for local execution into the right message /// queues. pub type XcmRouter = ( diff --git a/scripts/benchmarking.sh b/scripts/benchmarking.sh index 4eb77d5bb4a..7128382d1e3 100644 --- a/scripts/benchmarking.sh +++ b/scripts/benchmarking.sh @@ -62,8 +62,7 @@ function bench { --heap-pages 4096 \ --steps "${STEPS}" \ --repeat "${REPEAT}" \ - --template=.maintain/pallet-weight-template-no-back.hbs \ - --json-file raw.json \ + --template=scripts/pallet-weight-template.hbs \ --output "${OUTPUT}" } diff --git a/scripts/check_performance.sh b/scripts/check_performance.sh deleted file mode 100755 index 4fb9a4a5a91..00000000000 --- a/scripts/check_performance.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash - -# Need to run from the top-level node directory -[ -d ".maintain" ] || { - echo "This script must be executed from the top level node directory" - exit 1 -} - -echo "Basilisk node - Simple Performance check" -echo "---------------------------------------" - -echo -echo "Prerequisites" - -echo -n "Python version >= 3.8 ..... " - -PYTHON=python3 - -command -v $PYTHON >/dev/null 2>&1 || { - echo "python3 required. Please install first" - exit 1 -} - -if ! $PYTHON -c 'import sys; assert sys.version_info >= (3,8)' >/dev/null 2>&1; then - echo "Python version 3.8 or higher required." - exit 1 -fi - -echo "OK ($($PYTHON --version))" - -echo -n "Toolchain ...... " -TOOLCHAIN=$(rustup show active-toolchain) - -if [[ $TOOLCHAIN == "nightly"* ]]; then - echo "OK ($TOOLCHAIN)" -else - echo "Nightly toolchain required" - echo "Current toolchain $TOOLCHAIN" - exit 1 -fi - -EXPECTED_BENCHWIZARD_VERSION="0.5.0" - -echo -n "benchwizard >= $EXPECTED_BENCHWIZARD_VERSION ..... " - -$PYTHON -m bench_wizard >/dev/null 2>&1 || { - echo "benchwizard required. benchwizard is cli tool developed by Basilisk dev to streamline substrate benchmark process." - echo "Installation: pip3 install bench-wizard" - echo - read -p "Do you want to install it now? [Y/n] " -n 1 -r - echo # move to a new line - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 - fi - - pip3 install bench-wizard >/dev/null || { - echo "benchwizard installation failed." - exit 1 - } -} - -CURRENT_BENCH_VERSION=$($PYTHON -m bench_wizard version | tr -d '\n') - -if [[ $EXPECTED_BENCHWIZARD_VERSION > $CURRENT_BENCH_VERSION ]]; then - echo "Please upgrade benchwizard (current version $CURRENT_BENCH_VERSION): pip3 install bench-wizard --upgrade" - read -p "Do you want to upgrade it now? [Y/n] " -n 1 -r - echo # move to a new line - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 - fi - - pip3 install bench-wizard --upgrade >/dev/null || { - echo "benchwizard upgrade failed." - exit 1 - } -fi - -echo "OK ($($PYTHON -m bench_wizard version))" - -echo - -# Run the check -# shellcheck disable=SC2086 -$PYTHON -m bench_wizard pc -p pallet-xyk -p pallet-exchange -p pallet-transaction-multi-payment -rf .maintain/basilisk-bench-data.json - -echo - -# Run DB performance check -echo "Running DB disk performance" -if [ ! -d ./substrate ];then - echo "Cloning substrate ... " - git clone --branch=polkadot-v0.9.12 https://github.com/paritytech/substrate.git ./substrate >/dev/null 2>&1 -fi -$PYTHON -m bench_wizard db -d ./substrate - -echo - diff --git a/.maintain/pallet-weight-template-no-back.hbs b/scripts/pallet-weight-template.hbs similarity index 100% rename from .maintain/pallet-weight-template-no-back.hbs rename to scripts/pallet-weight-template.hbs From d44c86adff0139a69f12273ed9c423af6094eb73 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 15:52:50 +0200 Subject: [PATCH 33/56] resolve compilation warnings --- pallets/marketplace/src/mock.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pallets/marketplace/src/mock.rs b/pallets/marketplace/src/mock.rs index 92a2efbf501..e8a17d8bb8e 100644 --- a/pallets/marketplace/src/mock.rs +++ b/pallets/marketplace/src/mock.rs @@ -6,7 +6,6 @@ use frame_support::{ }; use frame_system as system; use pallet_nft::{CollectionType, NftPermissions}; -pub use primitives::{Amount, AssetId}; use sp_core::storage::Storage; use sp_core::{crypto::AccountId32, H256}; use sp_runtime::{ @@ -14,14 +13,8 @@ use sp_runtime::{ BuildStorage, }; use sp_std::convert::{TryFrom, TryInto}; -use std::borrow::Borrow; use system::EnsureRoot; -mod marketplace { - // Re-export needed for `impl_outer_event!`. - pub use super::super::*; -} - type Block = frame_system::mocking::MockBlock; type AccountId = AccountId32; @@ -211,7 +204,7 @@ impl ExtBuilder { .endowed_accounts .clone() .iter() - .flat_map(|(x, asset)| vec![(x.borrow().clone(), *asset)]) + .flat_map(|(x, asset)| vec![(x.clone(), *asset)]) .collect(), } .assimilate_storage(t) From 8a427d4cf7c6f3a7ef0c3a4d4d1af413a011d662 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 15:54:48 +0200 Subject: [PATCH 34/56] set max tip amount --- runtime/basilisk/src/governance.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/basilisk/src/governance.rs b/runtime/basilisk/src/governance.rs index 007bb488e0b..d326b3d8c70 100644 --- a/runtime/basilisk/src/governance.rs +++ b/runtime/basilisk/src/governance.rs @@ -191,7 +191,7 @@ parameter_types! { pub const TipReportDepositBase: Balance = 10 * DOLLARS; pub const TipReportDepositPerByte: Balance = CENTS; pub const MaximumReasonLength: u32 = 1024; - pub const MaxTipAmount: u128 = 1_000 * DOLLARS; // TODO: check this + pub const MaxTipAmount: u128 = 200_000_000 * 1_000_000_000_000; } impl pallet_tips::Config for Runtime { From 1ae161e76fb4049549252039f7f437a6cd2d08d6 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 15:56:41 +0200 Subject: [PATCH 35/56] remove todo commenets --- runtime/basilisk/src/assets.rs | 4 ++-- runtime/basilisk/src/system.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/basilisk/src/assets.rs b/runtime/basilisk/src/assets.rs index f82c00d1212..e7c95cb6efb 100644 --- a/runtime/basilisk/src/assets.rs +++ b/runtime/basilisk/src/assets.rs @@ -208,7 +208,7 @@ impl pallet_xyk::Config for Runtime { type AssetPairAccountId = AssetPairAccountId; type Currency = Currencies; type NativeAssetId = NativeAssetId; - type WeightInfo = weights::pallet_xyk::BasiliskWeight; //TODO: add benchmakrs + type WeightInfo = weights::pallet_xyk::BasiliskWeight; type GetExchangeFee = ExchangeFee; type MinTradingLimit = MinTradingLimit; type MinPoolLiquidity = MinPoolLiquidity; @@ -662,7 +662,7 @@ impl pallet_ema_oracle::Config for Runtime { type OracleWhitelist = Everything; type MaxUniqueEntries = MaxUniqueOracleEntries; #[cfg(feature = "runtime-benchmarks")] - type BenchmarkHelper = benchmarking::BenchmarkHelper; //TODO: implement helper + type BenchmarkHelper = benchmarking::BenchmarkHelper; } parameter_types! { diff --git a/runtime/basilisk/src/system.rs b/runtime/basilisk/src/system.rs index b97a8a0e46c..2e54c89d758 100644 --- a/runtime/basilisk/src/system.rs +++ b/runtime/basilisk/src/system.rs @@ -276,7 +276,7 @@ impl pallet_transaction_multi_payment::Config for Runtime { type WeightToFee = WeightToFee; type NativeAssetId = NativeAssetId; type EvmAssetId = WethAssetId; - type InspectEvmAccounts = EvmAccounts; //TODO: this does not really work here but needed to set it to something + type InspectEvmAccounts = EvmAccounts; } /// The type used to represent the kinds of proxying allowed. From 86c71a5e66e4b38a2d6e4fd76ddde097f3cc438c Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 16:43:13 +0200 Subject: [PATCH 36/56] benchmarkf features warnings --- Cargo.lock | 22 +++++++++---------- node/Cargo.toml | 2 +- pallets/marketplace/Cargo.toml | 2 +- pallets/xyk-liquidity-mining/Cargo.toml | 2 +- .../benchmarking/Cargo.toml | 2 +- primitives/Cargo.toml | 2 +- .../src/benchmarking/multi_payment.rs | 2 -- runtime/basilisk/src/governance.rs | 5 ++++- runtime/basilisk/src/lib.rs | 9 +++----- runtime/basilisk/src/system.rs | 5 ++++- 10 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ce881db8385..867a5fe9f60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -871,7 +871,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basilisk" -version = "11.1.0" +version = "13.1.0" dependencies = [ "basilisk-runtime", "clap", @@ -903,7 +903,7 @@ dependencies = [ "polkadot-parachain-primitives", "polkadot-primitives", "polkadot-service", - "primitives 6.6.0", + "primitives 6.6.1", "sc-basic-authorship", "sc-block-builder", "sc-chain-spec", @@ -1027,7 +1027,7 @@ dependencies = [ "polkadot-parachain-primitives", "polkadot-runtime-common", "primitive-types", - "primitives 6.6.0", + "primitives 6.6.1", "scale-info", "serde", "smallvec", @@ -7394,7 +7394,7 @@ dependencies = [ [[package]] name = "pallet-marketplace" -version = "5.0.17" +version = "5.0.18" dependencies = [ "frame-benchmarking", "frame-support", @@ -7404,7 +7404,7 @@ dependencies = [ "pallet-uniques", "parity-scale-codec", "pretty_assertions", - "primitives 6.6.0", + "primitives 6.6.1", "scale-info", "serde", "sp-arithmetic", @@ -8276,7 +8276,7 @@ dependencies = [ [[package]] name = "pallet-xyk-liquidity-mining" -version = "1.1.10" +version = "1.1.11" dependencies = [ "frame-support", "frame-system", @@ -8291,7 +8291,7 @@ dependencies = [ "pallet-xyk", "parity-scale-codec", "pretty_assertions", - "primitives 6.6.0", + "primitives 6.6.1", "scale-info", "sp-arithmetic", "sp-core", @@ -8302,7 +8302,7 @@ dependencies = [ [[package]] name = "pallet-xyk-liquidity-mining-benchmarking" -version = "1.0.16" +version = "1.0.17" dependencies = [ "frame-benchmarking", "frame-support", @@ -8319,7 +8319,7 @@ dependencies = [ "pallet-xyk", "pallet-xyk-liquidity-mining", "parity-scale-codec", - "primitives 6.6.0", + "primitives 6.6.1", "scale-info", "sp-arithmetic", "sp-core", @@ -9937,7 +9937,7 @@ dependencies = [ [[package]] name = "primitives" -version = "6.6.0" +version = "6.6.1" dependencies = [ "frame-support", "parity-scale-codec", @@ -10784,7 +10784,7 @@ dependencies = [ "polkadot-runtime-parachains", "polkadot-service", "pretty_assertions", - "primitives 6.6.0", + "primitives 6.6.1", "rococo-runtime", "sc-consensus-grandpa", "sp-api", diff --git a/node/Cargo.toml b/node/Cargo.toml index 2f5b5aebfa7..a2222efa821 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "basilisk" -version = "11.1.0" +version = "13.1.0" description = "Basilisk node" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/marketplace/Cargo.toml b/pallets/marketplace/Cargo.toml index 6721038af94..8afcac86979 100644 --- a/pallets/marketplace/Cargo.toml +++ b/pallets/marketplace/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-marketplace" -version = "5.0.17" +version = "5.0.18" authors = ["GalacticCoucil"] description = "The marketplace for trading NFTs" edition = "2018" diff --git a/pallets/xyk-liquidity-mining/Cargo.toml b/pallets/xyk-liquidity-mining/Cargo.toml index 9a7bb2549a8..e336f9c8cef 100644 --- a/pallets/xyk-liquidity-mining/Cargo.toml +++ b/pallets/xyk-liquidity-mining/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-xyk-liquidity-mining" -version = "1.1.10" +version = "1.1.11" description = "Liquidity mining" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/xyk-liquidity-mining/benchmarking/Cargo.toml b/pallets/xyk-liquidity-mining/benchmarking/Cargo.toml index 8298735570f..a61baf8f038 100644 --- a/pallets/xyk-liquidity-mining/benchmarking/Cargo.toml +++ b/pallets/xyk-liquidity-mining/benchmarking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-xyk-liquidity-mining-benchmarking" -version = "1.0.16" +version = "1.0.17" description = "Liquidity Mining Benchmarking Module" authors = ["GalacticCouncil"] edition = "2021" diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 22a89bdec8a..4e83f9f0a8b 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "primitives" -version = "6.6.0" +version = "6.6.1" authors = ["GalacticCouncil"] edition = "2021" repository = "https://github.com/galacticcouncil/Basilisk-node" diff --git a/runtime/basilisk/src/benchmarking/multi_payment.rs b/runtime/basilisk/src/benchmarking/multi_payment.rs index 809ba5d7cb7..34c61077c43 100644 --- a/runtime/basilisk/src/benchmarking/multi_payment.rs +++ b/runtime/basilisk/src/benchmarking/multi_payment.rs @@ -22,7 +22,6 @@ use frame_benchmarking::BenchmarkError; use frame_support::traits::{OnFinalize, OnInitialize}; use frame_support::{assert_ok, parameter_types}; use frame_system::RawOrigin; -use hydradx_traits::evm::InspectEvmAccounts; use hydradx_traits::router::PoolType; use hydradx_traits::router::RouteProvider; use hydradx_traits::PriceOracle; @@ -30,7 +29,6 @@ use orml_benchmarking::runtime_benchmarks; use orml_traits::MultiCurrencyExtended; use pallet_route_executor::MAX_NUMBER_OF_TRADES; use primitives::{BlockNumber, Price}; -use sp_core::Get; use sp_runtime::traits::SaturatedConversion; use sp_runtime::{FixedPointNumber, FixedU128}; diff --git a/runtime/basilisk/src/governance.rs b/runtime/basilisk/src/governance.rs index d326b3d8c70..d1ace9927a1 100644 --- a/runtime/basilisk/src/governance.rs +++ b/runtime/basilisk/src/governance.rs @@ -27,7 +27,7 @@ use frame_support::traits::{fungible, LinearStoragePrice}; use frame_support::{ parameter_types, sp_runtime::{Perbill, Percent, Permill}, - traits::{EitherOfDiverse, EqualPrivilegeOnly, LockIdentifier, NeverEnsureOrigin}, + traits::{EitherOfDiverse, EqualPrivilegeOnly, LockIdentifier}, PalletId, }; use frame_system::{EnsureRoot, EnsureSigned}; @@ -309,6 +309,9 @@ impl Pay for PayFromTreasuryAccount { fn ensure_concluded(_: Self::Id) {} } +#[cfg(not(feature = "runtime-benchmarks"))] +use frame_support::traits::NeverEnsureOrigin; + impl pallet_treasury::Config for Runtime { type Currency = Balances; type ApproveOrigin = SuperMajorityCouncilOrRoot; diff --git a/runtime/basilisk/src/lib.rs b/runtime/basilisk/src/lib.rs index 4270f9d5ca5..8cdd6ac1886 100644 --- a/runtime/basilisk/src/lib.rs +++ b/runtime/basilisk/src/lib.rs @@ -425,7 +425,7 @@ impl_runtime_apis! { Vec, Vec, ) { - use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList}; + use frame_benchmarking::{Benchmarking, BenchmarkList}; use frame_support::traits::StorageInfoTrait; use orml_benchmarking::list_benchmark as orml_list_benchmark; @@ -452,7 +452,7 @@ impl_runtime_apis! { fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{BenchmarkError, Benchmarking, BenchmarkBatch, add_benchmark}; + use frame_benchmarking::{BenchmarkError, Benchmarking, BenchmarkBatch}; use frame_support::traits::TrackedStorageKey; use orml_benchmarking::add_benchmark as orml_add_benchmark; @@ -478,10 +478,7 @@ impl_runtime_apis! { } use cumulus_primitives_core::ParaId; - use polkadot_xcm::latest::prelude::{ - GeneralIndex, Junction, Junctions, Location, Response, NetworkId, AssetId, - Assets as XcmAssets, Fungible, Asset, ParentThen, Parachain, Parent - }; + use polkadot_xcm::latest::prelude::{Location, AssetId, Fungible, Asset, ParentThen, Parachain, Parent}; impl pallet_xcm::benchmarking::Config for Runtime { fn reachable_dest() -> Option { diff --git a/runtime/basilisk/src/system.rs b/runtime/basilisk/src/system.rs index 2e54c89d758..8fb59df3934 100644 --- a/runtime/basilisk/src/system.rs +++ b/runtime/basilisk/src/system.rs @@ -40,7 +40,7 @@ use frame_support::{ }, PalletId, }; -use frame_system::{EnsureRoot, EnsureSignedBy}; +use frame_system::EnsureRoot; use hydradx_adapters::RelayChainBlockNumberProvider; use hydradx_traits::evm::InspectEvmAccounts; use primitives::constants::time::DAYS; @@ -544,6 +544,9 @@ parameter_types! { #[cfg(feature = "runtime-benchmarks")] use frame_system::EnsureSigned; +#[cfg(not(feature = "runtime-benchmarks"))] +use frame_system::EnsureSignedBy; + impl pallet_state_trie_migration::Config for Runtime { type ControlOrigin = SuperMajorityTechCommitteeOrRoot; #[cfg(feature = "runtime-benchmarks")] From d0edbc603e15742f9253a58b44cfc6455df0fe3c Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 16:59:55 +0200 Subject: [PATCH 37/56] some clippy issues --- pallets/asset-registry/src/lib.rs | 6 +++--- runtime/basilisk/src/benchmarking/helper.rs | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pallets/asset-registry/src/lib.rs b/pallets/asset-registry/src/lib.rs index 057646b6a35..5a1b644593f 100644 --- a/pallets/asset-registry/src/lib.rs +++ b/pallets/asset-registry/src/lib.rs @@ -668,7 +668,7 @@ impl> Inspect for Pallet { } fn decimals(id: Self::AssetId) -> Option { - Self::asset_metadata(id).and_then(|a| Some(a.decimals)) + Self::asset_metadata(id).map(|a| a.decimals) } fn asset_type(id: Self::AssetId) -> Option { @@ -680,11 +680,11 @@ impl> Inspect for Pallet { } fn asset_name(id: Self::AssetId) -> Option> { - Self::assets(id).and_then(|a| Some(a.name.to_vec())) + Self::assets(id).map(|a| a.name.to_vec()) } fn asset_symbol(id: Self::AssetId) -> Option> { - Self::asset_metadata(id).and_then(|a| Some(a.symbol.to_vec())) + Self::asset_metadata(id).map(|a| a.symbol.to_vec()) } fn existential_deposit(id: Self::AssetId) -> Option { diff --git a/runtime/basilisk/src/benchmarking/helper.rs b/runtime/basilisk/src/benchmarking/helper.rs index 07dd9317f7e..270cc6c2879 100644 --- a/runtime/basilisk/src/benchmarking/helper.rs +++ b/runtime/basilisk/src/benchmarking/helper.rs @@ -9,9 +9,7 @@ pub struct BenchmarkHelper; // Support for pallet treasury benchmarking impl ArgumentsFactory<(), AccountId> for BenchmarkHelper { - fn create_asset_kind(_seed: u32) -> () { - () - } + fn create_asset_kind(_seed: u32) { } fn create_beneficiary(seed: [u8; 32]) -> AccountId { AccountId::from(seed) From 2cbd8583930b7e5d3a0145d217ea0528b421c763 Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 25 Apr 2024 17:01:18 +0200 Subject: [PATCH 38/56] fix nft tests by increasing the weight to reach expected tx costs --- runtime/basilisk/src/weights/pallet_nft.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runtime/basilisk/src/weights/pallet_nft.rs b/runtime/basilisk/src/weights/pallet_nft.rs index b625ee33b4d..1430acd73be 100644 --- a/runtime/basilisk/src/weights/pallet_nft.rs +++ b/runtime/basilisk/src/weights/pallet_nft.rs @@ -56,6 +56,9 @@ use core::marker::PhantomData; /// Weights for `pallet_nft`. pub struct WeightInfo(PhantomData); +const CREATE_COLLECTION_OFFSET: u64 = 180 * 3; +const MINT_OFFSET: u64 = 140 * 3; + /// Weights for `pallet_nft` using the Basilisk node and recommended hardware. pub struct BasiliskWeight(PhantomData); impl pallet_nft::WeightInfo for BasiliskWeight { @@ -75,6 +78,7 @@ impl pallet_nft::WeightInfo for BasiliskWeight { // Estimated: `4087` // Minimum execution time: 21_440_000 picoseconds. Weight::from_parts(22_950_000, 4087) + .saturating_mul(CREATE_COLLECTION_OFFSET) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -100,6 +104,7 @@ impl pallet_nft::WeightInfo for BasiliskWeight { // Estimated: `4087` // Minimum execution time: 38_970_000 picoseconds. Weight::from_parts(40_021_000, 4087) + .saturating_mul(MINT_OFFSET) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } From 9eab88632877c4649ed3047af141832c2fdfed94 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 17:02:46 +0200 Subject: [PATCH 39/56] happy clippy happy life --- runtime/basilisk/src/benchmarking/helper.rs | 2 +- runtime/basilisk/src/benchmarking/route_executor.rs | 2 +- runtime/basilisk/src/system.rs | 5 +---- runtime/basilisk/src/xcm.rs | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/runtime/basilisk/src/benchmarking/helper.rs b/runtime/basilisk/src/benchmarking/helper.rs index 270cc6c2879..8e7277b7a28 100644 --- a/runtime/basilisk/src/benchmarking/helper.rs +++ b/runtime/basilisk/src/benchmarking/helper.rs @@ -9,7 +9,7 @@ pub struct BenchmarkHelper; // Support for pallet treasury benchmarking impl ArgumentsFactory<(), AccountId> for BenchmarkHelper { - fn create_asset_kind(_seed: u32) { } + fn create_asset_kind(_seed: u32) {} fn create_beneficiary(seed: [u8; 32]) -> AccountId { AccountId::from(seed) diff --git a/runtime/basilisk/src/benchmarking/route_executor.rs b/runtime/basilisk/src/benchmarking/route_executor.rs index d48edac63f0..cf8d314c00e 100644 --- a/runtime/basilisk/src/benchmarking/route_executor.rs +++ b/runtime/basilisk/src/benchmarking/route_executor.rs @@ -343,7 +343,7 @@ mod tests { pallet_asset_registry::GenesisConfig:: { registered_assets: vec![(b"DAI".to_vec(), 1_000, Some(2))], - native_asset_name: b"HDX".to_vec().try_into().unwrap(), + native_asset_name: b"HDX".to_vec(), native_existential_deposit: NativeExistentialDeposit::get(), } .assimilate_storage(&mut t) diff --git a/runtime/basilisk/src/system.rs b/runtime/basilisk/src/system.rs index 8fb59df3934..322fc9769d5 100644 --- a/runtime/basilisk/src/system.rs +++ b/runtime/basilisk/src/system.rs @@ -232,10 +232,7 @@ impl pallet_transaction_payment::Config for Runtime { pub struct WethAssetId; impl Get for WethAssetId { fn get() -> AssetId { - let invalid_id = - pallet_asset_registry::Pallet::::next_asset_id().defensive_unwrap_or(AssetId::MAX); - - invalid_id + pallet_asset_registry::Pallet::::next_asset_id().defensive_unwrap_or(AssetId::MAX) } } diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index f8ba8c48cf8..86eb16bf230 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -70,7 +70,7 @@ impl TryFrom for AssetLocation { fn try_from(value: Location) -> Result { let loc: MultiLocation = value.try_into()?; - Ok(AssetLocation(loc.into())) + Ok(AssetLocation(loc)) } } From 784ad1a8a07ef847d431d8d29492731f4cae19c4 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Apr 2024 17:04:30 +0200 Subject: [PATCH 40/56] bump versions --- Cargo.lock | 2 +- integration-tests/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 867a5fe9f60..64762289786 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10722,7 +10722,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.0.1" +version = "1.0.2" dependencies = [ "basilisk-runtime", "cumulus-pallet-aura-ext", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 2367d940074..ae5d1da188a 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.0.1" +version = "1.0.2" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" From f6ac70ea39eaf16c58411a322c20e478bfd229d3 Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Thu, 25 Apr 2024 17:59:47 +0200 Subject: [PATCH 41/56] add src component --- rust-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain b/rust-toolchain index dacd22ff583..fa4029d55a7 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,5 +1,5 @@ [toolchain] channel = "1.75.0" -components = [ "rustfmt", "clippy" ] +components = [ "rustfmt", "clippy", "rust-src" ] targets = [ "wasm32-unknown-unknown" ] profile = "minimal" From 70555008889ab8ff9c4b7f8b4d4d77d2539c7475 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 10:44:00 +0200 Subject: [PATCH 42/56] fix imports --- integration-tests/src/cross_chain_transfer.rs | 8 +++++--- integration-tests/src/exchange_asset.rs | 4 +--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/integration-tests/src/cross_chain_transfer.rs b/integration-tests/src/cross_chain_transfer.rs index b36c4c176bd..5c8fc1e6679 100644 --- a/integration-tests/src/cross_chain_transfer.rs +++ b/integration-tests/src/cross_chain_transfer.rs @@ -8,9 +8,11 @@ use polkadot_xcm::{v4::prelude::*, VersionedAssets, VersionedXcm}; use cumulus_primitives_core::ParaId; use orml_traits::currency::MultiCurrency; -use polkadot_xcm::opaque::v3::Junction; -use polkadot_xcm::opaque::v3::Junctions::{X1, X2}; -use polkadot_xcm::opaque::v3::MultiLocation; +use polkadot_xcm::opaque::v3::{ + Junction, + Junctions::{X1, X2}, + MultiLocation, +}; use sp_core::H256; use sp_runtime::traits::{AccountIdConversion, BlakeTwo256, Hash}; use xcm_emulator::TestExt; diff --git a/integration-tests/src/exchange_asset.rs b/integration-tests/src/exchange_asset.rs index 109f208826d..03486f296ad 100644 --- a/integration-tests/src/exchange_asset.rs +++ b/integration-tests/src/exchange_asset.rs @@ -17,9 +17,7 @@ use xcm_emulator::TestExt; use polkadot_xcm::{v4::prelude::*, VersionedXcm}; -use polkadot_xcm::opaque::v3::Junction; -use polkadot_xcm::opaque::v3::Junctions::X2; -use polkadot_xcm::opaque::v3::MultiLocation; +use polkadot_xcm::opaque::v3::{Junction, Junctions::X2, MultiLocation}; use sp_std::sync::Arc; pub const SELL: bool = true; From 90f758ab0c198a6c05c9cf6f214b8d29c48bd7ed Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 11:11:19 +0200 Subject: [PATCH 43/56] simplify asset declaration --- integration-tests/src/exchange_asset.rs | 81 ++++--------------------- 1 file changed, 13 insertions(+), 68 deletions(-) diff --git a/integration-tests/src/exchange_asset.rs b/integration-tests/src/exchange_asset.rs index 03486f296ad..99714db9ec4 100644 --- a/integration-tests/src/exchange_asset.rs +++ b/integration-tests/src/exchange_asset.rs @@ -37,29 +37,12 @@ fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_sell() { }); OtherParachain::execute_with(|| { - let sell_amount: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new( - 0, - cumulus_primitives_core::Junctions::X1(Arc::new( - vec![cumulus_primitives_core::Junction::GeneralIndex(0)] - .try_into() - .unwrap(), - )), - )), - fun: Fungible(5 * UNITS), - }; + let sell_amount: Asset = Asset::from((cumulus_primitives_core::Junction::GeneralIndex(0), 5 * UNITS)); - let min_amount_out: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new( - 0, - cumulus_primitives_core::Junctions::X1(Arc::new( - vec![cumulus_primitives_core::Junction::GeneralIndex(CORE_ASSET_ID.into())] - .try_into() - .unwrap(), - )), - )), - fun: Fungible(2 * UNITS), - }; + let min_amount_out = Asset::from(( + cumulus_primitives_core::Junction::GeneralIndex(CORE_ASSET_ID.into()), + 2 * UNITS, + )); let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>(sell_amount, min_amount_out, SELL); //Act @@ -121,29 +104,11 @@ fn basilisk_should_swap_assets_when_receiving_from_otherchain_with_buy() { let amount_out = 20 * UNITS; OtherParachain::execute_with(|| { - let max_amount_in: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new( - 0, - cumulus_primitives_core::Junctions::X1(Arc::new( - vec![cumulus_primitives_core::Junction::GeneralIndex(0)] - .try_into() - .unwrap(), - )), - )), - fun: Fungible(70 * UNITS), - }; - - let amount_out_asset: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new( - 0, - cumulus_primitives_core::Junctions::X1(Arc::new( - vec![cumulus_primitives_core::Junction::GeneralIndex(CORE_ASSET_ID.into())] - .try_into() - .unwrap(), - )), - )), - fun: Fungible(amount_out), - }; + let max_amount_in: Asset = Asset::from((cumulus_primitives_core::Junction::GeneralIndex(0), 70 * UNITS)); + let amount_out_asset: Asset = Asset::from(( + cumulus_primitives_core::Junction::GeneralIndex(CORE_ASSET_ID.into()), + amount_out, + )); let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>(max_amount_in, amount_out_asset, BUY); //Act @@ -222,29 +187,9 @@ fn basilisk_should_swap_assets_coming_from_karura_when_onchain_route_present() { }); OtherParachain::execute_with(|| { - let amount_in: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new( - 0, - cumulus_primitives_core::Junctions::X1(Arc::new( - vec![cumulus_primitives_core::Junction::GeneralIndex(0)] - .try_into() - .unwrap(), - )), - )), - fun: Fungible(5 * UNITS), - }; - - let min_amount_out: Asset = Asset { - id: cumulus_primitives_core::AssetId(Location::new( - 0, - cumulus_primitives_core::Junctions::X1(Arc::new( - vec![cumulus_primitives_core::Junction::GeneralIndex(KSM.into())] - .try_into() - .unwrap(), - )), - )), - fun: Fungible(2 * UNITS), - }; + let amount_in: Asset = Asset::from((cumulus_primitives_core::Junction::GeneralIndex(0), 5 * UNITS)); + let min_amount_out: Asset = + Asset::from((cumulus_primitives_core::Junction::GeneralIndex(KSM.into()), 2 * UNITS)); let xcm = craft_exchange_asset_xcm::<_, basilisk_runtime::RuntimeCall>(amount_in, min_amount_out, SELL); //Act From 50b055f714fcacc3eabbbe927ca8848ea9a53aef Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 11:17:04 +0200 Subject: [PATCH 44/56] simplify asset declaration --- integration-tests/src/exchange_asset.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/integration-tests/src/exchange_asset.rs b/integration-tests/src/exchange_asset.rs index 99714db9ec4..362fe042721 100644 --- a/integration-tests/src/exchange_asset.rs +++ b/integration-tests/src/exchange_asset.rs @@ -288,20 +288,11 @@ fn craft_exchange_asset_xcm, RC: Decode + GetDispatchInfo>( )), ); - let assets: Assets = Asset { - id: cumulus_primitives_core::AssetId(Location::new( - 0, - cumulus_primitives_core::Junctions::X1(Arc::new( - vec![cumulus_primitives_core::Junction::GeneralIndex(0)] - .try_into() - .unwrap(), - )), - )), - fun: Fungible(100 * UNITS), - } - .into(); + let assets: Assets = Assets::from(Asset::from(( + cumulus_primitives_core::Junction::GeneralIndex(0), + 100 * UNITS, + ))); - //let assets: MultiAssets = MultiAsset::from((cumulus_primitives_core::Junction::GeneralIndex(0), 100 * UNITS)).into(); // hardcoded let max_assets = assets.len() as u32 + 1; let context = cumulus_primitives_core::Junctions::X2(Arc::new( vec![ From 2a528f0ed24f94e0dcd864234b1e2ebe62d16b01 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 11:20:29 +0200 Subject: [PATCH 45/56] rename to rococo as we don't use kusama as relay chain anymore in tests --- integration-tests/src/cross_chain_transfer.rs | 6 +++--- integration-tests/src/kusama_test_net.rs | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/integration-tests/src/cross_chain_transfer.rs b/integration-tests/src/cross_chain_transfer.rs index 5c8fc1e6679..78f1214a02e 100644 --- a/integration-tests/src/cross_chain_transfer.rs +++ b/integration-tests/src/cross_chain_transfer.rs @@ -1,5 +1,5 @@ #![cfg(test)] -use crate::kusama_test_net::Kusama; +use crate::kusama_test_net::Rococo; use crate::kusama_test_net::*; use frame_support::{assert_noop, assert_ok}; @@ -34,7 +34,7 @@ fn basilisk_should_receive_asset_when_transferred_from_relaychain() { basilisk_runtime::AssetLocation(MultiLocation::parent().into()) )); }); - Kusama::execute_with(|| { + Rococo::execute_with(|| { assert_ok!(rococo_runtime::XcmPallet::reserve_transfer_assets( rococo_runtime::RuntimeOrigin::signed(ALICE.into()), Box::new(Parachain(BASILISK_PARA_ID).into_versioned()), @@ -87,7 +87,7 @@ fn relaychain_should_receive_asset_when_transferred_from_basilisk() { ); }); - Kusama::execute_with(|| { + Rococo::execute_with(|| { assert_eq!( rococo_runtime::Balances::free_balance(AccountId::from(BOB)), 2999989698923 // 3 * BSX - fee diff --git a/integration-tests/src/kusama_test_net.rs b/integration-tests/src/kusama_test_net.rs index 0f5aa617e85..27ae7338788 100644 --- a/integration-tests/src/kusama_test_net.rs +++ b/integration-tests/src/kusama_test_net.rs @@ -59,13 +59,13 @@ use primitives::constants::chain::CORE_ASSET_ID; pub use xcm_emulator::Network; use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains}; -pub type Kusama = KusamaRelayChain; +pub type Rococo = RococoRelayChain; pub type Basilisk = BasiliskParachain; pub type OtherParachain = OtherPara; decl_test_networks! { pub struct TestNet { - relay_chain = KusamaRelayChain, + relay_chain = RococoRelayChain, parachains = vec![ OtherPara, BasiliskParachain, @@ -76,8 +76,8 @@ decl_test_networks! { decl_test_relay_chains! { #[api_version(10)] - pub struct KusamaRelayChain { - genesis = kusama::genesis(), + pub struct RococoRelayChain { + genesis = rococo::genesis(), on_init = (), runtime = rococo_runtime, core = { @@ -132,7 +132,7 @@ decl_test_parachains! { } } -pub mod kusama { +pub mod rococo { use super::*; fn get_host_configuration() -> HostConfiguration { @@ -504,7 +504,7 @@ pub fn set_relaychain_block_number(number: BlockNumber) { use basilisk_runtime::ParachainSystem; use basilisk_runtime::RuntimeOrigin; - kusama_run_to_block(number); //We need to set block number this way as well because tarpaulin code coverage tool does not like the way how we set the block number with `cumulus-test-relay-sproof-builder` package + rococo_run_to_block(number); //We need to set block number this way as well because tarpaulin code coverage tool does not like the way how we set the block number with `cumulus-test-relay-sproof-builder` package ParachainSystem::on_initialize(number); @@ -526,7 +526,7 @@ pub fn set_relaychain_block_number(number: BlockNumber) { )); } -pub fn kusama_run_to_block(to: BlockNumber) { +pub fn rococo_run_to_block(to: BlockNumber) { use frame_support::traits::OnFinalize; while rococo_runtime::System::block_number() < to { From b4188934e88021717aa5d36446f1d8ebbc7da7ef Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 11:47:53 +0200 Subject: [PATCH 46/56] add assertion for trapped event --- integration-tests/src/cross_chain_transfer.rs | 10 +++++++++- integration-tests/src/kusama_test_net.rs | 12 ++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/integration-tests/src/cross_chain_transfer.rs b/integration-tests/src/cross_chain_transfer.rs index 78f1214a02e..9f41f724b3b 100644 --- a/integration-tests/src/cross_chain_transfer.rs +++ b/integration-tests/src/cross_chain_transfer.rs @@ -469,8 +469,16 @@ fn assets_should_be_trapped_when_assets_are_unknown() { )), fun: Fungible(30 * UNITS), }; - let hash = determine_hash(&origin, vec![asset]); + let hash = determine_hash(&origin, vec![asset.clone()]); assert_eq!(basilisk_runtime::PolkadotXcm::asset_trap(hash), 1); + + expect_basilisk_event(basilisk_runtime::RuntimeEvent::PolkadotXcm( + pallet_xcm::Event::AssetsTrapped { + hash: hash, + origin: origin.try_into().unwrap(), + assets: vec![asset].into(), + }, + )) }); } diff --git a/integration-tests/src/kusama_test_net.rs b/integration-tests/src/kusama_test_net.rs index 27ae7338788..0bfedca8d11 100644 --- a/integration-tests/src/kusama_test_net.rs +++ b/integration-tests/src/kusama_test_net.rs @@ -485,6 +485,18 @@ pub fn expect_basilisk_events(e: Vec) { assert_eq!(last_basilisk_events(e.len()), e); } +pub fn expect_basilisk_event(e: basilisk_runtime::RuntimeEvent) { + let last_10_events = last_basilisk_events(10); + let mut found = false; + for event in last_10_events { + if event == e { + found = true; + break; + } + } + assert!(found, "Event not found in the last 10 basilisk events"); +} + #[allow(dead_code)] pub fn last_parachain_events(n: usize) -> Vec { frame_system::Pallet::::events() From e97ca67534f97c2def6f317755d6f98250e5b3e6 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 11:51:24 +0200 Subject: [PATCH 47/56] remove unused usings --- integration-tests/src/transact_call_filter.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/integration-tests/src/transact_call_filter.rs b/integration-tests/src/transact_call_filter.rs index 1af30a9d43a..6171af1f9bf 100644 --- a/integration-tests/src/transact_call_filter.rs +++ b/integration-tests/src/transact_call_filter.rs @@ -4,7 +4,6 @@ use crate::kusama_test_net::*; use frame_support::{assert_ok, dispatch::GetDispatchInfo}; use sp_runtime::codec::Encode; -//use polkadot_xcm::v3::prelude::*; use polkadot_xcm::v4::prelude::*; use xcm_emulator::TestExt; From b3ac021a59c14ab20d72d0307d72e08d83961e04 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 11:53:36 +0200 Subject: [PATCH 48/56] remove duplication --- integration-tests/src/transact_call_filter.rs | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/integration-tests/src/transact_call_filter.rs b/integration-tests/src/transact_call_filter.rs index 6171af1f9bf..d232e07ad75 100644 --- a/integration-tests/src/transact_call_filter.rs +++ b/integration-tests/src/transact_call_filter.rs @@ -164,17 +164,10 @@ fn blocked_transact_calls_should_not_pass_filter() { }, ]); - let dest_basilisk = Location::new( - 1, - cumulus_primitives_core::Junctions::X1(Arc::new( - vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)] - .try_into() - .unwrap(), - )), - ); + let dest = basilisk_location(); // Act - assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm(Here, dest_basilisk, message)); + assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm(Here, dest, message)); }); Basilisk::execute_with(|| { @@ -247,19 +240,23 @@ fn safe_call_filter_should_respect_runtime_call_filter() { }, ]); - let dest_basilisk = Location::new( - 1, - cumulus_primitives_core::Junctions::X1(Arc::new( - vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)] - .try_into() - .unwrap(), - )), - ); + let dest = basilisk_location(); // Act - assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm(Here, dest_basilisk, message)); + assert_ok!(basilisk_runtime::PolkadotXcm::send_xcm(Here, dest, message)); }); //Assert Basilisk::execute_with(|| assert_xcm_message_processing_failed()); } + +fn basilisk_location() -> Location { + Location::new( + 1, + cumulus_primitives_core::Junctions::X1(Arc::new( + vec![cumulus_primitives_core::Junction::Parachain(BASILISK_PARA_ID)] + .try_into() + .unwrap(), + )), + ) +} From c53ee9693405d35814f17f662a67137f19ef079c Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 12:12:03 +0200 Subject: [PATCH 49/56] fix package version --- Cargo.lock | 2 +- node/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 64762289786..a74b4407e8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -871,7 +871,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basilisk" -version = "13.1.0" +version = "13.0.0" dependencies = [ "basilisk-runtime", "clap", diff --git a/node/Cargo.toml b/node/Cargo.toml index a2222efa821..f7805d93f7a 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "basilisk" -version = "13.1.0" +version = "13.0.0" description = "Basilisk node" authors = ["GalacticCouncil"] edition = "2021" From b1723017de5d6fbc62bd950b54138b91e52341b0 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 12:32:00 +0200 Subject: [PATCH 50/56] renaming as we use bsx, not hdx --- runtime/basilisk/src/benchmarking/multi_payment.rs | 4 ++-- runtime/basilisk/src/benchmarking/route_executor.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/basilisk/src/benchmarking/multi_payment.rs b/runtime/basilisk/src/benchmarking/multi_payment.rs index 34c61077c43..5291af10789 100644 --- a/runtime/basilisk/src/benchmarking/multi_payment.rs +++ b/runtime/basilisk/src/benchmarking/multi_payment.rs @@ -42,7 +42,7 @@ use hydradx_traits::OraclePeriod; parameter_types! { //NOTE: This should always be > 1 otherwise we will payout more than we collected as ED for //insufficient assets. - pub InsufficientEDinHDX: Balance = FixedU128::from_rational(11, 10) + pub InsufficientEDinBSX: Balance = FixedU128::from_rational(11, 10) .saturating_mul_int(::ExistentialDeposit::get()); } @@ -179,7 +179,7 @@ where RawOrigin::Root.into(), maker.clone(), 0_u32, - InsufficientEDinHDX::get() as i128, + InsufficientEDinBSX::get() as i128, )); assert_ok!(Currencies::update_balance( diff --git a/runtime/basilisk/src/benchmarking/route_executor.rs b/runtime/basilisk/src/benchmarking/route_executor.rs index cf8d314c00e..818a391924e 100644 --- a/runtime/basilisk/src/benchmarking/route_executor.rs +++ b/runtime/basilisk/src/benchmarking/route_executor.rs @@ -38,7 +38,7 @@ const HDX: AssetId = 0; parameter_types! { //NOTE: This should always be > 1 otherwise we will payout more than we collected as ED for //insufficient assets. - pub InsufficientEDinHDX: Balance = FixedU128::from_rational(11, 10) + pub InsufficientEDinBSX: Balance = FixedU128::from_rational(11, 10) .saturating_mul_int(::ExistentialDeposit::get()); } @@ -114,7 +114,7 @@ fn create_xyk_pool(asset_a: u32, asset_b: u32) { RawOrigin::Root.into(), caller.clone(), 0_u32, - InsufficientEDinHDX::get() as i128, + InsufficientEDinBSX::get() as i128, )); let amount = 100000 * UNITS; From 1e9c157e60b737aa7e69fa8f8880488932b49337 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 12:35:21 +0200 Subject: [PATCH 51/56] fix comment --- runtime/basilisk/src/benchmarking/route_executor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/basilisk/src/benchmarking/route_executor.rs b/runtime/basilisk/src/benchmarking/route_executor.rs index 818a391924e..42757042cac 100644 --- a/runtime/basilisk/src/benchmarking/route_executor.rs +++ b/runtime/basilisk/src/benchmarking/route_executor.rs @@ -1,4 +1,4 @@ -// This file is part of HydraDX-node +// This file is part of Basilisk-node // Copyright (C) 2020-2022 Intergalactic, Limited (GIB). // SPDX-License-Identifier: Apache-2.0 From 4e268541e546d80208a0bbabaf47918a5159dad9 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 12:36:40 +0200 Subject: [PATCH 52/56] use bsx as native asset in router benchmark --- runtime/basilisk/src/benchmarking/route_executor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/basilisk/src/benchmarking/route_executor.rs b/runtime/basilisk/src/benchmarking/route_executor.rs index 42757042cac..56d603d7330 100644 --- a/runtime/basilisk/src/benchmarking/route_executor.rs +++ b/runtime/basilisk/src/benchmarking/route_executor.rs @@ -343,7 +343,7 @@ mod tests { pallet_asset_registry::GenesisConfig:: { registered_assets: vec![(b"DAI".to_vec(), 1_000, Some(2))], - native_asset_name: b"HDX".to_vec(), + native_asset_name: b"BSX".to_vec(), native_existential_deposit: NativeExistentialDeposit::get(), } .assimilate_storage(&mut t) From aeae57fba0b15bf42119d93b069dcc625ac9affa Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 12:39:02 +0200 Subject: [PATCH 53/56] use constant for units --- runtime/basilisk/src/governance.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/basilisk/src/governance.rs b/runtime/basilisk/src/governance.rs index d1ace9927a1..c657560c9e0 100644 --- a/runtime/basilisk/src/governance.rs +++ b/runtime/basilisk/src/governance.rs @@ -17,7 +17,7 @@ use super::*; use primitives::constants::{ - currency::{deposit, CENTS, DOLLARS}, + currency::{deposit, CENTS, DOLLARS, UNITS}, time::{DAYS, HOURS}, }; @@ -191,7 +191,7 @@ parameter_types! { pub const TipReportDepositBase: Balance = 10 * DOLLARS; pub const TipReportDepositPerByte: Balance = CENTS; pub const MaximumReasonLength: u32 = 1024; - pub const MaxTipAmount: u128 = 200_000_000 * 1_000_000_000_000; + pub const MaxTipAmount: u128 = 200_000_000 * UNITS; } impl pallet_tips::Config for Runtime { From 1b57de4a9b1bd9219d76e5a16969ff06e52c74b6 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 7 May 2024 12:45:08 +0200 Subject: [PATCH 54/56] simplify using --- integration-tests/src/exchange_asset.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/integration-tests/src/exchange_asset.rs b/integration-tests/src/exchange_asset.rs index 362fe042721..dffbbe24eec 100644 --- a/integration-tests/src/exchange_asset.rs +++ b/integration-tests/src/exchange_asset.rs @@ -10,15 +10,16 @@ use hydradx_traits::router::AssetPair; use hydradx_traits::router::PoolType; use hydradx_traits::router::Trade; use orml_traits::currency::MultiCurrency; +use polkadot_xcm::{ + opaque::v3::{Junction, Junctions::X2, MultiLocation}, + v4::prelude::*, + VersionedXcm, +}; use pretty_assertions::assert_eq; use primitives::constants::chain::CORE_ASSET_ID; use sp_runtime::FixedU128; -use xcm_emulator::TestExt; - -use polkadot_xcm::{v4::prelude::*, VersionedXcm}; - -use polkadot_xcm::opaque::v3::{Junction, Junctions::X2, MultiLocation}; use sp_std::sync::Arc; +use xcm_emulator::TestExt; pub const SELL: bool = true; pub const BUY: bool = false; From 67f712b27e6910d4ef4d9fbae26b91bc6bde5985 Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Tue, 7 May 2024 14:38:06 +0200 Subject: [PATCH 55/56] Update runtime/basilisk/src/xcm.rs Co-authored-by: Richard Roznovjak --- runtime/basilisk/src/xcm.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runtime/basilisk/src/xcm.rs b/runtime/basilisk/src/xcm.rs index 86eb16bf230..7f8fc0a59e7 100644 --- a/runtime/basilisk/src/xcm.rs +++ b/runtime/basilisk/src/xcm.rs @@ -380,8 +380,7 @@ impl Convert> for CurrencyIdConvert { impl Convert> for CurrencyIdConvert { fn convert(asset: Asset) -> Option { - let Asset { id: asset_id, .. } = asset; - Self::convert(asset_id.0) + Self::convert(asset.id.0) } } From b0b0e1d43f705768f564145bcd4969c3866288f1 Mon Sep 17 00:00:00 2001 From: Martin Hloska Date: Tue, 7 May 2024 14:54:54 +0200 Subject: [PATCH 56/56] update identity's bytedeposit --- runtime/basilisk/src/system.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/basilisk/src/system.rs b/runtime/basilisk/src/system.rs index 322fc9769d5..a866388dc97 100644 --- a/runtime/basilisk/src/system.rs +++ b/runtime/basilisk/src/system.rs @@ -477,7 +477,7 @@ impl pallet_collator_rewards::Config for Runtime { parameter_types! { pub const BasicDeposit: Balance = 5 * DOLLARS; - pub const FieldDeposit: Balance = DOLLARS; + pub const ByteDeposit: Balance = DOLLARS / 10; pub const SubAccountDeposit: Balance = 5 * DOLLARS; pub const MaxSubAccounts: u32 = 100; pub const MaxAdditionalFields: u32 = 100; @@ -491,7 +491,7 @@ impl pallet_identity::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Currency = Balances; type BasicDeposit = BasicDeposit; - type ByteDeposit = FieldDeposit; //TODO: correct ?! + type ByteDeposit = ByteDeposit; type SubAccountDeposit = SubAccountDeposit; type MaxSubAccounts = MaxSubAccounts; type IdentityInformation = pallet_identity::legacy::IdentityInfo;