diff --git a/Cargo.lock b/Cargo.lock index 08e392a13..c2d986a7c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,7 +27,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli 0.27.2", + "gimli 0.27.3", ] [[package]] @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", "cipher 0.4.4", @@ -120,7 +120,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "209b47e8954a928e1d72e86eca7000ebb6655fe1436d33eefc2201cad027e237" dependencies = [ "aead 0.5.2", - "aes 0.8.2", + "aes 0.8.3", "cipher 0.4.4", "ctr 0.9.2", "ghash 0.5.0", @@ -153,7 +153,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] @@ -165,7 +165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] @@ -181,9 +181,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -194,6 +194,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4436e0292ab1bb631b42973c61205e704475fe8126af845c8d923c0996328127" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -235,15 +241,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] @@ -314,9 +320,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "asn1-rs" @@ -331,7 +337,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.21", + "time 0.3.22", ] [[package]] @@ -347,7 +353,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.21", + "time 0.3.22", ] [[package]] @@ -411,9 +417,9 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.19", + "rustix 0.37.20", "slab", - "socket2", + "socket2 0.4.9", "waker-fn", ] @@ -434,7 +440,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -490,7 +496,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide 0.6.2", - "object 0.30.3", + "object 0.30.4", "rustc-demangle", ] @@ -520,9 +526,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.1" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f1e31e207a6b8fb791a38ea3105e6cb541f55e4d029902d3039a4ad07cc4105" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "base64ct" @@ -680,7 +686,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec 0.7.4", "constant_time_eq", ] @@ -691,18 +697,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec 0.7.4", "constant_time_eq", ] [[package]] name = "blake3" -version = "1.3.3" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" +checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec 0.7.4", "cc", "cfg-if", "constant_time_eq", @@ -973,13 +979,13 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", "time 0.1.45", "wasm-bindgen", @@ -1084,7 +1090,7 @@ dependencies = [ "bitflags", "clap_derive 3.2.25", "clap_lex 0.2.4", - "indexmap", + "indexmap 1.9.3", "once_cell", "strsim", "termcolor", @@ -1093,20 +1099,20 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.0" +version = "4.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" +checksum = "bba77a07e4489fb41bd90e8d4201c3eb246b3c2c9ea2ba0bddd6c1d1df87db7d" dependencies = [ "clap_builder", - "clap_derive 4.3.0", + "clap_derive 4.3.2", "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.0" +version = "4.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" +checksum = "2c9b4a88bb4bc35d3d6f65a21b0f0bafe9c894fa00978de242c555ec28bea1c0" dependencies = [ "anstream", "anstyle", @@ -1130,14 +1136,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.0" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "191d9573962933b4027f932c600cd252ce27a8ad5979418fe78e43c07996f27b" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -1185,71 +1191,15 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "comfy-table" -version = "6.1.4" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e7b787b0dc42e8111badfdbe4c3059158ccb2db8780352fa1b01e8ccf45cc4d" +checksum = "7e959d788268e3bf9d35ace83e81b124190378e4c91c9067524675e33394b8ba" dependencies = [ "strum", "strum_macros", "unicode-width", ] -[[package]] -name = "common-runtime" -version = "102.5.0" -dependencies = [ - "cumulus-pallet-parachain-system", - "cumulus-pallet-xcmp-queue", - "cumulus-primitives-core", - "frame-support", - "frame-system", - "hydra-dx-math", - "hydradx-traits", - "orml-tokens", - "orml-traits", - "orml-vesting", - "orml-xcm-support", - "pallet-asset-registry", - "pallet-balances", - "pallet-circuit-breaker", - "pallet-claims", - "pallet-collator-selection", - "pallet-collective", - "pallet-currencies", - "pallet-dca", - "pallet-democracy", - "pallet-duster", - "pallet-ema-oracle", - "pallet-identity", - "pallet-liquidity-mining", - "pallet-omnipool", - "pallet-omnipool-liquidity-mining", - "pallet-otc", - "pallet-preimage", - "pallet-proxy", - "pallet-route-executor", - "pallet-scheduler", - "pallet-timestamp", - "pallet-tips", - "pallet-transaction-multi-payment", - "pallet-transaction-pause", - "pallet-transaction-payment", - "pallet-treasury", - "pallet-utility", - "pallet-xcm", - "parity-scale-codec", - "primitive-types", - "primitives", - "scale-info", - "sp-core", - "sp-npos-elections", - "sp-runtime", - "sp-std", - "substrate-wasm-builder", - "xcm", - "xcm-executor", -] - [[package]] name = "concurrent-queue" version = "2.2.0" @@ -1267,9 +1217,9 @@ checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" [[package]] name = "constant_time_eq" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" +checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" [[package]] name = "convert_case" @@ -1323,9 +1273,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" dependencies = [ "libc", ] @@ -1345,7 +1295,7 @@ version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18fed94c8770dc25d01154c3ffa64ed0b3ba9d583736f305fed7beebe5d9cf74" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", @@ -1511,14 +1461,14 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.8.0", + "memoffset 0.9.0", "scopeguard", ] @@ -1534,9 +1484,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -1623,7 +1573,7 @@ name = "cumulus-client-cli" version = "0.1.0" source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" dependencies = [ - "clap 4.3.0", + "clap 4.3.9", "parity-scale-codec", "sc-chain-spec", "sc-cli", @@ -2153,9 +2103,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.94" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" +checksum = "e88abab2f5abbe4c56e8f1fb431b784d710b709888f35755a160e62e33fe38e8" dependencies = [ "cc", "cxxbridge-flags", @@ -2165,9 +2115,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.94" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" +checksum = "5c0c11acd0e63bae27dcd2afced407063312771212b7a823b4fd72d633be30fb" dependencies = [ "cc", "codespan-reporting", @@ -2175,24 +2125,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] name = "cxxbridge-flags" -version = "1.0.94" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" +checksum = "8d3816ed957c008ccd4728485511e3d9aaf7db419aa321e3d2c5a2f3411e36c8" [[package]] name = "cxxbridge-macro" -version = "1.0.94" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" +checksum = "a26acccf6f445af85ea056362561a24ef56cdc15fcc685f03aec50b9c702cb6d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -2451,7 +2401,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -2605,7 +2555,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -2616,7 +2566,7 @@ checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -2651,6 +2601,12 @@ version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" +[[package]] +name = "equivalent" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" + [[package]] name = "errno" version = "0.2.8" @@ -2761,7 +2717,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5aa1e3ae159e592ad222dc90c5acbad632b527779ba88486abe92782ab268bd" dependencies = [ "expander 0.0.4", - "indexmap", + "indexmap 1.9.3", "proc-macro-crate", "proc-macro2", "quote", @@ -2905,9 +2861,9 @@ dependencies = [ [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -2951,7 +2907,7 @@ dependencies = [ "Inflector", "array-bytes 4.2.0", "chrono", - "clap 4.3.0", + "clap 4.3.9", "comfy-table", "frame-benchmarking", "frame-support", @@ -3280,7 +3236,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -3381,9 +3337,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -3407,7 +3363,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" dependencies = [ "opaque-debug 0.3.0", - "polyval 0.6.0", + "polyval 0.6.1", ] [[package]] @@ -3417,15 +3373,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ "fallible-iterator", - "indexmap", + "indexmap 1.9.3", "stable_deref_trait", ] [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "glob" @@ -3489,9 +3445,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" dependencies = [ "bytes", "fnv", @@ -3499,7 +3455,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -3559,6 +3515,12 @@ dependencies = [ "ahash 0.8.3", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "heck" version = "0.4.1" @@ -3744,10 +3706,9 @@ dependencies = [ [[package]] name = "hydradx" -version = "10.0.0" +version = "10.0.1" dependencies = [ - "clap 4.3.0", - "common-runtime", + "clap 4.3.9", "cumulus-client-cli", "cumulus-client-collator", "cumulus-client-consensus-aura", @@ -3838,9 +3799,8 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "162.0.0" +version = "163.0.0" dependencies = [ - "common-runtime", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", @@ -3858,6 +3818,7 @@ dependencies = [ "frame-system-rpc-runtime-api", "frame-try-runtime", "hex-literal 0.3.4", + "hydra-dx-math", "hydradx-adapters", "hydradx-traits", "orml-benchmarking", @@ -3909,6 +3870,7 @@ dependencies = [ "parachain-info", "parity-scale-codec", "polkadot-parachain", + "primitive-types", "primitives", "scale-info", "serde", @@ -3949,9 +3911,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.26" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -3964,7 +3926,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite 0.2.9", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -3988,9 +3950,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -4028,9 +3990,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -4105,6 +4067,16 @@ dependencies = [ "serde", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + [[package]] name = "inout" version = "0.1.3" @@ -4165,9 +4137,9 @@ checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", @@ -4182,21 +4154,21 @@ checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" [[package]] name = "ipconfig" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd302af1b90f2463a98fa5ad469fc212c8e3175a41c3068601bfa2727591c5be" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2", + "socket2 0.5.3", "widestring", - "winapi", + "windows-sys 0.48.0", "winreg", ] [[package]] name = "ipnet" -version = "2.7.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" @@ -4205,8 +4177,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", - "io-lifetimes 1.0.10", - "rustix 0.37.19", + "io-lifetimes 1.0.11", + "rustix 0.37.20", "windows-sys 0.48.0", ] @@ -4236,9 +4208,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -4299,7 +4271,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3dc3e9cf2ba50b7b1d7d76a667619f82846caa39e8e8daa8a4962d74acaddca" dependencies = [ "anyhow", - "arrayvec 0.7.2", + "arrayvec 0.7.4", "async-trait", "beef", "futures-channel", @@ -4328,7 +4300,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" dependencies = [ "anyhow", - "arrayvec 0.7.2", + "arrayvec 0.7.4", "async-lock", "async-trait", "beef", @@ -4483,7 +4455,7 @@ dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -4656,9 +4628,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libloading" @@ -4691,7 +4663,7 @@ dependencies = [ "bytes", "futures", "futures-timer", - "getrandom 0.2.9", + "getrandom 0.2.10", "instant", "libp2p-core 0.38.0", "libp2p-dns", @@ -4742,7 +4714,7 @@ dependencies = [ "rand 0.8.5", "rw-stream-sink", "sec1", - "sha2 0.10.6", + "sha2 0.10.7", "smallvec", "thiserror", "unsigned-varint", @@ -4826,7 +4798,7 @@ dependencies = [ "multihash 0.17.0", "quick-protobuf", "rand 0.8.5", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", "zeroize", ] @@ -4837,7 +4809,7 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2766dcd2be8c87d5e1f35487deb22d765f49c6ae1251b3633efe3b25698bd3d2" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "asynchronous-codec", "bytes", "either", @@ -4851,7 +4823,7 @@ dependencies = [ "prost", "prost-build", "rand 0.8.5", - "sha2 0.10.6", + "sha2 0.10.7", "smallvec", "thiserror", "uint", @@ -4873,7 +4845,7 @@ dependencies = [ "log", "rand 0.8.5", "smallvec", - "socket2", + "socket2 0.4.9", "tokio", "trust-dns-proto", "void", @@ -4926,7 +4898,7 @@ dependencies = [ "prost", "prost-build", "rand 0.8.5", - "sha2 0.10.6", + "sha2 0.10.7", "snow", "static_assertions", "thiserror", @@ -5034,7 +5006,7 @@ dependencies = [ "libc", "libp2p-core 0.38.0", "log", - "socket2", + "socket2 0.4.9", "tokio", ] @@ -5257,9 +5229,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -5267,12 +5239,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "lru" @@ -5382,7 +5351,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix 0.37.19", + "rustix 0.37.20", ] [[package]] @@ -5414,9 +5383,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -5486,14 +5455,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -5618,7 +5586,7 @@ dependencies = [ "core2", "digest 0.10.7", "multihash-derive", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "unsigned-varint", ] @@ -5852,7 +5820,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "itoa", ] @@ -5906,15 +5874,15 @@ checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "crc32fast", "hashbrown 0.12.3", - "indexmap", + "indexmap 1.9.3", "memchr", ] [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "memchr", ] @@ -5939,9 +5907,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "oorandom" @@ -6173,9 +6141,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.5.0" +version = "6.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" +checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" [[package]] name = "output_vt100" @@ -6194,7 +6162,7 @@ checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" dependencies = [ "ecdsa", "elliptic-curve", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -6205,7 +6173,7 @@ checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" dependencies = [ "ecdsa", "elliptic-curve", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -7705,11 +7673,11 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.5.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28" +checksum = "2287753623c76f953acd29d15d8100bcab84d29db78fb6f352adb3c53e83b967" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "bitvec", "byte-slice-cast", "bytes", @@ -7720,9 +7688,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.4" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" +checksum = "2b6937b5e67bfba3351b87b040d48352a2fcb6ad72f81855412ce97b45c8f110" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7766,7 +7734,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.7", + "parking_lot_core 0.9.8", ] [[package]] @@ -7785,15 +7753,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets", ] [[package]] @@ -7846,15 +7814,15 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" +checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" dependencies = [ "thiserror", "ucd-trie", @@ -7862,9 +7830,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" +checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" dependencies = [ "pest", "pest_generator", @@ -7872,26 +7840,26 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" +checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] name = "pest_meta" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" +checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" dependencies = [ "once_cell", "pest", - "sha2 0.10.6", + "sha2 0.10.7", ] [[package]] @@ -7901,7 +7869,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" dependencies = [ "fixedbitset 0.2.0", - "indexmap", + "indexmap 1.9.3", ] [[package]] @@ -7911,7 +7879,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset 0.4.2", - "indexmap", + "indexmap 1.9.3", ] [[package]] @@ -7931,7 +7899,7 @@ checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -7988,9 +7956,9 @@ checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" [[package]] name = "plotters" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b639e642295546c50fcd545198c9d64ee2a38620a628724a3b266d5fbf97" +checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" dependencies = [ "num-traits", "plotters-backend", @@ -8001,15 +7969,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193228616381fecdc1224c62e96946dfbc73ff4384fba576e052ff8c1bea8142" +checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" [[package]] name = "plotters-svg" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a81d2759aae1dae668f783c308bc5c8ebd191ff4184aaa1b37f65a6ae5a56f" +checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" dependencies = [ "plotters-backend", ] @@ -8092,7 +8060,7 @@ name = "polkadot-cli" version = "0.9.38" source = "git+https://github.com/galacticcouncil/polkadot?branch=fix-xcm-executor-atomicity-9-38#a225599ab533bb5f7913429690e5c12ee3cff5ba" dependencies = [ - "clap 4.3.0", + "clap 4.3.9", "frame-benchmarking-cli", "futures", "log", @@ -8200,7 +8168,7 @@ dependencies = [ "fatality", "futures", "futures-timer", - "indexmap", + "indexmap 1.9.3", "lru 0.9.0", "parity-scale-codec", "polkadot-erasure-coding", @@ -9187,7 +9155,7 @@ dependencies = [ "arrayvec 0.5.2", "fatality", "futures", - "indexmap", + "indexmap 1.9.3", "parity-scale-codec", "polkadot-node-network-protocol", "polkadot-node-primitives", @@ -9251,9 +9219,9 @@ dependencies = [ [[package]] name = "polyval" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef234e08c11dfcb2e56f79fd70f6f2eb7f025c0ce2333e82f4f0518ecad30c6" +checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" dependencies = [ "cfg-if", "cpufeatures", @@ -9334,7 +9302,7 @@ dependencies = [ [[package]] name = "primitives" -version = "5.7.3" +version = "5.8.0" dependencies = [ "frame-support", "hex-literal 0.3.4", @@ -9342,6 +9310,7 @@ dependencies = [ "polkadot-primitives", "scale-info", "serde", + "sp-core", "static_assertions", ] @@ -9397,9 +9366,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.58" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] @@ -9443,16 +9412,15 @@ dependencies = [ [[package]] name = "proptest" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f1b898011ce9595050a68e60f90bad083ff2987a695a42357134c8381fba70" +checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" dependencies = [ "bit-set", "bitflags", "byteorder", "lazy_static", "num-traits", - "quick-error 2.0.1", "rand 0.8.5", "rand_chacha 0.3.1", "rand_xorshift", @@ -9544,12 +9512,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quick-protobuf" version = "0.8.1" @@ -9590,9 +9552,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.27" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] @@ -9662,7 +9624,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -9747,7 +9709,7 @@ checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" dependencies = [ "pem", "ring", - "time 0.3.21", + "time 0.3.22", "x509-parser 0.13.2", "yasna", ] @@ -9760,7 +9722,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ "pem", "ring", - "time 0.3.21", + "time 0.3.22", "yasna", ] @@ -9788,7 +9750,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "redox_syscall 0.2.16", "thiserror", ] @@ -9823,7 +9785,7 @@ checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -9840,11 +9802,11 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.2" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1a59b5d8e97dee33696bf13c5ba8ab85341c002922fba050069326b9c498974" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ - "aho-corasick 1.0.1", + "aho-corasick 1.0.2", "memchr", "regex-syntax 0.7.2", ] @@ -9877,7 +9839,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ "hostname", - "quick-error 1.2.3", + "quick-error", ] [[package]] @@ -10092,9 +10054,8 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.7.16" +version = "1.7.17" dependencies = [ - "common-runtime", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", @@ -10235,13 +10196,13 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ "bitflags", "errno 0.3.1", - "io-lifetimes 1.0.10", + "io-lifetimes 1.0.11", "libc", "linux-raw-sys 0.3.8", "windows-sys 0.48.0", @@ -10274,9 +10235,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -10286,11 +10247,11 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.1", + "base64 0.21.2", ] [[package]] @@ -10306,7 +10267,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" dependencies = [ "fnv", - "quick-error 1.2.3", + "quick-error", "tempfile", "wait-timeout", ] @@ -10447,7 +10408,7 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#bc dependencies = [ "array-bytes 4.2.0", "chrono", - "clap 4.3.0", + "clap 4.3.9", "fdlimit", "futures", "libp2p", @@ -11240,7 +11201,7 @@ name = "sc-storage-monitor" version = "0.1.0" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#bcff60a227d455d95b4712b6cb356ce56b1ff672" dependencies = [ - "clap 4.3.0", + "clap 4.3.9", "futures", "log", "nix 0.26.2", @@ -11407,9 +11368,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b569c32c806ec3abdf3b5869fb8bf1e0d275a7c1c9b0b05603d9464632649edf" +checksum = "ad560913365790f17cbf12479491169f01b9d46d29cfc7422bf8c64bdc61b731" dependencies = [ "bitvec", "cfg-if", @@ -11421,9 +11382,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53012eae69e5aa5c14671942a5dd47de59d4cdcff8532a6dd0e081faf1119482" +checksum = "19df9bd9ace6cc2fe19387c96ce677e823e07d017ceed253e7bb3d1d1bd9c73b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11629,29 +11590,29 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" dependencies = [ "itoa", "ryu", @@ -11709,9 +11670,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", @@ -11841,7 +11802,7 @@ dependencies = [ "rand_core 0.6.4", "ring", "rustc_version", - "sha2 0.10.6", + "sha2 0.10.7", "subtle", ] @@ -11855,6 +11816,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "soketto" version = "0.7.1" @@ -12123,7 +12094,7 @@ dependencies = [ "blake2", "byteorder", "digest 0.10.7", - "sha2 0.10.6", + "sha2 0.10.7", "sha3", "sp-std", "twox-hash", @@ -12858,9 +12829,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.16" +version = "2.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01" +checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616" dependencies = [ "proc-macro2", "quote", @@ -12908,21 +12879,22 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.7" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" +checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac" [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.19", - "windows-sys 0.45.0", + "rustix 0.37.20", + "windows-sys 0.48.0", ] [[package]] @@ -13028,7 +13000,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -13103,9 +13075,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa", "serde", @@ -13140,7 +13112,7 @@ dependencies = [ "pbkdf2 0.11.0", "rand 0.8.5", "rustc-hash", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", "unicode-normalization", "wasm-bindgen", @@ -13174,11 +13146,12 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.1" +version = "1.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" +checksum = "374442f06ee49c3a28a8fc9f01a2596fed7559c6b99b31279c3261778e77d84f" dependencies = [ "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -13186,7 +13159,7 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite 0.2.9", "signal-hook-registry", - "socket2", + "socket2 0.4.9", "tokio-macros", "windows-sys 0.48.0", ] @@ -13199,7 +13172,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -13251,17 +13224,17 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.9" +version = "0.19.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d964908cec0d030b812013af25a0e57fddfadb1e066ecc6681d86253129d4f" +checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7" dependencies = [ - "indexmap", + "indexmap 2.0.0", "toml_datetime", "winnow", ] @@ -13322,13 +13295,13 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] @@ -13481,7 +13454,7 @@ dependencies = [ "lazy_static", "rand 0.8.5", "smallvec", - "socket2", + "socket2 0.4.9", "thiserror", "tinyvec", "tokio", @@ -13520,7 +13493,7 @@ name = "try-runtime-cli" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#bcff60a227d455d95b4712b6cb356ce56b1ff672" dependencies = [ - "clap 4.3.0", + "clap 4.3.9", "frame-remote-externalities", "frame-try-runtime", "hex", @@ -13630,9 +13603,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -13695,12 +13668,12 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", - "idna 0.3.0", + "idna 0.4.0", "percent-encoding", ] @@ -13712,11 +13685,11 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.3.3" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" +checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -13779,11 +13752,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -13807,9 +13779,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -13817,24 +13789,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.36" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -13844,9 +13816,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -13854,22 +13826,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-instrument" @@ -13975,7 +13947,7 @@ version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" dependencies = [ - "indexmap", + "indexmap 1.9.3", ] [[package]] @@ -13987,7 +13959,7 @@ dependencies = [ "anyhow", "bincode", "cfg-if", - "indexmap", + "indexmap 1.9.3", "libc", "log", "object 0.29.0", @@ -14065,7 +14037,7 @@ dependencies = [ "anyhow", "cranelift-entity", "gimli 0.26.2", - "indexmap", + "indexmap 1.9.3", "log", "object 0.29.0", "serde", @@ -14120,7 +14092,7 @@ dependencies = [ "anyhow", "cc", "cfg-if", - "indexmap", + "indexmap 1.9.3", "libc", "log", "mach", @@ -14150,9 +14122,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -14210,10 +14182,10 @@ dependencies = [ "sdp", "serde", "serde_json", - "sha2 0.10.6", + "sha2 0.10.7", "stun", "thiserror", - "time 0.3.21", + "time 0.3.22", "tokio", "turn", "url", @@ -14273,7 +14245,7 @@ dependencies = [ "sec1", "serde", "sha1", - "sha2 0.10.6", + "sha2 0.10.7", "signature", "subtle", "thiserror", @@ -14315,7 +14287,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106" dependencies = [ "log", - "socket2", + "socket2 0.4.9", "thiserror", "tokio", "webrtc-util", @@ -14514,9 +14486,9 @@ dependencies = [ [[package]] name = "widestring" -version = "0.5.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" [[package]] name = "winapi" @@ -14568,7 +14540,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets", ] [[package]] @@ -14599,44 +14571,20 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets", ] [[package]] name = "windows-targets" -version = "0.42.2" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", @@ -14793,20 +14741,21 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" dependencies = [ "memchr", ] [[package]] name = "winreg" -version = "0.10.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "winapi", + "cfg-if", + "windows-sys 0.48.0", ] [[package]] @@ -14856,7 +14805,7 @@ dependencies = [ "ring", "rusticata-macros", "thiserror", - "time 0.3.21", + "time 0.3.22", ] [[package]] @@ -14874,7 +14823,7 @@ dependencies = [ "oid-registry 0.6.1", "rusticata-macros", "thiserror", - "time 0.3.21", + "time 0.3.22", ] [[package]] @@ -14997,7 +14946,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" dependencies = [ - "time 0.3.21", + "time 0.3.22", ] [[package]] @@ -15017,7 +14966,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.22", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index d27cb8eda..ffc6884d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,6 @@ panic = 'unwind' [workspace] members = [ 'node', - 'runtime/common', 'runtime/hydradx', 'pallets/omnipool', 'pallets/dca', @@ -40,7 +39,6 @@ primitives = { path = "primitives", default-features = false } hydradx-traits = { path = "traits", default-features = false } hydra-dx-math = { path = "math", default-features = false } -common-runtime = { path = "runtime/common", default-features = false } hydradx-adapters = { path = "runtime/adapters", default-features = false } hydradx-runtime = { path = "runtime/hydradx", default-features = false } @@ -205,7 +203,6 @@ pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release polkadot-xcm = { package = "xcm", git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38", default-features = false } xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38", default-features = false } xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38", default-features = false } substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 3630897f1..b8617a636 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.7.16" +version = "1.7.17" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" @@ -14,7 +14,6 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] } scraper = { workspace = true } primitives = { workspace = true } hydradx-runtime = { workspace = true } -common-runtime = { workspace = true } pallet-omnipool = { workspace = true } pallet-circuit-breaker = { workspace = true } pallet-omnipool-liquidity-mining = { workspace = true } @@ -175,7 +174,6 @@ std = [ "pallet-authorship/std", "hydradx-traits/std", "pallet-relaychain-info/std", - "common-runtime/std", "polkadot-runtime/std", "hydradx-runtime/std", ] diff --git a/integration-tests/src/omnipool_price_provider.rs b/integration-tests/src/omnipool_price_provider.rs index 6e2428d74..4aece5dc7 100644 --- a/integration-tests/src/omnipool_price_provider.rs +++ b/integration-tests/src/omnipool_price_provider.rs @@ -4,12 +4,9 @@ use crate::polkadot_test_net::*; use frame_support::assert_ok; use frame_system::RawOrigin; -use hydradx_runtime::Balance; -use hydradx_runtime::Omnipool; -use hydradx_runtime::RuntimeOrigin; -use hydradx_runtime::Tokens; +use hydradx_runtime::{adapters::OraclePriceProviderAdapterForOmnipool, Omnipool, RuntimeOrigin, Tokens}; use hydradx_traits::{OraclePeriod, PriceOracle}; -use primitives::AssetId; +use primitives::{AssetId, Balance}; use sp_runtime::{FixedU128, Permill}; use xcm_emulator::TestExt; @@ -22,11 +19,12 @@ fn omnipool_oracle_adapter_should_return_price_for_arbitraty_pairs() { set_relaychain_block_number(100); - let price = common_runtime::adapters::OraclePriceProviderAdapterForOmnipool::< - AssetId, - hydradx_runtime::EmaOracle, - hydradx_runtime::LRNA, - >::price(HDX, DAI, OraclePeriod::Short); + let price = + OraclePriceProviderAdapterForOmnipool::::price( + HDX, + DAI, + OraclePeriod::Short, + ); assert!(price.is_some()); }); @@ -41,11 +39,12 @@ fn omnipool_oracle_adapter_should_return_price_for_when_lrna_is_asset_a() { set_relaychain_block_number(100); - let price = common_runtime::adapters::OraclePriceProviderAdapterForOmnipool::< - AssetId, - hydradx_runtime::EmaOracle, - hydradx_runtime::LRNA, - >::price(LRNA, DAI, OraclePeriod::Short); + let price = + OraclePriceProviderAdapterForOmnipool::::price( + LRNA, + DAI, + OraclePeriod::Short, + ); assert!(price.is_some()); }); @@ -60,11 +59,12 @@ fn omnipool_oracle_adapter_should_return_price_for_when_lrna_is_asset_b() { set_relaychain_block_number(100); - let price = common_runtime::adapters::OraclePriceProviderAdapterForOmnipool::< - AssetId, - hydradx_runtime::EmaOracle, - hydradx_runtime::LRNA, - >::price(DAI, LRNA, OraclePeriod::Short); + let price = + OraclePriceProviderAdapterForOmnipool::::price( + DAI, + LRNA, + OraclePeriod::Short, + ); assert!(price.is_some()); }); diff --git a/integration-tests/src/oracle.rs b/integration-tests/src/oracle.rs index e70bbd9a9..60e9d3621 100644 --- a/integration-tests/src/oracle.rs +++ b/integration-tests/src/oracle.rs @@ -2,19 +2,18 @@ use crate::polkadot_test_net::*; -use frame_support::traits::tokens::fungibles::Mutate; use frame_support::{ assert_ok, - traits::{OnFinalize, OnInitialize}, + sp_runtime::{FixedU128, Permill}, + traits::{tokens::fungibles::Mutate, OnFinalize, OnInitialize}, }; -use hydradx_runtime::{EmaOracle, RuntimeOrigin}; +use hydradx_runtime::{EmaOracle, RuntimeOrigin, OMNIPOOL_SOURCE}; use hydradx_traits::{ AggregatedPriceOracle, OraclePeriod::{self, *}, }; use pallet_ema_oracle::OracleError; use polkadot_primitives::v2::BlockNumber; -use sp_runtime::{FixedU128, Permill}; use xcm_emulator::TestExt; pub fn hydradx_run_to_block(to: BlockNumber) { @@ -31,8 +30,6 @@ pub fn hydradx_run_to_block(to: BlockNumber) { } } -use common_runtime::{adapters::OMNIPOOL_SOURCE, AssetId, CORE_ASSET_ID}; - const HDX: AssetId = CORE_ASSET_ID; const SUPPORTED_PERIODS: &[OraclePeriod] = &[LastBlock, Short, TenMinutes]; diff --git a/integration-tests/src/polkadot_test_net.rs b/integration-tests/src/polkadot_test_net.rs index f750425b8..e2b666a06 100644 --- a/integration-tests/src/polkadot_test_net.rs +++ b/integration-tests/src/polkadot_test_net.rs @@ -11,7 +11,7 @@ use frame_support::{ }; pub use hydradx_runtime::{AccountId, NativeExistentialDeposit, Treasury, VestingPalletId}; use pallet_transaction_multi_payment::Price; -use primitives::{AssetId, Balance}; +pub use primitives::{constants::chain::CORE_ASSET_ID, AssetId, Balance}; use cumulus_primitives_core::ParaId; use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; diff --git a/node/Cargo.toml b/node/Cargo.toml index f63c7a837..ef67a465f 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx" -version = "10.0.0" +version = "10.0.1" description = "HydraDX node" authors = ["GalacticCouncil"] edition = "2021" @@ -28,7 +28,6 @@ clap = { version = "4.1.8", features = [ "derive" ] } futures = "0.3.21" # local dependencies -common-runtime = { workspace = true } hydradx-runtime = { workspace = true } primitives = { workspace = true } diff --git a/node/src/chain_spec/mod.rs b/node/src/chain_spec/mod.rs index 42378c1c1..da280c343 100644 --- a/node/src/chain_spec/mod.rs +++ b/node/src/chain_spec/mod.rs @@ -30,9 +30,12 @@ use hydradx_runtime::{ pallet_claims::EthereumAddress, AccountId, AssetRegistryConfig, AuraId, Balance, BalancesConfig, ClaimsConfig, CollatorSelectionConfig, CouncilConfig, DusterConfig, ElectionsConfig, GenesisConfig, GenesisHistoryConfig, MultiTransactionPaymentConfig, ParachainInfoConfig, SessionConfig, Signature, SystemConfig, - TechnicalCommitteeConfig, TokensConfig, VestingConfig, UNITS, WASM_BINARY, + TechnicalCommitteeConfig, TokensConfig, VestingConfig, WASM_BINARY, +}; +use primitives::{ + constants::currency::{NATIVE_EXISTENTIAL_DEPOSIT, UNITS}, + AssetId, BlockNumber, Price, }; -use primitives::{constants::currency::NATIVE_EXISTENTIAL_DEPOSIT, AssetId, BlockNumber, Price}; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; use serde::{Deserialize, Serialize}; diff --git a/node/src/service.rs b/node/src/service.rs index f43fea94d..0273cbb26 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -19,7 +19,6 @@ #![allow(clippy::all)] -use common_runtime::{AccountId, Balance, Block, Index}; use cumulus_client_cli::CollatorOptions; use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion}; use cumulus_client_consensus_common::{ParachainBlockImport as TParachainBlockImport, ParachainConsensus}; @@ -33,6 +32,7 @@ use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult}; use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node; use jsonrpsee::RpcModule; use polkadot_service::CollatorPair; +use primitives::{AccountId, Balance, Block, Index}; use sc_consensus::ImportQueue; use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch, NativeVersion}; use sc_network::NetworkService; diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index ef0dd1076..db67695c1 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "primitives" -version = "5.7.3" +version = "5.8.0" authors = ["GalacticCouncil"] edition = "2021" repository = "https://github.com/galacticcouncil/HydraDX-node" @@ -14,6 +14,7 @@ static_assertions = "1.1.0" # Substrate dependencies frame-support = { workspace = true } +sp-core = { workspace = true } # Polkadot dependencies polkadot-primitives = { workspace = true } @@ -25,4 +26,5 @@ std = [ "codec/std", "scale-info/std", "frame-support/std", + "sp-core/std", ] diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 7f3784218..9fe493c72 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -16,8 +16,17 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] + use frame_support::sp_runtime::FixedU128; +/// Opaque, encoded, unchecked extrinsic. +pub use frame_support::sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; +use frame_support::sp_runtime::{ + generic, + traits::{BlakeTwo256, IdentifyAccount, Verify}, + MultiSignature, +}; + pub mod constants; /// An index to a block. @@ -43,3 +52,26 @@ pub type CollectionId = u128; /// NFT Item ID pub type ItemId = u128; + +/// Alias to 512-bit hash when used in the context of a transaction signature on the chain. +pub type Signature = MultiSignature; + +/// Some way of identifying an account on the chain. We intentionally make it equivalent +/// to the public key of our transaction signing scheme. +pub type AccountId = <::Signer as IdentifyAccount>::AccountId; + +/// The type for looking up accounts. We don't expect more than 4 billion of them, but you +/// never know... +pub type AccountIndex = u32; + +/// Index of a transaction in the chain. +pub type Index = u32; + +/// A hash of some data used by the chain. +pub type Hash = sp_core::H256; + +/// Header type. +pub type Header = generic::Header; + +/// Block type. +pub type Block = generic::Block; diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml deleted file mode 100644 index d8aa8d472..000000000 --- a/runtime/common/Cargo.toml +++ /dev/null @@ -1,118 +0,0 @@ -[package] -name = "common-runtime" -version = "102.5.0" -authors = ["GalacticCouncil"] -edition = "2021" -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 = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } -primitives = { workspace = true } -primitive-types = {default-features = false, version = '0.12.0'} - -pallet-omnipool = { workspace = true } -pallet-circuit-breaker = { workspace = true } -pallet-omnipool-liquidity-mining = { workspace = true } -pallet-claims = { workspace = true } -pallet-dca = { workspace = true } - -hydra-dx-math = { workspace = true } - -# Warehouse dependencies -hydradx-traits = { workspace = true } -pallet-transaction-multi-payment = { workspace = true } -pallet-asset-registry = { workspace = true } -pallet-currencies = { workspace = true } -pallet-transaction-pause = { workspace = true } -pallet-otc = { workspace = true } -pallet-ema-oracle = { workspace = true } -warehouse-liquidity-mining = { workspace = true } -pallet-route-executor = { workspace = true } -pallet-duster = { workspace = true } - -# Substrate dependencies -sp-runtime = { workspace = true } -sp-core = { workspace = true } -sp-std = { workspace = true } -frame-support = { workspace = true } -frame-system = { workspace = true } -sp-npos-elections = { workspace = true } -pallet-transaction-payment = { workspace = true } -pallet-collective = { workspace = true } -pallet-treasury = { workspace = true } -pallet-utility = { workspace = true } -pallet-democracy = { workspace = true } -pallet-identity = { workspace = true } -pallet-preimage = { workspace = true } -pallet-proxy = { workspace = true } -pallet-scheduler = { workspace = true } -pallet-timestamp = { workspace = true } -pallet-balances = { workspace = true } -pallet-tips = { workspace = true } - -# Polkadot dependencies -pallet-xcm = { workspace = true } - -# ORML dependencies -orml-tokens = { workspace = true } -orml-vesting = { workspace = true } -orml-traits = { workspace = true } -orml-xcm-support = { workspace = true } - -# Cumulus dependencies -pallet-collator-selection = { workspace = true } -cumulus-pallet-xcmp-queue = { workspace = true } -cumulus-primitives-core = { workspace = true } -cumulus-pallet-parachain-system = { workspace = true } - -# Polkadot dependencies -xcm = { workspace = true } -xcm-executor = { workspace = true } - -[features] -default = ["std"] - -std = [ - "scale-info/std", - "primitives/std", - "pallet-omnipool/std", - "sp-runtime/std", - "sp-core/std", - "sp-std/std", - "frame-support/std", - "frame-system/std", - "sp-npos-elections/std", - "pallet-transaction-multi-payment/std", - "pallet-collective/std", - "pallet-treasury/std", - "pallet-utility/std", - "pallet-democracy/std", - "pallet-identity/std", - "pallet-preimage/std", - "pallet-proxy/std", - "pallet-route-executor/std", - "pallet-scheduler/std", - "pallet-timestamp/std", - "pallet-balances/std", - "pallet-claims/std", - "pallet-transaction-multi-payment/std", - "pallet-asset-registry/std", - "pallet-currencies/std", - "pallet-transaction-pause/std", - "orml-tokens/std", - "orml-vesting/std", - "orml-traits/std", - "orml-xcm-support/std", - "pallet-collator-selection/std", - "cumulus-pallet-xcmp-queue/std", - "xcm/std", - "xcm-executor/std", -] diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs deleted file mode 100644 index 0ea66f484..000000000 --- a/runtime/common/src/lib.rs +++ /dev/null @@ -1,371 +0,0 @@ -// This file is part of HydraDX-node. - -// Copyright (C) 2020-2021 Intergalactic, Limited (GIB). -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#![cfg_attr(not(feature = "std"), no_std)] - -pub mod adapters; -pub mod weights; - -use codec::alloc::vec; -use codec::{Decode, Encode, MaxEncodedLen}; -use frame_support::traits::{Contains, EitherOfDiverse, LockIdentifier}; -use frame_support::{parameter_types, PalletId, RuntimeDebug}; -use frame_system::EnsureRoot; -use hydradx_traits::oracle::{OraclePeriod, Source}; -pub use pallet_transaction_payment::Multiplier; -pub use primitives::constants::{chain::*, currency::*, time::*}; -pub use primitives::{Amount, AssetId, Balance, BlockNumber, CollectionId}; -use scale_info::TypeInfo; -use sp_runtime::{ - generic, - traits::{AccountIdConversion, BlakeTwo256, IdentifyAccount, Verify}, - FixedPointNumber, MultiSignature, Perbill, Percent, Permill, Perquintill, -}; -use sp_std::prelude::*; - -/// Alias to 512-bit hash when used in the context of a transaction signature on the chain. -pub type Signature = MultiSignature; - -/// Some way of identifying an account on the chain. We intentionally make it equivalent -/// to the public key of our transaction signing scheme. -pub type AccountId = <::Signer as IdentifyAccount>::AccountId; - -/// The type for looking up accounts. We don't expect more than 4 billion of them, but you -/// never know... -pub type AccountIndex = u32; - -/// Index of a transaction in the chain. -pub type Index = u32; - -/// A hash of some data used by the chain. -pub type Hash = sp_core::H256; - -use pallet_dca::types::NamedReserveIdentifier; -/// Opaque, encoded, unchecked extrinsic. -pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; - -use self::adapters::OMNIPOOL_SOURCE; - -/// Header type. -pub type Header = generic::Header; - -/// Block type. -pub type Block = generic::Block; - -/// 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%`. -pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_perthousand(25); -/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used -/// by Operational extrinsics. -pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); - -pub type CouncilCollective = pallet_collective::Instance1; -pub type TechnicalCollective = pallet_collective::Instance2; - -pub type TreasuryApproveOrigin = EitherOfDiverse< - EnsureRoot, - pallet_collective::EnsureProportionAtLeast, ->; - -pub type MoreThanHalfCouncil = EitherOfDiverse< - EnsureRoot, - pallet_collective::EnsureProportionMoreThan, ->; - -pub type MajorityOfCouncil = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - EnsureRoot, ->; - -pub type AllCouncilMembers = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - EnsureRoot, ->; - -pub type MoreThanHalfTechCommittee = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - EnsureRoot, ->; - -pub type SuperMajorityTechCommittee = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - EnsureRoot, ->; - -pub type AllTechnicalCommitteeMembers = EitherOfDiverse< - pallet_collective::EnsureProportionAtLeast, - EnsureRoot, ->; - -pub fn get_all_module_accounts() -> Vec { - vec![ - TreasuryPalletId::get().into_account_truncating(), - VestingPalletId::get().into_account_truncating(), - ] -} - -pub struct CircuitBreakerWhitelist; - -impl Contains for CircuitBreakerWhitelist { - fn contains(a: &AccountId) -> bool { - >::into_account_truncating(&TreasuryPalletId::get()) == *a - } -} - -// frame system -parameter_types! { - pub const BlockHashCount: BlockNumber = 2400; - /// Maximum length of block. Up to 5MB. - pub BlockLength: frame_system::limits::BlockLength = - frame_system::limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); - pub const SS58Prefix: u16 = 63; -} - -// pallet timestamp -parameter_types! { - pub const MinimumPeriod: u64 = SLOT_DURATION / 2; - pub const NativeAssetId : AssetId = CORE_ASSET_ID; -} - -// pallet balances -parameter_types! { - pub const NativeExistentialDeposit: u128 = NATIVE_EXISTENTIAL_DEPOSIT; - pub const MaxLocks: u32 = 50; - pub const MaxReserves: u32 = 50; -} - -// pallet aura -parameter_types! { - pub const MaxAuthorities: u32 = 50; -} - -// pallet transaction payment -parameter_types! { - pub const TransactionByteFee: Balance = 10 * MILLICENTS; - /// The portion of the `NORMAL_DISPATCH_RATIO` that we adjust the fees with. Blocks filled less - /// than this will decrease the weight and more will increase. - pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25); - /// The adjustment variable of the runtime. Higher values will cause `TargetBlockFullness` to - /// change the fees more rapidly. - pub AdjustmentVariable: Multiplier = Multiplier::saturating_from_rational(6, 100_000); - /// Minimum amount of the multiplier. This value cannot be too low. A test case should ensure - /// that combined with `AdjustmentVariable`, we can recover from the minimum. - pub MinimumMultiplier: Multiplier = Multiplier::saturating_from_rational(1, 1_000_000u128); - /// The maximum amount of the multiplier. - pub MaximumMultiplier: Multiplier = Multiplier::saturating_from_integer(4); -} - -// pallet treasury -parameter_types! { - pub const ProposalBond: Permill = Permill::from_percent(3); - pub const ProposalBondMinimum: Balance = 100 * DOLLARS; - pub const ProposalBondMaximum: Balance = 500 * DOLLARS; - pub const SpendPeriod: BlockNumber = DAYS; - pub const Burn: Permill = Permill::from_percent(0); - pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); - pub const MaxApprovals: u32 = 100; -} - -// pallet authorship -parameter_types! { - pub const UncleGenerations: u32 = 0; -} - -// pallet collator selection -parameter_types! { - pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 0; - pub const MinCandidates: u32 = 0; - pub const MaxInvulnerables: u32 = 50; -} - -// pallet session -parameter_types! { - pub const Period: u32 = 4 * HOURS; - pub const Offset: u32 = 0; -} - -// pallet preimage -parameter_types! { - pub PreimageBaseDeposit: Balance = deposit(2, 64); - pub PreimageByteDeposit: Balance = deposit(0, 1); -} - -// pallet identity -parameter_types! { - pub const BasicDeposit: Balance = 5 * DOLLARS; - pub const FieldDeposit: Balance = DOLLARS; - pub const SubAccountDeposit: Balance = 5 * DOLLARS; - pub const MaxSubAccounts: u32 = 100; - pub const MaxAdditionalFields: u32 = 100; - pub const MaxRegistrars: u32 = 20; -} - -// pallet collective Instance1 - CouncilCollective -parameter_types! { - pub const CouncilMaxProposals: u32 = 30; - pub const CouncilMaxMembers: u32 = 13; - pub const CouncilMotionDuration: BlockNumber = 5 * DAYS; -} - -// pallet collective Instance2 - TechnicalCollective -parameter_types! { - pub const TechnicalMaxProposals: u32 = 20; - pub const TechnicalMaxMembers: u32 = 10; - pub const TechnicalMotionDuration: BlockNumber = 5 * DAYS; -} - -// pallet democracy -parameter_types! { - pub const LaunchPeriod: BlockNumber = 3 * DAYS; - pub const VotingPeriod: BlockNumber = 3 * DAYS; - pub const FastTrackVotingPeriod: BlockNumber = 3 * HOURS; - pub const MinimumDeposit: Balance = 1000 * DOLLARS; - pub const EnactmentPeriod: BlockNumber = 24 * HOURS; - // Make sure VoteLockingPeriod > EnactmentPeriod - pub const VoteLockingPeriod: BlockNumber = 6 * DAYS; - pub const CooloffPeriod: BlockNumber = 7 * DAYS; - pub const InstantAllowed: bool = true; - pub const MaxVotes: u32 = 100; - pub const MaxProposals: u32 = 100; -} - -// pallet elections_phragmen -parameter_types! { - // Bond for candidacy into governance - pub const CandidacyBond: Balance = 5 * DOLLARS; - // 1 storage item created, key size is 32 bytes, value size is 16+16. - pub const VotingBondBase: Balance = CENTS; - // additional data per vote is 32 bytes (account id). - pub const VotingBondFactor: Balance = CENTS; - pub const TermDuration: BlockNumber = 7 * DAYS; - pub const DesiredMembers: u32 = 13; - pub const DesiredRunnersUp: u32 = 15; - pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect"; - pub const MaxElectionCandidates: u32 = 1_000; - pub const MaxElectionVoters: u32 = 10_000; -} - -// pallet tips -parameter_types! { - pub const DataDepositPerByte: Balance = CENTS; - pub const TipCountdown: BlockNumber = 2 * HOURS; - pub const TipFindersFee: Percent = Percent::from_percent(1); - pub const TipReportDepositBase: Balance = 10 * DOLLARS; - pub const TipReportDepositPerByte: Balance = CENTS; - pub const MaximumReasonLength: u32 = 1024; -} - -// pallet vesting -parameter_types! { - pub MinVestedTransfer: Balance = 100; - pub const MaxVestingSchedules: u32 = 100; - pub const VestingPalletId: PalletId = PalletId(*b"py/vstng"); -} - -// pallet proxy -/// The type used to represent the kinds of proxying allowed. -#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo)] -pub enum ProxyType { - Any, - CancelProxy, - Governance, - Transfer, - Liquidity, - LiquidityMining, -} -impl Default for ProxyType { - fn default() -> Self { - Self::Any - } -} - -parameter_types! { - pub ProxyDepositBase: Balance = deposit(1, 8); - pub ProxyDepositFactor: Balance = deposit(0, 33); - pub const MaxProxies: u16 = 32; - pub AnnouncementDepositBase: Balance = deposit(1, 8); - pub AnnouncementDepositFactor: Balance = deposit(0, 66); - pub const MaxPending: u16 = 32; -} - -// pallet multisig -parameter_types! { - pub DepositBase: Balance = deposit(1, 88); - pub DepositFactor: Balance = deposit(0, 32); - pub const MaxSignatories: u16 = 100; -} - -// pallet claims -parameter_types! { - pub ClaimMessagePrefix: &'static [u8] = b"I hereby claim all my HDX tokens to wallet:"; -} - -// pallet asset registry -parameter_types! { - pub const RegistryStrLimit: u32 = 32; - pub const SequentialIdOffset: u32 = 1_000_000; -} - -// pallet circuit breaker -parameter_types! { - pub const DefaultMaxNetTradeVolumeLimitPerBlock: (u32, u32) = (5_000, 10_000); // 50% - pub const DefaultMaxLiquidityLimitPerBlock: Option<(u32, u32)> = Some((500, 10_000)); // 5% -} - -// pallet duster -parameter_types! { - pub const DustingReward: u128 = 0; -} - -// omnipool's warehouse pallet liquidity mining -parameter_types! { - pub const OmniWarehouseLMPalletId: PalletId = PalletId(*b"OmniWhLM"); - #[derive(PartialEq, Eq)] - pub const MaxEntriesPerDeposit: u8 = 5; //NOTE: Rebenchmark when this change, TODO: - pub const MaxYieldFarmsPerGlobalFarm: u8 = 50; //NOTE: Includes deleted/destroyed farms, TODO: - pub const MinPlannedYieldingPeriods: BlockNumber = 14_440; //1d with 6s blocks, TODO: - pub const MinTotalFarmRewards: Balance = NATIVE_EXISTENTIAL_DEPOSIT * 100; //TODO: -} - -// omnipool's liquidity mining -parameter_types! { - pub const OmniLMPalletId: PalletId = PalletId(*b"Omni//LM"); - pub const OmnipoolLMCollectionId: CollectionId = 2584_u128; - pub const OmnipoolLMOraclePeriod: OraclePeriod = OraclePeriod::TenMinutes; - pub const OmnipoolLMOracleSource: Source = OMNIPOOL_SOURCE; -} - -// pallet dca -parameter_types! { - pub MinBudgetInNativeCurrency: Balance = 1000 * UNITS; - pub MaxSchedulesPerBlock: u32 = 20; - pub MaxPriceDifference: Permill = Permill::from_rational(15u32, 1000u32); - pub NamedReserveId: NamedReserveIdentifier = *b"dcaorder"; - pub MaxNumberOfRetriesOnError: u8 = 3; -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn democracy_periods() { - // Make sure VoteLockingPeriod > EnactmentPeriod - assert!(VoteLockingPeriod::get() > EnactmentPeriod::get()); - } -} diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index 7c3778599..c4b8e2430 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "162.0.0" +version = "163.0.0" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" @@ -22,13 +22,13 @@ smallvec = "1.9.0" # local dependencies primitives = { workspace = true } -common-runtime = { workspace = true } pallet-claims = { workspace = true } pallet-genesis-history = { workspace = true } pallet-omnipool = { workspace = true } pallet-circuit-breaker = { workspace = true } pallet-omnipool-liquidity-mining = { workspace = true } pallet-dca = { workspace = true } +hydra-dx-math = { workspace = true } # pallets pallet-balances = { workspace = true } @@ -122,6 +122,7 @@ sp-transaction-pool = { workspace = true } sp-version = { workspace = true } sp-trie = { workspace = true } sp-io = { workspace = true } +primitive-types = { workspace = true } [features] default = ["std"] @@ -172,7 +173,6 @@ std = [ "frame-system/std", "frame-system-rpc-runtime-api/std", "frame-try-runtime/std", - "common-runtime/std", "cumulus-pallet-parachain-system/std", "cumulus-pallet-aura-ext/std", "cumulus-primitives-core/std", diff --git a/runtime/common/src/adapters.rs b/runtime/hydradx/src/adapters.rs similarity index 93% rename from runtime/common/src/adapters.rs rename to runtime/hydradx/src/adapters.rs index dcdd387a3..3632a3945 100644 --- a/runtime/common/src/adapters.rs +++ b/runtime/hydradx/src/adapters.rs @@ -1,32 +1,33 @@ -use core::marker::PhantomData; +use crate::assets::OMNIPOOL_SOURCE; use codec::FullCodec; +use core::marker::PhantomData; use frame_support::{ + sp_runtime::{ + traits::{Convert, MaybeSerializeDeserialize, Zero}, + ArithmeticError, DispatchError, FixedPointNumber, FixedU128, SaturatedConversion, + }, traits::{Contains, Get}, weights::Weight, }; -use hydra_dx_math::ema::EmaPrice; -use hydra_dx_math::omnipool::types::BalanceUpdate; -use hydra_dx_math::support::rational::round_to_rational; -use hydra_dx_math::support::rational::Rounding; -use hydradx_traits::AggregatedPriceOracle; -use hydradx_traits::PriceOracle; -use hydradx_traits::{liquidity_mining::PriceAdjustment, OnLiquidityChangedHandler, OnTradeHandler, OraclePeriod}; -use orml_xcm_support::OnDepositFail; -use orml_xcm_support::UnknownAsset as UnknownAssetT; +use hydra_dx_math::{ + ema::EmaPrice, + omnipool::types::BalanceUpdate, + support::rational::{round_to_rational, Rounding}, +}; +use hydradx_traits::{ + liquidity_mining::PriceAdjustment, AggregatedPriceOracle, OnLiquidityChangedHandler, OnTradeHandler, OraclePeriod, + PriceOracle, +}; +use orml_xcm_support::{OnDepositFail, UnknownAsset as UnknownAssetT}; use pallet_circuit_breaker::WeightInfo; -use pallet_ema_oracle::Price; -use pallet_ema_oracle::{OnActivityHandler, OracleError}; +use pallet_ema_oracle::{OnActivityHandler, OracleError, Price}; use pallet_omnipool::traits::{AssetInfo, ExternalPriceProvider, OmnipoolHooks}; +use polkadot_xcm::latest::prelude::*; use primitive_types::U128; use primitives::{AssetId, Balance, BlockNumber}; -use sp_runtime::traits::MaybeSerializeDeserialize; -use sp_runtime::traits::{Convert, Zero}; -use sp_runtime::SaturatedConversion; -use sp_runtime::{ArithmeticError, DispatchError, FixedPointNumber, FixedU128}; use sp_std::fmt::Debug; use warehouse_liquidity_mining::GlobalFarmData; -use xcm::latest::prelude::*; use xcm_executor::{ traits::{Convert as MoreConvert, MatchesFungible, TransactAsset}, Assets, @@ -35,9 +36,6 @@ use xcm_executor::{ /// Passes on trade and liquidity data from the omnipool to the oracle. pub struct OmnipoolHookAdapter(PhantomData<(Origin, Lrna, Runtime)>); -/// The source of the data for the oracle. -pub const OMNIPOOL_SOURCE: [u8; 8] = *b"omnipool"; - impl OmnipoolHooks for OmnipoolHookAdapter where Lrna: Get, diff --git a/runtime/hydradx/src/assets.rs b/runtime/hydradx/src/assets.rs new file mode 100644 index 000000000..5dad1cf2a --- /dev/null +++ b/runtime/hydradx/src/assets.rs @@ -0,0 +1,452 @@ +// This file is part of HydraDX-node. + +// 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 super::*; +use crate::adapters::{EmaOraclePriceAdapter, OmnipoolHookAdapter, OraclePriceProviderAdapterForOmnipool}; +use crate::system::NativeAssetId; + +use hydradx_adapters::inspect::MultiInspectAdapter; +use hydradx_traits::{OraclePeriod, Source}; +use pallet_currencies::BasicCurrencyAdapter; +use pallet_dca::RelayChainBlockHashProvider; +use pallet_omnipool::traits::EnsurePriceWithin; +use pallet_otc::NamedReserveIdentifier; +use pallet_transaction_multi_payment::{AddTxAssetOnAccount, RemoveTxAssetOnKilled}; +use primitives::constants::currency::{NATIVE_EXISTENTIAL_DEPOSIT, UNITS}; + +use frame_support::{ + parameter_types, + sp_runtime::Permill, + traits::{AsEnsureOriginWithArg, ConstU32, Contains, EnsureOrigin, NeverEnsureOrigin}, + BoundedVec, PalletId, +}; +use frame_system::{EnsureRoot, RawOrigin}; +use orml_traits::currency::MutationHooks; + +parameter_types! { + pub const NativeExistentialDeposit: u128 = NATIVE_EXISTENTIAL_DEPOSIT; + pub const MaxLocks: u32 = 50; + pub const MaxReserves: u32 = 50; +} + +impl pallet_balances::Config for Runtime { + type Balance = Balance; + type DustRemoval = Treasury; + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = NativeExistentialDeposit; + type AccountStore = System; + type WeightInfo = weights::balances::HydraWeight; + type MaxLocks = MaxLocks; + type MaxReserves = MaxReserves; + type ReserveIdentifier = [u8; 8]; +} + +pub struct CurrencyHooks; +impl MutationHooks for CurrencyHooks { + type OnDust = Duster; + type OnSlash = (); + type PreDeposit = (); + type PostDeposit = (); + type PreTransfer = (); + type PostTransfer = (); + type OnNewTokenAccount = AddTxAssetOnAccount; + type OnKilledTokenAccount = RemoveTxAssetOnKilled; +} + +impl orml_tokens::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type Amount = Amount; + type CurrencyId = AssetId; + type WeightInfo = weights::tokens::HydraWeight; + type ExistentialDeposits = AssetRegistry; + type CurrencyHooks = CurrencyHooks; + type MaxLocks = MaxLocks; + type MaxReserves = MaxReserves; + type ReserveIdentifier = [u8; 8]; + type DustRemovalWhitelist = DustRemovalWhitelist; +} + +// The latest versions of the orml-currencies pallet don't emit events. +// The infrastructure relies on the events from this pallet, so we use the latest version of +// the pallet that contains and emit events and was updated to the polkadot version we use. +impl pallet_currencies::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type MultiCurrency = Tokens; + type NativeCurrency = BasicCurrencyAdapter; + type GetNativeCurrencyId = NativeAssetId; + type WeightInfo = weights::currencies::HydraWeight; +} + +pub struct RootAsVestingPallet; +impl EnsureOrigin for RootAsVestingPallet { + type Success = AccountId; + + fn try_origin(o: RuntimeOrigin) -> Result { + Into::, RuntimeOrigin>>::into(o).and_then(|o| match o { + RawOrigin::Root => Ok(VestingPalletId::get().into_account_truncating()), + r => Err(RuntimeOrigin::from(r)), + }) + } + + #[cfg(feature = "runtime-benchmarks")] + fn try_successful_origin() -> Result { + let zero_account_id = AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) + .expect("infinite length input; no invalid inputs for type; qed"); + Ok(RuntimeOrigin::from(RawOrigin::Signed(zero_account_id))) + } +} + +parameter_types! { + pub MinVestedTransfer: Balance = 100; + pub const MaxVestingSchedules: u32 = 100; + pub const VestingPalletId: PalletId = PalletId(*b"py/vstng"); +} + +impl orml_vesting::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type MinVestedTransfer = MinVestedTransfer; + type VestedTransferOrigin = RootAsVestingPallet; + type WeightInfo = weights::vesting::HydraWeight; + type MaxVestingSchedules = MaxVestingSchedules; + type BlockNumberProvider = RelayChainBlockNumberProvider; +} + +parameter_types! { + pub ClaimMessagePrefix: &'static [u8] = b"I hereby claim all my HDX tokens to wallet:"; +} + +impl pallet_claims::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Prefix = ClaimMessagePrefix; + type WeightInfo = weights::claims::HydraWeight; + type Currency = Balances; + type CurrencyBalance = Balance; +} + +parameter_types! { + pub const RegistryStrLimit: u32 = 32; + pub const SequentialIdOffset: u32 = 1_000_000; +} + +impl pallet_asset_registry::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RegistryOrigin = SuperMajorityTechCommittee; + type AssetId = AssetId; + type Balance = Balance; + type AssetNativeLocation = AssetLocation; + type StringLimit = RegistryStrLimit; + type SequentialIdStartAt = SequentialIdOffset; + type NativeAssetId = NativeAssetId; + type WeightInfo = weights::registry::HydraWeight; +} + +parameter_types! { + pub const CollectionDeposit: Balance = 0; + pub const ItemDeposit: Balance = 0; + pub const KeyLimit: u32 = 256; // Max 256 bytes per key + pub const ValueLimit: u32 = 1024; // Max 1024 bytes per value + pub const UniquesMetadataDepositBase: Balance = 1_000 * UNITS; + pub const AttributeDepositBase: Balance = UNITS; + pub const DepositPerByte: Balance = UNITS; + pub const UniquesStringLimit: u32 = 72; +} + +impl pallet_uniques::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type CollectionId = CollectionId; + type ItemId = ItemId; + type Currency = Balances; + type ForceOrigin = MajorityOfCouncil; + // Standard collection creation is disallowed + type CreateOrigin = AsEnsureOriginWithArg>; + type Locker = (); + type CollectionDeposit = CollectionDeposit; + type ItemDeposit = ItemDeposit; + type MetadataDepositBase = UniquesMetadataDepositBase; + type AttributeDepositBase = AttributeDepositBase; + type DepositPerByte = DepositPerByte; + type StringLimit = UniquesStringLimit; + type KeyLimit = KeyLimit; + type ValueLimit = ValueLimit; + #[cfg(feature = "runtime-benchmarks")] + type Helper = (); + type WeightInfo = (); +} + +/// The source of the data for the oracle. +pub const OMNIPOOL_SOURCE: [u8; 8] = *b"omnipool"; + +parameter_types! { + pub const LRNA: AssetId = 1; + pub const StableAssetId: AssetId = 2; + pub ProtocolFee: Permill = Permill::from_rational(5u32,10000u32); + pub AssetFee: Permill = Permill::from_rational(25u32,10000u32); + pub const MinTradingLimit : Balance = 1_000u128; + pub const MinPoolLiquidity: Balance = 1_000_000u128; + pub const MaxInRatio: Balance = 3u128; + pub const MaxOutRatio: Balance = 3u128; + pub const OmnipoolCollectionId: CollectionId = 1337u128; + pub const EmaOracleSpotPriceLastBlock: OraclePeriod = OraclePeriod::LastBlock; + pub const EmaOracleSpotPriceShort: OraclePeriod = OraclePeriod::Short; + pub const OmnipoolMaxAllowedPriceDifference: Permill = Permill::from_percent(1); + pub MinimumWithdrawalFee: Permill = Permill::from_rational(1u32,10000); +} + +impl pallet_omnipool::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type Currency = Currencies; + type AuthorityOrigin = EnsureRoot; + type TechnicalOrigin = SuperMajorityTechCommittee; + type AssetRegistry = AssetRegistry; + type HdxAssetId = NativeAssetId; + type HubAssetId = LRNA; + type StableCoinAssetId = StableAssetId; + type ProtocolFee = ProtocolFee; + type AssetFee = AssetFee; + type MinWithdrawalFee = MinimumWithdrawalFee; + type MinimumTradingLimit = MinTradingLimit; + type MinimumPoolLiquidity = MinPoolLiquidity; + type MaxInRatio = MaxInRatio; + type MaxOutRatio = MaxOutRatio; + type PositionItemId = ItemId; + type CollectionId = CollectionId; + type NFTCollectionId = OmnipoolCollectionId; + type NFTHandler = Uniques; + type WeightInfo = weights::omnipool::HydraWeight; + type OmnipoolHooks = OmnipoolHookAdapter; + type PriceBarrier = ( + EnsurePriceWithin< + AccountId, + AssetId, + EmaOraclePriceAdapter, + OmnipoolMaxAllowedPriceDifference, + CircuitBreakerWhitelist, + >, + EnsurePriceWithin< + AccountId, + AssetId, + EmaOraclePriceAdapter, + OmnipoolMaxAllowedPriceDifference, + CircuitBreakerWhitelist, + >, + ); + type ExternalPriceOracle = EmaOraclePriceAdapter; +} + +pub struct CircuitBreakerWhitelist; + +impl Contains for CircuitBreakerWhitelist { + fn contains(a: &AccountId) -> bool { + >::into_account_truncating(&TreasuryPalletId::get()) == *a + } +} + +parameter_types! { + pub const DefaultMaxNetTradeVolumeLimitPerBlock: (u32, u32) = (5_000, 10_000); // 50% + pub const DefaultMaxLiquidityLimitPerBlock: Option<(u32, u32)> = Some((500, 10_000)); // 5% +} + +impl pallet_circuit_breaker::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type Balance = Balance; + type TechnicalOrigin = SuperMajorityTechCommittee; + type WhitelistedAccounts = CircuitBreakerWhitelist; + type DefaultMaxNetTradeVolumeLimitPerBlock = DefaultMaxNetTradeVolumeLimitPerBlock; + type DefaultMaxAddLiquidityLimitPerBlock = DefaultMaxLiquidityLimitPerBlock; + type DefaultMaxRemoveLiquidityLimitPerBlock = DefaultMaxLiquidityLimitPerBlock; + type OmnipoolHubAsset = LRNA; + type WeightInfo = weights::circuit_breaker::HydraWeight; +} + +parameter_types! { + pub SupportedPeriods: BoundedVec> = BoundedVec::truncate_from(vec![ + OraclePeriod::LastBlock, OraclePeriod::Short, OraclePeriod::TenMinutes]); +} + +impl pallet_ema_oracle::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::ema_oracle::HydraWeight; + /// The definition of the oracle time periods currently assumes a 6 second block time. + /// We use the parachain blocks anyway, because we want certain guarantees over how many blocks correspond + /// to which smoothing factor. + type BlockNumberProvider = System; + type SupportedPeriods = SupportedPeriods; + /// With every asset trading against LRNA we will only have as many pairs as there will be assets, so + /// 20 seems a decent upper bound for the forseeable future. + type MaxUniqueEntries = ConstU32<20>; +} + +pub struct DustRemovalWhitelist; + +impl Contains for DustRemovalWhitelist { + fn contains(a: &AccountId) -> bool { + get_all_module_accounts().contains(a) || pallet_duster::DusterWhitelist::::contains(a) + } +} + +parameter_types! { + pub const DustingReward: u128 = 0; +} + +impl pallet_duster::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type Amount = Amount; + type CurrencyId = AssetId; + type MultiCurrency = Currencies; + type MinCurrencyDeposits = AssetRegistry; + type Reward = DustingReward; + type NativeCurrencyId = NativeAssetId; + type BlacklistUpdateOrigin = SuperMajorityTechCommittee; + type WeightInfo = (); +} + +parameter_types! { + pub const OmniWarehouseLMPalletId: PalletId = PalletId(*b"OmniWhLM"); + #[derive(PartialEq, Eq)] + pub const MaxEntriesPerDeposit: u8 = 5; //NOTE: Rebenchmark when this change, TODO: + pub const MaxYieldFarmsPerGlobalFarm: u8 = 50; //NOTE: Includes deleted/destroyed farms, TODO: + pub const MinPlannedYieldingPeriods: BlockNumber = 14_440; //1d with 6s blocks, TODO: + pub const MinTotalFarmRewards: Balance = NATIVE_EXISTENTIAL_DEPOSIT * 100; //TODO: +} + +type OmnipoolLiquidityMiningInstance = warehouse_liquidity_mining::Instance1; +impl warehouse_liquidity_mining::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type MultiCurrency = Currencies; + type PalletId = OmniWarehouseLMPalletId; + type MinTotalFarmRewards = MinTotalFarmRewards; + type MinPlannedYieldingPeriods = MinPlannedYieldingPeriods; + type BlockNumberProvider = RelayChainBlockNumberProvider; + type AmmPoolId = AssetId; + type MaxFarmEntriesPerDeposit = MaxEntriesPerDeposit; + type MaxYieldFarmsPerGlobalFarm = MaxYieldFarmsPerGlobalFarm; + type AssetRegistry = AssetRegistry; + type NonDustableWhitelistHandler = Duster; + type PriceAdjustment = adapters::PriceAdjustmentAdapter; +} + +parameter_types! { + pub const OmniLMPalletId: PalletId = PalletId(*b"Omni//LM"); + pub const OmnipoolLMCollectionId: CollectionId = 2584_u128; + pub const OmnipoolLMOraclePeriod: OraclePeriod = OraclePeriod::TenMinutes; + pub const OmnipoolLMOracleSource: Source = OMNIPOOL_SOURCE; +} + +impl pallet_omnipool_liquidity_mining::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Currencies; + type CreateOrigin = AllTechnicalCommitteeMembers; + type PalletId = OmniLMPalletId; + type NFTCollectionId = OmnipoolLMCollectionId; + type NFTHandler = Uniques; + type LiquidityMiningHandler = OmnipoolWarehouseLM; + type OracleSource = OmnipoolLMOracleSource; + type OraclePeriod = OmnipoolLMOraclePeriod; + type PriceOracle = EmaOracle; + type WeightInfo = weights::omnipool_lm::HydraWeight; +} + +// The reason why there is difference between PROD and benchmark is that it is not possible +// to set validation data in parachain system pallet in the benchmarks. +// So for benchmarking, we mock it out and return some hardcoded parent hash +pub struct RelayChainBlockHashProviderAdapter(sp_std::marker::PhantomData); + +#[cfg(not(feature = "runtime-benchmarks"))] +impl RelayChainBlockHashProvider for RelayChainBlockHashProviderAdapter +where + Runtime: cumulus_pallet_parachain_system::Config, +{ + fn parent_hash() -> Option { + let validation_data = cumulus_pallet_parachain_system::Pallet::::validation_data(); + match validation_data { + Some(data) => Some(data.parent_head.hash()), + None => None, + } + } +} + +#[cfg(feature = "runtime-benchmarks")] +impl RelayChainBlockHashProvider for RelayChainBlockHashProviderAdapter +where + Runtime: cumulus_pallet_parachain_system::Config, +{ + fn parent_hash() -> Option { + None + } +} + +parameter_types! { + pub MinBudgetInNativeCurrency: Balance = 1000 * UNITS; + pub MaxSchedulesPerBlock: u32 = 20; + pub MaxPriceDifference: Permill = Permill::from_rational(15u32, 1000u32); + pub NamedReserveId: NamedReserveIdentifier = *b"dcaorder"; + pub MaxNumberOfRetriesOnError: u8 = 3; +} + +impl pallet_dca::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type TechnicalOrigin = SuperMajorityTechCommittee; + type Currencies = Currencies; + type RelayChainBlockHashProvider = RelayChainBlockHashProviderAdapter; + type RandomnessProvider = DCA; + type OraclePriceProvider = OraclePriceProviderAdapterForOmnipool; + type SpotPriceProvider = Omnipool; + type MaxPriceDifferenceBetweenBlocks = MaxPriceDifference; + type MaxSchedulePerBlock = MaxSchedulesPerBlock; + type MaxNumberOfRetriesOnError = MaxNumberOfRetriesOnError; + type NativeAssetId = NativeAssetId; + type MinBudgetInNativeCurrency = MinBudgetInNativeCurrency; + type MinimumTradingLimit = MinTradingLimit; + type FeeReceiver = TreasuryAccount; + type NamedReserveId = NamedReserveId; + type WeightToFee = WeightToFee; + type WeightInfo = weights::dca::HydraWeight; +} + +parameter_types! { + pub const MaxNumberOfTrades: u8 = 5; +} + +impl pallet_route_executor::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type Balance = Balance; + type MaxNumberOfTrades = MaxNumberOfTrades; + type Currency = MultiInspectAdapter; + type AMM = Omnipool; + type WeightInfo = weights::route_executor::HydraWeight; +} + +parameter_types! { + pub const ExistentialDepositMultiplier: u8 = 5; +} + +impl pallet_otc::Config for Runtime { + type AssetId = AssetId; + type AssetRegistry = AssetRegistry; + type Currency = Currencies; + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposits = AssetRegistry; + type ExistentialDepositMultiplier = ExistentialDepositMultiplier; + type WeightInfo = weights::otc::HydraWeight; +} diff --git a/runtime/hydradx/src/benchmarking/currencies.rs b/runtime/hydradx/src/benchmarking/currencies.rs index 5b626de33..e15245f36 100644 --- a/runtime/hydradx/src/benchmarking/currencies.rs +++ b/runtime/hydradx/src/benchmarking/currencies.rs @@ -1,4 +1,5 @@ -use crate::{AccountId, Amount, AssetId, Balance, Currencies, NativeAssetId, Runtime, NATIVE_EXISTENTIAL_DEPOSIT}; +use crate::{AccountId, Amount, AssetId, Balance, Currencies, NativeAssetId, Runtime}; +use primitives::constants::currency::NATIVE_EXISTENTIAL_DEPOSIT; use sp_std::prelude::*; diff --git a/runtime/hydradx/src/benchmarking/duster.rs b/runtime/hydradx/src/benchmarking/duster.rs index 13088c64d..c48a60d6c 100644 --- a/runtime/hydradx/src/benchmarking/duster.rs +++ b/runtime/hydradx/src/benchmarking/duster.rs @@ -1,4 +1,4 @@ -use crate::{AccountId, AssetId, Balance, Duster, DustingReward, NativeAssetId, Runtime, Tokens}; +use crate::{assets::DustingReward, AccountId, AssetId, Balance, Duster, NativeAssetId, Runtime, Tokens}; use super::*; diff --git a/runtime/hydradx/src/benchmarking/omnipool.rs b/runtime/hydradx/src/benchmarking/omnipool.rs index 0e70cdaf2..91fdd0de5 100644 --- a/runtime/hydradx/src/benchmarking/omnipool.rs +++ b/runtime/hydradx/src/benchmarking/omnipool.rs @@ -1,10 +1,14 @@ -use crate::{AccountId, AssetId, AssetRegistry, Balance, EmaOracle, Omnipool, Permill, Runtime, System}; +use crate::{AccountId, AssetId, AssetRegistry, Balance, EmaOracle, Omnipool, Runtime, System}; use super::*; use frame_benchmarking::account; use frame_support::{ assert_ok, + sp_runtime::{ + traits::{One, SaturatedConversion, Zero}, + FixedU128, Permill, + }, traits::{OnFinalize, OnInitialize}, }; use frame_system::RawOrigin; @@ -12,10 +16,6 @@ use hydradx_traits::Registry; use orml_benchmarking::runtime_benchmarks; use orml_traits::{MultiCurrency, MultiCurrencyExtended}; use pallet_omnipool::types::Tradability; -use sp_runtime::{ - traits::{One, SaturatedConversion, Zero}, - FixedU128, -}; pub fn update_balance(currency_id: AssetId, who: &AccountId, balance: Balance) { assert_ok!( diff --git a/runtime/hydradx/src/benchmarking/vesting.rs b/runtime/hydradx/src/benchmarking/vesting.rs index a89b5193b..13cfa792c 100644 --- a/runtime/hydradx/src/benchmarking/vesting.rs +++ b/runtime/hydradx/src/benchmarking/vesting.rs @@ -1,5 +1,7 @@ -use crate::{AccountId, AssetId, Balance, NativeAssetId, Runtime}; -use crate::{BlockNumber, Currencies, MaxVestingSchedules, System, Vesting}; +use crate::{ + assets::MaxVestingSchedules, AccountId, AssetId, Balance, BlockNumber, Currencies, NativeAssetId, Runtime, System, + Vesting, +}; use super::BSX; diff --git a/runtime/hydradx/src/governance.rs b/runtime/hydradx/src/governance.rs new file mode 100644 index 000000000..97b9f7ffb --- /dev/null +++ b/runtime/hydradx/src/governance.rs @@ -0,0 +1,306 @@ +// This file is part of HydraDX-node. + +// 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 super::*; +use primitives::constants::{ + currency::{deposit, CENTS, DOLLARS}, + time::{DAYS, HOURS}, +}; + +use frame_support::{ + parameter_types, + sp_runtime::{Perbill, Percent, Permill}, + traits::{ConstU32, EitherOfDiverse, LockIdentifier, NeverEnsureOrigin, PrivilegeCmp, U128CurrencyToVote}, + PalletId, +}; +use frame_system::EnsureRoot; +use sp_std::cmp::Ordering; + +parameter_types! { + pub TreasuryAccount: AccountId = Treasury::account_id(); + pub const ProposalBond: Permill = Permill::from_percent(3); + pub const ProposalBondMinimum: Balance = 100 * DOLLARS; + pub const ProposalBondMaximum: Balance = 500 * DOLLARS; + pub const SpendPeriod: BlockNumber = DAYS; + pub const Burn: Permill = Permill::from_percent(0); + pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); + pub const MaxApprovals: u32 = 100; +} + +impl pallet_treasury::Config for Runtime { + type Currency = Balances; + type ApproveOrigin = TreasuryApproveOrigin; + type RejectOrigin = MoreThanHalfCouncil; + type RuntimeEvent = RuntimeEvent; + type OnSlash = Treasury; + type ProposalBond = ProposalBond; + type ProposalBondMinimum = ProposalBondMinimum; + type ProposalBondMaximum = ProposalBondMaximum; + type SpendPeriod = SpendPeriod; + type Burn = Burn; + type PalletId = TreasuryPalletId; + type BurnDestination = (); + type WeightInfo = weights::treasury::HydraWeight; + type SpendFunds = (); + type MaxApprovals = MaxApprovals; + type SpendOrigin = NeverEnsureOrigin; +} + +parameter_types! { + pub PreimageBaseDeposit: Balance = deposit(2, 64); + pub PreimageByteDeposit: Balance = deposit(0, 1); +} + +impl pallet_preimage::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::preimage::HydraWeight; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type BaseDeposit = PreimageBaseDeposit; + type ByteDeposit = PreimageByteDeposit; +} + +/// Used the compare the privilege of an origin inside the scheduler. +pub struct OriginPrivilegeCmp; + +impl PrivilegeCmp for OriginPrivilegeCmp { + fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { + if left == right { + return Some(Ordering::Equal); + } + + match (left, right) { + // Root is greater than anything. + (OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater), + // Check which one has more yes votes. + ( + OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), + OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), + ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), + // For every other origin we don't care, as they are not used for `ScheduleOrigin`. + _ => None, + } + } +} + +parameter_types! { + pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; + pub const MaxScheduledPerBlock: u32 = 50; +} +impl pallet_scheduler::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type MaximumWeight = MaximumSchedulerWeight; + type ScheduleOrigin = MoreThanHalfCouncil; + type OriginPrivilegeCmp = OriginPrivilegeCmp; + type MaxScheduledPerBlock = MaxScheduledPerBlock; + type WeightInfo = weights::scheduler::HydraWeight; + type Preimages = Preimage; +} + +parameter_types! { + pub const CouncilMaxProposals: u32 = 30; + pub const CouncilMaxMembers: u32 = 13; + pub const CouncilMotionDuration: BlockNumber = 5 * DAYS; +} + +pub type CouncilCollective = pallet_collective::Instance1; +impl pallet_collective::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type MotionDuration = CouncilMotionDuration; + type MaxProposals = CouncilMaxProposals; + type MaxMembers = CouncilMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type WeightInfo = weights::council::HydraWeight; +} + +parameter_types! { + pub const TechnicalMaxProposals: u32 = 20; + pub const TechnicalMaxMembers: u32 = 10; + pub const TechnicalMotionDuration: BlockNumber = 5 * DAYS; +} + +pub type TechnicalCollective = pallet_collective::Instance2; +impl pallet_collective::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type MotionDuration = TechnicalMotionDuration; + type MaxProposals = TechnicalMaxProposals; + type MaxMembers = TechnicalMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type WeightInfo = weights::technical_comittee::HydraWeight; +} + +#[cfg(test)] +mod tests { + use super::{EnactmentPeriod, VoteLockingPeriod}; + + #[test] + fn democracy_periods() { + // Make sure VoteLockingPeriod > EnactmentPeriod + assert!(VoteLockingPeriod::get() > EnactmentPeriod::get()); + } +} + +pub type TreasuryApproveOrigin = EitherOfDiverse< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, +>; + +pub type MoreThanHalfCouncil = EitherOfDiverse< + EnsureRoot, + pallet_collective::EnsureProportionMoreThan, +>; + +pub type MajorityOfCouncil = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + EnsureRoot, +>; + +pub type AllCouncilMembers = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + EnsureRoot, +>; + +pub type MoreThanHalfTechCommittee = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + EnsureRoot, +>; + +pub type SuperMajorityTechCommittee = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + EnsureRoot, +>; + +pub type AllTechnicalCommitteeMembers = EitherOfDiverse< + pallet_collective::EnsureProportionAtLeast, + EnsureRoot, +>; + +parameter_types! { + pub const LaunchPeriod: BlockNumber = 3 * DAYS; + pub const VotingPeriod: BlockNumber = 3 * DAYS; + pub const FastTrackVotingPeriod: BlockNumber = 3 * HOURS; + pub const MinimumDeposit: Balance = 1000 * DOLLARS; + pub const EnactmentPeriod: BlockNumber = 24 * HOURS; + // Make sure VoteLockingPeriod > EnactmentPeriod + pub const VoteLockingPeriod: BlockNumber = 6 * DAYS; + pub const CooloffPeriod: BlockNumber = 7 * DAYS; + pub const InstantAllowed: bool = true; + pub const MaxVotes: u32 = 100; + pub const MaxProposals: u32 = 100; +} + +impl pallet_democracy::Config for Runtime { + type WeightInfo = weights::democracy::HydraWeight; + type RuntimeEvent = RuntimeEvent; + type Scheduler = Scheduler; + type Preimages = Preimage; + type Currency = Balances; + type EnactmentPeriod = EnactmentPeriod; + type LaunchPeriod = LaunchPeriod; + type VotingPeriod = VotingPeriod; + type VoteLockingPeriod = VoteLockingPeriod; + type MinimumDeposit = MinimumDeposit; + type InstantAllowed = InstantAllowed; + type FastTrackVotingPeriod = FastTrackVotingPeriod; + type CooloffPeriod = CooloffPeriod; + type MaxVotes = MaxVotes; + type MaxProposals = MaxProposals; + type MaxDeposits = ConstU32<100>; + type MaxBlacklisted = ConstU32<100>; + /// A straight majority of the council can decide what their next motion is. + type ExternalOrigin = MoreThanHalfCouncil; + type ExternalMajorityOrigin = MoreThanHalfCouncil; + /// A unanimous council can have the next scheduled referendum be a straight default-carries + /// (NTB) vote. + type ExternalDefaultOrigin = AllCouncilMembers; + type FastTrackOrigin = MoreThanHalfTechCommittee; + type InstantOrigin = AllTechnicalCommitteeMembers; + // To cancel a proposal which has been passed, 2/3 of the council must agree to it. + type CancellationOrigin = MajorityOfCouncil; + type BlacklistOrigin = EnsureRoot; + // To cancel a proposal before it has been passed, the technical committee must be unanimous or + // Root must agree. + type CancelProposalOrigin = AllTechnicalCommitteeMembers; + // Any single technical committee member may veto a coming council proposal, however they can + // only do it once and it lasts only for the cooloff period. + type VetoOrigin = pallet_collective::EnsureMember; + type PalletsOrigin = OriginCaller; + type Slash = Treasury; +} + +parameter_types! { + // Bond for candidacy into governance + pub const CandidacyBond: Balance = 5 * DOLLARS; + // 1 storage item created, key size is 32 bytes, value size is 16+16. + pub const VotingBondBase: Balance = CENTS; + // additional data per vote is 32 bytes (account id). + pub const VotingBondFactor: Balance = CENTS; + pub const TermDuration: BlockNumber = 7 * DAYS; + pub const DesiredMembers: u32 = 13; + pub const DesiredRunnersUp: u32 = 15; + pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect"; + pub const MaxElectionCandidates: u32 = 1_000; + pub const MaxElectionVoters: u32 = 10_000; +} + +impl pallet_elections_phragmen::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type PalletId = ElectionsPhragmenPalletId; + type Currency = Balances; + type ChangeMembers = Council; + type InitializeMembers = (); + // Set to () if defined in chain spec + type CurrencyToVote = U128CurrencyToVote; + type CandidacyBond = CandidacyBond; + type VotingBondBase = VotingBondBase; + type VotingBondFactor = VotingBondFactor; + type LoserCandidate = Treasury; + type KickedMember = Treasury; + type DesiredMembers = DesiredMembers; + type DesiredRunnersUp = DesiredRunnersUp; + type TermDuration = TermDuration; + type MaxCandidates = MaxElectionCandidates; + type MaxVoters = MaxElectionVoters; + type WeightInfo = (); +} + +parameter_types! { + pub const DataDepositPerByte: Balance = CENTS; + pub const TipCountdown: BlockNumber = 2 * HOURS; + pub const TipFindersFee: Percent = Percent::from_percent(1); + pub const TipReportDepositBase: Balance = 10 * DOLLARS; + pub const TipReportDepositPerByte: Balance = CENTS; + pub const MaximumReasonLength: u32 = 1024; +} + +impl pallet_tips::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type MaximumReasonLength = MaximumReasonLength; + type DataDepositPerByte = DataDepositPerByte; + type TipCountdown = TipCountdown; + type TipFindersFee = TipFindersFee; + type TipReportDepositBase = TipReportDepositBase; + type Tippers = Elections; + type WeightInfo = (); +} diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index 8c1d81397..3d4e43737 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -1,6 +1,6 @@ // This file is part of HydraDX-node. -// Copyright (C) 2020-2021 Intergalactic, Limited (GIB). +// Copyright (C) 2020-2023 Intergalactic, Limited (GIB). // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,61 +27,47 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); #[cfg(test)] mod tests; +mod benchmarking; +mod migrations; +pub mod weights; + +pub mod adapters; +mod assets; +mod governance; +mod system; +mod xcm; + +pub use assets::*; +pub use governance::*; +pub use system::*; +pub use xcm::*; + use codec::{Decode, Encode}; -use common_runtime::adapters::OraclePriceProviderAdapterForOmnipool; -use frame_system::{EnsureRoot, RawOrigin}; -use scale_info::TypeInfo; use sp_api::impl_runtime_apis; use sp_core::OpaqueMetadata; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, - traits::{AccountIdConversion, BlakeTwo256, Block as BlockT, IdentityLookup}, + traits::{AccountIdConversion, BlakeTwo256, Block as BlockT}, transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, Perbill, Permill, + ApplyExtrinsicResult, }; -use sp_std::cmp::Ordering; use sp_std::convert::From; use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; // A few exports that help ease life for downstream crates. -use frame_support::traits::AsEnsureOriginWithArg; -use frame_support::{ - construct_runtime, - dispatch::DispatchClass, - parameter_types, - traits::{ - ConstU32, Contains, EnsureOrigin, Get, InstanceFilter, NeverEnsureOrigin, PrivilegeCmp, U128CurrencyToVote, - }, - weights::{ - constants::{BlockExecutionWeight, RocksDbWeight}, - ConstantMultiplier, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, - }, - BoundedVec, +use frame_support::{construct_runtime, weights::Weight}; +pub use hex_literal::hex; +pub use primitives::{ + AccountId, Amount, AssetId, Balance, BlockNumber, CollectionId, Hash, Index, ItemId, Price, Signature, }; -use hydradx_traits::OraclePeriod; -use orml_traits::currency::MutationHooks; -use pallet_transaction_multi_payment::{AddTxAssetOnAccount, DepositAll, RemoveTxAssetOnKilled, TransferFees}; -use pallet_transaction_payment::TargetedFeeAdjustment; -use primitives::{CollectionId, ItemId}; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_runtime::traits::BlockNumberProvider; -use common_runtime::adapters::{EmaOraclePriceAdapter, OmnipoolHookAdapter}; -pub use common_runtime::*; -use pallet_currencies::BasicCurrencyAdapter; - -mod benchmarking; -mod migrations; -mod xcm; - -pub use hex_literal::hex; -use hydradx_adapters::inspect::MultiInspectAdapter; /// Import HydraDX pallets pub use pallet_claims; -pub use pallet_genesis_history; /// 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 @@ -110,7 +96,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 162, + spec_version: 163, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -126,42 +112,11 @@ pub fn native_version() -> NativeVersion { } } -use smallvec::smallvec; - -pub struct WeightToFee; - -impl WeightToFeePolynomial for WeightToFee { - type Balance = Balance; - - /// Handles converting a weight scalar to a fee value, based on the scale and granularity of the - /// node's balance type. - /// - /// This should typically create a mapping between the following ranges: - /// - [0, MAXIMUM_BLOCK_WEIGHT] - /// - [Balance::min, Balance::max] - /// - /// Yet, it can be used for any other sort of change to weight-fee. Some examples being: - /// - Setting it to `0` will essentially disable the weight fee. - /// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. - fn polynomial() -> WeightToFeeCoefficients { - // extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT - let p = CENTS; // 1_000_000_000_000 - let q = 10 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); // 7_919_840_000 - smallvec![WeightToFeeCoefficient { - degree: 1, - negative: false, - coeff_frac: Perbill::from_rational(p % q, q), - coeff_integer: p / q, // 124 - }] - } -} - -pub struct DustRemovalWhitelist; - -impl Contains for DustRemovalWhitelist { - fn contains(a: &AccountId) -> bool { - get_all_module_accounts().contains(a) || pallet_duster::DusterWhitelist::::contains(a) - } +pub fn get_all_module_accounts() -> Vec { + vec![ + TreasuryPalletId::get().into_account_truncating(), + VestingPalletId::get().into_account_truncating(), + ] } // Relay chain Block number provider. @@ -194,887 +149,6 @@ impl BlockNumberProvider for RelayChainBlockNumberProvi } } -// The reason why there is difference between PROD and benchmark is that it is not possible -// to set validation data in parachain system pallet in the benchmarks. -// So for benchmarking, we mock it out and return some hardcoded parent hash -pub struct RelayChainBlockHashProviderAdapter(sp_std::marker::PhantomData); - -#[cfg(not(feature = "runtime-benchmarks"))] -impl RelayChainBlockHashProvider for RelayChainBlockHashProviderAdapter -where - Runtime: cumulus_pallet_parachain_system::Config, -{ - fn parent_hash() -> Option { - let validation_data = cumulus_pallet_parachain_system::Pallet::::validation_data(); - match validation_data { - Some(data) => Some(data.parent_head.hash()), - None => None, - } - } -} - -#[cfg(feature = "runtime-benchmarks")] -impl RelayChainBlockHashProvider for RelayChainBlockHashProviderAdapter -where - Runtime: cumulus_pallet_parachain_system::Config, -{ - fn parent_hash() -> Option { - None - } -} - -pub struct CallFilter; -impl Contains for CallFilter { - fn contains(call: &RuntimeCall) -> bool { - if matches!( - call, - RuntimeCall::System(_) | RuntimeCall::Timestamp(_) | RuntimeCall::ParachainSystem(_) - ) { - // always allow - // Note: this is done to avoid unnecessary check of paused storage. - return true; - } - - if pallet_transaction_pause::PausedTransactionFilter::::contains(call) { - // if paused, dont allow! - return false; - } - - // filter transfers of LRNA and omnipool assets to the omnipool account - if let RuntimeCall::Tokens(orml_tokens::Call::transfer { dest, currency_id, .. }) - | RuntimeCall::Tokens(orml_tokens::Call::transfer_keep_alive { dest, currency_id, .. }) - | RuntimeCall::Tokens(orml_tokens::Call::transfer_all { dest, currency_id, .. }) - | RuntimeCall::Currencies(pallet_currencies::Call::transfer { dest, currency_id, .. }) = call - { - // Lookup::lookup() is not necessary thanks to IdentityLookup - if dest == &Omnipool::protocol_account() - && (*currency_id == ::HubAssetId::get() - || Omnipool::exists(*currency_id)) - { - return false; - } - } - // filter transfers of HDX to the omnipool account - if let RuntimeCall::Balances(pallet_balances::Call::transfer { dest, .. }) - | RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive { dest, .. }) - | RuntimeCall::Balances(pallet_balances::Call::transfer_all { dest, .. }) - | RuntimeCall::Currencies(pallet_currencies::Call::transfer_native_currency { dest, .. }) = call - { - // Lookup::lookup() is not necessary thanks to IdentityLookup - if dest == &Omnipool::protocol_account() { - return false; - } - } - - match call { - RuntimeCall::PolkadotXcm(_) => false, - RuntimeCall::OrmlXcm(_) => false, - _ => true, - } - } -} - -parameter_types! { - pub const Version: RuntimeVersion = VERSION; - /// Block weights base values and limits. - pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::builder() - .base_block(BlockExecutionWeight::get()) - .for_class(DispatchClass::all(), |weights| { - weights.base_extrinsic = ExtrinsicBaseWeight::get(); - }) - .for_class(DispatchClass::Normal, |weights| { - weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); - }) - .for_class(DispatchClass::Operational, |weights| { - weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); - // Operational transactions have an extra reserved space, so that they - // are included even if block reachd `MAXIMUM_BLOCK_WEIGHT`. - weights.reserved = Some( - MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT, - ); - }) - .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) - .build_or_panic(); - pub ExtrinsicBaseWeight: Weight = frame_support::weights::constants::ExtrinsicBaseWeight::get(); -} - -// Configure FRAME pallets to include in runtime. - -impl frame_system::Config for Runtime { - /// The basic call filter to use in dispatchable. - type BaseCallFilter = CallFilter; - type BlockWeights = BlockWeights; - type BlockLength = BlockLength; - /// The ubiquitous origin type. - type RuntimeOrigin = RuntimeOrigin; - /// The aggregated dispatch type that is available for extrinsics. - type RuntimeCall = RuntimeCall; - /// The index type for storing how many extrinsics an account has signed. - type Index = Index; - /// The index type for blocks. - type BlockNumber = BlockNumber; - /// The type for hashing blocks and tries. - type Hash = Hash; - /// The hashing algorithm used. - type Hashing = BlakeTwo256; - /// The identifier used to distinguish between accounts. - type AccountId = AccountId; - /// The lookup mechanism to get account ID from whatever is passed in dispatchers. - type Lookup = IdentityLookup; - /// The header type. - type Header = generic::Header; - /// The ubiquitous event type. - type RuntimeEvent = RuntimeEvent; - /// 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. - type DbWeight = RocksDbWeight; - /// The weight of the overhead invoked on the block import process, independent of the - /// extrinsics included in that block. - /// Version of the runtime. - type Version = Version; - /// Converts a module to the index of the module in `construct_runtime!`. - /// - /// This type is being generated by `construct_runtime!`. - type PalletInfo = PalletInfo; - /// The data to be stored in an account. - type AccountData = pallet_balances::AccountData; - /// What to do if a new account is created. - type OnNewAccount = (); - /// What to do if an account is fully reaped from the system. - type OnKilledAccount = (); - /// Weight information for the extrinsics of this pallet. - type SystemWeightInfo = common_runtime::weights::system::HydraWeight; - type SS58Prefix = SS58Prefix; - type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; - type MaxConsumers = frame_support::traits::ConstU32<16>; -} - -impl pallet_timestamp::Config for Runtime { - /// A timestamp: milliseconds since the unix epoch. - type Moment = u64; - type OnTimestampSet = (); - type MinimumPeriod = MinimumPeriod; - type WeightInfo = weights::timestamp::HydraWeight; -} - -impl pallet_balances::Config for Runtime { - type MaxLocks = MaxLocks; - /// The type for recording an account's balance. - type Balance = Balance; - /// The ubiquitous event type. - type RuntimeEvent = RuntimeEvent; - type DustRemoval = Treasury; - type ExistentialDeposit = NativeExistentialDeposit; - type AccountStore = System; - type WeightInfo = weights::balances::HydraWeight; - type MaxReserves = MaxReserves; - type ReserveIdentifier = [u8; 8]; -} - -/// Parameterized slow adjusting fee updated based on -/// https://w3f-research.readthedocs.io/en/latest/polkadot/overview/2-token-economics.html?highlight=token%20economics#-2.-slow-adjusting-mechanism -pub type SlowAdjustingFeeUpdate = - TargetedFeeAdjustment; - -impl pallet_transaction_payment::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = TransferFees, TreasuryAccount>; - type OperationalFeeMultiplier = (); - type WeightToFee = WeightToFee; - type LengthToFee = ConstantMultiplier; - type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; -} - -// Parachain Config - -parameter_types! { - pub ReservedXcmpWeight: Weight = BlockWeights::get().max_block / 4; - pub ReservedDmpWeight: Weight = BlockWeights::get().max_block / 4; -} - -impl cumulus_pallet_parachain_system::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - 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; -} - -impl pallet_aura::Config for Runtime { - type AuthorityId = AuraId; - type MaxAuthorities = MaxAuthorities; - type DisabledValidators = (); -} - -impl parachain_info::Config for Runtime {} - -impl cumulus_pallet_aura_ext::Config for Runtime {} - -impl pallet_treasury::Config for Runtime { - type PalletId = TreasuryPalletId; - type Currency = Balances; - type ApproveOrigin = TreasuryApproveOrigin; - type RejectOrigin = MoreThanHalfCouncil; - type RuntimeEvent = RuntimeEvent; - type OnSlash = Treasury; - type ProposalBond = ProposalBond; - type ProposalBondMinimum = ProposalBondMinimum; - type ProposalBondMaximum = ProposalBondMaximum; - type SpendPeriod = SpendPeriod; - type Burn = Burn; - type BurnDestination = (); - type WeightInfo = weights::treasury::HydraWeight; - type SpendFunds = (); - type MaxApprovals = MaxApprovals; - type SpendOrigin = NeverEnsureOrigin; -} - -impl pallet_authorship::Config for Runtime { - type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type EventHandler = (CollatorSelection,); -} - -impl pallet_collator_selection::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type UpdateOrigin = MoreThanHalfCouncil; - type PotId = PotId; - type MaxCandidates = MaxCandidates; - type MinCandidates = MinCandidates; - type MaxInvulnerables = MaxInvulnerables; - // should be a multiple of session or things will get inconsistent - type KickThreshold = Period; - type ValidatorId = ::AccountId; - type ValidatorIdOf = pallet_collator_selection::IdentityCollator; - type ValidatorRegistration = Session; - type WeightInfo = weights::collator_selection::HydraWeight; -} - -impl pallet_session::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type ValidatorId = ::AccountId; - // we don't have stash and controller, thus we don't need the convert as well. - type ValidatorIdOf = pallet_collator_selection::IdentityCollator; - type ShouldEndSession = pallet_session::PeriodicSessions; - type NextSessionRotation = pallet_session::PeriodicSessions; - // We wrap the session manager to give out rewards. - type SessionManager = CollatorRewards; - // Essentially just Aura, but lets be pedantic. - type SessionHandler = ::KeyTypeIdProviders; - type Keys = opaque::SessionKeys; - type WeightInfo = (); -} - -impl pallet_utility::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; - type PalletsOrigin = OriginCaller; - type WeightInfo = weights::utility::HydraWeight; -} - -impl pallet_preimage::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::preimage::HydraWeight; - type Currency = Balances; - type ManagerOrigin = EnsureRoot; - type BaseDeposit = PreimageBaseDeposit; - type ByteDeposit = PreimageByteDeposit; -} - -/// Used the compare the privilege of an origin inside the scheduler. -pub struct OriginPrivilegeCmp; - -impl PrivilegeCmp for OriginPrivilegeCmp { - fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { - if left == right { - return Some(Ordering::Equal); - } - - match (left, right) { - // Root is greater than anything. - (OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater), - // Check which one has more yes votes. - ( - OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), - OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), - ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), - // For every other origin we don't care, as they are not used for `ScheduleOrigin`. - _ => None, - } - } -} - -parameter_types! { - pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; - pub const MaxScheduledPerBlock: u32 = 50; - pub const NoPreimagePostponement: Option = Some(5 * MINUTES); -} -impl pallet_scheduler::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; - type PalletsOrigin = OriginCaller; - type RuntimeCall = RuntimeCall; - type MaximumWeight = MaximumSchedulerWeight; - type ScheduleOrigin = MoreThanHalfCouncil; - type OriginPrivilegeCmp = OriginPrivilegeCmp; - type MaxScheduledPerBlock = MaxScheduledPerBlock; - type WeightInfo = weights::scheduler::HydraWeight; - type Preimages = Preimage; -} - -impl pallet_identity::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type BasicDeposit = BasicDeposit; - type FieldDeposit = FieldDeposit; - type SubAccountDeposit = SubAccountDeposit; - type MaxSubAccounts = MaxSubAccounts; - type MaxAdditionalFields = MaxAdditionalFields; - type MaxRegistrars = MaxRegistrars; - type Slashed = Treasury; - type ForceOrigin = MoreThanHalfCouncil; - type RegistrarOrigin = MoreThanHalfCouncil; - type WeightInfo = weights::identity::HydraWeight; -} - -impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type MotionDuration = CouncilMotionDuration; - type MaxProposals = CouncilMaxProposals; - type MaxMembers = CouncilMaxMembers; - type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = common_runtime::weights::council::HydraWeight; -} - -impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type MotionDuration = TechnicalMotionDuration; - type MaxProposals = TechnicalMaxProposals; - type MaxMembers = TechnicalMaxMembers; - type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = common_runtime::weights::technical_comittee::HydraWeight; -} - -impl pallet_democracy::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type EnactmentPeriod = EnactmentPeriod; - type LaunchPeriod = LaunchPeriod; - type VotingPeriod = VotingPeriod; - type MinimumDeposit = MinimumDeposit; - /// A straight majority of the council can decide what their next motion is. - type ExternalOrigin = MoreThanHalfCouncil; - type ExternalMajorityOrigin = MoreThanHalfCouncil; - /// A unanimous council can have the next scheduled referendum be a straight default-carries - /// (NTB) vote. - type ExternalDefaultOrigin = AllCouncilMembers; - type FastTrackOrigin = MoreThanHalfTechCommittee; - type InstantOrigin = AllTechnicalCommitteeMembers; - type InstantAllowed = InstantAllowed; - type FastTrackVotingPeriod = FastTrackVotingPeriod; - // To cancel a proposal which has been passed, 2/3 of the council must agree to it. - type CancellationOrigin = MajorityOfCouncil; - // To cancel a proposal before it has been passed, the technical committee must be unanimous or - // Root must agree. - type CancelProposalOrigin = AllTechnicalCommitteeMembers; - type BlacklistOrigin = EnsureRoot; - // Any single technical committee member may veto a coming council proposal, however they can - // only do it once and it lasts only for the cooloff period. - type VetoOrigin = pallet_collective::EnsureMember; - type CooloffPeriod = CooloffPeriod; - type Slash = Treasury; - type Scheduler = Scheduler; - type PalletsOrigin = OriginCaller; - type MaxVotes = MaxVotes; - type WeightInfo = weights::democracy::HydraWeight; - type MaxProposals = MaxProposals; - type VoteLockingPeriod = VoteLockingPeriod; - type Preimages = Preimage; - type MaxDeposits = ConstU32<100>; - type MaxBlacklisted = ConstU32<100>; -} - -impl pallet_elections_phragmen::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type PalletId = ElectionsPhragmenPalletId; - type Currency = Balances; - type ChangeMembers = Council; - type InitializeMembers = (); - // Set to () if defined in chain spec - type CurrencyToVote = U128CurrencyToVote; - type CandidacyBond = CandidacyBond; - type VotingBondBase = VotingBondBase; - type VotingBondFactor = VotingBondFactor; - type LoserCandidate = Treasury; - type KickedMember = Treasury; - type DesiredMembers = DesiredMembers; - type DesiredRunnersUp = DesiredRunnersUp; - type TermDuration = TermDuration; - type MaxCandidates = MaxElectionCandidates; - type MaxVoters = MaxElectionVoters; - type WeightInfo = (); -} - -impl pallet_tips::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type DataDepositPerByte = DataDepositPerByte; - type MaximumReasonLength = MaximumReasonLength; - type Tippers = Elections; - type TipCountdown = TipCountdown; - type TipFindersFee = TipFindersFee; - type TipReportDepositBase = TipReportDepositBase; - type WeightInfo = (); -} - -/// ORML Configurations -pub struct CurrencyHooks; -impl MutationHooks for CurrencyHooks { - type OnDust = Duster; - type OnSlash = (); - type PreDeposit = (); - type PostDeposit = (); - type PreTransfer = (); - type PostTransfer = (); - type OnNewTokenAccount = AddTxAssetOnAccount; - type OnKilledTokenAccount = RemoveTxAssetOnKilled; -} - -impl orml_tokens::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Balance = Balance; - type Amount = Amount; - type CurrencyId = AssetId; - type WeightInfo = weights::tokens::HydraWeight; - type ExistentialDeposits = AssetRegistry; - type MaxLocks = MaxLocks; - type DustRemovalWhitelist = DustRemovalWhitelist; - type MaxReserves = MaxReserves; - type ReserveIdentifier = [u8; 8]; - type CurrencyHooks = CurrencyHooks; -} - -pub struct RootAsVestingPallet; -impl EnsureOrigin for RootAsVestingPallet { - type Success = AccountId; - - fn try_origin(o: RuntimeOrigin) -> Result { - Into::, RuntimeOrigin>>::into(o).and_then(|o| match o { - RawOrigin::Root => Ok(VestingPalletId::get().into_account_truncating()), - r => Err(RuntimeOrigin::from(r)), - }) - } - - #[cfg(feature = "runtime-benchmarks")] - fn try_successful_origin() -> Result { - let zero_account_id = AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) - .expect("infinite length input; no invalid inputs for type; qed"); - Ok(RuntimeOrigin::from(RawOrigin::Signed(zero_account_id))) - } -} - -impl orml_vesting::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type MinVestedTransfer = MinVestedTransfer; - type VestedTransferOrigin = RootAsVestingPallet; - type WeightInfo = weights::vesting::HydraWeight; - type MaxVestingSchedules = MaxVestingSchedules; - type BlockNumberProvider = RelayChainBlockNumberProvider; -} - -impl InstanceFilter for ProxyType { - fn filter(&self, c: &RuntimeCall) -> bool { - match self { - ProxyType::Any => true, - ProxyType::CancelProxy => matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. })), - ProxyType::Governance => matches!( - c, - RuntimeCall::Democracy(..) - | RuntimeCall::Council(..) - | RuntimeCall::TechnicalCommittee(..) - | RuntimeCall::Elections(..) - | RuntimeCall::Treasury(..) - | RuntimeCall::Tips(..) - | RuntimeCall::Utility(..) - ), - // Transfer group doesn't include cross-chain transfers - ProxyType::Transfer => matches!( - c, - RuntimeCall::Balances(..) | RuntimeCall::Currencies(..) | RuntimeCall::Tokens(..) - ), - ProxyType::Liquidity => matches!( - c, - RuntimeCall::Omnipool(pallet_omnipool::Call::add_liquidity { .. }) - | RuntimeCall::Omnipool(pallet_omnipool::Call::remove_liquidity { .. }) - ), - ProxyType::LiquidityMining => matches!( - c, - RuntimeCall::OmnipoolLiquidityMining(pallet_omnipool_liquidity_mining::Call::deposit_shares { .. }) - | RuntimeCall::OmnipoolLiquidityMining( - pallet_omnipool_liquidity_mining::Call::redeposit_shares { .. } - ) | RuntimeCall::OmnipoolLiquidityMining(pallet_omnipool_liquidity_mining::Call::claim_rewards { .. }) - | RuntimeCall::OmnipoolLiquidityMining( - pallet_omnipool_liquidity_mining::Call::withdraw_shares { .. } - ) - ), - } - } - fn is_superset(&self, o: &Self) -> bool { - match (self, o) { - (x, y) if x == y => true, - (ProxyType::Any, _) => true, - (_, ProxyType::Any) => false, - _ => false, - } - } -} - -impl pallet_proxy::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; - type Currency = Balances; - type ProxyType = ProxyType; - type ProxyDepositBase = ProxyDepositBase; - type ProxyDepositFactor = ProxyDepositFactor; - type MaxProxies = MaxProxies; - type WeightInfo = weights::proxy::HydraWeight; - type MaxPending = MaxPending; - type CallHasher = BlakeTwo256; - type AnnouncementDepositBase = AnnouncementDepositBase; - type AnnouncementDepositFactor = AnnouncementDepositFactor; -} - -impl pallet_multisig::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; - type Currency = Balances; - type DepositBase = DepositBase; - type DepositFactor = DepositFactor; - type MaxSignatories = MaxSignatories; - type WeightInfo = (); -} - -/// HydraDX Pallets configurations - -impl pallet_claims::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type Prefix = ClaimMessagePrefix; - type WeightInfo = weights::claims::HydraWeight; - type CurrencyBalance = Balance; -} - -impl pallet_genesis_history::Config for Runtime {} - -parameter_types! { - pub TreasuryAccount: AccountId = Treasury::account_id(); -} - -impl pallet_transaction_multi_payment::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type AcceptedCurrencyOrigin = SuperMajorityTechCommittee; - type Currencies = Currencies; - type SpotPriceProvider = Omnipool; - type WeightInfo = weights::payment::HydraWeight; - type WeightToFee = WeightToFee; - type NativeAssetId = NativeAssetId; -} - -#[derive(Debug, Default, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)] -pub struct AssetLocation(pub polkadot_xcm::v3::MultiLocation); - -impl pallet_asset_registry::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RegistryOrigin = SuperMajorityTechCommittee; - type AssetId = AssetId; - type Balance = Balance; - type AssetNativeLocation = AssetLocation; - type SequentialIdStartAt = SequentialIdOffset; - type StringLimit = RegistryStrLimit; - type NativeAssetId = NativeAssetId; - type WeightInfo = weights::registry::HydraWeight; -} - -impl pallet_relaychain_info::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RelaychainBlockNumberProvider = RelayChainBlockNumberProvider; -} - -// The latest versions of the orml-currencies pallet don't emit events. -// The infrastructure relies on the events from this pallet, so we use the latest version of -// the pallet that contains and emit events and was updated to the polkadot version we use. -impl pallet_currencies::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type MultiCurrency = Tokens; - type NativeCurrency = BasicCurrencyAdapter; - type GetNativeCurrencyId = NativeAssetId; - type WeightInfo = weights::currencies::HydraWeight; -} - -parameter_types! { - pub const RewardPerCollator: Balance = 455_371_584_699_000; // 83333 HDX / 183 sessions - //GalacticCouncil collators - pub ExcludedCollators: Vec = vec![ - // 5G3t6yhAonQHGUEqrByWQPgP9R8fcSSL6Vujphc89ysdTpKF - hex!["b0502e92d738d528922e8963b8a58a3c7c3b693db51b0972a6981836d67b8835"].into(), - // 5CVBHPAjhcVVAvL3AYpa9MB6kWDwoJbBwu7q4MqbhKwNnrV4 - hex!["12aa36d6c1b055b9a7ab5d39f4fd9a9fe42912163c90e122fb7997e890a53d7e"].into(), - // 5DFGmHjpxS6Xveg4YDw2hSp62JJ9h8oLCkeZUAoVR7hVtQ3k - hex!["344b7693389189ad0be0c83630b02830a568f7cb0f2d4b3483bcea323cc85f70"].into(), - // 5H178NL4DLM9DGgAgZz1kbrX2TReP3uPk7svPtsg1VcYnuXH - hex!["da6e859211b1140369a73af533ecea4e4c0e985ad122ac4c663cc8b81d4fcd12"].into(), - // 5Ca1iV2RNV253FzYJo12XtKJMPWCjv5CsPK9HdmwgJarD1sJ - hex!["165a3c2eb21341bf170fd1fa728bd9a7d02b7dc3b4968a46f2b1d494ee8c2b5d"].into(), - ]; -} - -impl pallet_collator_rewards::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Balance = Balance; - type CurrencyId = AssetId; - type Currency = Currencies; - type RewardPerCollator = RewardPerCollator; - type ExcludedCollators = ExcludedCollators; - type RewardCurrencyId = NativeAssetId; - // We wrap the ` SessionManager` implementation of `CollatorSelection` to get the collatrs that - // we hand out rewards to. - type SessionManager = CollatorSelection; -} - -parameter_types! { - pub const CollectionDeposit: Balance = 0; - pub const ItemDeposit: Balance = 0; - pub const KeyLimit: u32 = 256; // Max 256 bytes per key - pub const ValueLimit: u32 = 1024; // Max 1024 bytes per value - pub const UniquesMetadataDepositBase: Balance = 1_000 * UNITS; - pub const AttributeDepositBase: Balance = UNITS; - pub const DepositPerByte: Balance = UNITS; - pub const UniquesStringLimit: u32 = 72; -} - -impl pallet_uniques::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type CollectionId = CollectionId; - type ItemId = ItemId; - type Currency = Balances; - type ForceOrigin = MajorityOfCouncil; - // Standard collection creation is disallowed - type CreateOrigin = AsEnsureOriginWithArg>; - type Locker = (); - type CollectionDeposit = CollectionDeposit; - type ItemDeposit = ItemDeposit; - type MetadataDepositBase = UniquesMetadataDepositBase; - type AttributeDepositBase = AttributeDepositBase; - type DepositPerByte = DepositPerByte; - type StringLimit = UniquesStringLimit; - type KeyLimit = KeyLimit; - type ValueLimit = ValueLimit; - type WeightInfo = (); - #[cfg(feature = "runtime-benchmarks")] - type Helper = (); -} - -parameter_types! { - pub const LRNA: AssetId = 1; - pub const StableAssetId: AssetId = 2; - pub ProtocolFee: Permill = Permill::from_rational(5u32,10000u32); - pub AssetFee: Permill = Permill::from_rational(25u32,10000u32); - pub const MinTradingLimit : Balance = 1_000u128; - pub const MinPoolLiquidity: Balance = 1_000_000u128; - pub const MaxInRatio: Balance = 3u128; - pub const MaxOutRatio: Balance = 3u128; - pub const OmnipoolCollectionId: CollectionId = 1337u128; - pub const EmaOracleSpotPriceLastBlock: OraclePeriod = OraclePeriod::LastBlock; - pub const EmaOracleSpotPriceShort: OraclePeriod = OraclePeriod::Short; - pub const OmnipoolMaxAllowedPriceDifference: Permill = Permill::from_percent(1); - pub MinimumWithdrawalFee: Permill = Permill::from_rational(1u32,10000); -} - -impl pallet_omnipool::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type AssetId = AssetId; - type Currency = Currencies; - type AuthorityOrigin = EnsureRoot; - type TechnicalOrigin = SuperMajorityTechCommittee; - type AssetRegistry = AssetRegistry; - type HdxAssetId = NativeAssetId; - type HubAssetId = LRNA; - type StableCoinAssetId = StableAssetId; - type ProtocolFee = ProtocolFee; - type AssetFee = AssetFee; - type MinWithdrawalFee = MinimumWithdrawalFee; - type MinimumTradingLimit = MinTradingLimit; - type MinimumPoolLiquidity = MinPoolLiquidity; - type MaxInRatio = MaxInRatio; - type MaxOutRatio = MaxOutRatio; - type PositionItemId = ItemId; - type CollectionId = CollectionId; - type NFTCollectionId = OmnipoolCollectionId; - type NFTHandler = Uniques; - type WeightInfo = weights::omnipool::HydraWeight; - type OmnipoolHooks = OmnipoolHookAdapter; - type PriceBarrier = ( - EnsurePriceWithin< - AccountId, - AssetId, - EmaOraclePriceAdapter, - OmnipoolMaxAllowedPriceDifference, - CircuitBreakerWhitelist, - >, - EnsurePriceWithin< - AccountId, - AssetId, - EmaOraclePriceAdapter, - OmnipoolMaxAllowedPriceDifference, - CircuitBreakerWhitelist, - >, - ); - type ExternalPriceOracle = EmaOraclePriceAdapter; -} - -impl pallet_transaction_pause::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type UpdateOrigin = SuperMajorityTechCommittee; - type WeightInfo = weights::transaction_pause::HydraWeight; -} - -impl pallet_circuit_breaker::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type AssetId = AssetId; - type Balance = Balance; - type TechnicalOrigin = SuperMajorityTechCommittee; - type WhitelistedAccounts = CircuitBreakerWhitelist; - type DefaultMaxNetTradeVolumeLimitPerBlock = DefaultMaxNetTradeVolumeLimitPerBlock; - type DefaultMaxAddLiquidityLimitPerBlock = DefaultMaxLiquidityLimitPerBlock; - type DefaultMaxRemoveLiquidityLimitPerBlock = DefaultMaxLiquidityLimitPerBlock; - type OmnipoolHubAsset = LRNA; - type WeightInfo = weights::circuit_breaker::HydraWeight; -} - -// constants need to be in scope to use as types -use pallet_dca::RelayChainBlockHashProvider; -use pallet_ema_oracle::MAX_PERIODS; -use pallet_omnipool::traits::EnsurePriceWithin; - -parameter_types! { - pub SupportedPeriods: BoundedVec> = BoundedVec::truncate_from(vec![ - OraclePeriod::LastBlock, OraclePeriod::Short, OraclePeriod::TenMinutes]); -} - -impl pallet_ema_oracle::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::ema_oracle::HydraWeight; - /// The definition of the oracle time periods currently assumes a 6 second block time. - /// We use the parachain blocks anyway, because we want certain guarantees over how many blocks correspond - /// to which smoothing factor. - type BlockNumberProvider = System; - type SupportedPeriods = SupportedPeriods; - /// With every asset trading against LRNA we will only have as many pairs as there will be assets, so - /// 20 seems a decent upper bound for the forseeable future. - type MaxUniqueEntries = ConstU32<20>; -} - -impl pallet_duster::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Balance = Balance; - type Amount = Amount; - type CurrencyId = AssetId; - type MultiCurrency = Currencies; - type MinCurrencyDeposits = AssetRegistry; - type Reward = DustingReward; - type NativeCurrencyId = NativeAssetId; - type BlacklistUpdateOrigin = SuperMajorityTechCommittee; - type WeightInfo = (); -} - -type OmnipoolLiquidityMiningInstance = warehouse_liquidity_mining::Instance1; -impl warehouse_liquidity_mining::Config for Runtime { - type AssetId = AssetId; - type MultiCurrency = Currencies; - type PalletId = OmniWarehouseLMPalletId; - type MinTotalFarmRewards = MinTotalFarmRewards; - type MinPlannedYieldingPeriods = MinPlannedYieldingPeriods; - type BlockNumberProvider = RelayChainBlockNumberProvider; - type AmmPoolId = AssetId; - type MaxFarmEntriesPerDeposit = MaxEntriesPerDeposit; - type MaxYieldFarmsPerGlobalFarm = MaxYieldFarmsPerGlobalFarm; - type AssetRegistry = AssetRegistry; - type NonDustableWhitelistHandler = Duster; - type RuntimeEvent = RuntimeEvent; - type PriceAdjustment = adapters::PriceAdjustmentAdapter; -} - -impl pallet_omnipool_liquidity_mining::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Currency = Currencies; - type CreateOrigin = AllTechnicalCommitteeMembers; - type PalletId = OmniLMPalletId; - type NFTCollectionId = OmnipoolLMCollectionId; - type NFTHandler = Uniques; - type LiquidityMiningHandler = OmnipoolWarehouseLM; - type OracleSource = OmnipoolLMOracleSource; - type OraclePeriod = OmnipoolLMOraclePeriod; - type PriceOracle = EmaOracle; - type WeightInfo = common_runtime::weights::omnipool_lm::HydraWeight; -} - -impl pallet_dca::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Currencies = Currencies; - type RandomnessProvider = DCA; - type OraclePriceProvider = OraclePriceProviderAdapterForOmnipool; - type SpotPriceProvider = Omnipool; - type MaxPriceDifferenceBetweenBlocks = MaxPriceDifference; - type MaxSchedulePerBlock = MaxSchedulesPerBlock; - type NativeAssetId = NativeAssetId; - type MinBudgetInNativeCurrency = MinBudgetInNativeCurrency; - type MinimumTradingLimit = MinTradingLimit; - type FeeReceiver = TreasuryAccount; - type NamedReserveId = NamedReserveId; - type WeightToFee = WeightToFee; - type WeightInfo = weights::dca::HydraWeight; - type MaxNumberOfRetriesOnError = MaxNumberOfRetriesOnError; - type TechnicalOrigin = SuperMajorityTechCommittee; - type RelayChainBlockHashProvider = RelayChainBlockHashProviderAdapter; -} - -parameter_types! { - pub const MaxNumberOfTrades: u8 = 5; -} - -impl pallet_route_executor::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type AssetId = AssetId; - type Balance = Balance; - type MaxNumberOfTrades = MaxNumberOfTrades; - type Currency = MultiInspectAdapter; - type AMM = Omnipool; - type WeightInfo = weights::route_executor::HydraWeight; -} - -parameter_types! { - pub const ExistentialDepositMultiplier: u8 = 5; -} - -impl pallet_otc::Config for Runtime { - type AssetId = AssetId; - type AssetRegistry = AssetRegistry; - type Currency = Currencies; - type RuntimeEvent = RuntimeEvent; - type ExistentialDeposits = AssetRegistry; - type ExistentialDepositMultiplier = ExistentialDepositMultiplier; - type WeightInfo = weights::otc::HydraWeight; -} - // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -1398,15 +472,15 @@ impl_runtime_apis! { let whitelist: Vec = vec![ // Block Number - hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(), + hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(), // Total Issuance - hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(), + hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(), // Execution Phase - hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(), + hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(), // Event Count - hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(), + hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(), // System Events - hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(), + hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(), ]; let mut batches = Vec::::new(); diff --git a/runtime/hydradx/src/system.rs b/runtime/hydradx/src/system.rs new file mode 100644 index 000000000..1341f68b7 --- /dev/null +++ b/runtime/hydradx/src/system.rs @@ -0,0 +1,512 @@ +// This file is part of HydraDX-node. + +// 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 super::*; + +use pallet_transaction_multi_payment::{DepositAll, TransferFees}; +use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment}; +use primitives::constants::{ + chain::{CORE_ASSET_ID, MAXIMUM_BLOCK_WEIGHT}, + currency::{deposit, CENTS, DOLLARS, MILLICENTS}, + time::{HOURS, SLOT_DURATION}, +}; + +use codec::{Decode, Encode, MaxEncodedLen}; +use frame_support::{ + dispatch::DispatchClass, + parameter_types, + sp_runtime::{traits::IdentityLookup, FixedPointNumber, Perbill, Perquintill}, + traits::{Contains, InstanceFilter}, + weights::{ + constants::{BlockExecutionWeight, RocksDbWeight}, + ConstantMultiplier, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, + }, + PalletId, RuntimeDebug, +}; +use scale_info::TypeInfo; + +pub struct CallFilter; +impl Contains for CallFilter { + fn contains(call: &RuntimeCall) -> bool { + if matches!( + call, + RuntimeCall::System(_) | RuntimeCall::Timestamp(_) | RuntimeCall::ParachainSystem(_) + ) { + // always allow + // Note: this is done to avoid unnecessary check of paused storage. + return true; + } + + if pallet_transaction_pause::PausedTransactionFilter::::contains(call) { + // if paused, dont allow! + return false; + } + + // filter transfers of LRNA and omnipool assets to the omnipool account + if let RuntimeCall::Tokens(orml_tokens::Call::transfer { dest, currency_id, .. }) + | RuntimeCall::Tokens(orml_tokens::Call::transfer_keep_alive { dest, currency_id, .. }) + | RuntimeCall::Tokens(orml_tokens::Call::transfer_all { dest, currency_id, .. }) + | RuntimeCall::Currencies(pallet_currencies::Call::transfer { dest, currency_id, .. }) = call + { + // Lookup::lookup() is not necessary thanks to IdentityLookup + if dest == &Omnipool::protocol_account() + && (*currency_id == ::HubAssetId::get() + || Omnipool::exists(*currency_id)) + { + return false; + } + } + // filter transfers of HDX to the omnipool account + if let RuntimeCall::Balances(pallet_balances::Call::transfer { dest, .. }) + | RuntimeCall::Balances(pallet_balances::Call::transfer_keep_alive { dest, .. }) + | RuntimeCall::Balances(pallet_balances::Call::transfer_all { dest, .. }) + | RuntimeCall::Currencies(pallet_currencies::Call::transfer_native_currency { dest, .. }) = call + { + // Lookup::lookup() is not necessary thanks to IdentityLookup + if dest == &Omnipool::protocol_account() { + return false; + } + } + + match call { + RuntimeCall::PolkadotXcm(_) => false, + RuntimeCall::OrmlXcm(_) => false, + _ => true, + } + } +} + +/// 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%`. +pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_perthousand(25); +/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used +/// by Operational extrinsics. +pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); + +parameter_types! { + pub const Version: RuntimeVersion = VERSION; + /// Block weights base values and limits. + pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::builder() + .base_block(BlockExecutionWeight::get()) + .for_class(DispatchClass::all(), |weights| { + weights.base_extrinsic = ExtrinsicBaseWeight::get(); + }) + .for_class(DispatchClass::Normal, |weights| { + weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + .for_class(DispatchClass::Operational, |weights| { + weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); + // Operational transactions have an extra reserved space, so that they + // are included even if block reachd `MAXIMUM_BLOCK_WEIGHT`. + weights.reserved = Some( + MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT, + ); + }) + .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) + .build_or_panic(); + pub ExtrinsicBaseWeight: Weight = frame_support::weights::constants::ExtrinsicBaseWeight::get(); + pub const BlockHashCount: BlockNumber = 2400; + /// Maximum length of block. Up to 5MB. + pub BlockLength: frame_system::limits::BlockLength = + frame_system::limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); + pub const SS58Prefix: u16 = 63; +} + +impl frame_system::Config for Runtime { + /// The basic call filter to use in dispatchable. + type BaseCallFilter = CallFilter; + type BlockWeights = BlockWeights; + type BlockLength = BlockLength; + /// The ubiquitous origin type. + type RuntimeOrigin = RuntimeOrigin; + /// The aggregated dispatch type that is available for extrinsics. + type RuntimeCall = RuntimeCall; + /// The index type for storing how many extrinsics an account has signed. + type Index = Index; + /// The index type for blocks. + type BlockNumber = BlockNumber; + /// The type for hashing blocks and tries. + type Hash = Hash; + /// The hashing algorithm used. + type Hashing = BlakeTwo256; + /// The identifier used to distinguish between accounts. + type AccountId = AccountId; + /// The lookup mechanism to get account ID from whatever is passed in dispatchers. + type Lookup = IdentityLookup; + /// The header type. + type Header = generic::Header; + /// The ubiquitous event type. + type RuntimeEvent = RuntimeEvent; + /// 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. + type DbWeight = RocksDbWeight; + /// The weight of the overhead invoked on the block import process, independent of the + /// extrinsics included in that block. + /// Version of the runtime. + type Version = Version; + /// Converts a module to the index of the module in `construct_runtime!`. + /// + /// This type is being generated by `construct_runtime!`. + type PalletInfo = PalletInfo; + /// The data to be stored in an account. + type AccountData = pallet_balances::AccountData; + /// What to do if a new account is created. + type OnNewAccount = (); + /// 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::HydraWeight; + type SS58Prefix = SS58Prefix; + type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +parameter_types! { + pub const MinimumPeriod: u64 = SLOT_DURATION / 2; + pub const NativeAssetId : AssetId = CORE_ASSET_ID; +} +impl pallet_timestamp::Config for Runtime { + /// A timestamp: milliseconds since the unix epoch. + type Moment = u64; + type OnTimestampSet = (); + type MinimumPeriod = MinimumPeriod; + type WeightInfo = weights::timestamp::HydraWeight; +} + +parameter_types! { + pub ReservedXcmpWeight: Weight = BlockWeights::get().max_block / 4; + pub ReservedDmpWeight: Weight = BlockWeights::get().max_block / 4; +} + +impl cumulus_pallet_parachain_system::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + 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; +} + +parameter_types! { + pub const MaxAuthorities: u32 = 50; +} + +impl pallet_aura::Config for Runtime { + type AuthorityId = AuraId; + type MaxAuthorities = MaxAuthorities; + type DisabledValidators = (); +} + +impl parachain_info::Config for Runtime {} + +impl cumulus_pallet_aura_ext::Config for Runtime {} + +impl pallet_authorship::Config for Runtime { + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; + type EventHandler = (CollatorSelection,); +} + +parameter_types! { + pub const PotId: PalletId = PalletId(*b"PotStake"); + pub const MaxCandidates: u32 = 0; + pub const MinCandidates: u32 = 0; + pub const MaxInvulnerables: u32 = 50; +} + +impl pallet_collator_selection::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type UpdateOrigin = MoreThanHalfCouncil; + type PotId = PotId; + type MaxCandidates = MaxCandidates; + type MinCandidates = MinCandidates; + type MaxInvulnerables = MaxInvulnerables; + // should be a multiple of session or things will get inconsistent + type KickThreshold = Period; + type ValidatorId = ::AccountId; + type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + type ValidatorRegistration = Session; + type WeightInfo = weights::collator_selection::HydraWeight; +} + +parameter_types! { + pub const Period: u32 = 4 * HOURS; + pub const Offset: u32 = 0; +} + +impl pallet_session::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ValidatorId = ::AccountId; + // we don't have stash and controller, thus we don't need the convert as well. + type ValidatorIdOf = pallet_collator_selection::IdentityCollator; + type ShouldEndSession = pallet_session::PeriodicSessions; + type NextSessionRotation = pallet_session::PeriodicSessions; + // We wrap the session manager to give out rewards. + type SessionManager = CollatorRewards; + // Essentially just Aura, but lets be pedantic. + type SessionHandler = ::KeyTypeIdProviders; + type Keys = opaque::SessionKeys; + type WeightInfo = (); +} + +impl pallet_utility::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type PalletsOrigin = OriginCaller; + type WeightInfo = weights::utility::HydraWeight; +} + +parameter_types! { + pub const BasicDeposit: Balance = 5 * DOLLARS; + pub const FieldDeposit: Balance = DOLLARS; + pub const SubAccountDeposit: Balance = 5 * DOLLARS; + pub const MaxSubAccounts: u32 = 100; + pub const MaxAdditionalFields: u32 = 100; + pub const MaxRegistrars: u32 = 20; +} + +impl pallet_identity::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type BasicDeposit = BasicDeposit; + type FieldDeposit = FieldDeposit; + type SubAccountDeposit = SubAccountDeposit; + type MaxSubAccounts = MaxSubAccounts; + type MaxAdditionalFields = MaxAdditionalFields; + type MaxRegistrars = MaxRegistrars; + type Slashed = Treasury; + type ForceOrigin = MoreThanHalfCouncil; + type RegistrarOrigin = MoreThanHalfCouncil; + type WeightInfo = weights::identity::HydraWeight; +} + +/// The type used to represent the kinds of proxying allowed. +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo)] +pub enum ProxyType { + Any, + CancelProxy, + Governance, + Transfer, + Liquidity, + LiquidityMining, +} +impl Default for ProxyType { + fn default() -> Self { + Self::Any + } +} + +impl InstanceFilter for ProxyType { + fn filter(&self, c: &RuntimeCall) -> bool { + match self { + ProxyType::Any => true, + ProxyType::CancelProxy => matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. })), + ProxyType::Governance => matches!( + c, + RuntimeCall::Democracy(..) + | RuntimeCall::Council(..) + | RuntimeCall::TechnicalCommittee(..) + | RuntimeCall::Elections(..) + | RuntimeCall::Treasury(..) + | RuntimeCall::Tips(..) + | RuntimeCall::Utility(..) + ), + // Transfer group doesn't include cross-chain transfers + ProxyType::Transfer => matches!( + c, + RuntimeCall::Balances(..) | RuntimeCall::Currencies(..) | RuntimeCall::Tokens(..) + ), + ProxyType::Liquidity => matches!( + c, + RuntimeCall::Omnipool(pallet_omnipool::Call::add_liquidity { .. }) + | RuntimeCall::Omnipool(pallet_omnipool::Call::remove_liquidity { .. }) + ), + ProxyType::LiquidityMining => matches!( + c, + RuntimeCall::OmnipoolLiquidityMining(pallet_omnipool_liquidity_mining::Call::deposit_shares { .. }) + | RuntimeCall::OmnipoolLiquidityMining( + pallet_omnipool_liquidity_mining::Call::redeposit_shares { .. } + ) | RuntimeCall::OmnipoolLiquidityMining(pallet_omnipool_liquidity_mining::Call::claim_rewards { .. }) + | RuntimeCall::OmnipoolLiquidityMining( + pallet_omnipool_liquidity_mining::Call::withdraw_shares { .. } + ) + ), + } + } + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + _ => false, + } + } +} + +parameter_types! { + pub ProxyDepositBase: Balance = deposit(1, 8); + pub ProxyDepositFactor: Balance = deposit(0, 33); + pub const MaxProxies: u16 = 32; + pub AnnouncementDepositBase: Balance = deposit(1, 8); + pub AnnouncementDepositFactor: Balance = deposit(0, 66); + pub const MaxPending: u16 = 32; +} + +impl pallet_proxy::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type ProxyType = ProxyType; + type ProxyDepositBase = ProxyDepositBase; + type ProxyDepositFactor = ProxyDepositFactor; + type MaxProxies = MaxProxies; + type WeightInfo = weights::proxy::HydraWeight; + type MaxPending = MaxPending; + type CallHasher = BlakeTwo256; + type AnnouncementDepositBase = AnnouncementDepositBase; + type AnnouncementDepositFactor = AnnouncementDepositFactor; +} + +parameter_types! { + pub DepositBase: Balance = deposit(1, 88); + pub DepositFactor: Balance = deposit(0, 32); + pub const MaxSignatories: u16 = 100; +} + +impl pallet_multisig::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type DepositBase = DepositBase; + type DepositFactor = DepositFactor; + type MaxSignatories = MaxSignatories; + type WeightInfo = (); +} + +impl pallet_genesis_history::Config for Runtime {} + +/// Parameterized slow adjusting fee updated based on +/// https://w3f-research.readthedocs.io/en/latest/polkadot/overview/2-token-economics.html?highlight=token%20economics#-2.-slow-adjusting-mechanism +pub type SlowAdjustingFeeUpdate = + TargetedFeeAdjustment; + +pub struct WeightToFee; + +impl WeightToFeePolynomial for WeightToFee { + type Balance = Balance; + + /// Handles converting a weight scalar to a fee value, based on the scale and granularity of the + /// node's balance type. + /// + /// This should typically create a mapping between the following ranges: + /// - [0, MAXIMUM_BLOCK_WEIGHT] + /// - [Balance::min, Balance::max] + /// + /// Yet, it can be used for any other sort of change to weight-fee. Some examples being: + /// - Setting it to `0` will essentially disable the weight fee. + /// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. + fn polynomial() -> WeightToFeeCoefficients { + // extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT + let p = CENTS; // 1_000_000_000_000 + let q = 10 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); // 7_919_840_000 + smallvec::smallvec![WeightToFeeCoefficient { + degree: 1, + negative: false, + coeff_frac: Perbill::from_rational(p % q, q), + coeff_integer: p / q, // 124 + }] + } +} + +parameter_types! { + pub const TransactionByteFee: Balance = 10 * MILLICENTS; + /// The portion of the `NORMAL_DISPATCH_RATIO` that we adjust the fees with. Blocks filled less + /// than this will decrease the weight and more will increase. + pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25); + /// The adjustment variable of the runtime. Higher values will cause `TargetBlockFullness` to + /// change the fees more rapidly. + pub AdjustmentVariable: Multiplier = Multiplier::saturating_from_rational(6, 100_000); + /// Minimum amount of the multiplier. This value cannot be too low. A test case should ensure + /// that combined with `AdjustmentVariable`, we can recover from the minimum. + pub MinimumMultiplier: Multiplier = Multiplier::saturating_from_rational(1, 1_000_000u128); + /// The maximum amount of the multiplier. + pub MaximumMultiplier: Multiplier = Multiplier::saturating_from_integer(4); +} + +impl pallet_transaction_payment::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type OnChargeTransaction = TransferFees, TreasuryAccount>; + type OperationalFeeMultiplier = (); + type WeightToFee = WeightToFee; + type LengthToFee = ConstantMultiplier; + type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; +} + +impl pallet_transaction_multi_payment::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AcceptedCurrencyOrigin = SuperMajorityTechCommittee; + type Currencies = Currencies; + type SpotPriceProvider = Omnipool; + type WeightInfo = weights::payment::HydraWeight; + type WeightToFee = WeightToFee; + type NativeAssetId = NativeAssetId; +} + +impl pallet_relaychain_info::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RelaychainBlockNumberProvider = RelayChainBlockNumberProvider; +} + +parameter_types! { + pub const RewardPerCollator: Balance = 455_371_584_699_000; // 83333 HDX / 183 sessions + //GalacticCouncil collators + pub ExcludedCollators: Vec = vec![ + // 5G3t6yhAonQHGUEqrByWQPgP9R8fcSSL6Vujphc89ysdTpKF + hex!["b0502e92d738d528922e8963b8a58a3c7c3b693db51b0972a6981836d67b8835"].into(), + // 5CVBHPAjhcVVAvL3AYpa9MB6kWDwoJbBwu7q4MqbhKwNnrV4 + hex!["12aa36d6c1b055b9a7ab5d39f4fd9a9fe42912163c90e122fb7997e890a53d7e"].into(), + // 5DFGmHjpxS6Xveg4YDw2hSp62JJ9h8oLCkeZUAoVR7hVtQ3k + hex!["344b7693389189ad0be0c83630b02830a568f7cb0f2d4b3483bcea323cc85f70"].into(), + // 5H178NL4DLM9DGgAgZz1kbrX2TReP3uPk7svPtsg1VcYnuXH + hex!["da6e859211b1140369a73af533ecea4e4c0e985ad122ac4c663cc8b81d4fcd12"].into(), + // 5Ca1iV2RNV253FzYJo12XtKJMPWCjv5CsPK9HdmwgJarD1sJ + hex!["165a3c2eb21341bf170fd1fa728bd9a7d02b7dc3b4968a46f2b1d494ee8c2b5d"].into(), + ]; +} + +impl pallet_collator_rewards::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type CurrencyId = AssetId; + type Currency = Currencies; + type RewardPerCollator = RewardPerCollator; + type RewardCurrencyId = NativeAssetId; + type ExcludedCollators = ExcludedCollators; + // We wrap the ` SessionManager` implementation of `CollatorSelection` to get the collatrs that + // we hand out rewards to. + type SessionManager = CollatorSelection; +} + +impl pallet_transaction_pause::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type UpdateOrigin = SuperMajorityTechCommittee; + type WeightInfo = weights::transaction_pause::HydraWeight; +} diff --git a/runtime/hydradx/src/tests.rs b/runtime/hydradx/src/tests.rs index e7e7d25d3..1fada20ed 100644 --- a/runtime/hydradx/src/tests.rs +++ b/runtime/hydradx/src/tests.rs @@ -1,11 +1,17 @@ use crate::*; +use primitives::constants::{ + currency::{CENTS, DOLLARS, MILLICENTS}, + time::{DAYS, HOURS}, +}; + +use pallet_transaction_payment::Multiplier; + use codec::Encode; use frame_support::{ dispatch::{DispatchClass, GetDispatchInfo}, + sp_runtime::{traits::Convert, FixedPointNumber}, weights::WeightToFee, }; -use sp_runtime::traits::Convert; -use sp_runtime::FixedPointNumber; #[test] #[ignore] diff --git a/runtime/common/src/weights/balances.rs b/runtime/hydradx/src/weights/balances.rs similarity index 100% rename from runtime/common/src/weights/balances.rs rename to runtime/hydradx/src/weights/balances.rs diff --git a/runtime/common/src/weights/circuit_breaker.rs b/runtime/hydradx/src/weights/circuit_breaker.rs similarity index 100% rename from runtime/common/src/weights/circuit_breaker.rs rename to runtime/hydradx/src/weights/circuit_breaker.rs diff --git a/runtime/common/src/weights/claims.rs b/runtime/hydradx/src/weights/claims.rs similarity index 100% rename from runtime/common/src/weights/claims.rs rename to runtime/hydradx/src/weights/claims.rs diff --git a/runtime/common/src/weights/collator_selection.rs b/runtime/hydradx/src/weights/collator_selection.rs similarity index 100% rename from runtime/common/src/weights/collator_selection.rs rename to runtime/hydradx/src/weights/collator_selection.rs diff --git a/runtime/common/src/weights/council.rs b/runtime/hydradx/src/weights/council.rs similarity index 100% rename from runtime/common/src/weights/council.rs rename to runtime/hydradx/src/weights/council.rs diff --git a/runtime/common/src/weights/currencies.rs b/runtime/hydradx/src/weights/currencies.rs similarity index 100% rename from runtime/common/src/weights/currencies.rs rename to runtime/hydradx/src/weights/currencies.rs diff --git a/runtime/common/src/weights/dca.rs b/runtime/hydradx/src/weights/dca.rs similarity index 100% rename from runtime/common/src/weights/dca.rs rename to runtime/hydradx/src/weights/dca.rs diff --git a/runtime/common/src/weights/democracy.rs b/runtime/hydradx/src/weights/democracy.rs similarity index 100% rename from runtime/common/src/weights/democracy.rs rename to runtime/hydradx/src/weights/democracy.rs diff --git a/runtime/common/src/weights/duster.rs b/runtime/hydradx/src/weights/duster.rs similarity index 100% rename from runtime/common/src/weights/duster.rs rename to runtime/hydradx/src/weights/duster.rs diff --git a/runtime/common/src/weights/ema_oracle.rs b/runtime/hydradx/src/weights/ema_oracle.rs similarity index 100% rename from runtime/common/src/weights/ema_oracle.rs rename to runtime/hydradx/src/weights/ema_oracle.rs diff --git a/runtime/common/src/weights/identity.rs b/runtime/hydradx/src/weights/identity.rs similarity index 100% rename from runtime/common/src/weights/identity.rs rename to runtime/hydradx/src/weights/identity.rs diff --git a/runtime/common/src/weights/mod.rs b/runtime/hydradx/src/weights/mod.rs similarity index 100% rename from runtime/common/src/weights/mod.rs rename to runtime/hydradx/src/weights/mod.rs diff --git a/runtime/common/src/weights/omnipool.rs b/runtime/hydradx/src/weights/omnipool.rs similarity index 100% rename from runtime/common/src/weights/omnipool.rs rename to runtime/hydradx/src/weights/omnipool.rs diff --git a/runtime/common/src/weights/omnipool_lm.rs b/runtime/hydradx/src/weights/omnipool_lm.rs similarity index 100% rename from runtime/common/src/weights/omnipool_lm.rs rename to runtime/hydradx/src/weights/omnipool_lm.rs diff --git a/runtime/common/src/weights/otc.rs b/runtime/hydradx/src/weights/otc.rs similarity index 100% rename from runtime/common/src/weights/otc.rs rename to runtime/hydradx/src/weights/otc.rs diff --git a/runtime/common/src/weights/payment.rs b/runtime/hydradx/src/weights/payment.rs similarity index 100% rename from runtime/common/src/weights/payment.rs rename to runtime/hydradx/src/weights/payment.rs diff --git a/runtime/common/src/weights/preimage.rs b/runtime/hydradx/src/weights/preimage.rs similarity index 100% rename from runtime/common/src/weights/preimage.rs rename to runtime/hydradx/src/weights/preimage.rs diff --git a/runtime/common/src/weights/proxy.rs b/runtime/hydradx/src/weights/proxy.rs similarity index 100% rename from runtime/common/src/weights/proxy.rs rename to runtime/hydradx/src/weights/proxy.rs diff --git a/runtime/common/src/weights/registry.rs b/runtime/hydradx/src/weights/registry.rs similarity index 100% rename from runtime/common/src/weights/registry.rs rename to runtime/hydradx/src/weights/registry.rs diff --git a/runtime/common/src/weights/route_executor.rs b/runtime/hydradx/src/weights/route_executor.rs similarity index 100% rename from runtime/common/src/weights/route_executor.rs rename to runtime/hydradx/src/weights/route_executor.rs diff --git a/runtime/common/src/weights/scheduler.rs b/runtime/hydradx/src/weights/scheduler.rs similarity index 100% rename from runtime/common/src/weights/scheduler.rs rename to runtime/hydradx/src/weights/scheduler.rs diff --git a/runtime/common/src/weights/system.rs b/runtime/hydradx/src/weights/system.rs similarity index 100% rename from runtime/common/src/weights/system.rs rename to runtime/hydradx/src/weights/system.rs diff --git a/runtime/common/src/weights/technical_comittee.rs b/runtime/hydradx/src/weights/technical_comittee.rs similarity index 100% rename from runtime/common/src/weights/technical_comittee.rs rename to runtime/hydradx/src/weights/technical_comittee.rs diff --git a/runtime/common/src/weights/timestamp.rs b/runtime/hydradx/src/weights/timestamp.rs similarity index 100% rename from runtime/common/src/weights/timestamp.rs rename to runtime/hydradx/src/weights/timestamp.rs diff --git a/runtime/common/src/weights/tokens.rs b/runtime/hydradx/src/weights/tokens.rs similarity index 100% rename from runtime/common/src/weights/tokens.rs rename to runtime/hydradx/src/weights/tokens.rs diff --git a/runtime/common/src/weights/transaction_pause.rs b/runtime/hydradx/src/weights/transaction_pause.rs similarity index 100% rename from runtime/common/src/weights/transaction_pause.rs rename to runtime/hydradx/src/weights/transaction_pause.rs diff --git a/runtime/common/src/weights/treasury.rs b/runtime/hydradx/src/weights/treasury.rs similarity index 100% rename from runtime/common/src/weights/treasury.rs rename to runtime/hydradx/src/weights/treasury.rs diff --git a/runtime/common/src/weights/utility.rs b/runtime/hydradx/src/weights/utility.rs similarity index 100% rename from runtime/common/src/weights/utility.rs rename to runtime/hydradx/src/weights/utility.rs diff --git a/runtime/common/src/weights/vesting.rs b/runtime/hydradx/src/weights/vesting.rs similarity index 100% rename from runtime/common/src/weights/vesting.rs rename to runtime/hydradx/src/weights/vesting.rs diff --git a/runtime/common/src/weights/xcm.rs b/runtime/hydradx/src/weights/xcm.rs similarity index 100% rename from runtime/common/src/weights/xcm.rs rename to runtime/hydradx/src/weights/xcm.rs diff --git a/runtime/common/src/weights/xcmp_queue.rs b/runtime/hydradx/src/weights/xcmp_queue.rs similarity index 100% rename from runtime/common/src/weights/xcmp_queue.rs rename to runtime/hydradx/src/weights/xcmp_queue.rs diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index e329c60cd..a9a7c5f66 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -1,20 +1,24 @@ -use super::{AssetId, *}; +use super::*; +use crate::adapters::ReroutingMultiCurrencyAdapter; + +use hydradx_adapters::{MultiCurrencyTrader, ToFeeReceiver}; +use pallet_transaction_multi_payment::DepositAll; +use primitives::AssetId; // shadow glob import of polkadot_xcm::v3::prelude::AssetId -use common_runtime::adapters::ReroutingMultiCurrencyAdapter; use cumulus_primitives_core::ParaId; use frame_support::{ - traits::{Everything, Nothing}, + parameter_types, + sp_runtime::traits::{AccountIdConversion, Convert}, + traits::{ConstU32, Contains, Everything, Get, Nothing}, PalletId, }; -use hydradx_adapters::{MultiCurrencyTrader, ToFeeReceiver}; +use frame_system::EnsureRoot; use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key}; -pub use orml_xcm_support::{DepositToAlternative, IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; +use orml_xcm_support::{DepositToAlternative, IsNativeConcrete, MultiNativeAsset}; use pallet_xcm::XcmPassthrough; use polkadot_parachain::primitives::Sibling; -use polkadot_xcm::v3::prelude::*; -use polkadot_xcm::v3::Weight as XcmWeight; -use primitives::Price; -use sp_runtime::traits::{AccountIdConversion, Convert}; +use polkadot_xcm::v3::{prelude::*, Weight as XcmWeight}; +use scale_info::TypeInfo; use xcm_builder::{ AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, @@ -23,6 +27,9 @@ use xcm_builder::{ }; use xcm_executor::{Config, XcmExecutor}; +#[derive(Debug, Default, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)] +pub struct AssetLocation(pub polkadot_xcm::v3::MultiLocation); + pub type LocalOriginToLocation = SignedToAccountId32; pub type Barrier = ( @@ -198,7 +205,7 @@ impl pallet_xcm::Config for Runtime { type TrustedLockers = (); type SovereignAccountOf = (); type MaxLockers = ConstU32<8>; - type WeightInfo = common_runtime::weights::xcm::HydraWeight; + type WeightInfo = weights::xcm::HydraWeight; #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; }