From f7d441d9e56a0eecff2c75947519edff70953bf9 Mon Sep 17 00:00:00 2001 From: Gonza Montiel Date: Wed, 8 Oct 2025 23:16:34 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20=20add=20collective=20preco?= =?UTF-8?q?mpile=20(#204)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Add Collective Precompile Adds the pallet collective precompile to `mainnet`, `stagenet`, and `testnet` according to Moonbeam's configuration. ### Changes: - Added `pallet-evm-precompile-collective` dependency to workspace - Configured collective precompile at address `2064` using `TreasuryCouncilInstanc` - Configured collective precompile at address `2068` using `TechnicalCommitteeInstance` The precompile provides EVM access to collective governance functionality including proposal execution, voting, and membership management. --------- Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com> --- operator/Cargo.lock | 1007 +++++++++-------- operator/Cargo.toml | 3 +- operator/precompiles/collective/Cargo.toml | 50 + .../precompiles/collective/Collective.sol | 137 +++ operator/precompiles/collective/src/lib.rs | 366 ++++++ operator/precompiles/collective/src/mock.rs | 384 +++++++ operator/precompiles/collective/src/tests.rs | 685 +++++++++++ operator/runtime/mainnet/Cargo.toml | 6 +- operator/runtime/mainnet/src/configs/mod.rs | 16 +- operator/runtime/mainnet/src/precompiles.rs | 12 + operator/runtime/stagenet/Cargo.toml | 6 +- operator/runtime/stagenet/src/configs/mod.rs | 16 +- operator/runtime/stagenet/src/precompiles.rs | 12 + operator/runtime/testnet/Cargo.toml | 6 +- operator/runtime/testnet/src/configs/mod.rs | 16 +- operator/runtime/testnet/src/precompiles.rs | 12 + 16 files changed, 2234 insertions(+), 500 deletions(-) create mode 100644 operator/precompiles/collective/Cargo.toml create mode 100644 operator/precompiles/collective/Collective.sol create mode 100644 operator/precompiles/collective/src/lib.rs create mode 100644 operator/precompiles/collective/src/mock.rs create mode 100644 operator/precompiles/collective/src/tests.rs diff --git a/operator/Cargo.lock b/operator/Cargo.lock index f4f4c26d..d6e3380f 100644 --- a/operator/Cargo.lock +++ b/operator/Cargo.lock @@ -23,11 +23,11 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.24.2" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" dependencies = [ - "gimli 0.31.1", + "gimli 0.32.3", ] [[package]] @@ -154,7 +154,7 @@ dependencies = [ "derive_more 2.0.1", "foldhash 0.1.5", "hashbrown 0.15.5", - "indexmap 2.11.0", + "indexmap 2.11.4", "itoa", "k256", "keccak-asm", @@ -201,7 +201,7 @@ dependencies = [ "alloy-sol-macro-input", "const-hex", "heck 0.5.0", - "indexmap 2.11.0", + "indexmap 2.11.4", "proc-macro-error2", "proc-macro2", "quote", @@ -281,9 +281,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] name = "anstyle-parse" @@ -316,9 +316,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.99" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "approx" @@ -421,6 +421,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ark-ff" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" +dependencies = [ + "ark-ff-asm 0.5.0", + "ark-ff-macros 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "arrayvec 0.7.6", + "digest 0.10.7", + "educe", + "itertools 0.13.0", + "num-bigint", + "num-traits", + "paste", + "zeroize", +] + [[package]] name = "ark-ff-asm" version = "0.3.0" @@ -441,6 +461,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-ff-asm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" +dependencies = [ + "quote", + "syn 2.0.106", +] + [[package]] name = "ark-ff-macros" version = "0.3.0" @@ -466,6 +496,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-ff-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "ark-poly" version = "0.4.2" @@ -501,6 +544,18 @@ dependencies = [ "num-bigint", ] +[[package]] +name = "ark-serialize" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" +dependencies = [ + "ark-std 0.5.0", + "arrayvec 0.7.6", + "digest 0.10.7", + "num-bigint", +] + [[package]] name = "ark-serialize-derive" version = "0.4.2" @@ -532,6 +587,16 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "ark-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + [[package]] name = "array-bytes" version = "6.2.3" @@ -587,7 +652,7 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror 2.0.16", + "thiserror 2.0.17", "time", ] @@ -694,9 +759,9 @@ dependencies = [ [[package]] name = "async-fs" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f7e37c0ed80b2a977691c47dae8625cfb21e205827106c64f7c588766b2e50" +checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5" dependencies = [ "async-lock 3.4.1", "blocking", @@ -711,7 +776,7 @@ checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel 2.5.0", "async-executor", - "async-io 2.5.0", + "async-io 2.6.0", "async-lock 3.4.1", "blocking", "futures-lite 2.6.1", @@ -740,20 +805,20 @@ dependencies = [ [[package]] name = "async-io" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19634d6336019ef220f09fd31168ce5c184b295cbf80345437cc36094ef223ca" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" dependencies = [ - "async-lock 3.4.1", + "autocfg", "cfg-if", "concurrent-queue", "futures-io", "futures-lite 2.6.1", "parking", - "polling 3.10.0", - "rustix 1.0.8", + "polling 3.11.0", + "rustix 1.1.2", "slab", - "windows-sys 0.60.2", + "windows-sys 0.61.1", ] [[package]] @@ -793,7 +858,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" dependencies = [ - "async-io 2.5.0", + "async-io 2.6.0", "blocking", "futures-lite 2.6.1", ] @@ -817,12 +882,12 @@ dependencies = [ [[package]] name = "async-process" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65daa13722ad51e6ab1a1b9c01299142bc75135b337923cfa10e79bbbd669f00" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" dependencies = [ "async-channel 2.5.0", - "async-io 2.5.0", + "async-io 2.6.0", "async-lock 3.4.1", "async-signal", "async-task", @@ -830,25 +895,25 @@ dependencies = [ "cfg-if", "event-listener 5.4.1", "futures-lite 2.6.1", - "rustix 1.0.8", + "rustix 1.1.2", ] [[package]] name = "async-signal" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f567af260ef69e1d52c2b560ce0ea230763e6fbb9214a85d768760a920e3e3c1" +checksum = "43c070bbf59cd3570b6b2dd54cd772527c7c3620fce8be898406dd3ed6adc64c" dependencies = [ - "async-io 2.5.0", + "async-io 2.6.0", "async-lock 3.4.1", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 1.0.8", + "rustix 1.1.2", "signal-hook-registry", "slab", - "windows-sys 0.60.2", + "windows-sys 0.61.1", ] [[package]] @@ -859,7 +924,7 @@ checksum = "2c8e079a4ab67ae52b7403632e4618815d6db36d2a010cfe41b02c1b1578f93b" dependencies = [ "async-channel 1.9.0", "async-global-executor", - "async-io 2.5.0", + "async-io 2.6.0", "async-lock 3.4.1", "crossbeam-utils", "futures-channel", @@ -958,17 +1023,17 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "backtrace" -version = "0.3.75" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" dependencies = [ - "addr2line 0.24.2", + "addr2line 0.25.1", "cfg-if", "libc", "miniz_oxide", - "object 0.36.7", + "object 0.37.3", "rustc-demangle", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -983,6 +1048,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base256emoji" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e9430d9a245a77c92176e649af6e275f20839a48389859d1661e9a128d077c" +dependencies = [ + "const-str", + "match-lookup", +] + [[package]] name = "base58" version = "0.2.0" @@ -1097,7 +1172,7 @@ dependencies = [ "bitflags 2.9.4", "cexpr", "clang-sys", - "itertools 0.12.1", + "itertools 0.13.0", "proc-macro2", "quote", "regex", @@ -1468,7 +1543,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" dependencies = [ "memchr", - "regex-automata 0.4.10", + "regex-automata", "serde", ] @@ -1542,11 +1617,11 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.12" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0b03af37dad7a14518b7691d81acb0f8222604ad3d1b02f6b4bed5188c0cd5" +checksum = "276a59bf2b2c967788139340c9f0c5b12d7fd6630315c15c217e559de85d2609" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -1566,7 +1641,7 @@ checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" dependencies = [ "camino", "cargo-platform", - "semver 1.0.26", + "semver 1.0.27", "serde", "serde_json", "thiserror 1.0.69", @@ -1580,9 +1655,9 @@ checksum = "fd6c0e7b807d60291f42f33f58480c0bfafe28ed08286446f45e463728cf9c1c" [[package]] name = "cc" -version = "1.2.36" +version = "1.2.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5252b3d2648e5eedbc1a6f501e3c795e07025c1e93bbf8bbdd6eef7f447a6d54" +checksum = "e1354349954c6fc9cb0deab020f27f783cf0b604e8bb754dc4658ecf0d29c35f" dependencies = [ "find-msvc-tools", "jobserver", @@ -1676,7 +1751,7 @@ dependencies = [ "js-sys", "num-traits", "wasm-bindgen", - "windows-link 0.2.0", + "windows-link", ] [[package]] @@ -1737,9 +1812,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.47" +version = "4.5.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eac00902d9d136acd712710d71823fb8ac8004ca445a89e73a41d45aa712931" +checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae" dependencies = [ "clap_builder", "clap_derive", @@ -1747,9 +1822,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.47" +version = "4.5.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ad9bbf750e73b5884fb8a211a9424a1906c1e156724260fdae972f31d70e1d6" +checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9" dependencies = [ "anstream", "anstyle", @@ -1816,9 +1891,9 @@ dependencies = [ [[package]] name = "comfy-table" -version = "7.2.0" +version = "7.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f8e18d0dca9578507f13f9803add0df13362b02c501c1c17734f0dbb52eaf0b" +checksum = "b03b7db8e0b4b2fdad6c551e634134e99ec000e5c8c3b6856c65e8bbaded7a3b" dependencies = [ "unicode-segmentation", "unicode-width", @@ -1854,15 +1929,14 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dccd746bf9b1038c0507b7cec21eb2b11222db96a2902c96e8c185d6d20fb9c4" +checksum = "b6407bff74dea37e0fa3dc1c1c974e5d46405f0c987bf9997a0762adce71eda6" dependencies = [ "cfg-if", "cpufeatures", - "hex", "proptest", - "serde", + "serde_core", ] [[package]] @@ -1891,6 +1965,12 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "const-str" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f421161cb492475f1661ddc9815a745a1c894592070661180fdec3d4872e9c3" + [[package]] name = "const_format" version = "0.2.34" @@ -2650,11 +2730,12 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.179" +version = "1.0.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b04ade63e106c145cdcd3482932299c2dcd36b15f1d5c596c06edf365966fe" +checksum = "4e9c4fe7f2f5dc5c62871a1b43992d197da6fa1394656a94276ac2894a90a6fe" dependencies = [ "cc", + "cxx-build", "cxxbridge-cmd", "cxxbridge-flags", "cxxbridge-macro", @@ -2664,13 +2745,13 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.179" +version = "1.0.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba16a03d510b0e52be1952831ae1656e3ac9f6ac0c293a7b261670a0c7ff3b54" +checksum = "b5cf2909d37d80633ddd208676fc27c2608a7f035fff69c882421168038b26dd" dependencies = [ "cc", "codespan-reporting", - "indexmap 2.11.0", + "indexmap 2.11.4", "proc-macro2", "quote", "scratch", @@ -2679,13 +2760,13 @@ dependencies = [ [[package]] name = "cxxbridge-cmd" -version = "1.0.179" +version = "1.0.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c3aefd0d58a2df90cd67fe2eccdf7fb6e6905e9886ae5feb2258ce0dec23063" +checksum = "077f5ee3d3bfd8d27f83208fdaa96ddd50af7f096c77077cc4b94da10bfacefd" dependencies = [ "clap", "codespan-reporting", - "indexmap 2.11.0", + "indexmap 2.11.4", "proc-macro2", "quote", "syn 2.0.106", @@ -2693,17 +2774,17 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.179" +version = "1.0.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b735d976ca632f9e94b9de9b0ab8283de65e2641e7ae9d5abc3e6b467ea6673" +checksum = "b0108748615125b9f2e915dfafdffcbdabbca9b15102834f6d7e9a768f2f2864" [[package]] name = "cxxbridge-macro" -version = "1.0.179" +version = "1.0.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42fffb686dc0b7bab364ee41fcf5a04c295c7e7a5f07cd38155c1c3bda437666" +checksum = "e6e896681ef9b8dc462cfa6961d61909704bde0984b30bcb4082fe102b478890" dependencies = [ - "indexmap 2.11.0", + "indexmap 2.11.4", "proc-macro2", "quote", "rustversion", @@ -2816,7 +2897,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d162beedaa69905488a8da94f5ac3edb4dd4788b732fadb7bd120b2625c1976" dependencies = [ "data-encoding", - "syn 1.0.109", + "syn 2.0.106", ] [[package]] @@ -2862,6 +2943,7 @@ dependencies = [ "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", "pallet-evm-precompile-call-permit", + "pallet-evm-precompile-collective", "pallet-evm-precompile-file-system", "pallet-evm-precompile-identity", "pallet-evm-precompile-modexp", @@ -3141,6 +3223,7 @@ dependencies = [ "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", "pallet-evm-precompile-call-permit", + "pallet-evm-precompile-collective", "pallet-evm-precompile-file-system", "pallet-evm-precompile-identity", "pallet-evm-precompile-modexp", @@ -3284,6 +3367,7 @@ dependencies = [ "pallet-evm-precompile-blake2", "pallet-evm-precompile-bn128", "pallet-evm-precompile-call-permit", + "pallet-evm-precompile-collective", "pallet-evm-precompile-file-system", "pallet-evm-precompile-identity", "pallet-evm-precompile-modexp", @@ -3425,9 +3509,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d630bccd429a5bb5a64b5e94f693bfc48c9f8566418fda4c494cc94f911f87cc" +checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" dependencies = [ "powerfmt", ] @@ -3846,6 +3930,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "either" version = "1.15.0" @@ -3905,6 +4001,26 @@ dependencies = [ "syn 2.0.106", ] +[[package]] +name = "enum-ordinalize" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.106", +] + [[package]] name = "enumflags2" version = "0.7.12" @@ -3963,12 +4079,12 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.1", ] [[package]] @@ -4221,8 +4337,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb42427514b063d97ce21d5199f36c0c307d981434a6be32582bc79fe5bd2303" dependencies = [ "expander", - "indexmap 2.11.0", - "proc-macro-crate 3.3.0", + "indexmap 2.11.4", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -4486,9 +4602,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fd99930f64d146689264c637b5af2f0233a933bef0d8570e2526bf9e083192d" +checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959" [[package]] name = "finito" @@ -4809,7 +4925,7 @@ name = "frame-election-provider-solution-type" version = "14.0.2" source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-stable2412-6#bbc435c7667d3283ba280a8fec44676357392753" dependencies = [ - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -4969,7 +5085,7 @@ version = "13.0.1" source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-stable2412-6#bbc435c7667d3283ba280a8fec44676357392753" dependencies = [ "frame-support-procedural-tools-derive", - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -5279,20 +5395,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "generator" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "605183a538e3e2a9c1038635cc5c2d194e2ee8fd0d1b66b8349fad7dbacce5a2" -dependencies = [ - "cc", - "cfg-if", - "libc", - "log", - "rustversion", - "windows 0.61.3", -] - [[package]] name = "generic-array" version = "0.12.4" @@ -5346,7 +5448,7 @@ dependencies = [ "js-sys", "libc", "r-efi", - "wasi 0.14.4+wasi-0.2.4", + "wasi 0.14.7+wasi-0.2.4", "wasm-bindgen", ] @@ -5393,9 +5495,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.31.1" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" [[package]] name = "glob" @@ -5458,7 +5560,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.11.0", + "indexmap 2.11.4", "slab", "tokio", "tokio-util", @@ -5477,7 +5579,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.3.1", - "indexmap 2.11.0", + "indexmap 2.11.4", "slab", "tokio", "tokio-util", @@ -5551,6 +5653,12 @@ dependencies = [ "serde", ] +[[package]] +name = "hashbrown" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" + [[package]] name = "hashlink" version = "0.8.4" @@ -5592,9 +5700,6 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] [[package]] name = "hex-conservative" @@ -5632,7 +5737,7 @@ dependencies = [ "once_cell", "rand 0.9.2", "ring 0.17.14", - "thiserror 2.0.16", + "thiserror 2.0.17", "tinyvec", "tokio", "tracing", @@ -5655,7 +5760,7 @@ dependencies = [ "rand 0.9.2", "resolv-conf", "smallvec", - "thiserror 2.0.16", + "thiserror 2.0.17", "tokio", "tracing", ] @@ -5769,9 +5874,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b112acc8b3adf4b107a8ec20977da0273a8c386765a3ec0229bd500a1443f9f" +checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" [[package]] name = "hyper" @@ -5846,20 +5951,20 @@ dependencies = [ "hyper 1.7.0", "hyper-util", "log", - "rustls 0.23.31", + "rustls 0.23.32", "rustls-native-certs 0.8.1", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.2", + "tokio-rustls 0.26.4", "tower-service", "webpki-roots 1.0.2", ] [[package]] name = "hyper-util" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9b05277c7e8da2c93a568989bb6207bef0112e8d17df7a6eda4a3cf143bc5e" +checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" dependencies = [ "base64 0.22.1", "bytes", @@ -5881,9 +5986,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.63" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -5891,7 +5996,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.61.2", + "windows-core 0.62.1", ] [[package]] @@ -6053,7 +6158,7 @@ version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdf9d64cfcf380606e64f9a0bcf493616b65331199f984151a6fa11a7b3cde38" dependencies = [ - "async-io 2.5.0", + "async-io 2.6.0", "core-foundation 0.9.4", "fnv", "futures", @@ -6067,7 +6172,7 @@ dependencies = [ "rtnetlink", "system-configuration", "tokio", - "windows 0.53.0", + "windows", ] [[package]] @@ -6188,13 +6293,14 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.11.0" +version = "2.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2481980430f9f78649238835720ddccc57e52df14ffce1c6f37391d61b563e9" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", - "hashbrown 0.15.5", + "hashbrown 0.16.0", "serde", + "serde_core", ] [[package]] @@ -6339,6 +6445,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.14.0" @@ -6402,9 +6517,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.78" +version = "0.3.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0b063578492ceec17683ef2f8c5e89121fbd0b172cbc280635ab7567db2738" +checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305" dependencies = [ "once_cell", "wasm-bindgen", @@ -6480,13 +6595,13 @@ dependencies = [ "http 1.3.1", "jsonrpsee-core 0.23.2", "pin-project", - "rustls 0.23.31", + "rustls 0.23.32", "rustls-pki-types", "rustls-platform-verifier 0.3.4", "soketto 0.8.1", "thiserror 1.0.69", "tokio", - "tokio-rustls 0.26.2", + "tokio-rustls 0.26.4", "tokio-util", "tracing", "url", @@ -6503,13 +6618,13 @@ dependencies = [ "http 1.3.1", "jsonrpsee-core 0.24.9", "pin-project", - "rustls 0.23.31", + "rustls 0.23.32", "rustls-pki-types", "rustls-platform-verifier 0.5.3", "soketto 0.8.1", "thiserror 1.0.69", "tokio", - "tokio-rustls 0.26.2", + "tokio-rustls 0.26.4", "tokio-util", "tracing", "url", @@ -6613,7 +6728,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e65763c942dfc9358146571911b0cd1c361c2d63e2d2305622d40d36376ca80" dependencies = [ "heck 0.5.0", - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -6864,18 +6979,18 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.175" +version = "0.2.176" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" +checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" [[package]] name = "libloading" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-targets 0.53.3", + "windows-link", ] [[package]] @@ -7025,7 +7140,7 @@ dependencies = [ "quick-protobuf", "rand 0.8.5", "sha2 0.10.9", - "thiserror 2.0.16", + "thiserror 2.0.17", "tracing", "zeroize", ] @@ -7320,9 +7435,9 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" +checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" dependencies = [ "bitflags 2.9.4", "libc", @@ -7469,9 +7584,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "linux-raw-sys" -version = "0.9.4" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "lioness" @@ -7505,7 +7620,7 @@ dependencies = [ "futures", "futures-timer", "hickory-resolver", - "indexmap 2.11.0", + "indexmap 2.11.4", "libc", "mockall 0.13.1", "multiaddr 0.17.1", @@ -7522,7 +7637,7 @@ dependencies = [ "smallvec", "snow", "socket2 0.5.10", - "thiserror 2.0.16", + "thiserror 2.0.17", "tokio", "tokio-stream", "tokio-tungstenite", @@ -7533,7 +7648,7 @@ dependencies = [ "url", "x25519-dalek", "x509-parser 0.17.0", - "yamux 0.13.6", + "yamux 0.13.7", "yasna", "zeroize", ] @@ -7557,19 +7672,6 @@ dependencies = [ "value-bag", ] -[[package]] -name = "loom" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" -dependencies = [ - "cfg-if", - "generator", - "scoped-tls", - "tracing", - "tracing-subscriber", -] - [[package]] name = "lru" version = "0.11.1" @@ -7688,12 +7790,23 @@ dependencies = [ ] [[package]] -name = "matchers" -version = "0.1.0" +name = "match-lookup" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "1265724d8cb29dbbc2b0f06fffb8bf1a8c0cf73a78eede9ba73a4a66c52a981e" dependencies = [ - "regex-automata 0.1.10", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", ] [[package]] @@ -7724,9 +7837,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.5" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "memfd" @@ -7734,7 +7847,7 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad38eb12aea514a0466ea40a80fd8cc83637065948eb4a426e4aa46261175227" dependencies = [ - "rustix 1.0.8", + "rustix 1.1.2", ] [[package]] @@ -7955,20 +8068,19 @@ dependencies = [ [[package]] name = "moka" -version = "0.12.10" +version = "0.12.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9321642ca94a4282428e6ea4af8cc2ca4eac48ac7a6a4ea8f33f76d0ce70926" +checksum = "8261cd88c312e0004c1d51baad2980c66528dfdb2bee62003e643a4d8f86b077" dependencies = [ "crossbeam-channel", "crossbeam-epoch", "crossbeam-utils", - "loom", + "equivalent", "parking_lot 0.12.4", "portable-atomic", "rustc_version 0.4.1", "smallvec", "tagptr", - "thiserror 1.0.69", "uuid", ] @@ -8012,11 +8124,12 @@ dependencies = [ [[package]] name = "multibase" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b3539ec3c1f04ac9748a260728e855f261b4977f5c3406612c884564f329404" +checksum = "8694bb4835f452b0e3bb06dbebb1d6fc5385b6ca1caf2e55fd165c042390ec77" dependencies = [ "base-x", + "base256emoji", "data-encoding", "data-encoding-macro", ] @@ -8180,7 +8293,7 @@ dependencies = [ "log", "netlink-packet-core", "netlink-sys", - "thiserror 2.0.16", + "thiserror 2.0.17", ] [[package]] @@ -8204,7 +8317,7 @@ checksum = "07709a6d4eba90ab10ec170a0530b3aafc81cb8a2d380e4423ae41fc55fe5745" dependencies = [ "cc", "libc", - "thiserror 2.0.16", + "thiserror 2.0.17", "winapi", ] @@ -8285,12 +8398,11 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" [[package]] name = "nu-ansi-term" -version = "0.46.0" +version = "0.50.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" dependencies = [ - "overload", - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -8409,7 +8521,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -8438,9 +8550,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.7" +version = "0.37.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" dependencies = [ "memchr", ] @@ -8525,9 +8637,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-src" -version = "300.5.2+3.5.2" +version = "300.5.3+3.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d270b79e2926f5150189d475bc7e9d2c69f9c4697b185fa917d5a32b792d21b4" +checksum = "dc6bad8cd0233b63971e232cc9c5e83039375b8586d2312f31fda85db8f888c2" dependencies = [ "cc", ] @@ -8575,10 +8687,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43dfaf083aef571385fccfdc3a2f8ede8d0a1863160455d4f2b014d8f7d04a3f" dependencies = [ "expander", - "indexmap 2.11.0", + "indexmap 2.11.4", "itertools 0.11.0", "petgraph 0.6.5", - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 1.0.109", @@ -8593,12 +8705,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "pallet-asset-conversion" version = "21.1.0" @@ -9084,6 +9190,28 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-evm-precompile-collective" +version = "0.1.0" +dependencies = [ + "evm", + "fp-evm", + "frame-support", + "frame-system", + "pallet-balances", + "pallet-collective", + "pallet-evm", + "pallet-timestamp", + "pallet-treasury", + "parity-scale-codec", + "precompile-utils", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-evm-precompile-file-system" version = "0.1.0" @@ -10014,7 +10142,7 @@ version = "3.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34b4653168b563151153c9e4c08ebed57fb8262bebfa79711552fa983c623e7a" dependencies = [ - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -10145,20 +10273,20 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pest" -version = "2.8.1" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323" +checksum = "21e0a3a33733faeaf8651dfee72dd0f388f0c8e5ad496a3478fa5a922f49cfa8" dependencies = [ "memchr", - "thiserror 2.0.16", + "thiserror 2.0.17", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.8.1" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb056d9e8ea77922845ec74a1c4e8fb17e7c218cc4fc11a15c5d25e189aa40bc" +checksum = "bc58706f770acb1dbd0973e6530a3cff4746fb721207feb3a8a6064cd0b6c663" dependencies = [ "pest", "pest_generator", @@ -10166,9 +10294,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.8.1" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e404e638f781eb3202dc82db6760c8ae8a1eeef7fb3fa8264b2ef280504966" +checksum = "6d4f36811dfe07f7b8573462465d5cb8965fffc2e71ae377a33aecf14c2c9a2f" dependencies = [ "pest", "pest_meta", @@ -10179,9 +10307,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.8.1" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd1101f170f5903fde0914f899bb503d9ff5271d7ba76bbb70bea63690cc0d5" +checksum = "42919b05089acbd0a5dcd5405fb304d17d1053847b81163d09c4ad18ce8e8420" dependencies = [ "pest", "sha2 0.10.9", @@ -10194,7 +10322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset 0.4.2", - "indexmap 2.11.0", + "indexmap 2.11.4", ] [[package]] @@ -10204,23 +10332,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" dependencies = [ "fixedbitset 0.5.7", - "indexmap 2.11.0", + "indexmap 2.11.4", ] [[package]] name = "phf" -version = "0.11.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" dependencies = [ "phf_shared", + "serde", ] [[package]] name = "phf_shared" -version = "0.11.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" dependencies = [ "siphasher 1.0.1", ] @@ -10447,7 +10576,7 @@ dependencies = [ "fatality", "futures", "futures-timer", - "indexmap 2.11.0", + "indexmap 2.11.4", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -11375,7 +11504,7 @@ dependencies = [ "fatality", "futures", "futures-timer", - "indexmap 2.11.0", + "indexmap 2.11.4", "parity-scale-codec", "polkadot-node-network-protocol", "polkadot-node-primitives", @@ -11500,16 +11629,16 @@ dependencies = [ [[package]] name = "polling" -version = "3.10.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5bd19146350fe804f7cb2669c851c03d69da628803dab0d98018142aaa5d829" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" dependencies = [ "cfg-if", "concurrent-queue", "hermit-abi 0.5.2", "pin-project-lite", - "rustix 1.0.8", - "windows-sys 0.60.2", + "rustix 1.1.2", + "windows-sys 0.61.1", ] [[package]] @@ -11543,9 +11672,9 @@ checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" [[package]] name = "postgres-protocol" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ff0abab4a9b844b93ef7b81f1efc0a366062aaef2cd702c76256b5dc075c54" +checksum = "fbef655056b916eb868048276cfd5d6a7dea4f81560dfd047f97c8c6fe3fcfd4" dependencies = [ "base64 0.22.1", "byteorder", @@ -11561,9 +11690,9 @@ dependencies = [ [[package]] name = "postgres-types" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613283563cd90e1dfc3518d548caee47e0e725455ed619881f5cf21f36de4b48" +checksum = "77a120daaabfcb0e324d5bf6e411e9222994cb3795c79943a0ef28ed27ea76e4" dependencies = [ "bytes", "fallible-iterator 0.2.0", @@ -11596,11 +11725,12 @@ dependencies = [ [[package]] name = "pq-sys" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfd6cf44cca8f9624bc19df234fc4112873432f5fda1caff174527846d026fa9" +checksum = "412a4cb9e93795c0594dab7c1c4ec1c8b42b514e1baf6e9f63d14aa376e5bd04" dependencies = [ "libc", + "pkg-config", "vcpkg", ] @@ -11773,11 +11903,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" +checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" dependencies = [ - "toml_edit", + "toml_edit 0.23.6", ] [[package]] @@ -11896,9 +12026,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fcdab19deb5195a31cf7726a210015ff1496ba1464fd42cb4f537b8b01b471f" +checksum = "2bb0be07becd10686a0bb407298fb425360a5c44a663774406340c59a22de4ce" dependencies = [ "bit-set", "bit-vec", @@ -11908,7 +12038,7 @@ dependencies = [ "rand 0.9.2", "rand_chacha 0.9.0", "rand_xorshift", - "regex-syntax 0.8.6", + "regex-syntax", "rusty-fork", "tempfile", "unarray", @@ -12101,9 +12231,9 @@ dependencies = [ "quinn-proto 0.11.13", "quinn-udp 0.5.14", "rustc-hash 2.1.1", - "rustls 0.23.31", + "rustls 0.23.32", "socket2 0.6.0", - "thiserror 2.0.16", + "thiserror 2.0.17", "tokio", "tracing", "web-time", @@ -12138,10 +12268,10 @@ dependencies = [ "rand 0.9.2", "ring 0.17.14", "rustc-hash 2.1.1", - "rustls 0.23.31", + "rustls 0.23.32", "rustls-pki-types", "slab", - "thiserror 2.0.16", + "thiserror 2.0.17", "tinyvec", "tracing", "web-time", @@ -12176,9 +12306,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" dependencies = [ "proc-macro2", ] @@ -12389,18 +12519,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2", "quote", @@ -12449,42 +12579,27 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.2" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" +checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.10", - "regex-syntax 0.8.6", + "regex-automata", + "regex-syntax", ] [[package]] name = "regex-automata" -version = "0.1.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" +checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.6", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.6" @@ -12512,14 +12627,14 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn 0.11.9", - "rustls 0.23.31", + "rustls 0.23.32", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", "tokio", - "tokio-rustls 0.26.2", + "tokio-rustls 0.26.4", "tokio-util", "tower 0.5.2", "tower-http 0.6.6", @@ -12534,9 +12649,9 @@ dependencies = [ [[package]] name = "resolv-conf" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95325155c684b1c89f7765e30bc1c42e4a6da51ca513615660cb8a62ef9a88e3" +checksum = "6b3789b30bd25ba102de4beabd95d21ac45b69b1be7d14522bab988c526d6799" [[package]] name = "rfc6979" @@ -12675,13 +12790,14 @@ dependencies = [ [[package]] name = "ruint" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecb38f82477f20c5c3d62ef52d7c4e536e38ea9b73fb570a20c5cae0e14bcf6" +checksum = "a68df0380e5c9d20ce49534f292a36a7514ae21350726efe1865bdb1fa91d278" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", "ark-ff 0.4.2", + "ark-ff 0.5.0", "bytes", "fastrlp 0.3.1", "fastrlp 0.4.0", @@ -12695,7 +12811,7 @@ dependencies = [ "rand 0.9.2", "rlp 0.5.2", "ruint-macro", - "serde", + "serde_core", "valuable", "zeroize", ] @@ -12745,7 +12861,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.26", + "semver 1.0.27", ] [[package]] @@ -12800,15 +12916,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.8" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ "bitflags 2.9.4", "errno", "libc", - "linux-raw-sys 0.9.4", - "windows-sys 0.60.2", + "linux-raw-sys 0.11.0", + "windows-sys 0.61.1", ] [[package]] @@ -12839,15 +12955,15 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.31" +version = "0.23.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ebcbd2f03de0fc1122ad9bb24b127a5a6cd51d72604a3f3c50ac459762b6cc" +checksum = "cd3c25631629d034ce7cd9940adc9d45762d46de2b0f57193c4443b92c6d4d40" dependencies = [ "log", "once_cell", "ring 0.17.14", "rustls-pki-types", - "rustls-webpki 0.103.4", + "rustls-webpki 0.103.7", "subtle 2.6.1", "zeroize", ] @@ -12886,7 +13002,7 @@ dependencies = [ "openssl-probe", "rustls-pki-types", "schannel", - "security-framework 3.4.0", + "security-framework 3.5.1", ] [[package]] @@ -12928,7 +13044,7 @@ dependencies = [ "jni 0.19.0", "log", "once_cell", - "rustls 0.23.31", + "rustls 0.23.32", "rustls-native-certs 0.7.3", "rustls-platform-verifier-android", "rustls-webpki 0.102.8", @@ -12949,11 +13065,11 @@ dependencies = [ "jni 0.21.1", "log", "once_cell", - "rustls 0.23.31", + "rustls 0.23.32", "rustls-native-certs 0.8.1", "rustls-platform-verifier-android", - "rustls-webpki 0.103.4", - "security-framework 3.4.0", + "rustls-webpki 0.103.7", + "security-framework 3.5.1", "security-framework-sys", "webpki-root-certs 0.26.11", "windows-sys 0.59.0", @@ -12988,9 +13104,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.4" +version = "0.103.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc" +checksum = "e10b3f4191e8a80e6b43eebabfac91e5dcecebb27a71f04e820c47ec41d314bf" dependencies = [ "ring 0.17.14", "rustls-pki-types", @@ -13182,7 +13298,7 @@ name = "sc-chain-spec-derive" version = "12.0.0" source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-stable2412-6#bbc435c7667d3283ba280a8fec44676357392753" dependencies = [ - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -13911,7 +14027,7 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.4", "rand 0.8.5", - "rustls 0.23.31", + "rustls 0.23.32", "sc-client-api", "sc-network", "sc-network-common", @@ -14226,7 +14342,7 @@ name = "sc-tracing-proc-macro" version = "11.0.0" source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-stable2412-6#bbc435c7667d3283ba280a8fec44676357392753" dependencies = [ - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -14240,7 +14356,7 @@ dependencies = [ "async-trait", "futures", "futures-timer", - "indexmap 2.11.0", + "indexmap 2.11.4", "itertools 0.11.0", "linked-hash-map", "log", @@ -14354,7 +14470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef2618f123c88da9cd8853b69d766068f1eddc7692146d7dfe9b89e25ce2efd" dependencies = [ "darling 0.20.11", - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -14380,7 +14496,7 @@ version = "2.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6630024bf739e2179b91fb424b28898baf819414262c5d376677dbff1fe7ebf" dependencies = [ - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -14432,11 +14548,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.1", ] [[package]] @@ -14494,12 +14610,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - [[package]] name = "scopeguard" version = "1.2.0" @@ -14607,9 +14717,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "3.4.0" +version = "3.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b369d18893388b345804dc0007963c99b7d665ae71d275812d828c6f089640" +checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef" dependencies = [ "bitflags 2.9.4", "core-foundation 0.10.1", @@ -14648,11 +14758,12 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" dependencies = [ "serde", + "serde_core", ] [[package]] @@ -14678,10 +14789,11 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ + "serde_core", "serde_derive", ] @@ -14696,18 +14808,28 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.17" +version = "0.11.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8437fd221bde2d4ca316d61b90e337e9e702b3820b87d63caa9ba6c02bd06d96" +checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" dependencies = [ "serde", + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -14716,14 +14838,15 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.143" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ "itoa", "memchr", "ryu", "serde", + "serde_core", ] [[package]] @@ -14737,11 +14860,11 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83" +checksum = "5417783452c2be558477e104686f7de5dae53dba813c28435e0e70f82d9b04ee" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -15562,11 +15685,11 @@ checksum = "a33bd3e260892199c3ccfc487c88b2da2265080acb316cd920da72fdfd7c599f" dependencies = [ "async-channel 2.5.0", "async-executor", - "async-fs 2.1.3", - "async-io 2.5.0", + "async-fs 2.2.0", + "async-io 2.6.0", "async-lock 3.4.1", "async-net 2.0.0", - "async-process 2.4.0", + "async-process 2.5.0", "blocking", "futures-lite 2.6.1", ] @@ -16352,7 +16475,7 @@ dependencies = [ "Inflector", "blake2 0.10.6", "expander", - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -16850,7 +16973,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-stable dependencies = [ "Inflector", "expander", - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -17143,7 +17266,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap 2.11.0", + "indexmap 2.11.4", "log", "memchr", "native-tls", @@ -17734,8 +17857,8 @@ dependencies = [ "lazy-regex", "log", "pin-project", - "rustls 0.23.31", - "thiserror 2.0.16", + "rustls 0.23.32", + "thiserror 2.0.17", ] [[package]] @@ -17851,15 +17974,15 @@ checksum = "1ac9aa371f599d22256307c24a9d748c041e548cbf599f35d890f9d365361790" [[package]] name = "tempfile" -version = "3.21.0" +version = "3.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15b61f8f20e3a6f7e0649d825294eaf317edce30f82cf6026e7e4cb9222a7d1e" +checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ "fastrand 2.3.0", "getrandom 0.3.3", "once_cell", - "rustix 1.0.8", - "windows-sys 0.60.2", + "rustix 1.1.2", + "windows-sys 0.61.1", ] [[package]] @@ -17877,7 +18000,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0" dependencies = [ - "rustix 1.0.8", + "rustix 1.1.2", "windows-sys 0.60.2", ] @@ -17898,11 +18021,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.16" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ - "thiserror-impl 2.0.16", + "thiserror-impl 2.0.17", ] [[package]] @@ -17938,9 +18061,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.16" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", @@ -17994,11 +18117,12 @@ dependencies = [ [[package]] name = "time" -version = "0.3.43" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83bde6f1ec10e72d583d91623c939f623002284ef622b87de38cfd546cbf2031" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" dependencies = [ "deranged", + "itoa", "num-conv", "powerfmt", "serde", @@ -18089,9 +18213,9 @@ dependencies = [ [[package]] name = "tokio-postgres" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c95d533c83082bb6490e0189acaa0bbeef9084e60471b696ca6988cd0541fb0" +checksum = "a156efe7fff213168257853e1dfde202eed5f487522cbbbf7d219941d753d853" dependencies = [ "async-trait", "byteorder", @@ -18107,7 +18231,7 @@ dependencies = [ "postgres-protocol", "postgres-types", "rand 0.9.2", - "socket2 0.5.10", + "socket2 0.6.0", "tokio", "tokio-util", "whoami", @@ -18136,11 +18260,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.2" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" dependencies = [ - "rustls 0.23.31", + "rustls 0.23.32", "tokio", ] @@ -18164,11 +18288,11 @@ checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" dependencies = [ "futures-util", "log", - "rustls 0.23.31", + "rustls 0.23.32", "rustls-native-certs 0.8.1", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.2", + "tokio-rustls 0.26.4", "tungstenite", ] @@ -18204,19 +18328,19 @@ dependencies = [ "serde", "serde_spanned 0.6.9", "toml_datetime 0.6.11", - "toml_edit", + "toml_edit 0.22.27", ] [[package]] name = "toml" -version = "0.9.5" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8" +checksum = "00e5e5d9bf2475ac9d4f0d9edab68cc573dc2fd644b0dba36b0c30a92dd9eaa0" dependencies = [ - "indexmap 2.11.0", - "serde", - "serde_spanned 1.0.0", - "toml_datetime 0.7.0", + "indexmap 2.11.4", + "serde_core", + "serde_spanned 1.0.2", + "toml_datetime 0.7.2", "toml_parser", "toml_writer", "winnow", @@ -18233,11 +18357,11 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3" +checksum = "32f1085dec27c2b6632b04c80b3bb1b4300d6495d1e129693bdda7d91e72eec1" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -18246,7 +18370,7 @@ version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ - "indexmap 2.11.0", + "indexmap 2.11.4", "serde", "serde_spanned 0.6.9", "toml_datetime 0.6.11", @@ -18255,10 +18379,22 @@ dependencies = [ ] [[package]] -name = "toml_parser" -version = "1.0.2" +name = "toml_edit" +version = "0.23.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10" +checksum = "f3effe7c0e86fdff4f69cdd2ccc1b96f933e24811c5441d44904e8683e27184b" +dependencies = [ + "indexmap 2.11.4", + "toml_datetime 0.7.2", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cf893c33be71572e0e9aa6dd15e6677937abd686b066eac3f8cd3531688a627" dependencies = [ "winnow", ] @@ -18271,9 +18407,9 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" [[package]] name = "toml_writer" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64" +checksum = "d163a63c116ce562a22cda521fcc4d79152e7aba014456fb5eb442f6d6a10109" [[package]] name = "tower" @@ -18411,7 +18547,7 @@ version = "5.0.0" source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-stable2412-6#bbc435c7667d3283ba280a8fec44676357392753" dependencies = [ "expander", - "proc-macro-crate 3.3.0", + "proc-macro-crate 3.4.0", "proc-macro2", "quote", "syn 2.0.106", @@ -18430,15 +18566,15 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" dependencies = [ "matchers", "nu-ansi-term", "once_cell", "parking_lot 0.12.4", - "regex", + "regex-automata", "sharded-slab", "smallvec", "thread_local", @@ -18562,9 +18698,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trybuild" -version = "1.0.110" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e257d7246e7a9fd015fb0b28b330a8d4142151a33f03e6a497754f4b1f6a8e" +checksum = "0ded9fdb81f30a5708920310bfcd9ea7482ff9cba5f54601f7a19a877d5c2392" dependencies = [ "dissimilar", "glob", @@ -18573,7 +18709,7 @@ dependencies = [ "serde_json", "target-triple", "termcolor", - "toml 0.9.5", + "toml 0.9.7", ] [[package]] @@ -18594,10 +18730,10 @@ dependencies = [ "httparse", "log", "rand 0.9.2", - "rustls 0.23.31", + "rustls 0.23.32", "rustls-pki-types", "sha1", - "thiserror 2.0.16", + "thiserror 2.0.17", "url", "utf-8", ] @@ -18622,9 +18758,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "ucd-trie" @@ -18676,9 +18812,9 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" [[package]] name = "unicode-normalization" @@ -18904,9 +19040,18 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasi" -version = "0.14.4+wasi-0.2.4" +version = "0.14.7+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a5f4a424faf49c3c2c344f166f0662341d470ea185e939657aaff130f0ec4a" +checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" +dependencies = [ + "wasip2", +] + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ "wit-bindgen", ] @@ -18928,9 +19073,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.101" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e14915cadd45b529bb8d1f343c4ed0ac1de926144b746e2710f9cd05df6603b" +checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d" dependencies = [ "cfg-if", "once_cell", @@ -18941,9 +19086,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.101" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28d1ba982ca7923fd01448d5c30c6864d0a14109560296a162f80f305fb93bb" +checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19" dependencies = [ "bumpalo", "log", @@ -18955,9 +19100,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.51" +version = "0.4.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca85039a9b469b38336411d6d6ced91f3fc87109a2a27b0c197663f5144dffe" +checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c" dependencies = [ "cfg-if", "js-sys", @@ -18968,9 +19113,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.101" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3d463ae3eff775b0c45df9da45d68837702ac35af998361e2c84e7c5ec1b0d" +checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -18978,9 +19123,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.101" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bb4ce89b08211f923caf51d527662b75bdc9c9c7aab40f86dcb9fb85ac552aa" +checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7" dependencies = [ "proc-macro2", "quote", @@ -18991,9 +19136,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.101" +version = "0.2.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f143854a3b13752c6950862c906306adb27c7e839f7414cec8fea35beab624c1" +checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1" dependencies = [ "unicode-ident", ] @@ -19322,9 +19467,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.78" +version = "0.3.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77e4b637749ff0d92b8fad63aa1f7cff3cbe125fd49c175cd6345e7272638b12" +checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120" dependencies = [ "js-sys", "wasm-bindgen", @@ -19431,7 +19576,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.0", + "windows-sys 0.61.1", ] [[package]] @@ -19450,28 +19595,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows" -version = "0.61.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" -dependencies = [ - "windows-collections", - "windows-core 0.61.2", - "windows-future", - "windows-link 0.1.3", - "windows-numerics", -] - -[[package]] -name = "windows-collections" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" -dependencies = [ - "windows-core 0.61.2", -] - [[package]] name = "windows-core" version = "0.53.0" @@ -19484,33 +19607,22 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.61.2" +version = "0.62.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +checksum = "6844ee5416b285084d3d3fffd743b925a6c9385455f64f6d4fa3031c4c2749a9" dependencies = [ "windows-implement", "windows-interface", - "windows-link 0.1.3", - "windows-result 0.3.4", + "windows-link", + "windows-result 0.4.0", "windows-strings", ] -[[package]] -name = "windows-future" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", - "windows-threading", -] - [[package]] name = "windows-implement" -version = "0.60.0" +version = "0.60.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +checksum = "edb307e42a74fb6de9bf3a02d9712678b22399c87e6fa869d6dfcd8c1b7754e0" dependencies = [ "proc-macro2", "quote", @@ -19519,37 +19631,21 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.59.1" +version = "0.59.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +checksum = "c0abd1ddbc6964ac14db11c7213d6532ef34bd9aa042c2e5935f59d7908b46a5" dependencies = [ "proc-macro2", "quote", "syn 2.0.106", ] -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - [[package]] name = "windows-link" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" -[[package]] -name = "windows-numerics" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", -] - [[package]] name = "windows-result" version = "0.1.2" @@ -19561,20 +19657,20 @@ dependencies = [ [[package]] name = "windows-result" -version = "0.3.4" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +checksum = "7084dcc306f89883455a206237404d3eaf961e5bd7e0f312f7c91f57eb44167f" dependencies = [ - "windows-link 0.1.3", + "windows-link", ] [[package]] name = "windows-strings" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +checksum = "7218c655a553b0bed4426cf54b20d7ba363ef543b52d515b3e48d7fd55318dda" dependencies = [ - "windows-link 0.1.3", + "windows-link", ] [[package]] @@ -19619,16 +19715,16 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.3", + "windows-targets 0.53.4", ] [[package]] name = "windows-sys" -version = "0.61.0" +version = "0.61.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa" +checksum = "6f109e41dd4a3c848907eb83d5a42ea98b3769495597450cf6d153507b166f0f" dependencies = [ - "windows-link 0.2.0", + "windows-link", ] [[package]] @@ -19679,11 +19775,11 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.3" +version = "0.53.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" +checksum = "2d42b7b7f66d2a06854650af09cfdf8713e427a439c97ad65a6375318033ac4b" dependencies = [ - "windows-link 0.1.3", + "windows-link", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", @@ -19694,15 +19790,6 @@ dependencies = [ "windows_x86_64_msvc 0.53.0", ] -[[package]] -name = "windows-threading" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" -dependencies = [ - "windows-link 0.1.3", -] - [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -19904,9 +19991,9 @@ dependencies = [ [[package]] name = "wit-bindgen" -version = "0.45.1" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c573471f125075647d03df72e026074b7203790d41351cd6edc96f46bcccd36" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" [[package]] name = "writeable" @@ -19965,7 +20052,7 @@ dependencies = [ "nom", "oid-registry 0.8.1", "rusticata-macros", - "thiserror 2.0.16", + "thiserror 2.0.17", "time", ] @@ -20026,9 +20113,9 @@ dependencies = [ [[package]] name = "yamux" -version = "0.13.6" +version = "0.13.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2dd50a6d6115feb3e5d7d0efd45e8ca364b6c83722c1e9c602f5764e0e9597" +checksum = "6927cfe0edfae4b26a369df6bad49cd0ef088c0ec48f4045b2084bcaedc10246" dependencies = [ "futures", "log", @@ -20128,9 +20215,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" dependencies = [ "zeroize_derive", ] diff --git a/operator/Cargo.toml b/operator/Cargo.toml index 51951775..28386f1a 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -35,9 +35,10 @@ pallet-datahaven-native-transfer = { path = "./pallets/datahaven-native-transfer pallet-evm-precompile-balances-erc20 = { path = "./precompiles/erc20-balances", default-features = false } pallet-evm-precompile-batch = { path = "./precompiles/batch", default-features = false } pallet-evm-precompile-call-permit = { path = "./precompiles/call-permit", default-features = false } +pallet-evm-precompile-collective = { path = "./precompiles/collective", default-features = false } +pallet-evm-precompile-identity = { path = "./precompiles/identity", default-features = false } pallet-evm-precompile-proxy = { path = "./precompiles/proxy", default-features = false } pallet-evm-precompile-registry = { path = "./precompiles/precompile-registry", default-features = false } -pallet-evm-precompile-identity = { path = "./precompiles/identity", default-features = false } # Crates.io (wasm) alloy-core = { version = "0.8.15", default-features = false } diff --git a/operator/precompiles/collective/Cargo.toml b/operator/precompiles/collective/Cargo.toml new file mode 100644 index 00000000..bf241777 --- /dev/null +++ b/operator/precompiles/collective/Cargo.toml @@ -0,0 +1,50 @@ +[package] +name = "pallet-evm-precompile-collective" +authors = { workspace = true } +description = "A Precompile wrapping the collective pallet." +edition = "2021" +version = "0.1.0" + +[dependencies] +# Substrate +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-collective = { workspace = true } +parity-scale-codec = { workspace = true, features = ["max-encoded-len"] } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } + +# Frontier +evm = { workspace = true, features = ["with-codec"] } +fp-evm = { workspace = true } +pallet-evm = { workspace = true, features = ["forbid-evm-reentrancy"] } +precompile-utils = { workspace = true } + +[dev-dependencies] +#similar-asserts = { workspace = true } + +pallet-balances = { workspace = true, features = ["std"] } +pallet-timestamp = { workspace = true, features = ["std"] } +pallet-treasury = { workspace = true, features = ["std"] } +parity-scale-codec = { workspace = true, features = ["max-encoded-len"] } +precompile-utils = { workspace = true, features = ["std", "testing"] } +scale-info = { workspace = true, features = ["derive", "std"] } +sp-runtime = { workspace = true, features = ["std"] } + +[features] +default = ["std"] +std = [ + "fp-evm/std", + "frame-support/std", + "frame-system/std", + "pallet-collective/std", + "pallet-evm/std", + "parity-scale-codec/std", + "precompile-utils/std", + "sp-core/std", + "sp-io/std", + "sp-std/std", +] +runtime-benchmarks = [] diff --git a/operator/precompiles/collective/Collective.sol b/operator/precompiles/collective/Collective.sol new file mode 100644 index 00000000..f879d6b8 --- /dev/null +++ b/operator/precompiles/collective/Collective.sol @@ -0,0 +1,137 @@ +// SPDX-License-Identifier: GPL-3.0-only +pragma solidity >=0.8.3; + +/// @dev The Collective Council contract's address. +address constant COLLECTIVE_COUNCIL_ADDRESS = 0x000000000000000000000000000000000000080e; +/// @dev The Collective Technical Committee contract's address. +address constant COLLECTIVE_TECHNICAL_ADDRESS = 0x000000000000000000000000000000000000080F; +/// @dev The Collective Treasury Council contract's address. +address constant COLLECTIVE_TREASURY_ADDRESS = 0x0000000000000000000000000000000000000810; + +/// @dev The Collective Council contract's instance. +Collective constant COLLECTIVE_COUNCIL_CONTRACT = Collective( + COLLECTIVE_COUNCIL_ADDRESS +); +/// @dev The Collective Technical Committee contract's instance. +Collective constant COLLECTIVE_TECHNICAL_CONTRACT = Collective( + COLLECTIVE_TECHNICAL_ADDRESS +); +/// @dev The Collective Treasury Council contract's instance. +Collective constant COLLECTIVE_TREASURY_CONTRACT = Collective( + COLLECTIVE_TREASURY_ADDRESS +); + +/// @title Collective precompile +/// Allows to interact with Substrate pallet_collective from the EVM. +/// Addresses: +/// - 0x000000000000000000000000000000000000080e: Council +/// - 0x000000000000000000000000000000000000080f: Technical Committee +/// - 0x0000000000000000000000000000000000000810: Treasury Council. +interface Collective { + /// @dev Execute a proposal as a single member of the collective. + /// The sender must be a member of the collective. + /// This will NOT revert if the Substrate proposal is dispatched but fails ! + /// + /// @param proposal SCALE-encoded Substrate call. + /// + /// @custom:selector 09c5eabe + function execute(bytes memory proposal) external; + + /// @dev Make a proposal for a call. + /// The sender must be a member of the collective. + /// If the threshold is less than 2 then the proposal will be dispatched + /// directly from the group of one member of the collective. + /// + /// @param threshold Amount of members required to dispatch the proposal. + /// @param proposal SCALE-encoded Substrate call. + /// @return index Index of the new proposal. Meaningless if threshold < 2 + /// + /// @custom:selector c57f3260 + function propose(uint32 threshold, bytes memory proposal) + external + returns (uint32 index); + + /// @dev Vote for a proposal. + /// The sender must be a member of the collective. + /// + /// @param proposalHash Hash of the proposal to vote for. Ensure the caller knows what they're + /// voting in case of front-running or reorgs. + /// @param proposalIndex Index of the proposal (returned by propose). + /// @param approve The vote itself, is the caller approving or not the proposal. + /// + /// @custom:selector 73e37688 + function vote( + bytes32 proposalHash, + uint32 proposalIndex, + bool approve + ) external; + + /// @dev Close a proposal. + /// Can be called by anyone once there is enough votes. + /// Reverts if called at a non appropriate time. + /// + /// @param proposalHash Hash of the proposal to close. + /// @param proposalIndex Index of the proposal. + /// @param proposalWeightBound Maximum amount of Substrate weight the proposal can use. + /// This call will revert if the proposal call would use more. + /// @param lengthBound Must be a value higher or equal to the length of the SCALE-encoded + /// proposal in bytes. + /// @return executed Was the proposal executed or removed? + /// + /// @custom:selector 638d9d47 + function close( + bytes32 proposalHash, + uint32 proposalIndex, + uint64 proposalWeightBound, + uint32 lengthBound + ) external returns (bool executed); + + /// @dev Compute the hash of a proposal. + /// + /// @param proposal SCALE-encoded Substrate call. + /// @return proposalHash Hash of the proposal. + /// + /// @custom:selector fc379417 + function proposalHash(bytes memory proposal) + external + view + returns (bytes32 proposalHash); + + /// @dev Get the hashes of active proposals. + /// + /// @return proposalsHash Hashes of active proposals. + /// + /// @custom:selector 55ef20e6 + function proposals() external view returns (bytes32[] memory proposalsHash); + + /// @dev Get the list of members. + /// + /// @return members List of members. + /// + /// @custom:selector bdd4d18d + function members() external view returns (address[] memory members); + + /// @dev Check if the given account is a member of the collective. + /// + /// @param account Account to check membership. + /// + /// @custom:selector a230c524 + function isMember(address account) external view returns (bool); + + /// @dev Get the prime account if there is one. + /// + /// @return prime Prime account of 0x00..00 if None. + /// + /// @custom:selector c7ee005e + function prime() external view returns (address prime); + + event Executed(bytes32 indexed proposalHash); + event Proposed( + address indexed who, + uint32 indexed proposalIndex, + bytes32 indexed proposalHash, + uint32 threshold + ); + event Voted(address indexed who, bytes32 indexed proposalHash, bool voted); + event Closed(bytes32 indexed proposalHash); +} diff --git a/operator/precompiles/collective/src/lib.rs b/operator/precompiles/collective/src/lib.rs new file mode 100644 index 00000000..8132f5ac --- /dev/null +++ b/operator/precompiles/collective/src/lib.rs @@ -0,0 +1,366 @@ +// Copyright 2019-2025 PureStake Inc. +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +//! Precompile to interact with pallet_collective instances. + +#![cfg_attr(not(feature = "std"), no_std)] + +use core::marker::PhantomData; +use fp_evm::Log; +use frame_support::{ + dispatch::{GetDispatchInfo, Pays, PostDispatchInfo}, + sp_runtime::traits::Hash, + traits::ConstU32, + weights::Weight, +}; +use pallet_evm::AddressMapping; +use parity_scale_codec::DecodeLimit as _; +use precompile_utils::prelude::*; +use sp_core::{Decode, Get, H160, H256}; +use sp_runtime::traits::Dispatchable; +use sp_std::{boxed::Box, vec::Vec}; + +#[cfg(test)] +mod mock; +#[cfg(test)] +mod tests; + +/// System account size in bytes = Pallet_Name_Hash (16) + Storage_name_hash (16) + +/// Blake2_128Concat (16) + AccountId (20) + AccountInfo (4 + 12 + AccountData (4* 16)) = 148 +pub const SYSTEM_ACCOUNT_SIZE: u64 = 148; + +/// Proposal max proof size in bytes. See: +/// moonbeam/blob/dd3e2b69f847dd74f6116b965fe7e2d97c3c7eb5/primitives/xcm/src/ethereum_xcm.rs#L27-L33 +pub const PROPOSAL_MAX_PROOF_SIZE: u64 = 256 * 1024; + +/// Solidity selector of the Executed log. +pub const SELECTOR_LOG_EXECUTED: [u8; 32] = keccak256!("Executed(bytes32)"); + +/// Solidity selector of the Proposed log. +pub const SELECTOR_LOG_PROPOSED: [u8; 32] = keccak256!("Proposed(address,uint32,bytes32,uint32)"); + +/// Solidity selector of the Voted log. +pub const SELECTOR_LOG_VOTED: [u8; 32] = keccak256!("Voted(address,bytes32,bool)"); + +/// Solidity selector of the Closed log. +pub const SELECTOR_LOG_CLOSED: [u8; 32] = keccak256!("Closed(bytes32)"); + +pub fn log_executed(address: impl Into, hash: H256) -> Log { + log2(address.into(), SELECTOR_LOG_EXECUTED, hash, Vec::new()) +} + +pub fn log_proposed( + address: impl Into, + who: impl Into, + index: u32, + hash: H256, + threshold: u32, +) -> Log { + log4( + address.into(), + SELECTOR_LOG_PROPOSED, + who.into(), + H256::from_slice(&solidity::encode_arguments(index)), + hash, + solidity::encode_arguments(threshold), + ) +} + +pub fn log_voted(address: impl Into, who: impl Into, hash: H256, voted: bool) -> Log { + log3( + address.into(), + SELECTOR_LOG_VOTED, + who.into(), + hash, + solidity::encode_arguments(voted), + ) +} + +pub fn log_closed(address: impl Into, hash: H256) -> Log { + log2(address.into(), SELECTOR_LOG_CLOSED, hash, Vec::new()) +} + +type GetProposalLimit = ConstU32<{ 2u32.pow(16) }>; +type DecodeLimit = ConstU32<8>; + +pub struct CollectivePrecompile(PhantomData<(Runtime, Instance)>); + +#[precompile_utils::precompile] +impl CollectivePrecompile +where + Instance: 'static, + Runtime: pallet_collective::Config + pallet_evm::Config, + Runtime::RuntimeCall: Dispatchable + GetDispatchInfo + Decode, + Runtime::RuntimeCall: From>, + >::Proposal: From, + ::RuntimeOrigin: From>, + Runtime::AccountId: Into, + H256: From<::Hash> + + Into<::Hash>, + ::AddressMapping: AddressMapping, +{ + #[precompile::public("execute(bytes)")] + fn execute( + handle: &mut impl PrecompileHandle, + proposal: BoundedBytes, + ) -> EvmResult { + let proposal: Vec<_> = proposal.into(); + let proposal_hash: H256 = hash::(&proposal); + + let log = log_executed(handle.context().address, proposal_hash); + handle.record_log_costs(&[&log])?; + + let proposal_length: u32 = proposal.len().try_into().map_err(|_| { + RevertReason::value_is_too_large("uint32") + .in_field("length") + .in_field("proposal") + })?; + + let proposal = + Runtime::RuntimeCall::decode_with_depth_limit(DecodeLimit::get(), &mut &*proposal) + .map_err(|_| { + RevertReason::custom("Failed to decode proposal").in_field("proposal") + })? + .into(); + let proposal = Box::new(proposal); + + let origin = Runtime::AddressMapping::into_account_id(handle.context().caller); + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + pallet_collective::Call::::execute { + proposal, + length_bound: proposal_length, + }, + SYSTEM_ACCOUNT_SIZE, + )?; + + log.record(handle)?; + + Ok(()) + } + + #[precompile::public("propose(uint32,bytes)")] + fn propose( + handle: &mut impl PrecompileHandle, + threshold: u32, + proposal: BoundedBytes, + ) -> EvmResult { + // ProposalCount + handle.record_db_read::(4)?; + + let proposal: Vec<_> = proposal.into(); + let proposal_length: u32 = proposal.len().try_into().map_err(|_| { + RevertReason::value_is_too_large("uint32") + .in_field("length") + .in_field("proposal") + })?; + + let proposal_index = pallet_collective::ProposalCount::::get(); + let proposal_hash: H256 = hash::(&proposal); + + // In pallet_collective a threshold < 2 means the proposal has been + // executed directly. + let log = if threshold < 2 { + log_executed(handle.context().address, proposal_hash) + } else { + log_proposed( + handle.context().address, + handle.context().caller, + proposal_index, + proposal_hash, + threshold, + ) + }; + + handle.record_log_costs(&[&log])?; + + let proposal = + Runtime::RuntimeCall::decode_with_depth_limit(DecodeLimit::get(), &mut &*proposal) + .map_err(|_| { + RevertReason::custom("Failed to decode proposal").in_field("proposal") + })? + .into(); + let proposal = Box::new(proposal); + + { + let origin = Runtime::AddressMapping::into_account_id(handle.context().caller); + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + pallet_collective::Call::::propose { + threshold, + proposal, + length_bound: proposal_length, + }, + SYSTEM_ACCOUNT_SIZE, + )?; + } + + log.record(handle)?; + + Ok(proposal_index) + } + + #[precompile::public("vote(bytes32,uint32,bool)")] + fn vote( + handle: &mut impl PrecompileHandle, + proposal_hash: H256, + proposal_index: u32, + approve: bool, + ) -> EvmResult { + // TODO: Since we cannot access ayes/nays of a proposal we cannot + // include it in the EVM events to mirror Substrate events. + let log = log_voted( + handle.context().address, + handle.context().caller, + proposal_hash, + approve, + ); + handle.record_log_costs(&[&log])?; + + let origin = Runtime::AddressMapping::into_account_id(handle.context().caller); + RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + pallet_collective::Call::::vote { + proposal: proposal_hash.into(), + index: proposal_index, + approve, + }, + SYSTEM_ACCOUNT_SIZE, + )?; + + log.record(handle)?; + + Ok(()) + } + + #[precompile::public("close(bytes32,uint32,uint64,uint32)")] + fn close( + handle: &mut impl PrecompileHandle, + proposal_hash: H256, + proposal_index: u32, + proposal_weight_bound: u64, + length_bound: u32, + ) -> EvmResult { + // Because the actual log cannot be built before dispatch, we manually + // record it first (`executed` and `closed` have the same cost). + handle.record_log_costs_manual(2, 0)?; + + let origin = Runtime::AddressMapping::into_account_id(handle.context().caller); + let post_dispatch_info = RuntimeHelper::::try_dispatch( + handle, + Some(origin).into(), + pallet_collective::Call::::close { + proposal_hash: proposal_hash.into(), + index: proposal_index, + proposal_weight_bound: Weight::from_parts( + proposal_weight_bound, + PROPOSAL_MAX_PROOF_SIZE, + ), + length_bound, + }, + SYSTEM_ACCOUNT_SIZE, + )?; + + // We can know if the proposal was executed or not based on the `pays_fee` in + // `PostDispatchInfo`. + let (executed, log) = match post_dispatch_info.pays_fee { + Pays::Yes => (true, log_executed(handle.context().address, proposal_hash)), + Pays::No => (false, log_closed(handle.context().address, proposal_hash)), + }; + log.record(handle)?; + + Ok(executed) + } + + #[precompile::public("proposalHash(bytes)")] + #[precompile::view] + fn proposal_hash( + _handle: &mut impl PrecompileHandle, + proposal: BoundedBytes, + ) -> EvmResult { + let proposal: Vec<_> = proposal.into(); + let hash = hash::(&proposal); + + Ok(hash) + } + + #[precompile::public("proposals()")] + #[precompile::view] + fn proposals(handle: &mut impl PrecompileHandle) -> EvmResult> { + // Proposals: BoundedVec(32 * MaxProposals) + handle.record_db_read::( + 32 * (>::MaxProposals::get() as usize), + )?; + + let proposals = pallet_collective::Proposals::::get(); + let proposals: Vec<_> = proposals.into_iter().map(|hash| hash.into()).collect(); + + Ok(proposals) + } + + #[precompile::public("members()")] + #[precompile::view] + fn members(handle: &mut impl PrecompileHandle) -> EvmResult> { + // Members: Vec(20 * MaxMembers) + handle.record_db_read::( + 20 * (>::MaxProposals::get() as usize), + )?; + + let members = pallet_collective::Members::::get(); + let members: Vec<_> = members.into_iter().map(|id| Address(id.into())).collect(); + + Ok(members) + } + + #[precompile::public("isMember(address)")] + #[precompile::view] + fn is_member(handle: &mut impl PrecompileHandle, account: Address) -> EvmResult { + // Members: Vec(20 * MaxMembers) + handle.record_db_read::( + 20 * (>::MaxProposals::get() as usize), + )?; + + let account = Runtime::AddressMapping::into_account_id(account.into()); + + let is_member = pallet_collective::Pallet::::is_member(&account); + + Ok(is_member) + } + + #[precompile::public("prime()")] + #[precompile::view] + fn prime(handle: &mut impl PrecompileHandle) -> EvmResult
{ + // Prime + handle.record_db_read::(20)?; + + let prime = pallet_collective::Prime::::get() + .map(|prime| prime.into()) + .unwrap_or(H160::zero()); + + Ok(Address(prime)) + } +} + +pub fn hash(data: &[u8]) -> H256 +where + Runtime: frame_system::Config, + H256: From<::Hash>, +{ + ::Hashing::hash(data).into() +} diff --git a/operator/precompiles/collective/src/mock.rs b/operator/precompiles/collective/src/mock.rs new file mode 100644 index 00000000..6705d921 --- /dev/null +++ b/operator/precompiles/collective/src/mock.rs @@ -0,0 +1,384 @@ +// Copyright 2019-2025 PureStake Inc. +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +//! Test utilities +use super::*; +use frame_support::traits::tokens::{PayFromAccount, UnityAssetBalanceConversion}; +use frame_support::{ + construct_runtime, parameter_types, + traits::{ConstU128, Everything, MapSuccess, OnFinalize, OnInitialize}, + PalletId, +}; +use frame_system::{pallet_prelude::BlockNumberFor, EnsureRoot}; +use pallet_evm::{ + EnsureAddressNever, EnsureAddressRoot, FrameSystemAccountProvider, SubstrateBlockHashMapping, +}; +use precompile_utils::{ + precompile_set::*, + testing::{Bob, Charlie, MockAccount}, +}; +use sp_core::{H256, U256}; +use sp_io; +use sp_runtime::{ + traits::{BlakeTwo256, IdentityLookup, Replace}, + BuildStorage, Permill, +}; + +#[cfg(feature = "runtime-benchmarks")] +use pallet_treasury::ArgumentsFactory; + +pub type AccountId = MockAccount; +pub type Balance = u128; +pub type BlockNumber = BlockNumberFor; + +type Block = frame_system::mocking::MockBlockU32; + +// Configure a mock runtime to test the pallet. +construct_runtime!( + pub enum Runtime { + System: frame_system, + Balances: pallet_balances, + Evm: pallet_evm, + Timestamp: pallet_timestamp, + Treasury: pallet_treasury, + CouncilCollective: + pallet_collective::, + } +); + +parameter_types! { + pub const BlockHashCount: u32 = 250; + pub const SS58Prefix: u8 = 42; +} +impl frame_system::Config for Runtime { + type BaseCallFilter = Everything; + type DbWeight = (); + type RuntimeOrigin = RuntimeOrigin; + type RuntimeTask = RuntimeTask; + type Nonce = u64; + type Block = Block; + type RuntimeCall = RuntimeCall; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type BlockWeights = (); + type BlockLength = (); + type SS58Prefix = SS58Prefix; + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + type SingleBlockMigrations = (); + type MultiBlockMigrator = (); + type PreInherents = (); + type PostInherents = (); + type PostTransactions = (); + type ExtensionsWeightInfo = (); +} + +parameter_types! { + pub const ExistentialDeposit: u128 = 0; +} + +impl pallet_balances::Config for Runtime { + type MaxReserves = (); + type ReserveIdentifier = (); + type MaxLocks = (); + type Balance = Balance; + type RuntimeEvent = RuntimeEvent; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); + type RuntimeHoldReason = (); + type FreezeIdentifier = (); + type MaxFreezes = (); + type RuntimeFreezeReason = (); + type DoneSlashHandler = (); +} + +pub type Precompiles = PrecompileSetBuilder< + R, + (PrecompileAt, CollectivePrecompile>,), +>; + +pub type PCall = CollectivePrecompileCall; + +const MAX_POV_SIZE: u64 = 5 * 1024 * 1024; +/// Block storage limit in bytes. Set to 40 KB. +const BLOCK_STORAGE_LIMIT: u64 = 40 * 1024; + +parameter_types! { + pub BlockGasLimit: U256 = U256::from(u64::MAX); + pub PrecompilesValue: Precompiles = Precompiles::new(); + pub const WeightPerGas: Weight = Weight::from_parts(1, 0); + pub GasLimitPovSizeRatio: u64 = { + let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64(); + block_gas_limit.saturating_div(MAX_POV_SIZE) + }; + pub GasLimitStorageGrowthRatio : u64 = { + let block_gas_limit = BlockGasLimit::get().min(u64::MAX.into()).low_u64(); + block_gas_limit.saturating_div(BLOCK_STORAGE_LIMIT) + }; +} + +impl pallet_evm::Config for Runtime { + type FeeCalculator = (); + type GasWeightMapping = pallet_evm::FixedGasWeightMapping; + type WeightPerGas = WeightPerGas; + type CallOrigin = EnsureAddressRoot; + type WithdrawOrigin = EnsureAddressNever; + type AddressMapping = AccountId; + type Currency = Balances; + type RuntimeEvent = RuntimeEvent; + type Runner = pallet_evm::runner::stack::Runner; + type PrecompilesType = Precompiles; + type PrecompilesValue = PrecompilesValue; + type ChainId = (); + type OnChargeTransaction = (); + type BlockGasLimit = BlockGasLimit; + type BlockHashMapping = SubstrateBlockHashMapping; + type FindAuthor = (); + type OnCreate = (); + type GasLimitPovSizeRatio = GasLimitPovSizeRatio; + type GasLimitStorageGrowthRatio = GasLimitStorageGrowthRatio; + type Timestamp = Timestamp; + type WeightInfo = pallet_evm::weights::SubstrateWeight; + type AccountProvider = FrameSystemAccountProvider; +} + +parameter_types! { + pub const MinimumPeriod: u64 = 5; +} +impl pallet_timestamp::Config for Runtime { + type Moment = u64; + type OnTimestampSet = (); + type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); +} + +parameter_types! { + pub const LaunchPeriod: BlockNumber = 10; + pub const VotingPeriod: BlockNumber = 10; + pub const VoteLockingPeriod: BlockNumber = 10; + pub const FastTrackVotingPeriod: BlockNumber = 5; + pub const EnactmentPeriod: BlockNumber = 10; + pub const CooloffPeriod: BlockNumber = 10; + pub const MinimumDeposit: Balance = 10; + pub const MaxVotes: u32 = 10; + pub const MaxProposals: u32 = 10; + pub const PreimageByteDeposit: Balance = 10; + pub const InstantAllowed: bool = false; +} + +parameter_types! { + pub const ProposalBond: Permill = Permill::from_percent(5); + pub const TreasuryId: PalletId = PalletId(*b"pc/trsry"); + pub TreasuryAccount: AccountId = Treasury::account_id(); +} + +#[cfg(feature = "runtime-benchmarks")] +pub struct BenchmarkHelper; +#[cfg(feature = "runtime-benchmarks")] +impl ArgumentsFactory<(), AccountId> for BenchmarkHelper { + fn create_asset_kind(_seed: u32) -> () { + () + } + + fn create_beneficiary(seed: [u8; 32]) -> AccountId { + AccountId::from(H160::from(H256::from(seed))) + } +} + +impl pallet_treasury::Config for Runtime { + type PalletId = TreasuryId; + type Currency = Balances; + type RejectOrigin = frame_support::traits::NeverEnsureOrigin; + type RuntimeEvent = RuntimeEvent; + // If spending proposal rejected, transfer proposer bond to treasury + type SpendPeriod = ConstU32<1>; + type Burn = (); + type BurnDestination = (); + type MaxApprovals = ConstU32<100>; + type WeightInfo = pallet_treasury::weights::SubstrateWeight; + type SpendFunds = (); + type SpendOrigin = MapSuccess< + pallet_collective::EnsureProportionMoreThan, + Replace>, + >; + type AssetKind = (); + type Beneficiary = AccountId; + type BeneficiaryLookup = IdentityLookup; + type Paymaster = PayFromAccount; + type BalanceConverter = UnityAssetBalanceConversion; + type PayoutPeriod = ConstU32<0>; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = BenchmarkHelper; + type BlockNumberProvider = System; +} + +parameter_types! { + pub MaxProposalWeight: Weight = Weight::from_parts(1_000_000_000, 1_000_000_000); +} + +impl pallet_collective::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type RuntimeEvent = RuntimeEvent; + type Proposal = RuntimeCall; + /// The maximum amount of time (in blocks) for council members to vote on motions. + /// Motions may end in fewer blocks if enough votes are cast to determine the result. + type MotionDuration = ConstU32<2>; + /// The maximum number of Proposlas that can be open in the council at once. + type MaxProposals = ConstU32<100>; + /// The maximum number of council members. + type MaxMembers = ConstU32<100>; + type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; + type WeightInfo = pallet_collective::weights::SubstrateWeight; + type SetMembersOrigin = frame_system::EnsureRoot; + type MaxProposalWeight = MaxProposalWeight; + type KillOrigin = EnsureRoot; + type DisapproveOrigin = EnsureRoot; + type Consideration = (); +} + +/// Build test externalities, prepopulated with data for testing democracy precompiles +pub(crate) struct ExtBuilder { + /// Endowed accounts with balances + balances: Vec<(AccountId, Balance)>, + /// Collective members + collective: Vec, +} + +impl Default for ExtBuilder { + fn default() -> ExtBuilder { + ExtBuilder { + balances: vec![], + collective: vec![Bob.into(), Charlie.into()], + } + } +} + +impl ExtBuilder { + /// Fund some accounts before starting the test + #[allow(unused)] + pub(crate) fn with_balances(mut self, balances: Vec<(AccountId, Balance)>) -> Self { + self.balances = balances; + self + } + + /// Set members of the collective + #[allow(unused)] + pub(crate) fn with_collective(mut self, collective: Vec) -> Self { + self.collective = collective; + self + } + + /// Build the test externalities for use in tests + #[allow(unused)] + pub(crate) fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::::default() + .build_storage() + .expect("Frame system builds valid default genesis config"); + + pallet_balances::GenesisConfig:: { + balances: self.balances.clone(), + } + .assimilate_storage(&mut t) + .expect("Pallet balances storage can be assimilated"); + + pallet_collective::GenesisConfig:: { + members: self.collective.clone(), + phantom: Default::default(), + } + .assimilate_storage(&mut t) + .expect("Pallet collective storage can be assimilated"); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + System::set_block_number(1); + }); + ext + } +} + +#[allow(unused)] +pub(crate) fn roll_to(n: BlockNumber) { + // We skip timestamp's on_finalize because it requires that the timestamp inherent be set + // We may be able to simulate this by poking its storage directly, but I don't see any value + // added from doing that. + while System::block_number() < n { + Treasury::on_finalize(System::block_number()); + // Times tamp::on_finalize(System::block_number()); + Evm::on_finalize(System::block_number()); + Balances::on_finalize(System::block_number()); + System::on_finalize(System::block_number()); + + System::set_block_number(System::block_number() + 1); + + System::on_initialize(System::block_number()); + Balances::on_initialize(System::block_number()); + Evm::on_initialize(System::block_number()); + Timestamp::on_initialize(System::block_number()); + Treasury::on_initialize(System::block_number()); + } +} + +pub(crate) fn events() -> Vec { + System::events() + .into_iter() + .map(|r| r.event) + .collect::>() +} + +#[macro_export] +macro_rules! assert_tail_eq { + ($tail:expr, $arr:expr) => { + if $tail.len() != 0 { + // 0-length always passes + + if $tail.len() > $arr.len() { + similar_asserts::assert_eq!($tail, $arr); // will fail + } + + let len_diff = $arr.len() - $tail.len(); + similar_asserts::assert_eq!($tail, $arr[len_diff..]); + } + }; +} + +/// Panics if an event is not found in the system log of events +#[macro_export] +macro_rules! assert_event_emitted { + ($event:expr) => { + match &$event { + e => { + assert!( + crate::mock::events().iter().find(|x| *x == e).is_some(), + "Event {:?} was not found in events: \n {:#?}", + e, + crate::mock::events() + ); + } + } + }; +} diff --git a/operator/precompiles/collective/src/tests.rs b/operator/precompiles/collective/src/tests.rs new file mode 100644 index 00000000..8d594ce7 --- /dev/null +++ b/operator/precompiles/collective/src/tests.rs @@ -0,0 +1,685 @@ +// Copyright 2019-2025 PureStake Inc. +// This file is part of Moonbeam. + +// Moonbeam is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Moonbeam is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Moonbeam. If not, see . + +use crate::{ + assert_event_emitted, hash, log_closed, log_executed, log_proposed, log_voted, + mock::{ExtBuilder, PCall, Precompiles, PrecompilesValue, Runtime, RuntimeOrigin}, +}; +use frame_support::{assert_ok, instances::Instance1}; +use parity_scale_codec::Encode; +use precompile_utils::{solidity::codec::Address, testing::*}; +use sp_core::{H160, H256}; +use sp_runtime::DispatchError; + +fn precompiles() -> Precompiles { + PrecompilesValue::get() +} + +#[test] +fn test_solidity_interface_has_all_function_selectors_documented_and_implemented() { + check_precompile_implements_solidity_interfaces(&["Collective.sol"], PCall::supports_selector) +} + +#[test] +fn selector_less_than_four_bytes() { + ExtBuilder::default().build().execute_with(|| { + // This selector is only three bytes long when four are required. + precompiles() + .prepare_test(Alice, Precompile1, vec![1u8, 2u8, 3u8]) + .execute_reverts(|output| output == b"Tried to read selector out of bounds"); + }); +} + +#[test] +fn no_selector_exists_but_length_is_right() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test(Alice, Precompile1, vec![1u8, 2u8, 3u8, 4u8]) + .execute_reverts(|output| output == b"Unknown selector"); + }); +} + +#[test] +fn selectors() { + assert!(PCall::execute_selectors().contains(&0x09c5eabe)); + assert!(PCall::propose_selectors().contains(&0xc57f3260)); + assert!(PCall::vote_selectors().contains(&0x73e37688)); + assert!(PCall::close_selectors().contains(&0x638d9d47)); + assert!(PCall::proposal_hash_selectors().contains(&0xfc379417)); + assert!(PCall::proposals_selectors().contains(&0x55ef20e6)); + assert!(PCall::members_selectors().contains(&0xbdd4d18d)); + assert!(PCall::is_member_selectors().contains(&0xa230c524)); + assert!(PCall::prime_selectors().contains(&0xc7ee005e)); +} + +#[test] +fn modifiers() { + ExtBuilder::default() + .with_balances(vec![(Alice.into(), 1000)]) + .build() + .execute_with(|| { + let mut tester = PrecompilesModifierTester::new(precompiles(), Alice, Precompile1); + + tester.test_default_modifier(PCall::execute_selectors()); + tester.test_default_modifier(PCall::propose_selectors()); + tester.test_default_modifier(PCall::vote_selectors()); + tester.test_default_modifier(PCall::close_selectors()); + tester.test_view_modifier(PCall::proposal_hash_selectors()); + tester.test_view_modifier(PCall::proposals_selectors()); + tester.test_view_modifier(PCall::members_selectors()); + tester.test_view_modifier(PCall::is_member_selectors()); + tester.test_view_modifier(PCall::prime_selectors()); + }); +} + +#[test] +fn non_member_cannot_propose() { + ExtBuilder::default().build().execute_with(|| { + let proposal = pallet_treasury::Call::::spend_local { + amount: 1, + beneficiary: Alice.into(), + }; + let proposal: ::RuntimeCall = proposal.into(); + let proposal = proposal.encode(); + + precompiles() + .prepare_test( + Alice, + Precompile1, + PCall::propose { + threshold: 1, + proposal: proposal.into(), + }, + ) + .expect_no_logs() + .execute_reverts(|output| output.ends_with(b"NotMember\") })")); + }); +} + +#[test] +fn non_member_cannot_vote() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test( + Alice, + Precompile1, + PCall::vote { + proposal_hash: H256::zero(), + proposal_index: 1, + approve: false, + }, + ) + .expect_no_logs() + .execute_reverts(|output| output.ends_with(b"NotMember\") })")); + }); +} + +#[test] +fn non_member_cannot_execute() { + ExtBuilder::default().build().execute_with(|| { + let proposal = pallet_treasury::Call::::spend_local { + amount: 1, + beneficiary: Alice.into(), + }; + let proposal: ::RuntimeCall = proposal.into(); + let proposal = proposal.encode(); + + precompiles() + .prepare_test( + Alice, + Precompile1, + PCall::execute { + proposal: proposal.into(), + }, + ) + .expect_no_logs() + .execute_reverts(|output| output.ends_with(b"NotMember\") })")); + }); +} + +#[test] +fn cannot_vote_for_unknown_proposal() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::vote { + proposal_hash: H256::zero(), + proposal_index: 1, + approve: false, + }, + ) + .expect_no_logs() + .execute_reverts(|output| output.ends_with(b"ProposalMissing\") })")); + }); +} + +#[test] +fn cannot_close_unknown_proposal() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::close { + proposal_hash: H256::zero(), + proposal_index: 1, + proposal_weight_bound: 0, + length_bound: 0, + }, + ) + .expect_no_logs() + .execute_reverts(|output| output.ends_with(b"ProposalMissing\") })")); + }); +} + +#[test] +fn member_can_make_instant_proposal() { + ExtBuilder::default().build().execute_with(|| { + let proposal = pallet_treasury::Call::::spend_local { + amount: 1, + beneficiary: Alice.into(), + }; + let proposal: ::RuntimeCall = proposal.into(); + let proposal = proposal.encode(); + let proposal_hash: H256 = hash::(&proposal); + + // Proposal is executed. The proposal call will itself fail but it + // still counts as a success according to pallet_collective. + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::propose { + threshold: 1, + proposal: proposal.into(), + }, + ) + .expect_log(log_executed(Precompile1, proposal_hash)) + .execute_returns(0u32); + + assert_event_emitted!(pallet_collective::Event::Executed { + proposal_hash, + result: Err(DispatchError::BadOrigin) + } + .into()); + }); +} + +#[test] +fn member_can_make_delayed_proposal() { + ExtBuilder::default().build().execute_with(|| { + let proposal = pallet_treasury::Call::::spend_local { + amount: 1, + beneficiary: Alice.into(), + }; + let proposal: ::RuntimeCall = proposal.into(); + let proposal = proposal.encode(); + let proposal_hash: H256 = hash::(&proposal); + + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::propose { + threshold: 2, + proposal: proposal.into(), + }, + ) + .expect_log(log_proposed(Precompile1, Bob, 0, proposal_hash, 2)) + .execute_returns(0u32); + + assert_event_emitted!(pallet_collective::Event::Proposed { + account: Bob.into(), + proposal_index: 0, + proposal_hash, + threshold: 2, + } + .into()); + }); +} + +#[test] +fn member_can_vote_on_proposal() { + ExtBuilder::default().build().execute_with(|| { + let proposal = pallet_treasury::Call::::spend_local { + amount: 1, + beneficiary: Alice.into(), + }; + let proposal: ::RuntimeCall = proposal.into(); + let proposal = proposal.encode(); + let proposal_hash: H256 = hash::(&proposal); + + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::propose { + threshold: 2, + proposal: proposal.into(), + }, + ) + .expect_log(log_proposed(Precompile1, Bob, 0, proposal_hash, 2)) + .execute_returns(0u32); + + precompiles() + .prepare_test( + Charlie, + Precompile1, + PCall::vote { + proposal_hash, + proposal_index: 0, + approve: true, + }, + ) + .expect_log(log_voted(Precompile1, Charlie, proposal_hash, true)) + .execute_returns(()); + + assert_event_emitted!(pallet_collective::Event::Voted { + account: Charlie.into(), + proposal_hash, + voted: true, + yes: 1, + no: 0, + } + .into()); + }); +} + +#[test] +fn cannot_close_if_not_enough_votes() { + ExtBuilder::default().build().execute_with(|| { + let proposal = pallet_treasury::Call::::spend_local { + amount: 1, + beneficiary: Alice.into(), + }; + let proposal: ::RuntimeCall = proposal.into(); + let proposal = proposal.encode(); + let proposal_hash: H256 = hash::(&proposal); + let length_bound = proposal.len() as u32; + + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::propose { + threshold: 2, + proposal: proposal.into(), + }, + ) + .expect_log(log_proposed(Precompile1, Bob, 0, proposal_hash, 2)) + .execute_returns(0u32); + + precompiles() + .prepare_test( + Alice, + Precompile1, + PCall::close { + proposal_hash, + proposal_index: 0, + proposal_weight_bound: 10_000_000, + length_bound, + }, + ) + .expect_no_logs() + .execute_reverts(|output| output.ends_with(b"TooEarly\") })")); + }); +} + +#[test] +fn can_close_execute_if_enough_votes() { + ExtBuilder::default().build().execute_with(|| { + let proposal = pallet_treasury::Call::::spend_local { + amount: 1, + beneficiary: Alice.into(), + }; + let proposal: ::RuntimeCall = proposal.into(); + let proposal = proposal.encode(); + let proposal_hash: H256 = hash::(&proposal); + let length_bound = proposal.len() as u32; + + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::propose { + threshold: 2, + proposal: proposal.into(), + }, + ) + .expect_log(log_proposed(Precompile1, Bob, 0, proposal_hash, 2)) + .execute_returns(0u32); + + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::vote { + proposal_hash, + proposal_index: 0, + approve: true, + }, + ) + .expect_log(log_voted(Precompile1, Bob, proposal_hash, true)) + .execute_returns(()); + + precompiles() + .prepare_test( + Charlie, + Precompile1, + PCall::vote { + proposal_hash, + proposal_index: 0, + approve: true, + }, + ) + .expect_log(log_voted(Precompile1, Charlie, proposal_hash, true)) + .execute_returns(()); + + precompiles() + .prepare_test( + Alice, + Precompile1, + PCall::close { + proposal_hash, + proposal_index: 0, + proposal_weight_bound: 200_000_000, + length_bound, + }, + ) + .expect_log(log_executed(Precompile1, proposal_hash)) + .execute_returns(true); + + assert_event_emitted!(pallet_collective::Event::Closed { + proposal_hash, + yes: 2, + no: 0, + } + .into()); + + assert_event_emitted!(pallet_collective::Event::Approved { proposal_hash }.into()); + + assert_event_emitted!(pallet_collective::Event::Executed { + proposal_hash, + result: Ok(()) + } + .into()); + + assert_event_emitted!(pallet_treasury::Event::SpendApproved { + proposal_index: 0, + amount: 1, + beneficiary: Alice.into(), + } + .into()); + }); +} + +#[test] +fn can_close_refuse_if_enough_votes() { + ExtBuilder::default().build().execute_with(|| { + let proposal = pallet_treasury::Call::::spend_local { + amount: 1, + beneficiary: Alice.into(), + }; + let proposal: ::RuntimeCall = proposal.into(); + let proposal = proposal.encode(); + let proposal_hash: H256 = hash::(&proposal); + let length_bound = proposal.len() as u32; + + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::propose { + threshold: 2, + proposal: proposal.into(), + }, + ) + .expect_log(log_proposed(Precompile1, Bob, 0, proposal_hash, 2)) + .execute_returns(0u32); + + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::vote { + proposal_hash, + proposal_index: 0, + approve: false, + }, + ) + .expect_log(log_voted(Precompile1, Bob, proposal_hash, false)) + .execute_returns(()); + + precompiles() + .prepare_test( + Charlie, + Precompile1, + PCall::vote { + proposal_hash, + proposal_index: 0, + approve: false, + }, + ) + .expect_log(log_voted(Precompile1, Charlie, proposal_hash, false)) + .execute_returns(()); + + precompiles() + .prepare_test( + Alice, + Precompile1, + PCall::close { + proposal_hash, + proposal_index: 0, + proposal_weight_bound: 100_000_000, + length_bound, + }, + ) + .expect_log(log_closed(Precompile1, proposal_hash)) + .execute_returns(false); + + assert_event_emitted!(pallet_collective::Event::Closed { + proposal_hash, + yes: 0, + no: 2, + } + .into()); + + assert_event_emitted!(pallet_collective::Event::Disapproved { proposal_hash }.into()); + }); +} + +#[test] +fn multiple_propose_increase_index() { + ExtBuilder::default().build().execute_with(|| { + let proposal = pallet_treasury::Call::::spend_local { + amount: 1, + beneficiary: Alice.into(), + }; + let proposal: ::RuntimeCall = proposal.into(); + let proposal = proposal.encode(); + let proposal_hash: H256 = hash::(&proposal); + + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::propose { + threshold: 2, + proposal: proposal.into(), + }, + ) + .expect_log(log_proposed(Precompile1, Bob, 0, proposal_hash, 2)) + .execute_returns(0u32); + + let proposal = pallet_treasury::Call::::spend_local { + amount: 2, + beneficiary: Alice.into(), + }; + let proposal: ::RuntimeCall = proposal.into(); + let proposal = proposal.encode(); + let proposal_hash: H256 = hash::(&proposal); + + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::propose { + threshold: 2, + proposal: proposal.into(), + }, + ) + .expect_log(log_proposed(Precompile1, Bob, 1, proposal_hash, 2)) + .execute_returns(1u32); + }); +} + +#[test] +fn view_members() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test(Bob, Precompile1, PCall::members {}) + .expect_no_logs() + .execute_returns(vec![Address(Bob.into()), Address(Charlie.into())]); + }); +} + +#[test] +fn view_no_prime() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test(Bob, Precompile1, PCall::prime {}) + .expect_no_logs() + .execute_returns(Address(H160::zero())); + }); +} + +#[test] +fn view_some_prime() { + ExtBuilder::default().build().execute_with(|| { + assert_ok!(pallet_collective::Pallet::< + Runtime, + pallet_collective::Instance1, + >::set_members( + RuntimeOrigin::root(), + vec![Alice.into(), Bob.into()], + Some(Alice.into()), + 2 + )); + + precompiles() + .prepare_test(Bob, Precompile1, PCall::prime {}) + .expect_no_logs() + .execute_returns(Address(Alice.into())); + }); +} + +#[test] +fn view_is_member() { + ExtBuilder::default().build().execute_with(|| { + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::is_member { + account: Address(Bob.into()), + }, + ) + .expect_no_logs() + .execute_returns(true); + + precompiles() + .prepare_test( + Bob, + Precompile1, + PCall::is_member { + account: Address(Alice.into()), + }, + ) + .expect_no_logs() + .execute_returns(false); + }); +} + +mod bounded_proposal_decode { + use super::*; + use crate::GetProposalLimit; + use precompile_utils::prelude::BoundedBytes; + + fn scenario(nesting: usize, call: F) + where + F: FnOnce(BoundedBytes) -> PCall, + { + ExtBuilder::default().build().execute_with(|| { + // Some random call. + let mut proposal = pallet_collective::Call::::set_members { + new_members: Vec::new(), + prime: None, + old_count: 0, + }; + + // Nest it. + for _ in 0..nesting { + proposal = pallet_collective::Call::::propose { + threshold: 10, + proposal: Box::new(proposal.into()), + length_bound: 1, + }; + } + + let proposal: ::RuntimeCall = proposal.into(); + let proposal = proposal.encode(); + + precompiles() + .prepare_test(Alice, Precompile1, call(proposal.into())) + .expect_no_logs() + .execute_reverts(|output| { + if nesting < 8 { + output.ends_with(b"NotMember\") })") + } else { + output == b"proposal: Failed to decode proposal" + } + }); + }); + } + + #[test] + fn proposal_above_bound() { + scenario(8, |proposal| PCall::propose { + threshold: 1, + proposal, + }); + } + + #[test] + fn proposal_below_bound() { + scenario(7, |proposal| PCall::propose { + threshold: 1, + proposal, + }); + } + + #[test] + fn execute_above_bound() { + scenario(8, |proposal| PCall::execute { proposal }); + } + + #[test] + fn execute_below_bound() { + scenario(7, |proposal| PCall::execute { proposal }); + } +} diff --git a/operator/runtime/mainnet/Cargo.toml b/operator/runtime/mainnet/Cargo.toml index 95480ddf..c163b91f 100644 --- a/operator/runtime/mainnet/Cargo.toml +++ b/operator/runtime/mainnet/Cargo.toml @@ -126,9 +126,10 @@ strum_macros = { workspace = true } pallet-evm-precompile-balances-erc20 = { workspace = true } pallet-evm-precompile-batch = { workspace = true } pallet-evm-precompile-call-permit = { workspace = true } +pallet-evm-precompile-collective = { workspace = true } +pallet-evm-precompile-identity = { workspace = true } pallet-evm-precompile-proxy = { workspace = true } pallet-evm-precompile-registry = { workspace = true } -pallet-evm-precompile-identity = { workspace = true } # StorageHub pallet-bucket-nfts = { workspace = true } @@ -199,9 +200,10 @@ std = [ "pallet-evm-precompile-balances-erc20/std", "pallet-evm-precompile-batch/std", "pallet-evm-precompile-call-permit/std", + "pallet-evm-precompile-collective/std", + "pallet-evm-precompile-identity/std", "pallet-evm-precompile-proxy/std", "pallet-evm-precompile-registry/std", - "pallet-evm-precompile-identity/std", "pallet-external-validators/std", "pallet-external-validators-rewards/std", "pallet-external-validators-rewards-runtime-api/std", diff --git a/operator/runtime/mainnet/src/configs/mod.rs b/operator/runtime/mainnet/src/configs/mod.rs index 8b2f8e63..9326686b 100644 --- a/operator/runtime/mainnet/src/configs/mod.rs +++ b/operator/runtime/mainnet/src/configs/mod.rs @@ -739,17 +739,11 @@ impl frame_support::traits::InstanceFilter for ProxyType { } /// Helper function to identify governance precompiles (copied from Moonbeam) -fn is_governance_precompile(_precompile_name: &PrecompileName) -> bool { - // TODO: Uncomment when DataHaven implements these governance precompiles - // matches!( - // precompile_name, - // PrecompileName::ConvictionVotingPrecompile - // | PrecompileName::PreimagePrecompile - // | PrecompileName::ReferendaPrecompile - // | PrecompileName::OpenTechCommitteeInstance - // | PrecompileName::TreasuryCouncilInstance - // ) - false // Temporarily disabled until governance precompiles are added +fn is_governance_precompile(precompile_name: &PrecompileName) -> bool { + matches!( + precompile_name, + PrecompileName::TechnicalCommitteeInstance | PrecompileName::TreasuryCouncilInstance + ) } impl pallet_evm_precompile_proxy::EvmProxyCallFilter for ProxyType { diff --git a/operator/runtime/mainnet/src/precompiles.rs b/operator/runtime/mainnet/src/precompiles.rs index 292ad67e..9f4735b2 100644 --- a/operator/runtime/mainnet/src/precompiles.rs +++ b/operator/runtime/mainnet/src/precompiles.rs @@ -15,11 +15,13 @@ // along with DataHaven. If not, see . use crate::configs::MaxAdditionalFields; +use crate::governance::councils::{TechnicalCommitteeInstance, TreasuryCouncilInstance}; use pallet_evm_precompile_balances_erc20::{Erc20BalancesPrecompile, Erc20Metadata}; use pallet_evm_precompile_batch::BatchPrecompile; use pallet_evm_precompile_blake2::Blake2F; use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; use pallet_evm_precompile_call_permit::CallPermitPrecompile; +use pallet_evm_precompile_collective::CollectivePrecompile; use pallet_evm_precompile_file_system::FileSystemPrecompile; use pallet_evm_precompile_identity::IdentityPrecompile; use pallet_evm_precompile_modexp::Modexp; @@ -100,6 +102,16 @@ type DataHavenPrecompilesAt = ( CallableByPrecompile>>, ), >, + PrecompileAt< + AddressU64<2064>, + CollectivePrecompile, + (CallableByContract, CallableByPrecompile), + >, + PrecompileAt< + AddressU64<2068>, + CollectivePrecompile, + (CallableByContract, CallableByPrecompile), + >, PrecompileAt< AddressU64<2069>, PrecompileRegistry, diff --git a/operator/runtime/stagenet/Cargo.toml b/operator/runtime/stagenet/Cargo.toml index d5b36d65..da53e864 100644 --- a/operator/runtime/stagenet/Cargo.toml +++ b/operator/runtime/stagenet/Cargo.toml @@ -126,9 +126,10 @@ xcm-executor = { workspace = true } pallet-evm-precompile-balances-erc20 = { workspace = true } pallet-evm-precompile-batch = { workspace = true } pallet-evm-precompile-call-permit = { workspace = true } +pallet-evm-precompile-collective = { workspace = true } +pallet-evm-precompile-identity = { workspace = true } pallet-evm-precompile-proxy = { workspace = true } pallet-evm-precompile-registry = { workspace = true } -pallet-evm-precompile-identity = { workspace = true } # StorageHub pallet-bucket-nfts = { workspace = true } @@ -199,9 +200,10 @@ std = [ "pallet-evm-precompile-balances-erc20/std", "pallet-evm-precompile-batch/std", "pallet-evm-precompile-call-permit/std", + "pallet-evm-precompile-collective/std", + "pallet-evm-precompile-identity/std", "pallet-evm-precompile-proxy/std", "pallet-evm-precompile-registry/std", - "pallet-evm-precompile-identity/std", "pallet-external-validators/std", "pallet-external-validators-rewards/std", "pallet-external-validators-rewards-runtime-api/std", diff --git a/operator/runtime/stagenet/src/configs/mod.rs b/operator/runtime/stagenet/src/configs/mod.rs index 049a20c3..3bc82ba8 100644 --- a/operator/runtime/stagenet/src/configs/mod.rs +++ b/operator/runtime/stagenet/src/configs/mod.rs @@ -738,17 +738,11 @@ impl frame_support::traits::InstanceFilter for ProxyType { } /// Helper function to identify governance precompiles (copied from Moonbeam) -fn is_governance_precompile(_precompile_name: &PrecompileName) -> bool { - // TODO: Uncomment when DataHaven implements these governance precompiles - // matches!( - // precompile_name, - // PrecompileName::ConvictionVotingPrecompile - // | PrecompileName::PreimagePrecompile - // | PrecompileName::ReferendaPrecompile - // | PrecompileName::OpenTechCommitteeInstance - // | PrecompileName::TreasuryCouncilInstance - // ) - false // Temporarily disabled until governance precompiles are added +fn is_governance_precompile(precompile_name: &PrecompileName) -> bool { + matches!( + precompile_name, + PrecompileName::TechnicalCommitteeInstance | PrecompileName::TreasuryCouncilInstance + ) } impl pallet_evm_precompile_proxy::EvmProxyCallFilter for ProxyType { diff --git a/operator/runtime/stagenet/src/precompiles.rs b/operator/runtime/stagenet/src/precompiles.rs index b2be7257..f8be1a9d 100644 --- a/operator/runtime/stagenet/src/precompiles.rs +++ b/operator/runtime/stagenet/src/precompiles.rs @@ -15,11 +15,13 @@ // along with DataHaven. If not, see . use crate::configs::MaxAdditionalFields; +use crate::governance::councils::{TechnicalCommitteeInstance, TreasuryCouncilInstance}; use pallet_evm_precompile_balances_erc20::{Erc20BalancesPrecompile, Erc20Metadata}; use pallet_evm_precompile_batch::BatchPrecompile; use pallet_evm_precompile_blake2::Blake2F; use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; use pallet_evm_precompile_call_permit::CallPermitPrecompile; +use pallet_evm_precompile_collective::CollectivePrecompile; use pallet_evm_precompile_file_system::FileSystemPrecompile; use pallet_evm_precompile_identity::IdentityPrecompile; use pallet_evm_precompile_modexp::Modexp; @@ -100,6 +102,16 @@ type DataHavenPrecompilesAt = ( CallableByPrecompile>>, ), >, + PrecompileAt< + AddressU64<2064>, + CollectivePrecompile, + (CallableByContract, CallableByPrecompile), + >, + PrecompileAt< + AddressU64<2068>, + CollectivePrecompile, + (CallableByContract, CallableByPrecompile), + >, PrecompileAt< AddressU64<2069>, PrecompileRegistry, diff --git a/operator/runtime/testnet/Cargo.toml b/operator/runtime/testnet/Cargo.toml index 14260caa..53b8b0d6 100644 --- a/operator/runtime/testnet/Cargo.toml +++ b/operator/runtime/testnet/Cargo.toml @@ -126,9 +126,10 @@ strum_macros = { workspace = true } pallet-evm-precompile-balances-erc20 = { workspace = true } pallet-evm-precompile-batch = { workspace = true } pallet-evm-precompile-call-permit = { workspace = true } +pallet-evm-precompile-collective = { workspace = true } +pallet-evm-precompile-identity = { workspace = true } pallet-evm-precompile-proxy = { workspace = true } pallet-evm-precompile-registry = { workspace = true } -pallet-evm-precompile-identity = { workspace = true } # StorageHub pallet-bucket-nfts = { workspace = true } @@ -199,9 +200,10 @@ std = [ "pallet-evm-precompile-balances-erc20/std", "pallet-evm-precompile-batch/std", "pallet-evm-precompile-call-permit/std", + "pallet-evm-precompile-collective/std", + "pallet-evm-precompile-identity/std", "pallet-evm-precompile-proxy/std", "pallet-evm-precompile-registry/std", - "pallet-evm-precompile-identity/std", "pallet-evm-precompile-file-system/std", "pallet-grandpa/std", "pallet-identity/std", diff --git a/operator/runtime/testnet/src/configs/mod.rs b/operator/runtime/testnet/src/configs/mod.rs index e0757667..17338c9a 100644 --- a/operator/runtime/testnet/src/configs/mod.rs +++ b/operator/runtime/testnet/src/configs/mod.rs @@ -738,17 +738,11 @@ impl frame_support::traits::InstanceFilter for ProxyType { } /// Helper function to identify governance precompiles (copied from Moonbeam) -fn is_governance_precompile(_precompile_name: &PrecompileName) -> bool { - // TODO: Uncomment when DataHaven implements these governance precompiles - // matches!( - // precompile_name, - // PrecompileName::ConvictionVotingPrecompile - // | PrecompileName::PreimagePrecompile - // | PrecompileName::ReferendaPrecompile - // | PrecompileName::OpenTechCommitteeInstance - // | PrecompileName::TreasuryCouncilInstance - // ) - false // Temporarily disabled until governance precompiles are added +fn is_governance_precompile(precompile_name: &PrecompileName) -> bool { + matches!( + precompile_name, + PrecompileName::TechnicalCommitteeInstance | PrecompileName::TreasuryCouncilInstance + ) } impl pallet_evm_precompile_proxy::EvmProxyCallFilter for ProxyType { diff --git a/operator/runtime/testnet/src/precompiles.rs b/operator/runtime/testnet/src/precompiles.rs index 62dcfa1c..890c6c35 100644 --- a/operator/runtime/testnet/src/precompiles.rs +++ b/operator/runtime/testnet/src/precompiles.rs @@ -15,11 +15,13 @@ // along with DataHaven. If not, see . use crate::configs::MaxAdditionalFields; +use crate::governance::councils::{TechnicalCommitteeInstance, TreasuryCouncilInstance}; use pallet_evm_precompile_balances_erc20::{Erc20BalancesPrecompile, Erc20Metadata}; use pallet_evm_precompile_batch::BatchPrecompile; use pallet_evm_precompile_blake2::Blake2F; use pallet_evm_precompile_bn128::{Bn128Add, Bn128Mul, Bn128Pairing}; use pallet_evm_precompile_call_permit::CallPermitPrecompile; +use pallet_evm_precompile_collective::CollectivePrecompile; use pallet_evm_precompile_file_system::FileSystemPrecompile; use pallet_evm_precompile_identity::IdentityPrecompile; use pallet_evm_precompile_modexp::Modexp; @@ -100,6 +102,16 @@ type DataHavenPrecompilesAt = ( CallableByPrecompile>>, ), >, + PrecompileAt< + AddressU64<2064>, + CollectivePrecompile, + (CallableByContract, CallableByPrecompile), + >, + PrecompileAt< + AddressU64<2068>, + CollectivePrecompile, + (CallableByContract, CallableByPrecompile), + >, PrecompileAt< AddressU64<2069>, PrecompileRegistry,