diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3dbca9ea5..97b08edf4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -199,3 +199,43 @@ jobs: - name: Run integration tests run: cargo test --no-default-features --features parachain --test parachain + + file-writer-integration-tests: + needs: lint + strategy: + matrix: + os: ["ubuntu-latest", "macos-latest"] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + default: true + target: wasm32-unknown-unknown + components: rust-src, clippy + + - name: Cache + uses: Swatinem/rust-cache@v2 + + - name: Install packages (Linux) + if: matrix.os == 'ubuntu-latest' + uses: "./.github/actions/init" + with: + git-user: ${{ env.GITHUB_ACTOR }} + + - name: Install packages (macOS) + if: matrix.os == 'macos-latest' + run: | + brew install protobuf + protoc --version + + - name: Run integration tests + run: | + cargo test --test pop_add_to_pallet_config_type && \ + cargo test --test pop_add_to_runtime_pallet && \ + cargo test --test new_pallet_added_to_existing_runtime diff --git a/Cargo.lock b/Cargo.lock index 733c9a4d7..cb7d9870e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,19 +166,20 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", + "once_cell", "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.94" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "approx" @@ -440,7 +441,7 @@ dependencies = [ "nom", "num-traits", "rusticata-macros", - "thiserror 2.0.11", + "thiserror 2.0.12", "time", ] @@ -510,7 +511,7 @@ dependencies = [ "bstr", "doc-comment", "libc", - "predicates 3.1.2", + "predicates 3.1.3", "predicates-core", "predicates-tree", "wait-timeout", @@ -576,7 +577,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix 0.38.42", + "rustix 0.38.44", "slab", "tracing", "windows-sys 0.59.0", @@ -588,7 +589,7 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener 5.3.1", + "event-listener 5.4.0", "event-listener-strategy", "pin-project-lite", ] @@ -617,9 +618,9 @@ dependencies = [ "async-task", "blocking", "cfg-if", - "event-listener 5.3.1", + "event-listener 5.4.0", "futures-lite", - "rustix 0.38.42", + "rustix 0.38.44", "tracing", ] @@ -635,7 +636,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.42", + "rustix 0.38.44", "signal-hook-registry", "slab", "windows-sys 0.59.0", @@ -671,9 +672,9 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", @@ -732,10 +733,10 @@ dependencies = [ "axum-core", "bytes", "futures-util", - "http 1.2.0", + "http 1.3.1", "http-body 1.0.1", "http-body-util", - "hyper 1.5.2", + "hyper 1.6.0", "hyper-util", "itoa", "matchit", @@ -765,7 +766,7 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.2.0", + "http 1.3.1", "http-body 1.0.1", "http-body-util", "mime", @@ -798,7 +799,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide", - "object 0.36.5", + "object 0.36.7", "rustc-demangle", "windows-targets 0.52.6", ] @@ -841,15 +842,15 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.6.0" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" [[package]] name = "basic-toml" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" dependencies = [ "serde", ] @@ -972,9 +973,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "bitvec" @@ -1022,9 +1023,9 @@ dependencies = [ [[package]] name = "blake2b_simd" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" +checksum = "06e903a20b159e944f91ec8499fe1e55651480c541ea0a584f5d967c49ad9d99" dependencies = [ "arrayref", "arrayvec 0.7.6", @@ -1098,9 +1099,9 @@ dependencies = [ "futures-core", "futures-util", "hex", - "http 1.2.0", + "http 1.3.1", "http-body-util", - "hyper 1.5.2", + "hyper 1.6.0", "hyper-named-pipe", "hyper-util", "hyperlocal", @@ -1111,7 +1112,7 @@ dependencies = [ "serde_json", "serde_repr", "serde_urlencoded", - "thiserror 2.0.11", + "thiserror 2.0.12", "tokio", "tokio-util", "tower-service", @@ -1132,9 +1133,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.3" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" +checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" dependencies = [ "borsh-derive", "cfg_aliases 0.2.1", @@ -1142,12 +1143,12 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.3" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" +checksum = "fdd1d3c0c2f5833f22386f252fe8ed005c7f59fdcddeef025c01b4c3b9fd9ac3" dependencies = [ "once_cell", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -1155,9 +1156,9 @@ dependencies = [ [[package]] name = "bounded-collections" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d077619e9c237a5d1875166f5e8033e8f6bff0c96f8caf81e1c2d7738c431bf" +checksum = "64ad8a0bed7827f0b07a5d23cec2e58cc02038a99e4ca81616cb2bb2025f804d" dependencies = [ "log", "parity-scale-codec", @@ -1195,9 +1196,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.11.1" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" +checksum = "531a9155a481e2ee699d4f98f43c0ca4ff8ee1bfd55c31e9e98fb29d2b176fe0" dependencies = [ "memchr", "regex-automata 0.4.9", @@ -1206,15 +1207,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "byte-slice-cast" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" +checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d" [[package]] name = "byte-tools" @@ -1258,9 +1259,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.9.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "bzip2-sys" @@ -1302,16 +1303,16 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8769706aad5d996120af43197bf46ef6ad0fda35216b4505f926a365a232d924" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" dependencies = [ "camino", "cargo-platform", "semver", "serde", "serde_json", - "thiserror 2.0.11", + "thiserror 2.0.12", ] [[package]] @@ -1321,14 +1322,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88da5a13c620b4ca0078845707ea9c3faf11edbc3ffd8497d11d686211cd1ac0" dependencies = [ "serde", - "toml 0.8.19", + "toml 0.8.20", +] + +[[package]] +name = "cargo_toml" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fbd1fe9db3ebf71b89060adaf7b0504c2d6a425cf061313099547e382c2e472" +dependencies = [ + "serde", + "toml 0.8.20", ] [[package]] name = "cc" -version = "1.2.16" +version = "1.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" +checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" dependencies = [ "jobserver", "libc", @@ -1413,9 +1424,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1423,7 +1434,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -1485,9 +1496,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.23" +version = "4.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" +checksum = "e958897981290da2a852763fe9cdb89cd36977a5d729023127095fa94d95e2ff" dependencies = [ "clap_builder", "clap_derive", @@ -1495,9 +1506,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.23" +version = "4.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" +checksum = "83b0f35019843db2160b5bb19ae09b4e6411ac33fc6a712003c33e03090e2489" dependencies = [ "anstream", "anstyle", @@ -1508,9 +1519,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -1551,12 +1562,13 @@ dependencies = [ [[package]] name = "codespan-reporting" -version = "0.11.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81" dependencies = [ + "serde", "termcolor", - "unicode-width 0.1.14", + "unicode-width", ] [[package]] @@ -1575,6 +1587,15 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "colored" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "combine" version = "4.6.7" @@ -1592,7 +1613,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a65ebfec4fb190b6f90e944a817d60499ee0744e582530e2c9900a22e591d9a" dependencies = [ "unicode-segmentation", - "unicode-width 0.2.0", + "unicode-width", ] [[package]] @@ -1612,14 +1633,14 @@ dependencies = [ [[package]] name = "console" -version = "0.15.10" +version = "0.15.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b" +checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" dependencies = [ "encode_unicode", "libc", "once_cell", - "unicode-width 0.2.0", + "unicode-width", "windows-sys 0.59.0", ] @@ -1709,16 +1730,16 @@ checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" [[package]] name = "contract-build" -version = "5.0.2" +version = "5.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b014fa89030235ecd8bdeb061ec97df326281b484f89ad3e17a79f08759c2f52" +checksum = "6e661897ab30bc0290628b2ea3ce18463c766a1264687a76aa8f5a36b6e75e78" dependencies = [ "anyhow", "blake2 0.10.6", "bollard", "cargo_metadata", "clap", - "colored", + "colored 2.2.0", "contract-metadata", "crossterm", "duct", @@ -1736,27 +1757,27 @@ dependencies = [ "term_size", "tokio", "tokio-stream", - "toml 0.8.19", + "toml 0.8.20", "tracing", "url", "uzers", "walkdir", "wasm-encoder", "wasm-opt", - "wasmparser 0.220.0", + "wasmparser 0.220.1", "which", "zip", ] [[package]] name = "contract-extrinsics" -version = "5.0.2" +version = "5.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67d0c91349c31caec4d5e3c544b4bc4fcc7c0468dc49ee84a96a24f915464401" +checksum = "f21e03420806389aa620e4aa6c01085478f0b5024e7bdefa26c41af26379ffcf" dependencies = [ "anyhow", "blake2 0.10.6", - "colored", + "colored 2.2.0", "contract-build", "contract-metadata", "contract-transcode", @@ -1775,7 +1796,7 @@ dependencies = [ "sp-core 32.0.0", "sp-runtime 35.0.0", "sp-weights", - "subxt 0.38.0", + "subxt 0.38.1", "tokio", "tracing", "url", @@ -1783,9 +1804,9 @@ dependencies = [ [[package]] name = "contract-metadata" -version = "5.0.2" +version = "5.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83ae8bcb5f7c5ea033d05fa0bbffa4e762a5b69c0ce96e4188fb15385a01998b" +checksum = "3ce11bf540c9b154aca38e9d828ae7ea93ec7b4486c5dea87d553016b28af175" dependencies = [ "anyhow", "impl-serde 0.5.0", @@ -1797,9 +1818,9 @@ dependencies = [ [[package]] name = "contract-transcode" -version = "5.0.2" +version = "5.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baca96dc859fd180eba5f15e468f59dc8c932a6b72f6b76f91b571b6743a9e7d" +checksum = "b315857697f467045d8c1bcf2bce7c9eb0a6e32d94554afd0d2892e772ecad0c" dependencies = [ "anyhow", "base58", @@ -1819,7 +1840,7 @@ dependencies = [ "serde", "serde_json", "strsim 0.11.1", - "thiserror 2.0.11", + "thiserror 2.0.12", "tracing", ] @@ -1875,9 +1896,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] @@ -2029,11 +2050,11 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "crossterm_winapi", "mio", "parking_lot 0.12.3", - "rustix 0.38.42", + "rustix 0.38.44", "signal-hook", "signal-hook-mio", "winapi", @@ -2050,9 +2071,9 @@ dependencies = [ [[package]] name = "crunchy" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] name = "crypto-bigint" @@ -2207,7 +2228,7 @@ dependencies = [ "async-trait", "cumulus-primitives-core", "futures", - "jsonrpsee-core 0.24.7", + "jsonrpsee-core 0.24.9", "parity-scale-codec", "polkadot-overseer", "sc-client-api", @@ -2274,9 +2295,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.135" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d44ff199ff93242c3afe480ab588d544dd08d72e92885e152ffebc670f076ad" +checksum = "fdb3e596b379180315d2f934231e233a2fc745041f88231807774093d8de45f2" dependencies = [ "cc", "cxxbridge-cmd", @@ -2288,9 +2309,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.135" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66fd8f17ad454fc1e4f4ab83abffcc88a532e90350d3ffddcb73030220fcbd52" +checksum = "3743fae7f47620cd34ec23bab819db9ee52da93166a058f87ab0ad99d777dc9b" dependencies = [ "cc", "codespan-reporting", @@ -2302,9 +2323,9 @@ dependencies = [ [[package]] name = "cxxbridge-cmd" -version = "1.0.135" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4717c9c806a9e07fdcb34c84965a414ea40fafe57667187052cf1eb7f5e8a8a9" +checksum = "aaea0273c049b126a3918df88a1670c9c0168e0738df9370a988ff69070d4fff" dependencies = [ "clap", "codespan-reporting", @@ -2315,15 +2336,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.135" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f6515329bf3d98f4073101c7866ff2bec4e635a13acb82e3f3753fff0bf43cb" +checksum = "020a9a3d6b792aab7f30f6e323893ad7f45052e572cde5d014c47fe67c89495f" [[package]] name = "cxxbridge-macro" -version = "1.0.135" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb93e6a7ce8ec985c02bbb758237a31598b340acbbc3c19c5a4fa6adaaac92ab" +checksum = "ee54cd01f94db0328c4c73036d38bd8c3bb88927e953d05ffefe743edbf4eb68" dependencies = [ "proc-macro2", "quote", @@ -2416,15 +2437,15 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010" [[package]] name = "data-encoding-macro" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1559b6cba622276d6d63706db152618eeb15b89b3e4041446b05876e352e639" +checksum = "9f9724adfcf41f45bf652b3995837669d73c4d49a1b5ac1ff82905ac7d9b5558" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -2432,12 +2453,12 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.13" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "332d754c0af53bc87c108fed664d121ecf59207ec4196041f04d6ab9002ad33f" +checksum = "18e4fdb82bd54a12e42fb58a800dcae6b9e13982238ce2296dc3570b92148e1f" dependencies = [ "data-encoding", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] @@ -2480,9 +2501,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.11" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" dependencies = [ "powerfmt", "serde", @@ -2534,9 +2555,9 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.18" +version = "0.99.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +checksum = "3da29a38df43d6f156149c9b43ded5e018ddff2a855cf2cfd62e8cd7d079c69f" dependencies = [ "convert_case", "proc-macro2", @@ -2705,7 +2726,7 @@ dependencies = [ "regex", "syn 2.0.100", "termcolor", - "toml 0.8.19", + "toml 0.8.20", "walkdir", ] @@ -2741,9 +2762,9 @@ dependencies = [ [[package]] name = "dyn-clonable" -version = "0.9.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" +checksum = "a36efbb9bfd58e1723780aa04b61aba95ace6a05d9ffabfdb0b43672552f0805" dependencies = [ "dyn-clonable-impl", "dyn-clone", @@ -2751,20 +2772,20 @@ dependencies = [ [[package]] name = "dyn-clonable-impl" -version = "0.9.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" +checksum = "7e8671d54058979a37a26f3511fbf8d198ba1aa35ffb202c42587d918d77213a" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "dyn-clone" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" +checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" [[package]] name = "ecdsa" @@ -2837,9 +2858,9 @@ dependencies = [ [[package]] name = "either" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "elliptic-curve" @@ -2902,14 +2923,20 @@ dependencies = [ [[package]] name = "env_filter" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" dependencies = [ "log", "regex", ] +[[package]] +name = "env_home" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" + [[package]] name = "env_logger" version = "0.10.2" @@ -2944,9 +2971,9 @@ checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" @@ -2982,9 +3009,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "5.3.1" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" dependencies = [ "concurrent-queue", "parking", @@ -2997,7 +3024,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ - "event-listener 5.3.1", + "event-listener 5.4.0", "pin-project-lite", ] @@ -3055,7 +3082,7 @@ checksum = "eb42427514b063d97ce21d5199f36c0c307d981434a6be32582bc79fe5bd2303" dependencies = [ "expander", "indexmap 2.8.0", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -3073,9 +3100,9 @@ dependencies = [ [[package]] name = "ff" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" dependencies = [ "rand_core 0.6.4", "subtle 2.6.1", @@ -3171,9 +3198,9 @@ checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" [[package]] name = "flate2" -version = "1.0.35" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" +checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc" dependencies = [ "crc32fast", "miniz_oxide", @@ -3188,6 +3215,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "float-cmp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8" +dependencies = [ + "num-traits", +] + [[package]] name = "fnv" version = "1.0.7" @@ -3196,9 +3232,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "foreign-types" @@ -3245,9 +3281,9 @@ dependencies = [ [[package]] name = "fragile" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" +checksum = "28dd6caf6059519a65843af8fe2a3ae298b14b80179855aeb4adc2c1934ee619" [[package]] name = "frame-benchmarking" @@ -3339,9 +3375,9 @@ dependencies = [ [[package]] name = "frame-decode" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d3379df61ff3dd871e2dde7d1bcdc0263e613c21c7579b149fd4f0ad9b1dc2" +checksum = "6027a409bac4fe95b4d107f965fcdbc252fc89d884a360d076b3070b6128c094" dependencies = [ "frame-metadata 17.0.0", "parity-scale-codec", @@ -3470,7 +3506,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81a088fd6fda5f53ff0c17fc7551ce8bd0ead14ba742228443c8196296a7369b" dependencies = [ "frame-support-procedural-tools-derive", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -3527,6 +3563,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "fs_rollback" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "110a7d453ac4dce499ec5a8da4267007fafef274c936cc60eb56f7ba162393f7" +dependencies = [ + "rustilities", + "same-file", + "tempfile", + "thiserror 2.0.12", +] + [[package]] name = "funty" version = "2.0.0" @@ -3594,9 +3642,9 @@ checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" +checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532" dependencies = [ "fastrand", "futures-core", @@ -3767,7 +3815,7 @@ version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "libc", "libgit2-sys", "log", @@ -3792,9 +3840,9 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "glob-match" @@ -3854,16 +3902,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" +checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2" dependencies = [ "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "http 1.2.0", + "http 1.3.1", "indexmap 2.8.0", "slab", "tokio", @@ -4123,9 +4171,9 @@ dependencies = [ [[package]] name = "http" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" dependencies = [ "bytes", "fnv", @@ -4150,18 +4198,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.2.0", + "http 1.3.1", ] [[package]] name = "http-body-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", - "futures-util", - "http 1.2.0", + "futures-core", + "http 1.3.1", "http-body 1.0.1", "pin-project-lite", ] @@ -4180,9 +4228,9 @@ checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" [[package]] name = "httparse" -version = "1.9.5" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" @@ -4231,15 +4279,15 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.2" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.7", - "http 1.2.0", + "h2 0.4.8", + "http 1.3.1", "http-body 1.0.1", "httparse", "httpdate", @@ -4257,7 +4305,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73b7d8abf35697b81a825e386fc151e0d503e8cb5fcb93cc8669c376dfd6f278" dependencies = [ "hex", - "hyper 1.5.2", + "hyper 1.6.0", "hyper-util", "pin-project-lite", "tokio", @@ -4283,18 +4331,18 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.4" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6884a48c6826ec44f524c7456b163cebe9e55a18d7b5e307cb4f100371cc767" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" dependencies = [ "futures-util", - "http 1.2.0", - "hyper 1.5.2", + "http 1.3.1", + "hyper 1.6.0", "hyper-util", - "rustls 0.23.23", + "rustls 0.23.25", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.1", + "tokio-rustls 0.26.2", "tower-service", ] @@ -4318,7 +4366,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.5.2", + "hyper 1.6.0", "hyper-util", "native-tls", "tokio", @@ -4335,9 +4383,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.2.0", + "http 1.3.1", "http-body 1.0.1", - "hyper 1.5.2", + "hyper 1.6.0", "pin-project-lite", "socket2 0.5.8", "tokio", @@ -4353,7 +4401,7 @@ checksum = "986c5ce3b994526b3cd75578e62554abd09f0899d6206de48b3e96ab34ccc8c7" dependencies = [ "hex", "http-body-util", - "hyper 1.5.2", + "hyper 1.6.0", "hyper-util", "pin-project-lite", "tokio", @@ -4362,14 +4410,15 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b2fd658b06e56721792c5df4475705b6cda790e9298d19d2f8af083457bcd127" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", "windows-core 0.52.0", ] @@ -4424,9 +4473,9 @@ dependencies = [ [[package]] name = "icu_locid_transform_data" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" +checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" [[package]] name = "icu_normalizer" @@ -4448,9 +4497,9 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" +checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" [[package]] name = "icu_properties" @@ -4469,9 +4518,9 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" +checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" [[package]] name = "icu_provider" @@ -4612,9 +4661,9 @@ dependencies = [ [[package]] name = "impl-codec" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67aa010c1e3da95bf151bd8b4c059b2ed7e75387cdb969b4f8f2723a43f9941" +checksum = "2d40b9d5e17727407e55028eafc22b2dc68781786e6d7eb8a21103f5058e3a14" dependencies = [ "parity-scale-codec", ] @@ -4714,14 +4763,14 @@ checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "indicatif" -version = "0.17.9" +version = "0.17.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf675b85ed934d3c67b5c5469701eec7db22689d0a2139d856e0925fa28b281" +checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" dependencies = [ "console", "number_prefix", "portable-atomic", - "unicode-width 0.2.0", + "unicode-width", "web-time", ] @@ -4837,9 +4886,9 @@ dependencies = [ [[package]] name = "inout" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ "generic-array 0.14.7", ] @@ -4893,9 +4942,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "is-docker" @@ -4969,17 +5018,26 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jiff" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d699bc6dfc879fb1bf9bdff0d4c56f0884fc6f0d0eb0fba397a6d00cd9a6b85e" +checksum = "c102670231191d07d37a35af3eb77f1f0dbf7a71be51a962dcd57ea607be7260" dependencies = [ "jiff-static", "log", @@ -4990,9 +5048,9 @@ dependencies = [ [[package]] name = "jiff-static" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d16e75759ee0aa64c57a56acbf43916987b20c77373cb7e808979e02b93c9f9" +checksum = "4cdde31a9d349f1b1f51a0b3714a5940ac022976f4b49485fc04be052b183b4c" dependencies = [ "proc-macro2", "quote", @@ -5013,6 +5071,22 @@ dependencies = [ "walkdir", ] +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + [[package]] name = "jni-sys" version = "0.3.0" @@ -5036,9 +5110,9 @@ checksum = "72167d68f5fce3b8655487b8038691a3c9984ee769590f93f2a631f4ad64e4f5" [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -5093,16 +5167,16 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.24.7" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5c71d8c1a731cc4227c2f698d377e7848ca12c8a48866fc5e6951c43a4db843" +checksum = "37b26c20e2178756451cfeb0661fb74c47dd5988cb7e3939de7e9241fd604d42" dependencies = [ - "jsonrpsee-client-transport 0.24.7", - "jsonrpsee-core 0.24.7", + "jsonrpsee-client-transport 0.24.9", + "jsonrpsee-core 0.24.9", "jsonrpsee-proc-macros", "jsonrpsee-server", - "jsonrpsee-types 0.24.7", - "jsonrpsee-ws-client 0.24.7", + "jsonrpsee-types 0.24.9", + "jsonrpsee-ws-client 0.24.9", "tokio", "tracing", ] @@ -5136,16 +5210,16 @@ checksum = "08163edd8bcc466c33d79e10f695cdc98c00d1e6ddfb95cec41b6b0279dd5432" dependencies = [ "base64 0.22.1", "futures-util", - "http 1.2.0", + "http 1.3.1", "jsonrpsee-core 0.23.2", "pin-project", - "rustls 0.23.23", + "rustls 0.23.25", "rustls-pki-types", - "rustls-platform-verifier", + "rustls-platform-verifier 0.3.4", "soketto 0.8.1", "thiserror 1.0.69", "tokio", - "tokio-rustls 0.26.1", + "tokio-rustls 0.26.2", "tokio-util", "tracing", "url", @@ -5153,22 +5227,22 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.24.7" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "548125b159ba1314104f5bb5f38519e03a41862786aa3925cf349aae9cdd546e" +checksum = "bacb85abf4117092455e1573625e21b8f8ef4dec8aff13361140b2dc266cdff2" dependencies = [ "base64 0.22.1", "futures-util", - "http 1.2.0", - "jsonrpsee-core 0.24.7", + "http 1.3.1", + "jsonrpsee-core 0.24.9", "pin-project", - "rustls 0.23.23", + "rustls 0.23.25", "rustls-pki-types", - "rustls-platform-verifier", + "rustls-platform-verifier 0.5.1", "soketto 0.8.1", "thiserror 1.0.69", "tokio", - "tokio-rustls 0.26.1", + "tokio-rustls 0.26.2", "tokio-util", "tracing", "url", @@ -5221,22 +5295,22 @@ dependencies = [ [[package]] name = "jsonrpsee-core" -version = "0.24.7" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2882f6f8acb9fdaec7cefc4fd607119a9bd709831df7d7672a1d3b644628280" +checksum = "456196007ca3a14db478346f58c7238028d55ee15c1df15115596e411ff27925" dependencies = [ "async-trait", "bytes", "futures-timer", "futures-util", - "http 1.2.0", + "http 1.3.1", "http-body 1.0.1", "http-body-util", - "jsonrpsee-types 0.24.7", + "jsonrpsee-types 0.24.9", "parking_lot 0.12.3", "pin-project", "rand 0.8.5", - "rustc-hash 2.1.0", + "rustc-hash 2.1.1", "serde", "serde_json", "thiserror 1.0.69", @@ -5272,7 +5346,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e65763c942dfc9358146571911b0cd1c361c2d63e2d2305622d40d36376ca80" dependencies = [ "heck 0.5.0", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -5280,18 +5354,18 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.24.8" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b7a3df90a1a60c3ed68e7ca63916b53e9afa928e33531e87f61a9c8e9ae87b" +checksum = "55e363146da18e50ad2b51a0a7925fc423137a0b1371af8235b1c231a0647328" dependencies = [ "futures-util", - "http 1.2.0", + "http 1.3.1", "http-body 1.0.1", "http-body-util", - "hyper 1.5.2", + "hyper 1.6.0", "hyper-util", - "jsonrpsee-core 0.24.7", - "jsonrpsee-types 0.24.7", + "jsonrpsee-core 0.24.9", + "jsonrpsee-types 0.24.9", "pin-project", "route-recognizer", "serde", @@ -5325,7 +5399,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c465fbe385238e861fdc4d1c85e04ada6c1fd246161d26385c1b311724d2af" dependencies = [ "beef", - "http 1.2.0", + "http 1.3.1", "serde", "serde_json", "thiserror 1.0.69", @@ -5333,11 +5407,11 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.24.7" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a178c60086f24cc35bb82f57c651d0d25d99c4742b4d335de04e97fa1f08a8a1" +checksum = "08a8e70baf945b6b5752fc8eb38c918a48f1234daf11355e07106d963f860089" dependencies = [ - "http 1.2.0", + "http 1.3.1", "serde", "serde_json", "thiserror 1.0.69", @@ -5349,7 +5423,7 @@ version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c28759775f5cb2f1ea9667672d3fe2b0e701d1f4b7b67954e60afe7fd058b5e" dependencies = [ - "http 1.2.0", + "http 1.3.1", "jsonrpsee-client-transport 0.23.2", "jsonrpsee-core 0.23.2", "jsonrpsee-types 0.23.2", @@ -5358,14 +5432,14 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.24.7" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fe322e0896d0955a3ebdd5bf813571c53fea29edd713bc315b76620b327e86d" +checksum = "01b3323d890aa384f12148e8d2a1fd18eb66e9e7e825f9de4fa53bcc19b93eef" dependencies = [ - "http 1.2.0", - "jsonrpsee-client-transport 0.24.7", - "jsonrpsee-core 0.24.7", - "jsonrpsee-types 0.24.7", + "http 1.3.1", + "jsonrpsee-client-transport 0.24.9", + "jsonrpsee-core 0.24.9", + "jsonrpsee-types 0.24.9", "url", ] @@ -5464,7 +5538,7 @@ dependencies = [ "jsonpath-rust", "k8s-openapi", "kube-core", - "pem 3.0.4", + "pem 3.0.5", "pin-project", "rand 0.8.5", "rustls 0.21.12", @@ -5578,9 +5652,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.169" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libgit2-sys" @@ -5603,7 +5677,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -6148,9 +6222,9 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "libc", - "redox_syscall 0.5.8", + "redox_syscall 0.5.10", ] [[package]] @@ -6170,12 +6244,12 @@ dependencies = [ [[package]] name = "libsecp256k1" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +checksum = "e79019718125edc905a079a70cfa5f3820bc76139fc91d6f9abc27ea2a887139" dependencies = [ "arrayref", - "base64 0.13.1", + "base64 0.22.1", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -6218,9 +6292,9 @@ dependencies = [ [[package]] name = "libssh2-sys" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" +checksum = "220e4f05ad4a218192533b300327f5150e809b54c4ec83b5a1d91833601811b9" dependencies = [ "cc", "libc", @@ -6232,9 +6306,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.20" +version = "1.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" dependencies = [ "cc", "libc", @@ -6244,9 +6318,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d240c6f7e1ba3a28b0249f774e6a9dd0175054b52dfbb61b16eb8505c3785c9" +checksum = "4a6f6da007f968f9def0d65a05b187e2960183de70c160204ecfccf0ee330212" dependencies = [ "cc", ] @@ -6268,18 +6342,18 @@ dependencies = [ [[package]] name = "linkme" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566336154b9e58a4f055f6dd4cbab62c7dc0826ce3c0a04e63b2d2ecd784cdae" +checksum = "22d227772b5999ddc0690e733f734f95ca05387e329c4084fe65678c51198ffe" dependencies = [ "linkme-impl", ] [[package]] name = "linkme-impl" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbe595006d355eaf9ae11db92707d4338cd2384d16866131cc1afdbdd35d8d9" +checksum = "71a98813fa0073a317ed6a8055dcd4722a49d9b862af828ee68449adb799b6be" dependencies = [ "proc-macro2", "quote", @@ -6303,9 +6377,9 @@ checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "linux-raw-sys" @@ -6327,9 +6401,9 @@ dependencies = [ [[package]] name = "litemap" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" +checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" [[package]] name = "litep2p" @@ -6366,7 +6440,7 @@ dependencies = [ "smallvec", "snow", "socket2 0.5.8", - "thiserror 2.0.11", + "thiserror 2.0.12", "tokio", "tokio-stream", "tokio-tungstenite 0.26.2", @@ -6394,9 +6468,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.26" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "lru" @@ -6535,7 +6609,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.42", + "rustix 0.38.44", ] [[package]] @@ -6610,9 +6684,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" +checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" dependencies = [ "adler2", ] @@ -6679,7 +6753,7 @@ dependencies = [ "downcast", "fragile", "mockall_derive 0.13.1", - "predicates 3.1.2", + "predicates 3.1.3", "predicates-tree", ] @@ -6709,21 +6783,21 @@ dependencies = [ [[package]] name = "mockito" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "652cd6d169a36eaf9d1e6bce1a221130439a966d7f27858af66a33a66e9c4ee2" +checksum = "7760e0e418d9b7e5777c0374009ca4c93861b9066f18cb334a20ce50ab63aa48" dependencies = [ "assert-json-diff", "bytes", - "colored", + "colored 3.0.0", "futures-util", - "http 1.2.0", + "http 1.3.1", "http-body 1.0.1", "http-body-util", - "hyper 1.5.2", + "hyper 1.6.0", "hyper-util", "log", - "rand 0.8.5", + "rand 0.9.0", "regex", "serde_json", "serde_urlencoded", @@ -6896,9 +6970,9 @@ checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" [[package]] name = "native-tls" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" dependencies = [ "libc", "log", @@ -6959,7 +7033,7 @@ dependencies = [ "log", "netlink-packet-core", "netlink-sys", - "thiserror 2.0.11", + "thiserror 2.0.12", ] [[package]] @@ -7004,7 +7078,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "cfg-if", "cfg_aliases 0.2.1", "libc", @@ -7191,9 +7265,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.5" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] @@ -7218,9 +7292,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" [[package]] name = "opaque-debug" @@ -7236,9 +7310,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "open" -version = "5.3.1" +version = "5.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ecd52f0b8d15c40ce4820aa251ed5de032e5d91fab27f7db2f40d42a8bdf69c" +checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95" dependencies = [ "is-wsl", "libc", @@ -7247,11 +7321,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.70" +version = "0.10.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6" +checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "cfg-if", "foreign-types", "libc", @@ -7273,24 +7347,24 @@ dependencies = [ [[package]] name = "openssl-probe" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-src" -version = "300.4.1+3.4.0" +version = "300.4.2+3.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faa4eac4138c62414b5622d1b31c5c304f34b406b013c079c2bbc652fdd6678c" +checksum = "168ce4e058f975fe43e89d9ccf78ca668601887ae736090aacc23ae353c298e2" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.105" +version = "0.9.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc" +checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" dependencies = [ "cc", "libc", @@ -7332,7 +7406,7 @@ dependencies = [ "indexmap 2.8.0", "itertools 0.11.0", "petgraph 0.6.5", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 1.0.109", @@ -7349,9 +7423,9 @@ dependencies = [ [[package]] name = "os_info" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ca711d8b83edbb00b44d504503cd247c9c0bd8b0fa2694f2a1a3d8165379ce" +checksum = "2a604e53c24761286860eba4e2c8b23a0161526476b1de520139d69cdb85a6b5" dependencies = [ "log", "windows-sys 0.52.0", @@ -7454,7 +7528,7 @@ version = "3.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "581c837bb6b9541ce7faa9377c20616e4fb7650f6b0f68bc93c827ee504fb7b3" dependencies = [ - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -7515,7 +7589,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.8", + "redox_syscall 0.5.10", "smallvec", "windows-targets 0.52.6", ] @@ -7577,9 +7651,9 @@ dependencies = [ [[package]] name = "pem" -version = "3.0.4" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +checksum = "38af38e8470ac9dee3ce1bae1af9c1671fffc44ddfd8bd1d0a3445bf349a8ef3" dependencies = [ "base64 0.22.1", "serde", @@ -7593,20 +7667,20 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.15" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" dependencies = [ "memchr", - "thiserror 2.0.11", + "thiserror 2.0.12", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.15" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816518421cfc6887a0d62bf441b6ffb4536fcc926395a69e1a85852d4363f57e" +checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" dependencies = [ "pest", "pest_generator", @@ -7614,9 +7688,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.15" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d1396fd3a870fc7838768d171b4616d5c91f6cc25e377b673d714567d99377b" +checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" dependencies = [ "pest", "pest_meta", @@ -7627,9 +7701,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.15" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea" +checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" dependencies = [ "once_cell", "pest", @@ -7658,18 +7732,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.7" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.7" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", @@ -7678,9 +7752,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -7711,9 +7785,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "polkadot-core-primitives" @@ -7756,7 +7830,7 @@ dependencies = [ "async-channel 1.9.0", "async-trait", "bitvec", - "derive_more 0.99.18", + "derive_more 0.99.19", "fatality", "futures", "hex", @@ -7808,7 +7882,7 @@ checksum = "7193b889dc5b82a4aa0022eb26ef3528ac7a0d08dd3749b037b8ab79c1b2f3a0" dependencies = [ "async-trait", "bitvec", - "derive_more 0.99.18", + "derive_more 0.99.19", "fatality", "futures", "orchestra", @@ -7860,7 +7934,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d10a3da595ecd419e526a9cfcc013cd00bcd9a2c962991d6efb312df8307eaf" dependencies = [ "bounded-collections", - "derive_more 0.99.18", + "derive_more 0.99.19", "parity-scale-codec", "polkadot-core-primitives", "scale-info", @@ -8026,7 +8100,7 @@ dependencies = [ "concurrent-queue", "hermit-abi 0.4.0", "pin-project-lite", - "rustix 0.38.42", + "rustix 0.38.44", "tracing", "windows-sys 0.59.0", ] @@ -8065,27 +8139,36 @@ dependencies = [ "cliclack", "console", "contract-extrinsics", + "deranged", "dirs", "duct", "env_logger 0.11.7", "frame-benchmarking-cli", + "fs_rollback", "git2", "mockito", "open", "os_info", + "pathdiff", "pop-common", "pop-contracts", "pop-parachains", "pop-telemetry", + "predicates 3.1.3", + "proc-macro2", "reqwest", + "rust_writer", + "rustilities", "serde", "serde_json", + "similar", "sp-core 32.0.0", "sp-weights", "strum 0.26.3", "strum_macros 0.26.4", - "subxt 0.38.0", - "subxt-signer 0.38.0", + "subxt 0.38.1", + "subxt-signer 0.38.1", + "syn 2.0.100", "tempfile", "tokio", "toml 0.5.11", @@ -8099,25 +8182,31 @@ name = "pop-common" version = "0.6.0" dependencies = [ "anyhow", - "cargo_toml", + "cargo_toml 0.20.5", "contract-build", "contract-extrinsics", + "deranged", "duct", "flate2", + "fs_rollback", "git2", "git2_credentials", "ink_env", "mockito", + "proc-macro2", "regex", "reqwest", + "rust_writer", + "rustilities", "scale-info", "serde", "serde_json", "sp-core 32.0.0", "strum 0.26.3", "strum_macros 0.26.4", - "subxt 0.38.0", - "subxt-signer 0.38.0", + "subxt 0.38.1", + "subxt-signer 0.38.1", + "syn 2.0.100", "tar", "tempfile", "thiserror 1.0.69", @@ -8135,6 +8224,7 @@ dependencies = [ "contract-build", "contract-extrinsics", "contract-transcode", + "deranged", "duct", "heck 0.5.0", "ink_env", @@ -8145,8 +8235,8 @@ dependencies = [ "sp-weights", "strum 0.26.3", "strum_macros 0.26.4", - "subxt 0.38.0", - "subxt-signer 0.38.0", + "subxt 0.38.1", + "subxt-signer 0.38.1", "tempfile", "thiserror 1.0.69", "tokio", @@ -8162,6 +8252,7 @@ dependencies = [ "askama", "clap", "cumulus-primitives-proof-size-hostfunction 0.10.0", + "deranged", "duct", "frame-benchmarking-cli", "glob", @@ -8179,9 +8270,11 @@ dependencies = [ "srtool-lib", "strum 0.26.3", "strum_macros 0.26.4", - "subxt 0.38.0", - "subxt-signer 0.38.0", + "subxt 0.38.1", + "subxt-signer 0.38.1", "symlink", + "syn 2.0.100", + "tar", "tempfile", "thiserror 1.0.69", "tokio", @@ -8196,6 +8289,7 @@ dependencies = [ name = "pop-telemetry" version = "0.6.0" dependencies = [ + "deranged", "dirs", "env_logger 0.11.7", "log", @@ -8210,9 +8304,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" [[package]] name = "portable-atomic-util" @@ -8231,11 +8325,11 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.7.35", + "zerocopy 0.8.24", ] [[package]] @@ -8245,7 +8339,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", - "float-cmp", + "float-cmp 0.9.0", "itertools 0.10.5", "normalize-line-endings", "predicates-core", @@ -8254,26 +8348,29 @@ dependencies = [ [[package]] name = "predicates" -version = "3.1.2" +version = "3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97" +checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573" dependencies = [ "anstyle", "difflib", + "float-cmp 0.10.0", + "normalize-line-endings", "predicates-core", + "regex", ] [[package]] name = "predicates-core" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" +checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa" [[package]] name = "predicates-tree" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" +checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c" dependencies = [ "predicates-core", "termtree", @@ -8281,9 +8378,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" dependencies = [ "proc-macro2", "syn 2.0.100", @@ -8309,7 +8406,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d15600a7d856470b7d278b3fe0e311fe28c2526348549f8ef2ff7db3299c87f5" dependencies = [ "fixed-hash", - "impl-codec 0.7.0", + "impl-codec 0.7.1", "impl-num-traits", "impl-serde 0.5.0", "scale-info", @@ -8324,7 +8421,7 @@ checksum = "a172e6cc603231f2cf004232eabcecccc0da53ba576ab286ef7baa0cfc7927ad" dependencies = [ "coarsetime", "crossbeam-queue", - "derive_more 0.99.18", + "derive_more 0.99.19", "futures", "futures-timer", "nanorand", @@ -8344,9 +8441,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ "toml_edit", ] @@ -8492,7 +8589,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" dependencies = [ "heck 0.5.0", - "itertools 0.13.0", + "itertools 0.14.0", "log", "multimap", "once_cell", @@ -8512,7 +8609,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.11.0", + "itertools 0.12.1", "proc-macro2", "quote", "syn 2.0.100", @@ -8525,7 +8622,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.13.0", + "itertools 0.14.0", "proc-macro2", "quote", "syn 2.0.100", @@ -8656,9 +8753,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.39" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1f1914ce909e1658d9907913b4b91947430c7d9be598b15a1912935b8c04801" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -8694,7 +8791,7 @@ checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.3", - "zerocopy 0.8.23", + "zerocopy 0.8.24", ] [[package]] @@ -8766,7 +8863,7 @@ version = "11.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6df7ab838ed27997ba19a4664507e6f82b41fe6e20be42929332156e5e85146" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -8834,11 +8931,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -8854,18 +8951,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931" +checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" +checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" dependencies = [ "proc-macro2", "quote", @@ -8939,21 +9036,21 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.9" +version = "0.12.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2 0.4.7", - "http 1.2.0", + "h2 0.4.8", + "http 1.3.1", "http-body 1.0.1", "http-body-util", - "hyper 1.5.2", - "hyper-rustls 0.27.4", + "hyper 1.6.0", + "hyper-rustls 0.27.5", "hyper-tls", "hyper-util", "ipnet", @@ -8974,6 +9071,7 @@ dependencies = [ "tokio", "tokio-native-tls", "tokio-util", + "tower 0.5.2", "tower-service", "url", "wasm-bindgen", @@ -9019,9 +9117,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.13" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ac5d832aa16abd7d1def883a8545280c20a60f523a370aa3a9617c2b8550ee" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", @@ -9132,9 +9230,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.36.0" +version = "1.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" +checksum = "faa7de2ba56ac291bd90c6b9bece784a52ae1411f9506544b3eae36dd2356d50" dependencies = [ "arrayvec 0.7.6", "borsh", @@ -9146,6 +9244,33 @@ dependencies = [ "serde_json", ] +[[package]] +name = "rust_writer" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf4bb56f2de882403080044bd15dbafbdceb5437580638da25d257de8fbd86e" +dependencies = [ + "prettyplease", + "proc-macro2", + "regex", + "rust_writer_proc", + "rustilities", + "syn 2.0.100", + "thiserror 2.0.12", +] + +[[package]] +name = "rust_writer_proc" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54abd3b6b8f7e68143a45c862405827fc453433e46c5d892d59421607bea8074" +dependencies = [ + "proc-macro2", + "quote", + "rustilities", + "syn 2.0.100", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -9160,9 +9285,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustc-hex" @@ -9188,6 +9313,19 @@ dependencies = [ "nom", ] +[[package]] +name = "rustilities" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d049a83871f271465eba32e54bc8b9342795ac9675015dd9891938e6fec7f75" +dependencies = [ + "cargo_toml 0.21.0", + "proc-macro2", + "syn 2.0.100", + "thiserror 2.0.12", + "toml_edit", +] + [[package]] name = "rustix" version = "0.36.17" @@ -9204,14 +9342,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.42" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "errno", "libc", - "linux-raw-sys 0.4.14", + "linux-raw-sys 0.4.15", "windows-sys 0.59.0", ] @@ -9221,7 +9359,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e56a18552996ac8d29ecc3b190b4fdbb2d91ca4ec396de7bbffaf43f3d637e96" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "errno", "libc", "linux-raw-sys 0.9.3", @@ -9246,7 +9384,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", - "ring 0.17.13", + "ring 0.17.14", "rustls-webpki 0.101.7", "sct", ] @@ -9258,7 +9396,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", - "ring 0.17.13", + "ring 0.17.14", "rustls-pki-types", "rustls-webpki 0.102.8", "subtle 2.6.1", @@ -9267,15 +9405,15 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.23" +version = "0.23.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395" +checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c" dependencies = [ "log", "once_cell", - "ring 0.17.13", + "ring 0.17.14", "rustls-pki-types", - "rustls-webpki 0.102.8", + "rustls-webpki 0.103.1", "subtle 2.6.1", "zeroize", ] @@ -9349,10 +9487,10 @@ checksum = "afbb878bdfdf63a336a5e63561b1835e7a8c91524f51621db870169eac84b490" dependencies = [ "core-foundation 0.9.4", "core-foundation-sys", - "jni", + "jni 0.19.0", "log", "once_cell", - "rustls 0.23.23", + "rustls 0.23.25", "rustls-native-certs 0.7.3", "rustls-platform-verifier-android", "rustls-webpki 0.102.8", @@ -9362,6 +9500,27 @@ dependencies = [ "winapi", ] +[[package]] +name = "rustls-platform-verifier" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5467026f437b4cb2a533865eaa73eb840019a0916f4b9ec563c6e617e086c9" +dependencies = [ + "core-foundation 0.10.0", + "core-foundation-sys", + "jni 0.21.1", + "log", + "once_cell", + "rustls 0.23.25", + "rustls-native-certs 0.8.1", + "rustls-platform-verifier-android", + "rustls-webpki 0.103.1", + "security-framework 3.2.0", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.59.0", +] + [[package]] name = "rustls-platform-verifier-android" version = "0.1.1" @@ -9374,7 +9533,7 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.13", + "ring 0.17.14", "untrusted 0.9.0", ] @@ -9384,16 +9543,27 @@ version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ - "ring 0.17.13", + "ring 0.17.14", + "rustls-pki-types", + "untrusted 0.9.0", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" +dependencies = [ + "ring 0.17.14", "rustls-pki-types", "untrusted 0.9.0", ] [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "ruzstd" @@ -9402,7 +9572,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d" dependencies = [ "byteorder", - "derive_more 0.99.18", + "derive_more 0.99.19", "twox-hash", ] @@ -9413,7 +9583,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5174a470eeb535a721ae9fdd6e291c2411a906b96592182d05217591d5c5cf7b" dependencies = [ "byteorder", - "derive_more 0.99.18", + "derive_more 0.99.19", ] [[package]] @@ -9429,9 +9599,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "safe_arch" @@ -9553,7 +9723,7 @@ version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b18cef11d2c69703e0d7c3528202ef4ed1cd2b47a6f063e9e17cad8255b1fa94" dependencies = [ - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -9989,7 +10159,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58ac6a01eb88a5ea7e2ed7e6348f332548262fd00247c263f5b081dff3d1432b" dependencies = [ "futures", - "jsonrpsee 0.24.7", + "jsonrpsee 0.24.9", "log", "parity-scale-codec", "parking_lot 0.12.3", @@ -10021,7 +10191,7 @@ version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5a45ebf7365e369bea319018dd2706929d4d8d8807829a1989dfaf3f1c7125d" dependencies = [ - "jsonrpsee 0.24.7", + "jsonrpsee 0.24.9", "parity-scale-codec", "sc-chain-spec", "sc-mixnet", @@ -10046,11 +10216,11 @@ dependencies = [ "forwarded-header-value", "futures", "governor", - "http 1.2.0", + "http 1.3.1", "http-body-util", - "hyper 1.5.2", + "hyper 1.6.0", "ip_network", - "jsonrpsee 0.24.7", + "jsonrpsee 0.24.9", "log", "sc-rpc-api", "serde", @@ -10072,7 +10242,7 @@ dependencies = [ "futures-util", "hex", "itertools 0.11.0", - "jsonrpsee 0.24.7", + "jsonrpsee 0.24.9", "log", "parity-scale-codec", "parking_lot 0.12.3", @@ -10105,7 +10275,7 @@ dependencies = [ "exit-future", "futures", "futures-timer", - "jsonrpsee 0.24.7", + "jsonrpsee 0.24.9", "log", "parity-scale-codec", "parking_lot 0.12.3", @@ -10177,7 +10347,7 @@ version = "41.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e636383d99aa72ab948ea0939df12273a5b0cfe977e71c09ab6cc0379c051c2" dependencies = [ - "derive_more 0.99.18", + "derive_more 0.99.19", "futures", "libc", "log", @@ -10249,7 +10419,7 @@ version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "151cdf86d79abf22cf2a240a7ca95041c908dbd96c2ae9a818073042aa210964" dependencies = [ - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -10347,7 +10517,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afc79ba56a1c742f5aeeed1f1801f3edf51f7e818f0a54582cac6f131364ea7b" dependencies = [ - "derive_more 0.99.18", + "derive_more 0.99.19", "parity-scale-codec", "scale-bits 0.5.0", "scale-decode-derive 0.11.1", @@ -10361,7 +10531,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e98f3262c250d90e700bb802eb704e1f841e03331c2eb815e46516c4edbf5b27" dependencies = [ - "derive_more 0.99.18", + "derive_more 0.99.19", "parity-scale-codec", "primitive-types 0.12.2", "scale-bits 0.6.0", @@ -10427,7 +10597,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "628800925a33794fb5387781b883b5e14d130fece9af5a63613867b8de07c5c7" dependencies = [ - "derive_more 0.99.18", + "derive_more 0.99.19", "parity-scale-codec", "scale-encode-derive 0.6.0", "scale-type-resolver 0.1.1", @@ -10440,7 +10610,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528464e6ae6c8f98e2b79633bf79ef939552e795e316579dab09c61670d56602" dependencies = [ - "derive_more 0.99.18", + "derive_more 0.99.19", "parity-scale-codec", "primitive-types 0.12.2", "scale-bits 0.6.0", @@ -10484,7 +10654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef2618f123c88da9cd8853b69d766068f1eddc7692146d7dfe9b89e25ce2efd" dependencies = [ "darling 0.20.10", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -10497,7 +10667,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "102fbc6236de6c53906c0b262f12c7aa69c2bdc604862c12728f5f4d370bc137" dependencies = [ "darling 0.20.10", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -10524,7 +10694,7 @@ version = "2.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6630024bf739e2179b91fb424b28898baf819414262c5d376677dbff1fe7ebf" dependencies = [ - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -10583,7 +10753,7 @@ checksum = "8cd6ab090d823e75cfdb258aad5fe92e13f2af7d04b43a55d607d25fcc38c811" dependencies = [ "base58", "blake2 0.10.6", - "derive_more 0.99.18", + "derive_more 0.99.19", "either", "frame-metadata 15.1.0", "parity-scale-codec", @@ -10627,9 +10797,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" dependencies = [ "dyn-clone", "schemars_derive", @@ -10639,9 +10809,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" dependencies = [ "proc-macro2", "quote", @@ -10651,9 +10821,9 @@ dependencies = [ [[package]] name = "schnellru" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a8ef13a93c54d20580de1e5c413e624e53121d42fc7e2c11d10ef7f8b02367" +checksum = "356285bbf17bea63d9e52e96bd18f039672ac92b55b8cb997d6162a2a37d1649" dependencies = [ "ahash 0.8.11", "cfg-if", @@ -10687,9 +10857,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scratch" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" +checksum = "9f6280af86e5f559536da57a45ebc84948833b3bee313a7dd25232e09c878a52" [[package]] name = "scrypt" @@ -10709,7 +10879,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.13", + "ring 0.17.14", "untrusted 0.9.0", ] @@ -10815,7 +10985,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "core-foundation 0.9.4", "core-foundation-sys", "libc", @@ -10829,7 +10999,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "core-foundation 0.10.0", "core-foundation-sys", "libc", @@ -10848,9 +11018,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" dependencies = [ "serde", ] @@ -10882,9 +11052,9 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.15" +version = "0.11.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" +checksum = "8437fd221bde2d4ca316d61b90e337e9e702b3820b87d63caa9ba6c02bd06d96" dependencies = [ "serde", ] @@ -10913,9 +11083,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.139" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "indexmap 2.8.0", "itoa", @@ -10926,9 +11096,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +checksum = "59fab13f937fa393d08645bf3a84bdfe86e296747b506ada67bb15f10f218b2a" dependencies = [ "itoa", "serde", @@ -10936,9 +11106,9 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" dependencies = [ "proc-macro2", "quote", @@ -10968,9 +11138,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" dependencies = [ "base64 0.22.1", "chrono", @@ -11156,9 +11326,9 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "similar" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e" +checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" [[package]] name = "simple-dns" @@ -11166,7 +11336,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dee851d0e5e7af3721faea1843e8015e820a234f81fda3dea9247e15bac9a86a" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -11204,9 +11374,9 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "smallvec" -version = "1.13.2" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" [[package]] name = "smawk" @@ -11246,7 +11416,7 @@ dependencies = [ "bs58", "chacha20", "crossbeam-queue", - "derive_more 0.99.18", + "derive_more 0.99.19", "ed25519-zebra 4.0.3", "either", "event-listener 4.0.3", @@ -11301,10 +11471,10 @@ dependencies = [ "bs58", "chacha20", "crossbeam-queue", - "derive_more 0.99.18", + "derive_more 0.99.19", "ed25519-zebra 4.0.3", "either", - "event-listener 5.3.1", + "event-listener 5.4.0", "fnv", "futures-lite", "futures-util", @@ -11350,7 +11520,7 @@ dependencies = [ "async-lock", "base64 0.21.7", "blake2-rfc", - "derive_more 0.99.18", + "derive_more 0.99.19", "either", "event-listener 4.0.3", "fnv", @@ -11387,9 +11557,9 @@ dependencies = [ "base64 0.22.1", "blake2-rfc", "bs58", - "derive_more 0.99.18", + "derive_more 0.99.19", "either", - "event-listener 5.3.1", + "event-listener 5.4.0", "fnv", "futures-channel", "futures-lite", @@ -11429,7 +11599,7 @@ dependencies = [ "chacha20poly1305", "curve25519-dalek 4.1.3", "rand_core 0.6.4", - "ring 0.17.13", + "ring 0.17.14", "rustc_version", "sha2 0.10.8", "subtle 2.6.1", @@ -11479,7 +11649,7 @@ dependencies = [ "base64 0.22.1", "bytes", "futures", - "http 1.2.0", + "http 1.3.1", "httparse", "log", "rand 0.8.5", @@ -11541,7 +11711,7 @@ dependencies = [ "Inflector", "blake2 0.10.6", "expander", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -11556,7 +11726,7 @@ dependencies = [ "Inflector", "blake2 0.10.6", "expander", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -12315,7 +12485,7 @@ checksum = "0195f32c628fee3ce1dfbbf2e7e52a30ea85f3589da9fe62a8b816d70fc06294" dependencies = [ "Inflector", "expander", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -12768,7 +12938,7 @@ checksum = "9dbb79b4db5ac7e4628e6537551c905661d0525dfe34051d14137cd347f85e21" dependencies = [ "log", "serde_json", - "thiserror 2.0.11", + "thiserror 2.0.12", "ureq", ] @@ -12951,7 +13121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b6772e9c3621b8d067a706dfda6a20db6faa7cde39822c58ffc8588d16409c5" dependencies = [ "http-body-util", - "hyper 1.5.2", + "hyper 1.6.0", "hyper-util", "log", "prometheus", @@ -13009,9 +13179,9 @@ dependencies = [ [[package]] name = "subxt" -version = "0.38.0" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53029d133e4e0cb7933f1fe06f2c68804b956de9bb8fa930ffca44e9e5e4230" +checksum = "1c17d7ec2359d33133b63c97e28c8b7cd3f0a5bc6ce567ae3aef9d9e85be3433" dependencies = [ "async-trait", "derive-where", @@ -13020,7 +13190,7 @@ dependencies = [ "futures", "hex", "impl-serde 0.5.0", - "jsonrpsee 0.24.7", + "jsonrpsee 0.24.9", "parity-scale-codec", "polkadot-sdk", "primitive-types 0.13.1", @@ -13031,10 +13201,10 @@ dependencies = [ "scale-value 0.17.0", "serde", "serde_json", - "subxt-core 0.38.0", - "subxt-lightclient 0.38.0", - "subxt-macro 0.38.0", - "subxt-metadata 0.38.0", + "subxt-core 0.38.1", + "subxt-lightclient 0.38.1", + "subxt-macro 0.38.1", + "subxt-metadata 0.38.1", "thiserror 1.0.69", "tokio", "tokio-util", @@ -13067,9 +13237,9 @@ dependencies = [ [[package]] name = "subxt-codegen" -version = "0.38.0" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cfcfb7d9589f3df0ac87c4988661cf3fb370761fcb19f2fd33104cc59daf22a" +checksum = "6550ef451c77db6e3bc7c56fb6fe1dca9398a2c8fc774b127f6a396a769b9c5b" dependencies = [ "heck 0.5.0", "parity-scale-codec", @@ -13077,7 +13247,7 @@ dependencies = [ "quote", "scale-info", "scale-typegen 0.9.0", - "subxt-metadata 0.38.0", + "subxt-metadata 0.38.1", "syn 2.0.100", "thiserror 1.0.69", ] @@ -13111,9 +13281,9 @@ dependencies = [ [[package]] name = "subxt-core" -version = "0.38.0" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea28114366780d23684bd55ab879cd04c9d4cbba3b727a3854a3eca6bf29a1a" +checksum = "cb7a1bc6c9c1724971636a66e3225a7253cdb35bb6efb81524a6c71c04f08c59" dependencies = [ "base58", "blake2 0.10.6", @@ -13134,7 +13304,7 @@ dependencies = [ "scale-value 0.17.0", "serde", "serde_json", - "subxt-metadata 0.38.0", + "subxt-metadata 0.38.1", "tracing", ] @@ -13157,9 +13327,9 @@ dependencies = [ [[package]] name = "subxt-lightclient" -version = "0.38.0" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534d4b725183a9fa09ce0e0f135674473297fdd97dee4d683f41117f365ae997" +checksum = "89ebc9131da4d0ba1f7814495b8cc79698798ccd52cacd7bcefe451e415bd945" dependencies = [ "futures", "futures-util", @@ -13189,16 +13359,16 @@ dependencies = [ [[package]] name = "subxt-macro" -version = "0.38.0" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "228db9a5c95a6d8dc6152b4d6cdcbabc4f60821dd3f482a4f8791e022b7caadb" +checksum = "7819c5e09aae0319981ee853869f2fcd1fac4db8babd0d004c17161297aadc05" dependencies = [ "darling 0.20.10", "parity-scale-codec", "proc-macro-error2", "quote", "scale-typegen 0.9.0", - "subxt-codegen 0.38.0", + "subxt-codegen 0.38.1", "subxt-utils-fetchmetadata", "syn 2.0.100", ] @@ -13218,9 +13388,9 @@ dependencies = [ [[package]] name = "subxt-metadata" -version = "0.38.0" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee13e6862eda035557d9a2871955306aff540d2b89c06e0a62a1136a700aed28" +checksum = "aacd4e7484fef58deaa2dcb32d94753a864b208a668c0dd0c28be1d8abeeadb2" dependencies = [ "frame-decode", "frame-metadata 17.0.0", @@ -13256,9 +13426,9 @@ dependencies = [ [[package]] name = "subxt-signer" -version = "0.38.0" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7a336d6a1f86f126100a4a717be58352de4c8214300c4f7807f974494efdb9" +checksum = "d680352d04665b1e4eb6f9d2a54b800c4d8e1b20478e69be1b7d975b08d9fc34" dependencies = [ "base64 0.22.1", "bip39", @@ -13277,15 +13447,15 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", - "subxt-core 0.38.0", + "subxt-core 0.38.1", "zeroize", ] [[package]] name = "subxt-utils-fetchmetadata" -version = "0.38.0" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082b17a86e3c3fe45d858d94d68f6b5247caace193dad6201688f24db8ba9bb" +checksum = "a3c53bc3eeaacc143a2f29ace4082edd2edaccab37b69ad20befba9fb00fdb3d" dependencies = [ "hex", "parity-scale-codec", @@ -13358,7 +13528,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "core-foundation 0.9.4", "system-configuration-sys", ] @@ -13381,9 +13551,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tar" -version = "0.4.43" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c65998313f8e17d0d553d28f91a0df93e4dbbbf770279c7bc21ca0f09ea1a1f6" +checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a" dependencies = [ "filetime", "libc", @@ -13398,14 +13568,14 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.14.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" dependencies = [ - "cfg-if", "fastrand", + "getrandom 0.3.2", "once_cell", - "rustix 0.38.42", + "rustix 1.0.3", "windows-sys 0.59.0", ] @@ -13440,19 +13610,19 @@ dependencies = [ [[package]] name = "termtree" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" +checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" [[package]] name = "textwrap" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" +checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" dependencies = [ "smawk", "unicode-linebreak", - "unicode-width 0.1.14", + "unicode-width", ] [[package]] @@ -13466,11 +13636,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.11", + "thiserror-impl 2.0.12", ] [[package]] @@ -13486,9 +13656,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", @@ -13534,9 +13704,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.37" +version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" dependencies = [ "deranged", "itoa", @@ -13549,15 +13719,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" [[package]] name = "time-macros" -version = "0.2.19" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" dependencies = [ "num-conv", "time-core", @@ -13584,9 +13754,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" dependencies = [ "tinyvec_macros", ] @@ -13599,9 +13769,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.42.0" +version = "1.44.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" dependencies = [ "backtrace", "bytes", @@ -13627,9 +13797,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", @@ -13669,11 +13839,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" +checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" dependencies = [ - "rustls 0.23.23", + "rustls 0.23.25", "tokio", ] @@ -13722,19 +13892,19 @@ checksum = "7a9daff607c6d2bf6c16fd681ccb7eecc83e4e2cdc1ca067ffaadfca5de7f084" dependencies = [ "futures-util", "log", - "rustls 0.23.23", + "rustls 0.23.25", "rustls-native-certs 0.8.1", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.1", + "tokio-rustls 0.26.2", "tungstenite 0.26.2", ] [[package]] name = "tokio-util" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" +checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" dependencies = [ "bytes", "futures-core", @@ -13756,9 +13926,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" dependencies = [ "serde", "serde_spanned", @@ -13777,9 +13947,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap 2.8.0", "serde", @@ -13828,7 +13998,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ "base64 0.21.7", - "bitflags 2.6.0", + "bitflags 2.9.0", "bytes", "futures-core", "futures-util", @@ -13848,9 +14018,9 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "bytes", - "http 1.2.0", + "http 1.3.1", "http-body 1.0.1", "http-body-util", "pin-project-lite", @@ -13864,10 +14034,10 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", "bytes", "futures-util", - "http 1.2.0", + "http 1.3.1", "http-body 1.0.1", "http-body-util", "http-range-header 0.4.2", @@ -13957,7 +14127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f074568687ffdfd0adb6005aa8d1d96840197f2c159f80471285f08694cf0ce" dependencies = [ "expander", - "proc-macro-crate 3.2.0", + "proc-macro-crate 3.3.0", "proc-macro2", "quote", "syn 2.0.100", @@ -14139,14 +14309,14 @@ checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13" dependencies = [ "bytes", "data-encoding", - "http 1.2.0", + "http 1.3.1", "httparse", "log", "rand 0.9.0", - "rustls 0.23.23", + "rustls 0.23.25", "rustls-pki-types", "sha1", - "thiserror 2.0.11", + "thiserror 2.0.12", "url", "utf-8", ] @@ -14171,9 +14341,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "ucd-trie" @@ -14207,9 +14377,9 @@ dependencies = [ [[package]] name = "unicase" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-bidi" @@ -14219,9 +14389,9 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.14" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "unicode-linebreak" @@ -14244,12 +14414,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "unicode-width" version = "0.2.0" @@ -14314,15 +14478,15 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "3.0.7" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f85f9ee53e53fd3f65b73dc51c5a782785d1a6cc381a06652a1141649537ad8" +checksum = "4b0351ca625c7b41a8e4f9bb6c5d9755f67f62c2187ebedecacd9974674b271d" dependencies = [ "base64 0.22.1", "flate2", "log", "percent-encoding", - "rustls 0.23.23", + "rustls 0.23.25", "rustls-pemfile 2.2.0", "rustls-pki-types", "ureq-proto", @@ -14332,12 +14496,12 @@ dependencies = [ [[package]] name = "ureq-proto" -version = "0.3.2" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e8862e186de3ad6ea1505dd071d179ec27aa7d2cb0798196c83f94625c8e9a" +checksum = "ae239d0a3341aebc94259414d1dc67cfce87d41cbebc816772c91b77902fafa4" dependencies = [ "base64 0.22.1", - "http 1.2.0", + "http 1.3.1", "httparse", "log", ] @@ -14380,11 +14544,11 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.11.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.3.2", ] [[package]] @@ -14399,9 +14563,9 @@ dependencies = [ [[package]] name = "valuable" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "vcpkg" @@ -14447,9 +14611,9 @@ dependencies = [ [[package]] name = "wait-timeout" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" dependencies = [ "libc", ] @@ -14499,20 +14663,21 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", @@ -14524,9 +14689,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.49" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", @@ -14537,9 +14702,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -14547,9 +14712,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", @@ -14560,18 +14725,21 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "wasm-encoder" -version = "0.220.0" +version = "0.220.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebf48234b389415b226a4daef6562933d38c7b28a8b8f64c5c4130dad1561ab7" +checksum = "e913f9242315ca39eff82aee0e19ee7a372155717ff0eb082c741e435ce25ed1" dependencies = [ "leb128", - "wasmparser 0.220.0", + "wasmparser 0.220.1", ] [[package]] @@ -14734,12 +14902,12 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.220.0" +version = "0.220.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e246c2772ce3ebc83f89a2d4487ac5794cad6c309b2071818a88c7db7c36d87b" +checksum = "8d07b6a3b550fefa1a914b6d54fc175dd11c3392da11eee604e6ffc759805d25" dependencies = [ "ahash 0.8.11", - "bitflags 2.6.0", + "bitflags 2.9.0", "hashbrown 0.14.5", "indexmap 2.8.0", "semver", @@ -14952,9 +15120,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -14976,10 +15144,19 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.17.13", + "ring 0.17.14", "untrusted 0.9.0", ] +[[package]] +name = "webpki-root-certs" +version = "0.26.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09aed61f5e8d2c18344b3faa33a4c837855fe56642757754775548fee21386c4" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "webpki-roots" version = "0.25.4" @@ -14997,13 +15174,13 @@ dependencies = [ [[package]] name = "which" -version = "7.0.0" +version = "7.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9cad3279ade7346b96e38731a641d7343dd6a53d55083dd54eadfa5a1b38c6b" +checksum = "2774c861e1f072b3aadc02f8ba886c26ad6321567ecc294c935434cad06f1283" dependencies = [ "either", - "home", - "rustix 0.38.42", + "env_home", + "rustix 0.38.44", "winsafe", ] @@ -15093,15 +15270,21 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-link" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + [[package]] name = "windows-registry" -version = "0.2.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" dependencies = [ - "windows-result 0.2.0", + "windows-result 0.3.2", "windows-strings", - "windows-targets 0.52.6", + "windows-targets 0.53.0", ] [[package]] @@ -15115,21 +15298,20 @@ dependencies = [ [[package]] name = "windows-result" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" dependencies = [ - "windows-targets 0.52.6", + "windows-link", ] [[package]] name = "windows-strings" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" dependencies = [ - "windows-result 0.2.0", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -15207,13 +15389,29 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -15232,6 +15430,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -15250,6 +15454,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -15268,12 +15478,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -15292,6 +15514,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -15310,6 +15538,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -15328,6 +15562,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -15346,11 +15586,17 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + [[package]] name = "winnow" -version = "0.6.20" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" dependencies = [ "memchr", ] @@ -15377,7 +15623,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.9.0", ] [[package]] @@ -15443,19 +15689,18 @@ dependencies = [ "nom", "oid-registry 0.8.1", "rusticata-macros", - "thiserror 2.0.11", + "thiserror 2.0.12", "time", ] [[package]] name = "xattr" -version = "1.3.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" +checksum = "0d65cbf2f12c15564212d48f4e3dfb87923d25d611f2aed18f4cb23f0413d89e" dependencies = [ "libc", - "linux-raw-sys 0.4.14", - "rustix 0.38.42", + "rustix 1.0.3", ] [[package]] @@ -15499,9 +15744,9 @@ dependencies = [ [[package]] name = "xxhash-rust" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a5cbf750400958819fb6178eaa83bee5cd9c29a26a40cc241df8c70fdd46984" +checksum = "fdd20c5420375476fbd4394763288da7eb0cc0b8c11deed431a91562af7335d3" [[package]] name = "yamux" @@ -15579,17 +15824,16 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "byteorder", "zerocopy-derive 0.7.35", ] [[package]] name = "zerocopy" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ - "zerocopy-derive 0.8.23", + "zerocopy-derive 0.8.24", ] [[package]] @@ -15605,9 +15849,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", @@ -15616,18 +15860,18 @@ dependencies = [ [[package]] name = "zerofrom" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", @@ -15692,9 +15936,9 @@ dependencies = [ [[package]] name = "zombienet-configuration" -version = "0.2.26" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7941f65dadce0e0d0e55e86ae5e6d04bcc9798544fb47c7dd6f1023339c04dba" +checksum = "f4e0e7e93b56f7fdea2e732399caff7f773a1ef4c19a98a24514b390f832504e" dependencies = [ "anyhow", "lazy_static", @@ -15705,7 +15949,7 @@ dependencies = [ "serde_json", "thiserror 1.0.69", "tokio", - "toml 0.8.19", + "toml 0.8.20", "tracing", "url", "zombienet-support", @@ -15713,9 +15957,9 @@ dependencies = [ [[package]] name = "zombienet-orchestrator" -version = "0.2.26" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccf76e4952f3611822c3a2c6e06a8ec80c8d1b29608001be6955645272d35df" +checksum = "4a36a3983d7c06e30f585ba99e983c5d28b9622b44d8e5ba11a9718d2712c418" dependencies = [ "anyhow", "async-trait", @@ -15732,8 +15976,8 @@ dependencies = [ "serde_json", "sha2 0.10.8", "sp-core 35.0.0", - "subxt 0.38.0", - "subxt-signer 0.38.0", + "subxt 0.38.1", + "subxt-signer 0.38.1", "thiserror 1.0.69", "tokio", "tracing", @@ -15746,9 +15990,9 @@ dependencies = [ [[package]] name = "zombienet-prom-metrics-parser" -version = "0.2.26" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fe68ac63e9a5e519da0545e0ca2e074ab5fe8229b86e2a43f639a13c2b58fb" +checksum = "70f596e81ddcd8c6d70abcd8f6b336dac6bfdd7a94f1fce3696b8889231084b0" dependencies = [ "pest", "pest_derive", @@ -15757,9 +16001,9 @@ dependencies = [ [[package]] name = "zombienet-provider" -version = "0.2.26" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aac2749ed001ab31041e8bdd0f06c067e853ab56c2e0358c5df3496f1e033012" +checksum = "0431363423a2a378a24d4148056e80cdf45911f238a2e597d4eb2b8a3b2ae334" dependencies = [ "anyhow", "async-trait", @@ -15788,15 +16032,15 @@ dependencies = [ [[package]] name = "zombienet-sdk" -version = "0.2.26" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae5fdf40b7d3d51b1b64e8a592b7a2fd01baf82ebf7182e7fb35b5686b526493" +checksum = "f725d029b34acea1e5de4df09835de70594d828db57338c528dea52753be9343" dependencies = [ "async-trait", "futures", "lazy_static", - "subxt 0.38.0", - "subxt-signer 0.38.0", + "subxt 0.38.1", + "subxt-signer 0.38.1", "tokio", "zombienet-configuration", "zombienet-orchestrator", @@ -15806,9 +16050,9 @@ dependencies = [ [[package]] name = "zombienet-support" -version = "0.2.26" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131c64f2e3e45c8ff96eeabf1909c35031473b3426f541f1c9c286931ed44b93" +checksum = "e3cfa5555e6725c65e1dfbec6fcd49ef2799ac1a89d4fe56255ed21882275cee" dependencies = [ "anyhow", "async-trait", @@ -15863,9 +16107,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.14+zstd.1.5.7" +version = "2.0.15+zstd.1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb060d4926e4ac3a3ad15d864e99ceb5f343c6b34f5bd6d81ae6ed417311be5" +checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index 99bf9d75a..bde62ae68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,14 +24,26 @@ version = "0.6.0" anyhow = "1.0" assert_cmd = "2.0.14" cargo_toml = "0.20.3" +# deranged 0.4.1 implements PartialOrd for some types leading to conflicts with core primitive types. +# Some related discussion: 'https://github.com/jhpratt/deranged/issues/18' +# This creates conflicts on the dependency tree of Pop-cli as deranged is somewhere there and some downstream crates +# are affected in the way described in the discussion. Til that's fixed, a pin to the version 0.4.0 is necessary as +# a workaround. Pinned in all pop-cli crates for this reason. +deranged = { version = "=0.4.0", default-features = false } dirs = "5.0" duct = "0.13" env_logger = "0.11.7" flate2 = "1.0.30" +fs_rollback = "3.0.0" git2 = { version = "0.18", features = ["vendored-openssl"] } glob = "0.3.1" log = "0.4.20" mockito = "1.4.0" +pathdiff = "0.2.1" +proc-macro2 = "1.0.86" +rustilities = "2.1.0" +rust_writer = "1.0.4" +syn = "2.0.100" tar = "0.4.40" tempfile = "3.10" thiserror = "1.0.58" diff --git a/crates/pop-cli/Cargo.toml b/crates/pop-cli/Cargo.toml index ec544a520..7d894095d 100644 --- a/crates/pop-cli/Cargo.toml +++ b/crates/pop-cli/Cargo.toml @@ -14,12 +14,20 @@ path = "src/main.rs" [dependencies] anyhow.workspace = true +# Pin to solve dependencies conflics. See Cargo.toml for further info. +deranged.workspace = true duct.workspace = true env_logger.workspace = true +fs_rollback.workspace = true os_info.workspace = true +pathdiff.workspace = true +proc-macro2.workspace = true reqwest.workspace = true +rustilities = { workspace = true, features = ["paths", "fmt", "manifest"]} +rust_writer.workspace = true serde = { workspace = true, features = ["derive"] } serde_json.workspace = true +syn = { workspace = true, features = ["parsing"] } tempfile.workspace = true tokio.workspace = true toml.workspace = true @@ -64,6 +72,8 @@ mockito.workspace = true subxt.workspace = true subxt-signer.workspace = true sp-weights.workspace = true +similar = "2.7.0" +predicates = "3.0.3" [features] default = ["contract", "parachain", "telemetry"] diff --git a/crates/pop-cli/src/commands/add/mod.rs b/crates/pop-cli/src/commands/add/mod.rs new file mode 100644 index 000000000..adf15aa3b --- /dev/null +++ b/crates/pop-cli/src/commands/add/mod.rs @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-3.0 + +use clap::{Args, Subcommand}; + +pub mod pallet_config_type; +pub mod runtime_pallet; + +/// Arguments for adding a new feature to existing code +#[derive(Args)] +#[command(args_conflicts_with_subcommands = true)] +pub struct AddArgs { + #[command(subcommand)] + pub command: Command, +} + +#[derive(Subcommand)] +pub enum Command { + /// Expand your runtime using Pop-Cli + #[command(subcommand)] + Runtime(RuntimeCommand), + /// Expand a pallet using Pop-Cli + #[command(subcommand)] + Pallet(PalletCommand), +} + +#[derive(Subcommand)] +pub enum RuntimeCommand { + /// Add pallets to an existing runtime + Pallet(runtime_pallet::AddPalletCommand), +} + +#[derive(Subcommand)] +pub enum PalletCommand { + /// Add a new config type to an existing pallet + ConfigType(pallet_config_type::AddConfigTypeCommand), +} diff --git a/crates/pop-cli/src/commands/add/pallet_config_type.rs b/crates/pop-cli/src/commands/add/pallet_config_type.rs new file mode 100644 index 000000000..6a79fe5ee --- /dev/null +++ b/crates/pop-cli/src/commands/add/pallet_config_type.rs @@ -0,0 +1,322 @@ +// SPDX-License-Identifier: GPL-3.0 + +mod common_types; + +use crate::{ + cli::{traits::Cli as _, Cli}, + multiselect_pick, +}; +use clap::{error::ErrorKind, Args, Command}; +use cliclack::multiselect; +use fs_rollback::Rollback; +use pop_common::{manifest, rust_writer_helpers::DefaultConfigType}; +use rust_writer::{ + ast::{ + finder, + finder::{Finder, ToFind}, + implementors::{ItemToFile, ItemToImpl, ItemToMod, ItemToTrait}, + mutator, + mutator::{Mutator, ToMutate}, + }, + preserver::Preserver, +}; +use std::{env, fs, path::PathBuf}; +use strum::{EnumMessage, IntoEnumIterator}; +use syn::{parse_quote, visit_mut::VisitMut}; + +#[mutator(ItemToImpl<'a>, ItemToImpl<'a>, ItemToImpl<'a>, ItemToImpl<'a>)] +#[finder(ItemToImpl<'a>, ItemToImpl<'a>, ItemToImpl<'a>, ItemToImpl<'a>)] +#[impl_from] +struct DefaultConfigsImplementor; + +#[derive(Args, Debug, Clone)] +pub struct AddConfigTypeCommand { + #[arg(short, long, value_enum, num_args(1..), required = false, help = "The types you want to include in your pallet.")] + pub(crate) types: Vec, + #[arg( + short, + long, + help = "Pop-CLI will add the config type to the current directory lib if there's one. Use this argument to point to other path." + )] + pub(crate) pallet_path: Option, + #[arg( + long, + help = "If your pallet is part of a workspace containing a runtime, Pop-Cli will look for the impl block in configs/your_pallet_name.rs or in the runtime lib file to add the new type. Use this argument to point to other path." + )] + pub(crate) pallet_impl_path: Option, +} + +impl AddConfigTypeCommand { + pub(crate) async fn execute(self) -> anyhow::Result<()> { + Cli.intro("Add a new type to your pallet")?; + let mut cmd = Command::new(""); + + let pallet_path = if let Some(path) = &self.pallet_path { + rustilities::paths::prefix_with_current_dir(path) + } else { + // If not provided, use the working dir + let working_dir = match env::current_dir() { + Ok(working_dir) => working_dir, + _ => cmd.error(ErrorKind::Io, "Cannot modify the working crate").exit(), + }; + rustilities::paths::prefix_with_current_dir(working_dir) + }; + + let src = pallet_path.join("src"); + // Check that the path correspond to a pallet using that the file lib.rs always contains the + // line #[pallet::pallet]. + let pallet_lib_path = src.join("lib.rs"); + if !pallet_lib_path.is_file() { + cmd.error( + ErrorKind::InvalidValue, + "Make sure that the used path correspond to a pallet crate.", + ) + .exit(); + } + let lib_content = fs::read_to_string(&pallet_lib_path)?; + if !lib_content.contains("#[pallet::pallet]") { + cmd.error( + ErrorKind::InvalidValue, + "Make sure that the used path correspond to a pallet crate.", + ) + .exit(); + } + + let mut types = if self.types.is_empty() { + multiselect_pick!( + common_types::CommonTypes, + "Select the types you want to include in your pallet" + ) + } else { + self.types + }; + + types = common_types::complete_dependencies(types); + + let using_default_config = lib_content.contains("pub mod config_preludes"); + let pallet_crate_name = + rustilities::manifest::find_crate_name(&pallet_path.join("Cargo.toml")) + .ok_or(anyhow::anyhow!("Couldn't determine the pallet's crate name"))?; + let config_preludes_path = pallet_path.join("src").join("config_preludes.rs"); + let runtime_path = manifest::find_pallet_runtime_path(&pallet_path); + let pallet_mock_path = pallet_path.join("src").join("mock.rs"); + + let spinner = cliclack::spinner(); + spinner.start("Updating pallet's config trait..."); + + let pallet_impl_path = if let Some(ref runtime_path) = runtime_path { + match self.pallet_impl_path { + Some(_) => self.pallet_impl_path.clone(), + _ => Some(manifest::get_pallet_impl_path( + &runtime_path, + &pallet_crate_name.splitn(2, '-').nth(1).unwrap_or("pallet").to_owned(), + )?), + } + } else { + None + }; + + let mut rollback = Rollback::with_capacity(4, 0, 0); + + rollback.note_file(&pallet_lib_path)?; + rollback.note_file(&pallet_mock_path)?; + // This may be Err cause the config preludes file may not exist. And it's perfect + let _ = rollback.note_file(&config_preludes_path); + // Note pallet_impl_path if needed + if let Some(ref pallet_impl_path) = pallet_impl_path { + rollback.note_file(&pallet_impl_path)?; + } + + let roll_pallet_lib_path = rollback + .get_noted_file(&pallet_lib_path) + .expect("The file has been noted above; qed;"); + let roll_pallet_mock_path = rollback + .get_noted_file(&pallet_mock_path) + .expect("The file has been noted above; qed;"); + + for type_ in types { + let use_preserver = Preserver::new("use"); + let pub_use_preserver = Preserver::new("pub use"); + let mut mod_pallet_and_config_trait_preserver = Preserver::new("pub mod pallet"); + mod_pallet_and_config_trait_preserver.add_inners(&["pub trait Config"]); + + let mut preserved_ast = rust_writer::preserver::preserve_and_parse( + roll_pallet_lib_path, + &[&use_preserver, &pub_use_preserver, &mod_pallet_and_config_trait_preserver], + )?; + + for use_statement in type_.get_needed_use_statements() { + let use_statement: ItemToFile = use_statement.into(); + let mut finder = Finder::default().to_find(&use_statement); + let use_statement_used = finder.find(&preserved_ast); + if !use_statement_used { + let mut mutator = Mutator::default().to_mutate(&use_statement); + mutator.mutate(&mut preserved_ast)?; + } + } + + for composite_enum in type_.get_needed_composite_enums() { + let composite_enum_implementor: ItemToMod = ("pallet", composite_enum).into(); + let mut finder = Finder::default().to_find(&composite_enum_implementor); + let composite_enum_used = finder.find(&preserved_ast); + if !composite_enum_used { + let mut mutator = Mutator::default().to_mutate(&composite_enum_implementor); + mutator.mutate(&mut preserved_ast)?; + } + } + + let default_config = if using_default_config { + type_.get_default_config() + } else { + // Here the inner element's irrelevant, so we place a simple type definition + DefaultConfigType::Default { type_default_impl: parse_quote! {type marker = ();} } + }; + + let type_implementor: ItemToTrait = + ("Config", type_.get_type_definition(default_config.clone())).into(); + let mut finder = Finder::default().to_find(&type_implementor); + let type_already_used = finder.find(&preserved_ast); + + if !type_already_used { + let mut mutator = Mutator::default().to_mutate(&type_implementor); + mutator.mutate(&mut preserved_ast)?; + } else { + return Err(anyhow::anyhow!(format!( + "{} is already in use.", + type_.get_message().expect("Message defined for all types; qed;") + ))); + } + + rust_writer::preserver::resolve_preserved(&preserved_ast, roll_pallet_lib_path)?; + + match default_config { + // Need to update default config + DefaultConfigType::Default { type_default_impl } | + DefaultConfigType::NoDefaultBounds { type_default_impl } + if using_default_config => + { + // If config_preludes isn't defined in its own file, we use the lib file. + let file_path = if config_preludes_path.is_file() { + rollback + .get_noted_file(&config_preludes_path) + .expect("config_preludes_path is file, so it's well noted; qed") + } else { + roll_pallet_lib_path + }; + + // Define preservers for the most common used struct names for default config. + let preserver_testchain_config = + Preserver::new("impl DefaultConfig for TestDefaultConfig"); + + let preserver_solochain_config = + Preserver::new("impl DefaultConfig for SolochainDefaultConfig"); + + let preserver_relaychain_config = + Preserver::new("impl DefaultConfig for RelayChainDefaultConfig"); + + let preserver_parachain_config = + Preserver::new("impl DefaultConfig for ParaChainDefaultConfig"); + + let mut preserved_ast = rust_writer::preserver::preserve_and_parse( + file_path, + &[ + &preserver_testchain_config, + &preserver_solochain_config, + &preserver_relaychain_config, + &preserver_parachain_config, + ], + )?; + + let default_config_implementor: DefaultConfigsImplementor = ( + (Some("DefaultConfig"), "TestDefaultConfig", type_default_impl.clone()) + .into(), + (Some("DefaultConfig"), "TestDefaultConfig", type_default_impl.clone()) + .into(), + (Some("DefaultConfig"), "TestDefaultConfig", type_default_impl.clone()) + .into(), + (Some("DefaultConfig"), "TestDefaultConfig", type_default_impl.clone()) + .into(), + ) + .into(); + + let mut finder: DefaultConfigsImplementorFinderWrapper = + Finder::default().to_find(&default_config_implementor).into(); + finder.find(&preserved_ast, None); + let missing_indexes = finder.get_missing_indexes(); + if missing_indexes.is_some() { + let mut mutator: DefaultConfigsImplementorMutatorWrapper = + Mutator::default().to_mutate(&default_config_implementor).into(); + mutator.mutate(&mut preserved_ast, missing_indexes.as_deref())?; + rust_writer::preserver::resolve_preserved(&preserved_ast, file_path)?; + } + }, + // Need to update runtimes + _ => { + let pallet_name = pallet_crate_name.replace("-", "_"); + let pallet_config_trait_impl = format!("impl {}::Config", pallet_name); + let pallet_impl_preserver = Preserver::new(&pallet_config_trait_impl); + + let runtime_value_implementor: ItemToImpl = + (Some("Config"), "Runtime", type_.get_common_runtime_value()).into(); + + let mock_runtime_value_implementor: ItemToImpl = + (Some("Config"), "Test", type_.get_common_runtime_value()).into(); + + if let Some(ref impl_path) = pallet_impl_path { + let roll_impl_path = rollback + .get_noted_file(impl_path) + .expect("The file has been noted above; qed;"); + + let mut preserved_ast = rust_writer::preserver::preserve_and_parse( + roll_impl_path, + &[&pallet_impl_preserver], + )?; + + let mut finder = Finder::default().to_find(&runtime_value_implementor); + let runtime_value_already_used = finder.find(&preserved_ast); + if !runtime_value_already_used { + let mut mutator = + Mutator::default().to_mutate(&runtime_value_implementor); + mutator.mutate(&mut preserved_ast)?; + rust_writer::preserver::resolve_preserved( + &preserved_ast, + roll_impl_path, + )?; + } + } + + let mut preserved_ast = rust_writer::preserver::preserve_and_parse( + roll_pallet_mock_path, + &[&pallet_impl_preserver], + )?; + + let mut finder = Finder::default().to_find(&mock_runtime_value_implementor); + let runtime_value_already_used = finder.find(&preserved_ast); + if !runtime_value_already_used { + let mut mutator = + Mutator::default().to_mutate(&mock_runtime_value_implementor); + mutator.mutate(&mut preserved_ast)?; + rust_writer::preserver::resolve_preserved( + &preserved_ast, + roll_pallet_mock_path, + )?; + } + }, + } + } + + rollback.commit()?; + + if let Some(mut workspace_toml) = + rustilities::manifest::find_workspace_manifest(&pallet_path) + { + workspace_toml.pop(); + rustilities::fmt::format_dir(&workspace_toml)?; + } else { + rustilities::fmt::format_dir(&pallet_path)?; + } + + spinner.stop("Your types are ready to be used in your pallet 🚀"); + Ok(()) + } +} diff --git a/crates/pop-cli/src/commands/add/pallet_config_type/common_types.rs b/crates/pop-cli/src/commands/add/pallet_config_type/common_types.rs new file mode 100644 index 000000000..c971c69bf --- /dev/null +++ b/crates/pop-cli/src/commands/add/pallet_config_type/common_types.rs @@ -0,0 +1,195 @@ +// SPDX-License-Identifier: GPL-3.0 +use clap::ValueEnum; +use pop_common::rust_writer_helpers::DefaultConfigType; +use strum_macros::{EnumIter, EnumMessage}; +use syn::{parse_quote, ImplItem, Item, TraitItem}; + +/// This enum is used to register from the CLI which types that are kind of usual in config traits +/// are included in the pallet +#[derive(Debug, Copy, Clone, PartialEq, EnumIter, EnumMessage, ValueEnum)] +pub enum CommonTypes { + /// This type will enable your pallet to emit events. + #[strum( + message = "RuntimeEvent", + detailed_message = "This type will enable your pallet to emit events." + )] + RuntimeEvent, + /// This type will be helpful if your pallet needs to deal with the outer RuntimeOrigin enum, + /// or if your pallet needs to use custom origins. + #[strum( + message = "RuntimeOrigin", + detailed_message = "This type will be helpful if your pallet needs to deal with the outer RuntimeOrigin enum, or if your pallet needs to use custom origins." + )] + RuntimeOrigin, + /// This type will be helpful if your pallet needs to hold funds. + #[strum( + message = "RuntimeHoldReason", + detailed_message = "This type will be helpful if your pallet needs to hold funds." + )] + RuntimeHoldReason, + /// This type will be helpful if your pallet needs to freeze funds. + #[strum( + message = "RuntimeFreezeReason", + detailed_message = "This type will be helpful if your pallet needs to freeze funds." + )] + RuntimeFreezeReason, + /// This type will allow your pallet to manage fungible assets. If you add this type to your + /// pallet, RuntimeHoldReason and RuntimeFreezeReason will be added as well + #[strum( + message = "Fungibles", + detailed_message = "This type will allow your pallet to manage fungible assets. If you add this type to your pallet, RuntimeHoldReason and RuntimeFreezeReason will be added as well" + )] + Fungibles, +} + +impl CommonTypes { + pub fn get_type_definition(&self, default_config: DefaultConfigType) -> TraitItem { + match (self, default_config) { + (CommonTypes::RuntimeEvent, DefaultConfigType::NoDefaultBounds { .. }) => + parse_quote! { + /// The aggregated event type of the runtime. + #[pallet::no_default_bounds] + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + }, + (CommonTypes::RuntimeEvent, DefaultConfigType::Default { .. }) => parse_quote! { + /// The aggregated event type of the runtime. + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + }, + (CommonTypes::RuntimeOrigin, DefaultConfigType::NoDefaultBounds { .. }) => + parse_quote! { + /// The aggregated origin type of the runtime. + #[pallet::no_default_bounds] + type RuntimeOrigin: From>; + }, + (CommonTypes::RuntimeOrigin, DefaultConfigType::Default { .. }) => parse_quote! { + /// The aggregated origin type of the runtime. + type RuntimeOrigin: From>; + }, + (CommonTypes::RuntimeHoldReason, DefaultConfigType::NoDefaultBounds { .. }) => + parse_quote! { + /// A reason for placing a hold on funds + #[pallet::no_default_bounds] + type RuntimeHoldReason: From; + }, + (CommonTypes::RuntimeHoldReason, DefaultConfigType::Default { .. }) => parse_quote! { + /// A reason for placing a hold on funds + type RuntimeHoldReason: From; + }, + (CommonTypes::RuntimeFreezeReason, DefaultConfigType::NoDefaultBounds { .. }) => + parse_quote! { + /// A reason for placing a freeze on funds + #[pallet::no_default_bounds] + type RuntimeFreezeReason: VariantCount; + }, + (CommonTypes::RuntimeFreezeReason, DefaultConfigType::Default { .. }) => parse_quote! { + /// A reason for placing a freeze on funds + type RuntimeFreezeReason: VariantCount; + }, + (CommonTypes::Fungibles, DefaultConfigType::NoDefault) => parse_quote! { + #[pallet::no_default] + type Fungibles: + fungible::Inspect + + fungible::Mutate + + fungible::hold::Inspect + + fungible::hold::Mutate + + fungible::freeze::Inspect + + fungible::freeze::Mutate; + }, + (CommonTypes::Fungibles, DefaultConfigType::Default { .. }) => parse_quote! { + type Fungibles: + fungible::Inspect + + fungible::Mutate + + fungible::hold::Inspect + + fungible::hold::Mutate + + fungible::freeze::Inspect + + fungible::freeze::Mutate; + }, + // By construction this case shouldn't occur. + _ => parse_quote! {}, + } + } + + pub fn get_common_runtime_value(&self) -> ImplItem { + match self { + CommonTypes::RuntimeEvent => parse_quote! {type RuntimeEvent = RuntimeEvent;}, + CommonTypes::RuntimeOrigin => parse_quote! {type RuntimeOrigin = RuntimeOrigin;}, + CommonTypes::RuntimeHoldReason => + parse_quote! {type RuntimeHoldReason = RuntimeHoldReason;}, + CommonTypes::RuntimeFreezeReason => + parse_quote! {type RuntimeFreezeReason = RuntimeFreezeReason;}, + CommonTypes::Fungibles => parse_quote! {type Fungibles = Balances;}, + } + } + + pub fn get_default_config(&self) -> DefaultConfigType { + match self { + CommonTypes::RuntimeEvent => DefaultConfigType::NoDefaultBounds { + type_default_impl: ImplItem::Type(parse_quote! { + #[inject_runtime_type] + type RuntimeEvent = (); + }), + }, + CommonTypes::RuntimeOrigin => DefaultConfigType::NoDefaultBounds { + type_default_impl: ImplItem::Type(parse_quote! { + #[inject_runtime_type] + type RuntimeOrigin = (); + }), + }, + CommonTypes::RuntimeHoldReason => DefaultConfigType::NoDefaultBounds { + type_default_impl: ImplItem::Type(parse_quote! { + #[inject_runtime_type] + type RuntimeHoldReason = (); + }), + }, + CommonTypes::RuntimeFreezeReason => DefaultConfigType::NoDefaultBounds { + type_default_impl: ImplItem::Type(parse_quote! { + #[inject_runtime_type] + type RuntimeFreezeReason = (); + }), + }, + CommonTypes::Fungibles => DefaultConfigType::NoDefault, + } + } + + pub fn get_needed_use_statements(&self) -> Vec { + match self { + CommonTypes::RuntimeEvent => Vec::new(), + CommonTypes::RuntimeOrigin => Vec::new(), + CommonTypes::RuntimeHoldReason => Vec::new(), + CommonTypes::RuntimeFreezeReason => + vec![parse_quote! {use frame::traits::VariantCount;}], + CommonTypes::Fungibles => vec![parse_quote! {use frame::traits::fungible;}], + } + } + + pub fn get_needed_composite_enums(&self) -> Vec { + match self { + CommonTypes::RuntimeEvent => Vec::new(), + CommonTypes::RuntimeOrigin => Vec::new(), + CommonTypes::RuntimeHoldReason => vec![parse_quote! { + /// A reason for the pallet placing a hold on funds. + #[pallet::composite_enum] + pub enum HoldReason { + /// Some hold reason + #[codec(index = 0)] + SomeHoldReason, + } + }], + CommonTypes::RuntimeFreezeReason => Vec::new(), + CommonTypes::Fungibles => Vec::new(), + } + } +} + +pub fn complete_dependencies(mut types: Vec) -> Vec { + if types.contains(&CommonTypes::Fungibles) { + if !types.contains(&CommonTypes::RuntimeHoldReason) { + types.push(CommonTypes::RuntimeHoldReason); + } + + if !types.contains(&CommonTypes::RuntimeFreezeReason) { + types.push(CommonTypes::RuntimeFreezeReason); + } + } + types +} diff --git a/crates/pop-cli/src/commands/add/runtime_pallet.rs b/crates/pop-cli/src/commands/add/runtime_pallet.rs new file mode 100644 index 000000000..4dd345c39 --- /dev/null +++ b/crates/pop-cli/src/commands/add/runtime_pallet.rs @@ -0,0 +1,277 @@ +// SPDX-License-Identifier: GPL-3.0 + +use crate::{ + cli::{traits::Cli as _, Cli}, + multiselect_pick, +}; +use clap::{error::ErrorKind, Args, Command}; +use cliclack::multiselect; +use fs_rollback::Rollback; +use pop_common::{ + manifest, + rust_writer_helpers::{self, RuntimeUsedMacro}, +}; +use rust_writer::{ + ast::{ + finder, + finder::{Finder, ToFind}, + implementors::{ItemToFile, ItemToMod, TokenStreamToMacro}, + mutator, + mutator::{Mutator, ToMutate}, + }, + preserver::Preserver, +}; +use rustilities::manifest::{ManifestDependencyConfig, ManifestDependencyOrigin}; +use std::{env, path::PathBuf}; +use strum::{EnumMessage, IntoEnumIterator}; +use syn::{parse_quote, visit_mut::VisitMut}; + +mod common_pallets; + +#[mutator(ItemToFile, ItemToFile)] +#[finder(ItemToFile, ItemToFile)] +#[impl_from] +struct PalletImplBlockImplementor; + +#[derive(Args, Debug, Clone)] +pub struct AddPalletCommand { + #[arg(short, long, value_enum, num_args(1..), required = false, help = "The pallets you want to include to your runtime.")] + pub(crate) pallets: Vec, + #[arg(short, long, help = "Specify the path to the runtime crate.")] + pub(crate) runtime_path: Option, + #[arg( + long, + help = "Pop-Cli will place the impl blocks for your pallets' Config traits inside a dedicated file under configs directory. Use this argument to point to other path." + )] + pub(crate) pallet_impl_path: Option, +} + +impl AddPalletCommand { + pub(crate) async fn execute(self) -> anyhow::Result<()> { + Cli.intro("Add a new pallet to your runtime")?; + let mut cmd = Command::new(""); + + let runtime_path = if let Some(path) = &self.runtime_path { + rustilities::paths::prefix_with_current_dir(path) + } else { + let working_dir = match env::current_dir() { + Ok(working_dir) => working_dir, + _ => cmd.error(ErrorKind::Io, "Cannot modify the working crate").exit(), + }; + // Give the chance to use the command either from a workspace containing a runtime or + // from a runtime crate if path not specified + if working_dir.join("runtime").exists() { + rustilities::paths::prefix_with_current_dir(working_dir.join("runtime")) + } else { + rustilities::paths::prefix_with_current_dir(working_dir) + } + }; + + if !manifest::is_runtime_crate(&runtime_path) { + cmd.error( + ErrorKind::InvalidValue, + "Make sure to run this command either in a workspace containing a runtime crate/a runtime crate or to specify the path to the runtime crate using -r.", + ) + .exit(); + } + + let spinner = cliclack::spinner(); + spinner.start("Updating runtime..."); + + let pallets = if self.pallets.is_empty() { + multiselect_pick!( + common_pallets::CommonPallets, + "Select the pallets you want to include in your runtime" + ) + } else { + self.pallets + }; + + let mut rollback = Rollback::default(); + + let mut precomputed_pallet_config_paths = Vec::with_capacity(pallets.len()); + + let (runtime_lib_path, configs_rs_path, configs_folder_path, configs_mod_path) = + rust_writer_helpers::compute_pallet_related_paths(&runtime_path); + + let runtime_manifest = rustilities::manifest::find_innermost_manifest(&runtime_path) + .expect("Runtime is a crate, so it contains a manifest; qed;"); + + for pallet in pallets.iter() { + let pallet_name = + pallet.get_crate_name().splitn(2, '-').nth(1).unwrap_or("pallet").to_string(); + precomputed_pallet_config_paths + .push(configs_folder_path.join(format!("{}.rs", pallet_name))); + } + + rollback.note_file(&runtime_lib_path)?; + rollback.note_file(&runtime_manifest)?; + if let Some(ref pallet_impl_path) = self.pallet_impl_path { + // The impl path may be the runtime lib, so the path may be already noted. + match rollback.note_file(pallet_impl_path) { + Ok(()) => (), + Err(fs_rollback::Error::AlreadyNoted(_)) => (), + Err(err) => return Err(err.into()), + } + } + + for (index, pallet) in pallets.iter().enumerate() { + let pallet_name = + pallet.get_crate_name().splitn(2, '-').nth(1).unwrap_or("pallet").to_string(); + + let pallet_config_path = &precomputed_pallet_config_paths[index]; + + let roll_pallet_impl_path = match self.pallet_impl_path { + // specified impl path, so get it. + Some(ref pallet_impl_path) => rollback.get_noted_file(pallet_impl_path).unwrap_or( + rollback + .get_noted_file(&runtime_lib_path) + .expect("The file has been noted above;qed;"), + ), + None => { + rollback = rust_writer_helpers::compute_new_pallet_impl_path( + rollback, + &runtime_lib_path, + &configs_rs_path, + &configs_folder_path, + &configs_mod_path, + &pallet_config_path, + &pallet_name, + )?; + + rollback + .get_new_file(&pallet_config_path) + .expect("compute_new_pallet_impl_path noted this file; qed;") + }, + }; + + let roll_runtime_lib_path = rollback + .get_noted_file(&runtime_lib_path) + .expect("This file is noted by the rollback; qed;"); + let roll_manifest = rollback + .get_noted_file(&runtime_manifest) + .expect("This file is noted by the rollback; qed;"); + + // Add the pallet to the runtime module + let construct_runtime_preserver = Preserver::new("construct_runtime!"); + let mod_runtime_preserver = Preserver::new("mod runtime"); + let mut preserved_ast = rust_writer::preserver::preserve_and_parse( + roll_runtime_lib_path, + &[&construct_runtime_preserver, &mod_runtime_preserver], + )?; + + // Parse the runtime to find which of the runtime macros is being used and the highest + // pallet index used (if needed, otherwise 0). + let used_macro = rust_writer_helpers::find_used_runtime_macro(&preserved_ast)?; + match used_macro { + RuntimeUsedMacro::Runtime => { + let highest_index = + rust_writer_helpers::find_highest_pallet_index(&preserved_ast)?; + let pallet_to_runtime_implementor: ItemToMod = + ("runtime", pallet.get_pallet_declaration_runtime_module(highest_index)) + .into(); + + let mut finder = Finder::default().to_find(&pallet_to_runtime_implementor); + let pallet_already_present = finder.find(&preserved_ast); + if pallet_already_present { + return Err(anyhow::anyhow!(format!( + "{} is already in use.", + pallet.get_crate_name() + ))); + } else { + let mut mutator = + Mutator::default().to_mutate(&pallet_to_runtime_implementor); + mutator.mutate(&mut preserved_ast)?; + rust_writer::preserver::resolve_preserved( + &preserved_ast, + roll_runtime_lib_path, + )?; + } + }, + RuntimeUsedMacro::ConstructRuntime => { + let pallet_to_construct_runtime_implementor: TokenStreamToMacro = ( + parse_quote!(construct_runtime), + Some(parse_quote!(Runtime)), + pallet.get_pallet_declaration_construct_runtime(), + ) + .into(); + let mut finder = + Finder::default().to_find(&pallet_to_construct_runtime_implementor); + let pallet_already_present = finder.find(&preserved_ast); + if pallet_already_present { + return Err(anyhow::anyhow!(format!( + "{} is already in use.", + pallet.get_crate_name() + ))); + } else { + let mut mutator = + Mutator::default().to_mutate(&pallet_to_construct_runtime_implementor); + mutator.mutate(&mut preserved_ast)?; + rust_writer::preserver::resolve_preserved( + &preserved_ast, + roll_runtime_lib_path, + )?; + } + }, + } + + // Add the pallet impl block and its related use statements + let use_preserver = Preserver::new("use"); + let pub_use_preserver = Preserver::new("pub use"); + + let mut preserved_ast = rust_writer::preserver::preserve_and_parse( + roll_pallet_impl_path, + &[&use_preserver, &pub_use_preserver], + )?; + + for use_statement in pallet.get_impl_needed_use_statements() { + let use_statement: ItemToFile = use_statement.into(); + let mut finder = Finder::default().to_find(&use_statement); + let use_statement_used = finder.find(&preserved_ast); + if !use_statement_used { + let mut mutator = Mutator::default().to_mutate(&use_statement); + mutator.mutate(&mut preserved_ast)?; + } + } + + let pallet_impl_block_implementor: PalletImplBlockImplementor = ( + ItemToFile { item: pallet.get_needed_parameter_types() }, + ItemToFile { item: pallet.get_needed_impl_block() }, + ) + .into(); + + let mut mutator: PalletImplBlockImplementorMutatorWrapper = + Mutator::default().to_mutate(&pallet_impl_block_implementor).into(); + + mutator.mutate(&mut preserved_ast, None)?; + + rust_writer::preserver::resolve_preserved(&preserved_ast, roll_pallet_impl_path)?; + + // Update the crate's manifest to add the pallet crate + rustilities::manifest::add_crate_to_dependencies( + roll_manifest, + &pallet.get_crate_name(), + ManifestDependencyConfig::new( + ManifestDependencyOrigin::crates_io(&pallet.get_version()), + false, + vec![], + false, + ), + )?; + } + + rollback.commit()?; + + if let Some(mut workspace_toml) = + rustilities::manifest::find_workspace_manifest(&runtime_path) + { + workspace_toml.pop(); + rustilities::fmt::format_dir(&workspace_toml)?; + } else { + rustilities::fmt::format_dir(&runtime_path)?; + } + + spinner.stop("Your runtime has been updated and it's ready to use 🚀"); + Ok(()) + } +} diff --git a/crates/pop-cli/src/commands/add/runtime_pallet/common_pallets.rs b/crates/pop-cli/src/commands/add/runtime_pallet/common_pallets.rs new file mode 100644 index 000000000..aa28d2541 --- /dev/null +++ b/crates/pop-cli/src/commands/add/runtime_pallet/common_pallets.rs @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: GPL-3.0 +use clap::ValueEnum; +use proc_macro2::{Literal, TokenStream}; +use strum_macros::{EnumIter, EnumMessage}; +use syn::{parse_quote, Item}; + +#[derive(Debug, Copy, Clone, PartialEq, EnumIter, EnumMessage, ValueEnum)] +pub enum CommonPallets { + /// Add pallet-balances to your runtime. + #[strum(message = "Balances", detailed_message = "Add pallet-balances to your runtime.")] + Balances, + /// Add pallet-contracts to your runtime. + #[strum(message = "Contracts", detailed_message = "Add pallet-contracts to your runtime.")] + Contracts, +} + +impl CommonPallets { + pub fn get_crate_name(&self) -> String { + match self { + CommonPallets::Balances => "pallet-balances".to_string(), + CommonPallets::Contracts => "pallet-contracts".to_string(), + } + } + + pub fn get_pallet_declaration_construct_runtime(&self) -> TokenStream { + match self { + CommonPallets::Balances => parse_quote! { Balances: pallet_balances, }, + CommonPallets::Contracts => parse_quote! { Contracts: pallet_contracts, }, + } + } + + pub fn get_pallet_declaration_runtime_module(&self, highest_index: Literal) -> Item { + match self { + CommonPallets::Balances => parse_quote! { + ///TEMP_DOC + #[runtime::pallet_index(#highest_index)] + pub type Balances = pallet_balances; + }, + CommonPallets::Contracts => parse_quote! { + ///TEMP_DOC + #[runtime::pallet_index(#highest_index)] + pub type Contracts = pallet_contracts; + }, + } + } + + pub fn get_version(&self) -> String { + match self { + CommonPallets::Balances => "39.0.0".to_string(), + CommonPallets::Contracts => "27.0.0".to_string(), + } + } + + pub fn get_impl_needed_use_statements(&self) -> Vec { + match self { + CommonPallets::Balances => vec![parse_quote!( + use crate::System; + )], + CommonPallets::Contracts => vec![parse_quote!( + use crate::Balances; + )], + } + } + + pub fn get_needed_parameter_types(&self) -> Item { + match self { + CommonPallets::Balances => parse_quote!(), + CommonPallets::Contracts => parse_quote! { + parameter_types!{ + pub Schedule: pallet_contracts::Schedule = Default::default(); + } + }, + } + } + + pub fn get_needed_impl_block(&self) -> Item { + match self { + CommonPallets::Balances => parse_quote! { + ///TEMP_DOC + #[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)] + impl pallet_balances::Config for Runtime{ + type AccountStore = System; + } + }, + CommonPallets::Contracts => parse_quote! { + ///TEMP_DOC + #[derive_impl(pallet_contracts::config_preludes::TestDefaultConfig)] + impl pallet_contracts::Config for Runtime{ + type Currency = Balances; + type Schedule = [pallet_contracts::Frame; 5]; + type CallStack = Schedule; + } + }, + } + } +} diff --git a/crates/pop-cli/src/commands/mod.rs b/crates/pop-cli/src/commands/mod.rs index 286f8e163..ffdfe75bb 100644 --- a/crates/pop-cli/src/commands/mod.rs +++ b/crates/pop-cli/src/commands/mod.rs @@ -5,6 +5,7 @@ use clap::Subcommand; use pop_common::templates::Template; use serde_json::{json, Value}; +pub(crate) mod add; #[cfg(feature = "parachain")] pub(crate) mod bench; pub(crate) mod build; @@ -45,6 +46,9 @@ pub(crate) enum Command { /// Remove generated/cached artifacts. #[clap(alias = "C")] Clean(clean::CleanArgs), + /// Add a new feature to your existing polkadot-sdk project + #[clap(name = "add-to", alias = "a")] + Add(add::AddArgs), } /// Help message for the build command. @@ -150,6 +154,16 @@ impl Command { .map(|_| Value::Null) }, }, + Self::Add(args) => match args.command { + add::Command::Runtime(runtime_command) => match runtime_command { + add::RuntimeCommand::Pallet(cmd) => + cmd.execute().await.map(|_| json!("default")), + }, + add::Command::Pallet(pallet_command) => match pallet_command { + add::PalletCommand::ConfigType(cmd) => + cmd.execute().await.map(|_| json!("default")), + }, + }, } } } diff --git a/crates/pop-cli/src/commands/new/contract.rs b/crates/pop-cli/src/commands/new/contract.rs index 35a9132c6..f714b4ca0 100644 --- a/crates/pop-cli/src/commands/new/contract.rs +++ b/crates/pop-cli/src/commands/new/contract.rs @@ -4,7 +4,7 @@ use crate::cli::{ traits::{Cli as _, Confirm as _}, Cli, }; -use pop_common::manifest::{add_crate_to_workspace, find_workspace_toml}; +use pop_common::manifest::add_crate_to_workspace; use anyhow::Result; use clap::{ @@ -75,7 +75,7 @@ impl NewContractCommand { generate_contract_from_template(name, path, &template)?; // If the contract is part of a workspace, add it to that workspace - if let Some(workspace_toml) = find_workspace_toml(path) { + if let Some(workspace_toml) = rustilities::manifest::find_workspace_manifest(path) { add_crate_to_workspace(&workspace_toml, path)?; } diff --git a/crates/pop-cli/src/commands/new/pallet.rs b/crates/pop-cli/src/commands/new/pallet.rs index ba47d49a4..1e7ee1a38 100644 --- a/crates/pop-cli/src/commands/new/pallet.rs +++ b/crates/pop-cli/src/commands/new/pallet.rs @@ -7,13 +7,28 @@ use crate::{ use clap::{Args, Subcommand}; use cliclack::{confirm, input, multiselect, outro, outro_cancel}; -use pop_common::{add_crate_to_workspace, find_workspace_toml, prefix_with_current_dir_if_needed}; +use fs_rollback::Rollback; +use pop_common::{ + capitalize_str, find_pallet_runtime_path, rust_writer_helpers, + rust_writer_helpers::RuntimeUsedMacro, +}; use pop_parachains::{ create_pallet_template, TemplatePalletConfig, TemplatePalletConfigCommonTypes, TemplatePalletOptions, TemplatePalletStorageTypes, }; -use std::{fs, path::PathBuf, process::Command}; +use proc_macro2::Span; +use rust_writer::{ + ast::{ + finder::{Finder, ToFind}, + implementors::{ItemToFile, ItemToMod, TokenStreamToMacro}, + mutator::{Mutator, ToMutate}, + }, + preserver::Preserver, +}; +use rustilities::manifest::{ManifestDependencyConfig, ManifestDependencyOrigin}; +use std::{fs, path::PathBuf}; use strum::{EnumMessage, IntoEnumIterator}; +use syn::{parse_quote, parse_str, Ident, Type}; fn after_help_simple() -> &'static str { r#"Examples: @@ -47,6 +62,11 @@ pub struct NewPalletCommand { pub(crate) authors: Option, #[arg(short, long, help = "Pallet description", default_value = "Frame Pallet")] pub(crate) description: Option, + #[arg( + long, + help = "If your pallet is created within a workspace that includes a runtime, the `impl` blocks will be generated for your pallet's `Config` traits in a dedicated file under the configs directory. Use this argument to specify a different path." + )] + pub(crate) pallet_impl_path: Option, #[command(subcommand)] pub(crate) mode: Option, } @@ -146,10 +166,10 @@ impl NewPalletCommand { // If the user has introduced something like pallets/my_pallet, probably it refers to // ./pallets/my_pallet. We need to transform this path, as otherwise the Cargo.toml won't be // detected and the pallet won't be added to the workspace. - let pallet_path = prefix_with_current_dir_if_needed(pallet_path); + let pallet_path = rustilities::paths::prefix_with_current_dir(pallet_path); // Determine if the pallet is being created inside a workspace - let workspace_toml = find_workspace_toml(&pallet_path); + let workspace_toml = rustilities::manifest::find_workspace_manifest(&pallet_path); if pallet_path.exists() { if !confirm(format!( @@ -176,24 +196,232 @@ impl NewPalletCommand { pallet_in_workspace: workspace_toml.is_some(), pallet_advanced_mode: self.mode.is_some(), pallet_default_config, - pallet_common_types, + pallet_common_types: pallet_common_types.clone(), pallet_storage, pallet_genesis, pallet_custom_origin, }, )?; - // If the pallet has been created inside a workspace, add it to that workspace - if let Some(workspace_toml) = workspace_toml { - add_crate_to_workspace(&workspace_toml, &pallet_path)?; + // If the pallet has been created inside a workspace containing a runtime, add the + // pallet to that runtime. + if let Some(runtime_path) = find_pallet_runtime_path(&pallet_path) { + spinner.set_message("Adding the pallet to your runtime..."); + + let pallet_crate_name = + rustilities::manifest::find_crate_name(&pallet_path.join("Cargo.toml")) + .unwrap_or("pallet".to_owned()); + + let runtime_lib_path = runtime_path.join("src").join("lib.rs"); + let runtime_manifest = + rustilities::manifest::find_innermost_manifest(&runtime_lib_path) + .expect("Runtime is a crate, so it contains a manifest; qed;"); + + let pallet_ident = Ident::new( + &capitalize_str( + &pallet_crate_name + .split("pallet-") + .last() + .ok_or(anyhow::anyhow! { + "Pallet crates are supposed to be called pallet-something."})? + .replace("-", ""), + ), + Span::call_site(), + ); + let pallet_type = parse_str::(&pallet_crate_name.replace("-", "_"))?; + + let pallet_name = + pallet_crate_name.splitn(2, '-').nth(1).unwrap_or("pallet").to_string(); + + let (runtime_lib_path, configs_rs_path, configs_folder_path, configs_mod_path) = + rust_writer_helpers::compute_pallet_related_paths(&runtime_path); + let pallet_config_path = configs_folder_path.join(format!("{}.rs", pallet_name)); + + let mut rollback = Rollback::default(); + + rollback.note_file(&runtime_manifest)?; + rollback.note_file(&runtime_lib_path)?; + if let Some(ref pallet_impl_path) = self.pallet_impl_path { + // The impl path may be the runtime lib, so the path may be already noted. + match rollback.note_file(pallet_impl_path) { + Ok(()) => (), + Err(fs_rollback::Error::AlreadyNoted(_)) => (), + Err(err) => return Err(err.into()), + } + } + + let roll_pallet_impl_path = match self.pallet_impl_path { + Some(ref pallet_impl_path) => rollback.get_noted_file(pallet_impl_path).unwrap_or( + rollback + .get_noted_file(&runtime_lib_path) + .expect("The file has been noted above;qed;"), + ), + None => { + rollback = rust_writer_helpers::compute_new_pallet_impl_path( + rollback, + &runtime_lib_path, + &configs_rs_path, + &configs_folder_path, + &configs_mod_path, + &pallet_config_path, + &pallet_name, + )?; + + rollback + .get_new_file(&pallet_config_path) + .expect("compute_new_pallet_impl_path noted this file; qed;") + }, + }; + + let roll_runtime_lib_path = rollback + .get_noted_file(&runtime_lib_path) + .expect("This file is noted by the rollback; qed;"); + let roll_manifest = rollback + .get_noted_file(&runtime_manifest) + .expect("This file is noted by the rollback; qed;"); + + // Add the pallet to the runtime module + let construct_runtime_preserver = Preserver::new("construct_runtime!"); + let mod_runtime_preserver = Preserver::new("mod runtime"); + let mut preserved_ast = rust_writer::preserver::preserve_and_parse( + roll_runtime_lib_path, + &[&construct_runtime_preserver, &mod_runtime_preserver], + )?; + + // Parse the runtime to find which of the runtime macros is being used and the highest + // pallet index used (if needed, otherwise 0). + let used_macro = rust_writer_helpers::find_used_runtime_macro(&preserved_ast)?; + + let pallet_added_to_runtime = match used_macro { + RuntimeUsedMacro::Runtime => { + let highest_index = + rust_writer_helpers::find_highest_pallet_index(&preserved_ast)?; + let pallet_to_runtime_implementor: ItemToMod = ( + "runtime", + parse_quote! { + ///TEMP_DOC + #[runtime::pallet_index(#highest_index)] + pub type #pallet_ident = #pallet_type; + }, + ) + .into(); + + let mut finder = Finder::default().to_find(&pallet_to_runtime_implementor); + let pallet_already_present = finder.find(&preserved_ast); + if !pallet_already_present { + let mut mutator = + Mutator::default().to_mutate(&pallet_to_runtime_implementor); + mutator.mutate(&mut preserved_ast)?; + rust_writer::preserver::resolve_preserved( + &preserved_ast, + roll_runtime_lib_path, + ) + } else { + Ok(()) + } + }, + RuntimeUsedMacro::ConstructRuntime => { + let pallet_to_construct_runtime_implementor: TokenStreamToMacro = ( + parse_quote!(construct_runtime), + Some(parse_quote!(Runtime)), + parse_quote!(#pallet_ident: #pallet_type,), + ) + .into(); + let mut finder = + Finder::default().to_find(&pallet_to_construct_runtime_implementor); + let pallet_already_present = finder.find(&preserved_ast); + if !pallet_already_present { + let mut mutator = + Mutator::default().to_mutate(&pallet_to_construct_runtime_implementor); + mutator.mutate(&mut preserved_ast)?; + rust_writer::preserver::resolve_preserved( + &preserved_ast, + roll_runtime_lib_path, + ) + } else { + Ok(()) + } + }, + }; + + // Update the crate's manifest to add the pallet crate + let relative_local_path = pathdiff::diff_paths( + &pallet_path, + &runtime_manifest + .parent() + .expect("A file's always contained inside a directory; qed;"), + ) + .unwrap_or(pallet_path.clone()); + let crate_added_to_dependencies = rustilities::manifest::add_crate_to_dependencies( + roll_manifest, + &pallet_crate_name, + ManifestDependencyConfig::new( + ManifestDependencyOrigin::local(&relative_local_path), + false, + vec![], + false, + ), + ); + + // Add pallet's impl block + let mut preserved_ast = + rust_writer::preserver::preserve_and_parse(roll_pallet_impl_path, &[])?; + + let (types, values) = if pallet_default_config { + (Vec::new(), Vec::new()) + } else { + let types: Vec = pallet_common_types + .clone() + .iter() + .map(|type_| { + Ident::new(type_.get_message().unwrap_or_default(), Span::call_site()) + }) + .collect(); + let values: Vec = + pallet_common_types.iter().map(|type_| type_.common_value()).collect(); + (types, values) + }; + + let pallet_impl_block_implementor = ItemToFile { + item: parse_quote! { + ///TEMP_DOC + impl #pallet_type::Config for Runtime{ + #( + type #types = #values; + )* + } + }, + }; + + let mut mutator = Mutator::default().to_mutate(&pallet_impl_block_implementor); + + let pallet_impl_block_added = mutator.mutate(&mut preserved_ast); + + rust_writer::preserver::resolve_preserved(&preserved_ast, roll_pallet_impl_path)?; + + // If some of these results are Err, that doesn't mean that everything went wrong, only + // that the pallet wasn't included into the runtime. But the pallet was indeed + // created, so we cannot return an error here + match (pallet_added_to_runtime, crate_added_to_dependencies, pallet_impl_block_added) { + (Ok(_), Ok(_), Ok(_)) => rollback.commit()?, + _ => { + Cli.warning( + "Your pallet has been created but it couldn't be added to your runtime.", + )?; + }, + } } - // Format the dir. If this fails we do nothing, it's not a major failure - Command::new("cargo") - .arg("fmt") - .arg("--all") - .current_dir(&pallet_path) - .output()?; + // If the pallet has been created inside a workspace, add it to that workspace + if let Some(mut workspace_toml) = + rustilities::manifest::find_workspace_manifest(&pallet_path) + { + pop_common::add_crate_to_workspace(&workspace_toml, &pallet_path)?; + workspace_toml.pop(); + rustilities::fmt::format_dir(&workspace_toml)?; + } else { + rustilities::fmt::format_dir(&pallet_path)?; + } spinner.stop("Generation complete"); outro(format!( diff --git a/crates/pop-cli/src/common/helpers.rs b/crates/pop-cli/src/common/helpers.rs index 87e9f1c27..03ca57fa5 100644 --- a/crates/pop-cli/src/common/helpers.rs +++ b/crates/pop-cli/src/common/helpers.rs @@ -61,7 +61,7 @@ #[macro_export] macro_rules! multiselect_pick { ($enum: ty, $prompt_message: expr $(, $excluded_variants: expr)?) => {{ - // Ensure the enum is 1-byte long. This is needed cause fieldless enums with > 256 elements + // Ensure the enum is 1-byte long. This is needed cause fieldless enums with > 256 elements // will lead to unexpected behavior as the conversion to u8 for them isn't detected as wrong // at compile time. Enums containing variants with fields will be catched at compile time. // Weird but possible. diff --git a/crates/pop-cli/tests/new_pallet_added_to_existing_runtime.rs b/crates/pop-cli/tests/new_pallet_added_to_existing_runtime.rs new file mode 100644 index 000000000..a92e32a9e --- /dev/null +++ b/crates/pop-cli/tests/new_pallet_added_to_existing_runtime.rs @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: GPL-3.0 + +use assert_cmd::Command; +use similar::{ChangeTag, TextDiff}; + +#[test] +fn pop_new_pallet_modifies_runtime() { + let temp = tempfile::tempdir().unwrap(); + let tempdir = temp.path(); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&tempdir) + .args(&["new", "parachain", "test_parachain", "-t", "r0gue-io/base-parachain"]) + .assert() + .success(); + + let test_parachain = tempdir.join("test_parachain"); + + let workspace_manifest_path = test_parachain.join("Cargo.toml"); + + let runtime_path = test_parachain.join("runtime"); + let runtime_lib_path = runtime_path.join("src").join("lib.rs"); + let configs_path = runtime_path.join("src").join("configs"); + let configs_mod_path = configs_path.join("mod.rs"); + let configs_pallet_path = configs_path.join("template.rs"); + + let workspace_content_before = std::fs::read_to_string(&workspace_manifest_path).unwrap(); + let runtime_lib_content_before = std::fs::read_to_string(&runtime_lib_path).unwrap(); + let configs_mod_content_before = std::fs::read_to_string(&configs_mod_path).unwrap(); + + assert!(!configs_pallet_path.exists()); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&test_parachain) + .args(&["new", "pallet", "template", "advanced", "-c", "runtime-event", "-d"]) + .assert() + .success(); + + let workspace_content_after = std::fs::read_to_string(&workspace_manifest_path).unwrap(); + let runtime_lib_content_after = std::fs::read_to_string(&runtime_lib_path).unwrap(); + let configs_mod_content_after = std::fs::read_to_string(&configs_mod_path).unwrap(); + let configs_pallet_content = std::fs::read_to_string(&configs_pallet_path).unwrap(); + + let runtime_lib_diff = + TextDiff::from_lines(&runtime_lib_content_before, &runtime_lib_content_after); + let workspace_diff = TextDiff::from_lines(&workspace_content_before, &workspace_content_after); + let configs_mod_diff = + TextDiff::from_lines(&configs_mod_content_before, &configs_mod_content_after); + + let expected_runtime_lib_inserted_lines = vec![ + "\n", + " #[runtime::pallet_index(34)]\n", + " pub type Template = pallet_template;\n", + ]; + + let expected_workspace_inserted_lines = + vec!["members = [\"node\", \"runtime\", \"template\"]\n"]; + + let expected_workspace_deleted_lines = vec!["members = [\"node\", \"runtime\"]\n"]; + + let expected_configs_mod_inserted_lines = vec!["mod template;\n"]; + + let mut runtime_lib_inserted_lines = Vec::with_capacity(3); + let mut workspace_inserted_lines = Vec::with_capacity(1); + let mut workspace_deleted_lines = Vec::with_capacity(1); + let mut configs_mod_inserted_lines = Vec::with_capacity(1); + + for change in runtime_lib_diff.iter_all_changes() { + match change.tag() { + ChangeTag::Delete => panic!("No deletions in lib expected"), + ChangeTag::Insert => runtime_lib_inserted_lines.push(change.value()), + _ => (), + } + } + + for change in workspace_diff.iter_all_changes() { + match change.tag() { + ChangeTag::Delete => workspace_deleted_lines.push(change.value()), + ChangeTag::Insert => workspace_inserted_lines.push(change.value()), + _ => (), + } + } + + for change in configs_mod_diff.iter_all_changes() { + match change.tag() { + ChangeTag::Delete => panic!("No deletions expected"), + ChangeTag::Insert => configs_mod_inserted_lines.push(change.value()), + _ => (), + } + } + + assert_eq!(expected_runtime_lib_inserted_lines, runtime_lib_inserted_lines); + assert_eq!(expected_workspace_inserted_lines, workspace_inserted_lines); + assert_eq!(expected_workspace_deleted_lines, workspace_deleted_lines); + assert_eq!(expected_configs_mod_inserted_lines, configs_mod_inserted_lines); + + assert_eq!(configs_pallet_content, "impl pallet_template::Config for Runtime {}\n"); +} diff --git a/crates/pop-cli/tests/pop_add_to_pallet_config_type.rs b/crates/pop-cli/tests/pop_add_to_pallet_config_type.rs new file mode 100644 index 000000000..96e8151db --- /dev/null +++ b/crates/pop-cli/tests/pop_add_to_pallet_config_type.rs @@ -0,0 +1,229 @@ +// SPDX-License-Identifier: GPL-3.0 + +use assert_cmd::Command; +use similar::{ChangeTag, TextDiff}; + +#[test] +fn pop_add_to_pallet_config_type_works() { + let temp = tempfile::tempdir().unwrap(); + let tempdir = temp.path(); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&tempdir) + .args(&["new", "parachain", "test_parachain", "-t", "r0gue-io/base-parachain"]) + .assert() + .success(); + + let test_parachain = tempdir.join("test_parachain"); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&test_parachain) + .args(&["new", "pallet", "template", "advanced", "-c", "runtime-event", "-d"]) + .assert() + .success(); + + let pallet_path = test_parachain.join("template"); + let pallet_lib_path = pallet_path.join("src").join("lib.rs"); + let pallet_mock_path = pallet_path.join("src").join("mock.rs"); + let pallet_impl_path = + test_parachain.join("runtime").join("src").join("configs").join("template.rs"); + let config_preludes_path = pallet_path.join("src").join("config_preludes.rs"); + + let lib_content_before_new_type = std::fs::read_to_string(&pallet_lib_path).unwrap(); + let mock_content_before_new_type = std::fs::read_to_string(&pallet_mock_path).unwrap(); + let pallet_impl_content_before_new_type = std::fs::read_to_string(&pallet_impl_path).unwrap(); + let config_preludes_path_content_before_new_type = + std::fs::read_to_string(&config_preludes_path).unwrap(); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&pallet_path) + .args(&["add-to", "pallet", "config-type", "-t", "fungibles"]) + .assert() + .success(); + + let lib_content_after_new_type = std::fs::read_to_string(&pallet_lib_path).unwrap(); + let mock_content_after_new_type = std::fs::read_to_string(&pallet_mock_path).unwrap(); + let pallet_impl_content_after_new_type = std::fs::read_to_string(&pallet_impl_path).unwrap(); + let config_preludes_path_content_after_new_type = + std::fs::read_to_string(&config_preludes_path).unwrap(); + + let lib_diff = TextDiff::from_lines(&lib_content_before_new_type, &lib_content_after_new_type); + let mock_diff = + TextDiff::from_lines(&mock_content_before_new_type, &mock_content_after_new_type); + let pallet_impl_diff = TextDiff::from_lines( + &pallet_impl_content_before_new_type, + &pallet_impl_content_after_new_type, + ); + let config_preludes_diff = TextDiff::from_lines( + &config_preludes_path_content_before_new_type, + &config_preludes_path_content_after_new_type, + ); + + let expected_lib_inserted_lines = vec![ + " #[pallet::no_default]\n", + " type Fungibles: fungible::Inspect\n", + " + fungible::Mutate\n", + " + fungible::hold::Inspect\n", + " + fungible::hold::Mutate\n", + " + fungible::freeze::Inspect\n", + " + fungible::freeze::Mutate;\n", + " /// A reason for placing a hold on funds\n", + " #[pallet::no_default_bounds]\n", + " type RuntimeHoldReason: From;\n", + " /// A reason for placing a freeze on funds\n", + " #[pallet::no_default_bounds]\n", + " type RuntimeFreezeReason: VariantCount;\n", + " /// A reason for the pallet placing a hold on funds.\n", + " #[pallet::composite_enum]\n", + " pub enum HoldReason {\n", + " /// Some hold reason\n", + " #[codec(index = 0)]\n", + " SomeHoldReason,\n", + " }\n", + "use frame::traits::fungible;\n", + "use frame::traits::VariantCount;\n", + ]; + + let expected_mock_inserted_lines = vec![ + "impl pallet_template::Config for Test {\n", + " type Fungibles = Balances;\n", + "}\n", + ]; + + let expected_mock_deleted_lines = vec!["impl pallet_template::Config for Test {}\n"]; + + let expected_impl_type_inserted_lines = vec![ + "impl pallet_template::Config for Runtime {\n", + " type Fungibles = Balances;\n", + "}\n", + ]; + + let expected_impl_type_deleted_lines = vec!["impl pallet_template::Config for Runtime {}\n"]; + + // There's 4 default configs (Testchain, solochain, relaychain, parachain), so the changes are + // applied four times each. + let expected_config_preludes_inserted_lines = vec![ + " #[inject_runtime_type]\n", + " type RuntimeHoldReason = ();\n", + " #[inject_runtime_type]\n", + " type RuntimeHoldReason = ();\n", + " #[inject_runtime_type]\n", + " type RuntimeHoldReason = ();\n", + " #[inject_runtime_type]\n", + " type RuntimeHoldReason = ();\n", + " #[inject_runtime_type]\n", + " type RuntimeFreezeReason = ();\n", + " #[inject_runtime_type]\n", + " type RuntimeFreezeReason = ();\n", + " #[inject_runtime_type]\n", + " type RuntimeFreezeReason = ();\n", + " #[inject_runtime_type]\n", + " type RuntimeFreezeReason = ();\n", + ]; + + let mut lib_inserted_lines = Vec::with_capacity(18); + let mut mock_inserted_lines = Vec::with_capacity(1); + let mut mock_deleted_lines = Vec::with_capacity(3); + let mut pallet_impl_inserted_lines = Vec::with_capacity(1); + let mut pallet_impl_deleted_lines = Vec::with_capacity(3); + let mut config_preludes_inserted_lines = Vec::with_capacity(16); + + for change in lib_diff.iter_all_changes() { + match change.tag() { + ChangeTag::Delete => panic!("No deletions in lib expected"), + ChangeTag::Insert => lib_inserted_lines.push(change.value()), + _ => (), + } + } + + for change in mock_diff.iter_all_changes() { + match change.tag() { + ChangeTag::Delete => mock_deleted_lines.push(change.value()), + ChangeTag::Insert => mock_inserted_lines.push(change.value()), + _ => (), + } + } + + for change in pallet_impl_diff.iter_all_changes() { + match change.tag() { + ChangeTag::Delete => pallet_impl_deleted_lines.push(change.value()), + ChangeTag::Insert => pallet_impl_inserted_lines.push(change.value()), + _ => (), + } + } + + for change in config_preludes_diff.iter_all_changes() { + match change.tag() { + ChangeTag::Delete => panic!("No deletions in lib expected"), + ChangeTag::Insert => config_preludes_inserted_lines.push(change.value()), + _ => (), + } + } + + assert_eq!(expected_lib_inserted_lines, lib_inserted_lines); + assert_eq!(expected_mock_inserted_lines, mock_inserted_lines); + assert_eq!(expected_mock_deleted_lines, mock_deleted_lines); + assert_eq!(expected_impl_type_inserted_lines, pallet_impl_inserted_lines); + assert_eq!(expected_impl_type_deleted_lines, pallet_impl_deleted_lines); + assert_eq!(expected_config_preludes_inserted_lines, config_preludes_inserted_lines); +} + +#[test] +fn pop_add_to_pallet_config_type_doesnt_modify_on_fail() { + let temp = tempfile::tempdir().unwrap(); + let tempdir = temp.path(); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&tempdir) + .args(&["new", "parachain", "test_parachain", "-t", "r0gue-io/base-parachain"]) + .assert() + .success(); + + let test_parachain = tempdir.join("test_parachain"); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&test_parachain) + .args(&["new", "pallet", "template", "advanced", "-c", "runtime-event", "-d"]) + .assert() + .success(); + + let pallet_path = test_parachain.join("template"); + let pallet_lib_path = pallet_path.join("src").join("lib.rs"); + let pallet_mock_path = pallet_path.join("src").join("mock.rs"); + let pallet_impl_path = + test_parachain.join("runtime").join("src").join("configs").join("template.rs"); + let config_preludes_path = pallet_path.join("src").join("config_preludes.rs"); + + let lib_content_before_new_type = std::fs::read_to_string(&pallet_lib_path).unwrap(); + let mock_content_before_new_type = std::fs::read_to_string(&pallet_mock_path).unwrap(); + let pallet_impl_content_before_new_type = std::fs::read_to_string(&pallet_impl_path).unwrap(); + let config_preludes_path_content_before_new_type = + std::fs::read_to_string(&config_preludes_path).unwrap(); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&pallet_path) + .args(&["add-to", "pallet", "config-type", "-t", "fungibles", "runtime-event"]) + .assert() + .failure() + .stderr(predicates::str::contains("Error: RuntimeEvent is already in use.")); + + let lib_content_after_new_type = std::fs::read_to_string(&pallet_lib_path).unwrap(); + let mock_content_after_new_type = std::fs::read_to_string(&pallet_mock_path).unwrap(); + let pallet_impl_content_after_new_type = std::fs::read_to_string(&pallet_impl_path).unwrap(); + let config_preludes_path_content_after_new_type = + std::fs::read_to_string(&config_preludes_path).unwrap(); + + assert_eq!(lib_content_before_new_type, lib_content_after_new_type); + assert_eq!(mock_content_before_new_type, mock_content_after_new_type); + assert_eq!(pallet_impl_content_before_new_type, pallet_impl_content_after_new_type); + assert_eq!( + config_preludes_path_content_before_new_type, + config_preludes_path_content_after_new_type + ); +} diff --git a/crates/pop-cli/tests/pop_add_to_runtime_pallet.rs b/crates/pop-cli/tests/pop_add_to_runtime_pallet.rs new file mode 100644 index 000000000..0e0cf0921 --- /dev/null +++ b/crates/pop-cli/tests/pop_add_to_runtime_pallet.rs @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: GPL-3.0 + +use assert_cmd::Command; +use similar::{ChangeTag, TextDiff}; + +#[test] +fn pop_add_to_runtime_pallet_runtime_macro_v2_works() { + let temp = tempfile::tempdir().unwrap(); + let tempdir = temp.path(); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&tempdir) + .args(&["new", "parachain", "test_parachain", "-t", "r0gue-io/base-parachain"]) + .assert() + .success(); + + let test_parachain = tempdir.join("test_parachain"); + let runtime_path = test_parachain.join("runtime"); + + let manifest_path = runtime_path.join("Cargo.toml"); + let runtime_lib_path = runtime_path.join("src").join("lib.rs"); + let pallet_configs_path = runtime_path.join("src").join("configs"); + let pallet_configs_mod_path = pallet_configs_path.join("mod.rs"); + let contracts_pallet_config_path = pallet_configs_path.join("contracts.rs"); + + assert!(!contracts_pallet_config_path.exists()); + + let runtime_lib_content_before = std::fs::read_to_string(&runtime_lib_path).unwrap(); + let pallet_configs_mod_content_before = + std::fs::read_to_string(&pallet_configs_mod_path).unwrap(); + let manifest_content_before = std::fs::read_to_string(&manifest_path).unwrap(); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&test_parachain) + .args(&["add-to", "runtime", "pallet", "-p", "contracts"]) + .assert() + .success(); + + let runtime_lib_content_after = std::fs::read_to_string(&runtime_lib_path).unwrap(); + let pallet_configs_mod_content_after = + std::fs::read_to_string(&pallet_configs_mod_path).unwrap(); + let manifest_content_after = std::fs::read_to_string(&manifest_path).unwrap(); + let contracts_pallet_config_content = + std::fs::read_to_string(&contracts_pallet_config_path).unwrap(); + + let runtime_lib_diff = + TextDiff::from_lines(&runtime_lib_content_before, &runtime_lib_content_after); + let pallet_configs_mod_diff = + TextDiff::from_lines(&pallet_configs_mod_content_before, &pallet_configs_mod_content_after); + let manifest_diff = TextDiff::from_lines(&manifest_content_before, &manifest_content_after); + + let expected_inserted_lines_runtime_lib = vec![ + "\n", + " #[runtime::pallet_index(34)]\n", + " pub type Contracts = pallet_contracts;\n", + ]; + let expected_inserted_lines_configs_mod = vec!["mod contracts;\n"]; + let expected_inserted_lines_manifest = + vec!["pallet-contracts = { version = \"27.0.0\", default-features = false }\n"]; + + let mut inserted_lines_runtime_lib = Vec::with_capacity(3); + let mut inserted_lines_configs_mod = Vec::with_capacity(1); + let mut inserted_lines_manifest = Vec::with_capacity(1); + + for change in runtime_lib_diff.iter_all_changes() { + match change.tag() { + ChangeTag::Delete => panic!("no deletion expected"), + ChangeTag::Insert => inserted_lines_runtime_lib.push(change.value()), + _ => (), + } + } + + for change in pallet_configs_mod_diff.iter_all_changes() { + match change.tag() { + ChangeTag::Delete => panic!("no deletion expected"), + ChangeTag::Insert => inserted_lines_configs_mod.push(change.value()), + _ => (), + } + } + + for change in manifest_diff.iter_all_changes() { + match change.tag() { + ChangeTag::Delete => panic!("no deletion expected"), + ChangeTag::Insert => inserted_lines_manifest.push(change.value()), + _ => (), + } + } + + assert_eq!(expected_inserted_lines_runtime_lib, inserted_lines_runtime_lib); + assert_eq!(expected_inserted_lines_configs_mod, inserted_lines_configs_mod); + assert_eq!(expected_inserted_lines_manifest, inserted_lines_manifest); + + assert_eq!( + contracts_pallet_config_content, + r#"use crate::Balances; +parameter_types! { + pub Schedule : pallet_contracts::Schedule < Runtime > = Default::default(); +} + +#[derive_impl(pallet_contracts::config_preludes::TestDefaultConfig)] +impl pallet_contracts::Config for Runtime { + type Currency = Balances; + type Schedule = [pallet_contracts::Frame; 5]; + type CallStack = Schedule; +} +"# + ); +} + +#[test] +fn pop_add_to_runtime_pallet_construct_runtime_works() { + let temp = tempfile::tempdir().unwrap(); + let tempdir = temp.path(); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&tempdir) + .args(&[ + "new", + "parachain", + "test_parachain2", + "openzeppelin", + "-t", + "openzeppelin/generic-template", + "-r", + "v2.0.3", + ]) + .assert() + .success(); + + let test_parachain = tempdir.join("test_parachain2"); + let runtime_path = test_parachain.join("runtime"); + + let manifest_path = runtime_path.join("Cargo.toml"); + let runtime_lib_path = runtime_path.join("src").join("lib.rs"); + + let runtime_lib_content_before = std::fs::read_to_string(&runtime_lib_path).unwrap(); + let manifest_content_before = std::fs::read_to_string(&manifest_path).unwrap(); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&test_parachain) + .args(&[ + "add-to", + "runtime", + "pallet", + "-p", + "contracts", + "--pallet-impl-path", + runtime_lib_path.to_str().unwrap(), + ]) + .assert() + .success(); + + let runtime_lib_content_after = std::fs::read_to_string(&runtime_lib_path).unwrap(); + let manifest_content_after = std::fs::read_to_string(&manifest_path).unwrap(); + + let manifest_diff = TextDiff::from_lines(&manifest_content_before, &manifest_content_after); + + let expected_inserted_lines_manifest = + vec!["pallet-contracts = { version = \"27.0.0\", default-features = false }\n"]; + + let mut inserted_lines_manifest = Vec::with_capacity(1); + + for change in manifest_diff.iter_all_changes() { + match change.tag() { + ChangeTag::Delete => panic!("no deletion expected"), + ChangeTag::Insert => inserted_lines_manifest.push(change.value()), + _ => (), + } + } + + assert_eq!(expected_inserted_lines_manifest, inserted_lines_manifest); + + // Unparsing the AST with construct_runtime is a bit unpredictable due to the well-known issue + // of formatting a macro invocation AST, so the assertions we can do are limited. Let's just + // state that pallet_contracts have been added. + assert!(!runtime_lib_content_before.contains("Contracts")); + assert!(runtime_lib_content_after.contains("Contracts")); + assert!(!runtime_lib_content_before.contains("pallet_contracts")); + assert!(runtime_lib_content_after.contains("pallet_contracts")); + assert!(!runtime_lib_content_before.contains("type CallStack = Schedule;")); + assert!(runtime_lib_content_after.contains("type CallStack = Schedule;")); +} + +#[test] +fn pop_add_to_runtime_pallet_doesnt_modify_on_failure() { + let temp = tempfile::tempdir().unwrap(); + let tempdir = temp.path(); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&tempdir) + .args(&["new", "parachain", "test_parachain3", "-t", "r0gue-io/contracts-parachain"]) + .assert() + .success(); + + let test_parachain = tempdir.join("test_parachain3"); + let runtime_path = test_parachain.join("runtime"); + + let manifest_path = runtime_path.join("Cargo.toml"); + let runtime_lib_path = runtime_path.join("src").join("lib.rs"); + let pallet_configs_mod_path = runtime_path.join("src").join("configs").join("mod.rs"); + + let runtime_lib_content_before = std::fs::read_to_string(&runtime_lib_path).unwrap(); + let pallet_configs_mod_content_before = + std::fs::read_to_string(&pallet_configs_mod_path).unwrap(); + let manifest_content_before = std::fs::read_to_string(&manifest_path).unwrap(); + + Command::cargo_bin("pop") + .unwrap() + .current_dir(&test_parachain) + .args(&["add-to", "runtime", "pallet", "-p", "contracts"]) + .assert() + .failure() + .stderr(predicates::str::contains("Error: contracts is already in use.")); + + let runtime_lib_content_after = std::fs::read_to_string(&runtime_lib_path).unwrap(); + let pallet_configs_mod_content_after = + std::fs::read_to_string(&pallet_configs_mod_path).unwrap(); + let manifest_content_after = std::fs::read_to_string(&manifest_path).unwrap(); + + assert_eq!(runtime_lib_content_before, runtime_lib_content_after); + assert_eq!(pallet_configs_mod_content_before, pallet_configs_mod_content_after); + assert_eq!(manifest_content_before, manifest_content_after); +} diff --git a/crates/pop-common/Cargo.toml b/crates/pop-common/Cargo.toml index f2f1b0bfa..32c2a4cef 100644 --- a/crates/pop-common/Cargo.toml +++ b/crates/pop-common/Cargo.toml @@ -12,13 +12,19 @@ anyhow.workspace = true cargo_toml.workspace = true contract-build.workspace = true contract-extrinsics.workspace = true +# Pin to solve dependencies conflics. See Cargo.toml for further info. +deranged.workspace = true duct.workspace = true flate2.workspace = true +fs_rollback.workspace = true git2.workspace = true git2_credentials.workspace = true ink_env.workspace = true +proc-macro2.workspace = true regex.workspace = true reqwest.workspace = true +rustilities = { workspace = true, features = ["manifest"] } +rust_writer.workspace = true scale-info.workspace = true serde_json.workspace = true serde.workspace = true @@ -34,6 +40,7 @@ tokio.workspace = true toml.workspace = true toml_edit.workspace = true url.workspace = true +syn.workspace = true [dev-dependencies] mockito.workspace = true diff --git a/crates/pop-common/src/errors.rs b/crates/pop-common/src/errors.rs index 65e9a2778..b0f24c065 100644 --- a/crates/pop-common/src/errors.rs +++ b/crates/pop-common/src/errors.rs @@ -13,6 +13,8 @@ pub enum Error { AnyhowError(#[from] anyhow::Error), #[error("Configuration error: {0}")] Config(String), + #[error("{0}")] + Descriptive(String), #[error("a git error occurred: {0}")] Git(String), #[error("IO error: {0}")] @@ -30,6 +32,10 @@ pub enum Error { /// An error occurred while parsing the provided secret URI. #[error("Failed to parse secret URI: {0}")] ParseSecretURI(String), + #[error("{0}")] + RollbackError(#[from] fs_rollback::Error), + #[error("Failed to update files: {0}")] + RustWriterError(#[from] rust_writer::Error), #[error("SourceError error: {0}")] SourceError(#[from] sourcing::Error), #[error("TemplateError error: {0}")] @@ -37,8 +43,12 @@ pub enum Error { /// An error occurred while executing a test command. #[error("Failed to execute test command: {0}")] TestCommand(String), + #[error("TomlError: {0}")] + TomlError(#[from] toml_edit::TomlError), #[error("Unsupported command: {0}")] UnsupportedCommand(String), #[error("Unsupported platform: {arch} {os}")] UnsupportedPlatform { arch: &'static str, os: &'static str }, + #[error("Unable to write to the introduced path. {0}")] + WriteError(String), } diff --git a/crates/pop-common/src/helpers.rs b/crates/pop-common/src/helpers.rs index 369b15bd2..4380fff9f 100644 --- a/crates/pop-common/src/helpers.rs +++ b/crates/pop-common/src/helpers.rs @@ -5,7 +5,7 @@ use std::{ collections::HashMap, fs, io::{Read, Write}, - path::{Component, Path, PathBuf}, + path::{Path, PathBuf}, }; /// Replaces occurrences of specified strings in a file with new values. @@ -40,19 +40,14 @@ pub fn get_project_name_from_path<'a>(path: &'a Path, default: &'a str) -> &'a s path.file_name().and_then(|name| name.to_str()).unwrap_or(default) } -/// Transforms a path without prefix into a relative path starting at the current directory. -/// -/// # Arguments -/// * `path` - The path to be prefixed if needed. -pub fn prefix_with_current_dir_if_needed(path: PathBuf) -> PathBuf { - let components = &path.components().collect::>(); - if !components.is_empty() { - // If the first component is a normal component, we prefix the path with the current dir - if let Component::Normal(_) = components[0] { - return as AsRef>::as_ref(&Component::CurDir).join(path); - } +pub fn capitalize_str(input: &str) -> String { + if input.is_empty() { + return String::new(); } - path + + let first_char = input.chars().next().expect("The introduced str isn't empty").to_uppercase(); + let rest = &input[1..]; + format!("{}{}", first_char, rest) } /// Returns the relative path from `base` to `full` if `full` is inside `base`. @@ -104,33 +99,6 @@ mod tests { Ok(()) } - #[test] - fn prefix_with_current_dir_if_needed_works_well() { - let no_prefixed_path = PathBuf::from("my/path".to_string()); - let current_dir_prefixed_path = PathBuf::from("./my/path".to_string()); - let parent_dir_prefixed_path = PathBuf::from("../my/path".to_string()); - let root_dir_prefixed_path = PathBuf::from("/my/path".to_string()); - let empty_path = PathBuf::from("".to_string()); - - assert_eq!( - prefix_with_current_dir_if_needed(no_prefixed_path), - PathBuf::from("./my/path/".to_string()) - ); - assert_eq!( - prefix_with_current_dir_if_needed(current_dir_prefixed_path), - PathBuf::from("./my/path/".to_string()) - ); - assert_eq!( - prefix_with_current_dir_if_needed(parent_dir_prefixed_path), - PathBuf::from("../my/path/".to_string()) - ); - assert_eq!( - prefix_with_current_dir_if_needed(root_dir_prefixed_path), - PathBuf::from("/my/path/".to_string()) - ); - assert_eq!(prefix_with_current_dir_if_needed(empty_path), PathBuf::from("".to_string())); - } - #[test] fn get_relative_or_absolute_path_works() { [ diff --git a/crates/pop-common/src/lib.rs b/crates/pop-common/src/lib.rs index 9c4131d4b..8e2c5ce46 100644 --- a/crates/pop-common/src/lib.rs +++ b/crates/pop-common/src/lib.rs @@ -7,10 +7,9 @@ pub use build::Profile; pub use errors::Error; pub use git::{Git, GitHub, Release}; pub use helpers::{ - get_project_name_from_path, get_relative_or_absolute_path, prefix_with_current_dir_if_needed, - replace_in_file, + capitalize_str, get_project_name_from_path, get_relative_or_absolute_path, replace_in_file, }; -pub use manifest::{add_crate_to_workspace, find_workspace_toml}; +pub use manifest::{add_crate_to_workspace, find_pallet_runtime_path}; pub use metadata::format_type; pub use signer::create_signer; pub use sourcing::set_executable_permission; @@ -29,6 +28,7 @@ pub mod manifest; /// Provides functionality for formatting and resolving metadata types. pub mod metadata; pub mod polkadot_sdk; +pub mod rust_writer_helpers; /// Provides functionality for creating a signer from a secret URI. pub mod signer; pub mod sourcing; diff --git a/crates/pop-common/src/manifest.rs b/crates/pop-common/src/manifest.rs index 0d9c40f25..74f1b751f 100644 --- a/crates/pop-common/src/manifest.rs +++ b/crates/pop-common/src/manifest.rs @@ -29,33 +29,6 @@ pub fn from_path(path: Option<&Path>) -> Result { Ok(Manifest::from_path(path.canonicalize()?)?) } -/// This function is used to determine if a Path is contained inside a workspace, and returns a -/// PathBuf to the workspace Cargo.toml if found. -/// -/// # Arguments -/// * `target_dir` - A directory that may be contained inside a workspace -pub fn find_workspace_toml(target_dir: &Path) -> Option { - let mut dir = target_dir; - while let Some(parent) = dir.parent() { - // This condition is necessary to avoid that calling the function from a workspace using a - // path which isn't contained in a workspace returns `Some(Cargo.toml)` refering the - // workspace from where the function has been called instead of the expected `None`. - if parent.to_str() == Some("") { - return None; - } - let cargo_toml = parent.join("Cargo.toml"); - if cargo_toml.exists() { - if let Ok(contents) = read_to_string(&cargo_toml) { - if contents.contains("[workspace]") { - return Some(cargo_toml); - } - } - } - dir = parent; - } - None -} - /// This function is used to add a crate to a workspace. /// # Arguments /// @@ -98,6 +71,61 @@ pub fn add_crate_to_workspace(workspace_toml: &Path, crate_path: &Path) -> anyho Ok(()) } +pub fn is_runtime_crate(path: &Path) -> bool { + // Ideally the runtime would be contained inside a workspace + if let Some(workspace_toml) = rustilities::manifest::find_workspace_manifest(path) { + match Manifest::from_path(&workspace_toml) + .ok() + .map(|manifest| manifest.workspace.map(|workspace| workspace.members)) + { + Some(Some(members)) + if members.contains(&"runtime".to_owned()) && + path.join("src").join("lib.rs").is_file() => + return true, + _ => (), + } + } + // If not, at least it should be a lib crate + if path.join("src").join("lib.rs").is_file() { + true + } else { + false + } +} + +pub fn find_pallet_runtime_path(pallet_path: &Path) -> Option { + if let Some(mut workspace_toml) = rustilities::manifest::find_workspace_manifest(pallet_path) { + match Manifest::from_path(&workspace_toml) + .ok() + .map(|manifest| manifest.workspace.map(|workspace| workspace.members)) + { + Some(Some(members)) if members.contains(&"runtime".to_string()) => { + workspace_toml.pop(); + Some(workspace_toml.join("runtime")) + }, + _ => None, + } + } else { + None + } +} + +pub fn get_pallet_impl_path(runtime_path: &Path, pallet_name: &str) -> Result { + let pallet_config_path = + runtime_path.join("src").join("configs").join(format!("{}.rs", pallet_name)); + if pallet_config_path.exists() { + return Ok(pallet_config_path); + } + let runtime_lib_path = runtime_path.join("src").join("lib.rs"); + if read_to_string(&runtime_lib_path)?.contains(&format!("{} for Runtime", pallet_name)) { + return Ok(runtime_lib_path) + } + Err(Error::Descriptive(format!( + "Pop-CLI couldn't find the impl block for the pallet {}", + pallet_name + ))) +} + /// Adds a "production" profile to the Cargo.toml manifest if it doesn't already exist. /// /// # Arguments @@ -239,49 +267,6 @@ mod tests { Ok(()) } - #[test] - fn find_workspace_toml_works_well() { - let test_builder = TestBuilder::default() - .add_workspace() - .add_inside_workspace_dir() - .add_workspace_cargo_toml( - r#"[workspace] - resolver = "2" - members = ["member1"] - "#, - ) - .add_outside_workspace_dir(); - assert!(find_workspace_toml( - test_builder - .inside_workspace_dir - .as_ref() - .expect("Inside workspace dir should exist") - .path() - ) - .is_some()); - assert_eq!( - find_workspace_toml( - test_builder - .inside_workspace_dir - .as_ref() - .expect("Inside workspace dir should exist") - .path() - ) - .expect("The Cargo.toml should exist at this point"), - test_builder.workspace_cargo_toml.expect("Cargo.toml should exist") - ); - assert!(find_workspace_toml( - test_builder - .outside_workspace_dir - .as_ref() - .expect("Outside workspace dir should exist") - .path() - ) - .is_none()); - // Calling the function from a relative path which parent is "" returns None - assert!(find_workspace_toml(&PathBuf::from("..")).is_none()); - } - #[test] fn add_crate_to_workspace_works_well_if_members_exists() { let test_builder = TestBuilder::default() diff --git a/crates/pop-common/src/rust_writer_helpers.rs b/crates/pop-common/src/rust_writer_helpers.rs new file mode 100644 index 000000000..958479ce9 --- /dev/null +++ b/crates/pop-common/src/rust_writer_helpers.rs @@ -0,0 +1,249 @@ +// SPDX-License-Identifier: GPL-3.0 + +use crate::Error; +use fs_rollback::Rollback; +use proc_macro2::{Literal, Span}; +use rust_writer::{ + ast::{ + finder::{Finder, ToFind}, + implementors::ItemToFile, + mutator::{Mutator, ToMutate}, + }, + preserver::Preserver, +}; +use std::{ + cmp, + path::{Path, PathBuf}, +}; +use syn::{ + parse_quote, File, Ident, ImplItem, Item, ItemMacro, ItemMod, ItemType, Macro, Meta, MetaList, + Path as syn_Path, +}; + +#[cfg(test)] +mod tests; + +#[derive(Debug, Clone, PartialEq)] +pub enum DefaultConfigType { + Default { type_default_impl: ImplItem }, + NoDefault, + NoDefaultBounds { type_default_impl: ImplItem }, +} + +#[derive(Debug, Clone, PartialEq)] +pub enum RuntimeUsedMacro { + Runtime, + ConstructRuntime, +} + +// Not more than 256 pallets are included in a runtime +pub type PalletIndex = u8; + +/// Find the highest implemented pallet index in the outer enum if using the macro +/// #[runtime]. +pub fn find_highest_pallet_index(ast: &File) -> Result { + let mut highest_index: PalletIndex = 0; + let mut found = false; + for item in &ast.items { + match item { + Item::Mod(ItemMod { ident, content, .. }) + if *ident == "runtime" && content.is_some() => + { + let (_, items) = + content.as_ref().expect("content is always Some thanks to the match guard"); + for item in items { + if let Item::Type(ItemType { attrs, .. }) = item { + if let Some(pallet_index_attribute) = attrs.iter().find(|attribute| { + if let Meta::List(MetaList { + path: syn_Path { segments, .. }, .. + }) = &attribute.meta + { + segments.iter().any(|segment| segment.ident == "pallet_index") + } else { + false + } + }) { + // As the attribute at this point is for sure + // #[runtime::pallet_index(n)], so meta is a MetaList where tokens + // is a TokenStream of exactly one element: the literal n. + let mut pallet_index = 0u8; + if let Meta::List(MetaList { tokens, .. }) = + &pallet_index_attribute.meta + { + pallet_index = tokens + .clone() + .into_iter() + .next() + .expect("This iterator has one element due to the attribute shape; qed;") + .to_string() + .parse::() + .expect("The macro #[runtime::pallet_index(n)] is only valid if n is a valid number, so we can parse it to PalletIndex; qed;"); + } + // Despite the pallets will likely be ordered by call_index in the + // runtime, that's not necessarily true, so we keep the highest index in + // order to give the added pallet the next index + highest_index = cmp::max(highest_index, pallet_index); + found = true; + } + } + } + }, + _ => continue, + } + } + + if !found { + return Err(Error::Descriptive( + format! {"Unable to find the highest pallet index in runtime file"}, + )) + } + Ok(Literal::u8_unsuffixed(highest_index.saturating_add(1))) +} + +/// Determine whether a runtime's ast uses the construct_runtime! macro or the #[runtime] macro. +pub fn find_used_runtime_macro(ast: &File) -> Result { + for item in &ast.items { + match item { + Item::Mod(ItemMod { ident, .. }) if *ident == "runtime" => { + return Ok(RuntimeUsedMacro::Runtime); + }, + Item::Macro(ItemMacro { + mac: Macro { path: syn_Path { segments, .. }, .. }, .. + }) if segments.iter().any(|segment| segment.ident == "construct_runtime") => { + return Ok(RuntimeUsedMacro::ConstructRuntime); + }, + _ => (), + } + } + return Err(Error::Descriptive(format!("Unable to find a runtime declaration in runtime file"))); +} + +pub fn compute_pallet_related_paths(runtime_path: &Path) -> (PathBuf, PathBuf, PathBuf, PathBuf) { + let runtime_src_path = runtime_path.join("src"); + let runtime_lib_path = runtime_src_path.join("lib.rs"); + let configs_rs_path = runtime_src_path.join("configs.rs"); + let configs_folder_path = runtime_src_path.join("configs"); + let configs_mod_path = configs_folder_path.join("mod.rs"); + (runtime_lib_path, configs_rs_path, configs_folder_path, configs_mod_path) +} + +pub fn compute_new_pallet_impl_path<'a>( + mut rollback: Rollback<'a>, + runtime_lib_path: &'a Path, + configs_rs_path: &'a Path, + configs_folder_path: &'a Path, + configs_mod_path: &'a Path, + pallet_config_path: &'a Path, + pallet_name: &str, +) -> Result, Error> { + let pallet_name_ident = Ident::new(pallet_name, Span::call_site()); + + let mod_preserver = Preserver::new("mod"); + let pub_mod_preserver = Preserver::new("pub mod"); + + let pallet_mod_implementor = ItemToFile { item: parse_quote!(mod #pallet_name_ident;) }; + + match (configs_rs_path.is_file(), configs_mod_path.is_file()) { + // The runtime is using a configs module without the mod.rs sintax + (true, false) => { + if rollback.get_noted_file(&configs_rs_path).is_none() { + rollback.note_file(&configs_rs_path)?; + } + + let roll_configs_rs_path = rollback + .get_noted_file(&configs_rs_path) + .expect("This file has been noted above; qed;"); + let mut preserved_ast = rust_writer::preserver::preserve_and_parse( + roll_configs_rs_path, + &[&mod_preserver, &pub_mod_preserver], + )?; + + let mut finder = Finder::default().to_find(&pallet_mod_implementor); + let pallet_already_declared = finder.find(&preserved_ast); + if !pallet_already_declared { + let mut mutator = Mutator::default().to_mutate(&pallet_mod_implementor); + mutator.mutate(&mut preserved_ast)?; + rust_writer::preserver::resolve_preserved(&preserved_ast, roll_configs_rs_path)?; + } else { + return Err(Error::Descriptive(format!("{pallet_name} is already in use."))); + } + + rollback.new_file(&pallet_config_path)?; + Ok(rollback) + }, + // The runtime is using a configs module with the mod.rs syntax + (false, true) => { + if rollback.get_noted_file(&configs_mod_path).is_none() { + rollback.note_file(&configs_mod_path)?; + } + + let roll_configs_mod_path = rollback + .get_noted_file(&configs_mod_path) + .expect("This file has been noted above; qed;"); + let mut preserved_ast = rust_writer::preserver::preserve_and_parse( + roll_configs_mod_path, + &[&mod_preserver, &pub_mod_preserver], + )?; + + let mut finder = Finder::default().to_find(&pallet_mod_implementor); + let pallet_already_declared = finder.find(&preserved_ast); + if !pallet_already_declared { + let mut mutator = Mutator::default().to_mutate(&pallet_mod_implementor); + mutator.mutate(&mut preserved_ast)?; + rust_writer::preserver::resolve_preserved(&preserved_ast, roll_configs_mod_path)?; + } else { + return Err(Error::Descriptive(format!("{pallet_name} is already in use."))); + } + + rollback.new_file(&pallet_config_path)?; + Ok(rollback) + }, + // The runtime isn't using a configs module yet, we opt for the configs.rs + // convention + (false, false) => { + let configs_mod_implementor = ItemToFile { + item: parse_quote!( + pub mod configs; + ), + }; + if rollback.get_noted_file(&runtime_lib_path).is_none() { + rollback.note_file(&runtime_lib_path)?; + } + + let roll_runtime_lib_path = rollback + .get_noted_file(&runtime_lib_path) + .expect("This file has been noted above; qed;"); + let mut preserved_ast = rust_writer::preserver::preserve_and_parse( + roll_runtime_lib_path, + &[&mod_preserver, &pub_mod_preserver], + )?; + + let mut finder = Finder::default().to_find(&configs_mod_implementor); + let configs_already_declared = finder.find(&preserved_ast); + if !configs_already_declared { + let mut mutator = Mutator::default().to_mutate(&configs_mod_implementor); + mutator.mutate(&mut preserved_ast)?; + rust_writer::preserver::resolve_preserved(&preserved_ast, roll_runtime_lib_path)?; + } + + rollback.new_file(&configs_rs_path)?; + rollback.new_dir(&configs_folder_path)?; + rollback.new_file(&pallet_config_path)?; + + let roll_configs_rs_path = rollback + .get_new_file(&configs_rs_path) + .expect("The new file has been noted above; qed"); + + // New file so we can mutate it directly. + let mut ast = rust_writer::preserver::preserve_and_parse(roll_configs_rs_path, &[])?; + let mut mutator = Mutator::default().to_mutate(&pallet_mod_implementor); + mutator.mutate(&mut ast)?; + rust_writer::preserver::resolve_preserved(&ast, roll_configs_rs_path)?; + + Ok(rollback) + }, + // Both approaches at the sime time aren't supported by the compiler, so this is + // unreachable in a compiling project + (true, true) => unreachable!(), + } +} diff --git a/crates/pop-common/src/rust_writer_helpers/sample_files/basic_pallet.rs b/crates/pop-common/src/rust_writer_helpers/sample_files/basic_pallet.rs new file mode 100644 index 000000000..89b01bbfe --- /dev/null +++ b/crates/pop-common/src/rust_writer_helpers/sample_files/basic_pallet.rs @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-3.0 + +#![cfg_attr(not(feature = "std"), no_std)] + +use frame::prelude::*; + +pub use pallet::*; + +#[cfg(test)] +mod mock; + +#[cfg(test)] +mod tests; + +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking; + +#[frame::pallet] +pub mod pallet { + use super::*; + + pub enum SomeEnum { + #[codec(index = 0)] + Something, + } + + #[pallet::pallet] + pub struct Pallet(_); + + #[pallet::config(with_default)] + pub trait Config: frame_system::Config {} + + #[pallet::call] + impl Pallet {} +} diff --git a/crates/pop-common/src/rust_writer_helpers/sample_files/runtime_using_construct_runtime_macro.rs b/crates/pop-common/src/rust_writer_helpers/sample_files/runtime_using_construct_runtime_macro.rs new file mode 100644 index 000000000..faaea67d6 --- /dev/null +++ b/crates/pop-common/src/rust_writer_helpers/sample_files/runtime_using_construct_runtime_macro.rs @@ -0,0 +1,258 @@ +// SPDX-License-Identifier: GPL-3.0 + +#![cfg_attr(not(feature = "std"), no_std)] +// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. +#![recursion_limit = "256"] + +// Make the WASM binary available. +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +pub mod apis; +#[cfg(feature = "runtime-benchmarks")] +mod benchmarks; +mod configs; +mod weights; + +use smallvec::smallvec; +use sp_runtime::{ + create_runtime_str, generic, impl_opaque_keys, + traits::{BlakeTwo256, IdentifyAccount, Verify}, + MultiSignature, +}; + +use sp_std::prelude::*; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; + +use frame_support::{construct_runtime, weights::{ + constants::WEIGHT_REF_TIME_PER_SECOND, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, + WeightToFeePolynomial, +}}; +pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; +pub use sp_runtime::{MultiAddress, Perbill, Permill}; + +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; + +use weights::ExtrinsicBaseWeight; + +/// Alias to 512-bit hash when used in the context of a transaction signature on the chain. +pub type Signature = MultiSignature; + +/// Some way of identifying an account on the chain. We intentionally make it equivalent +/// to the public key of our transaction signing scheme. +pub type AccountId = <::Signer as IdentifyAccount>::AccountId; + +/// Balance of an account. +pub type Balance = u128; + +/// Index of a transaction in the chain. +pub type Nonce = u32; + +/// A hash of some data used by the chain. +pub type Hash = sp_core::H256; + +/// An index to a block. +pub type BlockNumber = u32; + +/// The address format for describing accounts. +pub type Address = MultiAddress; + +/// Block header type as expected by this runtime. +pub type Header = generic::Header; + +/// Block type as expected by this runtime. +pub type Block = generic::Block; + +/// A Block signed with a Justification +pub type SignedBlock = generic::SignedBlock; + +/// BlockId type as expected by this runtime. +pub type BlockId = generic::BlockId; + +/// The SignedExtension to the basic transaction logic. +#[docify::export(template_signed_extra)] +pub type SignedExtra = ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, + cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, + frame_metadata_hash_extension::CheckMetadataHash, +); + +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic; + +/// Migrations to apply on runtime upgrade. +pub type Migrations = pallet_xcm::migration::MigrateToLatestXcmVersion; + +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, + Migrations, +>; + +/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the +/// node's balance type. +/// +/// This should typically create a mapping between the following ranges: +/// - `[0, MAXIMUM_BLOCK_WEIGHT]` +/// - `[Balance::min, Balance::max]` +/// +/// Yet, it can be used for any other sort of change to weight-fee. Some examples being: +/// - Setting it to `0` will essentially disable the weight fee. +/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. +pub struct WeightToFee; +impl WeightToFeePolynomial for WeightToFee { + type Balance = Balance; + fn polynomial() -> WeightToFeeCoefficients { + // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: + // in our template, we map to 1/10 of that, or 1/10 MILLIUNIT + let p = MILLIUNIT / 10; + let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); + smallvec![WeightToFeeCoefficient { + degree: 1, + negative: false, + coeff_frac: Perbill::from_rational(p % q, q), + coeff_integer: p / q, + }] + } +} + +/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know +/// the specifics of the runtime. They can then be made to be agnostic over specific formats +/// of data like extrinsics, allowing for them to continue syncing the network through upgrades +/// to even the core data structures. +pub mod opaque { + use super::*; + use sp_runtime::{ + generic, + traits::{BlakeTwo256, Hash as HashT}, + }; + + pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; + /// Opaque block header type. + pub type Header = generic::Header; + /// Opaque block type. + pub type Block = generic::Block; + /// Opaque block identifier type. + pub type BlockId = generic::BlockId; + /// Opaque block hash type. + pub type Hash = ::Output; +} + +impl_opaque_keys! { + pub struct SessionKeys { + pub aura: Aura, + } +} + +const spec_name: RuntimeString = create_runtime_str!("parachain-template-runtime"); + +const impl_name: RuntimeString = create_runtime_str!("parachain-template-runtime"); + +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name, + impl_name, + authoring_version: 1, + spec_version: 1, + impl_version: 0, + apis: apis::RUNTIME_API_VERSIONS, + transaction_version: 1, + state_version: 1, +}; + +/// This determines the average expected block time that we are targeting. +/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`. +/// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked +/// up by `pallet_aura` to implement `fn slot_duration()`. +/// +/// Change this to adjust the block time. +pub const MILLISECS_PER_BLOCK: u64 = 6000; + +// NOTE: Currently it is not possible to change the slot duration after the chain has started. +// Attempting to do so will brick block production. +pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; + +// Time is measured by number of blocks. +pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); +pub const HOURS: BlockNumber = MINUTES * 60; +pub const DAYS: BlockNumber = HOURS * 24; + +// Unit = the base number of indivisible units for balances +pub const UNIT: Balance = 1_000_000_000_000; +pub const CENTIUNIT: Balance = 10_000_000_000; +pub const MILLIUNIT: Balance = 1_000_000_000; +pub const MICROUNIT: Balance = 1_000_000; + +/// The existential deposit. Set to 1/10 of the Connected Relay Chain. +pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT; + +/// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is +/// used to limit the maximal weight of a single extrinsic. +const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); + +/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by +/// `Operational` extrinsics. +const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); + +/// We allow for 2 seconds of compute with a 6-second average block. +const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), + cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, +); + +/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included +/// into the relay chain. +const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3; +/// How many parachain blocks are processed by the relay chain per parent. Limits the +/// number of blocks authored per slot. +const BLOCK_PROCESSING_VELOCITY: u32 = 1; +/// Relay chain slot duration, in milliseconds. +const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; + +/// Aura consensus hook +type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< + Runtime, + RELAY_CHAIN_SLOT_DURATION_MILLIS, + BLOCK_PROCESSING_VELOCITY, + UNINCLUDED_SEGMENT_CAPACITY, +>; + +/// The version information used to identify this runtime when compiled natively. +#[cfg(feature = "std")] +pub fn native_version() -> NativeVersion { + NativeVersion { + runtime_version: VERSION, + can_author_with: Default::default(), + } +} + +construct_runtime! { + pub enum Runtime{ + System:frame_system, + ParachainSystem: cumulus_pallet_parachain_system, + Timestamp: pallet_timestamp, + ParachainInfo:parachain_info, + Balances: pallet_balances, + TransactionPayment: pallet_transaction_payment, + } +} + +cumulus_pallet_parachain_system::register_validate_block! { + Runtime = Runtime, + BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, +} diff --git a/crates/pop-common/src/rust_writer_helpers/sample_files/runtime_using_runtime_macro.rs b/crates/pop-common/src/rust_writer_helpers/sample_files/runtime_using_runtime_macro.rs new file mode 100644 index 000000000..6374e6727 --- /dev/null +++ b/crates/pop-common/src/rust_writer_helpers/sample_files/runtime_using_runtime_macro.rs @@ -0,0 +1,281 @@ +// SPDX-License-Identifier: GPL-3.0 + +#![cfg_attr(not(feature = "std"), no_std)] +// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. +#![recursion_limit = "256"] + +// Make the WASM binary available. +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +pub mod apis; +#[cfg(feature = "runtime-benchmarks")] +mod benchmarks; +mod configs; +mod weights; + +use smallvec::smallvec; +use sp_runtime::{ + create_runtime_str, generic, impl_opaque_keys, + traits::{BlakeTwo256, IdentifyAccount, Verify}, + MultiSignature, +}; + +use sp_std::prelude::*; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; + +use frame_support::weights::{ + constants::WEIGHT_REF_TIME_PER_SECOND, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, + WeightToFeePolynomial, +}; +pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; +pub use sp_runtime::{MultiAddress, Perbill, Permill}; + +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; + +use weights::ExtrinsicBaseWeight; + +/// Alias to 512-bit hash when used in the context of a transaction signature on the chain. +pub type Signature = MultiSignature; + +/// Some way of identifying an account on the chain. We intentionally make it equivalent +/// to the public key of our transaction signing scheme. +pub type AccountId = <::Signer as IdentifyAccount>::AccountId; + +/// Balance of an account. +pub type Balance = u128; + +/// Index of a transaction in the chain. +pub type Nonce = u32; + +/// A hash of some data used by the chain. +pub type Hash = sp_core::H256; + +/// An index to a block. +pub type BlockNumber = u32; + +/// The address format for describing accounts. +pub type Address = MultiAddress; + +/// Block header type as expected by this runtime. +pub type Header = generic::Header; + +/// Block type as expected by this runtime. +pub type Block = generic::Block; + +/// A Block signed with a Justification +pub type SignedBlock = generic::SignedBlock; + +/// BlockId type as expected by this runtime. +pub type BlockId = generic::BlockId; + +/// The SignedExtension to the basic transaction logic. +#[docify::export(template_signed_extra)] +pub type SignedExtra = ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, + cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim, + frame_metadata_hash_extension::CheckMetadataHash, +); + +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic; + +/// Migrations to apply on runtime upgrade. +pub type Migrations = pallet_xcm::migration::MigrateToLatestXcmVersion; + +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, + Migrations, +>; + +/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the +/// node's balance type. +/// +/// This should typically create a mapping between the following ranges: +/// - `[0, MAXIMUM_BLOCK_WEIGHT]` +/// - `[Balance::min, Balance::max]` +/// +/// Yet, it can be used for any other sort of change to weight-fee. Some examples being: +/// - Setting it to `0` will essentially disable the weight fee. +/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. +pub struct WeightToFee; +impl WeightToFeePolynomial for WeightToFee { + type Balance = Balance; + fn polynomial() -> WeightToFeeCoefficients { + // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: + // in our template, we map to 1/10 of that, or 1/10 MILLIUNIT + let p = MILLIUNIT / 10; + let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); + smallvec![WeightToFeeCoefficient { + degree: 1, + negative: false, + coeff_frac: Perbill::from_rational(p % q, q), + coeff_integer: p / q, + }] + } +} + +/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know +/// the specifics of the runtime. They can then be made to be agnostic over specific formats +/// of data like extrinsics, allowing for them to continue syncing the network through upgrades +/// to even the core data structures. +pub mod opaque { + use super::*; + use sp_runtime::{ + generic, + traits::{BlakeTwo256, Hash as HashT}, + }; + + pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; + /// Opaque block header type. + pub type Header = generic::Header; + /// Opaque block type. + pub type Block = generic::Block; + /// Opaque block identifier type. + pub type BlockId = generic::BlockId; + /// Opaque block hash type. + pub type Hash = ::Output; +} + +impl_opaque_keys! { + pub struct SessionKeys { + pub aura: Aura, + } +} + +const spec_name: RuntimeString = create_runtime_str!("parachain-template-runtime"); + +const impl_name: RuntimeString = create_runtime_str!("parachain-template-runtime"); + +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name, + impl_name, + authoring_version: 1, + spec_version: 1, + impl_version: 0, + apis: apis::RUNTIME_API_VERSIONS, + transaction_version: 1, + state_version: 1, +}; + +/// This determines the average expected block time that we are targeting. +/// Blocks will be produced at a minimum duration defined by `SLOT_DURATION`. +/// `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked +/// up by `pallet_aura` to implement `fn slot_duration()`. +/// +/// Change this to adjust the block time. +pub const MILLISECS_PER_BLOCK: u64 = 6000; + +// NOTE: Currently it is not possible to change the slot duration after the chain has started. +// Attempting to do so will brick block production. +pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; + +// Time is measured by number of blocks. +pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); +pub const HOURS: BlockNumber = MINUTES * 60; +pub const DAYS: BlockNumber = HOURS * 24; + +// Unit = the base number of indivisible units for balances +pub const UNIT: Balance = 1_000_000_000_000; +pub const CENTIUNIT: Balance = 10_000_000_000; +pub const MILLIUNIT: Balance = 1_000_000_000; +pub const MICROUNIT: Balance = 1_000_000; + +/// The existential deposit. Set to 1/10 of the Connected Relay Chain. +pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT; + +/// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is +/// used to limit the maximal weight of a single extrinsic. +const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); + +/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by +/// `Operational` extrinsics. +const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); + +/// We allow for 2 seconds of compute with a 6-second average block. +const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), + cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, +); + +/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included +/// into the relay chain. +const UNINCLUDED_SEGMENT_CAPACITY: u32 = 3; +/// How many parachain blocks are processed by the relay chain per parent. Limits the +/// number of blocks authored per slot. +const BLOCK_PROCESSING_VELOCITY: u32 = 1; +/// Relay chain slot duration, in milliseconds. +const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; + +/// Aura consensus hook +type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< + Runtime, + RELAY_CHAIN_SLOT_DURATION_MILLIS, + BLOCK_PROCESSING_VELOCITY, + UNINCLUDED_SEGMENT_CAPACITY, +>; + +/// The version information used to identify this runtime when compiled natively. +#[cfg(feature = "std")] +pub fn native_version() -> NativeVersion { + NativeVersion { + runtime_version: VERSION, + can_author_with: Default::default(), + } +} + +#[frame_support::runtime] +mod runtime { + // Create the runtime by composing the FRAME pallets that were previously configured. + #[runtime::runtime] + #[runtime::derive( + RuntimeCall, + RuntimeEvent, + RuntimeError, + RuntimeOrigin, + RuntimeFreezeReason, + RuntimeHoldReason, + RuntimeSlashReason, + RuntimeLockId, + RuntimeTask + )] + pub struct Runtime; + + // System support stuff. + #[runtime::pallet_index(0)] + pub type System = frame_system::Pallet; + #[runtime::pallet_index(1)] + pub type ParachainSystem = cumulus_pallet_parachain_system::Pallet; + #[runtime::pallet_index(2)] + pub type Timestamp = pallet_timestamp::Pallet; + #[runtime::pallet_index(3)] + pub type ParachainInfo = parachain_info::Pallet; + + // Monetary stuff. + #[runtime::pallet_index(10)] + pub type Balances = pallet_balances::Pallet; + #[runtime::pallet_index(11)] + pub type TransactionPayment = pallet_transaction_payment::Pallet; +} + +cumulus_pallet_parachain_system::register_validate_block! { + Runtime = Runtime, + BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, +} diff --git a/crates/pop-common/src/rust_writer_helpers/tests.rs b/crates/pop-common/src/rust_writer_helpers/tests.rs new file mode 100644 index 000000000..907ed707e --- /dev/null +++ b/crates/pop-common/src/rust_writer_helpers/tests.rs @@ -0,0 +1,118 @@ +// SPDX-License-Identifier: GPL-3.0 + +use super::*; +use std::{fs, path::PathBuf}; +use syn::{parse_file, parse_quote, File}; + +struct TestBuilder { + test_files: PathBuf, + pub(crate) ast: File, +} + +impl Default for TestBuilder { + fn default() -> Self { + Self { + test_files: PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("src") + .join("rust_writer_helpers") + .join("sample_files"), + ast: parse_quote! {}, + } + } +} + +macro_rules! add_ast_to_builder_no_preserve{ + ($([$name: ident, $file: literal]),*) => { + $( + fn $name(&mut self){ + self.ast = parse_file( + &fs::read_to_string(self.test_files.join($file)) + .expect(concat!{"Error reading file in ", stringify!($name)}), + ) + .expect(concat!{"Error parsing file in ", stringify!($name)}); + } + )* + }; +} + +impl TestBuilder { + add_ast_to_builder_no_preserve! { + [add_basic_pallet_ast, "basic_pallet.rs"], + [add_runtime_using_runtime_macro_ast, "runtime_using_runtime_macro.rs"], + [add_runtime_using_construct_runtime_macro_ast, "runtime_using_construct_runtime_macro.rs"] + } +} + +#[test] +fn find_highest_pallet_index_works_well() { + let mut test_builder = TestBuilder::default(); + + //find_highest_pallet_index should work with a runtime using the #[runtime] macro + test_builder.add_runtime_using_runtime_macro_ast(); + + let highest_index = find_highest_pallet_index(&test_builder.ast) + .expect("find_highest_pallet_index is supposed to be Ok"); + + // The highest index in the sample pallet is 11 + assert_eq!(highest_index.to_string(), "12"); +} + +#[test] +fn find_highest_pallet_index_fails_if_input_doesnt_use_runtime_macro() { + let mut test_builder = TestBuilder::default(); + + //Add a pallet file to the test_builder + test_builder.add_runtime_using_construct_runtime_macro_ast(); + + let failed_call = find_highest_pallet_index(&test_builder.ast); + + assert!(failed_call.is_err()); + if let Error::Descriptive(msg) = failed_call.unwrap_err() { + assert_eq!(msg, "Unable to find the highest pallet index in runtime file"); + } else { + panic!("find_highest_pallet_index should return only Error::Descriptive") + } +} + +#[test] +fn find_used_runtime_macro_with_construct_runtime_works_well() { + let mut test_builder = TestBuilder::default(); + + //Add the runtime with construct_runtime to the test_builder + test_builder.add_runtime_using_construct_runtime_macro_ast(); + + let used_macro = find_used_runtime_macro(&test_builder.ast) + .expect("find_used_runtime_macro is supposed to be Ok"); + + assert_eq!(used_macro, RuntimeUsedMacro::ConstructRuntime); +} + +#[test] +fn find_used_runtime_macro_with_runtime_macro_works_well() { + let mut test_builder = TestBuilder::default(); + + //Add the runtime with runtime to the test_builder + test_builder.add_runtime_using_runtime_macro_ast(); + + let used_macro = find_used_runtime_macro(&test_builder.ast) + .expect("find_used_runtime_macro is supposed to be Ok"); + + assert_eq!(used_macro, RuntimeUsedMacro::Runtime); +} + +#[test] +fn find_used_runtime_macro_fails_if_input_isnt_runtime_file() { + let mut test_builder = TestBuilder::default(); + + //Add a pallet file to the test_builder + test_builder.add_basic_pallet_ast(); + + let failed_call = find_used_runtime_macro(&test_builder.ast); + + assert!(failed_call.is_err()); + if let Error::Descriptive(msg) = failed_call.unwrap_err() { + assert_eq!(msg, "Unable to find a runtime declaration in runtime file"); + } else { + panic!("find_used_runtime_macro should return only Error::Descriptive") + } +} diff --git a/crates/pop-contracts/Cargo.toml b/crates/pop-contracts/Cargo.toml index 581075f95..f217bcdb8 100644 --- a/crates/pop-contracts/Cargo.toml +++ b/crates/pop-contracts/Cargo.toml @@ -12,6 +12,8 @@ version.workspace = true [dependencies] anyhow.workspace = true +# Pin to solve dependencies conflics. See Cargo.toml for further info. +deranged.workspace = true duct.workspace = true reqwest.workspace = true tempfile.workspace = true @@ -38,4 +40,4 @@ pop-common = { path = "../pop-common", version = "0.6.0" } [dev-dependencies] # Used in doc tests. -tokio-test.workspace = true \ No newline at end of file +tokio-test.workspace = true diff --git a/crates/pop-parachains/Cargo.toml b/crates/pop-parachains/Cargo.toml index 42f751343..8cff33407 100644 --- a/crates/pop-parachains/Cargo.toml +++ b/crates/pop-parachains/Cargo.toml @@ -11,11 +11,15 @@ version.workspace = true [dependencies] anyhow.workspace = true clap.workspace = true +# Pin to solve dependencies conflics. See Cargo.toml for further info. +deranged.workspace = true duct.workspace = true glob.workspace = true serde_json.workspace = true strum.workspace = true strum_macros.workspace = true +syn.workspace = true +tar.workspace = true subxt-signer.workspace = true subxt.workspace = true tempfile.workspace = true diff --git a/crates/pop-parachains/src/new_pallet/new_pallet_options.rs b/crates/pop-parachains/src/new_pallet/new_pallet_options.rs index d0109a3d6..547e15f15 100644 --- a/crates/pop-parachains/src/new_pallet/new_pallet_options.rs +++ b/crates/pop-parachains/src/new_pallet/new_pallet_options.rs @@ -1,5 +1,6 @@ use clap::ValueEnum; use strum_macros::{EnumIter, EnumMessage}; +use syn::{parse_quote, Type}; /// This enum is used to register from the CLI which types that are kind of usual in config traits /// are included in the pallet @@ -27,6 +28,16 @@ pub enum TemplatePalletConfigCommonTypes { Currency, } +impl TemplatePalletConfigCommonTypes { + pub fn common_value(&self) -> Type { + match self { + TemplatePalletConfigCommonTypes::RuntimeEvent => parse_quote! {RuntimeEvent}, + TemplatePalletConfigCommonTypes::RuntimeOrigin => parse_quote! {RuntimeOrigin}, + TemplatePalletConfigCommonTypes::Currency => parse_quote! {Balances}, + } + } +} + /// This enum is used to determine which storage shape has a storage item in the pallet #[derive(Debug, Copy, Clone, PartialEq, EnumIter, EnumMessage, ValueEnum)] pub enum TemplatePalletStorageTypes { diff --git a/crates/pop-parachains/templates/pallet/advanced_mode/src/lib.rs.templ b/crates/pop-parachains/templates/pallet/advanced_mode/src/lib.rs.templ index e64b37dee..af51f966b 100644 --- a/crates/pop-parachains/templates/pallet/advanced_mode/src/lib.rs.templ +++ b/crates/pop-parachains/templates/pallet/advanced_mode/src/lib.rs.templ @@ -18,7 +18,7 @@ use frame::traits::{fungible, VariantCount}; pub mod config_preludes; {{- endif }} -use pallet::*; +pub use pallet::*; // A module where the main logic of the pallet is stored mod pallet_logic; diff --git a/crates/pop-telemetry/Cargo.toml b/crates/pop-telemetry/Cargo.toml index 9db875169..03aa9357a 100644 --- a/crates/pop-telemetry/Cargo.toml +++ b/crates/pop-telemetry/Cargo.toml @@ -8,6 +8,8 @@ repository.workspace = true version.workspace = true [dependencies] +# Pin to solve dependencies conflics. See Cargo.toml for further info. +deranged.workspace = true dirs = { workspace = true } env_logger.workspace = true log.workspace = true @@ -19,4 +21,4 @@ tokio.workspace = true [dev-dependencies] mockito.workspace = true -tempfile.workspace = true \ No newline at end of file +tempfile.workspace = true