From 31e30f338e1714aca5eada6279bae8e62c64a530 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Rios <54085674+JuaniRios@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:57:53 +0100 Subject: [PATCH] Feature/plmc 412 on initialize benchmarks (#159) --- Cargo.lock | 839 +++++----- Cargo.toml | 1 + nodes/parachain/src/rpc.rs | 2 +- pallets/democracy/src/lib.rs | 6 +- pallets/democracy/src/vote_threshold.rs | 10 +- pallets/elections-phragmen/src/lib.rs | 4 +- pallets/funding/src/benchmarking.rs | 1453 ++++++++++++++--- pallets/funding/src/functions.rs | 329 ++-- pallets/funding/src/instantiator.rs | 85 +- pallets/funding/src/lib.rs | 213 ++- pallets/funding/src/mock.rs | 5 +- pallets/funding/src/tests.rs | 256 ++- pallets/funding/src/types.rs | 12 +- pallets/funding/src/weights.rs | 1404 +++++++++++----- pallets/linear-release/src/impls.rs | 12 +- pallets/linear-release/src/lib.rs | 2 +- pallets/oracle-ocw/src/lib.rs | 16 +- pallets/oracle-ocw/src/traits.rs | 12 +- pallets/oracle-ocw/src/types.rs | 16 +- .../src/delegation_requests.rs | 8 +- pallets/parachain-staking/src/lib.rs | 18 +- pallets/parachain-staking/src/tests.rs | 8 +- pallets/parachain-staking/src/types.rs | 28 +- pallets/polimec-receiver/src/lib.rs | 2 +- pallets/xcm-executor/src/lib.rs | 6 +- runtimes/base/Cargo.toml | 1 + runtimes/shared-configuration/Cargo.toml | 1 + runtimes/shared-configuration/src/fee.rs | 4 +- runtimes/testnet/Cargo.toml | 3 + runtimes/testnet/src/lib.rs | 10 +- 30 files changed, 3268 insertions(+), 1498 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7576e3a78..2faa5d0bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,23 +73,23 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "once_cell", "version_check", ] [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" dependencies = [ "cfg-if", - "getrandom 0.2.11", + "getrandom 0.2.12", "once_cell", "version_check", "zerocopy", @@ -136,9 +136,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -150,9 +150,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -165,9 +165,9 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3a318f1f38d2418400f8209655bfd825785afd25aa30bb7ba6cc792e4596748" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ "windows-sys 0.52.0", ] @@ -184,9 +184,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "approx" @@ -285,18 +285,18 @@ dependencies = [ [[package]] name = "async-io" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6d3b15875ba253d1110c740755e246537483f152fa334f91abd7fe84c88b3ff" +checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65" dependencies = [ - "async-lock 3.2.0", + "async-lock 3.3.0", "cfg-if", "concurrent-queue", "futures-io", "futures-lite", "parking", "polling", - "rustix 0.38.26", + "rustix 0.38.31", "slab", "tracing", "windows-sys 0.52.0", @@ -313,11 +313,11 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c" +checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" dependencies = [ - "event-listener 4.0.0", + "event-listener 4.0.3", "event-listener-strategy", "pin-project-lite 0.2.13", ] @@ -330,18 +330,18 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -359,9 +359,9 @@ dependencies = [ [[package]] name = "atomic-polyfill" -version = "0.1.11" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" +checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" dependencies = [ "critical-section", ] @@ -394,7 +394,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide", - "object 0.32.1", + "object 0.32.2", "rustc-demangle", ] @@ -418,9 +418,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -467,13 +467,13 @@ dependencies = [ "lazy_static", "lazycell", "peeking_take_while", - "prettyplease 0.2.15", + "prettyplease 0.2.16", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -484,9 +484,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bitvec" @@ -623,9 +623,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" +checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" dependencies = [ "memchr", "serde", @@ -660,9 +660,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" [[package]] name = "byteorder" @@ -698,9 +698,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" dependencies = [ "serde", ] @@ -713,7 +713,7 @@ checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" dependencies = [ "camino", "cargo-platform", - "semver 1.0.20", + "semver 1.0.21", "serde", "serde_json", "thiserror", @@ -740,9 +740,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.15.5" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3" +checksum = "fa50868b64a9a6fda9d593ce778849ea8715cd2a3d2cc17ffdb4a2f2f2f1961d" dependencies = [ "smallvec", ] @@ -785,16 +785,16 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -832,9 +832,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" dependencies = [ "glob", "libc", @@ -843,9 +843,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.11" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" dependencies = [ "clap_builder", "clap_derive", @@ -853,9 +853,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" dependencies = [ "anstream", "anstyle", @@ -865,31 +865,30 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "coarsetime" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71367d3385c716342014ad17e3d19f7788ae514885a1f4c24f500260fb365e1a" +checksum = "13b3839cf01bb7960114be3ccf2340f541b6d0c81f8690b007b2b39f750f7e5d" dependencies = [ "libc", - "once_cell", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasix", "wasm-bindgen", ] @@ -958,22 +957,22 @@ dependencies = [ [[package]] name = "console" -version = "0.15.7" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" dependencies = [ "encode_unicode", "lazy_static", "libc", "unicode-width", - "windows-sys 0.45.0", + "windows-sys 0.52.0", ] [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "const-random" @@ -990,7 +989,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "once_cell", "tiny-keccak", ] @@ -1053,9 +1052,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -1160,9 +1159,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] @@ -1175,46 +1174,37 @@ checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset 0.9.0", - "scopeguard", ] [[package]] name = "crossbeam-queue" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crunchy" @@ -1550,7 +1540,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1840,9 +1830,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", @@ -1863,14 +1853,14 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "cxx" -version = "1.0.110" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7129e341034ecb940c9072817cd9007974ea696844fc4dd582dc1653a7fbe2e8" +checksum = "8aff472b83efd22bfc0176aa8ba34617dd5c17364670eb201a5f06d339b8abf7" dependencies = [ "cc", "cxxbridge-flags", @@ -1880,9 +1870,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.110" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a24f3f5f8eed71936f21e570436f024f5c2e25628f7496aa7ccd03b90109d5" +checksum = "bcf6e7a52c19013a9a0ec421c7d9c2d1125faf333551227e0a017288d71b47c3" dependencies = [ "cc", "codespan-reporting", @@ -1890,24 +1880,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "cxxbridge-flags" -version = "1.0.110" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06fdd177fc61050d63f67f5bd6351fac6ab5526694ea8e359cd9cd3b75857f44" +checksum = "589e83d02fc1d4fb78f5ad56ca08835341e23499d086d2821315869426d618dc" [[package]] name = "cxxbridge-macro" -version = "1.0.110" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "587663dd5fb3d10932c8aecfe7c844db1bcf0aee93eeab08fac13dc1212c2e7f" +checksum = "e2cb1fd8ffae4230c7cfbbaf3698dbeaf750fa8c5dadf7ed897df581b9b572a5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1962,9 +1952,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", ] @@ -2089,7 +2079,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2113,7 +2103,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.39", + "syn 2.0.48", "termcolor", "walkdir", ] @@ -2204,11 +2194,11 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "ed25519 2.2.3", "rand_core 0.6.4", "serde", @@ -2233,9 +2223,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "elliptic-curve" @@ -2276,33 +2266,33 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5998b4f30320c9d93aed72f63af821bfdac50465b75428fce77b48ec482c3939" +checksum = "3278c9d5fb675e0a51dabcf4c0d355f692b064171535ba72361be1528a9d8e8d" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" +checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "enumn" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" +checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2320,9 +2310,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ "humantime", "is-terminal", @@ -2361,9 +2351,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "4.0.0" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770d968249b5d99410d61f5bf89057f3199a077a04d087092f58e7d10692baae" +checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" dependencies = [ "concurrent-queue", "parking", @@ -2376,7 +2366,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" dependencies = [ - "event-listener 4.0.0", + "event-listener 4.0.3", "pin-project-lite 0.2.13", ] @@ -2423,7 +2413,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2490,9 +2480,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" +checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" [[package]] name = "file-per-thread-logger" @@ -2500,7 +2490,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" dependencies = [ - "env_logger 0.10.1", + "env_logger 0.10.2", "log", ] @@ -2680,7 +2670,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2799,7 +2789,7 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2811,7 +2801,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2821,7 +2811,7 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948 dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2904,7 +2894,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" dependencies = [ - "rustix 0.38.26", + "rustix 0.38.31", "windows-sys 0.48.0", ] @@ -2916,9 +2906,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -2931,9 +2921,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -2941,15 +2931,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -2959,15 +2949,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143" +checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" dependencies = [ "futures-core", "pin-project-lite 0.2.13", @@ -2975,13 +2965,13 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2997,15 +2987,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-timer" @@ -3015,9 +3005,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -3083,9 +3073,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -3132,9 +3122,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" dependencies = [ "aho-corasick", - "bstr 1.8.0", + "bstr 1.9.0", "log", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] @@ -3151,9 +3141,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -3161,7 +3151,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.1.0", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -3212,7 +3202,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", + "ahash 0.7.8", ] [[package]] @@ -3221,7 +3211,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.8", ] [[package]] @@ -3232,9 +3222,9 @@ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "heapless" -version = "0.7.16" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" +checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" dependencies = [ "atomic-polyfill", "hash32", @@ -3261,9 +3251,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" [[package]] name = "hex" @@ -3325,11 +3315,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3356,9 +3346,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -3391,9 +3381,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -3406,7 +3396,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite 0.2.13", - "socket2 0.4.10", + "socket2 0.5.5", "tokio", "tower-service", "tracing", @@ -3423,25 +3413,25 @@ dependencies = [ "http", "hyper", "log", - "rustls 0.21.9", + "rustls 0.21.10", "rustls-native-certs", "tokio", "tokio-rustls", - "webpki-roots 0.25.3", + "webpki-roots 0.25.4", ] [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -3545,9 +3535,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -3555,9 +3545,9 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" +checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" dependencies = [ "console", "instant", @@ -3605,7 +3595,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.5", "libc", "windows-sys 0.48.0", ] @@ -3636,13 +3626,13 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ - "hermit-abi 0.3.3", - "rustix 0.38.26", - "windows-sys 0.48.0", + "hermit-abi 0.3.5", + "libc", + "windows-sys 0.52.0", ] [[package]] @@ -3665,24 +3655,24 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -3720,7 +3710,7 @@ dependencies = [ "tokio-rustls", "tokio-util", "tracing", - "webpki-roots 0.25.3", + "webpki-roots 0.25.4", ] [[package]] @@ -3833,9 +3823,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.13.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ "cfg-if", "ecdsa", @@ -3846,9 +3836,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] @@ -4025,18 +4015,18 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libloading" -version = "0.7.4" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" dependencies = [ "cfg-if", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -4048,7 +4038,7 @@ dependencies = [ "bytes", "futures", "futures-timer", - "getrandom 0.2.11", + "getrandom 0.2.12", "instant", "libp2p-allow-block-list", "libp2p-connection-limits", @@ -4167,7 +4157,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "276bb57e7af15d8f100d3c11cbdd32c6752b7eef4ba7a18ecf464972c07abcce" dependencies = [ "bs58", - "ed25519-dalek 2.1.0", + "ed25519-dalek 2.1.1", "log", "multiaddr", "multihash", @@ -4438,7 +4428,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "libc", "redox_syscall 0.4.1", ] @@ -4508,9 +4498,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" dependencies = [ "cc", "pkg-config", @@ -4558,9 +4548,9 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -4643,7 +4633,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -4657,7 +4647,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -4668,7 +4658,7 @@ checksum = "d710e1214dffbab3b5dacb21475dde7d6ed84c69ff722b3a47a782668d44fbac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -4679,7 +4669,7 @@ checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -4689,7 +4679,7 @@ dependencies = [ "proc-macro2", "quote", "sp-core", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -4738,9 +4728,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memfd" @@ -4748,7 +4738,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.26", + "rustix 0.38.31", ] [[package]] @@ -4769,15 +4759,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - [[package]] name = "memory-db" version = "0.32.0" @@ -4818,9 +4799,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -5133,13 +5114,19 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-format" version = "0.4.4" @@ -5152,11 +5139,10 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] @@ -5174,9 +5160,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -5187,7 +5173,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi 0.3.5", "libc", ] @@ -5211,9 +5197,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -5229,9 +5215,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" @@ -6333,7 +6319,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -6615,9 +6601,9 @@ dependencies = [ [[package]] name = "parity-db" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e9ab494af9e6e813c72170f0d3c1de1500990d62c97cc05cc7576f91aa402f" +checksum = "592a28a24b09c9dc20ac8afaa6839abc417c720afe42c12e1e4a9d6aa2508d2e" dependencies = [ "blake2", "crc32fast", @@ -6631,6 +6617,7 @@ dependencies = [ "rand 0.8.5", "siphasher", "snap", + "winapi", ] [[package]] @@ -6654,7 +6641,7 @@ version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" dependencies = [ - "proc-macro-crate 2.0.1", + "proc-macro-crate 2.0.2", "proc-macro2", "quote", "syn 1.0.109", @@ -6779,9 +6766,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.5" +version = "2.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" +checksum = "219c0dcc30b6a27553f9cc242972b67f75b60eb0db71f0b5462f38b058c41546" dependencies = [ "memchr", "thiserror", @@ -6790,9 +6777,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.5" +version = "2.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2" +checksum = "22e1288dbd7786462961e69bfd4df7848c1e37e8b74303dbdab82c3a9cdd2809" dependencies = [ "pest", "pest_generator", @@ -6800,22 +6787,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.5" +version = "2.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227" +checksum = "1381c29a877c6d34b8c176e734f35d7f7f5b3adaefe940cb4d1bb7af94678e2e" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "pest_meta" -version = "2.7.5" +version = "2.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6" +checksum = "d0934d6907f148c22a3acbda520c7eed243ad7487a30f51f6ce52b58b7077a8a" dependencies = [ "once_cell", "pest", @@ -6829,27 +6816,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.1.0", + "indexmap 2.2.3", ] [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -6882,15 +6869,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platforms" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" +checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" [[package]] name = "polimec-base-runtime" @@ -7114,6 +7101,7 @@ dependencies = [ "sp-block-builder", "sp-consensus-aura", "sp-core", + "sp-debug-derive", "sp-inherents", "sp-io", "sp-offchain", @@ -8355,14 +8343,14 @@ dependencies = [ [[package]] name = "polling" -version = "3.3.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e" +checksum = "30054e72317ab98eddd8561db0f6524df3367636884b7b21b703e4b280a84a14" dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite 0.2.13", - "rustix 0.38.26", + "rustix 0.38.31", "tracing", "windows-sys 0.52.0", ] @@ -8450,12 +8438,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -8499,9 +8487,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" dependencies = [ "toml_datetime", "toml_edit 0.20.2", @@ -8539,14 +8527,14 @@ checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -8585,7 +8573,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -8710,9 +8698,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -8782,7 +8770,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", ] [[package]] @@ -8811,9 +8799,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ "either", "rayon-core", @@ -8821,9 +8809,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -8865,7 +8853,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "libredox", "thiserror", ] @@ -8885,22 +8873,22 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" +checksum = "c4846d4c50d1721b1a3bef8af76924eef20d5e723647333798c1b519b3a9473f" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" +checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -8917,13 +8905,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] @@ -8938,9 +8926,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -9001,7 +8989,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", - "getrandom 0.2.11", + "getrandom 0.2.12", "libc", "spin 0.9.8", "untrusted 0.9.0", @@ -9188,7 +9176,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.20", + "semver 1.0.21", ] [[package]] @@ -9216,14 +9204,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.26" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", - "linux-raw-sys 0.4.12", + "linux-raw-sys 0.4.13", "windows-sys 0.52.0", ] @@ -9241,9 +9229,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.9" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring 0.17.7", @@ -9269,7 +9257,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", ] [[package]] @@ -9301,9 +9289,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "safe-mix" @@ -9436,7 +9424,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -9713,7 +9701,7 @@ name = "sc-consensus-grandpa" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.8", "array-bytes", "async-trait", "dyn-clone", @@ -9956,7 +9944,7 @@ name = "sc-network-gossip" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.8", "futures", "futures-timer", "libp2p", @@ -10359,7 +10347,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -10447,11 +10435,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -10460,7 +10448,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.8", "cfg-if", "hashbrown 0.13.2", ] @@ -10589,9 +10577,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" dependencies = [ "serde", ] @@ -10604,9 +10592,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] @@ -10623,20 +10611,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -10645,9 +10633,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] @@ -10742,9 +10730,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" @@ -10786,9 +10774,9 @@ dependencies = [ [[package]] name = "similar" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aeaf503862c419d66959f5d7ca015337d864e9c49485d771b732e2a20453597" +checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21" dependencies = [ "bstr 0.2.17", "unicode-segmentation", @@ -10848,9 +10836,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "snap" @@ -10860,14 +10848,14 @@ checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" [[package]] name = "snow" -version = "0.9.4" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58021967fd0a5eeeb23b08df6cc244a4d4a5b4aec1d27c9e02fad1a58b4cd74e" +checksum = "850948bee068e713b8ab860fe1adc4d109676ab4c3b621fd8147f06b261f2f85" dependencies = [ "aes-gcm", "blake2", "chacha20poly1305", - "curve25519-dalek 4.1.1", + "curve25519-dalek 4.1.2", "rand_core 0.6.4", "ring 0.17.7", "rustc_version 0.4.0", @@ -10944,7 +10932,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -11181,7 +11169,7 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948 dependencies = [ "quote", "sp-core-hashing", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -11200,7 +11188,7 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948 dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -11407,7 +11395,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -11549,7 +11537,7 @@ name = "sp-trie" version = "22.0.0" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#948fbd2fd1233dc26dbb9f9bbc1d2cca2c03945d" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.8", "hash-db", "hashbrown 0.13.2", "lazy_static", @@ -11592,7 +11580,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -11661,9 +11649,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.44.0" +version = "1.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35935738370302d5e33963665b77541e4b990a3e919ec904c837a56cfc891de1" +checksum = "b1114ee5900b8569bbc8b1a014a942f937b752af4b44f4607430b5f86cedaac0" dependencies = [ "Inflector", "num-format", @@ -11716,9 +11704,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" [[package]] name = "strum" @@ -11758,7 +11746,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -11869,7 +11857,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -11919,9 +11907,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -11969,28 +11957,27 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.12" +version = "0.12.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" +checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" [[package]] name = "tempfile" -version = "3.8.1" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.4.1", - "rustix 0.38.26", - "windows-sys 0.48.0", + "rustix 0.38.31", + "windows-sys 0.52.0", ] [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -12003,22 +11990,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -12082,12 +12069,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -12102,10 +12090,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -12154,9 +12143,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.34.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -12179,7 +12168,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -12199,7 +12188,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.9", + "rustls 0.21.10", "tokio", ] @@ -12266,7 +12255,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", @@ -12279,7 +12268,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.3", "toml_datetime", "winnow", ] @@ -12301,7 +12290,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "bytes", "futures-core", "futures-util", @@ -12345,7 +12334,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -12388,7 +12377,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -12505,9 +12494,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "try-runtime-cli" @@ -12589,9 +12578,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -12610,9 +12599,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" @@ -12732,11 +12721,20 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasix" +version = "0.12.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1fbb4ef9bbca0c1170e0b00dd28abc9e3b68669821600cad1caaed606583c6d" +dependencies = [ + "wasi 0.11.0+wasi-snapshot-preview1", +] + [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -12744,24 +12742,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -12771,9 +12769,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -12781,22 +12779,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "wasm-instrument" @@ -12916,7 +12914,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c86437fa68626fe896e5afc69234bb2b5894949083586535f200385adfd71213" dependencies = [ "anyhow", - "base64 0.21.5", + "base64 0.21.7", "bincode", "directories-next", "file-per-thread-logger", @@ -13045,7 +13043,7 @@ dependencies = [ "log", "mach", "memfd", - "memoffset 0.8.0", + "memoffset", "paste", "rand 0.8.5", "rustix 0.36.17", @@ -13069,9 +13067,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ "js-sys", "wasm-bindgen", @@ -13098,9 +13096,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.3" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "westend-runtime" @@ -13218,14 +13216,14 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.26", + "rustix 0.38.31", ] [[package]] name = "wide" -version = "0.7.13" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68938b57b33da363195412cfc5fc37c9ed49aa9cfe2156fde64b8d2c9498242" +checksum = "89beec544f246e679fc25490e3f8e08003bc4bf612068f325120dad4cea02c1c" dependencies = [ "bytemuck", "safe_arch", @@ -13274,7 +13272,7 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" dependencies = [ - "windows-core", + "windows-core 0.51.1", "windows-targets 0.48.5", ] @@ -13287,6 +13285,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-sys" version = "0.45.0" @@ -13487,9 +13494,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.25" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e87b8dfbe3baffbe687eef2e164e32286eff31a5ee16463ce03d991643ec94" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] @@ -13608,7 +13615,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -13636,22 +13643,22 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.29" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d075cf85bbb114e933343e087b92f2146bac0d55b534cbb8188becf0039948e" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.29" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86cd5ca076997b97ef09d3ad65efe811fa68c9e874cb636ccb211223a813b0c2" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -13671,7 +13678,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ee3a6e8b5..2ad12961a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,6 +98,7 @@ frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate" frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" } frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" } sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" } +sp-debug-derive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" } sp-staking = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" } diff --git a/nodes/parachain/src/rpc.rs b/nodes/parachain/src/rpc.rs index ae8a95ac0..af8a224d5 100644 --- a/nodes/parachain/src/rpc.rs +++ b/nodes/parachain/src/rpc.rs @@ -21,7 +21,7 @@ use std::sync::Arc; use sc_client_api::AuxStore; -pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; +pub use sc_rpc::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; diff --git a/pallets/democracy/src/lib.rs b/pallets/democracy/src/lib.rs index 925df7a9e..b57ef1eaa 100644 --- a/pallets/democracy/src/lib.rs +++ b/pallets/democracy/src/lib.rs @@ -813,7 +813,7 @@ pub mod pallet { if let Some((ext_proposal, _)) = NextExternal::::get() { ensure!(proposal_hash == ext_proposal.hash(), Error::::ProposalMissing); } else { - return Err(Error::::NoProposal.into()) + return Err(Error::::NoProposal.into()); } let mut existing_vetoers = >::get(&proposal_hash).map(|pair| pair.1).unwrap_or_default(); @@ -1482,7 +1482,7 @@ impl Pallet { Self::transfer_metadata(MetadataOwner::External, MetadataOwner::Referendum(ref_index)); Ok(()) } else { - return Err(Error::::NoneWaiting.into()) + return Err(Error::::NoneWaiting.into()); } } @@ -1512,7 +1512,7 @@ impl Pallet { } Ok(()) } else { - return Err(Error::::NoneWaiting.into()) + return Err(Error::::NoneWaiting.into()); } } diff --git a/pallets/democracy/src/vote_threshold.rs b/pallets/democracy/src/vote_threshold.rs index fccfc35a8..0c4081e93 100644 --- a/pallets/democracy/src/vote_threshold.rs +++ b/pallets/democracy/src/vote_threshold.rs @@ -50,18 +50,18 @@ fn compare_rationals + Div + Rem diff --git a/pallets/elections-phragmen/src/lib.rs b/pallets/elections-phragmen/src/lib.rs index 3a6a38f10..dd8fec21e 100644 --- a/pallets/elections-phragmen/src/lib.rs +++ b/pallets/elections-phragmen/src/lib.rs @@ -890,7 +890,7 @@ impl Pallet { if candidates_and_deposit.len().is_zero() { Self::deposit_event(Event::EmptyTerm); - return T::DbWeight::get().reads(3) + return T::DbWeight::get().reads(3); } // All of the new winners that come out of phragmen will thus have a deposit recorded. @@ -921,7 +921,7 @@ impl Pallet { "Failed to run election. Number of voters exceeded", ); Self::deposit_event(Event::ElectionError); - return T::DbWeight::get().reads(3 + max_voters as u64) + return T::DbWeight::get().reads(3 + max_voters as u64); }, } diff --git a/pallets/funding/src/benchmarking.rs b/pallets/funding/src/benchmarking.rs index 08e3df95d..fd9be7df7 100644 --- a/pallets/funding/src/benchmarking.rs +++ b/pallets/funding/src/benchmarking.rs @@ -18,8 +18,6 @@ //! Benchmarking setup for Funding pallet -use sp_runtime::traits::TrailingZeroInput; - use super::*; use crate::instantiator::*; use frame_benchmarking::v2::*; @@ -29,6 +27,7 @@ use frame_support::{ dispatch::RawOrigin, traits::{ fungible::{InspectHold, MutateHold}, + fungibles::metadata::MetadataDeposit, OriginTrait, }, Parameter, @@ -41,7 +40,7 @@ use scale_info::prelude::format; use sp_arithmetic::Percent; use sp_core::H256; use sp_io::hashing::blake2_256; -use sp_runtime::traits::{BlakeTwo256, Get, Member}; +use sp_runtime::traits::{BlakeTwo256, Get, Member, TrailingZeroInput}; const METADATA: &str = r#" { @@ -322,8 +321,7 @@ pub fn fill_projects_to_update( // We keep in mind that we already filled `x` amount of vecs to max capacity let remaining_vecs = total_vecs_in_storage.saturating_sub(fully_filled_vecs_from_insertion); if remaining_vecs > 0 { - // we benchmarked this with different values, and it had no impact on the weight, so we use a low value to speed up the benchmark - let items_per_vec = 5u32; + let items_per_vec = T::MaxProjectsToUpdatePerBlock::get(); let mut block_number: BlockNumberFor = Zero::zero(); for _ in 0..remaining_vecs { // To iterate over all expected items when looking to remove, we need to insert everything _before_ our already stored project's block_number @@ -366,6 +364,9 @@ mod benchmarks { impl_benchmark_test_suite!(PalletFunding, crate::mock::new_test_ext(), crate::mock::TestRuntime); + // + // Extrinsics + // #[benchmark] fn create() { // * setup * @@ -377,10 +378,14 @@ mod benchmarks { let issuer = account::>("issuer", 0, 0); whitelist_account!(issuer); - inst.mint_plmc_to(vec![UserToPLMCBalance::new(issuer.clone(), ed * 2u64.into())]); - let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let metadata_deposit = T::ContributionTokenCurrency::calc_metadata_deposit( + project_metadata.token_information.name.as_slice(), + project_metadata.token_information.symbol.as_slice(), + ); + inst.mint_plmc_to(vec![UserToPLMCBalance::new(issuer.clone(), ed * 2u64.into() + metadata_deposit)]); + #[extrinsic_call] create(RawOrigin::Signed(issuer.clone()), project_metadata.clone()); @@ -490,9 +495,9 @@ mod benchmarks { let mut inst = BenchInstantiator::::new(None); // We need to leave enough block numbers to fill `ProjectsToUpdate` before our project insertion - let u32_remaining_vecs: u32 = y.saturating_sub(x); + let u32_remaining_vecs: u32 = y.saturating_sub(x).into(); let time_advance: u32 = 1 + u32_remaining_vecs + 1; - inst.advance_time(time_advance.into()).unwrap(); + frame_system::Pallet::::set_block_number(time_advance.into()); let issuer = account::>("issuer", 0, 0); whitelist_account!(issuer); @@ -512,7 +517,11 @@ mod benchmarks { inst.advance_time(One::one()).unwrap(); inst.bond_for_users(project_id, evaluations).expect("All evaluations are accepted"); - inst.advance_time(::EvaluationDuration::get() + One::one()).unwrap(); + let (evaluation_end_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(evaluation_end_block - 1u32.into()); + inst.advance_time(2u32.into()).unwrap(); + + assert_eq!(inst.get_project_details(project_id).status, ProjectStatus::AuctionInitializePeriod); let current_block = inst.current_block(); // `do_english_auction` fn will try to add an automatic transition 1 block after the last english round block @@ -530,70 +539,7 @@ mod benchmarks { // Events frame_system::Pallet::::assert_last_event( - Event::::EnglishAuctionStarted { project_id, when: current_block }.into(), - ); - } - - #[benchmark] - fn start_auction_automatically( - // Insertion attempts in add_to_update_store. Total amount of storage items iterated through in `ProjectsToUpdate`. Leave one free to make the extrinsic pass - x: Linear<1, { ::MaxProjectsToUpdateInsertionAttempts::get() - 1 }>, - // No `y` param because we don't need to remove the automatic transition from storage - ) { - // * setup * - let mut inst = BenchInstantiator::::new(None); - - // real benchmark starts at block 0, and we can't call `events()` at block 0 - inst.advance_time(1u32.into()).unwrap(); - - let issuer = account::>("issuer", 0, 0); - whitelist_account!(issuer); - - let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); - let project_id = inst.create_evaluating_project(project_metadata, issuer.clone()); - - let evaluations = default_evaluations(); - let plmc_for_evaluating = BenchInstantiator::::calculate_evaluation_plmc_spent(evaluations.clone()); - let existential_plmc: Vec> = plmc_for_evaluating.accounts().existential_deposits(); - let ct_account_deposits: Vec> = plmc_for_evaluating.accounts().ct_account_deposits(); - - inst.mint_plmc_to(existential_plmc); - inst.mint_plmc_to(ct_account_deposits); - inst.mint_plmc_to(plmc_for_evaluating); - - inst.advance_time(One::one()).unwrap(); - inst.bond_for_users(project_id, evaluations).expect("All evaluations are accepted"); - - inst.advance_time(::EvaluationDuration::get() + One::one()).unwrap(); - - let current_block = inst.current_block(); - let automatic_transition_block = - current_block + ::AuctionInitializePeriodDuration::get() + One::one(); - let insertion_block_number: BlockNumberFor = - automatic_transition_block + T::EnglishAuctionDuration::get() + One::one(); - let block_number = insertion_block_number; - - fill_projects_to_update::(x, block_number, None); - - let now = inst.current_block(); - inst.advance_time(automatic_transition_block - now - One::one()).unwrap(); - let now = inst.current_block(); - // we don't use advance time to avoid triggering on_initialize. This benchmark should only measure the extrinsic - // weight and not the whole on_initialize call weight - frame_system::Pallet::::set_block_number(now + One::one()); - - #[extrinsic_call] - start_auction(RawOrigin::Signed(issuer), project_id); - - // * validity checks * - // Storage - let stored_details = ProjectsDetails::::get(project_id).unwrap(); - assert_eq!(stored_details.status, ProjectStatus::AuctionRound(AuctionPhase::English)); - - // Events - let current_block = inst.current_block(); - frame_system::Pallet::::assert_last_event( - Event::::EnglishAuctionStarted { project_id, when: current_block }.into(), + Event::::EnglishAuctionStarted { project_id, when: current_block.into() }.into(), ); } @@ -831,11 +777,11 @@ mod benchmarks { let existential_deposits: Vec> = vec![bidder.clone()].existential_deposits(); let ct_account_deposits = vec![bidder.clone()].ct_account_deposits(); - let usdt_for_existing_bids: Vec> = + let usdt_for_existing_bids: Vec> = BenchInstantiator::::calculate_auction_funding_asset_spent(&existing_bids_post_bucketing, None); let escrow_account = Pallet::::fund_account_id(project_id); let prev_total_escrow_usdt_locked = - inst.get_free_statemint_asset_balances_for(usdt_id(), vec![escrow_account.clone()]); + inst.get_free_foreign_asset_balances_for(usdt_id(), vec![escrow_account.clone()]); inst.mint_plmc_to(plmc_for_existing_bids.clone()); inst.mint_plmc_to(existential_deposits.clone()); @@ -843,7 +789,7 @@ mod benchmarks { inst.mint_foreign_asset_to(usdt_for_existing_bids.clone()); // do "x" contributions for this user - inst.bid_for_users(project_id, existing_bids_post_bucketing.clone()); + inst.bid_for_users(project_id, existing_bids_post_bucketing.clone()).unwrap(); // to call do_perform_bid several times, we need the bucket to reach its limit. You can only bid over 10 buckets // in a single bid, since the increase delta is 10% of the total allocation, and you cannot bid more than the allocation. @@ -851,10 +797,10 @@ mod benchmarks { let mut maybe_filler_bid = None; let new_bidder = account::>("new_bidder", 0, 0); - let mut usdt_for_filler_bidder = vec![UserToStatemintAsset::::new( + let mut usdt_for_filler_bidder = vec![UserToForeignAssets::::new( new_bidder.clone(), Zero::zero(), - AcceptedFundingAsset::USDT.to_statemint_id(), + AcceptedFundingAsset::USDT.to_assethub_id(), )]; if do_perform_bid_calls > 0 { let current_bucket = Buckets::::get(project_id).unwrap(); @@ -879,9 +825,9 @@ mod benchmarks { inst.mint_plmc_to(plmc_for_new_bidder); inst.mint_plmc_to(plmc_ed); inst.mint_plmc_to(plmc_ct_deposit); - inst.mint_statemint_asset_to(usdt_for_new_bidder.clone()); + inst.mint_foreign_asset_to(usdt_for_new_bidder.clone()); - inst.bid_for_users(project_id, vec![bid_params]); + inst.bid_for_users(project_id, vec![bid_params]).unwrap(); ct_amount = Percent::from_percent(10) * (project_metadata.total_allocation_size.0 * (do_perform_bid_calls as u128).into()); @@ -894,10 +840,10 @@ mod benchmarks { assert_eq!(extrinsic_bids_post_bucketing.len(), (do_perform_bid_calls as usize).max(1usize)); let plmc_for_extrinsic_bids: Vec> = BenchInstantiator::::calculate_auction_plmc_spent(&extrinsic_bids_post_bucketing, None); - let usdt_for_extrinsic_bids: Vec> = + let usdt_for_extrinsic_bids: Vec> = BenchInstantiator::::calculate_auction_funding_asset_spent(&extrinsic_bids_post_bucketing, None); inst.mint_plmc_to(plmc_for_extrinsic_bids.clone()); - inst.mint_statemint_asset_to(usdt_for_extrinsic_bids.clone()); + inst.mint_foreign_asset_to(usdt_for_extrinsic_bids.clone()); let total_free_plmc = existential_deposits[0].plmc_amount; let total_plmc_participation_bonded = BenchInstantiator::::sum_balance_mappings(vec![ @@ -905,7 +851,7 @@ mod benchmarks { plmc_for_existing_bids.clone(), ]); let total_free_usdt = Zero::zero(); - let total_escrow_usdt_locked = BenchInstantiator::::sum_statemint_mappings(vec![ + let total_escrow_usdt_locked = BenchInstantiator::::sum_foreign_mappings(vec![ prev_total_escrow_usdt_locked.clone(), usdt_for_extrinsic_bids.clone(), usdt_for_existing_bids.clone(), @@ -938,7 +884,8 @@ mod benchmarks { total_plmc_bonded: BalanceOf, total_free_usdt: BalanceOf, total_usdt_locked: BalanceOf, - ) where + ) -> () + where ::Balance: From, ::Price: From, T::Hash: From, @@ -1007,7 +954,7 @@ mod benchmarks { let escrow_account = Pallet::::fund_account_id(project_id); let locked_usdt = - inst.get_free_statemint_asset_balances_for(usdt_id(), vec![escrow_account.clone()])[0].asset_amount; + inst.get_free_foreign_asset_balances_for(usdt_id(), vec![escrow_account.clone()])[0].asset_amount; assert_eq!(locked_usdt, total_usdt_locked); let free_usdt = inst.get_free_foreign_asset_balances_for(usdt_id(), vec![bidder])[0].asset_amount; @@ -1048,7 +995,7 @@ mod benchmarks { total_usdt_locked, ) = bid_setup::(x, y); - make_ct_deposit_for::(original_extrinsic_bid.bidder.clone(), project_id); + let _new_plmc_minted = make_ct_deposit_for::(original_extrinsic_bid.bidder.clone(), project_id); #[extrinsic_call] bid( @@ -1143,10 +1090,10 @@ mod benchmarks { // We need to leave enough block numbers to fill `ProjectsToUpdate` before our project insertion let mut time_advance: u32 = 1; if let Some((y, z)) = ends_round { - let u32_remaining_vecs: u32 = z.saturating_sub(y); + let u32_remaining_vecs: u32 = z.saturating_sub(y).into(); time_advance += u32_remaining_vecs + 1; } - inst.advance_time(time_advance.into()).unwrap(); + frame_system::Pallet::::set_block_number(time_advance.into()); let issuer = account::>("issuer", 0, 0); let contributor = account::>("contributor", 0, 0); @@ -1195,15 +1142,14 @@ mod benchmarks { plmc_for_extrinsic_contribution.accounts().ct_account_deposits(); let escrow_account = Pallet::::fund_account_id(project_id); - let prev_total_usdt_locked = - inst.get_free_statemint_asset_balances_for(usdt_id(), vec![escrow_account.clone()]); + let prev_total_usdt_locked = inst.get_free_foreign_asset_balances_for(usdt_id(), vec![escrow_account.clone()]); inst.mint_plmc_to(plmc_for_existing_contributions.clone()); inst.mint_plmc_to(plmc_for_extrinsic_contribution.clone()); inst.mint_plmc_to(existential_deposits.clone()); inst.mint_plmc_to(ct_account_deposits.clone()); - inst.mint_statemint_asset_to(usdt_for_existing_contributions.clone()); - inst.mint_statemint_asset_to(usdt_for_extrinsic_contribution.clone()); + inst.mint_foreign_asset_to(usdt_for_existing_contributions.clone()); + inst.mint_foreign_asset_to(usdt_for_extrinsic_contribution.clone()); // do "x" contributions for this user inst.contribute_for_users(project_id, existing_contributions).expect("All contributions are accepted"); @@ -1212,7 +1158,7 @@ mod benchmarks { plmc_for_existing_contributions.clone(), plmc_for_extrinsic_contribution.clone(), ]); - let mut total_usdt_locked = BenchInstantiator::::sum_statemint_mappings(vec![ + let mut total_usdt_locked = BenchInstantiator::::sum_foreign_mappings(vec![ prev_total_usdt_locked, usdt_for_existing_contributions.clone(), usdt_for_extrinsic_contribution.clone(), @@ -1309,7 +1255,7 @@ mod benchmarks { let escrow_account = Pallet::::fund_account_id(project_id); let locked_usdt = - inst.get_free_statemint_asset_balances_for(usdt_id(), vec![escrow_account.clone()])[0].asset_amount; + inst.get_free_foreign_asset_balances_for(usdt_id(), vec![escrow_account.clone()])[0].asset_amount; assert_eq!(locked_usdt, total_usdt_locked); let free_usdt = inst.get_free_foreign_asset_balances_for(usdt_id(), vec![contributor.clone()])[0].asset_amount; @@ -1393,7 +1339,7 @@ mod benchmarks { total_ct_sold, ) = contribution_setup::(x, ends_round); - make_ct_deposit_for::(extrinsic_contribution.contributor.clone(), project_id); + let _new_plmc_minted = make_ct_deposit_for::(extrinsic_contribution.contributor.clone(), project_id); #[extrinsic_call] contribute( @@ -1484,7 +1430,7 @@ mod benchmarks { total_ct_sold, ) = contribution_setup::(x, ends_round); - make_ct_deposit_for::(extrinsic_contribution.contributor.clone(), project_id); + let _new_plmc_minter = make_ct_deposit_for::(extrinsic_contribution.contributor.clone(), project_id); #[extrinsic_call] contribute( @@ -1657,7 +1603,9 @@ mod benchmarks { vec![], ); - inst.advance_time(::SuccessToSettlementTime::get()).unwrap(); + let (settlement_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(settlement_block - 1u32.into()); + inst.advance_time(1u32.into()).unwrap(); assert_eq!(inst.get_project_details(project_id).status, ProjectStatus::FundingSuccessful); assert_eq!( inst.get_project_details(project_id).cleanup, @@ -1669,7 +1617,7 @@ mod benchmarks { inst.execute(|| { PalletFunding::::evaluation_reward_payout_for( - ::RuntimeOrigin::signed(evaluator.clone()), + ::RuntimeOrigin::signed(evaluator.clone().into()), project_id, evaluator.clone(), evaluation_to_unbond.id, @@ -1730,7 +1678,9 @@ mod benchmarks { vec![], ); - inst.advance_time(::SuccessToSettlementTime::get()).unwrap(); + let (update_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(update_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); assert_eq!( inst.get_project_details(project_id).cleanup, Cleaner::Success(CleanerState::Initialized(PhantomData)) @@ -1803,7 +1753,9 @@ mod benchmarks { vec![], ); - inst.advance_time(::SuccessToSettlementTime::get()).unwrap(); + let (update_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(update_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); assert_eq!( inst.get_project_details(project_id).cleanup, Cleaner::Success(CleanerState::Initialized(PhantomData)) @@ -1968,7 +1920,9 @@ mod benchmarks { vec![], ); - inst.advance_time(::SuccessToSettlementTime::get()).unwrap(); + let (update_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(update_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); assert_eq!( inst.get_project_details(project_id).cleanup, Cleaner::Success(CleanerState::Initialized(PhantomData)) @@ -2033,7 +1987,9 @@ mod benchmarks { vec![], ); - inst.advance_time(::SuccessToSettlementTime::get()).unwrap(); + let (update_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(update_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); assert_eq!( inst.get_project_details(project_id).cleanup, Cleaner::Success(CleanerState::Initialized(PhantomData)) @@ -2098,7 +2054,9 @@ mod benchmarks { vec![], ); - inst.advance_time(::SuccessToSettlementTime::get()).unwrap(); + let (update_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(update_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); assert_eq!( inst.get_project_details(project_id).cleanup, Cleaner::Success(CleanerState::Initialized(PhantomData)) @@ -2178,7 +2136,9 @@ mod benchmarks { vec![], ); - inst.advance_time(::SuccessToSettlementTime::get()).unwrap(); + let (update_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(update_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); assert_eq!( inst.get_project_details(project_id).cleanup, Cleaner::Success(CleanerState::Initialized(PhantomData)) @@ -2250,7 +2210,9 @@ mod benchmarks { vec![], ); - inst.advance_time(::SuccessToSettlementTime::get()).unwrap(); + let (update_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(update_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); assert_eq!( inst.get_project_details(project_id).cleanup, Cleaner::Success(CleanerState::Initialized(PhantomData)) @@ -2305,7 +2267,9 @@ mod benchmarks { vec![], ); - inst.advance_time(::SuccessToSettlementTime::get()).unwrap(); + let (update_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(update_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); assert_eq!( inst.get_project_details(project_id).cleanup, Cleaner::Success(CleanerState::Initialized(PhantomData)) @@ -2367,7 +2331,9 @@ mod benchmarks { vec![], ); - inst.advance_time(::SuccessToSettlementTime::get()).unwrap(); + let (update_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(update_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); assert_eq!( inst.get_project_details(project_id).cleanup, Cleaner::Success(CleanerState::Initialized(PhantomData)) @@ -2419,7 +2385,9 @@ mod benchmarks { vec![], ); - inst.advance_time(::SuccessToSettlementTime::get()).unwrap(); + let (update_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(update_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); assert_eq!( inst.get_project_details(project_id).cleanup, Cleaner::Success(CleanerState::Initialized(PhantomData)) @@ -2473,19 +2441,18 @@ mod benchmarks { let mut inst = BenchInstantiator::::new(None); // We need to leave enough block numbers to fill `ProjectsToUpdate` before our project insertion - let u32_remaining_vecs: u32 = y.saturating_sub(x); + let u32_remaining_vecs: u32 = y.saturating_sub(x).into(); let time_advance: u32 = 1 + u32_remaining_vecs + 1; - inst.advance_time(time_advance.into()).unwrap(); + frame_system::Pallet::::set_block_number(time_advance.into()); let issuer = account::>("issuer", 0, 0); - let evaluations = default_evaluations::(); - let evaluator = evaluations[0].account.clone(); - whitelist_account!(evaluator); + whitelist_account!(issuer); let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); let target_funding_amount: BalanceOf = project_metadata.minimum_price.saturating_mul_int(project_metadata.total_allocation_size.0); + let evaluations = default_evaluations::(); let bids = BenchInstantiator::generate_bids_from_total_usd( Percent::from_percent(40) * target_funding_amount, 1u128.into(), @@ -2721,7 +2688,7 @@ mod benchmarks { inst.execute(|| { PalletFunding::::release_bid_funds_for( - ::RuntimeOrigin::signed(bidder.clone()), + ::RuntimeOrigin::signed(bidder.clone().into()), project_id, bidder.clone(), stored_bid.id, @@ -2794,7 +2761,7 @@ mod benchmarks { inst.execute(|| { PalletFunding::::release_contribution_funds_for( - ::RuntimeOrigin::signed(contributor.clone()), + ::RuntimeOrigin::signed(contributor.clone().into()), project_id, contributor.clone(), stored_contribution.id, @@ -2831,157 +2798,1050 @@ mod benchmarks { ); } - #[macro_export] - macro_rules! find_event { - ($env: expr, $pattern:pat) => { - $env.execute(|| { - let events: Vec::RuntimeEvent, T::Hash>> = - frame_system::Pallet::::events(); - - events.iter().find_map(|event_record| { - let runtime_event = event_record.event.clone(); - if let Ok(eve) = runtime_event.try_into() { - if let $pattern = &eve { - return Some(Rc::new(eve)); - } else { - return None; - } - } - return None; - }) - }) - }; - } + // + // on_initialize + // - #[cfg(test)] - mod tests { - use super::*; - use crate::mock::{new_test_ext, TestRuntime}; + //do_evaluation_end + #[benchmark] + fn end_evaluation_success( + // Insertion attempts in add_to_update_store. Total amount of storage items iterated through in `ProjectsToUpdate`. Leave one free to make the fn succeed + x: Linear<1, { ::MaxProjectsToUpdateInsertionAttempts::get() - 1 }>, + ) { + // * setup * + let mut inst = BenchInstantiator::::new(None); - #[test] - fn bench_create() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_create()); - }); - } + // real benchmark starts at block 0, and we can't call `events()` at block 0 + inst.advance_time(1u32.into()).unwrap(); - #[test] - fn bench_edit_metadata() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_edit_metadata()); - }); - } + let issuer = account::>("issuer", 0, 0); + whitelist_account!(issuer); - #[test] - fn bench_start_evaluation() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_start_evaluation()); - }); - } + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let project_id = inst.create_evaluating_project(project_metadata, issuer.clone()); - #[test] - fn bench_first_evaluation() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_first_evaluation()); - }); - } + let evaluations = default_evaluations(); + let plmc_for_evaluating = BenchInstantiator::::calculate_evaluation_plmc_spent(evaluations.clone()); + let existential_plmc: Vec> = plmc_for_evaluating.accounts().existential_deposits(); + let ct_account_deposits: Vec> = plmc_for_evaluating.accounts().ct_account_deposits(); - #[test] - fn bench_second_to_limit_evaluation() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_second_to_limit_evaluation()); - }); - } + inst.mint_plmc_to(existential_plmc); + inst.mint_plmc_to(ct_account_deposits); + inst.mint_plmc_to(plmc_for_evaluating); - #[test] - fn bench_evaluation_over_limit() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_evaluation_over_limit()); - }); - } + inst.advance_time(One::one()).unwrap(); + inst.bond_for_users(project_id, evaluations).expect("All evaluations are accepted"); - #[test] - fn bench_start_auction_manually() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_start_auction_manually()); - }); - } + let evaluation_end_block = + inst.get_project_details(project_id).phase_transition_points.evaluation.end().unwrap(); + // move block manually without calling any hooks, to avoid triggering the transition outside the benchmarking context + frame_system::Pallet::::set_block_number(evaluation_end_block + One::one()); - #[test] - fn bench_start_auction_automatically() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_start_auction_automatically()); - }); - } + let insertion_block_number = + inst.current_block() + One::one() + ::AuctionInitializePeriodDuration::get(); + fill_projects_to_update::(x, insertion_block_number, None); - #[test] - fn bench_bid_with_ct_deposit() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_bid_with_ct_deposit()); - }); + // Instead of advancing in time for the automatic `do_evaluation_end` call in on_initialize, we call it directly to benchmark it + #[block] + { + Pallet::::do_evaluation_end(project_id).unwrap(); } - #[test] - fn bench_bid_no_ct_deposit() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_bid_no_ct_deposit()); - }); - } + // * validity checks * + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::AuctionInitializePeriod); + } - #[test] - fn bench_first_contribution_no_ct_deposit() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_first_contribution_no_ct_deposit()); - }); - } + #[benchmark] + fn end_evaluation_failure() { + // * setup * + let mut inst = BenchInstantiator::::new(None); - #[test] - fn bench_first_contribution_with_ct_deposit() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_first_contribution_with_ct_deposit()); - }); - } + // real benchmark starts at block 0, and we can't call `events()` at block 0 + inst.advance_time(1u32.into()).unwrap(); - #[test] - fn bench_first_contribution_ends_round_no_ct_deposit() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_first_contribution_ends_round_no_ct_deposit()); - }); - } + let issuer = account::>("issuer", 0, 0); + whitelist_account!(issuer); - #[test] - fn bench_first_contribution_ends_round_with_ct_deposit() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_first_contribution_ends_round_with_ct_deposit()); - }); - } + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let project_id = inst.create_evaluating_project(project_metadata, issuer.clone()); + let project_details = inst.get_project_details(project_id); + + let evaluation_usd_target = + ::EvaluationSuccessThreshold::get() * project_details.fundraising_target; + // we only fund 50% of the minimum threshold for the evaluation round, since we want it to fail + let evaluations = vec![ + UserToUSDBalance::new( + account::>("evaluator_1", 0, 0), + (Percent::from_percent(5) * evaluation_usd_target).into(), + ), + UserToUSDBalance::new( + account::>("evaluator_2", 0, 0), + (Percent::from_percent(20) * evaluation_usd_target).into(), + ), + UserToUSDBalance::new( + account::>("evaluator_3", 0, 0), + (Percent::from_percent(25) * evaluation_usd_target).into(), + ), + ]; + let plmc_for_evaluating = BenchInstantiator::::calculate_evaluation_plmc_spent(evaluations.clone()); + let existential_plmc: Vec> = plmc_for_evaluating.accounts().existential_deposits(); + let ct_account_deposits: Vec> = plmc_for_evaluating.accounts().ct_account_deposits(); - #[test] - fn bench_second_to_limit_contribution() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_second_to_limit_contribution()); - }); - } + inst.mint_plmc_to(existential_plmc); + inst.mint_plmc_to(ct_account_deposits); + inst.mint_plmc_to(plmc_for_evaluating); - #[test] - fn bench_second_to_limit_contribution_ends_round() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_second_to_limit_contribution_ends_round()); - }); - } + inst.advance_time(One::one()).unwrap(); + inst.bond_for_users(project_id, evaluations).expect("All evaluations are accepted"); - #[test] - fn bench_contribution_over_limit() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_contribution_over_limit()); - }); - } + let evaluation_end_block = + inst.get_project_details(project_id).phase_transition_points.evaluation.end().unwrap(); + // move block manually without calling any hooks, to avoid triggering the transition outside the benchmarking context + frame_system::Pallet::::set_block_number(evaluation_end_block + One::one()); - #[test] - fn bench_evaluation_unbond_for() { - new_test_ext().execute_with(|| { - assert_ok!(PalletFunding::::test_evaluation_unbond_for()); - }); + // Instead of advancing in time for the automatic `do_evaluation_end` call in on_initialize, we call it directly to benchmark it + #[block] + { + Pallet::::do_evaluation_end(project_id).unwrap(); + } + + // * validity checks * + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::EvaluationFailed); + } + + //do_english_auction + #[benchmark] + fn start_auction_automatically( + // Insertion attempts in add_to_update_store. Total amount of storage items iterated through in `ProjectsToUpdate`. Leave one free to make the extrinsic pass + x: Linear<1, { ::MaxProjectsToUpdateInsertionAttempts::get() - 1 }>, + // No `y` param because we don't need to remove the automatic transition from storage + ) { + // * setup * + let mut inst = BenchInstantiator::::new(None); + + // real benchmark starts at block 0, and we can't call `events()` at block 0 + inst.advance_time(1u32.into()).unwrap(); + + let issuer = account::>("issuer", 0, 0); + whitelist_account!(issuer); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let project_id = inst.create_evaluating_project(project_metadata, issuer.clone()); + + let evaluations = default_evaluations(); + let plmc_for_evaluating = BenchInstantiator::::calculate_evaluation_plmc_spent(evaluations.clone()); + let existential_plmc: Vec> = plmc_for_evaluating.accounts().existential_deposits(); + let ct_account_deposits: Vec> = plmc_for_evaluating.accounts().ct_account_deposits(); + + inst.mint_plmc_to(existential_plmc); + inst.mint_plmc_to(ct_account_deposits); + inst.mint_plmc_to(plmc_for_evaluating); + + inst.advance_time(One::one()).unwrap(); + inst.bond_for_users(project_id, evaluations).expect("All evaluations are accepted"); + + let (evaluation_end_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(evaluation_end_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); + + let current_block = inst.current_block(); + let automatic_transition_block = + current_block + ::AuctionInitializePeriodDuration::get() + One::one(); + let insertion_block_number: BlockNumberFor = + automatic_transition_block + T::EnglishAuctionDuration::get() + One::one(); + let block_number = insertion_block_number; + + fill_projects_to_update::(x, block_number, None); + + // we don't use advance time to avoid triggering on_initialize. This benchmark should only measure the extrinsic + // weight and not the whole on_initialize call weight + frame_system::Pallet::::set_block_number(automatic_transition_block); + + #[extrinsic_call] + start_auction(RawOrigin::Signed(issuer), project_id); + + // * validity checks * + // Storage + let stored_details = ProjectsDetails::::get(project_id).unwrap(); + assert_eq!(stored_details.status, ProjectStatus::AuctionRound(AuctionPhase::English)); + + // Events + let current_block = inst.current_block(); + frame_system::Pallet::::assert_last_event( + Event::::EnglishAuctionStarted { project_id, when: current_block.into() }.into(), + ); + } + + // do_candle_auction + #[benchmark] + fn start_candle_phase( + // Insertion attempts in add_to_update_store. Total amount of storage items iterated through in `ProjectsToUpdate`. Leave one free to make the fn succeed + x: Linear<1, { ::MaxProjectsToUpdateInsertionAttempts::get() - 1 }>, + ) { + // * setup * + let mut inst = BenchInstantiator::::new(None); + + // real benchmark starts at block 0, and we can't call `events()` at block 0 + inst.advance_time(1u32.into()).unwrap(); + + let issuer = account::>("issuer", 0, 0); + whitelist_account!(issuer); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let project_id = inst.create_auctioning_project(project_metadata, issuer.clone(), default_evaluations()); + + let english_end_block = + inst.get_project_details(project_id).phase_transition_points.english_auction.end().unwrap(); + // we don't use advance time to avoid triggering on_initialize. This benchmark should only measure the extrinsic + // weight and not the whole on_initialize call weight + frame_system::Pallet::::set_block_number(english_end_block + One::one()); + + let insertion_block_number = inst.current_block() + T::CandleAuctionDuration::get() + One::one(); + + fill_projects_to_update::(x, insertion_block_number, None); + + #[block] + { + Pallet::::do_candle_auction(project_id).unwrap(); + } + // * validity checks * + // Storage + let stored_details = ProjectsDetails::::get(project_id).unwrap(); + assert_eq!(stored_details.status, ProjectStatus::AuctionRound(AuctionPhase::Candle)); + + // Events + let current_block = inst.current_block(); + frame_system::Pallet::::assert_last_event( + Event::::CandleAuctionStarted { project_id, when: current_block.into() }.into(), + ); + } + + // do_community_funding + // Should be complex due to calling `calculate_weighted_average_price` + #[benchmark] + fn start_community_funding_success( + // Insertion attempts in add_to_update_store. Total amount of storage items iterated through in `ProjectsToUpdate`. Leave one free to make the fn succeed + x: Linear<1, { ::MaxProjectsToUpdateInsertionAttempts::get() - 1 }>, + // Accepted Bids + y: Linear<1, { ::MaxBidsPerProject::get() / 2 }>, + // Failed Bids + z: Linear<0, { ::MaxBidsPerProject::get() / 2 }>, + ) { + // * setup * + let mut inst = BenchInstantiator::::new(None); + // real benchmark starts at block 0, and we can't call `events()` at block 0 + inst.advance_time(1u32.into()).unwrap(); + + let issuer = account::>("issuer", 0, 0); + whitelist_account!(issuer); + let bounded_name = BoundedVec::try_from("Contribution Token TEST".as_bytes().to_vec()).unwrap(); + let bounded_symbol = BoundedVec::try_from("CTEST".as_bytes().to_vec()).unwrap(); + let metadata_hash = hashed(format!("{}-{}", METADATA, 69)); + // default has 50k allocated for bidding, so we cannot test the cap of bidding (100k bids) with it, since the ticket size is 1. + let project_metadata = ProjectMetadata { + token_information: CurrencyMetadata { + name: bounded_name, + symbol: bounded_symbol, + decimals: ASSET_DECIMALS, + }, + mainnet_token_max_supply: BalanceOf::::try_from(8_000_000_0_000_000_000u128) + .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), + total_allocation_size: ( + BalanceOf::::try_from((10 * (y + z) + 1) as u128 * ASSET_UNIT) + .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), + BalanceOf::::try_from(50_000u128 * ASSET_UNIT) + .unwrap_or_else(|_| panic!("Failed to create BalanceOf")), + ), + minimum_price: 1u128.into(), + ticket_size: TicketSize { + minimum: Some(1u128.try_into().unwrap_or_else(|_| panic!("Failed to create BalanceOf"))), + maximum: None, + }, + participants_size: ParticipantsSize { minimum: Some(2), maximum: None }, + funding_thresholds: Default::default(), + conversion_rate: 0, + participation_currencies: AcceptedFundingAsset::USDT, + funding_destination_account: issuer.clone(), + offchain_information_hash: Some(metadata_hash.into()), + }; + let project_id = + inst.create_auctioning_project(project_metadata.clone(), issuer.clone(), default_evaluations()); + + let accepted_bids = (0..y) + .map(|i| { + BidParams::::new( + account::>("bidder", 0, i), + (10u128 * ASSET_UNIT).into(), + project_metadata.minimum_price, + 1u8, + AcceptedFundingAsset::USDT, + ) + }) + .collect_vec(); + + let plmc_needed_for_bids = BenchInstantiator::::calculate_auction_plmc_spent(&accepted_bids, None); + let plmc_ed = accepted_bids.accounts().existential_deposits(); + let plmc_ct_account_deposit = accepted_bids.accounts().ct_account_deposits(); + let funding_asset_needed_for_bids = + BenchInstantiator::::calculate_auction_funding_asset_spent(&accepted_bids, None); + + inst.mint_plmc_to(plmc_needed_for_bids); + inst.mint_plmc_to(plmc_ed); + inst.mint_plmc_to(plmc_ct_account_deposit); + inst.mint_foreign_asset_to(funding_asset_needed_for_bids); + + inst.bid_for_users(project_id, accepted_bids).unwrap(); + + let now = inst.current_block(); + frame_system::Pallet::::set_block_number(now + ::EnglishAuctionDuration::get()); + // automatic transition to candle + inst.advance_time(1u32.into()).unwrap(); + + // testing always produced this random ending + let random_ending: BlockNumberFor = 9176u32.into(); + frame_system::Pallet::::set_block_number(random_ending + 2u32.into()); + + let rejected_bids = (0..z) + .map(|i| { + BidParams::::new( + account::>("bidder", 0, i), + (10u128 * ASSET_UNIT).into(), + project_metadata.minimum_price, + 1u8, + AcceptedFundingAsset::USDT, + ) + }) + .collect_vec(); + + let plmc_needed_for_bids = BenchInstantiator::::calculate_auction_plmc_spent(&rejected_bids, None); + let plmc_ed = rejected_bids.accounts().existential_deposits(); + let plmc_ct_account_deposit = rejected_bids.accounts().ct_account_deposits(); + let funding_asset_needed_for_bids = + BenchInstantiator::::calculate_auction_funding_asset_spent(&rejected_bids, None); + + inst.mint_plmc_to(plmc_needed_for_bids); + inst.mint_plmc_to(plmc_ed); + inst.mint_plmc_to(plmc_ct_account_deposit); + inst.mint_foreign_asset_to(funding_asset_needed_for_bids); + + inst.bid_for_users(project_id, rejected_bids).unwrap(); + + let auction_candle_end_block = + inst.get_project_details(project_id).phase_transition_points.candle_auction.end().unwrap(); + // we don't use advance time to avoid triggering on_initialize. This benchmark should only measure the fn + // weight and not the whole on_initialize call weight + frame_system::Pallet::::set_block_number(auction_candle_end_block + One::one()); + let now = inst.current_block(); + + let community_end_block = now + T::CommunityFundingDuration::get(); + + let insertion_block_number = community_end_block + One::one(); + fill_projects_to_update::(x, insertion_block_number, None); + + #[block] + { + Pallet::::do_community_funding(project_id).unwrap(); + } + + // * validity checks * + // Storage + let stored_details = ProjectsDetails::::get(project_id).unwrap(); + assert_eq!(stored_details.status, ProjectStatus::CommunityRound); + + let accepted_bids_count = + Bids::::iter_prefix_values((project_id,)).filter(|b| matches!(b.status, BidStatus::Accepted)).count(); + let rejected_bids_count = + Bids::::iter_prefix_values((project_id,)).filter(|b| matches!(b.status, BidStatus::Rejected(_))).count(); + assert_eq!(rejected_bids_count, z as usize); + assert_eq!(accepted_bids_count, y as usize); + + // Events + frame_system::Pallet::::assert_last_event(Event::::CommunityFundingStarted { project_id }.into()); + } + + #[benchmark] + fn start_community_funding_failure( + // Insertion attempts in add_to_update_store. Total amount of storage items iterated through in `ProjectsToUpdate`. Leave one free to make the fn succeed + x: Linear<1, { ::MaxProjectsToUpdateInsertionAttempts::get() - 1 }>, + ) { + // * setup * + let mut inst = BenchInstantiator::::new(None); + + // real benchmark starts at block 0, and we can't call `events()` at block 0 + inst.advance_time(1u32.into()).unwrap(); + + let issuer = account::>("issuer", 0, 0); + whitelist_account!(issuer); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let project_id = inst.create_auctioning_project(project_metadata, issuer.clone(), default_evaluations()); + + // no bids are made, so the project fails + let (update_block, _) = inst.get_update_pair(project_id); + frame_system::Pallet::::set_block_number(update_block - 1u32.into()); + inst.advance_time(One::one()).unwrap(); + + let auction_candle_end_block = + inst.get_project_details(project_id).phase_transition_points.candle_auction.end().unwrap(); + // we don't use advance time to avoid triggering on_initialize. This benchmark should only measure the fn + // weight and not the whole on_initialize call weight + frame_system::Pallet::::set_block_number(auction_candle_end_block + One::one()); + let now = inst.current_block(); + + let community_end_block = now + T::CommunityFundingDuration::get(); + + let insertion_block_number = community_end_block + One::one(); + fill_projects_to_update::(x, insertion_block_number, None); + + #[block] + { + Pallet::::do_community_funding(project_id).unwrap(); + } + + // * validity checks * + // Storage + let stored_details = ProjectsDetails::::get(project_id).unwrap(); + assert_eq!(stored_details.status, ProjectStatus::FundingFailed); + + // Events + frame_system::Pallet::::assert_last_event(Event::::AuctionFailed { project_id }.into()); + } + + // do_remainder_funding + #[benchmark] + fn start_remainder_funding( + // Insertion attempts in add_to_update_store. Total amount of storage items iterated through in `ProjectsToUpdate`. Leave one free to make the fn succeed + x: Linear<1, { ::MaxProjectsToUpdateInsertionAttempts::get() - 1 }>, + ) { + // * setup * + let mut inst = BenchInstantiator::::new(None); + + // real benchmark starts at block 0, and we can't call `events()` at block 0 + inst.advance_time(1u32.into()).unwrap(); + + let issuer = account::>("issuer", 0, 0); + whitelist_account!(issuer); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let (project_id, _) = inst.create_community_contributing_project( + project_metadata, + issuer.clone(), + default_evaluations(), + default_bids(), + ); + + let community_end_block = inst.get_project_details(project_id).phase_transition_points.community.end().unwrap(); + + // we don't use advance time to avoid triggering on_initialize. This benchmark should only measure the fn + // weight and not the whole on_initialize call weight + frame_system::Pallet::::set_block_number(community_end_block + One::one()); + + let now = inst.current_block(); + let remainder_end_block = now + T::RemainderFundingDuration::get(); + let insertion_block_number = remainder_end_block + 1u32.into(); + + fill_projects_to_update::(x, insertion_block_number, None); + + #[block] + { + Pallet::::do_remainder_funding(project_id).unwrap(); + } + + // * validity checks * + // Storage + let stored_details = ProjectsDetails::::get(project_id).unwrap(); + assert_eq!(stored_details.status, ProjectStatus::RemainderRound); + + // Events + frame_system::Pallet::::assert_last_event(Event::::RemainderFundingStarted { project_id }.into()); + } + + // do_end_funding + #[benchmark] + fn end_funding_automatically_rejected_evaluators_slashed( + // Insertion attempts in add_to_update_store. Total amount of storage items iterated through in `ProjectsToUpdate`. Leave one free to make the fn succeed + x: Linear<1, { ::MaxProjectsToUpdateInsertionAttempts::get() - 1 }>, + ) { + // setup + let mut inst = BenchInstantiator::::new(None); + + let issuer = account::>("issuer", 0, 0); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let target_funding_amount: BalanceOf = project_metadata + .minimum_price + .saturating_mul_int(project_metadata.total_allocation_size.0 + project_metadata.total_allocation_size.1); + + let automatically_rejected_threshold = Percent::from_percent(33); + + let bids: Vec> = BenchInstantiator::generate_bids_from_total_usd( + (automatically_rejected_threshold * target_funding_amount) / 2.into(), + project_metadata.minimum_price, + default_weights(), + default_bidders::(), + default_bidder_multipliers(), + ); + let contributions = BenchInstantiator::generate_contributions_from_total_usd( + (automatically_rejected_threshold * target_funding_amount) / 2.into(), + BenchInstantiator::calculate_price_from_test_bids(bids.clone()), + default_weights(), + default_contributors::(), + default_community_contributor_multipliers(), + ); + + let (project_id, _) = inst.create_remainder_contributing_project( + project_metadata, + issuer.clone(), + default_evaluations::(), + bids, + contributions, + ); + + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::RemainderRound); + let last_funding_block = project_details.phase_transition_points.remainder.end().unwrap(); + + frame_system::Pallet::::set_block_number(last_funding_block + 1u32.into()); + + let insertion_block_number = inst.current_block() + 1u32.into(); + fill_projects_to_update::(x, insertion_block_number, None); + + #[block] + { + Pallet::::do_end_funding(project_id).unwrap(); + } + + // * validity checks * + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::FundingFailed); + } + #[benchmark] + fn end_funding_awaiting_decision_evaluators_slashed( + // Insertion attempts in add_to_update_store. Total amount of storage items iterated through in `ProjectsToUpdate`. Leave one free to make the fn succeed + x: Linear<1, { ::MaxProjectsToUpdateInsertionAttempts::get() - 1 }>, + ) { + // setup + let mut inst = BenchInstantiator::::new(None); + + let issuer = account::>("issuer", 0, 0); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let target_funding_amount: BalanceOf = project_metadata + .minimum_price + .saturating_mul_int(project_metadata.total_allocation_size.0 + project_metadata.total_allocation_size.1); + + let automatically_rejected_threshold = Percent::from_percent(75); + + let bids: Vec> = BenchInstantiator::generate_bids_from_total_usd( + (automatically_rejected_threshold * target_funding_amount) / 2.into(), + project_metadata.minimum_price, + default_weights(), + default_bidders::(), + default_bidder_multipliers(), + ); + let contributions = BenchInstantiator::generate_contributions_from_total_usd( + (automatically_rejected_threshold * target_funding_amount) / 2.into(), + BenchInstantiator::calculate_price_from_test_bids(bids.clone()), + default_weights(), + default_contributors::(), + default_community_contributor_multipliers(), + ); + + let (project_id, _) = inst.create_remainder_contributing_project( + project_metadata, + issuer.clone(), + default_evaluations::(), + bids, + contributions, + ); + + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::RemainderRound); + let last_funding_block = project_details.phase_transition_points.remainder.end().unwrap(); + + frame_system::Pallet::::set_block_number(last_funding_block + 1u32.into()); + + let insertion_block_number = inst.current_block() + T::ManualAcceptanceDuration::get().into() + 1u32.into(); + fill_projects_to_update::(x, insertion_block_number, None); + + #[block] + { + Pallet::::do_end_funding(project_id).unwrap(); + } + + // * validity checks * + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::AwaitingProjectDecision); + assert_eq!(project_details.evaluation_round_info.evaluators_outcome, EvaluatorsOutcome::Slashed) + } + #[benchmark] + fn end_funding_awaiting_decision_evaluators_unchanged( + // Insertion attempts in add_to_update_store. Total amount of storage items iterated through in `ProjectsToUpdate`. Leave one free to make the fn succeed + x: Linear<1, { ::MaxProjectsToUpdateInsertionAttempts::get() - 1 }>, + ) { + // setup + let mut inst = BenchInstantiator::::new(None); + + let issuer = account::>("issuer", 0, 0); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let target_funding_amount: BalanceOf = project_metadata + .minimum_price + .saturating_mul_int(project_metadata.total_allocation_size.0 + project_metadata.total_allocation_size.1); + + let automatically_rejected_threshold = Percent::from_percent(89); + + let bids: Vec> = BenchInstantiator::generate_bids_from_total_usd( + (automatically_rejected_threshold * target_funding_amount) / 2.into(), + project_metadata.minimum_price, + default_weights(), + default_bidders::(), + default_bidder_multipliers(), + ); + let contributions = BenchInstantiator::generate_contributions_from_total_usd( + (automatically_rejected_threshold * target_funding_amount) / 2.into(), + BenchInstantiator::calculate_price_from_test_bids(bids.clone()), + default_weights(), + default_contributors::(), + default_community_contributor_multipliers(), + ); + + let (project_id, _) = inst.create_remainder_contributing_project( + project_metadata, + issuer.clone(), + default_evaluations::(), + bids, + contributions, + ); + + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::RemainderRound); + let last_funding_block = project_details.phase_transition_points.remainder.end().unwrap(); + + frame_system::Pallet::::set_block_number(last_funding_block + 1u32.into()); + + let insertion_block_number = inst.current_block() + T::ManualAcceptanceDuration::get().into() + 1u32.into(); + fill_projects_to_update::(x, insertion_block_number, None); + + #[block] + { + Pallet::::do_end_funding(project_id).unwrap(); + } + + // * validity checks * + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::AwaitingProjectDecision); + assert_eq!(project_details.evaluation_round_info.evaluators_outcome, EvaluatorsOutcome::Unchanged) + } + #[benchmark] + fn end_funding_automatically_accepted_evaluators_rewarded( + // Insertion attempts in add_to_update_store. Total amount of storage items iterated through in `ProjectsToUpdate`. Leave one free to make the fn succeed + x: Linear<1, { ::MaxProjectsToUpdateInsertionAttempts::get() - 1 }>, + // How many evaluations have been made. Used when calculating evaluator rewards + y: Linear<1, { ::MaxEvaluationsPerProject::get() }>, + ) { + // setup + let mut inst = BenchInstantiator::::new(None); + + let issuer = account::>("issuer", 0, 0); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let target_funding_amount: BalanceOf = project_metadata + .minimum_price + .saturating_mul_int(project_metadata.total_allocation_size.0 + project_metadata.total_allocation_size.1); + + let automatically_rejected_threshold = Percent::from_percent(91); + + let mut evaluations = (0..y.saturating_sub(1)) + .map(|i| { + UserToUSDBalance::::new(account::>("evaluator", 0, i), (10u128 * ASSET_UNIT).into()) + }) + .collect_vec(); + + let evaluation_target_usd = ::EvaluationSuccessThreshold::get() * target_funding_amount; + evaluations.push(UserToUSDBalance::::new( + account::>("evaluator_success", 0, 69420), + evaluation_target_usd, + )); + + let plmc_needed_for_evaluating = BenchInstantiator::::calculate_evaluation_plmc_spent(evaluations.clone()); + let plmc_ed = evaluations.accounts().existential_deposits(); + let plmc_ct_account_deposit = evaluations.accounts().ct_account_deposits(); + + inst.mint_plmc_to(plmc_needed_for_evaluating); + inst.mint_plmc_to(plmc_ed); + inst.mint_plmc_to(plmc_ct_account_deposit); + + let bids: Vec> = BenchInstantiator::generate_bids_from_total_usd( + (automatically_rejected_threshold * target_funding_amount) / 2.into(), + project_metadata.minimum_price, + default_weights(), + default_bidders::(), + default_bidder_multipliers(), + ); + let contributions = BenchInstantiator::generate_contributions_from_total_usd( + (automatically_rejected_threshold * target_funding_amount) / 2.into(), + BenchInstantiator::calculate_price_from_test_bids(bids.clone()), + default_weights(), + default_contributors::(), + default_community_contributor_multipliers(), + ); + + let (project_id, _) = inst.create_remainder_contributing_project( + project_metadata, + issuer.clone(), + evaluations, + bids, + contributions, + ); + + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::RemainderRound); + let last_funding_block = project_details.phase_transition_points.remainder.end().unwrap(); + + frame_system::Pallet::::set_block_number(last_funding_block + 1u32.into()); + + let insertion_block_number = inst.current_block() + T::SuccessToSettlementTime::get().into(); + fill_projects_to_update::(x, insertion_block_number, None); + + #[block] + { + Pallet::::do_end_funding(project_id).unwrap(); + } + + // * validity checks * + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::FundingSuccessful); + } + + // do_project_decision + #[benchmark] + fn project_decision_accept_funding() { + // setup + let mut inst = BenchInstantiator::::new(None); + + let issuer = account::>("issuer", 0, 0); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let target_funding_amount: BalanceOf = project_metadata + .minimum_price + .saturating_mul_int(project_metadata.total_allocation_size.0 + project_metadata.total_allocation_size.1); + let manual_outcome_threshold = Percent::from_percent(50); + + let bids: Vec> = BenchInstantiator::generate_bids_from_total_usd( + (manual_outcome_threshold * target_funding_amount) / 2.into(), + project_metadata.minimum_price, + default_weights(), + default_bidders::(), + default_bidder_multipliers(), + ); + let contributions = BenchInstantiator::generate_contributions_from_total_usd( + (manual_outcome_threshold * target_funding_amount) / 2.into(), + BenchInstantiator::calculate_price_from_test_bids(bids.clone()), + default_weights(), + default_contributors::(), + default_community_contributor_multipliers(), + ); + + let project_id = inst.create_finished_project( + project_metadata, + issuer.clone(), + default_evaluations::(), + bids, + contributions, + vec![], + ); + + assert_eq!(inst.get_project_details(project_id).status, ProjectStatus::AwaitingProjectDecision); + + #[block] + { + Pallet::::do_project_decision(project_id, FundingOutcomeDecision::AcceptFunding).unwrap(); + } + + // * validity checks * + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::FundingSuccessful); + } + + #[benchmark] + fn project_decision_reject_funding() { + // setup + let mut inst = BenchInstantiator::::new(None); + + let issuer = account::>("issuer", 0, 0); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let target_funding_amount: BalanceOf = project_metadata + .minimum_price + .saturating_mul_int(project_metadata.total_allocation_size.0 + project_metadata.total_allocation_size.1); + let manual_outcome_threshold = Percent::from_percent(50); + + let bids: Vec> = BenchInstantiator::generate_bids_from_total_usd( + (manual_outcome_threshold * target_funding_amount) / 2.into(), + project_metadata.minimum_price, + default_weights(), + default_bidders::(), + default_bidder_multipliers(), + ); + let contributions = BenchInstantiator::generate_contributions_from_total_usd( + (manual_outcome_threshold * target_funding_amount) / 2.into(), + BenchInstantiator::calculate_price_from_test_bids(bids.clone()), + default_weights(), + default_contributors::(), + default_community_contributor_multipliers(), + ); + + let project_id = inst.create_finished_project( + project_metadata, + issuer.clone(), + default_evaluations::(), + bids, + contributions, + vec![], + ); + + assert_eq!(inst.get_project_details(project_id).status, ProjectStatus::AwaitingProjectDecision); + + #[block] + { + Pallet::::do_project_decision(project_id, FundingOutcomeDecision::RejectFunding).unwrap(); + } + + // * validity checks * + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.status, ProjectStatus::FundingFailed); + } + + // do_start_settlement + #[benchmark] + fn start_settlement_funding_success() { + // setup + let mut inst = BenchInstantiator::::new(None); + + let issuer = account::>("issuer", 0, 0); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let project_id = inst.create_finished_project( + project_metadata, + issuer.clone(), + default_evaluations::(), + default_bids::(), + default_community_contributions::(), + vec![], + ); + + #[block] + { + Pallet::::do_start_settlement(project_id).unwrap(); + } + + // * validity checks * + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.cleanup, Cleaner::Success(CleanerState::Initialized(PhantomData))); + } + + #[benchmark] + fn start_settlement_funding_failure() { + // setup + let mut inst = BenchInstantiator::::new(None); + + let issuer = account::>("issuer", 0, 0); + + let project_metadata = default_project::(inst.get_new_nonce(), issuer.clone()); + let target_funding_amount: BalanceOf = project_metadata + .minimum_price + .saturating_mul_int(project_metadata.total_allocation_size.0 + project_metadata.total_allocation_size.1); + + let bids: Vec> = BenchInstantiator::generate_bids_from_total_usd( + Percent::from_percent(15) * target_funding_amount, + 1u128.into(), + default_weights(), + default_bidders::(), + default_bidder_multipliers(), + ); + let contributions = BenchInstantiator::generate_contributions_from_total_usd( + Percent::from_percent(10) * target_funding_amount, + BenchInstantiator::calculate_price_from_test_bids(bids.clone()), + default_weights(), + default_contributors::(), + default_community_contributor_multipliers(), + ); + + let project_id = inst.create_finished_project( + project_metadata, + issuer.clone(), + default_evaluations::(), + bids, + contributions, + vec![], + ); + + assert_eq!(inst.get_project_details(project_id).status, ProjectStatus::FundingFailed); + + #[block] + { + Pallet::::do_start_settlement(project_id).unwrap(); + } + + // * validity checks * + let project_details = inst.get_project_details(project_id); + assert_eq!(project_details.cleanup, Cleaner::Failure(CleanerState::Initialized(PhantomData))); + } + + #[macro_export] + macro_rules! find_event { + ($env: expr, $pattern:pat) => { + $env.execute(|| { + let events: Vec::RuntimeEvent, T::Hash>> = + frame_system::Pallet::::events(); + + events.iter().find_map(|event_record| { + let runtime_event = event_record.event.clone(); + if let Ok(eve) = runtime_event.try_into() { + if let $pattern = &eve { + return Some(Rc::new(eve)); + } else { + return None; + } + } + return None; + }) + }) + }; + } + + #[cfg(test)] + mod tests { + use super::*; + use crate::mock::{new_test_ext, TestRuntime}; + + #[test] + fn bench_create() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_create()); + }); + } + + #[test] + fn bench_edit_metadata() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_edit_metadata()); + }); + } + + #[test] + fn bench_start_evaluation() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_start_evaluation()); + }); + } + + #[test] + fn bench_first_evaluation() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_first_evaluation()); + }); + } + + #[test] + fn bench_second_to_limit_evaluation() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_second_to_limit_evaluation()); + }); + } + + #[test] + fn bench_evaluation_over_limit() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_evaluation_over_limit()); + }); + } + + #[test] + fn bench_start_auction_manually() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_start_auction_manually()); + }); + } + + #[test] + fn bench_start_auction_automatically() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_start_auction_automatically()); + }); + } + + #[test] + fn bench_bid_with_ct_deposit() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_bid_with_ct_deposit()); + }); + } + + #[test] + fn bench_bid_no_ct_deposit() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_bid_no_ct_deposit()); + }); + } + + #[test] + fn bench_first_contribution_no_ct_deposit() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_first_contribution_no_ct_deposit()); + }); + } + + #[test] + fn bench_first_contribution_with_ct_deposit() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_first_contribution_with_ct_deposit()); + }); + } + + #[test] + fn bench_first_contribution_ends_round_no_ct_deposit() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_first_contribution_ends_round_no_ct_deposit()); + }); + } + + #[test] + fn bench_first_contribution_ends_round_with_ct_deposit() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_first_contribution_ends_round_with_ct_deposit()); + }); + } + + #[test] + fn bench_second_to_limit_contribution() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_second_to_limit_contribution()); + }); + } + + #[test] + fn bench_second_to_limit_contribution_ends_round() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_second_to_limit_contribution_ends_round()); + }); + } + + #[test] + fn bench_contribution_over_limit() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_contribution_over_limit()); + }); + } + + #[test] + fn bench_evaluation_unbond_for() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_evaluation_unbond_for()); + }); } #[test] @@ -3095,5 +3955,104 @@ mod benchmarks { assert_ok!(PalletFunding::::test_contribution_unbond_for()); }); } + + // on_initialize benches + #[test] + fn bench_end_evaluation_success() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_end_evaluation_success()); + }); + } + + #[test] + fn bench_end_evaluation_failure() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_end_evaluation_failure()); + }); + } + + #[test] + fn bench_start_candle_phase() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_start_candle_phase()); + }); + } + + #[test] + fn bench_start_community_funding_success() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_start_community_funding_success()); + }); + } + + #[test] + fn bench_start_community_funding_failure() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_start_community_funding_success()); + }); + } + + #[test] + fn bench_start_remainder_funding() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_start_remainder_funding()); + }); + } + + #[test] + fn bench_start_settlement_funding_success() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_start_settlement_funding_success()); + }); + } + + #[test] + fn bench_start_settlement_funding_failure() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_start_settlement_funding_failure()); + }); + } + + #[test] + fn bench_project_decision_accept_funding() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_project_decision_accept_funding()); + }); + } + + #[test] + fn bench_project_decision_reject_funding() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_project_decision_reject_funding()); + }); + } + + #[test] + fn bench_end_funding_automatically_rejected_evaluators_slashed() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_end_funding_automatically_rejected_evaluators_slashed()); + }); + } + + #[test] + fn bench_end_funding_automatically_accepted_evaluators_rewarded() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_end_funding_automatically_accepted_evaluators_rewarded()); + }); + } + + #[test] + fn bench_end_funding_awaiting_decision_evaluators_unchanged() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_end_funding_awaiting_decision_evaluators_unchanged()); + }); + } + + #[test] + fn bench_end_funding_awaiting_decision_evaluators_slashed() { + new_test_ext().execute_with(|| { + assert_ok!(PalletFunding::::test_end_funding_awaiting_decision_evaluators_slashed()); + }); + } } } diff --git a/pallets/funding/src/functions.rs b/pallets/funding/src/functions.rs index c1c064af4..e7188802f 100644 --- a/pallets/funding/src/functions.rs +++ b/pallets/funding/src/functions.rs @@ -17,20 +17,24 @@ // If you feel like getting in touch with us, you can do so at info@polimec.org //! Functions for the Funding pallet. - +use crate::ProjectStatus::FundingSuccessful; use frame_support::{ dispatch::{DispatchErrorWithPostInfo, DispatchResult, DispatchResultWithPostInfo, PostDispatchInfo}, ensure, pallet_prelude::*, traits::{ - fungible::{InspectHold, MutateHold as FungibleMutateHold}, - fungibles::{metadata::Mutate as MetadataMutate, Create, Inspect, Mutate as FungiblesMutate}, + fungible::{InspectHold, Mutate, MutateHold as FungibleMutateHold}, + fungibles::{ + metadata::{MetadataDeposit, Mutate as MetadataMutate}, + Create, Inspect, Mutate as FungiblesMutate, + }, tokens::{Fortitude, Precision, Preservation, Restriction}, Get, }, }; use frame_system::pallet_prelude::BlockNumberFor; use itertools::Itertools; +use polimec_common::ReleaseSchedule; use sp_arithmetic::{ traits::{CheckedDiv, CheckedSub, Zero}, Percent, Perquintill, @@ -39,14 +43,9 @@ use sp_runtime::traits::{Convert, ConvertBack}; use sp_std::{marker::PhantomData, ops::Not}; use xcm::v3::MaxDispatchErrorLen; -use crate::ProjectStatus::FundingSuccessful; -use polimec_common::ReleaseSchedule; - +use super::*; use crate::traits::{BondingRequirementCalculation, ProvideAssetPrice, VestingDurationCalculation}; -use frame_support::traits::fungible::Mutate; use polimec_common::migration_types::{MigrationInfo, MigrationOrigin, Migrations, ParticipationType}; - -use super::*; const POLIMEC_PARA_ID: u32 = 3344u32; const QUERY_RESPONSE_TIME_WINDOW_BLOCKS: u32 = 20u32; @@ -133,6 +132,16 @@ impl Pallet { ) .map_err(|_| Error::::NotEnoughFundsForEscrowCreation)?; + // Each project needs a new token type to be created (i.e contribution token). + // This creation is done automatically in the project transition on success, but someone needs to pay for the storage + // of the metadata associated with it. + let metadata_deposit = T::ContributionTokenCurrency::calc_metadata_deposit( + initial_metadata.token_information.name.as_slice(), + initial_metadata.token_information.symbol.as_slice(), + ); + T::NativeCurrency::transfer(&issuer, &escrow_account, metadata_deposit, Preservation::Preserve) + .map_err(|_| Error::::NotEnoughFundsForCTMetadata)?; + // * Update storage * ProjectsMetadata::::insert(project_id, &initial_metadata); ProjectsDetails::::insert(project_id, project_details); @@ -238,7 +247,7 @@ impl Pallet { /// /// * Bonding failed - `on_idle` at some point checks for failed evaluation projects, and /// unbonds the evaluators funds. - pub fn do_evaluation_end(project_id: ProjectId) -> DispatchResult { + pub fn do_evaluation_end(project_id: ProjectId) -> DispatchResultWithPostInfo { // * Get variables * let mut project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; let now = >::block_number(); @@ -282,7 +291,7 @@ impl Pallet { project_details.status = ProjectStatus::AuctionInitializePeriod; ProjectsDetails::::insert(project_id, project_details); // TODO: return real weights - let _insertions_attempts = match Self::add_to_update_store( + let insertion_attempts = match Self::add_to_update_store( auction_initialize_period_end_block + 1u32.into(), (&project_id, UpdateType::EnglishAuctionStart), ) { @@ -297,6 +306,11 @@ impl Pallet { end_block: auction_initialize_period_end_block, }); + return Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::end_evaluation_success(insertion_attempts)), + pays_fee: Pays::Yes, + }); + // Unsuccessful path } else { // * Update storage * @@ -306,9 +320,11 @@ impl Pallet { // * Emit events * Self::deposit_event(Event::EvaluationFailed { project_id }); + return Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::end_evaluation_failure()), + pays_fee: Pays::Yes, + }); } - - Ok(()) } /// Called by user extrinsic @@ -449,7 +465,7 @@ impl Pallet { /// but now their bids are not guaranteed. /// Later on, `on_initialize` ends the candle auction round and starts the community round, /// by calling [`do_community_funding`](Self::do_community_funding). - pub fn do_candle_auction(project_id: ProjectId) -> DispatchResult { + pub fn do_candle_auction(project_id: ProjectId) -> DispatchResultWithPostInfo { // * Get variables * let mut project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; let now = >::block_number(); @@ -472,8 +488,7 @@ impl Pallet { project_details.status = ProjectStatus::AuctionRound(AuctionPhase::Candle); ProjectsDetails::::insert(project_id, project_details); // Schedule for automatic check by on_initialize. Success depending on enough funding reached - // TODO: return real weights - let _iterations = match Self::add_to_update_store( + let insertion_iterations = match Self::add_to_update_store( candle_end_block + 1u32.into(), (&project_id, UpdateType::CommunityFundingStart), ) { @@ -484,7 +499,10 @@ impl Pallet { // * Emit events * Self::deposit_event(Event::CandleAuctionStarted { project_id, when: now }); - Ok(()) + Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::start_candle_phase(insertion_iterations)), + pays_fee: Pays::Yes, + }) } /// Called automatically by on_initialize @@ -509,7 +527,7 @@ impl Pallet { /// Retail users buy tokens at the price set on the auction round. /// Later on, `on_initialize` ends the community round by calling [`do_remainder_funding`](Self::do_remainder_funding) and /// starts the remainder round, where anyone can buy at that price point. - pub fn do_community_funding(project_id: ProjectId) -> DispatchResult { + pub fn do_community_funding(project_id: ProjectId) -> DispatchResultWithPostInfo { // * Get variables * let project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; let project_metadata = ProjectsMetadata::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; @@ -539,8 +557,7 @@ impl Pallet { Err(pallet_error) if pallet_error == Error::::NoBidsFound.into() => { project_details.status = ProjectStatus::FundingFailed; ProjectsDetails::::insert(project_id, project_details); - // TODO: return real weights - let _iterations = match Self::add_to_update_store( + let insertion_iterations = match Self::add_to_update_store( >::block_number() + 1u32.into(), (&project_id, UpdateType::FundingEnd), ) { @@ -551,10 +568,13 @@ impl Pallet { // * Emit events * Self::deposit_event(Event::AuctionFailed { project_id }); - Ok(()) + Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::start_community_funding_failure(insertion_iterations)), + pays_fee: Pays::Yes, + }) }, - e @ Err(_) => e, - Ok(()) => { + Err(e) => return Err(DispatchErrorWithPostInfo { post_info: ().into(), error: e }), + Ok((accepted_bids_count, rejected_bids_count)) => { // Get info again after updating it with new price. project_details.phase_transition_points.random_candle_ending = Some(end_block); project_details @@ -563,8 +583,8 @@ impl Pallet { .update(Some(community_start_block), Some(community_end_block)); project_details.status = ProjectStatus::CommunityRound; ProjectsDetails::::insert(project_id, project_details); - // TODO: return real weights - let _iterations = match Self::add_to_update_store( + + let insertion_iterations = match Self::add_to_update_store( community_end_block + 1u32.into(), (&project_id, UpdateType::RemainderFundingStart), ) { @@ -575,7 +595,14 @@ impl Pallet { // * Emit events * Self::deposit_event(Event::CommunityFundingStarted { project_id }); - Ok(()) + Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::start_community_funding_success( + insertion_iterations, + accepted_bids_count, + rejected_bids_count, + )), + pays_fee: Pays::Yes, + }) }, } } @@ -601,7 +628,7 @@ impl Pallet { /// Any users can now buy tokens at the price set on the auction round. /// Later on, `on_initialize` ends the remainder round, and finalizes the project funding, by calling /// [`do_end_funding`](Self::do_end_funding). - pub fn do_remainder_funding(project_id: ProjectId) -> DispatchResult { + pub fn do_remainder_funding(project_id: ProjectId) -> DispatchResultWithPostInfo { // * Get variables * let mut project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; let now = >::block_number(); @@ -624,8 +651,7 @@ impl Pallet { project_details.status = ProjectStatus::RemainderRound; ProjectsDetails::::insert(project_id, project_details); // Schedule for automatic transition by `on_initialize` - // TODO: return real weights - let _iterations = + let insertion_iterations = match Self::add_to_update_store(remainder_end_block + 1u32.into(), (&project_id, UpdateType::FundingEnd)) { Ok(iterations) => iterations, Err(_iterations) => return Err(Error::::TooManyInsertionAttempts.into()), @@ -634,7 +660,10 @@ impl Pallet { // * Emit events * Self::deposit_event(Event::RemainderFundingStarted { project_id }); - Ok(()) + Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::start_remainder_funding(insertion_iterations)), + pays_fee: Pays::Yes, + }) } /// Called automatically by on_initialize @@ -666,7 +695,7 @@ impl Pallet { /// * Bonded plmc with [`vested_plmc_purchase_unbond_for`](Self::vested_plmc_purchase_unbond_for) /// /// If **unsuccessful**, users every user should have their PLMC vesting unbonded. - pub fn do_end_funding(project_id: ProjectId) -> DispatchResult { + pub fn do_end_funding(project_id: ProjectId) -> DispatchResultWithPostInfo { // * Get variables * let mut project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; let project_metadata = ProjectsMetadata::::get(project_id).ok_or(Error::::ProjectNotFound)?; @@ -698,12 +727,22 @@ impl Pallet { // * Update Storage * if funding_ratio <= Perquintill::from_percent(33u64) { project_details.evaluation_round_info.evaluators_outcome = EvaluatorsOutcome::Slashed; - Self::make_project_funding_fail(project_id, project_details, FailureReason::TargetNotReached, 1u32.into()) + let insertion_iterations = Self::make_project_funding_fail( + project_id, + project_details, + FailureReason::TargetNotReached, + 1u32.into(), + )?; + return Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::end_funding_automatically_rejected_evaluators_slashed( + insertion_iterations, + )), + pays_fee: Pays::Yes, + }); } else if funding_ratio <= Perquintill::from_percent(75u64) { project_details.evaluation_round_info.evaluators_outcome = EvaluatorsOutcome::Slashed; project_details.status = ProjectStatus::AwaitingProjectDecision; - // TODO: return real weights - let _iterations = match Self::add_to_update_store( + let insertion_iterations = match Self::add_to_update_store( now + T::ManualAcceptanceDuration::get() + 1u32.into(), (&project_id, UpdateType::ProjectDecision(FundingOutcomeDecision::AcceptFunding)), ) { @@ -711,12 +750,16 @@ impl Pallet { Err(_iterations) => return Err(Error::::TooManyInsertionAttempts.into()), }; ProjectsDetails::::insert(project_id, project_details); - Ok(()) + Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::end_funding_awaiting_decision_evaluators_slashed( + insertion_iterations, + )), + pays_fee: Pays::Yes, + }) } else if funding_ratio < Perquintill::from_percent(90u64) { project_details.evaluation_round_info.evaluators_outcome = EvaluatorsOutcome::Unchanged; project_details.status = ProjectStatus::AwaitingProjectDecision; - // TODO: return real weights - let _iterations = match Self::add_to_update_store( + let insertion_iterations = match Self::add_to_update_store( now + T::ManualAcceptanceDuration::get() + 1u32.into(), (&project_id, UpdateType::ProjectDecision(FundingOutcomeDecision::AcceptFunding)), ) { @@ -724,20 +767,32 @@ impl Pallet { Err(_iterations) => return Err(Error::::TooManyInsertionAttempts.into()), }; ProjectsDetails::::insert(project_id, project_details); - Ok(()) + Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::end_funding_awaiting_decision_evaluators_unchanged( + insertion_iterations, + )), + pays_fee: Pays::Yes, + }) } else { - let reward_info = Self::generate_evaluator_rewards_info(project_id)?; + let (reward_info, evaluations_count) = Self::generate_evaluator_rewards_info(project_id)?; project_details.evaluation_round_info.evaluators_outcome = EvaluatorsOutcome::Rewarded(reward_info); - Self::make_project_funding_successful( + let insertion_iterations = Self::make_project_funding_successful( project_id, project_details, SuccessReason::ReachedTarget, T::SuccessToSettlementTime::get(), - ) + )?; + return Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::end_funding_automatically_accepted_evaluators_rewarded( + insertion_iterations, + evaluations_count, + )), + pays_fee: Pays::Yes, + }); } } - pub fn do_project_decision(project_id: ProjectId, decision: FundingOutcomeDecision) -> DispatchResult { + pub fn do_project_decision(project_id: ProjectId, decision: FundingOutcomeDecision) -> DispatchResultWithPostInfo { // * Get variables * let project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; @@ -750,6 +805,10 @@ impl Pallet { SuccessReason::ProjectDecision, T::SuccessToSettlementTime::get(), )?; + Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::project_decision_accept_funding()), + pays_fee: Pays::Yes, + }) }, FundingOutcomeDecision::RejectFunding => { Self::make_project_funding_fail( @@ -758,13 +817,15 @@ impl Pallet { FailureReason::ProjectDecision, T::SuccessToSettlementTime::get(), )?; + Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::project_decision_reject_funding()), + pays_fee: Pays::Yes, + }) }, } - - Ok(()) } - pub fn do_start_settlement(project_id: ProjectId) -> DispatchResult { + pub fn do_start_settlement(project_id: ProjectId) -> DispatchResultWithPostInfo { // * Get variables * let mut project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectDetailsNotFound)?; let token_information = @@ -784,21 +845,29 @@ impl Pallet { project_details.funding_end_block = Some(now); // * Update storage * - ProjectsDetails::::insert(project_id, &project_details); + let escrow_account = Self::fund_account_id(project_id); if project_details.status == ProjectStatus::FundingSuccessful { - T::ContributionTokenCurrency::create(project_id, project_details.issuer.clone(), false, 1_u32.into())?; + T::ContributionTokenCurrency::create(project_id, escrow_account.clone(), false, 1_u32.into())?; T::ContributionTokenCurrency::set( project_id, - &project_details.issuer, + &escrow_account.clone(), token_information.name.into(), token_information.symbol.into(), token_information.decimals, )?; - } - Ok(()) + Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::start_settlement_funding_success()), + pays_fee: Pays::Yes, + }) + } else { + Ok(PostDispatchInfo { + actual_weight: Some(WeightInfoOf::::start_settlement_funding_failure()), + pays_fee: Pays::Yes, + }) + } } } @@ -842,7 +911,7 @@ impl Pallet { Ok(()) } - // Note: usd_amount needs to have the same amount of decimals as PLMC,, so when multiplied by the plmc-usd price, it gives us the PLMC amount with the decimals we wanted. + // Note: usd_amount needs to have the same amount of decimals as PLMC, so when multiplied by the plmc-usd price, it gives us the PLMC amount with the decimals we wanted. pub fn do_evaluate( evaluator: &AccountIdOf, project_id: ProjectId, @@ -859,10 +928,12 @@ impl Pallet { T::EvaluationSuccessThreshold::get() * project_details.fundraising_target; let evaluation_round_info = &mut project_details.evaluation_round_info; let ct_deposit = T::ContributionTokenCurrency::deposit_required(project_id); + let evaluations_count = EvaluationCounts::::get(project_id); // * Validity Checks * ensure!(evaluator.clone() != project_details.issuer, Error::::ContributionToThemselves); ensure!(project_details.status == ProjectStatus::EvaluationRound, Error::::EvaluationNotStarted); + ensure!(evaluations_count < T::MaxEvaluationsPerProject::get(), Error::::TooManyEvaluationsForProject); // * Calculate new variables * let plmc_bond = plmc_usd_price @@ -927,6 +998,7 @@ impl Pallet { T::NativeCurrency::hold(&HoldReason::Evaluation(project_id).into(), evaluator, plmc_bond)?; Evaluations::::remove((project_id, evaluator, low_id)); + EvaluationCounts::::mutate(project_id, |c| *c -= 1); } Evaluations::::insert((project_id, evaluator, evaluation_id), new_evaluation); @@ -934,6 +1006,7 @@ impl Pallet { evaluation_round_info.total_bonded_usd += usd_amount; evaluation_round_info.total_bonded_plmc += plmc_bond; ProjectsDetails::::insert(project_id, project_details); + EvaluationCounts::::mutate(project_id, |c| *c += 1); // * Emit events * Self::deposit_event(Event::FundsBonded { project_id, amount: plmc_bond, bonder: evaluator.clone() }); @@ -946,7 +1019,7 @@ impl Pallet { } else { WeightInfoOf::::evaluation_over_limit() }; - // + Ok(PostDispatchInfo { actual_weight: Some(actual_weight), pays_fee: Pays::Yes }) } @@ -976,7 +1049,7 @@ impl Pallet { let plmc_usd_price = T::PriceProvider::get_price(PLMC_FOREIGN_ID).ok_or(Error::::PriceNotFound)?; let ct_deposit = T::ContributionTokenCurrency::deposit_required(project_id); let existing_bids = Bids::::iter_prefix_values((project_id, bidder)).collect::>(); - + let bid_count = BidCounts::::get(project_id); // weight return variables let mut perform_bid_calls = 0; let mut ct_deposit_required = false; @@ -984,16 +1057,17 @@ impl Pallet { // * Validity checks * ensure!(ct_amount > Zero::zero(), Error::::BidTooLow); + ensure!(bid_count < T::MaxBidsPerProject::get(), Error::::TooManyBidsForProject); ensure!(bidder.clone() != project_details.issuer, Error::::ContributionToThemselves); ensure!(matches!(project_details.status, ProjectStatus::AuctionRound(_)), Error::::AuctionNotStarted); ensure!(funding_asset == project_metadata.participation_currencies, Error::::FundingAssetNotAccepted); // Note: We limit the CT Amount to the total allocation size, to avoid long running loops. ensure!(ct_amount <= project_metadata.total_allocation_size.0, Error::::NotAllowed); - ensure!(existing_bids.len() < T::MaxBidsPerUser::get() as usize, Error::::TooManyBids); + ensure!(existing_bids.len() < T::MaxBidsPerUser::get() as usize, Error::::TooManyBidsForUser); // Reserve plmc deposit to create a contribution token account for this project - if T::NativeCurrency::balance_on_hold(&HoldReason::FutureDeposit(project_id).into(), bidder) < ct_deposit { - T::NativeCurrency::hold(&HoldReason::FutureDeposit(project_id).into(), bidder, ct_deposit)?; + if T::NativeCurrency::balance_on_hold(&HoldReason::FutureDeposit(project_id).into(), &bidder) < ct_deposit { + T::NativeCurrency::hold(&HoldReason::FutureDeposit(project_id).into(), &bidder, ct_deposit)?; ct_deposit_required = true } @@ -1107,6 +1181,7 @@ impl Pallet { Bids::::insert((project_id, bidder, bid_id), &new_bid); NextBidId::::set(bid_id.saturating_add(One::one())); + BidCounts::::mutate(project_id, |c| *c += 1); Self::deposit_event(Event::Bid { project_id, amount: ct_amount, price: ct_usd_price, multiplier }); @@ -1218,6 +1293,11 @@ impl Pallet { // * Update storage * // Reserve plmc deposit to create a contribution token account for this project + if T::NativeCurrency::balance_on_hold(&HoldReason::FutureDeposit(project_id).into(), &contributor) < ct_deposit + { + weight_ct_account_deposit = true; + T::NativeCurrency::hold(&HoldReason::FutureDeposit(project_id).into(), &contributor, ct_deposit)?; + } if T::NativeCurrency::balance_on_hold(&HoldReason::FutureDeposit(project_id).into(), contributor) < ct_deposit { weight_ct_account_deposit = true; T::NativeCurrency::hold(&HoldReason::FutureDeposit(project_id).into(), contributor, ct_deposit)?; @@ -1405,11 +1485,11 @@ impl Pallet { ensure!(project_details.status == ProjectStatus::AwaitingProjectDecision, Error::::NotAllowed); // * Update storage * - + let remove_attempts: u32; let mut insertion_attempts: u32 = 0u32; - let remove_attempts: u32 = match Self::remove_from_update_store(&project_id) { - Ok(iterations) => iterations, + match Self::remove_from_update_store(&project_id) { + Ok(iterations) => remove_attempts = iterations, Err(iterations) => return Err(DispatchErrorWithPostInfo { post_info: PostDispatchInfo { @@ -2600,7 +2680,7 @@ impl Pallet { return Ok(i); } } - Err(T::MaxProjectsToUpdateInsertionAttempts::get()) + return Err(T::MaxProjectsToUpdateInsertionAttempts::get()); } // returns the actual iterations for weight calculation either as an Err type or Ok type so the caller can add that @@ -2672,7 +2752,7 @@ impl Pallet { project_id: ProjectId, end_block: BlockNumberFor, total_allocation_size: BalanceOf, - ) -> DispatchResult { + ) -> Result<(u32, u32), DispatchError> { // Get all the bids that were made before the end of the candle let mut bids = Bids::::iter_prefix_values((project_id,)).collect::>(); // temp variable to store the sum of the bids @@ -2681,6 +2761,11 @@ impl Pallet { let mut bid_usd_value_sum = BalanceOf::::zero(); let project_account = Self::fund_account_id(project_id); let plmc_price = T::PriceProvider::get_price(PLMC_FOREIGN_ID).ok_or(Error::::PLMCPriceNotAvailable)?; + + // Weight calculation variables + let mut accepted_bids_count = 0u32; + let mut rejected_bids_count = 0u32; + // sort bids by price, and equal prices sorted by id bids.sort_by(|a, b| b.cmp(a)); // accept only bids that were made before `end_block` i.e end of candle auction @@ -2688,68 +2773,62 @@ impl Pallet { .into_iter() .map(|mut bid| { if bid.when > end_block { + rejected_bids_count += 1; return Self::refund_bid(&mut bid, project_id, &project_account, RejectionReason::AfterCandleEnd) .and(Ok(bid)); } let buyable_amount = total_allocation_size.saturating_sub(bid_token_amount_sum); if buyable_amount.is_zero() { + rejected_bids_count += 1; return Self::refund_bid(&mut bid, project_id, &project_account, RejectionReason::NoTokensLeft) .and(Ok(bid)); } else if bid.original_ct_amount <= buyable_amount { - let maybe_ticket_size = bid.original_ct_usd_price.checked_mul_int(bid.original_ct_amount); - if let Some(ticket_size) = maybe_ticket_size { - bid_token_amount_sum.saturating_accrue(bid.original_ct_amount); - bid_usd_value_sum.saturating_accrue(ticket_size); - bid.status = BidStatus::Accepted; - } else { - return Self::refund_bid(&mut bid, project_id, &project_account, RejectionReason::BadMath) - .and(Ok(bid)); - } + accepted_bids_count += 1; + let ticket_size = bid.original_ct_usd_price.saturating_mul_int(bid.original_ct_amount); + bid_token_amount_sum.saturating_accrue(bid.original_ct_amount); + bid_usd_value_sum.saturating_accrue(ticket_size); + bid.status = BidStatus::Accepted; } else { - let maybe_ticket_size = bid.original_ct_usd_price.checked_mul_int(buyable_amount); - if let Some(ticket_size) = maybe_ticket_size { - bid_usd_value_sum.saturating_accrue(ticket_size); - bid_token_amount_sum.saturating_accrue(buyable_amount); - bid.status = BidStatus::PartiallyAccepted(buyable_amount, RejectionReason::NoTokensLeft); - bid.final_ct_amount = buyable_amount; - - let funding_asset_price = T::PriceProvider::get_price(bid.funding_asset.to_assethub_id()) - .ok_or(Error::::PriceNotFound)?; - let funding_asset_amount_needed = funding_asset_price - .reciprocal() - .ok_or(Error::::BadMath)? - .checked_mul_int(ticket_size) - .ok_or(Error::::BadMath)?; - T::FundingCurrency::transfer( - bid.funding_asset.to_assethub_id(), - &project_account, - &bid.bidder, - bid.funding_asset_amount_locked.saturating_sub(funding_asset_amount_needed), - Preservation::Preserve, - )?; - - let usd_bond_needed = bid - .multiplier - .calculate_bonding_requirement::(ticket_size) - .map_err(|_| Error::::BadMath)?; - let plmc_bond_needed = plmc_price - .reciprocal() - .ok_or(Error::::BadMath)? - .checked_mul_int(usd_bond_needed) - .ok_or(Error::::BadMath)?; - T::NativeCurrency::release( - &HoldReason::Participation(project_id).into(), - &bid.bidder, - bid.plmc_bond.saturating_sub(plmc_bond_needed), - Precision::Exact, - )?; - - bid.funding_asset_amount_locked = funding_asset_amount_needed; - bid.plmc_bond = plmc_bond_needed; - } else { - return Self::refund_bid(&mut bid, project_id, &project_account, RejectionReason::BadMath) - .and(Ok(bid)); - } + accepted_bids_count += 1; + let ticket_size = bid.original_ct_usd_price.saturating_mul_int(buyable_amount); + bid_usd_value_sum.saturating_accrue(ticket_size); + bid_token_amount_sum.saturating_accrue(buyable_amount); + bid.status = BidStatus::PartiallyAccepted(buyable_amount, RejectionReason::NoTokensLeft); + bid.final_ct_amount = buyable_amount; + + let funding_asset_price = T::PriceProvider::get_price(bid.funding_asset.to_assethub_id()) + .ok_or(Error::::PriceNotFound)?; + let funding_asset_amount_needed = funding_asset_price + .reciprocal() + .ok_or(Error::::BadMath)? + .checked_mul_int(ticket_size) + .ok_or(Error::::BadMath)?; + T::FundingCurrency::transfer( + bid.funding_asset.to_assethub_id(), + &project_account, + &bid.bidder, + bid.funding_asset_amount_locked.saturating_sub(funding_asset_amount_needed), + Preservation::Preserve, + )?; + + let usd_bond_needed = bid + .multiplier + .calculate_bonding_requirement::(ticket_size) + .map_err(|_| Error::::BadMath)?; + let plmc_bond_needed = plmc_price + .reciprocal() + .ok_or(Error::::BadMath)? + .checked_mul_int(usd_bond_needed) + .ok_or(Error::::BadMath)?; + T::NativeCurrency::release( + &HoldReason::Participation(project_id.into()).into(), + &bid.bidder, + bid.plmc_bond.saturating_sub(plmc_bond_needed), + Precision::Exact, + )?; + + bid.funding_asset_amount_locked = funding_asset_amount_needed; + bid.plmc_bond = plmc_bond_needed; } Ok(bid) @@ -2860,7 +2939,7 @@ impl Pallet { } })?; - Ok(()) + Ok((accepted_bids_count, rejected_bids_count)) } /// Refund a bid because of `reason`. @@ -3010,11 +3089,13 @@ impl Pallet { /// /// Note: Consider refactoring the `RewardInfo` struct to make it more generic and /// reusable, not just for evaluator rewards. - pub fn generate_evaluator_rewards_info(project_id: ProjectId) -> Result, DispatchError> { + pub fn generate_evaluator_rewards_info(project_id: ProjectId) -> Result<(RewardInfoOf, u32), DispatchError> { // Fetching the necessary data for a specific project. let project_details = ProjectsDetails::::get(project_id).ok_or(Error::::ProjectNotFound)?; let project_metadata = ProjectsMetadata::::get(project_id).ok_or(Error::::ProjectNotFound)?; let evaluations = Evaluations::::iter_prefix((project_id,)).collect::>(); + // used for weight calculation + let evaluations_count = evaluations.len() as u32; // Determine how much funding has been achieved. let funding_amount_reached = project_details.funding_amount_reached; @@ -3069,7 +3150,7 @@ impl Pallet { normal_evaluator_total_bonded_usd, }; - Ok(reward_info) + Ok((reward_info, evaluations_count)) } pub fn make_project_funding_successful( @@ -3077,13 +3158,12 @@ impl Pallet { mut project_details: ProjectDetailsOf, reason: SuccessReason, settlement_delta: BlockNumberFor, - ) -> DispatchResult { + ) -> Result { let now = >::block_number(); project_details.status = ProjectStatus::FundingSuccessful; ProjectsDetails::::insert(project_id, project_details); - // TODO: add real weights - let _iterations = + let insertion_iterations = match Self::add_to_update_store(now + settlement_delta, (&project_id, UpdateType::StartSettlement)) { Ok(iterations) => iterations, Err(_iterations) => return Err(Error::::TooManyInsertionAttempts.into()), @@ -3091,7 +3171,7 @@ impl Pallet { Self::deposit_event(Event::FundingEnded { project_id, outcome: FundingOutcome::Success(reason) }); - Ok(()) + Ok(insertion_iterations) } pub fn make_project_funding_fail( @@ -3099,19 +3179,18 @@ impl Pallet { mut project_details: ProjectDetailsOf, reason: FailureReason, settlement_delta: BlockNumberFor, - ) -> DispatchResult { + ) -> Result { let now = >::block_number(); project_details.status = ProjectStatus::FundingFailed; ProjectsDetails::::insert(project_id, project_details); - // TODO: add real weights - let _iterations = + let insertion_iterations = match Self::add_to_update_store(now + settlement_delta, (&project_id, UpdateType::StartSettlement)) { Ok(iterations) => iterations, Err(_iterations) => return Err(Error::::TooManyInsertionAttempts.into()), }; Self::deposit_event(Event::FundingEnded { project_id, outcome: FundingOutcome::Failure(reason) }); - Ok(()) + Ok(insertion_iterations) } pub fn migrations_per_xcm_message_allowed() -> u32 { diff --git a/pallets/funding/src/instantiator.rs b/pallets/funding/src/instantiator.rs index 6d67faa7b..09ac8e269 100644 --- a/pallets/funding/src/instantiator.rs +++ b/pallets/funding/src/instantiator.rs @@ -23,8 +23,9 @@ use frame_support::{ traits::{ fungible::{Inspect as FungibleInspect, InspectHold as FungibleInspectHold, Mutate as FungibleMutate}, fungibles::{ - metadata::Inspect as MetadataInspect, roles::Inspect as RolesInspect, Inspect as FungiblesInspect, - Mutate as FungiblesMutate, + metadata::{Inspect as MetadataInspect, MetadataDeposit}, + roles::Inspect as RolesInspect, + Inspect as FungiblesInspect, Mutate as FungiblesMutate, }, AccountTouch, Get, OnFinalize, OnIdle, OnInitialize, }, @@ -51,8 +52,6 @@ use sp_std::{ ops::Not, }; -pub use testing_macros::*; - pub type RuntimeOriginOf = ::RuntimeOrigin; pub struct BoxToFunction(pub Box); impl Default for BoxToFunction { @@ -243,9 +242,11 @@ impl< let mut current_block = frame_system::Pallet::::block_number(); >>::on_finalize(current_block); + as OnFinalize>>::on_finalize(current_block); >>::on_idle(current_block, Weight::MAX); + as OnIdle>>::on_idle(current_block, Weight::MAX); current_block += One::one(); @@ -254,6 +255,7 @@ impl< let pre_events = frame_system::Pallet::::events(); as OnInitialize>>::on_initialize(current_block); + >>::on_initialize(current_block); let post_events = frame_system::Pallet::::events(); @@ -330,12 +332,13 @@ impl< pub fn test_ct_created_for(&mut self, project_id: ProjectId) { self.execute(|| { let metadata = ProjectsMetadata::::get(project_id).unwrap(); - let details = ProjectsDetails::::get(project_id).unwrap(); assert_eq!( ::ContributionTokenCurrency::name(project_id), metadata.token_information.name.to_vec() ); - assert_eq!(::ContributionTokenCurrency::admin(project_id).unwrap(), details.issuer); + let escrow_account = Pallet::::fund_account_id(project_id); + + assert_eq!(::ContributionTokenCurrency::admin(project_id).unwrap(), escrow_account); assert_eq!( ::ContributionTokenCurrency::total_issuance(project_id), 0u32.into(), @@ -849,8 +852,16 @@ impl< pub fn create_new_project(&mut self, project_metadata: ProjectMetadataOf, issuer: AccountIdOf) -> ProjectId { let now = self.current_block(); + let metadata_deposit = T::ContributionTokenCurrency::calc_metadata_deposit( + project_metadata.token_information.name.as_slice(), + project_metadata.token_information.symbol.as_slice(), + ); // one ED for the issuer, one ED for the escrow account - self.mint_plmc_to(vec![UserToPLMCBalance::new(issuer.clone(), Self::get_ed() * 2u64.into())]); + self.mint_plmc_to(vec![UserToPLMCBalance::new( + issuer.clone(), + Self::get_ed() * 2u64.into() + metadata_deposit, + )]); + self.execute(|| { crate::Pallet::::do_create(&issuer, project_metadata.clone()).unwrap(); let last_project_metadata = ProjectsMetadata::::iter().last().unwrap(); @@ -896,9 +907,12 @@ impl< if project_details.status == ProjectStatus::EvaluationRound { let evaluation_end = project_details.phase_transition_points.evaluation.end().unwrap(); - let auction_start = evaluation_end.saturating_add(2u32.into()); - let blocks_to_start = auction_start.saturating_sub(self.current_block()); - self.advance_time(blocks_to_start).unwrap(); + self.execute(|| frame_system::Pallet::::set_block_number(evaluation_end)); + // run on_initialize for evaluation end + self.advance_time(1u32.into()).unwrap(); + let auction_initialize_period_start = + self.get_project_details(project_id).phase_transition_points.auction_initialize_period.start().unwrap(); + self.execute(|| frame_system::Pallet::::set_block_number(auction_initialize_period_start)); }; assert_eq!(self.get_project_details(project_id).status, ProjectStatus::AuctionInitializePeriod); @@ -951,11 +965,13 @@ impl< project_id } - pub fn bid_for_users(&mut self, project_id: ProjectId, bids: Vec>) { + pub fn bid_for_users(&mut self, project_id: ProjectId, bids: Vec>) -> DispatchResultWithPostInfo { for bid in bids { - self.execute(|| crate::Pallet::::do_bid(&bid.bidder, project_id, bid.amount, bid.multiplier, bid.asset)) - .unwrap(); + self.execute(|| { + crate::Pallet::::do_bid(&bid.bidder, project_id, bid.amount, bid.multiplier, bid.asset) + })?; } + Ok(().into()) } pub fn start_community_funding(&mut self, project_id: ProjectId) -> Result<(), DispatchError> { @@ -966,9 +982,10 @@ impl< .end() .expect("English end point should exist"); - let candle_start = english_end + 2u32.into(); - let current_block = self.current_block(); - self.advance_time(candle_start.saturating_sub(current_block)).unwrap(); + self.execute(|| frame_system::Pallet::::set_block_number(english_end)); + // run on_initialize + self.advance_time(1u32.into()).unwrap(); + let candle_end = self .get_project_details(project_id) .phase_transition_points @@ -976,10 +993,9 @@ impl< .end() .expect("Candle end point should exist"); - let community_start = candle_end + 2u32.into(); - - let current_block = self.current_block(); - self.advance_time(community_start.saturating_sub(current_block)).unwrap(); + self.execute(|| frame_system::Pallet::::set_block_number(candle_end)); + // run on_initialize + self.advance_time(1u32.into()).unwrap(); assert_eq!(self.get_project_details(project_id).status, ProjectStatus::CommunityRound); @@ -1042,7 +1058,7 @@ impl< self.mint_plmc_to(plmc_ct_account_deposits.clone()); self.mint_foreign_asset_to(funding_asset_deposits.clone()); - self.bid_for_users(project_id, bids.clone()); + self.bid_for_users(project_id, bids.clone()).unwrap(); self.do_reserved_plmc_assertions( total_plmc_participation_locked.merge_accounts(MergeOperation::Add), @@ -1098,15 +1114,9 @@ impl< pub fn start_remainder_or_end_funding(&mut self, project_id: ProjectId) -> Result<(), DispatchError> { assert_eq!(self.get_project_details(project_id).status, ProjectStatus::CommunityRound); - let community_funding_end = self - .get_project_details(project_id) - .phase_transition_points - .community - .end() - .expect("Community funding end point should exist"); - let remainder_start = community_funding_end + 1u32.into(); - let current_block = self.current_block(); - self.advance_time(remainder_start.saturating_sub(current_block)).unwrap(); + let (transition_block, _) = self.get_update_pair(project_id); + self.execute(|| frame_system::Pallet::::set_block_number(transition_block - One::one())); + self.advance_time(1u32.into()).unwrap(); match self.get_project_details(project_id).status { ProjectStatus::RemainderRound | ProjectStatus::FundingSuccessful => Ok(()), _ => panic!("Bad state"), @@ -1115,12 +1125,12 @@ impl< pub fn finish_funding(&mut self, project_id: ProjectId) -> Result<(), DispatchError> { let (update_block, _) = self.get_update_pair(project_id); - let current_block = self.current_block(); - self.advance_time(update_block.saturating_sub(current_block)).unwrap(); + self.execute(|| frame_system::Pallet::::set_block_number(update_block - One::one())); + self.advance_time(1u32.into()).unwrap(); if self.get_project_details(project_id).status == ProjectStatus::RemainderRound { let (end_block, _) = self.get_update_pair(project_id); - let current_block = self.current_block(); - self.advance_time(end_block.saturating_sub(current_block)).unwrap(); + self.execute(|| frame_system::Pallet::::set_block_number(end_block - 1u32.into())); + self.advance_time(1u32.into()).unwrap(); } let project_details = self.get_project_details(project_id); assert!( @@ -1775,7 +1785,7 @@ pub mod async_features { inst.mint_plmc_to(plmc_ct_account_deposits.clone()); inst.mint_foreign_asset_to(funding_asset_deposits.clone()); - inst.bid_for_users(project_id, bids.clone()); + inst.bid_for_users(project_id, bids.clone()).unwrap(); inst.do_reserved_plmc_assertions( total_plmc_participation_locked.merge_accounts(MergeOperation::Add), @@ -2797,10 +2807,11 @@ pub mod testing_macros { macro_rules! assert_close_enough { // Match when a message is provided ($real:expr, $desired:expr, $max_approximation:expr, $msg:expr) => { + let real_parts; if $real <= $desired { - let real_parts = Perquintill::from_rational($real, $desired); + real_parts = Perquintill::from_rational($real, $desired); } else { - let real_parts = Perquintill::from_rational($desired, $real); + real_parts = Perquintill::from_rational($desired, $real); } let one = Perquintill::from_percent(100u64); let real_approximation = one - real_parts; diff --git a/pallets/funding/src/lib.rs b/pallets/funding/src/lib.rs index f75bf4f84..07345454b 100644 --- a/pallets/funding/src/lib.rs +++ b/pallets/funding/src/lib.rs @@ -337,6 +337,7 @@ pub mod pallet { + fungibles::InspectEnumerable, Balance = BalanceOf> + fungibles::metadata::Inspect> + fungibles::metadata::Mutate> + + fungibles::metadata::MetadataDeposit> + fungibles::Mutate, Balance = BalanceOf> + fungibles::roles::Inspect> + AccountTouch, Balance = BalanceOf> @@ -419,9 +420,11 @@ pub mod pallet { Currency = Self::NativeCurrency, Moment = BlockNumberFor, >; + /// For now we expect 3 days until the project is automatically accepted. Timeline decided by MiCA regulations. #[pallet::constant] type ManualAcceptanceDuration: Get>; + /// For now we expect 4 days from acceptance to settlement due to MiCA regulations. #[pallet::constant] type SuccessToSettlementTime: Get>; @@ -459,6 +462,13 @@ pub mod pallet { /// max iterations for trying to insert a project on the projects_to_update storage #[pallet::constant] type MaxProjectsToUpdateInsertionAttempts: Get; + + /// max individual bids per project. Used to estimate worst case weight for price calculation + #[pallet::constant] + type MaxBidsPerProject: Get; + + #[pallet::constant] + type MaxEvaluationsPerProject: Get; } #[pallet::storage] @@ -479,6 +489,12 @@ pub mod pallet { #[pallet::getter(fn next_contribution_id)] pub type NextContributionId = StorageValue<_, u32, ValueQuery>; + #[pallet::storage] + pub type BidCounts = StorageMap<_, Blake2_128Concat, ProjectId, u32, ValueQuery>; + + #[pallet::storage] + pub type EvaluationCounts = StorageMap<_, Blake2_128Concat, ProjectId, u32, ValueQuery>; + #[pallet::storage] #[pallet::getter(fn nonce)] /// A global counter used in the randomness generation @@ -951,10 +967,16 @@ pub mod pallet { NoFutureDepositHeld, /// The issuer doesn't have enough funds (ExistentialDeposit), to create the escrow account NotEnoughFundsForEscrowCreation, + /// The issuer doesn't have enough funds to pay for the metadata of their contribution token + NotEnoughFundsForCTMetadata, /// Too many attempts to insert project in to ProjectsToUpdate storage TooManyInsertionAttempts, /// Reached bid limit for this user on this project - TooManyBids, + TooManyBidsForUser, + /// Reached bid limit for this project + TooManyBidsForProject, + /// Reached evaluation limit for this project + TooManyEvaluationsForProject, } #[pallet::call] @@ -1000,7 +1022,11 @@ pub mod pallet { /// Bond PLMC for a project in the evaluation stage #[pallet::call_index(4)] - #[pallet::weight(WeightInfoOf::::evaluation_over_limit())] + #[pallet::weight( + WeightInfoOf::::first_evaluation() + .max(WeightInfoOf::::second_to_limit_evaluation(T::MaxEvaluationsPerUser::get() - 1)) + .max(WeightInfoOf::::evaluation_over_limit()) + )] pub fn evaluate( origin: OriginFor, project_id: ProjectId, @@ -1012,13 +1038,15 @@ pub mod pallet { /// Bid for a project in the Auction round #[pallet::call_index(5)] - #[pallet::weight(WeightInfoOf::::bid_no_ct_deposit( - // Last bid possible - ::MaxBidsPerUser::get() - 1, - // Assuming the current bucket is full, and has a price higher than the minimum. - // This user is buying 100% of the bid allocation, since each bucket has 10% of the allocation at a 10% increase - 10, - ))] + #[pallet::weight( + WeightInfoOf::::bid_no_ct_deposit( + ::MaxBidsPerUser::get() - 1, + // Assuming the current bucket is full, and has a price higher than the minimum. + // This user is buying 100% of the bid allocation. + // Since each bucket has 10% of the allocation, one bid can be split into a max of 10 + 10 + ) + .max(WeightInfoOf::::bid_with_ct_deposit(10)))] pub fn bid( origin: OriginFor, project_id: ProjectId, @@ -1032,14 +1060,22 @@ pub mod pallet { /// Buy tokens in the Community or Remainder round at the price set in the Auction Round #[pallet::call_index(6)] - #[pallet::weight(WeightInfoOf::::second_to_limit_contribution_ends_round( + #[pallet::weight( + WeightInfoOf::::first_contribution_with_ct_deposit() + .max(WeightInfoOf::::first_contribution_no_ct_deposit()) + .max(WeightInfoOf::::first_contribution_ends_round_with_ct_deposit(::MaxProjectsToUpdateInsertionAttempts::get() - 1, 10_000)) + .max(WeightInfoOf::::first_contribution_ends_round_no_ct_deposit(::MaxProjectsToUpdateInsertionAttempts::get() - 1, 10_000)) + .max(WeightInfoOf::::second_to_limit_contribution(T::MaxContributionsPerUser::get() - 1)) + .max(WeightInfoOf::::second_to_limit_contribution_ends_round( // Last contribution possible before having to remove an old lower one ::MaxContributionsPerUser::get() -1, // Since we didn't remove any previous lower contribution, we can buy all remaining CTs and try to move to the next phase ::MaxProjectsToUpdateInsertionAttempts::get() - 1, // Assumed upper bound for deletion attempts for the previous scheduled transition 10_000u32, - ))] + )) + .max(WeightInfoOf::::contribution_over_limit()) + )] pub fn contribute( origin: OriginFor, project_id: ProjectId, @@ -1077,7 +1113,10 @@ pub mod pallet { } #[pallet::call_index(9)] - #[pallet::weight(WeightInfoOf::::evaluation_reward_payout_for_with_ct_account_creation())] + #[pallet::weight( + WeightInfoOf::::evaluation_reward_payout_for_with_ct_account_creation() + .max(WeightInfoOf::::evaluation_reward_payout_for_no_ct_account_creation()) + )] pub fn evaluation_reward_payout_for( origin: OriginFor, project_id: ProjectId, @@ -1089,7 +1128,10 @@ pub mod pallet { } #[pallet::call_index(10)] - #[pallet::weight(WeightInfoOf::::bid_ct_mint_for_with_ct_account_creation())] + #[pallet::weight( + WeightInfoOf::::bid_ct_mint_for_with_ct_account_creation() + .max(WeightInfoOf::::bid_ct_mint_for_no_ct_account_creation()) + )] pub fn bid_ct_mint_for( origin: OriginFor, project_id: ProjectId, @@ -1101,7 +1143,10 @@ pub mod pallet { } #[pallet::call_index(11)] - #[pallet::weight(WeightInfoOf::::contribution_ct_mint_for_with_ct_account_creation())] + #[pallet::weight( + WeightInfoOf::::contribution_ct_mint_for_with_ct_account_creation() + .max(WeightInfoOf::::contribution_ct_mint_for_no_ct_account_creation()) + )] pub fn contribution_ct_mint_for( origin: OriginFor, project_id: ProjectId, @@ -1280,54 +1325,160 @@ pub mod pallet { impl Hooks> for Pallet { fn on_initialize(now: BlockNumberFor) -> Weight { // Get the projects that need to be updated on this block and update them + let mut used_weight = Weight::from_parts(0, 0); for (project_id, update_type) in ProjectsToUpdate::::take(now) { match update_type { // EvaluationRound -> AuctionInitializePeriod | EvaluationFailed UpdateType::EvaluationEnd => { - unwrap_result_or_skip!(Self::do_evaluation_end(project_id), project_id, |e| e); + used_weight = used_weight.saturating_add( + unwrap_result_or_skip!( + Self::do_evaluation_end(project_id), + project_id, + |e: DispatchErrorWithPostInfo| { e.error } + ) + .actual_weight + .unwrap_or(WeightInfoOf::::end_evaluation_success( + ::MaxProjectsToUpdateInsertionAttempts::get() - 1, + )), + ); }, // AuctionInitializePeriod -> AuctionRound(AuctionPhase::English) // Only if it wasn't first handled by user extrinsic UpdateType::EnglishAuctionStart => { - unwrap_result_or_skip!( - Self::do_english_auction(T::PalletId::get().into_account_truncating(), project_id), - project_id, - |e: DispatchErrorWithPostInfo| { e.error } + used_weight = used_weight.saturating_add( + unwrap_result_or_skip!( + Self::do_english_auction(T::PalletId::get().into_account_truncating(), project_id), + project_id, + |e: DispatchErrorWithPostInfo| { e.error } + ) + .actual_weight + .unwrap_or(WeightInfoOf::::start_auction_manually( + ::MaxProjectsToUpdateInsertionAttempts::get() - 1, + 10_000, + )), ); }, // AuctionRound(AuctionPhase::English) -> AuctionRound(AuctionPhase::Candle) UpdateType::CandleAuctionStart => { - unwrap_result_or_skip!(Self::do_candle_auction(project_id), project_id, |e| e); + used_weight = used_weight.saturating_add( + unwrap_result_or_skip!( + Self::do_candle_auction(project_id), + project_id, + |e: DispatchErrorWithPostInfo| { e.error } + ) + .actual_weight + .unwrap_or(WeightInfoOf::::start_candle_phase( + ::MaxProjectsToUpdateInsertionAttempts::get() - 1, + )), + ); }, // AuctionRound(AuctionPhase::Candle) -> CommunityRound UpdateType::CommunityFundingStart => { - unwrap_result_or_skip!(Self::do_community_funding(project_id), project_id, |e| e); + used_weight = used_weight.saturating_add( + unwrap_result_or_skip!( + Self::do_community_funding(project_id), + project_id, + |e: DispatchErrorWithPostInfo| { e.error } + ) + .actual_weight + .unwrap_or( + WeightInfoOf::::start_community_funding_success( + ::MaxProjectsToUpdateInsertionAttempts::get() - 1, + ::MaxBidsPerProject::get() / 2, + ::MaxBidsPerProject::get() / 2, + ) + .max(WeightInfoOf::::start_community_funding_success( + ::MaxProjectsToUpdateInsertionAttempts::get() - 1, + ::MaxBidsPerProject::get(), + 0u32, + )) + .max(WeightInfoOf::::start_community_funding_success( + ::MaxProjectsToUpdateInsertionAttempts::get() - 1, + 0u32, + ::MaxBidsPerProject::get(), + )), + ), + ); }, // CommunityRound -> RemainderRound UpdateType::RemainderFundingStart => { - unwrap_result_or_skip!(Self::do_remainder_funding(project_id), project_id, |e| e) + used_weight = used_weight.saturating_add( + unwrap_result_or_skip!( + Self::do_remainder_funding(project_id), + project_id, + |e: DispatchErrorWithPostInfo| { e.error } + ) + .actual_weight + .unwrap_or(WeightInfoOf::::start_remainder_funding( + ::MaxProjectsToUpdateInsertionAttempts::get() - 1, + )), + ); }, // CommunityRound || RemainderRound -> FundingEnded UpdateType::FundingEnd => { - unwrap_result_or_skip!(Self::do_end_funding(project_id), project_id, |e| e) + used_weight = used_weight.saturating_add( + unwrap_result_or_skip!( + Self::do_end_funding(project_id), + project_id, + |e: DispatchErrorWithPostInfo| { e.error } + ) + .actual_weight + .unwrap_or( + WeightInfoOf::::end_funding_automatically_rejected_evaluators_slashed( + ::MaxProjectsToUpdateInsertionAttempts::get() - 1, + ) + .max(WeightInfoOf::::end_funding_awaiting_decision_evaluators_slashed( + ::MaxProjectsToUpdateInsertionAttempts::get() - 1, + )) + .max(WeightInfoOf::::end_funding_awaiting_decision_evaluators_unchanged( + ::MaxProjectsToUpdateInsertionAttempts::get() - 1, + )) + .max(WeightInfoOf::::end_funding_automatically_accepted_evaluators_rewarded( + ::MaxProjectsToUpdateInsertionAttempts::get() - 1, + ::MaxEvaluationsPerProject::get(), + )), + ), + ); }, UpdateType::ProjectDecision(decision) => { - unwrap_result_or_skip!(Self::do_project_decision(project_id, decision), project_id, |e| e) + used_weight = used_weight.saturating_add( + unwrap_result_or_skip!( + Self::do_project_decision(project_id, decision), + project_id, + |e: DispatchErrorWithPostInfo| { e.error } + ) + .actual_weight + .unwrap_or( + WeightInfoOf::::project_decision_accept_funding() + .max(WeightInfoOf::::project_decision_reject_funding()), + ), + ); }, UpdateType::StartSettlement => { - unwrap_result_or_skip!(Self::do_start_settlement(project_id), project_id, |e| e) + used_weight = used_weight.saturating_add( + unwrap_result_or_skip!( + Self::do_start_settlement(project_id), + project_id, + |e: DispatchErrorWithPostInfo| { e.error } + ) + .actual_weight + .unwrap_or( + WeightInfoOf::::start_settlement_funding_success() + .max(WeightInfoOf::::start_settlement_funding_failure()), + ), + ); }, } } - // TODO: PLMC-127. Set a proper weight - Weight::from_parts(0, 0) + + used_weight } fn on_idle(_now: BlockNumberFor, max_weight: Weight) -> Weight { @@ -1343,7 +1494,7 @@ pub mod pallet { let projects_amount = projects_needing_cleanup.len() as u64; if projects_amount == 0 { - return max_weight + return max_weight; } let mut max_weight_per_project = remaining_weight.saturating_div(projects_amount); @@ -1359,7 +1510,7 @@ pub mod pallet { { consumed_weight.saturating_accrue(weight); } else { - break + break; } } @@ -1463,7 +1614,7 @@ pub mod local_macros { project_id: $project_id, error: Error::::FieldIsNone.into(), }); - continue + continue; }, } }; @@ -1477,7 +1628,7 @@ pub mod local_macros { Ok(val) => val, Err(err) => { Self::deposit_event(Event::TransitionError { project_id: $project_id, error: $error_handler(err) }); - continue + continue; }, } }; diff --git a/pallets/funding/src/mock.rs b/pallets/funding/src/mock.rs index 31d92f527..e0edaa5c9 100644 --- a/pallets/funding/src/mock.rs +++ b/pallets/funding/src/mock.rs @@ -293,7 +293,6 @@ parameter_types! { parameter_types! { pub BenchmarkReason: RuntimeHoldReason = RuntimeHoldReason::PolimecFunding(crate::HoldReason::Participation(0)); } - impl pallet_linear_release::Config for TestRuntime { type Balance = Balance; #[cfg(feature = "runtime-benchmarks")] @@ -351,12 +350,14 @@ impl Config for TestRuntime { type FeeBrackets = FeeBrackets; type FundingCurrency = ForeignAssets; type ManualAcceptanceDuration = ManualAcceptanceDuration; + type MaxBidsPerProject = ConstU32<2048>; type MaxBidsPerUser = ConstU32<4>; type MaxCapacityThresholds = MaxCapacityThresholds; type MaxContributionsPerUser = ConstU32<4>; + type MaxEvaluationsPerProject = ConstU32<2048>; type MaxEvaluationsPerUser = ConstU32<4>; type MaxMessageSizeThresholds = MaxMessageSizeThresholds; - type MaxProjectsToUpdateInsertionAttempts = ConstU32<10>; + type MaxProjectsToUpdateInsertionAttempts = ConstU32<100>; type MaxProjectsToUpdatePerBlock = ConstU32<5>; type Multiplier = Multiplier; type NativeCurrency = Balances; diff --git a/pallets/funding/src/tests.rs b/pallets/funding/src/tests.rs index b763bd532..d741fe329 100644 --- a/pallets/funding/src/tests.rs +++ b/pallets/funding/src/tests.rs @@ -18,8 +18,9 @@ //! Tests for Funding pallet. use assert_matches2::assert_matches; +use defaults::*; use frame_support::{ - assert_noop, assert_ok, + assert_err, assert_noop, assert_ok, traits::{ fungible::{Inspect as FungibleInspect, InspectHold as FungibleInspectHold}, Get, @@ -27,14 +28,12 @@ use frame_support::{ }; use itertools::Itertools; use parachains_common::DAYS; +use polimec_common::ReleaseSchedule; use sp_arithmetic::{traits::Zero, Percent, Perquintill}; use sp_runtime::BuildStorage; use sp_std::{cell::RefCell, marker::PhantomData}; use std::{cmp::min, iter::zip}; -use defaults::*; -use polimec_common::ReleaseSchedule; - use super::*; use crate::{ instantiator::*, @@ -298,6 +297,7 @@ mod creation_round_success { for _ in 0..512 { let project = default_project(inst.get_new_nonce(), issuer); inst.create_evaluating_project(project, issuer); + inst.advance_time(1u64).unwrap(); } } @@ -694,6 +694,42 @@ mod evaluation_round_failure { HoldReason::FutureDeposit(project_id).into(), ); } + + #[test] + fn cannot_evaluate_more_than_project_limit() { + let mut inst = MockInstantiator::new(Some(RefCell::new(new_test_ext()))); + let project_metadata = default_project(0, ISSUER); + let evaluations = (0u32..::MaxEvaluationsPerProject::get()) + .map(|i| UserToUSDBalance::::new(i as u64 + 420u64, (10u128 * ASSET_UNIT).into())) + .collect_vec(); + let failing_evaluation = UserToUSDBalance::new(EVALUATOR_1, 1000 * ASSET_UNIT); + + let project_id = inst.create_evaluating_project(project_metadata.clone(), ISSUER); + + let plmc_for_evaluating = MockInstantiator::calculate_evaluation_plmc_spent(evaluations.clone()); + let plmc_existential_deposits = evaluations.accounts().existential_deposits(); + let plmc_ct_account_deposits = evaluations.accounts().ct_account_deposits(); + + inst.mint_plmc_to(plmc_for_evaluating.clone()); + inst.mint_plmc_to(plmc_existential_deposits.clone()); + inst.mint_plmc_to(plmc_ct_account_deposits.clone()); + + inst.bond_for_users(project_id, evaluations.clone()).unwrap(); + + let plmc_for_failing_evaluating = + MockInstantiator::calculate_evaluation_plmc_spent(vec![failing_evaluation.clone()]); + let plmc_existential_deposits = plmc_for_failing_evaluating.accounts().existential_deposits(); + let plmc_ct_account_deposits = plmc_for_failing_evaluating.accounts().ct_account_deposits(); + + inst.mint_plmc_to(plmc_for_failing_evaluating.clone()); + inst.mint_plmc_to(plmc_existential_deposits.clone()); + inst.mint_plmc_to(plmc_ct_account_deposits.clone()); + + assert_err!( + inst.bond_for_users(project_id, vec![failing_evaluation]), + Error::::TooManyEvaluationsForProject + ); + } } mod auction_round_success { @@ -758,7 +794,7 @@ mod auction_round_success { )]); inst.mint_foreign_asset_to(necessary_usdt_for_bid); - inst.bid_for_users(project_id, vec![evaluator_bid]); + inst.bid_for_users(project_id, vec![evaluator_bid]).unwrap(); } #[test] @@ -782,7 +818,7 @@ mod auction_round_success { inst.mint_plmc_to(plmc_funding); inst.mint_foreign_asset_to(foreign_funding); - inst.bid_for_users(project_id, bids); + inst.bid_for_users(project_id, bids).unwrap(); inst.start_community_funding(project_id).unwrap(); } @@ -849,7 +885,7 @@ mod auction_round_success { BidParams::new(DAMIAN, 5_000 * ASSET_UNIT, 1.into(), 1u8, AcceptedFundingAsset::USDT), ]; - inst.bid_for_users(project_id, bids); + inst.bid_for_users(project_id, bids).unwrap(); inst.start_community_funding(project_id).unwrap(); @@ -923,7 +959,7 @@ mod auction_round_success { multiplier: bid_info.multiplier, asset: bid_info.asset, }]; - inst.bid_for_users(project_id, bids.clone()); + inst.bid_for_users(project_id, bids.clone()).unwrap(); bids_made.push(bids[0].clone()); bidding_account += 1; @@ -1403,7 +1439,7 @@ mod auction_round_success { let bidders_funding_assets = MockInstantiator::calculate_auction_funding_asset_spent(&bids, None); inst.mint_foreign_asset_to(bidders_funding_assets); - inst.bid_for_users(project_id, bids); + inst.bid_for_users(project_id, bids).unwrap(); inst.start_community_funding(project_id).unwrap(); let final_price = inst.get_project_details(project_id).weighted_average_price.unwrap(); @@ -1808,6 +1844,52 @@ mod auction_round_failure { }); } + #[test] + pub fn cannot_bid_more_than_project_limit_count() { + let mut inst = MockInstantiator::new(Some(RefCell::new(new_test_ext()))); + let project_metadata = default_project(0, ISSUER); + let bids = (0u32..::MaxBidsPerProject::get()) + .map(|i| { + BidParams::::new( + i as u64 + 420u64, + 10 * ASSET_UNIT, + 1_u128.into(), + 1u8, + AcceptedFundingAsset::USDT, + ) + }) + .collect_vec(); + let failing_bid = + BidParams::::new(BIDDER_1, 10 * ASSET_UNIT, 1_u128.into(), 1u8, AcceptedFundingAsset::USDT); + + let project_id = inst.create_auctioning_project(project_metadata.clone(), ISSUER, default_evaluations()); + + let plmc_for_bidding = MockInstantiator::calculate_auction_plmc_spent(&bids.clone(), None); + let plmc_existential_deposits = bids.accounts().existential_deposits(); + let plmc_ct_account_deposits = bids.accounts().ct_account_deposits(); + let usdt_for_bidding = MockInstantiator::calculate_auction_funding_asset_spent(&bids.clone(), None); + + inst.mint_plmc_to(plmc_for_bidding.clone()); + inst.mint_plmc_to(plmc_existential_deposits.clone()); + inst.mint_plmc_to(plmc_ct_account_deposits.clone()); + inst.mint_foreign_asset_to(usdt_for_bidding.clone()); + + inst.bid_for_users(project_id, bids.clone()).unwrap(); + + let plmc_for_failing_bid = MockInstantiator::calculate_auction_plmc_spent(&vec![failing_bid.clone()], None); + let plmc_existential_deposits = plmc_for_failing_bid.accounts().existential_deposits(); + let plmc_ct_account_deposits = plmc_for_failing_bid.accounts().ct_account_deposits(); + let usdt_for_bidding = + MockInstantiator::calculate_auction_funding_asset_spent(&vec![failing_bid.clone()], None); + + inst.mint_plmc_to(plmc_for_failing_bid.clone()); + inst.mint_plmc_to(plmc_existential_deposits.clone()); + inst.mint_plmc_to(plmc_ct_account_deposits.clone()); + inst.mint_foreign_asset_to(usdt_for_bidding.clone()); + + assert_err!(inst.bid_for_users(project_id, vec![failing_bid]), Error::::TooManyBidsForProject); + } + #[test] fn contribute_does_not_work() { let mut inst = MockInstantiator::new(Some(RefCell::new(new_test_ext()))); @@ -1899,7 +1981,7 @@ mod auction_round_failure { inst.mint_plmc_to(plmc_ct_account_deposits.clone()); inst.mint_foreign_asset_to(usdt_fundings.clone()); - inst.bid_for_users(project_id, vec![glutton_bid_1, rejected_bid, glutton_bid_2]); + inst.bid_for_users(project_id, vec![glutton_bid_1, rejected_bid, glutton_bid_2]).unwrap(); inst.do_free_plmc_assertions(vec![ UserToPLMCBalance::new(BIDDER_1, MockInstantiator::get_ed()), @@ -1987,7 +2069,7 @@ mod auction_round_failure { inst.mint_plmc_to(plmc_ct_account_deposits.clone()); inst.mint_foreign_asset_to(usdt_fundings.clone()); - inst.bid_for_users(project_id, vec![bid_in]); + inst.bid_for_users(project_id, vec![bid_in]).unwrap(); inst.advance_time( ::EnglishAuctionDuration::get() + ::CandleAuctionDuration::get() - @@ -1995,7 +2077,7 @@ mod auction_round_failure { ) .unwrap(); - inst.bid_for_users(project_id, vec![bid_out]); + inst.bid_for_users(project_id, vec![bid_out]).unwrap(); inst.do_free_plmc_assertions(vec![ UserToPLMCBalance::new(BIDDER_1, MockInstantiator::get_ed()), @@ -5837,157 +5919,7 @@ mod misc_features { mod async_tests { use super::*; - use core::sync::atomic::Ordering; - use futures::FutureExt; use instantiator::async_features::*; - use sp_std::sync::Arc; - use tokio::{runtime::Runtime, sync::Mutex}; - - #[test] - fn prototype_1() { - let tokio_runtime = Runtime::new().unwrap(); - let inst = MockInstantiator::new(Some(RefCell::new(new_test_ext()))); - - let _inst = tokio_runtime.block_on(async { - let block_orchestrator = Arc::new(BlockOrchestrator::new()); - let mutex_inst = Arc::new(Mutex::new(inst)); - - let controller_handle = tokio::spawn(block_controller(block_orchestrator.clone(), mutex_inst.clone())); - - let project_creations = vec![ - async_create_new_project(mutex_inst.clone(), default_project(0, ISSUER), ISSUER).boxed(), - async_create_evaluating_project(mutex_inst.clone(), default_project(1, ISSUER), ISSUER).boxed(), - async_create_auctioning_project( - mutex_inst.clone(), - block_orchestrator.clone(), - default_project(2, ISSUER), - ISSUER, - default_evaluations(), - ) - .boxed(), - async_create_community_contributing_project( - mutex_inst.clone(), - block_orchestrator.clone(), - default_project(3, ISSUER), - ISSUER, - default_evaluations(), - default_bids(), - ) - .map(|(project_id, _)| project_id) - .boxed(), - async_create_community_contributing_project( - mutex_inst.clone(), - block_orchestrator.clone(), - default_project(4, ISSUER), - ISSUER, - default_evaluations(), - default_bids(), - ) - .map(|(project_id, _)| project_id) - .boxed(), - async_create_community_contributing_project( - mutex_inst.clone(), - block_orchestrator.clone(), - default_project(5, ISSUER), - ISSUER, - default_evaluations(), - default_bids(), - ) - .map(|(project_id, _)| project_id) - .boxed(), - async_create_remainder_contributing_project( - mutex_inst.clone(), - block_orchestrator.clone(), - default_project(6, ISSUER), - ISSUER, - default_evaluations(), - default_bids(), - default_community_buys(), - ) - .map(|(project_id, _)| project_id) - .boxed(), - async_create_remainder_contributing_project( - mutex_inst.clone(), - block_orchestrator.clone(), - default_project(7, ISSUER), - ISSUER, - default_evaluations(), - default_bids(), - default_community_buys(), - ) - .map(|(project_id, _)| project_id) - .boxed(), - async_create_remainder_contributing_project( - mutex_inst.clone(), - block_orchestrator.clone(), - default_project(8, ISSUER), - ISSUER, - default_evaluations(), - default_bids(), - default_community_buys(), - ) - .map(|(project_id, _)| project_id) - .boxed(), - async_create_finished_project( - mutex_inst.clone(), - block_orchestrator.clone(), - default_project(9, ISSUER), - ISSUER, - default_evaluations(), - default_bids(), - default_community_buys(), - default_remainder_buys(), - ) - .boxed(), - async_create_finished_project( - mutex_inst.clone(), - block_orchestrator.clone(), - default_project(10, ISSUER), - ISSUER, - default_evaluations(), - default_bids(), - default_community_buys(), - default_remainder_buys(), - ) - .boxed(), - async_create_finished_project( - mutex_inst.clone(), - block_orchestrator.clone(), - default_project(11, ISSUER), - ISSUER, - default_evaluations(), - default_bids(), - default_community_buys(), - default_remainder_buys(), - ) - .boxed(), - ]; - // Wait for all project creation tasks to complete - futures::future::join_all(project_creations).await; - - // Now that all projects have been set up, signal the block_controller to stop - block_orchestrator.should_continue.store(false, Ordering::SeqCst); - - // Wait for the block controller to finish - controller_handle.await.unwrap(); - - let mut inst = mutex_inst.lock().await; - let events = inst.execute(|| frame_system::Pallet::::events()); - dbg!(events); - dbg!(inst.get_project_details(0).status); - dbg!(inst.get_project_details(1).status); - dbg!(inst.get_project_details(2).status); - dbg!(inst.get_project_details(3).status); - dbg!(inst.get_project_details(4).status); - dbg!(inst.get_project_details(5).status); - dbg!(inst.get_project_details(6).status); - dbg!(inst.get_project_details(7).status); - dbg!(inst.get_project_details(8).status); - dbg!(inst.get_project_details(9).status); - dbg!(inst.get_project_details(10).status); - dbg!(inst.get_project_details(11).status); - }); - } #[test] fn prototype_2() { diff --git a/pallets/funding/src/types.rs b/pallets/funding/src/types.rs index a890cf59e..f760fbbb9 100644 --- a/pallets/funding/src/types.rs +++ b/pallets/funding/src/types.rs @@ -194,7 +194,7 @@ pub mod storage_types { // TODO: PLMC-162. Perform a REAL validity check pub fn validity_check(&self) -> Result<(), ValidityError> { if self.minimum_price == Price::zero() { - return Err(ValidityError::PriceTooLow) + return Err(ValidityError::PriceTooLow); } self.ticket_size.is_valid()?; self.participants_size.is_valid()?; @@ -411,10 +411,10 @@ pub mod inner_types { impl TicketSize { pub(crate) fn is_valid(&self) -> Result<(), ValidityError> { if self.minimum.is_some() && self.maximum.is_some() { - return if self.minimum < self.maximum { Ok(()) } else { Err(ValidityError::TicketSizeError) } + return if self.minimum < self.maximum { Ok(()) } else { Err(ValidityError::TicketSizeError) }; } if self.minimum.is_some() || self.maximum.is_some() { - return Ok(()) + return Ok(()); } Err(ValidityError::TicketSizeError) @@ -771,7 +771,7 @@ pub struct MigrationGenerator(PhantomData); impl MigrationGenerator { pub fn evaluation_migration(evaluation: EvaluationInfoOf) -> Option { if matches!(evaluation.ct_migration_status, MigrationStatus::Confirmed | MigrationStatus::Sent(_)) { - return None + return None; } if let Some(RewardOrSlash::Reward(ct_amount)) = evaluation.rewarded_or_slashed { let multiplier = MultiplierOf::::try_from(1u8).ok()?; @@ -793,7 +793,7 @@ impl MigrationGenerator { if bid.final_ct_amount == Zero::zero() || matches!(bid.ct_migration_status, MigrationStatus::Confirmed | MigrationStatus::Sent(_)) { - return None + return None; } let vesting_duration = bid.multiplier.calculate_vesting_duration::(); let vesting_duration_local_type = ::BlockNumber::from(vesting_duration); @@ -808,7 +808,7 @@ impl MigrationGenerator { pub fn contribution_migration(contribution: ContributionInfoOf) -> Option { if matches!(contribution.ct_migration_status, MigrationStatus::Confirmed | MigrationStatus::Sent(_)) { - return None + return None; } let vesting_duration = contribution.multiplier.calculate_vesting_duration::(); let vesting_duration_local_type = ::BlockNumber::from(vesting_duration); diff --git a/pallets/funding/src/weights.rs b/pallets/funding/src/weights.rs index c7fa8edc2..78226edc1 100644 --- a/pallets/funding/src/weights.rs +++ b/pallets/funding/src/weights.rs @@ -20,7 +20,7 @@ //! Autogenerated weights for `pallet_funding` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2024-02-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-02-09, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `Juans-MBP.home`, CPU: `` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("polimec-rococo-local")`, DB CACHE: `1024` @@ -53,12 +53,11 @@ pub trait WeightInfo { fn edit_metadata() -> Weight; fn start_evaluation(x: u32, ) -> Weight; fn start_auction_manually(x: u32, y: u32, ) -> Weight; - fn start_auction_automatically(x: u32, ) -> Weight; fn first_evaluation() -> Weight; fn second_to_limit_evaluation(x: u32, ) -> Weight; fn evaluation_over_limit() -> Weight; - fn bid_with_ct_deposit(y: u32, ) -> Weight; fn bid_no_ct_deposit(x: u32, y: u32, ) -> Weight; + fn bid_with_ct_deposit(y: u32, ) -> Weight; fn first_contribution_with_ct_deposit() -> Weight; fn first_contribution_no_ct_deposit() -> Weight; fn first_contribution_ends_round_with_ct_deposit(y: u32, z: u32, ) -> Weight; @@ -83,6 +82,21 @@ pub trait WeightInfo { fn release_contribution_funds_for() -> Weight; fn bid_unbond_for() -> Weight; fn contribution_unbond_for() -> Weight; + fn end_evaluation_success(x: u32, ) -> Weight; + fn end_evaluation_failure() -> Weight; + fn start_auction_automatically(x: u32, ) -> Weight; + fn start_candle_phase(x: u32, ) -> Weight; + fn start_community_funding_success(x: u32, y: u32, z: u32, ) -> Weight; + fn start_community_funding_failure(x: u32, ) -> Weight; + fn start_remainder_funding(x: u32, ) -> Weight; + fn end_funding_automatically_rejected_evaluators_slashed(x: u32, ) -> Weight; + fn end_funding_awaiting_decision_evaluators_slashed(x: u32, ) -> Weight; + fn end_funding_awaiting_decision_evaluators_unchanged(x: u32, ) -> Weight; + fn end_funding_automatically_accepted_evaluators_rewarded(x: u32, y: u32, ) -> Weight; + fn project_decision_accept_funding() -> Weight; + fn project_decision_reject_funding() -> Weight; + fn start_settlement_funding_success() -> Weight; + fn start_settlement_funding_failure() -> Weight; } /// Weights for `pallet_funding` using the Substrate node and recommended hardware. @@ -104,8 +118,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `161` // Estimated: `3593` - // Minimum execution time: 60_000_000 picoseconds. - Weight::from_parts(62_000_000, 3593) + // Minimum execution time: 92_000_000 picoseconds. + Weight::from_parts(94_000_000, 3593) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -129,60 +143,42 @@ impl WeightInfo for SubstrateWeight { /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 99]`. fn start_evaluation(x: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `563 + x * (529 ±0)` - // Estimated: `4087 + x * (3097 ±0)` - // Minimum execution time: 22_000_000 picoseconds. - Weight::from_parts(19_253_978, 4087) - // Standard Error: 15_066 - .saturating_add(Weight::from_parts(2_633_080, 0).saturating_mul(x.into())) + // Measured: `562 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 23_000_000 picoseconds. + Weight::from_parts(21_490_523, 3814) + // Standard Error: 5_416 + .saturating_add(Weight::from_parts(2_287_829, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 3097).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::ProjectsToUpdate` (r:4558 w:2) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 99]`. /// The range of component `y` is `[1, 10000]`. fn start_auction_manually(x: u32, y: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + x * (1281 ±0) + y * (21 ±0)` - // Estimated: `268395 + x * (9966 ±8_383) + y * (1212 ±82)` - // Minimum execution time: 397_000_000 picoseconds. - Weight::from_parts(420_000_000, 268395) - // Standard Error: 4_704_303 - .saturating_add(Weight::from_parts(12_350_427, 0).saturating_mul(x.into())) - // Standard Error: 46_630 - .saturating_add(Weight::from_parts(1_402_043, 0).saturating_mul(y.into())) + // Measured: `0 + x * (539 ±0) + y * (13 ±0)` + // Estimated: `217021 + x * (8051 ±6_772) + y * (979 ±66)` + // Minimum execution time: 321_000_000 picoseconds. + Weight::from_parts(325_000_000, 217021) + // Standard Error: 3_856_088 + .saturating_add(Weight::from_parts(10_425_661, 0).saturating_mul(x.into())) + // Standard Error: 38_223 + .saturating_add(Weight::from_parts(1_158_523, 0).saturating_mul(y.into())) .saturating_add(T::DbWeight::get().reads(87_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 9966).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 1212).saturating_mul(y.into())) - } - /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) - /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) - /// The range of component `x` is `[1, 99]`. - fn start_auction_automatically(x: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `411 + x * (529 ±0)` - // Estimated: `4087 + x * (3097 ±0)` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(20_242_112, 4087) - // Standard Error: 18_140 - .saturating_add(Weight::from_parts(2_666_357, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) - .saturating_add(T::DbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 3097).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 8051).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 979).saturating_mul(y.into())) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) @@ -192,59 +188,65 @@ impl WeightInfo for SubstrateWeight { /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) /// Storage: `Oracle::Values` (r:1 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::EvaluationCounts` (r:1 w:1) + /// Proof: `PolimecFunding::EvaluationCounts` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) /// Storage: `Balances::Holds` (r:1 w:1) /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn first_evaluation() -> Weight { // Proof Size summary in bytes: - // Measured: `676` + // Measured: `745` // Estimated: `4614` - // Minimum execution time: 92_000_000 picoseconds. - Weight::from_parts(94_000_000, 4614) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) + // Minimum execution time: 90_000_000 picoseconds. + Weight::from_parts(97_000_000, 4614) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::NextEvaluationId` (r:1 w:1) /// Proof: `PolimecFunding::NextEvaluationId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::Evaluations` (r:256 w:1) + /// Storage: `PolimecFunding::Evaluations` (r:16 w:1) /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) /// Storage: `Oracle::Values` (r:1 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::EvaluationCounts` (r:1 w:1) + /// Proof: `PolimecFunding::EvaluationCounts` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) /// Storage: `Balances::Holds` (r:1 w:1) /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) - /// The range of component `x` is `[1, 255]`. + /// The range of component `x` is `[1, 15]`. fn second_to_limit_evaluation(x: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `893 + x * (137 ±0)` + // Measured: `941 + x * (137 ±0)` // Estimated: `4614 + x * (2820 ±0)` - // Minimum execution time: 71_000_000 picoseconds. - Weight::from_parts(58_910_334, 4614) - // Standard Error: 11_575 - .saturating_add(Weight::from_parts(3_780_894, 0).saturating_mul(x.into())) - .saturating_add(T::DbWeight::get().reads(5_u64)) + // Minimum execution time: 70_000_000 picoseconds. + Weight::from_parts(73_938_801, 4614) + // Standard Error: 20_740 + .saturating_add(Weight::from_parts(3_615_461, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) - .saturating_add(T::DbWeight::get().writes(4_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) .saturating_add(Weight::from_parts(0, 2820).saturating_mul(x.into())) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::NextEvaluationId` (r:1 w:1) /// Proof: `PolimecFunding::NextEvaluationId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::Evaluations` (r:257 w:2) + /// Storage: `PolimecFunding::Evaluations` (r:17 w:2) /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) /// Storage: `Oracle::Values` (r:1 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::EvaluationCounts` (r:1 w:1) + /// Proof: `PolimecFunding::EvaluationCounts` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) /// Storage: `Balances::Holds` (r:1 w:1) /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn evaluation_over_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `36120` - // Estimated: `725730` - // Minimum execution time: 1_017_000_000 picoseconds. - Weight::from_parts(1_051_000_000, 725730) - .saturating_add(T::DbWeight::get().reads(261_u64)) - .saturating_add(T::DbWeight::get().writes(5_u64)) + // Measured: `3148` + // Estimated: `48930` + // Minimum execution time: 152_000_000 picoseconds. + Weight::from_parts(158_000_000, 48930) + .saturating_add(T::DbWeight::get().reads(22_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) @@ -252,8 +254,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) /// Storage: `Oracle::Values` (r:2 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::Bids` (r:1 w:10) + /// Storage: `PolimecFunding::Bids` (r:128 w:10) /// Proof: `PolimecFunding::Bids` (`max_values`: None, `max_size`: Some(418), added: 2893, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::BidCounts` (r:1 w:1) + /// Proof: `PolimecFunding::BidCounts` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) /// Storage: `Balances::Holds` (r:1 w:1) /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::Buckets` (r:1 w:1) @@ -266,20 +270,23 @@ impl WeightInfo for SubstrateWeight { /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `StatemintAssets::Account` (r:2 w:2) /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `x` is `[0, 127]`. /// The range of component `y` is `[0, 10]`. - fn bid_with_ct_deposit(y: u32, ) -> Weight { + fn bid_no_ct_deposit(x: u32, y: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2140` - // Estimated: `6208` - // Minimum execution time: 143_000_000 picoseconds. - Weight::from_parts(106_855_955, 6208) - // Standard Error: 319_819 - .saturating_add(Weight::from_parts(70_108_416, 0).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(12_u64)) + // Measured: `2278 + x * (164 ±0)` + // Estimated: `6208 + x * (2893 ±0)` + // Minimum execution time: 539_000_000 picoseconds. + Weight::from_parts(84_439_405, 6208) + // Standard Error: 20_670 + .saturating_add(Weight::from_parts(3_779_627, 0).saturating_mul(x.into())) + // Standard Error: 250_512 + .saturating_add(Weight::from_parts(73_255_675, 0).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(13_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().writes(7_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(y.into()))) + .saturating_add(Weight::from_parts(0, 2893).saturating_mul(x.into())) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) @@ -287,8 +294,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) /// Storage: `Oracle::Values` (r:2 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::Bids` (r:256 w:10) + /// Storage: `PolimecFunding::Bids` (r:1 w:10) /// Proof: `PolimecFunding::Bids` (`max_values`: None, `max_size`: Some(418), added: 2893, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::BidCounts` (r:1 w:1) + /// Proof: `PolimecFunding::BidCounts` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) /// Storage: `Balances::Holds` (r:1 w:1) /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::Buckets` (r:1 w:1) @@ -301,23 +310,20 @@ impl WeightInfo for SubstrateWeight { /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `StatemintAssets::Account` (r:2 w:2) /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 255]`. + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// The range of component `y` is `[0, 10]`. - fn bid_no_ct_deposit(x: u32, y: u32, ) -> Weight { + fn bid_with_ct_deposit(y: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2227 + x * (164 ±0)` - // Estimated: `6208 + x * (2893 ±0)` - // Minimum execution time: 760_000_000 picoseconds. - Weight::from_parts(69_652_890, 6208) - // Standard Error: 11_684 - .saturating_add(Weight::from_parts(4_020_612, 0).saturating_mul(x.into())) - // Standard Error: 283_589 - .saturating_add(Weight::from_parts(72_460_034, 0).saturating_mul(y.into())) - .saturating_add(T::DbWeight::get().reads(12_u64)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) - .saturating_add(T::DbWeight::get().writes(6_u64)) + // Measured: `2184` + // Estimated: `6208` + // Minimum execution time: 143_000_000 picoseconds. + Weight::from_parts(110_639_424, 6208) + // Standard Error: 314_196 + .saturating_add(Weight::from_parts(70_855_879, 0).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(13_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(y.into()))) - .saturating_add(Weight::from_parts(0, 2893).saturating_mul(x.into())) } /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) @@ -339,10 +345,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn first_contribution_with_ct_deposit() -> Weight { // Proof Size summary in bytes: - // Measured: `1996` + // Measured: `2029` // Estimated: `6208` - // Minimum execution time: 147_000_000 picoseconds. - Weight::from_parts(155_000_000, 6208) + // Minimum execution time: 146_000_000 picoseconds. + Weight::from_parts(151_000_000, 6208) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -366,10 +372,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn first_contribution_no_ct_deposit() -> Weight { // Proof Size summary in bytes: - // Measured: `2073` + // Measured: `2106` // Estimated: `6208` - // Minimum execution time: 119_000_000 picoseconds. - Weight::from_parts(126_000_000, 6208) + // Minimum execution time: 118_000_000 picoseconds. + Weight::from_parts(120_000_000, 6208) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(7_u64)) } @@ -391,25 +397,25 @@ impl WeightInfo for SubstrateWeight { /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `StatemintAssets::Account` (r:2 w:2) /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9832 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9833 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `y` is `[1, 99]`. /// The range of component `z` is `[1, 10000]`. fn first_contribution_ends_round_with_ct_deposit(y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + y * (443 ±0) + z * (37 ±0)` - // Estimated: `78415 + y * (14240 ±4_378) + z * (1371 ±43)` - // Minimum execution time: 264_000_000 picoseconds. - Weight::from_parts(268_000_000, 78415) - // Standard Error: 5_143_014 - .saturating_add(Weight::from_parts(16_318_492, 0).saturating_mul(y.into())) - // Standard Error: 50_979 - .saturating_add(Weight::from_parts(1_601_983, 0).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(36_u64)) + // Measured: `0 + y * (140 ±0) + z * (20 ±0)` + // Estimated: `66042 + y * (11508 ±3_537) + z * (1108 ±35)` + // Minimum execution time: 232_000_000 picoseconds. + Weight::from_parts(246_000_000, 66042) + // Standard Error: 4_200_086 + .saturating_add(Weight::from_parts(12_470_526, 0).saturating_mul(y.into())) + // Standard Error: 41_632 + .saturating_add(Weight::from_parts(1_318_329, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(37_u64)) .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(y.into()))) .saturating_add(T::DbWeight::get().writes(8_u64)) - .saturating_add(Weight::from_parts(0, 14240).saturating_mul(y.into())) - .saturating_add(Weight::from_parts(0, 1371).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(0, 11508).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 1108).saturating_mul(z.into())) } /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) @@ -429,25 +435,25 @@ impl WeightInfo for SubstrateWeight { /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `StatemintAssets::Account` (r:2 w:2) /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9832 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9833 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `y` is `[1, 99]`. /// The range of component `z` is `[1, 10000]`. fn first_contribution_ends_round_no_ct_deposit(y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + y * (443 ±0) + z * (37 ±0)` - // Estimated: `78415 + y * (14240 ±4_378) + z * (1371 ±43)` - // Minimum execution time: 226_000_000 picoseconds. - Weight::from_parts(239_000_000, 78415) - // Standard Error: 5_135_841 - .saturating_add(Weight::from_parts(15_722_813, 0).saturating_mul(y.into())) - // Standard Error: 50_908 - .saturating_add(Weight::from_parts(1_606_667, 0).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(36_u64)) + // Measured: `0 + y * (140 ±0) + z * (20 ±0)` + // Estimated: `66042 + y * (11508 ±3_537) + z * (1108 ±35)` + // Minimum execution time: 212_000_000 picoseconds. + Weight::from_parts(223_000_000, 66042) + // Standard Error: 4_200_933 + .saturating_add(Weight::from_parts(12_638_804, 0).saturating_mul(y.into())) + // Standard Error: 41_641 + .saturating_add(Weight::from_parts(1_313_036, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(37_u64)) .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(y.into()))) .saturating_add(T::DbWeight::get().writes(8_u64)) - .saturating_add(Weight::from_parts(0, 14240).saturating_mul(y.into())) - .saturating_add(Weight::from_parts(0, 1371).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(0, 11508).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 1108).saturating_mul(z.into())) } /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) @@ -470,12 +476,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `x` is `[1, 255]`. fn second_to_limit_contribution(x: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2213 + x * (137 ±0)` + // Measured: `2246 + x * (137 ±0)` // Estimated: `6208 + x * (2839 ±0)` // Minimum execution time: 124_000_000 picoseconds. - Weight::from_parts(117_868_102, 6208) - // Standard Error: 10_026 - .saturating_add(Weight::from_parts(3_746_658, 0).saturating_mul(x.into())) + Weight::from_parts(128_568_935, 6208) + // Standard Error: 11_772 + .saturating_add(Weight::from_parts(3_704_148, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().writes(7_u64)) @@ -499,28 +505,28 @@ impl WeightInfo for SubstrateWeight { /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `StatemintAssets::Account` (r:2 w:2) /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9832 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9833 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 255]`. /// The range of component `y` is `[1, 99]`. /// The range of component `z` is `[1, 10000]`. fn second_to_limit_contribution_ends_round(x: u32, y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `75282 + x * (137 ±0) + y * (723 ±0) + z * (39 ±0)` - // Estimated: `17232 + x * (2839 ±0) + y * (115061 ±7_565) + z * (2358 ±74)` - // Minimum execution time: 1_097_000_000 picoseconds. - Weight::from_parts(554_228_738, 17232) - // Standard Error: 8_861_727 - .saturating_add(Weight::from_parts(133_771_367, 0).saturating_mul(y.into())) - // Standard Error: 86_849 - .saturating_add(Weight::from_parts(2_763_795, 0).saturating_mul(z.into())) - .saturating_add(T::DbWeight::get().reads(16_u64)) + // Measured: `44564 + x * (137 ±0) + y * (254 ±0) + z * (21 ±0)` + // Estimated: `15401 + x * (2839 ±0) + y * (92965 ±6_111) + z * (1905 ±59)` + // Minimum execution time: 1_120_000_000 picoseconds. + Weight::from_parts(55_806_166, 15401) + // Standard Error: 7_331_488 + .saturating_add(Weight::from_parts(111_668_126, 0).saturating_mul(y.into())) + // Standard Error: 71_852 + .saturating_add(Weight::from_parts(2_292_683, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().reads((37_u64).saturating_mul(y.into()))) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(z.into()))) .saturating_add(T::DbWeight::get().writes(8_u64)) .saturating_add(Weight::from_parts(0, 2839).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 115061).saturating_mul(y.into())) - .saturating_add(Weight::from_parts(0, 2358).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(0, 92965).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 1905).saturating_mul(z.into())) } /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) @@ -542,10 +548,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) fn contribution_over_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `37440` + // Measured: `37473` // Estimated: `730613` - // Minimum execution time: 1_103_000_000 picoseconds. - Weight::from_parts(1_165_000_000, 730613) + // Minimum execution time: 1_082_000_000 picoseconds. + Weight::from_parts(1_150_000_000, 730613) .saturating_add(T::DbWeight::get().reads(267_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -557,10 +563,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn evaluation_unbond_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1411` + // Measured: `1477` // Estimated: `4614` - // Minimum execution time: 55_000_000 picoseconds. - Weight::from_parts(60_000_000, 4614) + // Minimum execution time: 54_000_000 picoseconds. + Weight::from_parts(57_000_000, 4614) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -576,10 +582,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `LocalAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn evaluation_reward_payout_for_with_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1515` + // Measured: `1654` // Estimated: `4614` - // Minimum execution time: 92_000_000 picoseconds. - Weight::from_parts(102_000_000, 4614) + // Minimum execution time: 94_000_000 picoseconds. + Weight::from_parts(98_000_000, 4614) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -593,10 +599,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `LocalAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn evaluation_reward_payout_for_no_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1219` + // Measured: `1322` // Estimated: `3814` // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(49_000_000, 3814) + Weight::from_parts(50_000_000, 3814) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -610,10 +616,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn evaluation_slash_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1419` + // Measured: `1485` // Estimated: `4614` - // Minimum execution time: 68_000_000 picoseconds. - Weight::from_parts(71_000_000, 4614) + // Minimum execution time: 67_000_000 picoseconds. + Weight::from_parts(69_000_000, 4614) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -629,10 +635,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn bid_ct_mint_for_with_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1629` + // Measured: `1735` // Estimated: `4614` - // Minimum execution time: 96_000_000 picoseconds. - Weight::from_parts(99_000_000, 4614) + // Minimum execution time: 99_000_000 picoseconds. + Weight::from_parts(103_000_000, 4614) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -646,10 +652,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `LocalAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn bid_ct_mint_for_no_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1180` + // Measured: `1250` // Estimated: `3883` - // Minimum execution time: 44_000_000 picoseconds. - Weight::from_parts(47_000_000, 3883) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(50_000_000, 3883) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -665,10 +671,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn contribution_ct_mint_for_with_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1545` + // Measured: `1651` // Estimated: `4614` - // Minimum execution time: 91_000_000 picoseconds. - Weight::from_parts(98_000_000, 4614) + // Minimum execution time: 94_000_000 picoseconds. + Weight::from_parts(100_000_000, 4614) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -682,9 +688,9 @@ impl WeightInfo for SubstrateWeight { /// Proof: `LocalAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn contribution_ct_mint_for_no_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1217` + // Measured: `1287` // Estimated: `3829` - // Minimum execution time: 46_000_000 picoseconds. + // Minimum execution time: 47_000_000 picoseconds. Weight::from_parts(50_000_000, 3829) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) @@ -697,10 +703,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `LinearRelease::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`) fn start_bid_vesting_schedule_for() -> Weight { // Proof Size summary in bytes: - // Measured: `818` - // Estimated: `4283` + // Measured: `851` + // Estimated: `4316` // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(31_000_000, 4283) + Weight::from_parts(31_000_000, 4316) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -712,10 +718,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `LinearRelease::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`) fn start_contribution_vesting_schedule_for() -> Weight { // Proof Size summary in bytes: - // Measured: `847` - // Estimated: `4312` + // Measured: `880` + // Estimated: `4345` // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(32_000_000, 4312) + Weight::from_parts(31_000_000, 4345) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -731,10 +737,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn payout_bid_funds_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1372` + // Measured: `1405` // Estimated: `6208` - // Minimum execution time: 64_000_000 picoseconds. - Weight::from_parts(69_000_000, 6208) + // Minimum execution time: 67_000_000 picoseconds. + Weight::from_parts(68_000_000, 6208) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } @@ -750,34 +756,34 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn payout_contribution_funds_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1401` + // Measured: `1434` // Estimated: `6208` - // Minimum execution time: 69_000_000 picoseconds. - Weight::from_parts(77_000_000, 6208) + // Minimum execution time: 66_000_000 picoseconds. + Weight::from_parts(69_000_000, 6208) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(5_u64)) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::ProjectsToUpdate` (r:2980 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 99]`. /// The range of component `y` is `[1, 10000]`. fn decide_project_outcome(x: u32, y: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `10254 + x * (419 ±0) + y * (20 ±0)` - // Estimated: `35057 + x * (4876 ±4_177) + y * (1437 ±41)` - // Minimum execution time: 64_000_000 picoseconds. - Weight::from_parts(68_000_000, 35057) - // Standard Error: 4_809_624 - .saturating_add(Weight::from_parts(5_610_465, 0).saturating_mul(x.into())) - // Standard Error: 47_674 - .saturating_add(Weight::from_parts(1_647_468, 0).saturating_mul(y.into())) + // Measured: `4454 + x * (93 ±0) + y * (11 ±0)` + // Estimated: `28512 + x * (3946 ±3_374) + y * (1161 ±33)` + // Minimum execution time: 58_000_000 picoseconds. + Weight::from_parts(59_000_000, 28512) + // Standard Error: 3_928_236 + .saturating_add(Weight::from_parts(3_329_337, 0).saturating_mul(x.into())) + // Standard Error: 38_938 + .saturating_add(Weight::from_parts(1_351_270, 0).saturating_mul(y.into())) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 4876).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 1437).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 3946).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 1161).saturating_mul(y.into())) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) @@ -789,10 +795,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn release_bid_funds_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1481` + // Measured: `1514` // Estimated: `6208` - // Minimum execution time: 64_000_000 picoseconds. - Weight::from_parts(71_000_000, 6208) + // Minimum execution time: 65_000_000 picoseconds. + Weight::from_parts(70_000_000, 6208) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -806,10 +812,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn release_contribution_funds_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1474` + // Measured: `1507` // Estimated: `6208` - // Minimum execution time: 64_000_000 picoseconds. - Weight::from_parts(70_000_000, 6208) + // Minimum execution time: 63_000_000 picoseconds. + Weight::from_parts(69_000_000, 6208) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -821,10 +827,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn bid_unbond_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1486` + // Measured: `1519` // Estimated: `4614` - // Minimum execution time: 52_000_000 picoseconds. - Weight::from_parts(57_000_000, 4614) + // Minimum execution time: 54_000_000 picoseconds. + Weight::from_parts(56_000_000, 4614) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -836,13 +842,325 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn contribution_unbond_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1441` + // Measured: `1474` // Estimated: `4614` - // Minimum execution time: 52_000_000 picoseconds. + // Minimum execution time: 54_000_000 picoseconds. Weight::from_parts(57_000_000, 4614) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `Oracle::Values` (r:1 w:0) + /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Evaluations` (r:4 w:0) + /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:99 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn end_evaluation_success(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1174 + x * (29 ±0)` + // Estimated: `12270 + x * (2502 ±0)` + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(36_057_447, 12270) + // Standard Error: 5_687 + .saturating_add(Weight::from_parts(2_349_611, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `Oracle::Values` (r:1 w:0) + /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Evaluations` (r:4 w:0) + /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) + fn end_evaluation_failure() -> Weight { + // Proof Size summary in bytes: + // Measured: `1148` + // Estimated: `12270` + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(35_000_000, 12270) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:102 w:2) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn start_auction_automatically(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `413 + x * (29 ±0)` + // Estimated: `8496 + x * (2502 ±0)` + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(28_124_881, 8496) + // Standard Error: 5_442 + .saturating_add(Weight::from_parts(2_521_942, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn start_candle_phase(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `446 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_987_956, 3814) + // Standard Error: 5_995 + .saturating_add(Weight::from_parts(2_286_160, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Nonce` (r:1 w:1) + /// Proof: `PolimecFunding::Nonce` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Random::RandomMaterial` (r:1 w:0) + /// Proof: `Random::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Bids` (r:2049 w:2048) + /// Proof: `PolimecFunding::Bids` (`max_values`: None, `max_size`: Some(418), added: 2893, mode: `MaxEncodedLen`) + /// Storage: `Oracle::Values` (r:1 w:0) + /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `StatemintAssets::Asset` (r:1 w:1) + /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `StatemintAssets::Account` (r:1025 w:1025) + /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1024 w:1024) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1024 w:1024) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Buckets` (r:1 w:0) + /// Proof: `PolimecFunding::Buckets` (`max_values`: None, `max_size`: Some(100), added: 2575, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + /// The range of component `y` is `[1, 1024]`. + /// The range of component `z` is `[0, 1024]`. + fn start_community_funding_success(x: u32, y: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `86802 + x * (29 ±0) + y * (167 ±0) + z * (367 ±0)` + // Estimated: `4079 + x * (2502 ±0) + y * (2893 ±0) + z * (3624 ±0)` + // Minimum execution time: 8_733_000_000 picoseconds. + Weight::from_parts(8_889_000_000, 4079) + // Standard Error: 235_341 + .saturating_add(Weight::from_parts(6_457_226, 0).saturating_mul(y.into())) + // Standard Error: 235_237 + .saturating_add(Weight::from_parts(70_277_060, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(10_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(z.into()))) + .saturating_add(T::DbWeight::get().writes(5_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(z.into()))) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2893).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 3624).saturating_mul(z.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Nonce` (r:1 w:1) + /// Proof: `PolimecFunding::Nonce` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Random::RandomMaterial` (r:1 w:0) + /// Proof: `Random::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Bids` (r:1 w:0) + /// Proof: `PolimecFunding::Bids` (`max_values`: None, `max_size`: Some(418), added: 2893, mode: `MaxEncodedLen`) + /// Storage: `Oracle::Values` (r:1 w:0) + /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Buckets` (r:1 w:0) + /// Proof: `PolimecFunding::Buckets` (`max_values`: None, `max_size`: Some(100), added: 2575, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn start_community_funding_failure(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1418 + x * (3 ±0)` + // Estimated: `4079` + // Minimum execution time: 87_000_000 picoseconds. + Weight::from_parts(97_589_188, 4079) + // Standard Error: 3_828 + .saturating_add(Weight::from_parts(26_576, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn start_remainder_funding(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `536 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(18_694_146, 3814) + // Standard Error: 5_669 + .saturating_add(Weight::from_parts(2_256_677, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn end_funding_automatically_rejected_evaluators_slashed(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `824 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(23_753_565, 3814) + // Standard Error: 4_976 + .saturating_add(Weight::from_parts(2_285_728, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn end_funding_awaiting_decision_evaluators_slashed(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `823 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_149_882, 3814) + // Standard Error: 4_893 + .saturating_add(Weight::from_parts(2_241_882, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn end_funding_awaiting_decision_evaluators_unchanged(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `823 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(18_735_663, 3814) + // Standard Error: 5_515 + .saturating_add(Weight::from_parts(2_252_806, 0).saturating_mul(x.into())) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Evaluations` (r:2048 w:0) + /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + /// The range of component `y` is `[1, 2048]`. + fn end_funding_automatically_accepted_evaluators_rewarded(x: u32, y: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1184 + x * (29 ±0) + y * (187 ±0)` + // Estimated: `3814 + x * (2502 ±0) + y * (2820 ±0)` + // Minimum execution time: 257_000_000 picoseconds. + Weight::from_parts(260_000_000, 3814) + // Standard Error: 52_986 + .saturating_add(Weight::from_parts(476_614, 0).saturating_mul(x.into())) + // Standard Error: 2_564 + .saturating_add(Weight::from_parts(4_091_225, 0).saturating_mul(y.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2820).saturating_mul(y.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:2 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + fn project_decision_accept_funding() -> Weight { + // Proof Size summary in bytes: + // Measured: `563` + // Estimated: `5994` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_000_000, 5994) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:2 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + fn project_decision_reject_funding() -> Weight { + // Proof Size summary in bytes: + // Measured: `563` + // Estimated: `5994` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_000_000, 5994) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `LocalAssets::Asset` (r:1 w:1) + /// Proof: `LocalAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `LocalAssets::Metadata` (r:1 w:1) + /// Proof: `LocalAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn start_settlement_funding_success() -> Weight { + // Proof Size summary in bytes: + // Measured: `970` + // Estimated: `3814` + // Minimum execution time: 41_000_000 picoseconds. + Weight::from_parts(43_000_000, 3814) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + fn start_settlement_funding_failure() -> Weight { + // Proof Size summary in bytes: + // Measured: `760` + // Estimated: `3814` + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(12_000_000, 3814) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } // For backwards compatibility and tests. @@ -863,8 +1181,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `161` // Estimated: `3593` - // Minimum execution time: 60_000_000 picoseconds. - Weight::from_parts(62_000_000, 3593) + // Minimum execution time: 92_000_000 picoseconds. + Weight::from_parts(94_000_000, 3593) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -888,60 +1206,42 @@ impl WeightInfo for () { /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 99]`. fn start_evaluation(x: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `563 + x * (529 ±0)` - // Estimated: `4087 + x * (3097 ±0)` - // Minimum execution time: 22_000_000 picoseconds. - Weight::from_parts(19_253_978, 4087) - // Standard Error: 15_066 - .saturating_add(Weight::from_parts(2_633_080, 0).saturating_mul(x.into())) + // Measured: `562 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 23_000_000 picoseconds. + Weight::from_parts(21_490_523, 3814) + // Standard Error: 5_416 + .saturating_add(Weight::from_parts(2_287_829, 0).saturating_mul(x.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 3097).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::ProjectsToUpdate` (r:4558 w:2) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 99]`. /// The range of component `y` is `[1, 10000]`. fn start_auction_manually(x: u32, y: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + x * (1281 ±0) + y * (21 ±0)` - // Estimated: `268395 + x * (9966 ±8_383) + y * (1212 ±82)` - // Minimum execution time: 397_000_000 picoseconds. - Weight::from_parts(420_000_000, 268395) - // Standard Error: 4_704_303 - .saturating_add(Weight::from_parts(12_350_427, 0).saturating_mul(x.into())) - // Standard Error: 46_630 - .saturating_add(Weight::from_parts(1_402_043, 0).saturating_mul(y.into())) + // Measured: `0 + x * (539 ±0) + y * (13 ±0)` + // Estimated: `217021 + x * (8051 ±6_772) + y * (979 ±66)` + // Minimum execution time: 321_000_000 picoseconds. + Weight::from_parts(325_000_000, 217021) + // Standard Error: 3_856_088 + .saturating_add(Weight::from_parts(10_425_661, 0).saturating_mul(x.into())) + // Standard Error: 38_223 + .saturating_add(Weight::from_parts(1_158_523, 0).saturating_mul(y.into())) .saturating_add(RocksDbWeight::get().reads(87_u64)) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(x.into()))) .saturating_add(RocksDbWeight::get().writes(3_u64)) - .saturating_add(Weight::from_parts(0, 9966).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 1212).saturating_mul(y.into())) - } - /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) - /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) - /// The range of component `x` is `[1, 99]`. - fn start_auction_automatically(x: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `411 + x * (529 ±0)` - // Estimated: `4087 + x * (3097 ±0)` - // Minimum execution time: 20_000_000 picoseconds. - Weight::from_parts(20_242_112, 4087) - // Standard Error: 18_140 - .saturating_add(Weight::from_parts(2_666_357, 0).saturating_mul(x.into())) - .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - .saturating_add(Weight::from_parts(0, 3097).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 8051).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 979).saturating_mul(y.into())) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) @@ -951,59 +1251,65 @@ impl WeightInfo for () { /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) /// Storage: `Oracle::Values` (r:1 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::EvaluationCounts` (r:1 w:1) + /// Proof: `PolimecFunding::EvaluationCounts` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) /// Storage: `Balances::Holds` (r:1 w:1) /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn first_evaluation() -> Weight { // Proof Size summary in bytes: - // Measured: `676` + // Measured: `745` // Estimated: `4614` - // Minimum execution time: 92_000_000 picoseconds. - Weight::from_parts(94_000_000, 4614) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) + // Minimum execution time: 90_000_000 picoseconds. + Weight::from_parts(97_000_000, 4614) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::NextEvaluationId` (r:1 w:1) /// Proof: `PolimecFunding::NextEvaluationId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::Evaluations` (r:256 w:1) + /// Storage: `PolimecFunding::Evaluations` (r:16 w:1) /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) /// Storage: `Oracle::Values` (r:1 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::EvaluationCounts` (r:1 w:1) + /// Proof: `PolimecFunding::EvaluationCounts` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) /// Storage: `Balances::Holds` (r:1 w:1) /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) - /// The range of component `x` is `[1, 255]`. + /// The range of component `x` is `[1, 15]`. fn second_to_limit_evaluation(x: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `893 + x * (137 ±0)` + // Measured: `941 + x * (137 ±0)` // Estimated: `4614 + x * (2820 ±0)` - // Minimum execution time: 71_000_000 picoseconds. - Weight::from_parts(58_910_334, 4614) - // Standard Error: 11_575 - .saturating_add(Weight::from_parts(3_780_894, 0).saturating_mul(x.into())) - .saturating_add(RocksDbWeight::get().reads(5_u64)) + // Minimum execution time: 70_000_000 picoseconds. + Weight::from_parts(73_938_801, 4614) + // Standard Error: 20_740 + .saturating_add(Weight::from_parts(3_615_461, 0).saturating_mul(x.into())) + .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) - .saturating_add(RocksDbWeight::get().writes(4_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) .saturating_add(Weight::from_parts(0, 2820).saturating_mul(x.into())) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::NextEvaluationId` (r:1 w:1) /// Proof: `PolimecFunding::NextEvaluationId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::Evaluations` (r:257 w:2) + /// Storage: `PolimecFunding::Evaluations` (r:17 w:2) /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) /// Storage: `Oracle::Values` (r:1 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::EvaluationCounts` (r:1 w:1) + /// Proof: `PolimecFunding::EvaluationCounts` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) /// Storage: `Balances::Holds` (r:1 w:1) /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn evaluation_over_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `36120` - // Estimated: `725730` - // Minimum execution time: 1_017_000_000 picoseconds. - Weight::from_parts(1_051_000_000, 725730) - .saturating_add(RocksDbWeight::get().reads(261_u64)) - .saturating_add(RocksDbWeight::get().writes(5_u64)) + // Measured: `3148` + // Estimated: `48930` + // Minimum execution time: 152_000_000 picoseconds. + Weight::from_parts(158_000_000, 48930) + .saturating_add(RocksDbWeight::get().reads(22_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) @@ -1011,8 +1317,10 @@ impl WeightInfo for () { /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) /// Storage: `Oracle::Values` (r:2 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::Bids` (r:1 w:10) + /// Storage: `PolimecFunding::Bids` (r:128 w:10) /// Proof: `PolimecFunding::Bids` (`max_values`: None, `max_size`: Some(418), added: 2893, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::BidCounts` (r:1 w:1) + /// Proof: `PolimecFunding::BidCounts` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) /// Storage: `Balances::Holds` (r:1 w:1) /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::Buckets` (r:1 w:1) @@ -1025,20 +1333,23 @@ impl WeightInfo for () { /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `StatemintAssets::Account` (r:2 w:2) /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `x` is `[0, 127]`. /// The range of component `y` is `[0, 10]`. - fn bid_with_ct_deposit(y: u32, ) -> Weight { + fn bid_no_ct_deposit(x: u32, y: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2140` - // Estimated: `6208` - // Minimum execution time: 143_000_000 picoseconds. - Weight::from_parts(106_855_955, 6208) - // Standard Error: 319_819 - .saturating_add(Weight::from_parts(70_108_416, 0).saturating_mul(y.into())) - .saturating_add(RocksDbWeight::get().reads(12_u64)) + // Measured: `2278 + x * (164 ±0)` + // Estimated: `6208 + x * (2893 ±0)` + // Minimum execution time: 539_000_000 picoseconds. + Weight::from_parts(84_439_405, 6208) + // Standard Error: 20_670 + .saturating_add(Weight::from_parts(3_779_627, 0).saturating_mul(x.into())) + // Standard Error: 250_512 + .saturating_add(Weight::from_parts(73_255_675, 0).saturating_mul(y.into())) + .saturating_add(RocksDbWeight::get().reads(13_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(RocksDbWeight::get().writes(7_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(y.into()))) + .saturating_add(Weight::from_parts(0, 2893).saturating_mul(x.into())) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) @@ -1046,8 +1357,10 @@ impl WeightInfo for () { /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) /// Storage: `Oracle::Values` (r:2 w:0) /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::Bids` (r:256 w:10) + /// Storage: `PolimecFunding::Bids` (r:1 w:10) /// Proof: `PolimecFunding::Bids` (`max_values`: None, `max_size`: Some(418), added: 2893, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::BidCounts` (r:1 w:1) + /// Proof: `PolimecFunding::BidCounts` (`max_values`: None, `max_size`: Some(24), added: 2499, mode: `MaxEncodedLen`) /// Storage: `Balances::Holds` (r:1 w:1) /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::Buckets` (r:1 w:1) @@ -1060,23 +1373,20 @@ impl WeightInfo for () { /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `StatemintAssets::Account` (r:2 w:2) /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - /// The range of component `x` is `[0, 255]`. + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// The range of component `y` is `[0, 10]`. - fn bid_no_ct_deposit(x: u32, y: u32, ) -> Weight { + fn bid_with_ct_deposit(y: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2227 + x * (164 ±0)` - // Estimated: `6208 + x * (2893 ±0)` - // Minimum execution time: 760_000_000 picoseconds. - Weight::from_parts(69_652_890, 6208) - // Standard Error: 11_684 - .saturating_add(Weight::from_parts(4_020_612, 0).saturating_mul(x.into())) - // Standard Error: 283_589 - .saturating_add(Weight::from_parts(72_460_034, 0).saturating_mul(y.into())) - .saturating_add(RocksDbWeight::get().reads(12_u64)) - .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) - .saturating_add(RocksDbWeight::get().writes(6_u64)) + // Measured: `2184` + // Estimated: `6208` + // Minimum execution time: 143_000_000 picoseconds. + Weight::from_parts(110_639_424, 6208) + // Standard Error: 314_196 + .saturating_add(Weight::from_parts(70_855_879, 0).saturating_mul(y.into())) + .saturating_add(RocksDbWeight::get().reads(13_u64)) + .saturating_add(RocksDbWeight::get().writes(8_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(y.into()))) - .saturating_add(Weight::from_parts(0, 2893).saturating_mul(x.into())) } /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) @@ -1098,10 +1408,10 @@ impl WeightInfo for () { /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn first_contribution_with_ct_deposit() -> Weight { // Proof Size summary in bytes: - // Measured: `1996` + // Measured: `2029` // Estimated: `6208` - // Minimum execution time: 147_000_000 picoseconds. - Weight::from_parts(155_000_000, 6208) + // Minimum execution time: 146_000_000 picoseconds. + Weight::from_parts(151_000_000, 6208) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1125,10 +1435,10 @@ impl WeightInfo for () { /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn first_contribution_no_ct_deposit() -> Weight { // Proof Size summary in bytes: - // Measured: `2073` + // Measured: `2106` // Estimated: `6208` - // Minimum execution time: 119_000_000 picoseconds. - Weight::from_parts(126_000_000, 6208) + // Minimum execution time: 118_000_000 picoseconds. + Weight::from_parts(120_000_000, 6208) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(7_u64)) } @@ -1150,25 +1460,25 @@ impl WeightInfo for () { /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `StatemintAssets::Account` (r:2 w:2) /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9832 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9833 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `y` is `[1, 99]`. /// The range of component `z` is `[1, 10000]`. fn first_contribution_ends_round_with_ct_deposit(y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + y * (443 ±0) + z * (37 ±0)` - // Estimated: `78415 + y * (14240 ±4_378) + z * (1371 ±43)` - // Minimum execution time: 264_000_000 picoseconds. - Weight::from_parts(268_000_000, 78415) - // Standard Error: 5_143_014 - .saturating_add(Weight::from_parts(16_318_492, 0).saturating_mul(y.into())) - // Standard Error: 50_979 - .saturating_add(Weight::from_parts(1_601_983, 0).saturating_mul(z.into())) - .saturating_add(RocksDbWeight::get().reads(36_u64)) + // Measured: `0 + y * (140 ±0) + z * (20 ±0)` + // Estimated: `66042 + y * (11508 ±3_537) + z * (1108 ±35)` + // Minimum execution time: 232_000_000 picoseconds. + Weight::from_parts(246_000_000, 66042) + // Standard Error: 4_200_086 + .saturating_add(Weight::from_parts(12_470_526, 0).saturating_mul(y.into())) + // Standard Error: 41_632 + .saturating_add(Weight::from_parts(1_318_329, 0).saturating_mul(z.into())) + .saturating_add(RocksDbWeight::get().reads(37_u64)) .saturating_add(RocksDbWeight::get().reads((5_u64).saturating_mul(y.into()))) .saturating_add(RocksDbWeight::get().writes(8_u64)) - .saturating_add(Weight::from_parts(0, 14240).saturating_mul(y.into())) - .saturating_add(Weight::from_parts(0, 1371).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(0, 11508).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 1108).saturating_mul(z.into())) } /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) @@ -1188,25 +1498,25 @@ impl WeightInfo for () { /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `StatemintAssets::Account` (r:2 w:2) /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9832 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9833 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `y` is `[1, 99]`. /// The range of component `z` is `[1, 10000]`. fn first_contribution_ends_round_no_ct_deposit(y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `0 + y * (443 ±0) + z * (37 ±0)` - // Estimated: `78415 + y * (14240 ±4_378) + z * (1371 ±43)` - // Minimum execution time: 226_000_000 picoseconds. - Weight::from_parts(239_000_000, 78415) - // Standard Error: 5_135_841 - .saturating_add(Weight::from_parts(15_722_813, 0).saturating_mul(y.into())) - // Standard Error: 50_908 - .saturating_add(Weight::from_parts(1_606_667, 0).saturating_mul(z.into())) - .saturating_add(RocksDbWeight::get().reads(36_u64)) + // Measured: `0 + y * (140 ±0) + z * (20 ±0)` + // Estimated: `66042 + y * (11508 ±3_537) + z * (1108 ±35)` + // Minimum execution time: 212_000_000 picoseconds. + Weight::from_parts(223_000_000, 66042) + // Standard Error: 4_200_933 + .saturating_add(Weight::from_parts(12_638_804, 0).saturating_mul(y.into())) + // Standard Error: 41_641 + .saturating_add(Weight::from_parts(1_313_036, 0).saturating_mul(z.into())) + .saturating_add(RocksDbWeight::get().reads(37_u64)) .saturating_add(RocksDbWeight::get().reads((5_u64).saturating_mul(y.into()))) .saturating_add(RocksDbWeight::get().writes(8_u64)) - .saturating_add(Weight::from_parts(0, 14240).saturating_mul(y.into())) - .saturating_add(Weight::from_parts(0, 1371).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(0, 11508).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 1108).saturating_mul(z.into())) } /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) @@ -1229,12 +1539,12 @@ impl WeightInfo for () { /// The range of component `x` is `[1, 255]`. fn second_to_limit_contribution(x: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `2213 + x * (137 ±0)` + // Measured: `2246 + x * (137 ±0)` // Estimated: `6208 + x * (2839 ±0)` // Minimum execution time: 124_000_000 picoseconds. - Weight::from_parts(117_868_102, 6208) - // Standard Error: 10_026 - .saturating_add(Weight::from_parts(3_746_658, 0).saturating_mul(x.into())) + Weight::from_parts(128_568_935, 6208) + // Standard Error: 11_772 + .saturating_add(Weight::from_parts(3_704_148, 0).saturating_mul(x.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(RocksDbWeight::get().writes(7_u64)) @@ -1258,28 +1568,28 @@ impl WeightInfo for () { /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) /// Storage: `StatemintAssets::Account` (r:2 w:2) /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) - /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9832 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:9833 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 255]`. /// The range of component `y` is `[1, 99]`. /// The range of component `z` is `[1, 10000]`. fn second_to_limit_contribution_ends_round(x: u32, y: u32, z: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `75282 + x * (137 ±0) + y * (723 ±0) + z * (39 ±0)` - // Estimated: `17232 + x * (2839 ±0) + y * (115061 ±7_565) + z * (2358 ±74)` - // Minimum execution time: 1_097_000_000 picoseconds. - Weight::from_parts(554_228_738, 17232) - // Standard Error: 8_861_727 - .saturating_add(Weight::from_parts(133_771_367, 0).saturating_mul(y.into())) - // Standard Error: 86_849 - .saturating_add(Weight::from_parts(2_763_795, 0).saturating_mul(z.into())) - .saturating_add(RocksDbWeight::get().reads(16_u64)) + // Measured: `44564 + x * (137 ±0) + y * (254 ±0) + z * (21 ±0)` + // Estimated: `15401 + x * (2839 ±0) + y * (92965 ±6_111) + z * (1905 ±59)` + // Minimum execution time: 1_120_000_000 picoseconds. + Weight::from_parts(55_806_166, 15401) + // Standard Error: 7_331_488 + .saturating_add(Weight::from_parts(111_668_126, 0).saturating_mul(y.into())) + // Standard Error: 71_852 + .saturating_add(Weight::from_parts(2_292_683, 0).saturating_mul(z.into())) + .saturating_add(RocksDbWeight::get().reads(17_u64)) .saturating_add(RocksDbWeight::get().reads((37_u64).saturating_mul(y.into()))) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(z.into()))) .saturating_add(RocksDbWeight::get().writes(8_u64)) .saturating_add(Weight::from_parts(0, 2839).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 115061).saturating_mul(y.into())) - .saturating_add(Weight::from_parts(0, 2358).saturating_mul(z.into())) + .saturating_add(Weight::from_parts(0, 92965).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 1905).saturating_mul(z.into())) } /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) @@ -1301,10 +1611,10 @@ impl WeightInfo for () { /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) fn contribution_over_limit() -> Weight { // Proof Size summary in bytes: - // Measured: `37440` + // Measured: `37473` // Estimated: `730613` - // Minimum execution time: 1_103_000_000 picoseconds. - Weight::from_parts(1_165_000_000, 730613) + // Minimum execution time: 1_082_000_000 picoseconds. + Weight::from_parts(1_150_000_000, 730613) .saturating_add(RocksDbWeight::get().reads(267_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -1316,10 +1626,10 @@ impl WeightInfo for () { /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn evaluation_unbond_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1411` + // Measured: `1477` // Estimated: `4614` - // Minimum execution time: 55_000_000 picoseconds. - Weight::from_parts(60_000_000, 4614) + // Minimum execution time: 54_000_000 picoseconds. + Weight::from_parts(57_000_000, 4614) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1335,10 +1645,10 @@ impl WeightInfo for () { /// Proof: `LocalAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn evaluation_reward_payout_for_with_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1515` + // Measured: `1654` // Estimated: `4614` - // Minimum execution time: 92_000_000 picoseconds. - Weight::from_parts(102_000_000, 4614) + // Minimum execution time: 94_000_000 picoseconds. + Weight::from_parts(98_000_000, 4614) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -1352,10 +1662,10 @@ impl WeightInfo for () { /// Proof: `LocalAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) fn evaluation_reward_payout_for_no_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1219` + // Measured: `1322` // Estimated: `3814` // Minimum execution time: 48_000_000 picoseconds. - Weight::from_parts(49_000_000, 3814) + Weight::from_parts(50_000_000, 3814) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1369,10 +1679,10 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn evaluation_slash_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1419` + // Measured: `1485` // Estimated: `4614` - // Minimum execution time: 68_000_000 picoseconds. - Weight::from_parts(71_000_000, 4614) + // Minimum execution time: 67_000_000 picoseconds. + Weight::from_parts(69_000_000, 4614) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1388,10 +1698,10 @@ impl WeightInfo for () { /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn bid_ct_mint_for_with_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1629` + // Measured: `1735` // Estimated: `4614` - // Minimum execution time: 96_000_000 picoseconds. - Weight::from_parts(99_000_000, 4614) + // Minimum execution time: 99_000_000 picoseconds. + Weight::from_parts(103_000_000, 4614) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -1405,10 +1715,10 @@ impl WeightInfo for () { /// Proof: `LocalAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn bid_ct_mint_for_no_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1180` + // Measured: `1250` // Estimated: `3883` - // Minimum execution time: 44_000_000 picoseconds. - Weight::from_parts(47_000_000, 3883) + // Minimum execution time: 46_000_000 picoseconds. + Weight::from_parts(50_000_000, 3883) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1424,10 +1734,10 @@ impl WeightInfo for () { /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn contribution_ct_mint_for_with_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1545` + // Measured: `1651` // Estimated: `4614` - // Minimum execution time: 91_000_000 picoseconds. - Weight::from_parts(98_000_000, 4614) + // Minimum execution time: 94_000_000 picoseconds. + Weight::from_parts(100_000_000, 4614) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -1441,9 +1751,9 @@ impl WeightInfo for () { /// Proof: `LocalAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn contribution_ct_mint_for_no_ct_account_creation() -> Weight { // Proof Size summary in bytes: - // Measured: `1217` + // Measured: `1287` // Estimated: `3829` - // Minimum execution time: 46_000_000 picoseconds. + // Minimum execution time: 47_000_000 picoseconds. Weight::from_parts(50_000_000, 3829) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) @@ -1456,10 +1766,10 @@ impl WeightInfo for () { /// Proof: `LinearRelease::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`) fn start_bid_vesting_schedule_for() -> Weight { // Proof Size summary in bytes: - // Measured: `818` - // Estimated: `4283` + // Measured: `851` + // Estimated: `4316` // Minimum execution time: 29_000_000 picoseconds. - Weight::from_parts(31_000_000, 4283) + Weight::from_parts(31_000_000, 4316) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1471,10 +1781,10 @@ impl WeightInfo for () { /// Proof: `LinearRelease::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`) fn start_contribution_vesting_schedule_for() -> Weight { // Proof Size summary in bytes: - // Measured: `847` - // Estimated: `4312` + // Measured: `880` + // Estimated: `4345` // Minimum execution time: 30_000_000 picoseconds. - Weight::from_parts(32_000_000, 4312) + Weight::from_parts(31_000_000, 4345) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1490,10 +1800,10 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn payout_bid_funds_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1372` + // Measured: `1405` // Estimated: `6208` - // Minimum execution time: 64_000_000 picoseconds. - Weight::from_parts(69_000_000, 6208) + // Minimum execution time: 67_000_000 picoseconds. + Weight::from_parts(68_000_000, 6208) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } @@ -1509,34 +1819,34 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) fn payout_contribution_funds_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1401` + // Measured: `1434` // Estimated: `6208` - // Minimum execution time: 69_000_000 picoseconds. - Weight::from_parts(77_000_000, 6208) + // Minimum execution time: 66_000_000 picoseconds. + Weight::from_parts(69_000_000, 6208) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) /// Storage: `PolimecFunding::ProjectsToUpdate` (r:2980 w:1) - /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(622), added: 3097, mode: `MaxEncodedLen`) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) /// The range of component `x` is `[1, 99]`. /// The range of component `y` is `[1, 10000]`. fn decide_project_outcome(x: u32, y: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `10254 + x * (419 ±0) + y * (20 ±0)` - // Estimated: `35057 + x * (4876 ±4_177) + y * (1437 ±41)` - // Minimum execution time: 64_000_000 picoseconds. - Weight::from_parts(68_000_000, 35057) - // Standard Error: 4_809_624 - .saturating_add(Weight::from_parts(5_610_465, 0).saturating_mul(x.into())) - // Standard Error: 47_674 - .saturating_add(Weight::from_parts(1_647_468, 0).saturating_mul(y.into())) + // Measured: `4454 + x * (93 ±0) + y * (11 ±0)` + // Estimated: `28512 + x * (3946 ±3_374) + y * (1161 ±33)` + // Minimum execution time: 58_000_000 picoseconds. + Weight::from_parts(59_000_000, 28512) + // Standard Error: 3_928_236 + .saturating_add(Weight::from_parts(3_329_337, 0).saturating_mul(x.into())) + // Standard Error: 38_938 + .saturating_add(Weight::from_parts(1_351_270, 0).saturating_mul(y.into())) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(x.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) - .saturating_add(Weight::from_parts(0, 4876).saturating_mul(x.into())) - .saturating_add(Weight::from_parts(0, 1437).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 3946).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 1161).saturating_mul(y.into())) } /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:0) /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) @@ -1548,10 +1858,10 @@ impl WeightInfo for () { /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn release_bid_funds_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1481` + // Measured: `1514` // Estimated: `6208` - // Minimum execution time: 64_000_000 picoseconds. - Weight::from_parts(71_000_000, 6208) + // Minimum execution time: 65_000_000 picoseconds. + Weight::from_parts(70_000_000, 6208) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -1565,10 +1875,10 @@ impl WeightInfo for () { /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) fn release_contribution_funds_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1474` + // Measured: `1507` // Estimated: `6208` - // Minimum execution time: 64_000_000 picoseconds. - Weight::from_parts(70_000_000, 6208) + // Minimum execution time: 63_000_000 picoseconds. + Weight::from_parts(69_000_000, 6208) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -1580,10 +1890,10 @@ impl WeightInfo for () { /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn bid_unbond_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1486` + // Measured: `1519` // Estimated: `4614` - // Minimum execution time: 52_000_000 picoseconds. - Weight::from_parts(57_000_000, 4614) + // Minimum execution time: 54_000_000 picoseconds. + Weight::from_parts(56_000_000, 4614) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1595,11 +1905,323 @@ impl WeightInfo for () { /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) fn contribution_unbond_for() -> Weight { // Proof Size summary in bytes: - // Measured: `1441` + // Measured: `1474` // Estimated: `4614` - // Minimum execution time: 52_000_000 picoseconds. + // Minimum execution time: 54_000_000 picoseconds. Weight::from_parts(57_000_000, 4614) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `Oracle::Values` (r:1 w:0) + /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Evaluations` (r:4 w:0) + /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:99 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn end_evaluation_success(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1174 + x * (29 ±0)` + // Estimated: `12270 + x * (2502 ±0)` + // Minimum execution time: 38_000_000 picoseconds. + Weight::from_parts(36_057_447, 12270) + // Standard Error: 5_687 + .saturating_add(Weight::from_parts(2_349_611, 0).saturating_mul(x.into())) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `Oracle::Values` (r:1 w:0) + /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Evaluations` (r:4 w:0) + /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) + fn end_evaluation_failure() -> Weight { + // Proof Size summary in bytes: + // Measured: `1148` + // Estimated: `12270` + // Minimum execution time: 33_000_000 picoseconds. + Weight::from_parts(35_000_000, 12270) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:102 w:2) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn start_auction_automatically(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `413 + x * (29 ±0)` + // Estimated: `8496 + x * (2502 ±0)` + // Minimum execution time: 26_000_000 picoseconds. + Weight::from_parts(28_124_881, 8496) + // Standard Error: 5_442 + .saturating_add(Weight::from_parts(2_521_942, 0).saturating_mul(x.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn start_candle_phase(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `446 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(17_987_956, 3814) + // Standard Error: 5_995 + .saturating_add(Weight::from_parts(2_286_160, 0).saturating_mul(x.into())) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Nonce` (r:1 w:1) + /// Proof: `PolimecFunding::Nonce` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Random::RandomMaterial` (r:1 w:0) + /// Proof: `Random::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Bids` (r:2049 w:2048) + /// Proof: `PolimecFunding::Bids` (`max_values`: None, `max_size`: Some(418), added: 2893, mode: `MaxEncodedLen`) + /// Storage: `Oracle::Values` (r:1 w:0) + /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `StatemintAssets::Asset` (r:1 w:1) + /// Proof: `StatemintAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `StatemintAssets::Account` (r:1025 w:1025) + /// Proof: `StatemintAssets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1024 w:1024) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1024 w:1024) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(1149), added: 3624, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Buckets` (r:1 w:0) + /// Proof: `PolimecFunding::Buckets` (`max_values`: None, `max_size`: Some(100), added: 2575, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + /// The range of component `y` is `[1, 1024]`. + /// The range of component `z` is `[0, 1024]`. + fn start_community_funding_success(x: u32, y: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `86802 + x * (29 ±0) + y * (167 ±0) + z * (367 ±0)` + // Estimated: `4079 + x * (2502 ±0) + y * (2893 ±0) + z * (3624 ±0)` + // Minimum execution time: 8_733_000_000 picoseconds. + Weight::from_parts(8_889_000_000, 4079) + // Standard Error: 235_341 + .saturating_add(Weight::from_parts(6_457_226, 0).saturating_mul(y.into())) + // Standard Error: 235_237 + .saturating_add(Weight::from_parts(70_277_060, 0).saturating_mul(z.into())) + .saturating_add(RocksDbWeight::get().reads(10_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(y.into()))) + .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(z.into()))) + .saturating_add(RocksDbWeight::get().writes(5_u64)) + .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(y.into()))) + .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(z.into()))) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2893).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 3624).saturating_mul(z.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Nonce` (r:1 w:1) + /// Proof: `PolimecFunding::Nonce` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Random::RandomMaterial` (r:1 w:0) + /// Proof: `Random::RandomMaterial` (`max_values`: Some(1), `max_size`: Some(2594), added: 3089, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Bids` (r:1 w:0) + /// Proof: `PolimecFunding::Bids` (`max_values`: None, `max_size`: Some(418), added: 2893, mode: `MaxEncodedLen`) + /// Storage: `Oracle::Values` (r:1 w:0) + /// Proof: `Oracle::Values` (`max_values`: None, `max_size`: Some(36), added: 2511, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Buckets` (r:1 w:0) + /// Proof: `PolimecFunding::Buckets` (`max_values`: None, `max_size`: Some(100), added: 2575, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn start_community_funding_failure(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1418 + x * (3 ±0)` + // Estimated: `4079` + // Minimum execution time: 87_000_000 picoseconds. + Weight::from_parts(97_589_188, 4079) + // Standard Error: 3_828 + .saturating_add(Weight::from_parts(26_576, 0).saturating_mul(x.into())) + .saturating_add(RocksDbWeight::get().reads(8_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn start_remainder_funding(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `536 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(18_694_146, 3814) + // Standard Error: 5_669 + .saturating_add(Weight::from_parts(2_256_677, 0).saturating_mul(x.into())) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn end_funding_automatically_rejected_evaluators_slashed(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `824 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(23_753_565, 3814) + // Standard Error: 4_976 + .saturating_add(Weight::from_parts(2_285_728, 0).saturating_mul(x.into())) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn end_funding_awaiting_decision_evaluators_slashed(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `823 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_149_882, 3814) + // Standard Error: 4_893 + .saturating_add(Weight::from_parts(2_241_882, 0).saturating_mul(x.into())) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + fn end_funding_awaiting_decision_evaluators_unchanged(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `823 + x * (29 ±0)` + // Estimated: `3814 + x * (2502 ±0)` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(18_735_663, 3814) + // Standard Error: 5_515 + .saturating_add(Weight::from_parts(2_252_806, 0).saturating_mul(x.into())) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::Evaluations` (r:2048 w:0) + /// Proof: `PolimecFunding::Evaluations` (`max_values`: None, `max_size`: Some(345), added: 2820, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:100 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + /// The range of component `x` is `[1, 99]`. + /// The range of component `y` is `[1, 2048]`. + fn end_funding_automatically_accepted_evaluators_rewarded(x: u32, y: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1184 + x * (29 ±0) + y * (187 ±0)` + // Estimated: `3814 + x * (2502 ±0) + y * (2820 ±0)` + // Minimum execution time: 257_000_000 picoseconds. + Weight::from_parts(260_000_000, 3814) + // Standard Error: 52_986 + .saturating_add(Weight::from_parts(476_614, 0).saturating_mul(x.into())) + // Standard Error: 2_564 + .saturating_add(Weight::from_parts(4_091_225, 0).saturating_mul(y.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(y.into()))) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(Weight::from_parts(0, 2502).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2820).saturating_mul(y.into())) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:2 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + fn project_decision_accept_funding() -> Weight { + // Proof Size summary in bytes: + // Measured: `563` + // Estimated: `5994` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_000_000, 5994) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsToUpdate` (r:2 w:1) + /// Proof: `PolimecFunding::ProjectsToUpdate` (`max_values`: None, `max_size`: Some(27), added: 2502, mode: `MaxEncodedLen`) + fn project_decision_reject_funding() -> Weight { + // Proof Size summary in bytes: + // Measured: `563` + // Estimated: `5994` + // Minimum execution time: 18_000_000 picoseconds. + Weight::from_parts(19_000_000, 5994) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + /// Storage: `LocalAssets::Asset` (r:1 w:1) + /// Proof: `LocalAssets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`) + /// Storage: `LocalAssets::Metadata` (r:1 w:1) + /// Proof: `LocalAssets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn start_settlement_funding_success() -> Weight { + // Proof Size summary in bytes: + // Measured: `970` + // Estimated: `3814` + // Minimum execution time: 41_000_000 picoseconds. + Weight::from_parts(43_000_000, 3814) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } + /// Storage: `PolimecFunding::ProjectsDetails` (r:1 w:1) + /// Proof: `PolimecFunding::ProjectsDetails` (`max_values`: None, `max_size`: Some(349), added: 2824, mode: `MaxEncodedLen`) + /// Storage: `PolimecFunding::ProjectsMetadata` (r:1 w:0) + /// Proof: `PolimecFunding::ProjectsMetadata` (`max_values`: None, `max_size`: Some(334), added: 2809, mode: `MaxEncodedLen`) + fn start_settlement_funding_failure() -> Weight { + // Proof Size summary in bytes: + // Measured: `760` + // Estimated: `3814` + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(12_000_000, 3814) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } } \ No newline at end of file diff --git a/pallets/linear-release/src/impls.rs b/pallets/linear-release/src/impls.rs index fb95385cb..6ad347ac0 100644 --- a/pallets/linear-release/src/impls.rs +++ b/pallets/linear-release/src/impls.rs @@ -72,7 +72,7 @@ impl Pallet { // Validate user inputs. ensure!(schedule.locked() >= T::MinVestedTransfer::get(), Error::::AmountLow); if !schedule.is_valid() { - return Err(Error::::InvalidScheduleParams.into()) + return Err(Error::::InvalidScheduleParams.into()); }; // Check we can add to this account prior to any storage writes. @@ -272,13 +272,13 @@ impl ReleaseSchedule, ReasonOf> for Pallet { reason: ReasonOf, ) -> DispatchResult { if locked.is_zero() { - return Ok(()) + return Ok(()); } let vesting_schedule = VestingInfo::new(locked, per_block, starting_block); // Check for `per_block` or `locked` of 0. if !vesting_schedule.is_valid() { - return Err(Error::::InvalidScheduleParams.into()) + return Err(Error::::InvalidScheduleParams.into()); }; let mut schedules = Self::vesting(who, reason).unwrap_or_default(); @@ -313,13 +313,13 @@ impl ReleaseSchedule, ReasonOf> for Pallet { reason: ReasonOf, ) -> DispatchResult { if locked.is_zero() { - return Ok(()) + return Ok(()); } let vesting_schedule = VestingInfo::new(locked, per_block, starting_block); // Check for `per_block` or `locked` of 0. if !vesting_schedule.is_valid() { - return Err(Error::::InvalidScheduleParams.into()) + return Err(Error::::InvalidScheduleParams.into()); }; let mut schedules = Self::vesting(who, reason).unwrap_or_default(); @@ -346,7 +346,7 @@ impl ReleaseSchedule, ReasonOf> for Pallet { ) -> DispatchResult { // Check for `per_block` or `locked` of 0. if !VestingInfo::new(locked, per_block, starting_block).is_valid() { - return Err(Error::::InvalidScheduleParams.into()) + return Err(Error::::InvalidScheduleParams.into()); } ensure!( diff --git a/pallets/linear-release/src/lib.rs b/pallets/linear-release/src/lib.rs index 6d6c0daf0..d34db5b4d 100644 --- a/pallets/linear-release/src/lib.rs +++ b/pallets/linear-release/src/lib.rs @@ -371,7 +371,7 @@ pub mod pallet { ) -> DispatchResult { let who = ensure_signed(origin)?; if schedule1_index == schedule2_index { - return Ok(()) + return Ok(()); }; let schedule1_index = schedule1_index as usize; let schedule2_index = schedule2_index as usize; diff --git a/pallets/oracle-ocw/src/lib.rs b/pallets/oracle-ocw/src/lib.rs index fb9535e97..f576fb535 100644 --- a/pallets/oracle-ocw/src/lib.rs +++ b/pallets/oracle-ocw/src/lib.rs @@ -121,7 +121,7 @@ pub mod pallet { let account = public.clone().into_account(); if ::Members::contains(&account) { if let Ok(generic_public) = TryInto::>::try_into(public) { - return Some(generic_public.into()) + return Some(generic_public.into()); } } None @@ -157,21 +157,21 @@ pub mod pallet { if remainder >= BlockNumberFor::::zero() && remainder < window && last_send < &block_number.saturating_sub(window) { - return Some(*asset_name) + return Some(*asset_name); } None }) .collect::>(); if assets.is_empty() { - return + return; } log::trace!(target: LOG_TARGET, "Transaction grace period reached for assets {:?} in block {:?}", assets, block_number); let prices = Self::fetch_prices(assets); if prices.is_empty() { - return + return; } for (asset_name, price) in prices.clone() { @@ -220,14 +220,14 @@ pub mod pallet { .into_iter() .filter_map(|(key, price_list)| { if price_list.is_empty() { - return None + return None; } let combined_prices = price_list.into_iter().fold((FixedU128::zero(), FixedU128::zero()), |acc, (price, volume)| { (acc.0 + price, acc.1 + volume) }); if combined_prices.1.is_zero() { - return None + return None; } Some((key, combined_prices.0.div(combined_prices.1))) }) @@ -246,11 +246,11 @@ pub mod pallet { match result { Some((_, Ok(_))) => { log::trace!(target: LOG_TARGET, "offchain tx sent successfully"); - return Ok(()) + return Ok(()); }, _ => { log::trace!(target: LOG_TARGET, "failure: offchain_signed_tx"); - return Err(()) + return Err(()); }, } } diff --git a/pallets/oracle-ocw/src/traits.rs b/pallets/oracle-ocw/src/traits.rs index e785748b6..708d3b19e 100644 --- a/pallets/oracle-ocw/src/traits.rs +++ b/pallets/oracle-ocw/src/traits.rs @@ -31,12 +31,12 @@ pub(crate) trait FetchPrice { .filter_map(|asset| { let url = Self::get_url(asset); if url.is_empty() { - return None + return None; } let request = http::Request::get(url); if let Ok(req) = request.deadline(deadline).send() { - return Some(AssetRequest { asset, id: req.id }) + return Some(AssetRequest { asset, id: req.id }); } None }) @@ -51,9 +51,9 @@ pub(crate) trait FetchPrice { .filter_map(|(maybe_response, asset)| { if let Ok(Ok(response)) = maybe_response { if response.code != 200 { - return None + return None; } - return Some((asset, response)) + return Some((asset, response)); } None }) @@ -61,7 +61,7 @@ pub(crate) trait FetchPrice { let body = response.body().collect::>(); if let Ok(body_str) = sp_std::str::from_utf8(&body) { if let Some(ocv_data) = Self::parse_body(body_str) { - return Some((asset, ocv_data)) + return Some((asset, ocv_data)); } } None @@ -72,7 +72,7 @@ pub(crate) trait FetchPrice { (w_price_sum + ocv.vwp(), vol_sum.saturating_add(ocv.volume)) }); if total_vol.is_zero() { - return None + return None; } Some((asset, w_price_sum, total_vol)) }) diff --git a/pallets/oracle-ocw/src/types.rs b/pallets/oracle-ocw/src/types.rs index 6c2babcaf..443e5498a 100644 --- a/pallets/oracle-ocw/src/types.rs +++ b/pallets/oracle-ocw/src/types.rs @@ -119,7 +119,7 @@ impl FetchPrice for KrakenFetcher { let maybe_response = serde_json_core::from_str::(body); if let Err(e) = maybe_response { log::error!(target: LOG_TARGET, "Error parsing response for Kraken: {:?}", e); - return None + return None; } let response = maybe_response.ok()?; Some(response.0.result.data.into_iter().rev().take(NUMBER_OF_CANDLES).collect()) @@ -141,14 +141,14 @@ impl FetchPrice for BitFinexFetcher { let maybe_response = serde_json_core::from_str::>(body); if let Err(e) = maybe_response { log::error!(target: LOG_TARGET, "Error parsing response for BitFinex: {:?}", e); - return None + return None; } let response = maybe_response.ok()?; let data: Vec = response.0.into_iter().filter_map(|r| OpenCloseVolume::from_f64(r.3, r.4, r.2, r.5).ok()).collect(); if data.len() < NUMBER_OF_CANDLES { - return None + return None; } Some(data) } @@ -175,7 +175,7 @@ where let volume_str = "volume"; for row in data.into_iter() { if !row.contains_key(&high_str) && !row.contains_key(&close_str) && !row.contains_key(&volume_str) { - return Err(serde::de::Error::custom("Row does not contain required data")) + return Err(serde::de::Error::custom("Row does not contain required data")); } let high = *row.get(&high_str).ok_or(serde::de::Error::custom("Could not parse value to str"))?; let low = *row.get(&low_str).ok_or(serde::de::Error::custom("Could not parse value to str"))?; @@ -208,11 +208,11 @@ impl FetchPrice for BitStampFetcher { let maybe_response = serde_json_core::from_str::(body); if let Err(e) = maybe_response { log::error!(target: LOG_TARGET, "Error parsing response for Bitstamp: {:?}", e); - return None + return None; } let response = maybe_response.ok()?; if response.0.data.ohlc.len() < NUMBER_OF_CANDLES { - return None + return None; } Some(response.0.data.ohlc.into_iter().rev().collect()) @@ -234,7 +234,7 @@ impl FetchPrice for CoinbaseFetcher { let maybe_response = serde_json_core::from_str::>(body); if let Err(e) = maybe_response { log::error!(target: LOG_TARGET, "Error parsing response for Coinbase: {:?}", e); - return None + return None; } let response = maybe_response.ok()?; @@ -245,7 +245,7 @@ impl FetchPrice for CoinbaseFetcher { .filter_map(|r| OpenCloseVolume::from_f64(r.2, r.1, r.4, r.5).ok()) .collect(); if data.len() < NUMBER_OF_CANDLES { - return None + return None; } Some(data) } diff --git a/pallets/parachain-staking/src/delegation_requests.rs b/pallets/parachain-staking/src/delegation_requests.rs index 971d5bdc6..5ee672e2f 100644 --- a/pallets/parachain-staking/src/delegation_requests.rs +++ b/pallets/parachain-staking/src/delegation_requests.rs @@ -287,7 +287,7 @@ impl Pallet { } else { // must rm entire delegation if bond.amount <= less or cancel request Err(>::DelegationBelowMin.into()) - } + }; } } Err(>::DelegationDNE.into()) @@ -338,7 +338,7 @@ impl Pallet { } if existing_revoke_count == state.delegations.0.len() { - return Err(>::DelegatorAlreadyLeaving.into()) + return Err(>::DelegatorAlreadyLeaving.into()); } updated_scheduled_requests.into_iter().for_each(|(collator, scheduled_requests)| { @@ -363,7 +363,7 @@ impl Pallet { state.status = DelegatorStatus::Active; >::insert(delegator.clone(), state.clone()); Self::deposit_event(Event::DelegatorExitCancelled { delegator }); - return Ok(().into()) + return Ok(().into()); } // pre-validate that all delegations have a Revoke request. @@ -424,7 +424,7 @@ impl Pallet { } >::remove(&delegator); Self::deposit_event(Event::DelegatorLeft { delegator, unstaked_amount: state.total }); - return Ok(().into()) + return Ok(().into()); } let mut validated_scheduled_requests = vec![]; diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index 2eec4fe0c..8535de394 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -1454,12 +1454,12 @@ pub mod pallet { // payout is now - delay rounds ago => now - delay > 0 else return early let delay = T::RewardPaymentDelay::get(); if now <= delay { - return Weight::zero() + return Weight::zero(); } let round_to_payout = now.saturating_sub(delay); let total_points = >::get(round_to_payout); if total_points.is_zero() { - return Weight::zero() + return Weight::zero(); } let total_staked = >::take(round_to_payout); let total_issuance = Self::compute_issuance(total_staked); @@ -1501,7 +1501,7 @@ pub mod pallet { // don't underflow uint if now < delay { - return Weight::from_parts(0u64, 0) + return Weight::from_parts(0u64, 0); } let paid_for_round = now.saturating_sub(delay); @@ -1544,7 +1544,7 @@ pub mod pallet { // 2. we called pay_one_collator_reward when we were actually done with deferred // payouts log::warn!("pay_one_collator_reward called with no > for the round!"); - return (RewardPayment::Finished, early_weight) + return (RewardPayment::Finished, early_weight); } let collator_fee = payout_info.collator_commission; @@ -1559,7 +1559,7 @@ pub mod pallet { // read and kill AwardedPts early_weight = early_weight.saturating_add(T::DbWeight::get().reads_writes(1, 1)); if pts == 0 { - return (RewardPayment::Skipped, early_weight) + return (RewardPayment::Skipped, early_weight); } // 'extra_weight' tracks weight returned from fns that we delegate to which can't be @@ -1631,7 +1631,7 @@ pub mod pallet { pub fn compute_top_candidates() -> Vec { let top_n = >::get() as usize; if top_n == 0 { - return vec![] + return vec![]; } let mut candidates = >::get().0; @@ -1690,7 +1690,7 @@ pub mod pallet { }) } let weight = T::WeightInfo::select_top_candidates(0, 0); - return (weight, collator_count, delegation_count, total) + return (weight, collator_count, delegation_count, total); } // snapshot exposure for round for weighting reward distribution @@ -1834,7 +1834,7 @@ pub mod pallet { let compound_amount = compound_percent.mul_ceil(amount_transferred); if compound_amount.is_zero() { - return weight + return weight; } if let Err(err) = @@ -1846,7 +1846,7 @@ pub mod pallet { delegator, err ); - return weight + return weight; }; weight = weight.saturating_add(T::WeightInfo::delegator_bond_more()); diff --git a/pallets/parachain-staking/src/tests.rs b/pallets/parachain-staking/src/tests.rs index f3302b60e..baf309459 100644 --- a/pallets/parachain-staking/src/tests.rs +++ b/pallets/parachain-staking/src/tests.rs @@ -2516,7 +2516,7 @@ fn execute_delegator_bond_less_updates_just_bottom_delegations() { if &owner == post_owner { if &amount != post_amount { not_equal = true; - break + break; } } } @@ -2528,7 +2528,7 @@ fn execute_delegator_bond_less_updates_just_bottom_delegations() { if &owner == post_owner { if &amount != post_amount { equal = false; - break + break; } } } @@ -2563,7 +2563,7 @@ fn execute_delegator_bond_less_does_not_delete_bottom_delegations() { if &owner == post_owner { if &amount != post_amount { equal = false; - break + break; } } } @@ -2575,7 +2575,7 @@ fn execute_delegator_bond_less_does_not_delete_bottom_delegations() { if &owner == post_owner { if &amount != post_amount { not_equal = true; - break + break; } } } diff --git a/pallets/parachain-staking/src/types.rs b/pallets/parachain-staking/src/types.rs index 0bde3605a..96b985012 100644 --- a/pallets/parachain-staking/src/types.rs +++ b/pallets/parachain-staking/src/types.rs @@ -134,7 +134,7 @@ impl PartialEq for CollatorSnapshot { fn eq(&self, other: &Self) -> bool { let must_be_true = self.bond == other.bond && self.total == other.total; if !must_be_true { - return false + return false; } for ( BondWithAutoCompound { owner: o1, amount: a1, auto_compound: c1 }, @@ -142,7 +142,7 @@ impl PartialEq for CollatorSnapshot { ) in self.delegations.iter().zip(other.delegations.iter()) { if o1 != o2 || a1 != a2 || c1 != c2 { - return false + return false; } } true @@ -264,7 +264,7 @@ impl PartialEq for CollatorCandidate { self.request == other.request && self.state == other.state; if !must_be_true { - return false + return false; } for (x, y) in self.delegators.0.iter().zip(other.delegators.0.iter()) { if x != y { - return false + return false; } } for (Bond { owner: o1, amount: a1 }, Bond { owner: o2, amount: a2 }) in self.top_delegations.iter().zip(other.top_delegations.iter()) { if o1 != o2 || a1 != a2 { - return false + return false; } } for (Bond { owner: o1, amount: a1 }, Bond { owner: o2, amount: a2 }) in self.bottom_delegations.iter().zip(other.bottom_delegations.iter()) { if o1 != o2 || a1 != a2 { - return false + return false; } } true @@ -1166,13 +1166,13 @@ impl PartialEq for Delegator { self.less_total == other.less_total && self.status == other.status; if !must_be_true { - return false + return false; } for (Bond { owner: o1, amount: a1 }, Bond { owner: o2, amount: a2 }) in self.delegations.0.iter().zip(other.delegations.0.iter()) { if o1 != o2 || a1 != a2 { - return false + return false; } } true @@ -1337,7 +1337,7 @@ impl< >::put(new_total_staked); let nom_st: Delegator> = self.clone().into(); >::insert(&delegator_id, nom_st); - return Ok(in_top) + return Ok(in_top); } } Err(Error::::DelegationDNE.into()) @@ -1366,7 +1366,7 @@ impl< // additional sanity check: shouldn't ever want to lock more than total if amount > self.total { log::warn!("LOGIC ERROR: request to reserve more than bond total"); - return Err(DispatchError::Other("Invalid additional_required_balance")) + return Err(DispatchError::Other("Invalid additional_required_balance")); } }, BondAdjust::Decrease => (), // do nothing on decrease @@ -1496,13 +1496,13 @@ pub mod deprecated { fn eq(&self, other: &Self) -> bool { let must_be_true = self.bond == other.bond && self.total == other.total; if !must_be_true { - return false + return false; } for (Bond { owner: o1, amount: a1 }, Bond { owner: o2, amount: a2 }) in self.delegations.iter().zip(other.delegations.iter()) { if o1 != o2 || a1 != a2 { - return false + return false; } } true diff --git a/pallets/polimec-receiver/src/lib.rs b/pallets/polimec-receiver/src/lib.rs index 1929f4045..e41692fc0 100644 --- a/pallets/polimec-receiver/src/lib.rs +++ b/pallets/polimec-receiver/src/lib.rs @@ -112,7 +112,7 @@ pub mod pallet { let already_executed = ExecutedMigrations::::get((user, participation_type, id)); if already_executed { Self::deposit_event(Event::DuplicatedMigrationSkipped { migration }); - continue + continue; } T::Balances::transfer( &polimec_soverign_account, diff --git a/pallets/xcm-executor/src/lib.rs b/pallets/xcm-executor/src/lib.rs index ba1f7718b..3fdb1f323 100644 --- a/pallets/xcm-executor/src/lib.rs +++ b/pallets/xcm-executor/src/lib.rs @@ -246,7 +246,7 @@ impl ExecuteXcm for XcmExecutor XcmExecutor { let inst_res = recursion_count::using_once(&mut 1, || { recursion_count::with(|count| { if *count > RECURSION_LIMIT { - return Err(XcmError::ExceedsStackLimit) + return Err(XcmError::ExceedsStackLimit); } *count = count.saturating_add(1); Ok(()) @@ -895,7 +895,7 @@ impl XcmExecutor { fn take_fee(&mut self, fee: MultiAssets, reason: FeeReason) -> XcmResult { if Config::FeeManager::is_waived(self.origin_ref(), reason) { - return Ok(()) + return Ok(()); } let paid = if self.fees_mode.jit_withdraw { let origin = self.origin_ref().ok_or(XcmError::BadOrigin)?; diff --git a/runtimes/base/Cargo.toml b/runtimes/base/Cargo.toml index 6c93cbe54..5e40e6342 100644 --- a/runtimes/base/Cargo.toml +++ b/runtimes/base/Cargo.toml @@ -194,6 +194,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "polimec-xcm-executor/runtime-benchmarks", + "pallet-assets/runtime-benchmarks" ] try-runtime = [ diff --git a/runtimes/shared-configuration/Cargo.toml b/runtimes/shared-configuration/Cargo.toml index a6cfe059c..136df9071 100644 --- a/runtimes/shared-configuration/Cargo.toml +++ b/runtimes/shared-configuration/Cargo.toml @@ -34,6 +34,7 @@ pallet-balances.workspace = true pallet-authorship.workspace = true pallet-parachain-staking.workspace = true + [features] default = [ "std" ] fast-mode = [] diff --git a/runtimes/shared-configuration/src/fee.rs b/runtimes/shared-configuration/src/fee.rs index 61af74604..42efa3029 100644 --- a/runtimes/shared-configuration/src/fee.rs +++ b/runtimes/shared-configuration/src/fee.rs @@ -138,7 +138,7 @@ where _tip: Self::Balance, ) -> Result { if fee.is_zero() { - return Ok(None) + return Ok(None); } // TODO: This is a temporary workaround. @@ -146,7 +146,7 @@ where // This will probably be included in v1.6 or 1.7. // src: https://github.com/paritytech/polkadot-sdk/pull/2823 if F::can_withdraw(who, fee) != frame_support::traits::tokens::WithdrawConsequence::Success { - return Err(InvalidTransaction::Payment.into()) + return Err(InvalidTransaction::Payment.into()); }; match F::withdraw( diff --git a/runtimes/testnet/Cargo.toml b/runtimes/testnet/Cargo.toml index 9e1284c3e..f450667ee 100644 --- a/runtimes/testnet/Cargo.toml +++ b/runtimes/testnet/Cargo.toml @@ -21,6 +21,9 @@ hex-literal = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"] } smallvec.workspace = true +# Uncomment this to see variables instead of in the console output +sp-debug-derive = { workspace = true, features = ["force-debug"]} + # Polimec specific pallet-funding.workspace = true pallet-oracle-ocw.workspace = true diff --git a/runtimes/testnet/src/lib.rs b/runtimes/testnet/src/lib.rs index 8df966e12..9e283b514 100644 --- a/runtimes/testnet/src/lib.rs +++ b/runtimes/testnet/src/lib.rs @@ -499,7 +499,7 @@ pub struct EqualOrGreatestRootCmp; impl PrivilegeCmp for EqualOrGreatestRootCmp { fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { if left == right { - return Some(Ordering::Equal) + return Some(Ordering::Equal); } match (left, right) { // Root is greater than anything. @@ -639,13 +639,15 @@ impl pallet_funding::Config for Runtime { type FeeBrackets = FeeBrackets; type FundingCurrency = ForeignAssets; type ManualAcceptanceDuration = ManualAcceptanceDuration; - type MaxBidsPerUser = ConstU32<256>; + type MaxBidsPerProject = ConstU32<2048>; + type MaxBidsPerUser = ConstU32<128>; type MaxCapacityThresholds = MaxCapacityThresholds; type MaxContributionsPerUser = ConstU32<256>; - type MaxEvaluationsPerUser = ConstU32<256>; + type MaxEvaluationsPerProject = ConstU32<2048>; + type MaxEvaluationsPerUser = ConstU32<16>; type MaxMessageSizeThresholds = MaxMessageSizeThresholds; type MaxProjectsToUpdateInsertionAttempts = ConstU32<100>; - type MaxProjectsToUpdatePerBlock = ConstU32<100>; + type MaxProjectsToUpdatePerBlock = ConstU32<1>; type Multiplier = pallet_funding::types::Multiplier; type NativeCurrency = Balances; type PalletId = FundingPalletId;