diff --git a/.github/workflows/build-revive-debian.yml b/.github/workflows/build-revive-debian.yml new file mode 100644 index 0000000..f51ee1a --- /dev/null +++ b/.github/workflows/build-revive-debian.yml @@ -0,0 +1,38 @@ +name: Build revive-debian +on: + workflow_dispatch: + +env: + REVIVE_DEBIAN_PACKAGE: revive-debian-x86 + DEBIAN_CONTAINER: revive-builder-debian-x86 + DEBIAN_CONTAINER_BUILDER: build-debian-builder.sh + DEBIAN_CONTAINER_RUNNER: run-debian-builder.sh + REVIVE_DEBIAN_INSTALL: ${{ github.workspace }}/target/release + REVIVE_DEBIAN_BINARY: resolc + RUST_VERSION: "1.80" + +jobs: + build-revive-debian-x86: + name: debian-container-x86 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: build-container + run: | + (cd utils && ./${{ env.DEBIAN_CONTAINER_BUILDER}} --build-arg RUST_VERSION=${{ env.RUST_VERSION}} . ) + + - name: build-revive-debian + run: | + rustup show + cargo --version + rustup +nightly show + cargo +nightly --version + bash --version + utils/${{ env.DEBIAN_CONTAINER_RUNNER }} utils/build-revive.sh -o ${{ env.REVIVE_DEBIAN_INSTALL}} + + - uses: actions/upload-artifact@v4 + with: + name: ${{ env.REVIVE_DEBIAN_PACKAGE }} + path: ${{ env.REVIVE_DEBIAN_INSTALL }}/${{ env.REVIVE_DEBIAN_BINARY }} + retention-days: 1 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 812978f..31006ca 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,7 +19,7 @@ jobs: - name: Install solc run: | mkdir -p solc - curl -sSL --output solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.26/solc-static-linux + curl -sSL --output solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-static-linux chmod +x solc/solc echo "$(pwd)/solc/" >> $GITHUB_PATH @@ -31,7 +31,10 @@ jobs: echo "$(pwd)/llvm18/bin" >> $GITHUB_PATH - name: Install apt dependencies - run: sudo apt update && sudo apt install -y libtinfo5 + run: | + sudo add-apt-repository -y ppa:ethereum/ethereum + sudo apt update + sudo apt install -y libtinfo5 ethereum - name: Format run: make format diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..80f7322 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,28 @@ +# Changelog + +## Unreleased + +## v0.1.0-dev.5 + +This is development pre-release. + +# Added +- Implement the `CODESIZE` and `EXTCODESIZE` opcodes. + +# Changed +- Include the full revive version in the contract metadata. + +# Fixed + +## v0.1.0-dev-4 + +This is development pre-release. + +# Added +- Support the `ORIGIN` opcode. + +# Changed +- Update polkavm to `v0.14.0`. +- Enable the `a`, `fast-unaligned-access` and `xtheadcondmov` LLVM target features, decreasing the code size for some contracts. + +# Fixed diff --git a/Cargo.lock b/Cargo.lock index e980812..24315ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,75 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli 0.27.3", +] + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli 0.31.1", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + [[package]] name = "ahash" version = "0.8.11" @@ -9,6 +78,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", + "getrandom", "once_cell", "version_check", "zerocopy", @@ -24,20 +94,47 @@ dependencies = [ ] [[package]] -name = "alloy-primitives" -version = "0.6.4" +name = "allocator-api2" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600d34d8de81e23b6d909c094e23b3d357e01ca36b78a8c5424c501eedbe86f0" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + +[[package]] +name = "alloy-genesis" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a7a18afb0b318616b6b2b0e2e7ac5529d32a966c673b48091c9919e284e6aca" +dependencies = [ + "alloy-primitives 0.8.10", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-json-abi" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31a0f0d51db8a1a30a4d98a9f90e090a94c8f44cb4d9eafc7e03aa6d00aae984" +dependencies = [ + "alloy-primitives 0.8.10", + "alloy-sol-type-parser", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-primitives" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0628ec0ba5b98b3370bb6be17b12f23bfce8ee4ad83823325a20546d9b03b78" dependencies = [ "alloy-rlp", "bytes", "cfg-if", "const-hex", - "derive_more", + "derive_more 0.99.18", "hex-literal", "itoa", - "k256", - "keccak-asm", "proptest", "rand", "ruint", @@ -46,41 +143,149 @@ dependencies = [ ] [[package]] -name = "alloy-rlp" -version = "0.3.5" +name = "alloy-primitives" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b155716bab55763c95ba212806cf43d05bcc70e5f35b02bad20cf5ec7fe11fed" +checksum = "8edae627382349b56cd6a7a2106f4fd69b243a9233e560c55c2e03cabb7e1d3c" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more 1.0.0", + "foldhash", + "hashbrown 0.15.0", + "hex-literal", + "indexmap 2.6.0", + "itoa", + "k256", + "keccak-asm", + "paste", + "proptest", + "rand", + "ruint", + "rustc-hash 2.0.0", + "serde", + "sha3", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0822426598f95e45dd1ea32a738dac057529a709ee645fcc516ffa4cbde08f" dependencies = [ "arrayvec", "bytes", ] [[package]] -name = "alloy-sol-macro" -version = "0.6.4" +name = "alloy-serde" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86ec0a47740b20bc5613b8712d0d321d031c4efc58e9645af96085d5cccfc27" +checksum = "731f75ec5d383107fd745d781619bd9cedf145836c51ecb991623d41278e71fa" +dependencies = [ + "alloy-primitives 0.8.10", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-sol-macro" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a98ad1696a2e17f010ae8e43e9f2a1e930ed176a8e3ff77acfeff6dfb07b42c" dependencies = [ "const-hex", "dunce", "heck 0.4.1", - "indexmap", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.66", - "syn-solidity", + "syn 2.0.85", + "syn-solidity 0.4.2", "tiny-keccak", ] [[package]] -name = "alloy-sol-types" -version = "0.6.4" +name = "alloy-sol-macro" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad09ec5853fa700d12d778ad224dcdec636af424d29fad84fb9a2f16a5b0ef09" +checksum = "841eabaa4710f719fddbc24c95d386eae313f07e6da4babc25830ee37945be0c" dependencies = [ - "alloy-primitives", - "alloy-sol-macro", + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6672337f19d837b9f7073c45853aeb528ed9f7dd6a4154ce683e9e5cb7794014" +dependencies = [ + "alloy-sol-macro-input", + "const-hex", + "heck 0.5.0", + "indexmap 2.6.0", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.85", + "syn-solidity 0.8.10", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dff37dd20bfb118b777c96eda83b2067f4226d2644c5cfa00187b3bc01770ba" +dependencies = [ + "const-hex", + "dunce", + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.85", + "syn-solidity 0.8.10", +] + +[[package]] +name = "alloy-sol-type-parser" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b853d42292dbb159671a3edae3b2750277ff130f32b726fe07dc2b17aa6f2b5" +dependencies = [ + "serde", + "winnow", +] + +[[package]] +name = "alloy-sol-types" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98d7107bed88e8f09f0ddcc3335622d87bfb6821f3e0c7473329fb1cfad5e015" +dependencies = [ + "alloy-primitives 0.4.2", + "alloy-sol-macro 0.4.2", + "const-hex", + "serde", +] + +[[package]] +name = "alloy-sol-types" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa828bb1b9a6dc52208fbb18084fb9ce2c30facc2bfda6a5d922349b4990354f" +dependencies = [ + "alloy-json-abi", + "alloy-primitives 0.8.10", + "alloy-sol-macro 0.8.10", "const-hex", "serde", ] @@ -93,9 +298,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338" dependencies = [ "anstyle", "anstyle-parse", @@ -108,43 +313,208 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "8365de52b16c035ff4fcafe0092ba9390540e3e352870ac09933bebcaa2c8c56" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.3" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "aquamarine" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21cc1548309245035eb18aa7f0967da6bc65587005170c56e6ef2788a4cf3f4e" +dependencies = [ + "include_dir", + "itertools 0.10.5", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "ark-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb00293ba84f51ce3bd026bd0de55899c4e68f0a39a5728cebae3a73ffdc0a4f" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bls12-377-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c7021f180a0cbea0380eba97c2af3c57074cdaffe0eef7e840e1c9f2841e55" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-models-ext", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bls12-381-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1dc4b3d08f19e8ec06e949712f95b8361e43f1391d94f65e4234df03480631c" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff 0.4.2", + "ark-models-ext", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bw6-761" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e0605daf0cc5aa2034b78d008aaf159f56901d92a52ee4f6ecdfdac4f426700" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bw6-761-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccee5fba47266f460067588ee1bf070a9c760bf2050c1c509982c5719aadb4f2" +dependencies = [ + "ark-bw6-761", + "ark-ec", + "ark-ff 0.4.2", + "ark-models-ext", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "rayon", + "zeroize", +] + +[[package]] +name = "ark-ed-on-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b10d901b9ac4b38f9c32beacedfadcdd64e46f8d7f8e88c1ae1060022cf6f6c6" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-ed-on-bls12-377-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524a4fb7540df2e1a8c2e67a83ba1d1e6c3947f4f9342cc2359fc2e789ad731d" +dependencies = [ + "ark-ec", + "ark-ed-on-bls12-377", + "ark-ff 0.4.2", + "ark-models-ext", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-ed-on-bls12-381-bandersnatch" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9cde0f2aa063a2a5c28d39b47761aa102bda7c13c84fc118a61b87c7b2f785c" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-ed-on-bls12-381-bandersnatch-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d15185f1acb49a07ff8cbe5f11a1adc5a93b19e211e325d826ae98e98e124346" +dependencies = [ + "ark-ec", + "ark-ed-on-bls12-381-bandersnatch", + "ark-ff 0.4.2", + "ark-models-ext", + "ark-std 0.4.0", +] [[package]] name = "ark-ff" @@ -180,7 +550,7 @@ dependencies = [ "num-bigint", "num-traits", "paste", - "rustc_version 0.4.0", + "rustc_version 0.4.1", "zeroize", ] @@ -229,6 +599,61 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-models-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e9eab5d4b5ff2f228b763d38442adc9b084b0a465409b059fac5c2308835ec2" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-scale" +version = "0.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f69c00b3b529be29528a6f2fd5fa7b1790f8bed81b9cdca17e326538545a179" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "ark-secret-scalar" +version = "0.0.2" +source = "git+https://github.com/w3f/ring-vrf?rev=0fef826#0fef8266d851932ad25d6b41bc4b34d834d1e11d" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "ark-transcript", + "digest 0.10.7", + "getrandom_or_panic", + "zeroize", +] + [[package]] name = "ark-serialize" version = "0.3.0" @@ -245,11 +670,23 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ + "ark-serialize-derive", "ark-std 0.4.0", "digest 0.10.7", "num-bigint", ] +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "ark-std" version = "0.3.0" @@ -268,13 +705,114 @@ checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ "num-traits", "rand", + "rayon", ] [[package]] -name = "arrayvec" -version = "0.7.4" +name = "ark-transcript" +version = "0.0.2" +source = "git+https://github.com/w3f/ring-vrf?rev=0fef826#0fef8266d851932ad25d6b41bc4b34d834d1e11d" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "digest 0.10.7", + "rand_core", + "sha3", +] + +[[package]] +name = "array-bytes" +version = "6.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "5d5dde061bd34119e902bbb2d9b90c5692635cf59fb91d582c2b68043f1b8293" + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + +[[package]] +name = "asset-test-utils" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-pallet-parachain-system", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "frame-support", + "frame-system", + "pallet-assets", + "pallet-balances", + "pallet-collator-selection", + "pallet-session", + "pallet-timestamp", + "pallet-xcm", + "pallet-xcm-bridge-hub-router", + "parachains-common", + "parachains-runtimes-test-utils", + "parity-scale-codec", + "sp-io", + "sp-runtime", + "staging-parachain-info", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + +[[package]] +name = "assets-common" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "impl-trait-for-tuples", + "log", + "pallet-asset-conversion", + "pallet-assets", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-runtime", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + +[[package]] +name = "async-trait" +version = "0.1.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "auto_impl" @@ -284,14 +822,50 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.85", ] [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line 0.24.2", + "cfg-if", + "libc", + "miniz_oxide", + "object 0.36.5", + "rustc-demangle", + "windows-targets 0.52.6", +] + +[[package]] +name = "bandersnatch_vrfs" +version = "0.0.4" +source = "git+https://github.com/w3f/ring-vrf?rev=0fef826#0fef8266d851932ad25d6b41bc4b34d834d1e11d" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ed-on-bls12-381-bandersnatch", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "dleq_vrf", + "rand_chacha", + "rand_core", + "ring 0.1.0", + "sha2 0.10.8", + "sp-ark-bls12-381", + "sp-ark-ed-on-bls12-381-bandersnatch", + "zeroize", +] [[package]] name = "base16ct" @@ -299,12 +873,82 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "binary-merkle-tree" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bip32" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa13fae8b6255872fd86f7faf4b41168661d7d78609f7bfe6771b85c6739a15b" +dependencies = [ + "bs58", + "hmac 0.12.1", + "k256", + "rand_core", + "ripemd", + "sha2 0.10.8", + "subtle", + "zeroize", +] + +[[package]] +name = "bip39" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33415e24172c1b7d6066f6d999545375ab8e1d95421d6784bdfff9496f292387" +dependencies = [ + "bitcoin_hashes", + "serde", + "unicode-normalization", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -320,6 +964,22 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bitcoin-internals" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" + +[[package]] +name = "bitcoin_hashes" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals", + "hex-conservative", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -328,9 +988,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitvec" @@ -340,6 +1000,7 @@ checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", "radium", + "serde", "tap", "wyz", ] @@ -353,6 +1014,26 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "blake2b_simd" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -362,6 +1043,299 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bounded-collections" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db436177db0d505b1507f03aca56a41442ae6efdf8b6eaa855d73e52c5b078dc" +dependencies = [ + "log", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "bp-header-chain" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-runtime", + "finality-grandpa", + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-consensus-grandpa", + "sp-core", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "bp-messages" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-header-chain", + "bp-runtime", + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "bp-parachains" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-header-chain", + "bp-polkadot-core", + "bp-runtime", + "frame-support", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "bp-polkadot" +version = "0.5.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-header-chain", + "bp-polkadot-core", + "bp-runtime", + "frame-support", + "sp-api", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "bp-polkadot-core" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-messages", + "bp-runtime", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "bp-relayers" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-header-chain", + "bp-messages", + "bp-parachains", + "bp-runtime", + "frame-support", + "frame-system", + "pallet-utility", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "bp-runtime" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "hash-db", + "impl-trait-for-tuples", + "log", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-trie", + "trie-db", +] + +[[package]] +name = "bp-test-utils" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-header-chain", + "bp-parachains", + "bp-polkadot-core", + "bp-runtime", + "ed25519-dalek", + "finality-grandpa", + "parity-scale-codec", + "sp-application-crypto", + "sp-consensus-grandpa", + "sp-core", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-trie", +] + +[[package]] +name = "bp-xcm-bridge-hub" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-messages", + "bp-runtime", + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", +] + +[[package]] +name = "bp-xcm-bridge-hub-router" +version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", + "staging-xcm", +] + +[[package]] +name = "bridge-hub-common" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "pallet-message-queue", + "parity-scale-codec", + "scale-info", + "snowbridge-core", + "sp-core", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", +] + +[[package]] +name = "bridge-hub-test-utils" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "asset-test-utils", + "bp-header-chain", + "bp-messages", + "bp-parachains", + "bp-polkadot-core", + "bp-relayers", + "bp-runtime", + "bp-test-utils", + "bp-xcm-bridge-hub", + "bridge-runtime-common", + "cumulus-pallet-parachain-system", + "cumulus-pallet-xcmp-queue", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "pallet-balances", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-bridge-parachains", + "pallet-bridge-relayers", + "pallet-timestamp", + "pallet-utility", + "pallet-xcm", + "pallet-xcm-bridge-hub", + "parachains-common", + "parachains-runtimes-test-utils", + "parity-scale-codec", + "sp-core", + "sp-io", + "sp-keyring", + "sp-runtime", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", +] + +[[package]] +name = "bridge-runtime-common" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-header-chain", + "bp-messages", + "bp-parachains", + "bp-polkadot-core", + "bp-relayers", + "bp-runtime", + "bp-xcm-bridge-hub", + "frame-support", + "frame-system", + "log", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-bridge-parachains", + "pallet-bridge-relayers", + "pallet-transaction-payment", + "pallet-utility", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-trie", + "sp-weights", + "staging-xcm", + "tuplex", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "sha2 0.10.8", + "tinyvec", +] + +[[package]] +name = "build-helper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdce191bf3fa4995ce948c8c83b4640a1745457a149e73c6db75b4ffe36aad5f" +dependencies = [ + "semver 0.6.0", +] + [[package]] name = "bumpalo" version = "3.16.0" @@ -374,6 +1348,12 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" +[[package]] +name = "bytemuck" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" + [[package]] name = "byteorder" version = "1.5.0" @@ -382,9 +1362,44 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +dependencies = [ + "serde", +] + +[[package]] +name = "camino" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.23", + "serde", + "serde_json", + "thiserror", +] [[package]] name = "cast" @@ -394,9 +1409,29 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.98" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", +] [[package]] name = "cfg-if" @@ -432,21 +1467,20 @@ dependencies = [ ] [[package]] -name = "clap" -version = "2.34.0" +name = "cipher" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "bitflags 1.3.2", - "textwrap", - "unicode-width", + "crypto-common", + "inout", ] [[package]] name = "clap" -version = "4.5.4" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -454,39 +1488,49 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.1", ] [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.85", ] [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colored" @@ -499,10 +1543,55 @@ dependencies = [ ] [[package]] -name = "const-hex" -version = "1.12.0" +name = "combine" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "common" +version = "0.1.0" +source = "git+https://github.com/w3f/ring-proof?rev=665f5f5#665f5f51af5734c7b6d90b985dd6861d4c5b4752" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "fflonk", + "getrandom_or_panic", + "merlin", + "rand_chacha", +] + +[[package]] +name = "common-path" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" + +[[package]] +name = "console" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.52.0", +] + +[[package]] +name = "const-hex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0121754e84117e65f9d90648ee6aa4882a6e63110307ab73967a4c5e7e69e586" dependencies = [ "cfg-if", "cpufeatures", @@ -517,6 +1606,38 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "const-random" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom", + "once_cell", + "tiny-keccak", +] + +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + +[[package]] +name = "constcat" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" + [[package]] name = "convert_case" version = "0.4.0" @@ -524,14 +1645,146 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] -name = "cpufeatures" -version = "0.2.12" +name = "core-foundation" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] +[[package]] +name = "cranelift-bforest" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1277fbfa94bc82c8ec4af2ded3e639d49ca5f7f3c7eeab2c66accd135ece4e70" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6e8c31ad3b2270e9aeec38723888fe1b0ace3bea2b06b3f749ccf46661d3220" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-entity", + "cranelift-isle", + "gimli 0.27.3", + "hashbrown 0.13.2", + "log", + "regalloc2 0.6.1", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ac5ac30d62b2d66f12651f6b606dbdfd9c2cfd0908de6b387560a277c5c9da" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd82b8b376247834b59ed9bdc0ddeb50f517452827d4a11bccf5937b213748b8" + +[[package]] +name = "cranelift-entity" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40099d38061b37e505e63f89bab52199037a72b931ad4868d9089ff7268660b0" +dependencies = [ + "serde", +] + +[[package]] +name = "cranelift-frontend" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a25d9d0a0ae3079c463c34115ec59507b4707175454f0eee0891e83e30e82d" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80de6a7d0486e4acbd5f9f87ec49912bf4c8fb6aea00087b989685460d4469ba" + +[[package]] +name = "cranelift-native" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb6b03e0e03801c4b3fd8ce0758a94750c07a44e7944cc0ffbf0d3f2e7c79b00" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff3220489a3d928ad91e59dd7aeaa8b3de18afb554a6211213673a71c90737ac" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools 0.10.5", + "log", + "smallvec", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "criterion" version = "0.5.1" @@ -541,7 +1794,7 @@ dependencies = [ "anes", "cast", "ciborium", - "clap 4.5.4", + "clap", "criterion-plot", "is-terminal", "itertools 0.10.5", @@ -618,9 +1871,440 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core", "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "cumulus-pallet-aura-ext" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-pallet-parachain-system", + "frame-support", + "frame-system", + "pallet-aura", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-consensus-aura", + "sp-runtime", +] + +[[package]] +name = "cumulus-pallet-dmp-queue" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-primitives-core", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "staging-xcm", +] + +[[package]] +name = "cumulus-pallet-parachain-system" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bytes", + "cumulus-pallet-parachain-system-proc-macro", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-primitives-proof-size-hostfunction", + "environmental", + "frame-benchmarking", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "pallet-message-queue", + "parity-scale-codec", + "polkadot-parachain-primitives", + "polkadot-runtime-common", + "polkadot-runtime-parachains", + "scale-info", + "sp-core", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-trie", + "sp-version", + "staging-xcm", + "staging-xcm-builder", + "trie-db", +] + +[[package]] +name = "cumulus-pallet-parachain-system-proc-macro" +version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "cumulus-pallet-session-benchmarking" +version = "9.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-session", + "parity-scale-codec", + "sp-runtime", +] + +[[package]] +name = "cumulus-pallet-solo-to-para" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-pallet-parachain-system", + "frame-support", + "frame-system", + "pallet-sudo", + "parity-scale-codec", + "polkadot-primitives", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "cumulus-pallet-xcm" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "staging-xcm", +] + +[[package]] +name = "cumulus-pallet-xcmp-queue" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bounded-collections", + "bp-xcm-bridge-hub-router", + "cumulus-primitives-core", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-message-queue", + "parity-scale-codec", + "polkadot-runtime-common", + "polkadot-runtime-parachains", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", +] + +[[package]] +name = "cumulus-ping" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-pallet-xcm", + "cumulus-primitives-core", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "staging-xcm", +] + +[[package]] +name = "cumulus-primitives-aura" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "sp-api", + "sp-consensus-aura", +] + +[[package]] +name = "cumulus-primitives-core" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-primitives", + "scale-info", + "sp-api", + "sp-runtime", + "sp-trie", + "staging-xcm", +] + +[[package]] +name = "cumulus-primitives-parachain-inherent" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "async-trait", + "cumulus-primitives-core", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-inherents", + "sp-trie", +] + +[[package]] +name = "cumulus-primitives-proof-size-hostfunction" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-trie", +] + +[[package]] +name = "cumulus-primitives-storage-weight-reclaim" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-primitives-core", + "cumulus-primitives-proof-size-hostfunction", + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "cumulus-primitives-timestamp" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-primitives-core", + "sp-inherents", + "sp-timestamp", +] + +[[package]] +name = "cumulus-primitives-utility" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "log", + "pallet-asset-conversion", + "parity-scale-codec", + "polkadot-runtime-common", + "sp-runtime", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", +] + +[[package]] +name = "cumulus-test-relay-sproof-builder" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-primitives-core", + "parity-scale-codec", + "polkadot-primitives", + "sp-runtime", + "sp-state-machine", + "sp-trie", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "rustc_version 0.4.1", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "cxx" +version = "1.0.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbdc8cca144dce1c4981b5c9ab748761619979e515c3d53b5df385c677d1d007" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5764c3142ab44fcf857101d12c0ddf09c34499900557c764f5ad0597159d1fc" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn 2.0.85", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d422aff542b4fa28c2ce8e5cc202d42dbf24702345c1fba3087b2d3f8a1b90ff" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1719100f31492cd6adeeab9a0f46cdbc846e615fdb66d7b398aa46ec7fdd06f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core 0.14.4", + "darling_macro 0.14.4", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core 0.20.10", + "darling_macro 0.20.10", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.11.1", + "syn 2.0.85", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core 0.14.4", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core 0.20.10", + "quote", + "syn 2.0.85", +] + [[package]] name = "der" version = "0.7.9" @@ -631,6 +2315,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "derivative" version = "2.2.0" @@ -643,16 +2336,59 @@ dependencies = [ ] [[package]] -name = "derive_more" -version = "0.99.17" +name = "derive-syn-parse" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "derive-where" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.4.0", - "syn 1.0.109", + "rustc_version 0.4.1", + "syn 2.0.85", +] + +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", + "unicode-xid", ] [[package]] @@ -670,17 +2406,114 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", + "block-buffer 0.10.4", "const-oid", "crypto-common", "subtle", ] [[package]] -name = "dunce" -version = "1.0.4" +name = "directories-next" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dleq_vrf" +version = "0.0.2" +source = "git+https://github.com/w3f/ring-vrf?rev=0fef826#0fef8266d851932ad25d6b41bc4b34d834d1e11d" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-scale", + "ark-secret-scalar", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "ark-transcript", + "arrayvec", + "zeroize", +] + +[[package]] +name = "docify" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a2f138ad521dc4a2ced1a4576148a6a610b4c5923933b062a263130a6802ce" +dependencies = [ + "docify_macros", +] + +[[package]] +name = "docify_macros" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a081e51fb188742f5a7a1164ad752121abcb22874b21e2c3b0dd040c515fdad" +dependencies = [ + "common-path", + "derive-syn-parse", + "once_cell", + "proc-macro2", + "quote", + "regex", + "syn 2.0.85", + "termcolor", + "toml 0.8.19", + "walkdir", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "dyn-clonable" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" +dependencies = [ + "dyn-clonable-impl", + "dyn-clone", +] + +[[package]] +name = "dyn-clonable-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "ecdsa" @@ -692,15 +2525,55 @@ dependencies = [ "digest 0.10.7", "elliptic-curve", "rfc6979", + "serdect", "signature", "spki", ] [[package]] -name = "either" -version = "1.12.0" +name = "ed25519" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2 0.10.8", + "subtle", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d9ce6874da5d4415896cd45ffbc4d1cfc0c4f9c079427bd870742c30f2f65a9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "hashbrown 0.14.5", + "hex", + "rand_core", + "sha2 0.10.8", + "zeroize", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elliptic-curve" @@ -717,19 +2590,67 @@ dependencies = [ "pkcs8", "rand_core", "sec1", + "serdect", "subtle", "zeroize", ] +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "enumflags2" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d232db7f5956f3f14313dc2f87985c58bd2c695ce124c8cdd984e08e15ac133d" +dependencies = [ + "enumflags2_derive", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "enumn" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + [[package]] name = "env_logger" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" dependencies = [ + "humantime", + "is-terminal", "log", + "regex", + "termcolor", ] +[[package]] +name = "environmental" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + [[package]] name = "equivalent" version = "1.0.1" @@ -746,6 +2667,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ethabi-decode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d398648d65820a727d6a81e58b962f874473396a047e4c30bafe3240953417" +dependencies = [ + "ethereum-types 0.14.1", + "tiny-keccak", +] + [[package]] name = "ethbloom" version = "0.13.0" @@ -754,8 +2685,21 @@ checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" dependencies = [ "crunchy", "fixed-hash", + "tiny-keccak", +] + +[[package]] +name = "ethbloom" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c321610643004cf908ec0f5f2aa0d8f1f8e14b540562a2887a1111ff1ecbf7b" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-codec 0.7.0", "impl-rlp", - "impl-serde", + "impl-serde 0.5.0", + "scale-info", "tiny-keccak", ] @@ -765,28 +2709,49 @@ version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" dependencies = [ - "ethbloom", + "ethbloom 0.13.0", "fixed-hash", - "impl-rlp", - "impl-serde", - "primitive-types", - "uint", + "primitive-types 0.12.2", + "uint 0.9.5", ] [[package]] -name = "evm-interpreter" -version = "1.0.0-dev" -source = "git+https://github.com/xermicus/evm.git?branch=separate-compilation#596447a3391f42fb4f99def5280c076a15e44d18" +name = "ethereum-types" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ab15ed80916029f878e0267c3a9f92b67df55e79af370bf66199059ae2b4ee3" dependencies = [ - "auto_impl", - "parity-scale-codec", - "primitive-types", - "rlp", + "ethbloom 0.14.1", + "fixed-hash", + "impl-codec 0.7.0", + "impl-rlp", + "impl-serde 0.5.0", + "primitive-types 0.13.1", "scale-info", - "serde", - "sha3", + "uint 0.10.0", ] +[[package]] +name = "expander" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2c470c71d91ecbd179935b24170459e926382eaaa86b590b78814e180d8a8e2" +dependencies = [ + "blake2", + "file-guard", + "fs-err", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + [[package]] name = "fallible-iterator" version = "0.3.0" @@ -795,9 +2760,9 @@ checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "fastrlp" @@ -820,6 +2785,73 @@ dependencies = [ "subtle", ] +[[package]] +name = "fflonk" +version = "0.1.0" +source = "git+https://github.com/w3f/fflonk#1e854f35e9a65d08b11a86291405cdc95baa0a35" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "merlin", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "file-guard" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21ef72acf95ec3d7dbf61275be556299490a245f017cf084bd23b4f68cf9407c" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "file-per-thread-logger" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" +dependencies = [ + "env_logger", + "log", +] + +[[package]] +name = "filetime" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" +dependencies = [ + "cfg-if", + "libc", + "libredox", + "windows-sys 0.59.0", +] + +[[package]] +name = "finality-grandpa" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36530797b9bf31cd4ff126dcfee8170f86b00cfdcea3269d73133cc0415945c3" +dependencies = [ + "either", + "futures", + "futures-timer", + "log", + "num-traits", + "parity-scale-codec", + "parking_lot", + "scale-info", +] + [[package]] name = "fixed-hash" version = "0.8.0" @@ -838,12 +2870,407 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "frame-benchmarking" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-support-procedural", + "frame-system", + "linregress", + "log", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-runtime", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "static_assertions", +] + +[[package]] +name = "frame-benchmarking-pallet-pov" +version = "18.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "frame-election-provider-solution-type" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "frame-election-provider-support" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-election-provider-solution-type", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-npos-elections", + "sp-runtime", +] + +[[package]] +name = "frame-executive" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "aquamarine", + "frame-support", + "frame-system", + "frame-try-runtime", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "frame-metadata" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" +dependencies = [ + "cfg-if", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "frame-metadata" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cf1549fba25a6fcac22785b61698317d958e96cac72a59102ea45b9ae64692" +dependencies = [ + "cfg-if", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "frame-metadata-hash-extension" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "array-bytes", + "const-hex", + "docify", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "frame-support" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "aquamarine", + "array-bytes", + "binary-merkle-tree", + "bitflags 1.3.2", + "docify", + "environmental", + "frame-metadata 16.0.0", + "frame-support-procedural", + "impl-trait-for-tuples", + "k256", + "log", + "macro_magic", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "serde_json", + "smallvec", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-crypto-hashing-proc-macro", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-genesis-builder", + "sp-inherents", + "sp-io", + "sp-metadata-ir", + "sp-runtime", + "sp-staking", + "sp-state-machine", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-trie", + "sp-weights", + "static_assertions", + "tt-call", +] + +[[package]] +name = "frame-support-procedural" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "Inflector", + "cfg-expr", + "derive-syn-parse", + "docify", + "expander", + "frame-support-procedural-tools", + "itertools 0.11.0", + "macro_magic", + "proc-macro-warning", + "proc-macro2", + "quote", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "syn 2.0.85", +] + +[[package]] +name = "frame-support-procedural-tools" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support-procedural-tools-derive", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "frame-support-procedural-tools-derive" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "frame-system" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cfg-if", + "docify", + "frame-support", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-version", + "sp-weights", +] + +[[package]] +name = "frame-system-benchmarking" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "frame-system-rpc-runtime-api" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "parity-scale-codec", + "sp-api", +] + +[[package]] +name = "frame-try-runtime" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "parity-scale-codec", + "sp-api", + "sp-runtime", +] + +[[package]] +name = "fs-err" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41" +dependencies = [ + "autocfg", +] + [[package]] name = "funty" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" +dependencies = [ + "gloo-timers", + "send_wrapper", +] + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -866,16 +3293,103 @@ dependencies = [ "wasi", ] +[[package]] +name = "getrandom_or_panic" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea1015b5a70616b688dc230cfe50c8af89d972cb132d5a622814d29773b10b9" +dependencies = [ + "rand", + "rand_core", +] + +[[package]] +name = "ghash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" +dependencies = [ + "opaque-debug", + "polyval", +] + +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +dependencies = [ + "fallible-iterator 0.2.0", + "indexmap 1.9.3", + "stable_deref_trait", +] + [[package]] name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ - "fallible-iterator", + "fallible-iterator 0.3.0", "stable_deref_trait", ] +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +dependencies = [ + "fallible-iterator 0.3.0", + "stable_deref_trait", +] + +[[package]] +name = "gloo-net" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06f627b1a58ca3d42b45d6104bf1e1a03799df472df00988b6ba21accc10580" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils", + "http", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "gloo-utils" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "group" version = "0.13.0" @@ -887,6 +3401,25 @@ dependencies = [ "subtle", ] +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap 2.6.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "half" version = "2.4.1" @@ -897,6 +3430,27 @@ dependencies = [ "crunchy", ] +[[package]] +name = "hash-db" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e7d7786361d7425ae2fe4f9e407eb0efaa0840f5212d109cc018c40c35c6ab4" + +[[package]] +name = "hash256-std-hasher" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" +dependencies = [ + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.13.2" @@ -911,14 +3465,19 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] [[package]] -name = "heck" -version = "0.3.3" +name = "hashbrown" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" dependencies = [ - "unicode-segmentation", + "foldhash", + "serde", ] [[package]] @@ -939,11 +3498,26 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "hermit-abi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-conservative" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" [[package]] name = "hex-literal" @@ -951,6 +3525,25 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac 0.12.1", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + [[package]] name = "hmac" version = "0.12.1" @@ -960,6 +3553,17 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac 0.8.1", +] + [[package]] name = "home" version = "0.5.9" @@ -969,6 +3573,116 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "log", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + [[package]] name = "iced-x86" version = "1.21.0" @@ -978,6 +3692,22 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "impl-codec" version = "0.6.0" @@ -988,12 +3718,32 @@ dependencies = [ ] [[package]] -name = "impl-rlp" -version = "0.3.0" +name = "impl-codec" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +checksum = "b67aa010c1e3da95bf151bd8b4c059b2ed7e75387cdb969b4f8f2723a43f9941" dependencies = [ - "rlp", + "parity-scale-codec", +] + +[[package]] +name = "impl-num-traits" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "803d15461ab0dcc56706adf266158acbc44ccf719bf7d0af30705f58b90a4b8c" +dependencies = [ + "integer-sqrt", + "num-traits", + "uint 0.10.0", +] + +[[package]] +name = "impl-rlp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54ed8ad1f3877f7e775b8cbf30ed1bd3209a95401817f19a0eb4402d13f8cf90" +dependencies = [ + "rlp 0.6.1", ] [[package]] @@ -1005,6 +3755,15 @@ dependencies = [ "serde", ] +[[package]] +name = "impl-serde" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a143eada6a1ec4aefa5049037a26a6d597bfd64f8c026d07b77133e02b7dd0b" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -1017,19 +3776,56 @@ dependencies = [ ] [[package]] -name = "indexmap" -version = "2.2.6" +name = "include_dir" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd" dependencies = [ - "equivalent", - "hashbrown 0.14.5", + "include_dir_macros", ] [[package]] -name = "inkwell" +name = "include_dir_macros" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.0", + "serde", +] + +[[package]] +name = "indexmap-nostd" version = "0.4.0" -source = "git+https://github.com/TheDan64/inkwell.git?rev=6c0fb56b3554e939f9ca61b465043d6a84fb7b95#6c0fb56b3554e939f9ca61b465043d6a84fb7b95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + +[[package]] +name = "inkwell" +version = "0.5.0" +source = "git+https://github.com/TheDan64/inkwell.git?rev=7b410298b6a93450adaa90b1841d5805a3038f12#7b410298b6a93450adaa90b1841d5805a3038f12" dependencies = [ "either", "inkwell_internals", @@ -1042,30 +3838,59 @@ dependencies = [ [[package]] name = "inkwell_internals" -version = "0.9.0" -source = "git+https://github.com/TheDan64/inkwell.git?rev=6c0fb56b3554e939f9ca61b465043d6a84fb7b95#6c0fb56b3554e939f9ca61b465043d6a84fb7b95" +version = "0.10.0" +source = "git+https://github.com/TheDan64/inkwell.git?rev=7b410298b6a93450adaa90b1841d5805a3038f12#7b410298b6a93450adaa90b1841d5805a3038f12" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.85", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "integer-sqrt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +dependencies = [ + "num-traits", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.48.0", ] [[package]] name = "is-terminal" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" dependencies = [ - "hermit-abi", + "hermit-abi 0.4.0", "libc", "windows-sys 0.52.0", ] [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" @@ -1076,6 +3901,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.12.1" @@ -1092,26 +3926,226 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] -name = "js-sys" -version = "0.3.69" +name = "jni" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] -name = "k256" -version = "0.13.3" +name = "jsonrpsee" +version = "0.24.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +checksum = "c5c71d8c1a731cc4227c2f698d377e7848ca12c8a48866fc5e6951c43a4db843" +dependencies = [ + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-http-client", + "jsonrpsee-proc-macros", + "jsonrpsee-server", + "jsonrpsee-types", + "jsonrpsee-wasm-client", + "jsonrpsee-ws-client", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-client-transport" +version = "0.24.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548125b159ba1314104f5bb5f38519e03a41862786aa3925cf349aae9cdd546e" +dependencies = [ + "base64 0.22.1", + "futures-channel", + "futures-util", + "gloo-net", + "http", + "jsonrpsee-core", + "pin-project", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "soketto", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-util", + "tracing", + "url", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.24.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2882f6f8acb9fdaec7cefc4fd607119a9bd709831df7d7672a1d3b644628280" +dependencies = [ + "async-trait", + "bytes", + "futures-timer", + "futures-util", + "http", + "http-body", + "http-body-util", + "jsonrpsee-types", + "parking_lot", + "pin-project", + "rand", + "rustc-hash 2.0.0", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "wasm-bindgen-futures", +] + +[[package]] +name = "jsonrpsee-http-client" +version = "0.24.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3638bc4617f96675973253b3a45006933bde93c2fd8a6170b33c777cc389e5b" +dependencies = [ + "async-trait", + "base64 0.22.1", + "http-body", + "hyper", + "hyper-rustls", + "hyper-util", + "jsonrpsee-core", + "jsonrpsee-types", + "rustls", + "rustls-platform-verifier", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "tracing", + "url", +] + +[[package]] +name = "jsonrpsee-proc-macros" +version = "0.24.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06c01ae0007548e73412c08e2285ffe5d723195bf268bce67b1b77c3bb2a14d" +dependencies = [ + "heck 0.5.0", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "jsonrpsee-server" +version = "0.24.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82ad8ddc14be1d4290cd68046e7d1d37acd408efed6d3ca08aefcc3ad6da069c" +dependencies = [ + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "jsonrpsee-core", + "jsonrpsee-types", + "pin-project", + "route-recognizer", + "serde", + "serde_json", + "soketto", + "thiserror", + "tokio", + "tokio-stream", + "tokio-util", + "tower", + "tracing", +] + +[[package]] +name = "jsonrpsee-types" +version = "0.24.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a178c60086f24cc35bb82f57c651d0d25d99c4742b4d335de04e97fa1f08a8a1" +dependencies = [ + "http", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "jsonrpsee-wasm-client" +version = "0.24.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a01cd500915d24ab28ca17527e23901ef1be6d659a2322451e1045532516c25" +dependencies = [ + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-types", +] + +[[package]] +name = "jsonrpsee-ws-client" +version = "0.24.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fe322e0896d0955a3ebdd5bf813571c53fea29edd713bc315b76620b327e86d" +dependencies = [ + "http", + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-types", + "url", +] + +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", "once_cell", - "sha2", - "signature", + "serdect", + "sha2 0.10.8", ] [[package]] @@ -1125,42 +4159,135 @@ dependencies = [ [[package]] name = "keccak-asm" -version = "0.1.1" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" dependencies = [ "digest 0.10.7", "sha3-asm", ] [[package]] -name = "lazy_static" -version = "1.4.0" +name = "keccak-hash" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "4b286e6b663fb926e1eeb68528e69cb70ed46c6d65871a21b2215ae8154c6d3c" +dependencies = [ + "primitive-types 0.12.2", + "tiny-keccak", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "libmimalloc-sys" -version = "0.1.38" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7bb23d733dfcc8af652a78b7bf232f0e967710d044732185e561e47c0336b6" +checksum = "23aa6811d3bd4deb8a84dde645f943476d13b248d818edcf8ce0b2f37f036b44" dependencies = [ "cc", "libc", ] +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", + "redox_syscall", +] + +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64 0.13.1", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "link-cplusplus" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d240c6f7e1ba3a28b0249f774e6a9dd0175054b52dfbb61b16eb8505c3785c9" +dependencies = [ + "cc", +] + +[[package]] +name = "linregress" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9eda9dcf4f2a99787827661f312ac3219292549c2ee992bf9a6248ffb066bf7" +dependencies = [ + "nalgebra", +] + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -1169,7 +4296,7 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lld-sys" -version = "0.1.0" +version = "0.1.0-dev.5" dependencies = [ "cc", "libc", @@ -1177,9 +4304,9 @@ dependencies = [ [[package]] name = "llvm-sys" -version = "180.0.0" +version = "181.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "778fa5fa02e32728e718f11eec147e6f134137399ab02fd2c13d32476337affa" +checksum = "d320f9d2723c97d4b78f9190a61ed25cc7cfbe456668c08e6e7dd8e50ceb8500" dependencies = [ "anyhow", "cc", @@ -1190,10 +4317,96 @@ dependencies = [ ] [[package]] -name = "log" -version = "0.4.21" +name = "lock_api" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "macro_magic" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc33f9f0351468d26fbc53d9ce00a096c8522ecb42f19b50f34f2c422f76d21d" +dependencies = [ + "macro_magic_core", + "macro_magic_macros", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "macro_magic_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1687dc887e42f352865a393acae7cf79d98fab6351cde1f58e9e057da89bf150" +dependencies = [ + "const-random", + "derive-syn-parse", + "macro_magic_core_macros", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "macro_magic_core_macros" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b02abfe41815b5bd98dbd4260173db2c116dda171dc0fe7838cb206333b83308" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "macro_magic_macros" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ea28ee64b88876bf45277ed9a5817c1817df061a74f2b988971a12570e5869" +dependencies = [ + "macro_magic_core", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matrixmultiply" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9380b911e3e96d10c1f415da0876389aaf1b56759054eeb0de7df940c456ba1a" +dependencies = [ + "autocfg", + "rawpointer", +] [[package]] name = "md5" @@ -1203,19 +4416,116 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix 0.38.38", +] + +[[package]] +name = "memoffset" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memory-db" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808b50db46293432a45e63bc15ea51e0ab4c0a1647b8eb114e31a3e698dd6fbe" +dependencies = [ + "hash-db", +] + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core", + "zeroize", +] [[package]] name = "mimalloc" -version = "0.1.42" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9186d86b79b52f4a77af65604b51225e8db1d6ee7e3f41aec1e40829c71a176" +checksum = "68914350ae34959d83f732418d51e2427a794055d0b9529f48259ac07af65633" dependencies = [ "libmimalloc-sys", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "wasi", + "windows-sys 0.52.0", +] + +[[package]] +name = "multi-stash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685a9ac4b61f4e728e1d2c6a7844609c16527aeb5e6c865915c08e619c16410f" + +[[package]] +name = "nalgebra" +version = "0.33.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26aecdf64b707efd1310e3544d709c5c0ac61c13756046aaaba41be5c4f66a3b" +dependencies = [ + "approx", + "matrixmultiply", + "num-complex", + "num-rational", + "num-traits", + "simba", + "typenum", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num" version = "0.4.3" @@ -1232,9 +4542,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", @@ -1249,6 +4559,33 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "num-format" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" +dependencies = [ + "arrayvec", + "itoa", +] + [[package]] name = "num-integer" version = "0.1.46" @@ -1290,6 +4627,28 @@ dependencies = [ "libm", ] +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.9", + "libc", +] + +[[package]] +name = "object" +version = "0.30.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" +dependencies = [ + "crc32fast", + "hashbrown 0.13.2", + "indexmap 1.9.3", + "memchr", +] + [[package]] name = "object" version = "0.32.2" @@ -1300,25 +4659,1979 @@ dependencies = [ ] [[package]] -name = "once_cell" -version = "1.19.0" +name = "object" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "oorandom" -version = "11.1.3" +version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] -name = "pallet-contracts-pvm-llapi" +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "pallet-alliance" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-collective", + "pallet-identity", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-asset-conversion" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-asset-conversion-ops" version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-asset-conversion", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-asset-conversion-tx-payment" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-asset-conversion", + "pallet-transaction-payment", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "pallet-asset-rate" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "pallet-asset-tx-payment" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-transaction-payment", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-assets" +version = "29.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "pallet-assets-freezer" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-assets", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "pallet-atomic-swap" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-aura" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-consensus-aura", + "sp-runtime", +] + +[[package]] +name = "pallet-authority-discovery" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "pallet-session", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-authority-discovery", + "sp-runtime", +] + +[[package]] +name = "pallet-authorship" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "pallet-babe" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-consensus-babe", + "sp-core", + "sp-io", + "sp-runtime", + "sp-session", + "sp-staking", +] + +[[package]] +name = "pallet-bags-list" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "aquamarine", + "docify", + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "pallet-balances" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "pallet-beefy" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "parity-scale-codec", + "scale-info", + "serde", + "sp-consensus-beefy", + "sp-runtime", + "sp-session", + "sp-staking", +] + +[[package]] +name = "pallet-beefy-mmr" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "array-bytes", + "binary-merkle-tree", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-beefy", + "pallet-mmr", + "pallet-session", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-consensus-beefy", + "sp-core", + "sp-io", + "sp-runtime", + "sp-state-machine", +] + +[[package]] +name = "pallet-bounties" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-bridge-grandpa" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-header-chain", + "bp-runtime", + "bp-test-utils", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-consensus-grandpa", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "pallet-bridge-messages" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-header-chain", + "bp-messages", + "bp-runtime", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-trie", +] + +[[package]] +name = "pallet-bridge-parachains" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-header-chain", + "bp-parachains", + "bp-polkadot-core", + "bp-runtime", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-bridge-grandpa", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "pallet-bridge-relayers" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-header-chain", + "bp-messages", + "bp-relayers", + "bp-runtime", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-bridge-parachains", + "pallet-transaction-payment", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "pallet-broker" +version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bitvec", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "pallet-child-bounties" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-bounties", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-collator-selection" +version = "9.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-balances", + "pallet-session", + "parity-scale-codec", + "rand", + "scale-info", + "sp-runtime", + "sp-staking", +] + +[[package]] +name = "pallet-collective" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-collective-content" +version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "pallet-contracts" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bitflags 1.3.2", + "environmental", + "frame-benchmarking", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "pallet-balances", + "pallet-contracts-proc-macro", + "pallet-contracts-uapi", + "parity-scale-codec", + "paste", + "rand", + "scale-info", + "serde", + "smallvec", + "sp-api", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-builder", + "wasm-instrument", + "wasmi", +] + +[[package]] +name = "pallet-contracts-mock-network" +version = "3.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "pallet-assets", + "pallet-balances", + "pallet-contracts", + "pallet-contracts-proc-macro", + "pallet-contracts-uapi", + "pallet-insecure-randomness-collective-flip", + "pallet-message-queue", + "pallet-proxy", + "pallet-timestamp", + "pallet-utility", + "pallet-xcm", + "parity-scale-codec", + "polkadot-parachain-primitives", + "polkadot-primitives", + "polkadot-runtime-parachains", + "scale-info", + "sp-api", + "sp-core", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "xcm-simulator", +] + +[[package]] +name = "pallet-contracts-proc-macro" +version = "18.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "pallet-contracts-uapi" +version = "5.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bitflags 1.3.2", + "parity-scale-codec", + "paste", + "scale-info", +] + +[[package]] +name = "pallet-conviction-voting" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "assert_matches", + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-core-fellowship" +version = "12.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-ranked-collective", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-delegated-staking" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-staking", +] + +[[package]] +name = "pallet-democracy" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-dev-mode" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-election-provider-multi-phase" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-election-provider-support-benchmarking", + "parity-scale-codec", + "rand", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-npos-elections", + "sp-runtime", + "strum 0.26.3", +] + +[[package]] +name = "pallet-election-provider-support-benchmarking" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-system", + "parity-scale-codec", + "sp-npos-elections", + "sp-runtime", +] + +[[package]] +name = "pallet-elections-phragmen" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-npos-elections", + "sp-runtime", + "sp-staking", +] + +[[package]] +name = "pallet-fast-unstake" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-staking", +] + +[[package]] +name = "pallet-glutton" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "blake2", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-inherents", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-grandpa" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-consensus-grandpa", + "sp-core", + "sp-io", + "sp-runtime", + "sp-session", + "sp-staking", +] + +[[package]] +name = "pallet-identity" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "enumflags2", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-im-online" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", +] + +[[package]] +name = "pallet-indices" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-keyring", + "sp-runtime", +] + +[[package]] +name = "pallet-insecure-randomness-collective-flip" +version = "16.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "safe-mix", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "pallet-lottery" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "pallet-membership" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-message-queue" +version = "31.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "environmental", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-weights", +] + +[[package]] +name = "pallet-migrations" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cfg-if", + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "pallet-mixnet" +version = "0.4.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-application-crypto", + "sp-arithmetic", + "sp-io", + "sp-mixnet", + "sp-runtime", +] + +[[package]] +name = "pallet-mmr" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-mmr-primitives", + "sp-runtime", +] + +[[package]] +name = "pallet-multisig" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "log", + "parity-scale-codec", + "polkadot-sdk-frame", + "scale-info", +] + +[[package]] +name = "pallet-nft-fractionalization" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-assets", + "pallet-nfts", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "pallet-nfts" +version = "22.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "enumflags2", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-nfts-runtime-api" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "pallet-nfts", + "parity-scale-codec", + "sp-api", +] + +[[package]] +name = "pallet-nis" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "pallet-node-authorization" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-nomination-pools" +version = "25.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "pallet-nomination-pools-benchmarking" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "pallet-bags-list", + "pallet-delegated-staking", + "pallet-nomination-pools", + "pallet-staking", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-staking", +] + +[[package]] +name = "pallet-nomination-pools-runtime-api" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "pallet-nomination-pools", + "parity-scale-codec", + "sp-api", +] + +[[package]] +name = "pallet-offences" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "serde", + "sp-runtime", + "sp-staking", +] + +[[package]] +name = "pallet-offences-benchmarking" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-babe", + "pallet-balances", + "pallet-grandpa", + "pallet-im-online", + "pallet-offences", + "pallet-session", + "pallet-staking", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-staking", +] + +[[package]] +name = "pallet-paged-list" +version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-metadata-ir", + "sp-runtime", +] + +[[package]] +name = "pallet-parameters" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "pallet-preimage" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-proxy" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "polkadot-sdk-frame", + "scale-info", +] + +[[package]] +name = "pallet-ranked-collective" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-recovery" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-referenda" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-arithmetic", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-remark" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-revive" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bitflags 1.3.2", + "derive_more 0.99.18", + "environmental", + "ethereum-types 0.15.1", + "frame-benchmarking", + "frame-support", + "frame-system", + "hex", + "impl-trait-for-tuples", + "jsonrpsee", + "log", + "pallet-balances", + "pallet-revive-fixtures", + "pallet-revive-proc-macro", + "pallet-revive-uapi", + "pallet-transaction-payment", + "parity-scale-codec", + "paste", + "polkavm 0.13.0", + "rlp 0.6.1", + "scale-info", + "serde", + "sp-api", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-weights", + "staging-xcm", + "staging-xcm-builder", + "subxt-signer", +] + +[[package]] +name = "pallet-revive-fixtures" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" dependencies = [ "anyhow", - "inkwell", + "frame-system", + "log", + "parity-wasm", + "polkavm-linker 0.14.0", + "sp-core", + "sp-io", + "sp-runtime", + "tempfile", + "toml 0.8.19", ] +[[package]] +name = "pallet-revive-mock-network" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "pallet-assets", + "pallet-balances", + "pallet-message-queue", + "pallet-proxy", + "pallet-revive", + "pallet-revive-proc-macro", + "pallet-revive-uapi", + "pallet-timestamp", + "pallet-utility", + "pallet-xcm", + "parity-scale-codec", + "polkadot-parachain-primitives", + "polkadot-primitives", + "polkadot-runtime-parachains", + "scale-info", + "sp-api", + "sp-core", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "xcm-simulator", +] + +[[package]] +name = "pallet-revive-proc-macro" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "pallet-revive-uapi" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bitflags 1.3.2", + "parity-scale-codec", + "paste", + "polkavm-derive 0.14.0", + "scale-info", +] + +[[package]] +name = "pallet-root-offences" +version = "25.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "pallet-session", + "pallet-staking", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-staking", +] + +[[package]] +name = "pallet-root-testing" +version = "4.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-safe-mode" +version = "9.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-balances", + "pallet-proxy", + "pallet-utility", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-runtime", +] + +[[package]] +name = "pallet-salary" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-ranked-collective", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-scheduler" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "sp-weights", +] + +[[package]] +name = "pallet-scored-pool" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-session" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-state-machine", + "sp-trie", +] + +[[package]] +name = "pallet-session-benchmarking" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-session", + "pallet-staking", + "parity-scale-codec", + "rand", + "sp-runtime", + "sp-session", +] + +[[package]] +name = "pallet-skip-feeless-payment" +version = "3.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "pallet-society" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "rand_chacha", + "scale-info", + "sp-arithmetic", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-staking" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "parity-scale-codec", + "scale-info", + "serde", + "sp-application-crypto", + "sp-io", + "sp-runtime", + "sp-staking", +] + +[[package]] +name = "pallet-staking-reward-fn" +version = "19.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "log", + "sp-arithmetic", +] + +[[package]] +name = "pallet-staking-runtime-api" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "sp-api", + "sp-staking", +] + +[[package]] +name = "pallet-state-trie-migration" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-statement" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-core", + "sp-io", + "sp-runtime", + "sp-statement-store", +] + +[[package]] +name = "pallet-sudo" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-timestamp" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-timestamp", +] + +[[package]] +name = "pallet-tips" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-transaction-payment" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-transaction-payment-rpc-runtime-api" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "pallet-transaction-payment", + "parity-scale-codec", + "sp-api", + "sp-runtime", + "sp-weights", +] + +[[package]] +name = "pallet-transaction-storage" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "serde", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-transaction-storage-proof", +] + +[[package]] +name = "pallet-treasury" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "pallet-tx-pause" +version = "9.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-balances", + "pallet-proxy", + "pallet-utility", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "pallet-uniques" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "pallet-utility" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", +] + +[[package]] +name = "pallet-verify-signature" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-weights", +] + +[[package]] +name = "pallet-vesting" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "pallet-whitelist" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-runtime", +] + +[[package]] +name = "pallet-xcm" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bounded-collections", + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "tracing", + "xcm-runtime-apis", +] + +[[package]] +name = "pallet-xcm-benchmarks" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io", + "sp-runtime", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", +] + +[[package]] +name = "pallet-xcm-bridge-hub" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-messages", + "bp-runtime", + "bp-xcm-bridge-hub", + "frame-support", + "frame-system", + "log", + "pallet-bridge-messages", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", +] + +[[package]] +name = "pallet-xcm-bridge-hub-router" +version = "0.5.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bp-xcm-bridge-hub-router", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-builder", +] + +[[package]] +name = "parachains-common" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-support", + "frame-system", + "log", + "pallet-asset-tx-payment", + "pallet-assets", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "pallet-message-queue", + "pallet-xcm", + "parity-scale-codec", + "polkadot-primitives", + "scale-info", + "sp-consensus-aura", + "sp-core", + "sp-io", + "sp-runtime", + "staging-parachain-info", + "staging-xcm", + "staging-xcm-executor", + "substrate-wasm-builder", +] + +[[package]] +name = "parachains-runtimes-test-utils" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-pallet-parachain-system", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-test-relay-sproof-builder", + "frame-support", + "frame-system", + "pallet-balances", + "pallet-collator-selection", + "pallet-session", + "pallet-timestamp", + "pallet-xcm", + "parity-scale-codec", + "polkadot-parachain-primitives", + "sp-consensus-aura", + "sp-core", + "sp-io", + "sp-runtime", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-parachain-info", + "staging-xcm", + "staging-xcm-executor", + "substrate-wasm-builder", +] + +[[package]] +name = "parity-bip39" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e69bf016dc406eff7d53a7d3f7cf1c2e72c82b9088aac1118591e36dd2cd3e9" +dependencies = [ + "bitcoin_hashes", + "rand", + "rand_core", + "serde", + "unicode-normalization", +] + +[[package]] +name = "parity-bytes" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b56e3a2420138bdb970f84dfb9c774aea80fa0e7371549eedec0d80c209c67" + [[package]] name = "parity-scale-codec" version = "3.6.12" @@ -1328,6 +6641,7 @@ dependencies = [ "arrayvec", "bitvec", "byte-slice-cast", + "bytes", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -1345,6 +6659,46 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "parity-wasm" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + [[package]] name = "paste" version = "1.0.15" @@ -1358,16 +6712,64 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" [[package]] -name = "pest" -version = "2.7.10" +name = "pbkdf2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", + "password-hash", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pest" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", "thiserror", "ucd-trie", ] +[[package]] +name = "pin-project" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkcs8" version = "0.10.2" @@ -1379,10 +6781,16 @@ dependencies = [ ] [[package]] -name = "plotters" -version = "0.3.6" +name = "pkg-config" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[package]] +name = "plotters" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" dependencies = [ "num-traits", "plotters-backend", @@ -1393,83 +6801,718 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" [[package]] name = "plotters-svg" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" dependencies = [ "plotters-backend", ] +[[package]] +name = "polkadot-ckb-merkle-mountain-range" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b44320e5f7ce2c18227537a3032ae5b2c476a7e8eddba45333e1011fc31b92" +dependencies = [ + "cfg-if", + "itertools 0.10.5", +] + +[[package]] +name = "polkadot-core-primitives" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "polkadot-parachain-primitives" +version = "6.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bounded-collections", + "derive_more 0.99.18", + "parity-scale-codec", + "polkadot-core-primitives", + "scale-info", + "serde", + "sp-core", + "sp-runtime", + "sp-weights", +] + +[[package]] +name = "polkadot-primitives" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bitvec", + "hex-literal", + "log", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-authority-discovery", + "sp-consensus-slots", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "polkadot-runtime-common" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bitvec", + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "libsecp256k1", + "log", + "pallet-asset-rate", + "pallet-authorship", + "pallet-balances", + "pallet-broker", + "pallet-election-provider-multi-phase", + "pallet-fast-unstake", + "pallet-identity", + "pallet-session", + "pallet-staking", + "pallet-staking-reward-fn", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-treasury", + "pallet-vesting", + "parity-scale-codec", + "polkadot-primitives", + "polkadot-runtime-parachains", + "rustc-hex", + "scale-info", + "serde", + "serde_derive", + "slot-range-helper", + "sp-api", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keyring", + "sp-npos-elections", + "sp-runtime", + "sp-session", + "sp-staking", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "static_assertions", +] + +[[package]] +name = "polkadot-runtime-metrics" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bs58", + "frame-benchmarking", + "parity-scale-codec", + "polkadot-primitives", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "polkadot-runtime-parachains" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bitflags 1.3.2", + "bitvec", + "derive_more 0.99.18", + "frame-benchmarking", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "pallet-authority-discovery", + "pallet-authorship", + "pallet-babe", + "pallet-balances", + "pallet-broker", + "pallet-message-queue", + "pallet-mmr", + "pallet-session", + "pallet-staking", + "pallet-timestamp", + "pallet-vesting", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-primitives", + "polkadot-runtime-metrics", + "rand", + "rand_chacha", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-inherents", + "sp-io", + "sp-keystore", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-executor", +] + +[[package]] +name = "polkadot-sdk" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "asset-test-utils", + "assets-common", + "binary-merkle-tree", + "bp-header-chain", + "bp-messages", + "bp-parachains", + "bp-polkadot", + "bp-polkadot-core", + "bp-relayers", + "bp-runtime", + "bp-test-utils", + "bp-xcm-bridge-hub", + "bp-xcm-bridge-hub-router", + "bridge-hub-common", + "bridge-hub-test-utils", + "bridge-runtime-common", + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-parachain-system-proc-macro", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-solo-to-para", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-ping", + "cumulus-primitives-aura", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-primitives-proof-size-hostfunction", + "cumulus-primitives-storage-weight-reclaim", + "cumulus-primitives-timestamp", + "cumulus-primitives-utility", + "cumulus-test-relay-sproof-builder", + "frame-benchmarking", + "frame-benchmarking-pallet-pov", + "frame-election-provider-solution-type", + "frame-election-provider-support", + "frame-executive", + "frame-metadata-hash-extension", + "frame-support", + "frame-support-procedural", + "frame-support-procedural-tools-derive", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "pallet-alliance", + "pallet-asset-conversion", + "pallet-asset-conversion-ops", + "pallet-asset-conversion-tx-payment", + "pallet-asset-rate", + "pallet-asset-tx-payment", + "pallet-assets", + "pallet-assets-freezer", + "pallet-atomic-swap", + "pallet-aura", + "pallet-authority-discovery", + "pallet-authorship", + "pallet-babe", + "pallet-bags-list", + "pallet-balances", + "pallet-beefy", + "pallet-beefy-mmr", + "pallet-bounties", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-bridge-parachains", + "pallet-bridge-relayers", + "pallet-broker", + "pallet-child-bounties", + "pallet-collator-selection", + "pallet-collective", + "pallet-collective-content", + "pallet-contracts", + "pallet-contracts-mock-network", + "pallet-conviction-voting", + "pallet-core-fellowship", + "pallet-delegated-staking", + "pallet-democracy", + "pallet-dev-mode", + "pallet-election-provider-multi-phase", + "pallet-election-provider-support-benchmarking", + "pallet-elections-phragmen", + "pallet-fast-unstake", + "pallet-glutton", + "pallet-grandpa", + "pallet-identity", + "pallet-im-online", + "pallet-indices", + "pallet-insecure-randomness-collective-flip", + "pallet-lottery", + "pallet-membership", + "pallet-message-queue", + "pallet-migrations", + "pallet-mixnet", + "pallet-mmr", + "pallet-multisig", + "pallet-nft-fractionalization", + "pallet-nfts", + "pallet-nfts-runtime-api", + "pallet-nis", + "pallet-node-authorization", + "pallet-nomination-pools", + "pallet-nomination-pools-benchmarking", + "pallet-nomination-pools-runtime-api", + "pallet-offences", + "pallet-offences-benchmarking", + "pallet-paged-list", + "pallet-parameters", + "pallet-preimage", + "pallet-proxy", + "pallet-ranked-collective", + "pallet-recovery", + "pallet-referenda", + "pallet-remark", + "pallet-revive", + "pallet-revive-fixtures", + "pallet-revive-mock-network", + "pallet-root-offences", + "pallet-root-testing", + "pallet-safe-mode", + "pallet-salary", + "pallet-scheduler", + "pallet-scored-pool", + "pallet-session", + "pallet-session-benchmarking", + "pallet-skip-feeless-payment", + "pallet-society", + "pallet-staking", + "pallet-staking-reward-fn", + "pallet-staking-runtime-api", + "pallet-state-trie-migration", + "pallet-statement", + "pallet-sudo", + "pallet-timestamp", + "pallet-tips", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-transaction-storage", + "pallet-treasury", + "pallet-tx-pause", + "pallet-uniques", + "pallet-utility", + "pallet-verify-signature", + "pallet-vesting", + "pallet-whitelist", + "pallet-xcm", + "pallet-xcm-benchmarks", + "pallet-xcm-bridge-hub", + "pallet-xcm-bridge-hub-router", + "parachains-common", + "parachains-runtimes-test-utils", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-primitives", + "polkadot-runtime-common", + "polkadot-runtime-metrics", + "polkadot-runtime-parachains", + "polkadot-sdk-frame", + "sc-executor", + "slot-range-helper", + "snowbridge-beacon-primitives", + "snowbridge-core", + "snowbridge-ethereum", + "snowbridge-outbound-queue-merkle-tree", + "snowbridge-outbound-queue-runtime-api", + "snowbridge-pallet-ethereum-client", + "snowbridge-pallet-ethereum-client-fixtures", + "snowbridge-pallet-inbound-queue", + "snowbridge-pallet-inbound-queue-fixtures", + "snowbridge-pallet-outbound-queue", + "snowbridge-pallet-system", + "snowbridge-router-primitives", + "snowbridge-runtime-common", + "snowbridge-runtime-test-common", + "snowbridge-system-runtime-api", + "sp-api", + "sp-api-proc-macro", + "sp-application-crypto", + "sp-arithmetic", + "sp-authority-discovery", + "sp-block-builder", + "sp-consensus-aura", + "sp-consensus-babe", + "sp-consensus-beefy", + "sp-consensus-grandpa", + "sp-consensus-pow", + "sp-consensus-slots", + "sp-core", + "sp-core-hashing", + "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-crypto-hashing-proc-macro", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-genesis-builder", + "sp-inherents", + "sp-io", + "sp-keyring", + "sp-keystore", + "sp-metadata-ir", + "sp-mixnet", + "sp-mmr-primitives", + "sp-npos-elections", + "sp-offchain", + "sp-runtime", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-session", + "sp-staking", + "sp-state-machine", + "sp-statement-store", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-timestamp", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-transaction-pool", + "sp-transaction-storage-proof", + "sp-trie", + "sp-version", + "sp-version-proc-macro", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-weights", + "staging-parachain-info", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-bip39", + "testnet-parachains-constants", + "xcm-runtime-apis", +] + +[[package]] +name = "polkadot-sdk-frame" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "log", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-arithmetic", + "sp-block-builder", + "sp-consensus-aura", + "sp-consensus-grandpa", + "sp-core", + "sp-genesis-builder", + "sp-inherents", + "sp-io", + "sp-keyring", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-transaction-pool", + "sp-version", +] + [[package]] name = "polkavm" -version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a3693e5efdb2bf74e449cd25fd777a28bd7ed87e41f5d5da75eb31b4de48b94" dependencies = [ "libc", "log", - "polkavm-assembler", - "polkavm-common", - "polkavm-linux-raw", + "polkavm-assembler 0.9.0", + "polkavm-common 0.9.0", + "polkavm-linux-raw 0.9.0", +] + +[[package]] +name = "polkavm" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57e79a14b15ed38cb5b9a1e38d02e933f19e3d180ae5b325fed606c5e5b9177e" +dependencies = [ + "libc", + "log", + "polkavm-assembler 0.13.0", + "polkavm-common 0.13.0", + "polkavm-linux-raw 0.13.0", +] + +[[package]] +name = "polkavm" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99efc141e163ff058ead49853d69c42f37366e9e7824deb1937de4cf40698d46" +dependencies = [ + "libc", + "log", + "polkavm-assembler 0.14.0", + "polkavm-common 0.14.0", + "polkavm-linux-raw 0.14.0", ] [[package]] name = "polkavm-assembler" -version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa96d6d868243acc12de813dd48e756cbadcc8e13964c70d272753266deadc1" +dependencies = [ + "log", +] + +[[package]] +name = "polkavm-assembler" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e8da55465000feb0a61bbf556ed03024db58f3420eca37721fc726b3b2136bf" +dependencies = [ + "log", +] + +[[package]] +name = "polkavm-assembler" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec81bfae884b31b39d6c4ce187398af3c4f626d18ecfe86509a2270e61dab4ea" dependencies = [ "log", ] [[package]] name = "polkavm-common" -version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d9428a5cfcc85c5d7b9fc4b6a18c4b802d0173d768182a51cc7751640f08b92" dependencies = [ "log", ] +[[package]] +name = "polkavm-common" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "084b4339aae7dfdaaa5aa7d634110afd95970e0737b6fb2a0cb10db8b56b753c" +dependencies = [ + "log", + "polkavm-assembler 0.13.0", +] + +[[package]] +name = "polkavm-common" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711952a783e9c5ad407cdacb1ed147f36d37c5d43417c1091d86456d2999417b" +dependencies = [ + "log", + "polkavm-assembler 0.14.0", +] + +[[package]] +name = "polkavm-derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8c4bea6f3e11cd89bb18bcdddac10bd9a24015399bd1c485ad68a985a19606" +dependencies = [ + "polkavm-derive-impl-macro 0.9.0", +] + +[[package]] +name = "polkavm-derive" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4832a0aebf6cefc988bb7b2d74ea8c86c983164672e2fc96300f356a1babfc1" +dependencies = [ + "polkavm-derive-impl-macro 0.14.0", +] + +[[package]] +name = "polkavm-derive-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c4fdfc49717fb9a196e74a5d28e0bc764eb394a2c803eb11133a31ac996c60c" +dependencies = [ + "polkavm-common 0.9.0", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "polkavm-derive-impl" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e339fc7c11310fe5adf711d9342278ac44a75c9784947937cce12bd4f30842f2" +dependencies = [ + "polkavm-common 0.14.0", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "polkavm-derive-impl-macro" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ba81f7b5faac81e528eb6158a6f3c9e0bb1008e0ffa19653bc8dea925ecb429" +dependencies = [ + "polkavm-derive-impl 0.9.0", + "syn 2.0.85", +] + +[[package]] +name = "polkavm-derive-impl-macro" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b569754b15060d03000c09e3bf11509d527f60b75d79b4c30c3625b5071d9702" +dependencies = [ + "polkavm-derive-impl 0.14.0", + "syn 2.0.85", +] + [[package]] name = "polkavm-disassembler" -version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790fd526b261870ae0ca6aff231daa4aca997eeb2b7411662bb5407fc5b67ce4" dependencies = [ - "clap 4.5.4", + "clap", "iced-x86", - "polkavm", - "polkavm-common", - "polkavm-linker", + "polkavm 0.14.0", + "polkavm-common 0.14.0", + "polkavm-linker 0.14.0", ] [[package]] name = "polkavm-linker" -version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c7be503e60cf56c0eb785f90aaba4b583b36bff00e93997d93fef97f9553c39" dependencies = [ - "gimli", + "gimli 0.28.1", "hashbrown 0.14.5", "log", - "object", - "polkavm-common", - "regalloc2", + "object 0.32.2", + "polkavm-common 0.9.0", + "regalloc2 0.9.3", + "rustc-demangle", +] + +[[package]] +name = "polkavm-linker" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0959ac3b0f4fd5caf5c245c637705f19493efe83dba31a83bbba928b93b0116a" +dependencies = [ + "gimli 0.31.1", + "hashbrown 0.14.5", + "log", + "object 0.36.5", + "polkavm-common 0.14.0", + "regalloc2 0.9.3", "rustc-demangle", ] [[package]] name = "polkavm-linux-raw" -version = "0.10.0" -source = "git+https://github.com/koute/polkavm.git?rev=360029e#360029ec34863591e043012e1a76c767aa507657" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26e85d3456948e650dff0cfc85603915847faf893ed1e66b020bb82ef4557120" + +[[package]] +name = "polkavm-linux-raw" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686c4dd9c9c16cc22565b51bdbb269792318d0fd2e6b966b5f6c788534cad0e9" + +[[package]] +name = "polkavm-linux-raw" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3daa7ffd55852ca762aa9888c1a6a74ee0aa163ed91ae100dd09446ffb9b847" + +[[package]] +name = "polyval" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +dependencies = [ + "proc-macro2", + "syn 2.0.85", +] [[package]] name = "primitive-types" @@ -1478,17 +7521,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", - "impl-codec", + "impl-codec 0.6.0", + "impl-serde 0.4.0", + "scale-info", + "uint 0.9.5", +] + +[[package]] +name = "primitive-types" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d15600a7d856470b7d278b3fe0e311fe28c2526348549f8ef2ff7db3299c87f5" +dependencies = [ + "fixed-hash", + "impl-codec 0.7.0", + "impl-num-traits", "impl-rlp", - "impl-serde", - "uint", + "impl-serde 0.5.0", + "scale-info", + "uint 0.10.0", ] [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ "toml_edit", ] @@ -1518,29 +7576,62 @@ dependencies = [ ] [[package]] -name = "proc-macro2" -version = "1.0.84" +name = "proc-macro-error-attr2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "proc-macro-warning" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "proc-macro2" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.5.0", + "bitflags 2.6.0", "lazy_static", "num-traits", "rand", "rand_chacha", "rand_xorshift", - "regex-syntax", + "regex-syntax 0.8.5", "rusty-fork", "tempfile", "unarray", @@ -1548,9 +7639,9 @@ dependencies = [ [[package]] name = "psm" -version = "0.1.21" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +checksum = "aa37f80ca58604976033fae9515a8a2989fc13797d953f7c04fb8fa36a11f205" dependencies = [ "cc", ] @@ -1563,9 +7654,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -1585,6 +7676,7 @@ dependencies = [ "libc", "rand_chacha", "rand_core", + "serde", ] [[package]] @@ -1615,6 +7707,12 @@ dependencies = [ "rand_core", ] +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + [[package]] name = "rayon" version = "1.10.0" @@ -1635,6 +7733,58 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "redox_syscall" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +dependencies = [ + "bitflags 2.6.0", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "ref-cast" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "regalloc2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80535183cae11b149d618fbd3c37e38d7cda589d82d7769e196ca9a9042d7621" +dependencies = [ + "fxhash", + "log", + "slice-group-by", + "smallvec", +] + [[package]] name = "regalloc2" version = "0.9.3" @@ -1643,65 +7793,80 @@ checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" dependencies = [ "hashbrown 0.13.2", "log", - "rustc-hash", + "rustc-hash 1.1.0", "slice-group-by", "smallvec", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.5", ] [[package]] name = "regex-lite" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b661b2f27137bdbc16f00eda72866a92bb28af1753ffbd56744fb6e2e9cd8e" +checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "revive-benchmarks" -version = "0.1.0" +version = "0.1.0-dev.5" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.8.10", "criterion", "hex", - "polkavm", "revive-differential", "revive-integration", + "revive-runner", ] [[package]] name = "revive-builtins" -version = "0.1.0" +version = "0.1.0-dev.5" [[package]] name = "revive-common" -version = "0.1.0" +version = "0.1.0-dev.5" dependencies = [ "anyhow", "serde", @@ -1711,28 +7876,32 @@ dependencies = [ [[package]] name = "revive-differential" -version = "0.1.0" +version = "0.1.0-dev.5" dependencies = [ - "alloy-primitives", - "evm-interpreter", - "primitive-types", + "alloy-genesis", + "alloy-primitives 0.8.10", + "alloy-serde", + "hex", + "serde", + "serde_json", + "tempfile", ] [[package]] name = "revive-integration" -version = "0.1.0" +version = "0.1.0-dev.5" dependencies = [ - "alloy-primitives", - "alloy-sol-types", + "alloy-primitives 0.8.10", + "alloy-sol-types 0.8.10", "env_logger", "hex", "log", - "once_cell", - "polkavm", + "polkavm 0.14.0", "rayon", "revive-common", "revive-differential", "revive-llvm-context", + "revive-runner", "revive-solidity", "serde", "serde_json", @@ -1741,21 +7910,21 @@ dependencies = [ [[package]] name = "revive-linker" -version = "0.1.0" +version = "0.1.0-dev.5" dependencies = [ "anyhow", "inkwell", "libc", "lld-sys", - "polkavm-common", - "polkavm-linker", + "polkavm-common 0.14.0", + "polkavm-linker 0.14.0", "revive-builtins", "tempfile", ] [[package]] name = "revive-llvm-context" -version = "1.4.1" +version = "0.1.0-dev.5" dependencies = [ "anyhow", "hex", @@ -1764,30 +7933,53 @@ dependencies = [ "md5", "num", "once_cell", - "pallet-contracts-pvm-llapi", - "polkavm-common", + "polkavm-common 0.14.0", "polkavm-disassembler", "regex", "revive-builtins", "revive-common", "revive-linker", + "revive-runtime-api", "revive-stdlib", "semver 1.0.23", "serde", - "sha2", + "sha2 0.10.8", "sha3", - "zkevm_opcode_defs", +] + +[[package]] +name = "revive-runner" +version = "0.1.0-dev.5" +dependencies = [ + "alloy-primitives 0.8.10", + "hex", + "parity-scale-codec", + "polkadot-sdk", + "revive-differential", + "revive-solidity", + "scale-info", + "serde", + "serde_json", +] + +[[package]] +name = "revive-runtime-api" +version = "0.1.0-dev.5" +dependencies = [ + "anyhow", + "inkwell", + "revive-common", ] [[package]] name = "revive-solidity" -version = "1.4.0" +version = "0.1.0-dev.5" dependencies = [ "anyhow", + "clap", "colored", "hex", "inkwell", - "libc", "md5", "mimalloc", "num", @@ -1802,14 +7994,13 @@ dependencies = [ "serde", "serde_json", "sha3", - "structopt", "thiserror", "which", ] [[package]] name = "revive-stdlib" -version = "0.1.0" +version = "0.1.0-dev.5" dependencies = [ "inkwell", ] @@ -1820,10 +8011,51 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "hmac", + "hmac 0.12.1", "subtle", ] +[[package]] +name = "ring" +version = "0.1.0" +source = "git+https://github.com/w3f/ring-proof?rev=665f5f5#665f5f51af5734c7b6d90b985dd6861d4c5b4752" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "arrayvec", + "blake2", + "common", + "fflonk", + "merlin", +] + +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "rlp" version = "0.5.2" @@ -1835,10 +8067,42 @@ dependencies = [ ] [[package]] -name = "ruint" -version = "1.12.1" +name = "rlp" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f308135fef9fc398342da5472ce7c484529df23743fb7c734e0f3d472971e62" +checksum = "fa24e92bb2a83198bb76d661a71df9f7076b8c420b8696e4d3d97d50d94479e3" +dependencies = [ + "bytes", + "rustc-hex", +] + +[[package]] +name = "rococo-runtime-constants" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "polkadot-primitives", + "polkadot-runtime-common", + "smallvec", + "sp-core", + "sp-runtime", + "sp-weights", + "staging-xcm", + "staging-xcm-builder", +] + +[[package]] +name = "route-recognizer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" + +[[package]] +name = "ruint" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", @@ -1848,10 +8112,10 @@ dependencies = [ "num-bigint", "num-traits", "parity-scale-codec", - "primitive-types", + "primitive-types 0.12.2", "proptest", "rand", - "rlp", + "rlp 0.5.2", "ruint-macro", "serde", "valuable", @@ -1860,9 +8124,9 @@ dependencies = [ [[package]] name = "ruint-macro" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86854cf50259291520509879a5c294c3c9a4c334e9ff65071c51e42ef1e2343" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" [[package]] name = "rustc-demangle" @@ -1876,12 +8140,27 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc-hex" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + [[package]] name = "rustc_version" version = "0.3.3" @@ -1893,26 +8172,127 @@ dependencies = [ [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver 1.0.23", ] [[package]] name = "rustix" -version = "0.38.34" +version = "0.36.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "305efbd14fde4139eb501df5f136994bb520b033fa9fbdce287507dc23b8c7ed" dependencies = [ - "bitflags 2.5.0", + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.1.4", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustix" +version = "0.38.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" +dependencies = [ + "bitflags 2.6.0", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.14", "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.23.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" +dependencies = [ + "log", + "once_cell", + "ring 0.17.8", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" + +[[package]] +name = "rustls-platform-verifier" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afbb878bdfdf63a336a5e63561b1835e7a8c91524f51621db870169eac84b490" +dependencies = [ + "core-foundation", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-roots", + "winapi", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring 0.17.8", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" + [[package]] name = "rusty-fork" version = "0.3.0" @@ -1931,6 +8311,24 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[package]] +name = "safe-mix" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d3d055a2582e6b00ed7a31c1524040aa391092bf636328350813f3a0605215c" +dependencies = [ + "rustc_version 0.2.3", +] + +[[package]] +name = "safe_arch" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3460605018fdc9612bce72735cba0d27efbcd9904780d44c7e3a9948f96148a" +dependencies = [ + "bytemuck", +] + [[package]] name = "same-file" version = "1.0.6" @@ -1941,30 +8339,252 @@ dependencies = [ ] [[package]] -name = "scale-info" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" +name = "sc-allocator" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" dependencies = [ - "bitvec", - "cfg-if", - "derive_more", - "parity-scale-codec", - "scale-info-derive", + "log", + "sp-core", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "thiserror", ] [[package]] -name = "scale-info-derive" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" +name = "sc-executor" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" dependencies = [ - "proc-macro-crate", + "parity-scale-codec", + "parking_lot", + "sc-executor-common", + "sc-executor-polkavm", + "sc-executor-wasmtime", + "schnellru", + "sp-api", + "sp-core", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-io", + "sp-panic-handler", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-trie", + "sp-version", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "tracing", +] + +[[package]] +name = "sc-executor-common" +version = "0.29.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "polkavm 0.9.3", + "sc-allocator", + "sp-maybe-compressed-blob", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "thiserror", + "wasm-instrument", +] + +[[package]] +name = "sc-executor-polkavm" +version = "0.29.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "log", + "polkavm 0.9.3", + "sc-executor-common", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "sc-executor-wasmtime" +version = "0.29.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "log", + "parking_lot", + "rustix 0.36.17", + "sc-allocator", + "sc-executor-common", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "wasmtime", +] + +[[package]] +name = "scale-bits" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57b1e7f6b65ed1f04e79a85a57d755ad56d76fdf1e9bddcc9ae14f71fcdcf54" +dependencies = [ + "parity-scale-codec", + "scale-info", + "scale-type-resolver", + "serde", +] + +[[package]] +name = "scale-decode" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e98f3262c250d90e700bb802eb704e1f841e03331c2eb815e46516c4edbf5b27" +dependencies = [ + "derive_more 0.99.18", + "parity-scale-codec", + "primitive-types 0.12.2", + "scale-bits", + "scale-decode-derive", + "scale-type-resolver", + "smallvec", +] + +[[package]] +name = "scale-decode-derive" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb22f574168103cdd3133b19281639ca65ad985e24612728f727339dcaf4021" +dependencies = [ + "darling 0.14.4", "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "scale-encode" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "528464e6ae6c8f98e2b79633bf79ef939552e795e316579dab09c61670d56602" +dependencies = [ + "derive_more 0.99.18", + "parity-scale-codec", + "primitive-types 0.12.2", + "scale-bits", + "scale-encode-derive", + "scale-type-resolver", + "smallvec", +] + +[[package]] +name = "scale-encode-derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef2618f123c88da9cd8853b69d766068f1eddc7692146d7dfe9b89e25ce2efd" +dependencies = [ + "darling 0.20.10", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "scale-info" +version = "2.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa7ffc1c0ef49b0452c6e2986abf2b07743320641ffd5fc63d552458e3b779b" +dependencies = [ + "bitvec", + "cfg-if", + "derive_more 1.0.0", + "parity-scale-codec", + "scale-info-derive", + "serde", +] + +[[package]] +name = "scale-info-derive" +version = "2.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46385cc24172cf615450267463f937c10072516359b3ff1cb24228a4a08bf951" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "scale-type-resolver" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0cded6518aa0bd6c1be2b88ac81bf7044992f0f154bfbabd5ad34f43512abcb" +dependencies = [ + "scale-info", + "smallvec", +] + +[[package]] +name = "scale-value" +version = "0.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cd6ab090d823e75cfdb258aad5fe92e13f2af7d04b43a55d607d25fcc38c811" +dependencies = [ + "derive_more 0.99.18", + "either", + "frame-metadata 15.1.0", + "parity-scale-codec", + "scale-bits", + "scale-decode", + "scale-encode", + "scale-info", + "scale-type-resolver", +] + +[[package]] +name = "schannel" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "schnellru" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9a8ef13a93c54d20580de1e5c413e624e53121d42fc7e2c11d10ef7f8b02367" +dependencies = [ + "ahash", + "cfg-if", + "hashbrown 0.13.2", +] + +[[package]] +name = "schnorrkel" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de18f6d8ba0aad7045f5feae07ec29899c1112584a38509a84ad7b04451eaa0" +dependencies = [ + "aead", + "arrayref", + "arrayvec", + "curve25519-dalek", + "getrandom_or_panic", + "merlin", + "rand_core", + "serde_bytes", + "sha2 0.10.8", + "subtle", + "zeroize", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scratch" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" + [[package]] name = "sec1" version = "0.7.3" @@ -1975,17 +8595,87 @@ dependencies = [ "der", "generic-array", "pkcs8", + "serdect", "subtle", "zeroize", ] +[[package]] +name = "secp256k1" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +dependencies = [ + "cc", +] + +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "core-foundation-sys", + "libc", + "num-bigint", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" +dependencies = [ + "semver-parser 0.7.0", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser 0.7.0", +] + [[package]] name = "semver" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" dependencies = [ - "semver-parser", + "semver-parser 0.10.2", ] [[package]] @@ -1997,6 +8687,12 @@ dependencies = [ "serde", ] +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "semver-parser" version = "0.10.2" @@ -2007,36 +8703,70 @@ dependencies = [ ] [[package]] -name = "serde" -version = "1.0.203" +name = "send_wrapper" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + +[[package]] +name = "serde" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] [[package]] -name = "serde_derive" -version = "1.0.203" +name = "serde-big-array" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +checksum = "cd31f59f6fe2b0c055371bb2f16d7f0aa7d8881676c04a55b1596d1a17cd10a4" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_bytes" +version = "0.11.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.214" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.85", ] [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + [[package]] name = "serde_stacker" version = "0.1.11" @@ -2047,6 +8777,16 @@ dependencies = [ "stacker", ] +[[package]] +name = "serdect" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" +dependencies = [ + "base16ct", + "serde", +] + [[package]] name = "sha1" version = "0.10.6" @@ -2058,6 +8798,19 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + [[package]] name = "sha2" version = "0.10.8" @@ -2081,14 +8834,29 @@ dependencies = [ [[package]] name = "sha3-asm" -version = "0.1.1" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" dependencies = [ "cc", "cfg-if", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signature" version = "2.2.0" @@ -2099,18 +8867,1259 @@ dependencies = [ "rand_core", ] +[[package]] +name = "simba" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a386a501cd104797982c15ae17aafe8b9261315b5d07e3ec803f2ea26be0fa" +dependencies = [ + "approx", + "num-complex", + "num-traits", + "paste", + "wide", +] + +[[package]] +name = "simple-mermaid" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "620a1d43d70e142b1d46a929af51d44f383db9c7a2ec122de2cd992ccfcf3c18" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "slice-group-by" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" +[[package]] +name = "slot-range-helper" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "enumn", + "parity-scale-codec", + "paste", + "sp-runtime", +] + [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "snowbridge-amcl" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460a9ed63cdf03c1b9847e8a12a5f5ba19c4efd5869e4a737e05be25d7c427e5" +dependencies = [ + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "snowbridge-beacon-primitives" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "byte-slice-cast", + "frame-support", + "hex", + "parity-scale-codec", + "rlp 0.6.1", + "scale-info", + "serde", + "snowbridge-ethereum", + "snowbridge-milagro-bls", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "ssz_rs", + "ssz_rs_derive", +] + +[[package]] +name = "snowbridge-core" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "ethabi-decode", + "frame-support", + "frame-system", + "hex-literal", + "parity-scale-codec", + "polkadot-parachain-primitives", + "scale-info", + "serde", + "snowbridge-beacon-primitives", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-builder", +] + +[[package]] +name = "snowbridge-ethereum" +version = "0.3.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "ethabi-decode", + "ethbloom 0.14.1", + "ethereum-types 0.15.1", + "hex-literal", + "parity-bytes", + "parity-scale-codec", + "rlp 0.6.1", + "scale-info", + "serde", + "serde-big-array", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "snowbridge-milagro-bls" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "026aa8638f690a53e3f7676024b9e913b1cab0111d1b7b92669d40a188f9d7e6" +dependencies = [ + "hex", + "lazy_static", + "parity-scale-codec", + "rand", + "scale-info", + "snowbridge-amcl", + "zeroize", +] + +[[package]] +name = "snowbridge-outbound-queue-merkle-tree" +version = "0.3.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "snowbridge-outbound-queue-runtime-api" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "parity-scale-codec", + "snowbridge-core", + "snowbridge-outbound-queue-merkle-tree", + "sp-api", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "snowbridge-pallet-ethereum-client" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "serde", + "snowbridge-beacon-primitives", + "snowbridge-core", + "snowbridge-ethereum", + "snowbridge-pallet-ethereum-client-fixtures", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "static_assertions", +] + +[[package]] +name = "snowbridge-pallet-ethereum-client-fixtures" +version = "0.9.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "hex-literal", + "snowbridge-beacon-primitives", + "snowbridge-core", + "sp-core", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "snowbridge-pallet-inbound-queue" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "alloy-primitives 0.4.2", + "alloy-sol-types 0.4.2", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "serde", + "snowbridge-beacon-primitives", + "snowbridge-core", + "snowbridge-pallet-inbound-queue-fixtures", + "snowbridge-router-primitives", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-executor", +] + +[[package]] +name = "snowbridge-pallet-inbound-queue-fixtures" +version = "0.10.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "hex-literal", + "snowbridge-beacon-primitives", + "snowbridge-core", + "sp-core", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "snowbridge-pallet-outbound-queue" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bridge-hub-common", + "ethabi-decode", + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "snowbridge-core", + "snowbridge-outbound-queue-merkle-tree", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "snowbridge-pallet-system" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "snowbridge-core", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-executor", +] + +[[package]] +name = "snowbridge-router-primitives" +version = "0.9.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "hex-literal", + "log", + "parity-scale-codec", + "scale-info", + "snowbridge-core", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-executor", +] + +[[package]] +name = "snowbridge-runtime-common" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "log", + "parity-scale-codec", + "snowbridge-core", + "sp-arithmetic", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", +] + +[[package]] +name = "snowbridge-runtime-test-common" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-pallet-parachain-system", + "frame-support", + "frame-system", + "pallet-balances", + "pallet-collator-selection", + "pallet-message-queue", + "pallet-session", + "pallet-timestamp", + "pallet-utility", + "pallet-xcm", + "parachains-runtimes-test-utils", + "parity-scale-codec", + "snowbridge-core", + "snowbridge-pallet-ethereum-client", + "snowbridge-pallet-ethereum-client-fixtures", + "snowbridge-pallet-outbound-queue", + "snowbridge-pallet-system", + "sp-core", + "sp-io", + "sp-keyring", + "sp-runtime", + "staging-parachain-info", + "staging-xcm", + "staging-xcm-executor", +] + +[[package]] +name = "snowbridge-system-runtime-api" +version = "0.2.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "snowbridge-core", + "sp-api", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", +] + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "soketto" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37468c595637c10857701c990f93a40ce0e357cedb0953d1c26c8d8027f9bb53" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures", + "http", + "httparse", + "log", + "rand", + "sha1", +] + +[[package]] +name = "sp-api" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "hash-db", + "log", + "parity-scale-codec", + "scale-info", + "sp-api-proc-macro", + "sp-core", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-metadata-ir", + "sp-runtime", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-state-machine", + "sp-trie", + "sp-version", + "thiserror", +] + +[[package]] +name = "sp-api-proc-macro" +version = "15.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "Inflector", + "blake2", + "expander", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "sp-application-crypto" +version = "30.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", +] + +[[package]] +name = "sp-arithmetic" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "docify", + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "static_assertions", +] + +[[package]] +name = "sp-ark-bls12-381" +version = "0.4.2" +source = "git+https://github.com/paritytech/arkworks-substrate#caa2eed74beb885dd07c7db5f916f2281dad818f" +dependencies = [ + "ark-bls12-381-ext", + "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk)", +] + +[[package]] +name = "sp-ark-ed-on-bls12-381-bandersnatch" +version = "0.4.2" +source = "git+https://github.com/paritytech/arkworks-substrate#caa2eed74beb885dd07c7db5f916f2281dad818f" +dependencies = [ + "ark-ed-on-bls12-381-bandersnatch-ext", + "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk)", +] + +[[package]] +name = "sp-authority-discovery" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-application-crypto", + "sp-runtime", +] + +[[package]] +name = "sp-block-builder" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "sp-api", + "sp-inherents", + "sp-runtime", +] + +[[package]] +name = "sp-consensus-aura" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "async-trait", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-application-crypto", + "sp-consensus-slots", + "sp-inherents", + "sp-runtime", + "sp-timestamp", +] + +[[package]] +name = "sp-consensus-babe" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "async-trait", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-consensus-slots", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-timestamp", +] + +[[package]] +name = "sp-consensus-beefy" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-io", + "sp-keystore", + "sp-mmr-primitives", + "sp-runtime", + "sp-weights", + "strum 0.26.3", +] + +[[package]] +name = "sp-consensus-grandpa" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "finality-grandpa", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-keystore", + "sp-runtime", +] + +[[package]] +name = "sp-consensus-pow" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "sp-api", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "sp-consensus-slots" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-timestamp", +] + +[[package]] +name = "sp-core" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "array-bytes", + "bandersnatch_vrfs", + "bitflags 1.3.2", + "blake2", + "bounded-collections", + "bs58", + "dyn-clonable", + "ed25519-zebra", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde 0.5.0", + "itertools 0.11.0", + "k256", + "libsecp256k1", + "log", + "merlin", + "parity-bip39", + "parity-scale-codec", + "parking_lot", + "paste", + "primitive-types 0.13.1", + "rand", + "scale-info", + "schnorrkel", + "secp256k1", + "secrecy", + "serde", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "ss58-registry", + "substrate-bip39", + "thiserror", + "tracing", + "w3f-bls", + "zeroize", +] + +[[package]] +name = "sp-core-hashing" +version = "15.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "sp-crypto-ec-utils" +version = "0.10.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "ark-bls12-377", + "ark-bls12-377-ext", + "ark-bls12-381", + "ark-bls12-381-ext", + "ark-bw6-761", + "ark-bw6-761-ext", + "ark-ec", + "ark-ed-on-bls12-377", + "ark-ed-on-bls12-377-ext", + "ark-ed-on-bls12-381-bandersnatch", + "ark-ed-on-bls12-381-bandersnatch-ext", + "ark-scale", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "sp-crypto-ec-utils" +version = "0.10.0" +source = "git+https://github.com/paritytech/polkadot-sdk#db40a66db71e8e7fe943dda5cd0e28078efa2a19" +dependencies = [ + "ark-bls12-377", + "ark-bls12-377-ext", + "ark-bls12-381", + "ark-bls12-381-ext", + "ark-bw6-761", + "ark-bw6-761-ext", + "ark-ec", + "ark-ed-on-bls12-377", + "ark-ed-on-bls12-377-ext", + "ark-ed-on-bls12-381-bandersnatch", + "ark-ed-on-bls12-381-bandersnatch-ext", + "ark-scale", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk)", +] + +[[package]] +name = "sp-crypto-hashing" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc9927a7f81334ed5b8a98a4a978c81324d12bd9713ec76b5c68fd410174c5eb" +dependencies = [ + "blake2b_simd", + "byteorder", + "digest 0.10.7", + "sha2 0.10.8", + "sha3", + "twox-hash", +] + +[[package]] +name = "sp-crypto-hashing" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "blake2b_simd", + "byteorder", + "digest 0.10.7", + "sha2 0.10.8", + "sha3", + "twox-hash", +] + +[[package]] +name = "sp-crypto-hashing-proc-macro" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "quote", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "syn 2.0.85", +] + +[[package]] +name = "sp-debug-derive" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "sp-debug-derive" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#db40a66db71e8e7fe943dda5cd0e28078efa2a19" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "sp-externalities" +version = "0.25.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "sp-externalities" +version = "0.25.0" +source = "git+https://github.com/paritytech/polkadot-sdk#db40a66db71e8e7fe943dda5cd0e28078efa2a19" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk)", +] + +[[package]] +name = "sp-genesis-builder" +version = "0.8.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde_json", + "sp-api", + "sp-runtime", +] + +[[package]] +name = "sp-inherents" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "async-trait", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "sp-io" +version = "30.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bytes", + "docify", + "ed25519-dalek", + "libsecp256k1", + "log", + "parity-scale-codec", + "polkavm-derive 0.9.1", + "rustversion", + "secp256k1", + "sp-core", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-keystore", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-state-machine", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-trie", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-keyring" +version = "31.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "sp-core", + "sp-runtime", + "strum 0.26.3", +] + +[[package]] +name = "sp-keystore" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "parking_lot", + "sp-core", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "sp-maybe-compressed-blob" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "thiserror", + "zstd 0.12.4", +] + +[[package]] +name = "sp-metadata-ir" +version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-metadata 16.0.0", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "sp-mixnet" +version = "0.4.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-application-crypto", +] + +[[package]] +name = "sp-mmr-primitives" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "log", + "parity-scale-codec", + "polkadot-ckb-merkle-mountain-range", + "scale-info", + "serde", + "sp-api", + "sp-core", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "sp-npos-elections" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-arithmetic", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "sp-offchain" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "sp-api", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "sp-panic-handler" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "backtrace", + "regex", +] + +[[package]] +name = "sp-runtime" +version = "31.0.1" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "binary-merkle-tree", + "docify", + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "num-traits", + "parity-scale-codec", + "paste", + "rand", + "scale-info", + "serde", + "simple-mermaid", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-trie", + "sp-weights", + "tracing", + "tuplex", +] + +[[package]] +name = "sp-runtime-interface" +version = "24.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "polkavm-derive 0.9.1", + "primitive-types 0.13.1", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface" +version = "24.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#db40a66db71e8e7fe943dda5cd0e28078efa2a19" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "polkavm-derive 0.9.1", + "primitive-types 0.13.1", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "17.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "Inflector", + "expander", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "17.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#db40a66db71e8e7fe943dda5cd0e28078efa2a19" +dependencies = [ + "Inflector", + "expander", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "sp-session" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-core", + "sp-keystore", + "sp-runtime", + "sp-staking", +] + +[[package]] +name = "sp-staking" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "sp-state-machine" +version = "0.35.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "parking_lot", + "rand", + "smallvec", + "sp-core", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-panic-handler", + "sp-trie", + "thiserror", + "tracing", + "trie-db", +] + +[[package]] +name = "sp-statement-store" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "aes-gcm", + "curve25519-dalek", + "ed25519-dalek", + "hkdf", + "parity-scale-codec", + "rand", + "scale-info", + "sha2 0.10.8", + "sp-api", + "sp-application-crypto", + "sp-core", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-runtime", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "thiserror", + "x25519-dalek", +] + +[[package]] +name = "sp-std" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" + +[[package]] +name = "sp-std" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#db40a66db71e8e7fe943dda5cd0e28078efa2a19" + +[[package]] +name = "sp-storage" +version = "19.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "impl-serde 0.5.0", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "sp-storage" +version = "19.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#db40a66db71e8e7fe943dda5cd0e28078efa2a19" +dependencies = [ + "impl-serde 0.5.0", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk)", +] + +[[package]] +name = "sp-timestamp" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "async-trait", + "parity-scale-codec", + "sp-inherents", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "sp-tracing" +version = "16.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-tracing" +version = "16.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#db40a66db71e8e7fe943dda5cd0e28078efa2a19" +dependencies = [ + "parity-scale-codec", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-transaction-pool" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "sp-api", + "sp-runtime", +] + +[[package]] +name = "sp-transaction-storage-proof" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "async-trait", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-inherents", + "sp-runtime", + "sp-trie", +] + +[[package]] +name = "sp-trie" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "ahash", + "hash-db", + "memory-db", + "nohash-hasher", + "parity-scale-codec", + "parking_lot", + "rand", + "scale-info", + "schnellru", + "sp-core", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "thiserror", + "tracing", + "trie-db", + "trie-root", +] + +[[package]] +name = "sp-version" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "impl-serde 0.5.0", + "parity-scale-codec", + "parity-wasm", + "scale-info", + "serde", + "sp-crypto-hashing-proc-macro", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "sp-version-proc-macro", + "thiserror", +] + +[[package]] +name = "sp-version-proc-macro" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "parity-scale-codec", + "proc-macro-warning", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "sp-wasm-interface" +version = "20.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "anyhow", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "wasmtime", +] + +[[package]] +name = "sp-wasm-interface" +version = "20.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#db40a66db71e8e7fe943dda5cd0e28078efa2a19" +dependencies = [ + "anyhow", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", +] + +[[package]] +name = "sp-weights" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "bounded-collections", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "spki" version = "0.7.3" @@ -2121,6 +10130,44 @@ dependencies = [ "der", ] +[[package]] +name = "ss58-registry" +version = "1.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19409f13998e55816d1c728395af0b52ec066206341d939e22e7766df9b494b8" +dependencies = [ + "Inflector", + "num-format", + "proc-macro2", + "quote", + "serde", + "serde_json", + "unicode-xid", +] + +[[package]] +name = "ssz_rs" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "057291e5631f280978fa9c8009390663ca4613359fc1318e36a8c24c392f6d1f" +dependencies = [ + "bitvec", + "num-bigint", + "sha2 0.9.9", + "ssz_rs_derive", +] + +[[package]] +name = "ssz_rs_derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f07d54c4d01a1713eb363b55ba51595da15f6f1211435b71466460da022aa140" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -2129,15 +10176,89 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "stacker" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" +checksum = "799c883d55abdb5e98af1a7b3f23b9b6de8ecada0ecac058672d7635eb48ca7b" dependencies = [ "cc", "cfg-if", "libc", "psm", - "winapi", + "windows-sys 0.59.0", +] + +[[package]] +name = "staging-parachain-info" +version = "0.7.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-runtime", +] + +[[package]] +name = "staging-xcm" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "array-bytes", + "bounded-collections", + "derivative", + "environmental", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-runtime", + "sp-weights", + "xcm-procedural", +] + +[[package]] +name = "staging-xcm-builder" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "pallet-asset-conversion", + "pallet-transaction-payment", + "parity-scale-codec", + "polkadot-parachain-primitives", + "scale-info", + "sp-arithmetic", + "sp-io", + "sp-runtime", + "sp-weights", + "staging-xcm", + "staging-xcm-executor", +] + +[[package]] +name = "staging-xcm-executor" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "environmental", + "frame-benchmarking", + "frame-support", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-weights", + "staging-xcm", + "tracing", ] [[package]] @@ -2146,6 +10267,23 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "string-interner" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c6a0d765f5807e98a091107bae0a56ea3799f66a5de47b2c84c94a39c09974e" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strsim" version = "0.11.1" @@ -2153,34 +10291,148 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "structopt" -version = "0.3.26" +name = "strum" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" dependencies = [ - "clap 2.34.0", - "lazy_static", - "structopt-derive", + "strum_macros 0.26.4", ] [[package]] -name = "structopt-derive" -version = "0.4.18" +name = "strum_macros" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "heck 0.3.3", - "proc-macro-error", + "heck 0.4.1", "proc-macro2", "quote", + "rustversion", "syn 1.0.109", ] [[package]] -name = "subtle" -version = "2.5.0" +name = "strum_macros" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.85", +] + +[[package]] +name = "substrate-bip39" +version = "0.4.7" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "hmac 0.12.1", + "pbkdf2", + "schnorrkel", + "sha2 0.10.8", + "zeroize", +] + +[[package]] +name = "substrate-wasm-builder" +version = "17.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "build-helper", + "cargo_metadata", + "console", + "filetime", + "jobserver", + "parity-wasm", + "polkavm-linker 0.9.2", + "shlex", + "sp-maybe-compressed-blob", + "strum 0.26.3", + "tempfile", + "toml 0.8.19", + "walkdir", + "wasm-opt", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "subxt-core" +version = "0.37.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3af3b36405538a36b424d229dc908d1396ceb0994c90825ce928709eac1a159a" +dependencies = [ + "base58", + "blake2", + "derive-where", + "frame-metadata 16.0.0", + "hashbrown 0.14.5", + "hex", + "impl-serde 0.4.0", + "parity-scale-codec", + "primitive-types 0.12.2", + "scale-bits", + "scale-decode", + "scale-encode", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-crypto-hashing 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subxt-metadata", + "tracing", +] + +[[package]] +name = "subxt-metadata" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "738be5890fdeff899bbffff4d9c0f244fe2a952fb861301b937e3aa40ebb55da" +dependencies = [ + "frame-metadata 16.0.0", + "hashbrown 0.14.5", + "parity-scale-codec", + "scale-info", + "sp-crypto-hashing 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "subxt-signer" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49888ae6ae90fe01b471193528eea5bd4ed52d8eecd2d13f4a2333b87388850" +dependencies = [ + "bip32", + "bip39", + "cfg-if", + "hex", + "hmac 0.12.1", + "keccak-hash", + "parity-scale-codec", + "pbkdf2", + "regex", + "schnorrkel", + "secp256k1", + "secrecy", + "sha2 0.10.8", + "sp-crypto-hashing 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subxt-core", + "zeroize", +] [[package]] name = "syn" @@ -2195,9 +10447,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.66" +version = "2.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" dependencies = [ "proc-macro2", "quote", @@ -2206,14 +10458,26 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.6.4" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3d0961cd53c23ea94eeec56ba940f636f6394788976e9f16ca5ee0aca7464a" +checksum = "86b837ef12ab88835251726eb12237655e61ec8dc8a280085d1961cdc3dfd047" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.85", +] + +[[package]] +name = "syn-solidity" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16320d4a2021ba1a32470b3759676114a918885e9800e68ad60f2c67969fba62" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.85", ] [[package]] @@ -2223,44 +10487,107 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] -name = "tempfile" -version = "3.10.1" +name = "target-lexicon" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "tempfile" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", - "rustix", - "windows-sys 0.52.0", + "once_cell", + "rustix 0.38.38", + "windows-sys 0.59.0", ] [[package]] -name = "textwrap" -version = "0.11.0" +name = "termcolor" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ - "unicode-width", + "winapi-util", +] + +[[package]] +name = "testnet-parachains-constants" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "polkadot-core-primitives", + "rococo-runtime-constants", + "smallvec", + "sp-runtime", + "staging-xcm", + "westend-runtime-constants", ] [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.85", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", ] [[package]] @@ -2283,22 +10610,268 @@ dependencies = [ ] [[package]] -name = "toml_datetime" -version = "0.6.6" +name = "tinyvec" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", + "tokio-util", +] + +[[package]] +name = "tokio-util" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" -version = "0.21.1" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap", + "indexmap 2.6.0", + "serde", + "serde_spanned", "toml_datetime", "winnow", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "time", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "trie-db" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c992b4f40c234a074d48a757efeabb1a6be88af84c0c23f7ca158950cb0ae7f" +dependencies = [ + "hash-db", + "log", + "rustc-hex", + "smallvec", +] + +[[package]] +name = "trie-root" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ed310ef5ab98f5fa467900ed906cb9232dd5376597e00fd4cba2a449d06c0b" +dependencies = [ + "hash-db", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "tt-call" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" + +[[package]] +name = "tuplex" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "676ac81d5454c4dcf37955d34fa8626ede3490f744b86ca14a7b90168d2a08aa" + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "digest 0.10.7", + "rand", + "static_assertions", +] + [[package]] name = "typenum" version = "1.17.0" @@ -2307,9 +10880,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "uint" @@ -2323,6 +10896,18 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "uint" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "909988d098b2f738727b161a106cfc7cab00c539c2687a8836f8e565976fb53e" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "unarray" version = "0.1.4" @@ -2330,28 +10915,70 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] -name = "unicode-ident" -version = "1.0.12" +name = "unicode-bidi" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] -name = "unicode-segmentation" -version = "1.11.0" +name = "unicode-ident" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] [[package]] name = "unicode-width" -version = "0.1.12" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "valuable" @@ -2361,9 +10988,33 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "w3f-bls" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a48c48447120a85b0bdb897ba9426a7aa15b4229498a2e19103e8c9368dd4b2" +dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-ec", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-serialize-derive", + "arrayref", + "constcat", + "digest 0.10.7", + "rand", + "rand_chacha", + "rand_core", + "sha2 0.10.8", + "sha3", + "thiserror", + "zeroize", +] [[package]] name = "wait-timeout" @@ -2384,6 +11035,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2392,34 +11052,47 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.85", "wasm-bindgen-shared", ] [[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" +name = "wasm-bindgen-futures" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2427,33 +11100,361 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.85", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + +[[package]] +name = "wasm-instrument" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a47ecb37b9734d1085eaa5ae1a81e60801fd8c28d4cabdd8aedb982021918bc" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "wasm-opt" +version = "0.116.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd87a4c135535ffed86123b6fb0f0a5a0bc89e50416c942c5f0662c645f679c" +dependencies = [ + "anyhow", + "libc", + "strum 0.24.1", + "strum_macros 0.24.3", + "tempfile", + "thiserror", + "wasm-opt-cxx-sys", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-cxx-sys" +version = "0.116.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c57b28207aa724318fcec6575fe74803c23f6f266fce10cbc9f3f116762f12e" +dependencies = [ + "anyhow", + "cxx", + "cxx-build", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-sys" +version = "0.116.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a1cce564dc768dacbdb718fc29df2dba80bd21cb47d8f77ae7e3d95ceb98cbe" +dependencies = [ + "anyhow", + "cc", + "cxx", + "cxx-build", +] + +[[package]] +name = "wasmi" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50386c99b9c32bd2ed71a55b6dd4040af2580530fae8bdb9a6576571a80d0cca" +dependencies = [ + "arrayvec", + "multi-stash", + "num-derive", + "num-traits", + "smallvec", + "spin", + "wasmi_collections", + "wasmi_core", + "wasmparser-nostd", +] + +[[package]] +name = "wasmi_collections" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c128c039340ffd50d4195c3f8ce31aac357f06804cfc494c8b9508d4b30dca4" +dependencies = [ + "ahash", + "hashbrown 0.14.5", + "string-interner", +] + +[[package]] +name = "wasmi_core" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23b3a7f6c8c3ceeec6b83531ee61f0013c56e51cbf2b14b0f213548b23a4b41" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", +] + +[[package]] +name = "wasmparser" +version = "0.102.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" +dependencies = [ + "indexmap 1.9.3", + "url", +] + +[[package]] +name = "wasmparser-nostd" +version = "0.100.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" +dependencies = [ + "indexmap-nostd", +] + +[[package]] +name = "wasmtime" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9" +dependencies = [ + "anyhow", + "bincode", + "cfg-if", + "indexmap 1.9.3", + "libc", + "log", + "object 0.30.4", + "once_cell", + "paste", + "psm", + "rayon", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-cache", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c86437fa68626fe896e5afc69234bb2b5894949083586535f200385adfd71213" +dependencies = [ + "anyhow", + "base64 0.21.7", + "bincode", + "directories-next", + "file-per-thread-logger", + "log", + "rustix 0.36.17", + "serde", + "sha2 0.10.8", + "toml 0.5.11", + "windows-sys 0.45.0", + "zstd 0.11.2+zstd.1.5.2", +] + +[[package]] +name = "wasmtime-cranelift" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1cefde0cce8cb700b1b21b6298a3837dba46521affd7b8c38a9ee2c869eee04" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli 0.27.3", + "log", + "object 0.30.4", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-cranelift-shared", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-cranelift-shared" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd041e382ef5aea1b9fc78442394f1a4f6d676ce457e7076ca4cb3f397882f8b" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-native", + "gimli 0.27.3", + "object 0.30.4", + "target-lexicon", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-environ" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.27.3", + "indexmap 1.9.3", + "log", + "object 0.30.4", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" +dependencies = [ + "addr2line 0.19.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli 0.27.3", + "log", + "object 0.30.4", + "rustc-demangle", + "serde", + "target-lexicon", + "wasmtime-environ", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-runtime", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e0554b84c15a27d76281d06838aed94e13a77d7bf604bbbaf548aa20eb93846" +dependencies = [ + "object 0.30.4", + "once_cell", + "rustix 0.36.17", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd" +dependencies = [ + "cfg-if", + "libc", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-runtime" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap 1.9.3", + "libc", + "log", + "mach", + "memfd", + "memoffset", + "paste", + "rand", + "rustix 0.36.17", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-types" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f6fffd2a1011887d57f07654dd112791e872e3ff4a2e626aee8059ee17f06f" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "westend-runtime-constants" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "polkadot-primitives", + "polkadot-runtime-common", + "smallvec", + "sp-core", + "sp-runtime", + "sp-weights", + "staging-xcm", + "staging-xcm-builder", +] + [[package]] name = "which" version = "5.0.0" @@ -2463,10 +11464,20 @@ dependencies = [ "either", "home", "once_cell", - "rustix", + "rustix 0.38.38", "windows-sys 0.48.0", ] +[[package]] +name = "wide" +version = "0.7.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b828f995bf1e9622031f8009f8481a85406ce1f4d4588ff746d872043e855690" +dependencies = [ + "bytemuck", + "safe_arch", +] + [[package]] name = "winapi" version = "0.3.9" @@ -2485,11 +11496,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2498,6 +11509,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -2513,7 +11533,31 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -2533,20 +11577,26 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "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_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -2555,9 +11605,15 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" @@ -2567,9 +11623,15 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" @@ -2579,15 +11641,21 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" @@ -2597,9 +11665,15 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" @@ -2609,9 +11683,15 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" @@ -2621,9 +11701,15 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" @@ -2633,15 +11719,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.5.40" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -2656,23 +11742,83 @@ dependencies = [ ] [[package]] -name = "zerocopy" -version = "0.7.34" +name = "x25519-dalek" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" dependencies = [ + "curve25519-dalek", + "rand_core", + "serde", + "zeroize", +] + +[[package]] +name = "xcm-procedural" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "xcm-runtime-apis" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-weights", + "staging-xcm", + "staging-xcm-executor", +] + +[[package]] +name = "xcm-simulator" +version = "7.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc#2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "paste", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-primitives", + "polkadot-runtime-parachains", + "scale-info", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc)", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.85", ] [[package]] @@ -2692,19 +11838,53 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.85", ] [[package]] -name = "zkevm_opcode_defs" -version = "1.4.1" -source = "git+https://github.com/matter-labs/era-zkevm_opcode_defs?branch=v1.4.1#ba8228ff0582d21f64d6a319d50d0aec48e9e7b6" +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" dependencies = [ - "bitflags 2.5.0", - "blake2", - "ethereum-types", - "k256", - "lazy_static", - "sha2", - "sha3", + "zstd-safe 5.0.2+zstd.1.5.2", +] + +[[package]] +name = "zstd" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +dependencies = [ + "zstd-safe 6.0.6", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-safe" +version = "6.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.13+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +dependencies = [ + "cc", + "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index 6d1b859..ad786bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,31 @@ resolver = "2" members = ["crates/*"] +[workspace.package] +version = "0.1.0-dev.5" +authors = [ + "Cyrill Leutwiler ", + "Parity Technologies ", +] +license = "MIT/Apache-2.0" +edition = "2021" +repository = "https://github.com/paritytech/revive" +rust-version = "1.80.0" + [workspace.dependencies] +revive-benchmarks = { version = "0.1.0-dev.5", path = "crates/benchmarks" } +revive-builtins = { version = "0.1.0-dev.5", path = "crates/builtins" } +revive-common = { version = "0.1.0-dev.5", path = "crates/common" } +revive-differential = { version = "0.1.0-dev.5", path = "crates/differential" } +revive-integration = { version = "0.1.0-dev.5", path = "crates/integration" } +revive-linker = { version = "0.1.0-dev.5", path = "crates/linker" } +lld-sys = { version = "0.1.0-dev.5", path = "crates/lld-sys" } +revive-llvm-context = { version = "0.1.0-dev.5", path = "crates/llvm-context" } +revive-runtime-api = { version = "0.1.0-dev.5", path = "crates/runtime-api" } +revive-runner = { version = "0.1.0-dev.5", path = "crates/runner" } +revive-solidity = { version = "0.1.0-dev.5", path = "crates/solidity" } +revive-stdlib = { version = "0.1.0-dev.5", path = "crates/stdlib" } + hex = "0.4" petgraph = "0.6" cc = "1.0" @@ -25,30 +49,34 @@ thiserror = "1.0" which = "5.0" path-slash = "0.2" rayon = "1.8" -structopt = { version = "0.3", default-features = false } +clap = { version = "4", default-features = false, features = ["derive"] } rand = "0.8" -polkavm-common = { git = "https://github.com/koute/polkavm.git", rev = "360029e" } -polkavm-linker = { git = "https://github.com/koute/polkavm.git", rev = "360029e" } -polkavm-disassembler = { git = "https://github.com/koute/polkavm.git", rev = "360029e" } -polkavm = { git = "https://github.com/koute/polkavm.git", rev = "360029e" } -alloy-primitives = "0.6" -alloy-sol-types = "0.6" +polkavm-common = "0.14" +polkavm-linker = "0.14" +polkavm-disassembler = "0.14" +polkavm = "0.14" +alloy-primitives = { version = "0.8", features = ["serde"] } +alloy-sol-types = "0.8" +alloy-genesis = "0.3" +alloy-serde = "0.3" env_logger = { version = "0.10.0", default-features = false } serde_stacker = "0.1" criterion = { version = "0.5", features = ["html_reports"] } log = { version = "0.4" } -# Benchmarking against EVM -primitive-types = { version = "0.12", features = ["codec"] } -evm-interpreter = { git = "https://github.com/xermicus/evm.git", branch = "separate-compilation" } +# polkadot-sdk and friends +codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" } +scale-info = { version = "2.11.1", default-features = false } +polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "2b6b69641ccff4d7aa9c32051bbb2f1e775ef8cc" } +# llvm [workspace.dependencies.inkwell] git = "https://github.com/TheDan64/inkwell.git" -rev = "6c0fb56b3554e939f9ca61b465043d6a84fb7b95" +rev = "7b410298b6a93450adaa90b1841d5805a3038f12" default-features = false features = ["serde", "llvm18-0", "no-libffi-linking", "target-riscv"] -[profile.benchmark] +[profile.bench] inherits = "release" lto = true codegen-units = 1 diff --git a/Makefile b/Makefile index 02fae51..0b8f97c 100644 --- a/Makefile +++ b/Makefile @@ -23,11 +23,20 @@ install-wasm: install-npm: npm install && npm fund +# install-revive: Build and install to the directory specified in REVIVE_INSTALL_DIR +ifeq ($(origin REVIVE_INSTALL_DIR), undefined) +REVIVE_INSTALL_DIR=`pwd`/release/revive-debian +endif +install-revive: + cargo install --path crates/solidity --root $(REVIVE_INSTALL_DIR) + format: cargo fmt --all --check +clippy: + cargo clippy --all-features --workspace --tests --benches -- --deny warnings --allow dead_code + test: format clippy test-cli test-workspace - cargo test --workspace test-integration: install-bin cargo test --package revive-integration @@ -41,28 +50,18 @@ test-workspace: install test-cli: install npm run test:cli -bench-prepare: install-bin - cargo criterion --bench prepare --features bench-evm,bench-pvm --message-format=json \ - | criterion-table > crates/benchmarks/PREPARE.md +bench-pvm: install-bin + cargo criterion --bench execute --features bench-pvm-interpreter --message-format=json \ + | criterion-table > crates/benchmarks/PVM.md -bench-execute: install-bin - cargo criterion --bench execute --features bench-evm,bench-pvm --message-format=json \ - | criterion-table > crates/benchmarks/EXECUTE.md - -bench-extensive: install-bin - cargo criterion --all --all-features --message-format=json \ - | criterion-table > crates/benchmarks/BENCHMARKS.md - -bench-quick: install-bin - cargo criterion --all --features bench-evm +bench-evm: install-bin + cargo criterion --bench execute --features bench-evm --message-format=json \ + | criterion-table > crates/benchmarks/EVM.md bench: install-bin - cargo criterion --all --features bench-evm,bench-pvm --message-format=json \ + cargo criterion --all --all-features --message-format=json \ | criterion-table > crates/benchmarks/BENCHMARKS.md -clippy: - cargo clippy --all-features --workspace --tests --benches - docs: docs-build mdbook serve --open docs/ diff --git a/README.md b/README.md index 5955bcb..74ee16f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![CI](https://github.com/xermicus/revive/actions/workflows/rust.yml/badge.svg) +![CI](https://github.com/paritytech/revive/actions/workflows/rust.yml/badge.svg) # revive @@ -50,4 +50,4 @@ Please consult the [Makefile](Makefile) targets to learn how to run tests and be Ensure that your branch passes `make test` locally when submitting a pull request. ## Design overview -`revive` uses [solc](https://github.com/ethereum/solidity/), the Ethereum Solidity compiler, as the [Solidity frontend](crates/solidity/src/lib.rs) to process smart contracts written in Solidity. The YUL IR code (or legacy EVM assembly as a fallback for older `solc` versions) emitted by `solc` is then translated to LLVM IR, targetting a runtime similar to [Polkadots `contracts` pallet](https://docs.rs/pallet-contracts/latest/pallet_contracts/api_doc/trait.Current.html). +`revive` uses [solc](https://github.com/ethereum/solidity/), the Ethereum Solidity compiler, as the [Solidity frontend](crates/solidity/src/lib.rs) to process smart contracts written in Solidity. The YUL IR code (or legacy EVM assembly as a fallback for older `solc` versions) emitted by `solc` is then translated to LLVM IR, targetting [Polkadots `revive` pallet](https://docs.rs/pallet-revive/latest/pallet_revive/trait.SyscallDoc.html). diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..4316fd6 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,11 @@ +# Release checklist + +Prior to the first stable release we neither have formal release processes nor do we follow a fixed release schedule. + +To create a new pre-release: + +1. Merge a release PR which updates the `-dev.X` versions in the workspace `Cargo.toml` and updates the `CHANGELOG.md` accordingly +2. Push a release tag to `main` +3. Manually trigger the `Build revive-debian` action +4. Create a __pre-release__ from the tag and manually upload the build artifact generated by the action +5. Update the [contract-docs](https://github.com/paritytech/contract-docs/) accordingly diff --git a/crates/benchmarks/BENCHMARKS.md b/crates/benchmarks/BENCHMARKS.md index e69de29..568a254 100644 --- a/crates/benchmarks/BENCHMARKS.md +++ b/crates/benchmarks/BENCHMARKS.md @@ -0,0 +1,73 @@ +# Benchmarks + +## Table of Contents + +- [Benchmark Results](#benchmark-results) + - [Baseline](#baseline) + - [OddPorduct](#oddporduct) + - [TriangleNumber](#trianglenumber) + - [FibonacciRecursive](#fibonaccirecursive) + - [FibonacciIterative](#fibonacciiterative) + - [FibonacciBinet](#fibonaccibinet) + - [SHA1](#sha1) + +## Benchmark Results + +### Baseline + +| | `EVM` | `PVMInterpreter` | +|:--------|:------------------------|:-------------------------------- | +| **`0`** | `5.97 us` (✅ **1.00x**) | `27.04 us` (❌ *4.53x slower*) | + +### OddPorduct + +| | `EVM` | `PVMInterpreter` | +|:-------------|:--------------------------|:-------------------------------- | +| **`10000`** | `4.26 ms` (✅ **1.00x**) | `2.88 ms` (✅ **1.48x faster**) | +| **`100000`** | `42.37 ms` (✅ **1.00x**) | `28.35 ms` (✅ **1.49x faster**) | +| **`300000`** | `127.88 ms` (✅ **1.00x**) | `88.43 ms` (✅ **1.45x faster**) | + +### TriangleNumber + +| | `EVM` | `PVMInterpreter` | +|:-------------|:--------------------------|:-------------------------------- | +| **`10000`** | `2.85 ms` (✅ **1.00x**) | `2.37 ms` (✅ **1.20x faster**) | +| **`100000`** | `27.85 ms` (✅ **1.00x**) | `23.01 ms` (✅ **1.21x faster**) | +| **`360000`** | `103.01 ms` (✅ **1.00x**) | `83.66 ms` (✅ **1.23x faster**) | + +### FibonacciRecursive + +| | `EVM` | `PVMInterpreter` | +|:---------|:--------------------------|:--------------------------------- | +| **`12`** | `195.19 us` (✅ **1.00x**) | `333.53 us` (❌ *1.71x slower*) | +| **`16`** | `1.22 ms` (✅ **1.00x**) | `1.97 ms` (❌ *1.62x slower*) | +| **`20`** | `8.14 ms` (✅ **1.00x**) | `13.20 ms` (❌ *1.62x slower*) | +| **`24`** | `55.09 ms` (✅ **1.00x**) | `88.56 ms` (❌ *1.61x slower*) | + +### FibonacciIterative + +| | `EVM` | `PVMInterpreter` | +|:----------|:-------------------------|:--------------------------------- | +| **`64`** | `33.39 us` (✅ **1.00x**) | `86.02 us` (❌ *2.58x slower*) | +| **`128`** | `52.91 us` (✅ **1.00x**) | `126.38 us` (❌ *2.39x slower*) | +| **`256`** | `82.33 us` (✅ **1.00x**) | `208.74 us` (❌ *2.54x slower*) | + +### FibonacciBinet + +| | `EVM` | `PVMInterpreter` | +|:----------|:-------------------------|:--------------------------------- | +| **`64`** | `32.29 us` (✅ **1.00x**) | `161.75 us` (❌ *5.01x slower*) | +| **`128`** | `36.02 us` (✅ **1.00x**) | `172.59 us` (❌ *4.79x slower*) | +| **`256`** | `41.21 us` (✅ **1.00x**) | `185.30 us` (❌ *4.50x slower*) | + +### SHA1 + +| | `EVM` | `PVMInterpreter` | +|:----------|:--------------------------|:--------------------------------- | +| **`1`** | `160.17 us` (✅ **1.00x**) | `403.46 us` (❌ *2.52x slower*) | +| **`64`** | `286.69 us` (✅ **1.00x**) | `479.79 us` (❌ *1.67x slower*) | +| **`512`** | `1.18 ms` (✅ **1.00x**) | `1.37 ms` (❌ *1.16x slower*) | + +--- +Made with [criterion-table](https://github.com/nu11ptr/criterion-table) + diff --git a/crates/benchmarks/Cargo.toml b/crates/benchmarks/Cargo.toml index c04a6d2..f10cf28 100644 --- a/crates/benchmarks/Cargo.toml +++ b/crates/benchmarks/Cargo.toml @@ -1,32 +1,28 @@ [package] name = "revive-benchmarks" -version = "0.1.0" -edition = "2021" -authors = [ - "Cyrill Leutwiler ", -] +version.workspace = true +license.workspace = true +edition.workspace = true +repository.workspace = true +authors.workspace = true +description = "revive compiler benchmarks" [features] default = ["bench-pvm-interpreter"] -bench-pvm-interpreter = [] -bench-pvm = [] +bench-pvm-interpreter = ["revive-runner"] bench-evm = ["revive-differential"] -bench-extensive = [] [dependencies] hex = { workspace = true } -polkavm = { workspace = true } -revive-integration = { path = "../integration" } -revive-differential = { path = "../differential", optional = true } alloy-primitives = { workspace = true } +revive-integration = { workspace = true } +revive-differential = { workspace = true, optional = true } +revive-runner = { workspace = true, optional = true } + [dev-dependencies] criterion = { workspace = true } [[bench]] name = "execute" harness = false - -[[bench]] -name = "prepare" -harness = false diff --git a/crates/benchmarks/benches/execute.rs b/crates/benchmarks/benches/execute.rs index c87b828..5bb0505 100644 --- a/crates/benchmarks/benches/execute.rs +++ b/crates/benchmarks/benches/execute.rs @@ -1,103 +1,42 @@ +#![cfg(any(feature = "bench-pvm-interpreter", feature = "bench-evm"))] + +use alloy_primitives::U256; use criterion::{ - criterion_group, criterion_main, measurement::Measurement, BenchmarkGroup, BenchmarkId, - Criterion, + criterion_group, criterion_main, + measurement::{Measurement, WallTime}, + BenchmarkGroup, BenchmarkId, Criterion, }; use revive_integration::cases::Contract; -fn bench(mut group: BenchmarkGroup<'_, M>, parameters: &[P], labels: &[L], contract: I) -where +fn bench( + mut group: BenchmarkGroup<'_, WallTime>, + parameters: &[P], + labels: &[L], + contract: I, +) where P: Clone, L: std::fmt::Display, I: Fn(P) -> Contract, - M: Measurement, { assert_eq!(parameters.len(), labels.len()); + group.sample_size(10); + for (p, l) in parameters.iter().zip(labels.iter()) { + let contract = contract(p.clone()); + #[cfg(feature = "bench-evm")] - { - let contract = contract(p.clone()); - group.bench_with_input(BenchmarkId::new("EVM", l), p, move |b, _| { - b.iter(|| { - revive_differential::execute(revive_differential::prepare( - contract.evm_runtime.clone(), - contract.calldata.clone(), - )); - }); - }); - } + group.bench_with_input(BenchmarkId::new("EVM", l), p, |b, _| { + let code = &contract.evm_runtime; + let input = &contract.calldata; + b.iter_custom(|iters| revive_benchmarks::measure_evm(code, input, iters)); + }); - #[cfg(not(feature = "bench-extensive"))] - { - #[cfg(all(feature = "bench-pvm-interpreter", not(feature = "bench-extensive")))] - { - let contract = contract(p.clone()); - let (transaction, mut instance, export) = revive_benchmarks::prepare_pvm( - &contract.pvm_runtime, - contract.calldata, - polkavm::BackendKind::Interpreter, - ); - group.bench_with_input(BenchmarkId::new("PVMInterpreter", l), p, |b, _| { - b.iter(|| { - let _ = transaction.clone().call_on(&mut instance, export); - }); - }); - } - - #[cfg(all(feature = "bench-pvm", not(feature = "bench-extensive")))] - { - let contract = contract(p.clone()); - let (transaction, mut instance, export) = revive_benchmarks::prepare_pvm( - &contract.pvm_runtime, - contract.calldata, - polkavm::BackendKind::Compiler, - ); - group.bench_with_input(BenchmarkId::new("PVM", l), p, |b, _| { - b.iter(|| { - let _ = transaction.clone().call_on(&mut instance, export); - }); - }); - } - } - #[cfg(feature = "bench-extensive")] - { - use revive_benchmarks::instantiate_engine; - use revive_integration::mock_runtime::{instantiate_module, recompile_code, State}; - - #[cfg(feature = "bench-pvm-interpreter")] - { - let contract = contract(p.clone()); - let engine = instantiate_engine(polkavm::BackendKind::Interpreter); - let module = recompile_code(&contract.pvm_runtime, &engine); - let transaction = State::default() - .transaction() - .with_default_account(&contract.pvm_runtime) - .calldata(contract.calldata); - group.bench_with_input(BenchmarkId::new("PVMInterpreter", l), p, |b, _| { - b.iter(|| { - let (mut instance, export) = instantiate_module(&module, &engine); - let _ = transaction.clone().call_on(&mut instance, export); - }); - }); - } - - #[cfg(feature = "bench-pvm")] - { - let contract = contract(p.clone()); - let engine = instantiate_engine(polkavm::BackendKind::Compiler); - let module = recompile_code(&contract.pvm_runtime, &engine); - let transaction = State::default() - .transaction() - .with_default_account(&contract.pvm_runtime) - .calldata(contract.calldata); - group.bench_with_input(BenchmarkId::new("PVM", l), p, |b, _| { - b.iter(|| { - let (mut instance, export) = instantiate_module(&module, &engine); - let _ = transaction.clone().call_on(&mut instance, export); - }); - }); - } - } + #[cfg(feature = "bench-pvm-interpreter")] + group.bench_with_input(BenchmarkId::new("PVMInterpreter", l), p, |b, _| { + let specs = revive_benchmarks::create_specs(&contract); + b.iter_custom(|iters| revive_benchmarks::measure_pvm(&specs, iters)); + }); } group.finish(); @@ -107,14 +46,6 @@ fn group<'error, M>(c: &'error mut Criterion, group_name: &str) -> BenchmarkG where M: Measurement, { - #[cfg(feature = "bench-extensive")] - { - let mut group = c.benchmark_group(group_name); - group.sample_size(10); - group - } - - #[cfg(not(feature = "bench-extensive"))] return c.benchmark_group(group_name); } @@ -127,49 +58,46 @@ fn bench_baseline(c: &mut Criterion) { fn bench_odd_product(c: &mut Criterion) { let group = group(c, "OddPorduct"); - #[cfg(feature = "bench-extensive")] - let parameters = &[300000, 1200000, 12000000, 180000000, 720000000]; - #[cfg(not(feature = "bench-extensive"))] - let parameters = &[10_000, 100_000]; + let parameters = &[10_000, 100_000, 300000]; bench(group, parameters, parameters, Contract::odd_product); } fn bench_triangle_number(c: &mut Criterion) { let group = group(c, "TriangleNumber"); - #[cfg(feature = "bench-extensive")] - let parameters = &[360000, 1440000, 14400000, 216000000, 864000000]; - #[cfg(not(feature = "bench-extensive"))] - let parameters = &[10_000, 100_000]; + let parameters = &[10_000, 100_000, 360000]; bench(group, parameters, parameters, Contract::triangle_number); } fn bench_fibonacci_recurisve(c: &mut Criterion) { let group = group(c, "FibonacciRecursive"); - #[cfg(feature = "bench-extensive")] - let parameters = &[24, 27, 31, 36, 39]; - #[cfg(not(feature = "bench-extensive"))] - let parameters = &[12, 16, 20]; + let parameters = [12, 16, 20, 24] + .iter() + .map(|p| U256::from(*p)) + .collect::>(); - bench(group, parameters, parameters, Contract::fib_recursive); + bench(group, ¶meters, ¶meters, Contract::fib_recursive); } fn bench_fibonacci_iterative(c: &mut Criterion) { let group = group(c, "FibonacciIterative"); - #[cfg(feature = "bench-extensive")] - let parameters = &[256, 162500, 650000, 6500000, 100000000, 400000000]; - #[cfg(not(feature = "bench-extensive"))] - let parameters = &[64, 128, 256]; + let parameters = [64, 128, 256] + .iter() + .map(|p| U256::from(*p)) + .collect::>(); - bench(group, parameters, parameters, Contract::fib_iterative); + bench(group, ¶meters, ¶meters, Contract::fib_iterative); } fn bench_fibonacci_binet(c: &mut Criterion) { let group = group(c, "FibonacciBinet"); - let parameters = &[64, 128, 256]; + let parameters = [64, 128, 256] + .iter() + .map(|p| U256::from(*p)) + .collect::>(); - bench(group, parameters, parameters, Contract::fib_binet); + bench(group, ¶meters, ¶meters, Contract::fib_binet); } fn bench_sha1(c: &mut Criterion) { @@ -177,7 +105,9 @@ fn bench_sha1(c: &mut Criterion) { let parameters = &[vec![0xff], vec![0xff; 64], vec![0xff; 512]]; let labels = parameters.iter().map(|p| p.len()).collect::>(); - bench(group, parameters, &labels, Contract::sha1); + bench(group, parameters, &labels, |input| { + Contract::sha1(input.into()) + }); } criterion_group!( diff --git a/crates/benchmarks/benches/prepare.rs b/crates/benchmarks/benches/prepare.rs deleted file mode 100644 index 6c8a6f8..0000000 --- a/crates/benchmarks/benches/prepare.rs +++ /dev/null @@ -1,170 +0,0 @@ -use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; - -use revive_integration::cases::Contract; - -fn bench( - c: &mut Criterion, - group_name: &str, - #[cfg(feature = "bench-evm")] evm_runtime: Vec, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] pvm_runtime: Vec, -) { - let mut group = c.benchmark_group(group_name); - let code_size = 0; - - #[cfg(feature = "bench-evm")] - group.bench_with_input( - BenchmarkId::new("Evm", code_size), - &evm_runtime, - |b, code| b.iter(|| revive_differential::prepare(code.clone(), Vec::new())), - ); - - #[cfg(feature = "bench-pvm-interpreter")] - { - let engine = revive_benchmarks::instantiate_engine(polkavm::BackendKind::Interpreter); - group.bench_with_input( - BenchmarkId::new("PVMInterpreterCompile", code_size), - &(&pvm_runtime, engine), - |b, (code, engine)| { - b.iter(|| { - revive_integration::mock_runtime::recompile_code(code, engine); - }); - }, - ); - } - - #[cfg(feature = "bench-pvm-interpreter")] - { - let engine = revive_benchmarks::instantiate_engine(polkavm::BackendKind::Interpreter); - let module = revive_integration::mock_runtime::recompile_code(&pvm_runtime, &engine); - group.bench_with_input( - BenchmarkId::new("PVMInterpreterInstantiate", code_size), - &(module, engine), - |b, (module, engine)| { - b.iter(|| { - revive_integration::mock_runtime::instantiate_module(module, engine); - }); - }, - ); - } - - #[cfg(feature = "bench-pvm")] - { - let engine = revive_benchmarks::instantiate_engine(polkavm::BackendKind::Compiler); - group.bench_with_input( - BenchmarkId::new("PVMCompile", code_size), - &(&pvm_runtime, engine), - |b, (code, engine)| { - b.iter(|| { - revive_integration::mock_runtime::recompile_code(code, engine); - }); - }, - ); - } - - #[cfg(feature = "bench-pvm")] - { - let engine = revive_benchmarks::instantiate_engine(polkavm::BackendKind::Compiler); - let module = revive_integration::mock_runtime::recompile_code(&pvm_runtime, &engine); - group.bench_with_input( - BenchmarkId::new("PVMInstantiate", code_size), - &(module, engine), - |b, (module, engine)| { - b.iter(|| { - revive_integration::mock_runtime::instantiate_module(module, engine); - }); - }, - ); - } - - group.finish(); -} - -fn bench_baseline(c: &mut Criterion) { - bench( - c, - "PrepareBaseline", - #[cfg(feature = "bench-evm")] - Contract::baseline().evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::baseline().pvm_runtime, - ); -} - -fn bench_odd_product(c: &mut Criterion) { - bench( - c, - "PrepareOddProduct", - #[cfg(feature = "bench-evm")] - Contract::odd_product(0).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::baseline().pvm_runtime, - ); -} - -fn bench_triangle_number(c: &mut Criterion) { - bench( - c, - "PrepareTriangleNumber", - #[cfg(feature = "bench-evm")] - Contract::triangle_number(0).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::triangle_number(0).pvm_runtime, - ); -} - -fn bench_fibonacci_recursive(c: &mut Criterion) { - bench( - c, - "PrepareFibonacciRecursive", - #[cfg(feature = "bench-evm")] - Contract::fib_recursive(0).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::fib_recursive(0).pvm_runtime, - ); -} - -fn bench_fibonacci_iterative(c: &mut Criterion) { - bench( - c, - "PrepareFibonacciIterative", - #[cfg(feature = "bench-evm")] - Contract::fib_iterative(0).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::fib_iterative(0).pvm_runtime, - ); -} - -fn bench_fibonacci_binet(c: &mut Criterion) { - bench( - c, - "PrepareFibonacciBinet", - #[cfg(feature = "bench-evm")] - Contract::fib_binet(0).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::fib_binet(0).pvm_runtime, - ); -} - -fn bench_sha1(c: &mut Criterion) { - bench( - c, - "PrepareSHA1", - #[cfg(feature = "bench-evm")] - Contract::sha1(Default::default()).evm_runtime, - #[cfg(any(feature = "bench-pvm-interpreter", feature = "bench-pvm"))] - Contract::sha1(Default::default()).pvm_runtime, - ); -} - -criterion_group!( - name = prepare; - config = Criterion::default(); - targets = bench_baseline, - bench_odd_product, - bench_triangle_number, - bench_fibonacci_recursive, - bench_fibonacci_iterative, - bench_fibonacci_binet, - bench_sha1 -); -criterion_main!(prepare); diff --git a/crates/benchmarks/src/lib.rs b/crates/benchmarks/src/lib.rs index 99ef589..9ee8ec2 100644 --- a/crates/benchmarks/src/lib.rs +++ b/crates/benchmarks/src/lib.rs @@ -1,25 +1,70 @@ -use polkavm::{BackendKind, Config, Engine, ExportIndex, Instance, SandboxKind}; -use revive_integration::mock_runtime::{self, TransactionBuilder}; -use revive_integration::mock_runtime::{State, Transaction}; - -pub fn prepare_pvm( - code: &[u8], - input: Vec, - backend: BackendKind, -) -> (TransactionBuilder, Instance, ExportIndex) { - let mut config = Config::new(); - config.set_backend(Some(backend)); - config.set_sandbox(Some(SandboxKind::Linux)); - - let (instance, export_index) = mock_runtime::prepare(code, Some(config)); - let transaction = State::default().transaction().calldata(input); - - (transaction, instance, export_index) +#[cfg(feature = "bench-pvm-interpreter")] +pub fn create_specs(contract: &revive_integration::cases::Contract) -> revive_runner::Specs { + use revive_runner::*; + use SpecsAction::*; + Specs { + differential: false, + actions: vec![ + Instantiate { + code: Code::Bytes(contract.pvm_runtime.to_vec()), + origin: TestAddress::Alice, + data: Default::default(), + value: Default::default(), + gas_limit: Default::default(), + storage_deposit_limit: Default::default(), + salt: Default::default(), + }, + Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + data: contract.calldata.to_vec(), + value: Default::default(), + gas_limit: Default::default(), + storage_deposit_limit: Default::default(), + }, + ], + ..Default::default() + } } -pub fn instantiate_engine(backend: BackendKind) -> Engine { - let mut config = Config::new(); - config.set_backend(Some(backend)); - config.set_sandbox(Some(SandboxKind::Linux)); - mock_runtime::setup(Some(config)) +#[cfg(feature = "bench-pvm-interpreter")] +pub fn measure_pvm(specs: &revive_runner::Specs, iters: u64) -> std::time::Duration { + use revive_runner::*; + let mut total_time = std::time::Duration::default(); + + for _ in 0..iters { + let results = specs.clone().run(); + + let CallResult::Exec { result, wall_time } = + results.get(1).expect("contract should have been called") + else { + panic!("expected a execution result"); + }; + let ret = result.result.as_ref().unwrap(); + assert!(!ret.did_revert()); + + total_time += *wall_time; + } + + total_time +} + +#[cfg(feature = "bench-evm")] +pub fn measure_evm(code: &[u8], input: &[u8], iters: u64) -> std::time::Duration { + let mut total_time = std::time::Duration::default(); + + let code = hex::encode(code); + + for _ in 0..iters { + let log = revive_differential::Evm::default() + .code_blob(code.as_bytes().to_vec()) + .input(input.to_vec().into()) + .bench(true) + .run(); + assert!(log.output.run_success(), "evm run failed: {log:?}"); + + total_time += log.execution_time().unwrap(); + } + + total_time } diff --git a/crates/common/.github/ISSUE_TEMPLATE/bug_report.md b/crates/common/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 2d3e38a..0000000 --- a/crates/common/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -name: Bug report -about: Use this template for reporting issues -title: '' -labels: bug -assignees: '' ---- - -### 🐛 Bug Report - -#### 📝 Description - -Provide a clear and concise description of the bug. - -#### 🔄 Reproduction Steps - -Steps to reproduce the behaviour - -#### 🤔 Expected Behavior - -Describe what you expected to happen. - -#### 😯 Current Behavior - -Describe what actually happened. - -#### 🖥️ Environment - -Any relevant environment details. - -#### 📋 Additional Context - -Add any other context about the problem here. If applicable, add screenshots to help explain. - -#### 📎 Log Output - -``` -Paste any relevant log output here. -``` diff --git a/crates/common/.github/ISSUE_TEMPLATE/feature_request.md b/crates/common/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index d921e06..0000000 --- a/crates/common/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Feature request -about: Use this template for requesting features -title: '' -labels: feat -assignees: '' ---- - -### 🌟 Feature Request - -#### 📝 Description - -Provide a clear and concise description of the feature you'd like to see. - -#### 🤔 Rationale - -Explain why this feature is important and how it benefits the project. - -#### 📋 Additional Context - -Add any other context or information about the feature request here. diff --git a/crates/common/.github/pull_request_template.md b/crates/common/.github/pull_request_template.md deleted file mode 100644 index 022f67f..0000000 --- a/crates/common/.github/pull_request_template.md +++ /dev/null @@ -1,20 +0,0 @@ -# What ❔ - - - - - -## Why ❔ - - - - -## Checklist - - - - -- [ ] PR title corresponds to the body of PR. -- [ ] Tests for the changes have been added / updated. -- [ ] Documentation comments have been added / updated. -- [ ] Code has been formatted via `cargo fmt` and checked with `cargo clippy`. diff --git a/crates/common/.github/workflows/cargo-license.yaml b/crates/common/.github/workflows/cargo-license.yaml deleted file mode 100644 index e44f940..0000000 --- a/crates/common/.github/workflows/cargo-license.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: Cargo license check -on: pull_request - -jobs: - cargo-deny: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: EmbarkStudios/cargo-deny-action@v1 diff --git a/crates/common/.github/workflows/ci.yaml b/crates/common/.github/workflows/ci.yaml deleted file mode 100644 index fd0bd3b..0000000 --- a/crates/common/.github/workflows/ci.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: "Rust CI" -on: - pull_request: - -jobs: - build: - name: cargo build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - run: cargo build --verbose - - formatting: - name: cargo fmt - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - components: rustfmt - - name: Rustfmt Check - uses: actions-rust-lang/rustfmt@v1 diff --git a/crates/common/.github/workflows/secrets_scanner.yaml b/crates/common/.github/workflows/secrets_scanner.yaml deleted file mode 100644 index 54054cf..0000000 --- a/crates/common/.github/workflows/secrets_scanner.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: Leaked Secrets Scan -on: [pull_request] -jobs: - TruffleHog: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 - with: - fetch-depth: 0 - - name: TruffleHog OSS - uses: trufflesecurity/trufflehog@0c66d30c1f4075cee1aada2e1ab46dabb1b0071a - with: - path: ./ - base: ${{ github.event.repository.default_branch }} - head: HEAD - extra_args: --debug --only-verified diff --git a/crates/common/src/bit_length.rs b/crates/common/src/bit_length.rs index 521be3c..fd608f3 100644 --- a/crates/common/src/bit_length.rs +++ b/crates/common/src/bit_length.rs @@ -20,7 +20,7 @@ pub const BIT_LENGTH_ETH_ADDRESS: usize = pub const BIT_LENGTH_WORD: usize = crate::byte_length::BYTE_LENGTH_WORD * BIT_LENGTH_BYTE; /// Bit length of the runtime value type. -pub const BIT_LENGTH_VALUE: usize = crate::byte_length::BYTE_LENGTH_VALUE * BIT_LENGTH_BYTE; +pub const BIT_LENGTH_VALUE: usize = BIT_LENGTH_WORD; /// Bit length of thre runimte block number type. pub const BIT_LENGTH_BLOCK_NUMBER: usize = diff --git a/crates/common/src/byte_length.rs b/crates/common/src/byte_length.rs index e452ca2..8a5aade 100644 --- a/crates/common/src/byte_length.rs +++ b/crates/common/src/byte_length.rs @@ -6,15 +6,12 @@ pub const BYTE_LENGTH_BYTE: usize = 1; /// The x86 word byte-length. pub const BYTE_LENGTH_X32: usize = 4; -/// Native stack alignment size in bytes -#[cfg(not(feautre = "riscv-64"))] -pub const BYTE_LENGTH_STACK_ALIGN: usize = 4; -#[cfg(feautre = "riscv-64")] -pub const BYTE_LENGTH_STACK_ALIGN: usize = 8; - /// The x86_64 word byte-length. pub const BYTE_LENGTH_X64: usize = 8; +/// EVM native stack alignment size in bytes +pub const BYTE_LENGTH_STACK_ALIGN: usize = 32; + /// The ETH address byte-length. pub const BYTE_LENGTH_ETH_ADDRESS: usize = 20; @@ -25,7 +22,7 @@ pub const BYTE_LENGTH_WORD: usize = 32; pub const BYTE_LENGTH_VALUE: usize = 32; /// Byte length of the runtime block number type. -pub const BYTE_LENGTH_BLOCK_NUMBER: usize = 8; +pub const BYTE_LENGTH_BLOCK_NUMBER: usize = 4; /// Byte length of the runtime block timestamp type. -pub const BYTE_LENGTH_BLOCK_TIMESTAMP: usize = 8; +pub const BYTE_LENGTH_BLOCK_TIMESTAMP: usize = 4; diff --git a/crates/common/src/exit_code.rs b/crates/common/src/exit_code.rs index be72aec..a7678d0 100644 --- a/crates/common/src/exit_code.rs +++ b/crates/common/src/exit_code.rs @@ -1,6 +1,4 @@ -//! -//! The exit code constants. -//! +//! The revive exit code constants. /// The common application success exit code. pub const EXIT_CODE_SUCCESS: i32 = 0; diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs index 350dde6..b9fd621 100644 --- a/crates/common/src/lib.rs +++ b/crates/common/src/lib.rs @@ -6,7 +6,6 @@ pub(crate) mod byte_length; pub(crate) mod evm_version; pub(crate) mod exit_code; pub(crate) mod extension; -pub(crate) mod polkavm; pub(crate) mod utils; pub use self::base::*; @@ -15,5 +14,4 @@ pub use self::byte_length::*; pub use self::evm_version::EVMVersion; pub use self::exit_code::*; pub use self::extension::*; -pub use self::polkavm::address::*; pub use self::utils::*; diff --git a/crates/common/src/polkavm/address.rs b/crates/common/src/polkavm/address.rs deleted file mode 100644 index 2e500df..0000000 --- a/crates/common/src/polkavm/address.rs +++ /dev/null @@ -1,115 +0,0 @@ -//! The PolkaVM address constants. - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_TO_L1: u16 = 0xFFFF; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_PRECOMPILE: u16 = 0xFFFD; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_META: u16 = 0xFFFC; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_MIMIC_CALL: u16 = 0xFFFB; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_SYSTEM_MIMIC_CALL: u16 = 0xFFFA; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_MIMIC_CALL_BYREF: u16 = 0xFFF9; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_SYSTEM_MIMIC_CALL_BYREF: u16 = 0xFFF8; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_RAW_FAR_CALL: u16 = 0xFFF7; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_RAW_FAR_CALL_BYREF: u16 = 0xFFF6; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_SYSTEM_CALL: u16 = 0xFFF5; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_SYSTEM_CALL_BYREF: u16 = 0xFFF4; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_SET_CONTEXT_VALUE_CALL: u16 = 0xFFF3; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_SET_PUBDATA_PRICE: u16 = 0xFFF2; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_INCREMENT_TX_COUNTER: u16 = 0xFFF1; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_GET_GLOBAL_PTR_CALLDATA: u16 = 0xFFF0; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_GET_GLOBAL_CALL_FLAGS: u16 = 0xFFEF; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_GET_GLOBAL_PTR_RETURN_DATA: u16 = 0xFFEE; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_EVENT_INITIALIZE: u16 = 0xFFED; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_EVENT_WRITE: u16 = 0xFFEC; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_ACTIVE_PTR_LOAD_CALLDATA: u16 = 0xFFEB; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_ACTIVE_PTR_LOAD_RETURN_DATA: u16 = 0xFFEA; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_ACTIVE_PTR_ADD: u16 = 0xFFE9; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_ACTIVE_PTR_SHRINK: u16 = 0xFFE8; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_ACTIVE_PTR_PACK: u16 = 0xFFE7; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_MULTIPLICATION_HIGH_REGISTER: u16 = 0xFFE6; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_GET_GLOBAL_EXTRA_ABI_DATA: u16 = 0xFFE5; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_ACTIVE_PTR_DATA_LOAD: u16 = 0xFFE4; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_ACTIVE_PTR_DATA_COPY: u16 = 0xFFE3; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_ACTIVE_PTR_DATA_SIZE: u16 = 0xFFE2; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_CONST_ARRAY_DECLARE: u16 = 0xFFE1; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_CONST_ARRAY_SET: u16 = 0xFFE0; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_CONST_ARRAY_FINALIZE: u16 = 0xFFDF; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_CONST_ARRAY_GET: u16 = 0xFFDE; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_DECOMMIT: u16 = 0xFFDD; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_ACTIVE_PTR_LOAD_DECOMMIT: u16 = 0xFFDC; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_RETURN_FORWARD: u16 = 0xFFDB; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_REVERT_FORWARD: u16 = 0xFFDA; - -/// The corresponding simulation predefined address. -pub const POLKAVM_ADDRESS_ACTIVE_PTR_SWAP: u16 = 0xFFD9; diff --git a/crates/common/src/polkavm/mod.rs b/crates/common/src/polkavm/mod.rs deleted file mode 100644 index 093d451..0000000 --- a/crates/common/src/polkavm/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -//! -//! The PolkaVM constants. -//! - -pub mod address; diff --git a/crates/differential/Cargo.toml b/crates/differential/Cargo.toml index 970fefc..956c037 100644 --- a/crates/differential/Cargo.toml +++ b/crates/differential/Cargo.toml @@ -6,6 +6,10 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -evm-interpreter = { workspace = true } -primitive-types = { workspace = true } -alloy-primitives = { workspace = true } \ No newline at end of file +hex = { workspace = true } +tempfile = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +alloy-primitives = { workspace = true, features = ["serde"] } +alloy-genesis = { workspace = true } +alloy-serde = { workspace = true } \ No newline at end of file diff --git a/crates/differential/genesis.json b/crates/differential/genesis.json new file mode 100644 index 0000000..2abb453 --- /dev/null +++ b/crates/differential/genesis.json @@ -0,0 +1,40 @@ +{ + "config": { + "chainId": 420420420, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock": 0, + "londonBlock": 0, + "arrowGlacierBlock": 0, + "grayGlacierBlock": 0, + "shanghaiTime": 0, + "cancunTime": 0, + "terminalTotalDifficulty": 0, + "terminalTotalDifficultyPassed": true + }, + "coinbase": "0x0000000000000000000000000000000000000000", + "difficulty": "0x20000", + "extraData": "", + "gasLimit": "0xffffffff", + "nonce": "0x0000000000000042", + "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": "0x00", + "alloc": { + "0101010101010101010101010101010101010101": { + "balance": "1000000000" + }, + "0202020202020202020202020202020202020202": { + "balance": "1000000000" + }, + "0303030303030303030303030303030303030303": { + "balance": "1000000000" + } + } +} \ No newline at end of file diff --git a/crates/differential/src/go_duration.rs b/crates/differential/src/go_duration.rs new file mode 100644 index 0000000..f7c15d0 --- /dev/null +++ b/crates/differential/src/go_duration.rs @@ -0,0 +1,199 @@ +use std::time::Duration; + +/// Parse a go formatted duration. +/// +/// Sources: +/// - https://crates.io/crates/go-parse-duration (fixed an utf8 bug) +/// - https://github.com/golang/go/blob/master/src/time/format.go +pub fn parse_go_duration(value: &str) -> Result { + parse_duration(value).map(|ns| Duration::from_nanos(ns.unsigned_abs())) +} + +fn parse_duration(string: &str) -> Result { + // [-+]?([0-9]*(\.[0-9]*)?[a-z]+)+ + let mut s = string; + let mut d: i64 = 0; // duration to be returned + let mut neg = false; + + // Consume [-+]? + if !s.is_empty() { + let c = *s.as_bytes().first().unwrap(); + if c == b'-' || c == b'+' { + neg = c == b'-'; + s = &s[1..]; + } + } + // Special case: if all that is left is "0", this is zero. + if s == "0" { + return Ok(0); + } + if s.is_empty() { + return Err(format!("invalid duration: {string}")); + } + while !s.is_empty() { + // integers before, after decimal point + let mut v: i64; + let mut f: i64 = 0; + // value = v + f / scale + let mut scale: f64 = 1f64; + + // The next character must be [0-9.] + let c = *s.as_bytes().first().unwrap(); + if !(c == b'.' || c.is_ascii_digit()) { + return Err(format!("invalid duration: {string}")); + } + // Consume [0-9]* + let pl = s.len(); + match leading_int(s) { + Ok((_v, _s)) => { + v = _v; + s = _s; + } + Err(_) => { + return Err(format!("invalid duration: {string}")); + } + } + let pre = pl != s.len(); // whether we consume anything before a period + + // Consume (\.[0-9]*)? + let mut post = false; + if !s.is_empty() && *s.as_bytes().first().unwrap() == b'.' { + s = &s[1..]; + let pl = s.len(); + let (f_, scale_, s_) = leading_fraction(s); + { + f = f_; + scale = scale_; + s = s_; + } + post = pl != s.len(); + } + if !pre && !post { + // no digits (e.g. ".s" or "-.s") + return Err(format!("invalid duration: {string}")); + } + + // Consume unit. + let mut i = 0; + while i < s.len() { + let c = *s.as_bytes().get(i).unwrap(); + if c == b'.' || c.is_ascii_digit() { + break; + } + i += 1; + } + if i == 0 { + return Err(format!("missing unit in duration: {string}")); + } + let u = &s[..i]; + s = &s[i..]; + let unit = match u { + "ns" => 1i64, + "us" => 1000i64, + "µs" => 1000i64, // U+00B5 = micro symbol + "μs" => 1000i64, // U+03BC = Greek letter mu + "ms" => 1000000i64, + "s" => 1000000000i64, + "m" => 60000000000i64, + "h" => 3600000000000i64, + _ => { + return Err(format!("unknown unit {u} in duration {string}")); + } + }; + if v > (1 << (63 - 1)) / unit { + // overflow + return Err(format!("invalid duration {string}")); + } + v *= unit; + if f > 0 { + // f64 is needed to be nanosecond accurate for fractions of hours. + // v >= 0 && (f*unit/scale) <= 3.6e+12 (ns/h, h is the largest unit) + v += (f as f64 * (unit as f64 / scale)) as i64; + if v < 0 { + // overflow + return Err(format!("invalid duration {string}")); + } + } + d += v; + if d < 0 { + // overflow + return Err(format!("invalid duration {string}")); + } + } + if neg { + d = -d; + } + Ok(d) +} + +fn leading_int(s: &str) -> Result<(i64, &str), String> { + let mut x = 0; + let mut i = 0; + while i < s.len() { + let c = s.chars().nth(i).unwrap(); + if !c.is_ascii_digit() { + break; + } + if x > (1 << (63 - 1)) / 10 { + return Err("overflow".into()); + } + let d = i64::from(c.to_digit(10).unwrap()); + x = x * 10 + d; + if x < 0 { + // overflow + return Err("overflow".into()); + } + i += 1; + } + Ok((x, &s[i..])) +} + +fn leading_fraction(s: &str) -> (i64, f64, &str) { + let mut i = 0; + let mut x = 0i64; + let mut scale = 1f64; + let mut overflow = false; + while i < s.len() { + let c = s.chars().nth(i).unwrap(); + if !c.is_ascii_digit() { + break; + } + if overflow { + continue; + } + if x > (1 << (63 - 1)) / 10 { + // It's possible for overflow to give a positive number, so take care. + overflow = true; + continue; + } + let d = i64::from(c.to_digit(10).unwrap()); + let y = x * 10 + d; + if y < 0 { + overflow = true; + continue; + } + x = y; + scale *= 10f64; + i += 1; + } + (x, scale, &s[i..]) +} + +#[cfg(test)] +mod tests { + use super::parse_duration; + + #[test] + fn test_parse_duration() { + assert_eq!(parse_duration("8.731µs"), Ok(8731)); + assert_eq!(parse_duration("50ns"), Ok(50)); + assert_eq!(parse_duration("3ms"), Ok(3000000)); + assert_eq!(parse_duration("2us"), Ok(2000)); + assert_eq!(parse_duration("4.0s"), Ok(4000000000)); + assert_eq!(parse_duration("1h45m"), Ok(6300000000000)); + assert_eq!( + parse_duration("1"), + Err(String::from("missing unit in duration: 1")), + ); + } +} diff --git a/crates/differential/src/lib.rs b/crates/differential/src/lib.rs index fbe9190..d294b10 100644 --- a/crates/differential/src/lib.rs +++ b/crates/differential/src/lib.rs @@ -1,159 +1,569 @@ -use alloy_primitives::{keccak256, Address, B256}; -use evm_interpreter::{ - interpreter::{EtableInterpreter, RunInterpreter}, - trap::CallCreateTrap, - Context, Etable, ExitError, Log, Machine, RuntimeBackend, RuntimeBaseBackend, - RuntimeEnvironment, RuntimeState, TransactionContext, Valids, +use core::str; +use std::{ + collections::BTreeMap, + io::Write, + path::PathBuf, + process::{Command, Stdio}, + str::FromStr, + time::Duration, }; -use primitive_types::{H160, H256, U256}; -static RUNTIME_ETABLE: Etable = - Etable::runtime(); +use alloy_genesis::{Genesis, GenesisAccount}; +use alloy_primitives::{hex::ToHexExt, Address, Bytes, B256, U256}; +use alloy_serde::storage::deserialize_storage_map; +use serde::{Deserialize, Serialize}; +use serde_json::{Deserializer, Value}; +use tempfile::{NamedTempFile, TempPath}; -#[derive(Default)] -pub struct UnimplementedHandler { - logs: Vec, +pub use self::go_duration::parse_go_duration; + +mod go_duration; + +const GENESIS_JSON: &str = include_str!("../genesis.json"); +const EXECUTABLE_NAME: &str = "evm"; +const EXECUTABLE_ARGS: [&str; 8] = [ + "--log.format=json", + "run", + "--dump", + "--nomemory=false", + "--noreturndata=false", + "--json", + "--codefile", + "-", +]; +const EXECUTABLE_ARGS_BENCH: [&str; 6] = [ + "run", + "--bench", + "--nomemory=false", + "--noreturndata=false", + "--codefile", + "-", +]; +const GAS_USED_MARKER: &str = "EVM gas used:"; +const REVERT_MARKER: &str = " error: "; + +/// The geth EVM state dump structure +#[derive(Clone, Debug, Default, Serialize, Deserialize)] +pub struct StateDump { + pub root: Bytes, + pub accounts: BTreeMap, } -impl RuntimeEnvironment for UnimplementedHandler { - fn block_hash(&self, _number: U256) -> H256 { - unimplemented!() - } - fn block_number(&self) -> U256 { - U256::from(123) - } - fn block_coinbase(&self) -> H160 { - unimplemented!() - } - fn block_timestamp(&self) -> U256 { - U256::from(456) - } - fn block_difficulty(&self) -> U256 { - unimplemented!() - } - fn block_randomness(&self) -> Option { - unimplemented!() - } - fn block_gas_limit(&self) -> U256 { - unimplemented!() - } - fn block_base_fee_per_gas(&self) -> U256 { - unimplemented!() - } - fn chain_id(&self) -> U256 { - unimplemented!() +impl From for Genesis { + fn from(value: StateDump) -> Self { + let mut genesis: Genesis = serde_json::from_str(GENESIS_JSON).unwrap(); + genesis.alloc = value + .accounts + .iter() + .map(|(address, account)| (*address, account.clone().into())) + .collect(); + genesis } } -impl RuntimeBaseBackend for UnimplementedHandler { - fn balance(&self, _address: H160) -> U256 { - unimplemented!() - } - fn code_size(&self, _address: H160) -> U256 { - unimplemented!() - } - fn code_hash(&self, _address: H160) -> H256 { - unimplemented!() - } - fn code(&self, _address: H160) -> Vec { - unimplemented!() - } - fn storage(&self, _address: H160, _index: H256) -> H256 { - unimplemented!() - } - - fn exists(&self, _address: H160) -> bool { - unimplemented!() - } - - fn nonce(&self, _address: H160) -> U256 { - unimplemented!() - } +/// The geth EVM state dump account structure +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Account { + pub balance: U256, + pub nonce: u64, + pub code: Option, + #[serde( + default, + skip_serializing_if = "Option::is_none", + deserialize_with = "deserialize_storage_map" + )] + pub storage: Option>, + pub key: Option, } -impl RuntimeBackend for UnimplementedHandler { - fn original_storage(&self, _address: H160, _index: H256) -> H256 { - unimplemented!() - } - - fn deleted(&self, _address: H160) -> bool { - unimplemented!() - } - fn is_cold(&self, _address: H160, _index: Option) -> bool { - unimplemented!() - } - - fn mark_hot(&mut self, _address: H160, _index: Option) { - unimplemented!() - } - - fn set_storage(&mut self, _address: H160, _index: H256, _value: H256) -> Result<(), ExitError> { - unimplemented!() - } - fn log(&mut self, log: Log) -> Result<(), ExitError> { - self.logs.push(log); - Ok(()) - } - fn mark_delete(&mut self, _address: H160) { - unimplemented!() - } - - fn reset_storage(&mut self, _address: H160) { - unimplemented!() - } - - fn set_code(&mut self, _address: H160, _code: Vec) -> Result<(), ExitError> { - unimplemented!() - } - fn reset_balance(&mut self, _address: H160) { - unimplemented!() - } - - fn deposit(&mut self, _address: H160, _value: U256) { - unimplemented!() - } - fn withdrawal(&mut self, _address: H160, _value: U256) -> Result<(), ExitError> { - unimplemented!() - } - - fn inc_nonce(&mut self, _address: H160) -> Result<(), ExitError> { - unimplemented!() - } -} - -#[derive(Clone)] -pub struct PreparedEvm { - pub valids: Valids, - pub vm: Machine, -} - -pub fn prepare(code: Vec, data: Vec) -> PreparedEvm { - let address = Address::default().create2(B256::default(), keccak256([]).0); - let caller = Address::default().create2(B256::default(), keccak256([]).0); - - let state = RuntimeState { - context: Context { - address: H160::from(address.0 .0), - caller: H160::from(caller.0 .0), - apparent_value: U256::default(), - }, - transaction_context: TransactionContext { - gas_price: U256::default(), - origin: H160::default(), +impl From for GenesisAccount { + fn from(value: Account) -> Self { + GenesisAccount { + balance: value.balance, + nonce: Some(value.nonce), + code: value.code, + storage: value.storage, + private_key: value.key, } - .into(), - retbuf: Vec::new(), - }; - - PreparedEvm { - valids: Valids::new(&code[..]), - vm: evm_interpreter::Machine::new(code.into(), data.to_vec().into(), 1024, 0xFFFF, state), } } -pub fn execute(pre: PreparedEvm) -> (Vec, Vec) { - let mut vm = EtableInterpreter::new_valid(pre.vm, &RUNTIME_ETABLE, pre.valids); - let mut handler = UnimplementedHandler::default(); - vm.run(&mut handler).exit().unwrap().unwrap(); - (vm.retval.clone(), handler.logs) +/// Contains the output from geth `emv` invocations +#[derive(Clone, Debug, Default, Serialize, Deserialize)] +pub struct EvmOutput { + pub output: Bytes, + #[serde(rename = "gasUsed")] + pub gas_used: U256, + pub error: Option, +} + +impl EvmOutput { + /// Return if there was no error found. + /// + /// Panics if the gas used is zero as this indicates nothing was run. + pub fn run_success(&self) -> bool { + assert_ne!(self.gas_used, U256::ZERO, "nothing was executed: {self:?}"); + self.error.is_none() + } +} + +/// Contains the full log from geth `emv` invocations +#[derive(Clone, Debug)] +pub struct EvmLog { + pub account_deployed: Option
, + pub output: EvmOutput, + pub state_dump: StateDump, + pub stderr: String, +} + +impl EvmLog { + pub const EXECUTION_TIME_MARKER: &'static str = "execution time:"; + + /// Parse the reported execution time from stderr (requires --bench) + pub fn execution_time(&self) -> Result { + for line in self.stderr.lines() { + if let Some(value) = line.split("execution time:").nth(1) { + return parse_go_duration(value.trim()); + } + } + + Err(format!( + "execution time marker '{}' not found in raw EVM log", + Self::EXECUTION_TIME_MARKER + )) + } + + fn parse_gas_used_from_bench(&mut self) { + for line in self.stderr.lines() { + if let Some(gas_line) = line.split(GAS_USED_MARKER).nth(1) { + let gas_used = gas_line.trim().parse::().unwrap_or_else(|error| { + panic!("invalid output '{gas_line}' for gas used: {error}") + }); + self.output.gas_used = U256::from(gas_used); + } + } + } +} + +impl From<&str> for EvmLog { + fn from(value: &str) -> Self { + let mut output = None; + let mut state_dump = None; + for value in Deserializer::from_str(value).into_iter::() { + let Ok(value) = value else { continue }; + if let Ok(value @ EvmOutput { .. }) = serde_json::from_value(value.clone()) { + output = Some(value); + continue; + } + if let Ok(value @ StateDump { .. }) = serde_json::from_value(value) { + state_dump = Some(value); + } + } + + if let (Some(output), Some(state_dump)) = (output, state_dump) { + return Self { + account_deployed: None, + output, + state_dump, + stderr: value.into(), + }; + } + + EvmLog { + account_deployed: None, + output: EvmOutput { + error: value.find(REVERT_MARKER).map(|_| REVERT_MARKER.to_string()), + ..Default::default() + }, + state_dump: Default::default(), + stderr: Default::default(), + } + } +} + +/// Builder for running contracts in geth `evm` +pub struct Evm { + genesis_json: Option, + genesis_path: Option, + code: Option>, + input: Option, + receiver: Option, + sender: String, + value: Option, + gas: Option, + create: bool, + bench: bool, +} + +impl Default for Evm { + fn default() -> Self { + Self { + genesis_json: Some(GENESIS_JSON.to_string()), + genesis_path: None, + code: None, + input: None, + receiver: None, + sender: Address::default().encode_hex(), + value: None, + gas: None, + create: false, + bench: false, + } + } +} + +impl Evm { + /// Create a new EVM with the given `genesis` + pub fn from_genesis(genesis: Genesis) -> Self { + Self::default().genesis_json(genesis) + } + + /// Run the `code` + pub fn code_blob(self, blob: Vec) -> Self { + Self { + code: Some(blob), + ..self + } + } + + /// Set the calldata + pub fn input(self, bytes: Bytes) -> Self { + Self { + input: (!bytes.is_empty()).then_some(bytes), + ..self + } + } + + /// Set the create flag + pub fn deploy(self, enable: bool) -> Self { + Self { + create: enable, + ..self + } + } + + /// Set the transferred value + pub fn value(self, value: u128) -> Self { + Self { + value: Some(value), + ..self + } + } + + /// Set the gas limit + pub fn gas(self, limit: u64) -> Self { + Self { + gas: Some(limit), + ..self + } + } + + /// Provide the prestate genesis configuration + pub fn genesis_json(self, genesis: Genesis) -> Self { + let genesis_json = serde_json::to_string(&genesis).expect("state dump should be valid"); + // TODO: Investigate + let genesis_json = genesis_json.replace("\"0x0\"", "0").into(); + + Self { + genesis_json, + genesis_path: None, + ..self + } + } + + /// Provide a path to the genesis file to be used + pub fn genesis_path(self, path: PathBuf) -> Self { + Self { + genesis_path: Some(path), + genesis_json: None, + ..self + } + } + + /// Set the callee address + pub fn receiver(self, address: Address) -> Self { + Self { + receiver: Some(address.encode_hex()), + ..self + } + } + + /// Set the caller address + pub fn sender(self, address: Address) -> Self { + Self { + sender: address.encode_hex(), + ..self + } + } + + /// Run as a benchmark + pub fn bench(self, flag: bool) -> Self { + Self { + bench: flag, + ..self + } + } + + /// Calculate the address of the contract account this deploy call would create + pub fn expect_account_created(&self) -> Address { + assert!(self.create, "expected a deploy call"); + let sender = Address::from_str(&self.sender).expect("sender address should be valid"); + let genesis: Genesis = match (self.genesis_json.as_ref(), self.genesis_path.as_ref()) { + (Some(json), None) => serde_json::from_str(json).unwrap(), + (None, Some(path)) => { + serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap() + } + _ => panic!("provided a genesis json and a genesis json path"), + }; + let nonce = genesis + .alloc + .get(&sender) + .map(|account| account.nonce.unwrap_or(0)) + .unwrap_or(0); + sender.create(nonce) + } + + /// Return the path to the genesis file; + /// writes the genesis file into a tmpdir if necessary. + /// + /// `TempPath`` will delete on drop, so need to keep it around + fn write_genesis_file(&self, temp_path: &mut Option) -> String { + match (self.genesis_json.as_ref(), self.genesis_path.as_ref()) { + (Some(json), None) => { + let mut temp_file = NamedTempFile::new().unwrap(); + temp_file.write_all(json.as_bytes()).unwrap(); + let path = temp_file.into_temp_path(); + *temp_path = Some(path); + temp_path.as_ref().unwrap().display().to_string() + } + (None, Some(path)) => path.display().to_string(), + _ => panic!("provided a genesis json and a genesis json path"), + } + } + + /// Run the call in a geth `evm` subprocess. + /// + /// Definitively not a hairy plumbing function. + pub fn run(self) -> EvmLog { + let mut temp_path = None; + let genesis_json_path = &self.write_genesis_file(&mut temp_path); + + // Static args + let mut command = Command::new(PathBuf::from(EXECUTABLE_NAME)); + command + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()); + if self.bench { + command.args(EXECUTABLE_ARGS_BENCH); + } else { + command.args(EXECUTABLE_ARGS); + }; + + // Dynamic args + command.args(["--prestate", genesis_json_path]); + command.args(["--sender", &self.sender]); + if let Some(input) = &self.input { + command.args(["--input", hex::encode(input).as_str()]); + } + let account_deployed = if self.create { + command.arg("--create"); + self.expect_account_created().into() + } else { + None + }; + match (&self.code, &self.receiver) { + (Some(_), None) => {} + (None, Some(address)) => { + command.args(["--receiver", address]); + } + (Some(_), Some(_)) => panic!("code and receiver specified"), + _ => panic!("no code file or receiver specified"), + } + if let Some(gas) = self.gas { + command.args(["--gas", &format!("{gas}")]); + } + if let Some(value) = self.value { + command.args(["--value", &format!("{value}")]); + } + + // Run the evm subprocess and assert success return value + let process = command.spawn().unwrap_or_else(|error| { + panic!("{EXECUTABLE_NAME} subprocess spawning error: {error:?}") + }); + let buf = vec![]; + process + .stdin + .as_ref() + .unwrap_or_else(|| panic!("{EXECUTABLE_NAME} stdin getting error")) + .write_all(self.code.as_ref().unwrap_or(&buf)) + .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} stdin writing error: {err:?}")); + + let output = process + .wait_with_output() + .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} subprocess output error: {err}")); + assert!( + output.status.success(), + "{EXECUTABLE_NAME} command failed: {output:?}", + ); + drop(temp_path); + + let stdout = str::from_utf8(output.stdout.as_slice()) + .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} stdout failed to parse: {err}")); + let stderr = str::from_utf8(output.stderr.as_slice()) + .unwrap_or_else(|err| panic!("{EXECUTABLE_NAME} stderr failed to parse: {err}")); + + let mut log: EvmLog = stdout.into(); + log.stderr = stderr.into(); + if self.bench { + log.parse_gas_used_from_bench(); + } + + // Set the deployed account + log.account_deployed = account_deployed; + log + } +} + +#[cfg(test)] +mod tests { + use std::{str::FromStr, time::Duration}; + + use alloy_genesis::Genesis; + use alloy_primitives::{Bytes, B256, U256}; + + use crate::{Evm, EvmLog, EvmOutput, StateDump}; + + const OUTPUT_JSON_OK: &str = r#"{"output":"0000000000000000000000000000000000000000000000000000000000000000","gasUsed":"0x11d"}"#; + const OUTPUT_JSON_REVERTED: &str = + r#"{"output":"","gasUsed":"0x2d","error":"execution reverted"}"#; + const STATE_DUMP: &str = r#" +{ + "root": "eb5d51177cb9049b848ea92f87f9a3f00abfb683d0866c2eddecc5692ad27f86", + "accounts": { + "0x1f2a98889594024BFfdA3311CbE69728d392C06D": { + "balance": "0", + "nonce": 1, + "root": "0x63cfcda8d81a8b1840b1b9722c37f929a4037e53ad1ce6abdef31c0c8bac1f61", + "codeHash": "0xa6e0062c5ba829446695f179b97702a75f7d354e33445d2e928ed00e1a39e88f", + "code": "0x608060405260043610610028575f3560e01c80633fa4f2451461002c578063b144adfb1461004a575b5f80fd5b610034610086565b60405161004191906100c5565b60405180910390f35b348015610055575f80fd5b50610070600480360381019061006b919061013c565b61008d565b60405161007d91906100c5565b60405180910390f35b5f34905090565b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f819050919050565b6100bf816100ad565b82525050565b5f6020820190506100d85f8301846100b6565b92915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61010b826100e2565b9050919050565b61011b81610101565b8114610125575f80fd5b50565b5f8135905061013681610112565b92915050565b5f60208284031215610151576101506100de565b5b5f61015e84828501610128565b9150509291505056fea2646970667358221220a2109c2f05a629fff4640e9f0cf12a698bbea9b0858a4029901e88bf5d1c926964736f6c63430008190033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "02" + }, + "address": "0x1f2a98889594024bffda3311cbe69728d392c06d", + "key": "0xcbeeb4463624bc2f332dcfe2b479eddb1c380ec862ee63d9f31b31b854fb7c61" + } + } +}"#; + const EVM_BIN_FIXTURE: &str = "6080604052348015600e575f80fd5b506040516101403803806101408339818101604052810190602e9190607f565b805f806101000a81548160ff0219169083151502179055505060a5565b5f80fd5b5f8115159050919050565b606181604f565b8114606a575f80fd5b50565b5f81519050607981605a565b92915050565b5f602082840312156091576090604b565b5b5f609c84828501606d565b91505092915050565b608f806100b15f395ff3fe6080604052348015600e575f80fd5b50600436106026575f3560e01c8063cde4efa914602a575b5f80fd5b60306032565b005b5f8054906101000a900460ff16155f806101000a81548160ff02191690831515021790555056fea264697066735822122046c92dd2fd612b1ed93d184dad4c49f61c44690722c4a6c7c746ebeb0aadeb4a64736f6c63430008190033"; + const EVM_BIN_RUNTIME_FIXTURE: &str = "6080604052348015600e575f80fd5b50600436106026575f3560e01c8063cde4efa914602a575b5f80fd5b60306032565b005b5f8054906101000a900460ff16155f806101000a81548160ff02191690831515021790555056fea264697066735822122046c92dd2fd612b1ed93d184dad4c49f61c44690722c4a6c7c746ebeb0aadeb4a64736f6c63430008190033"; + const EVM_BIN_FIXTURE_INPUT: &str = + "0000000000000000000000000000000000000000000000000000000000000001"; + const EVM_BIN_RUNTIME_FIXTURE_INPUT: &str = "cde4efa9"; + const STDERR_BENCH_OK: &str = r#"EVM gas used: 560071 +execution time: 1.460881ms +allocations: 29 +allocated bytes: 2558 +"#; + const STDERR_BENCH_REVERT: &str = r#"EVM gas used: 69 +execution time: 10.11µs +allocations: 43 +allocated bytes: 3711"#; + const STDOUT_BENCH_REVERT: &str = r#" error: execution reverted"#; + + #[test] + fn parse_evm_output_ok() { + serde_json::from_str::(OUTPUT_JSON_OK).unwrap(); + } + + #[test] + fn parse_evm_output_revert() { + serde_json::from_str::(OUTPUT_JSON_REVERTED).unwrap(); + } + + #[test] + fn parse_evm_output_bench_ok() { + let mut log = EvmLog::from(""); + log.stderr = STDERR_BENCH_OK.into(); + log.parse_gas_used_from_bench(); + assert!(log.output.run_success()); + + assert_eq!(log.execution_time().unwrap(), Duration::from_nanos(1460881)); + } + + #[test] + fn parse_evm_output_bench_revert() { + let mut log = EvmLog::from(STDOUT_BENCH_REVERT); + log.stderr = STDERR_BENCH_REVERT.into(); + log.parse_gas_used_from_bench(); + assert!(!log.output.run_success()); + } + + #[test] + fn parse_state_dump() { + serde_json::from_str::(STATE_DUMP).unwrap(); + } + + #[test] + fn evm_log_from_str() { + let log = format!("{OUTPUT_JSON_OK}\n{STATE_DUMP}"); + let _ = EvmLog::from(log.as_str()); + } + + #[test] + fn generate_genesis() { + let log = format!("{OUTPUT_JSON_OK}\n{STATE_DUMP}"); + let log = EvmLog::from(log.as_str()); + let mut genesis: Genesis = log.state_dump.into(); + let storage = genesis + .alloc + .pop_first() + .expect("should have one account in genesis") + .1 + .storage + .expect("genesis account should have storage"); + let storage_value = storage + .get(&B256::ZERO) + .expect("genesis account should have key 0 occupied"); + assert_eq!(*storage_value, B256::from(U256::from(2))); + } + + #[test] + fn flipper() { + let log_runtime = Evm::default() + .code_blob(EVM_BIN_RUNTIME_FIXTURE.as_bytes().to_vec()) + .input(Bytes::from_str(EVM_BIN_RUNTIME_FIXTURE_INPUT).unwrap()) + .run(); + assert!(log_runtime.output.run_success()); + } + + #[test] + fn prestate() { + let log_deploy = Evm::default() + .code_blob(EVM_BIN_FIXTURE.as_bytes().to_vec()) + .input(Bytes::from_str(EVM_BIN_FIXTURE_INPUT).unwrap()) + .deploy(true) + .run(); + assert!(log_deploy.output.run_success()); + + let address = log_deploy.account_deployed.unwrap(); + let genesis: Genesis = log_deploy.state_dump.into(); + let log_runtime = Evm::default() + .genesis_json(genesis) + .receiver(address) + .input(Bytes::from_str(EVM_BIN_RUNTIME_FIXTURE_INPUT).unwrap()) + .run(); + assert!(log_runtime.output.run_success(), "{:?}", log_runtime.output); + } + + #[test] + fn bench_flipper() { + let log_runtime = Evm::default() + .code_blob(EVM_BIN_RUNTIME_FIXTURE.as_bytes().to_vec()) + .input(Bytes::from_str(EVM_BIN_RUNTIME_FIXTURE_INPUT).unwrap()) + .bench(true) + .run(); + assert!(log_runtime.output.run_success()); + assert!(log_runtime.execution_time().unwrap() > Duration::from_nanos(0)); + } } diff --git a/crates/integration/Cargo.toml b/crates/integration/Cargo.toml index c19e8ae..886bd9d 100644 --- a/crates/integration/Cargo.toml +++ b/crates/integration/Cargo.toml @@ -1,9 +1,11 @@ [package] name = "revive-integration" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +version.workspace = true +license.workspace = true +edition.workspace = true +repository.workspace = true +authors.workspace = true +description = "revive compiler integration test cases" [dependencies] polkavm = { workspace = true } @@ -12,12 +14,13 @@ alloy-sol-types = { workspace = true } hex = { workspace = true } env_logger = { workspace = true } log = { workspace = true } -once_cell = { workspace = true } +serde_json = { workspace = true } -revive-solidity = { path = "../solidity" } -revive-differential = { path = "../differential" } -revive-llvm-context = { path = "../llvm-context" } -revive-common = { path = "../common" } +revive-solidity = { workspace = true } +revive-differential = { workspace = true } +revive-llvm-context = { workspace = true } +revive-common = { workspace = true } +revive-runner = { workspace = true } [dev-dependencies] sha1 = { workspace = true } diff --git a/crates/integration/codesize.json b/crates/integration/codesize.json index 22dd275..868c594 100644 --- a/crates/integration/codesize.json +++ b/crates/integration/codesize.json @@ -1,10 +1,10 @@ { - "Baseline": 934, - "Computation": 4360, - "DivisionArithmetics": 39824, - "ERC20": 52825, - "Events": 1749, - "FibonacciIterative": 2973, - "Flipper": 3563, - "SHA1": 32623 + "Baseline": 967, + "Computation": 4022, + "DivisionArithmetics": 31787, + "ERC20": 44233, + "Events": 1743, + "FibonacciIterative": 2927, + "Flipper": 3408, + "SHA1": 26009 } \ No newline at end of file diff --git a/crates/integration/contracts/Baseline.sol b/crates/integration/contracts/Baseline.sol index 4fd3560..3db46ab 100644 --- a/crates/integration/contracts/Baseline.sol +++ b/crates/integration/contracts/Baseline.sol @@ -1,5 +1,20 @@ // SPDX-License-Identifier: MIT +/* runner.json + +{ + "actions": [ + { + "Instantiate": { + "origin": "Alice", + "value": 0 + } + } + ] +} + +*/ + pragma solidity ^0.8; contract Baseline { diff --git a/crates/integration/contracts/Bitwise.sol b/crates/integration/contracts/Bitwise.sol index 7cf581a..0e2d82a 100644 --- a/crates/integration/contracts/Bitwise.sol +++ b/crates/integration/contracts/Bitwise.sol @@ -2,6 +2,31 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Bitwise" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "3fa4f245" + } + } + ] +} +*/ + contract Bitwise { function opByte(uint i, uint x) public payable returns (uint ret) { assembly { diff --git a/crates/integration/contracts/Block.sol b/crates/integration/contracts/Block.sol index d4d9328..e078d48 100644 --- a/crates/integration/contracts/Block.sol +++ b/crates/integration/contracts/Block.sol @@ -2,12 +2,49 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Block" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "8381f58a" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b80777ea" + } + } + ] +} +*/ + contract Block { function timestamp() public view returns (uint ret) { ret = block.timestamp; } function number() public view returns (uint ret) { - ret = block.number; + if (block.number == 0) { + ret = 1; + } else { + ret = block.number; + } } } diff --git a/crates/integration/contracts/Call.sol b/crates/integration/contracts/Call.sol index 05bfcd1..77ff01d 100644 --- a/crates/integration/contracts/Call.sol +++ b/crates/integration/contracts/Call.sol @@ -2,19 +2,57 @@ pragma solidity ^0.8; -contract Call { - function value_transfer(address payable destination) public payable { - destination.transfer(msg.value); - } +/* runner.json +{ + "differential": true, + "actions": [ + { + "Upload": { + "code": { + "Solidity": { + "contract": "Callee" + } + } + } + }, + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Caller" + } + }, + "value": 123 + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "5a6535fc00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004cafebabe00000000000000000000000000000000000000000000000000000000" + } + } + ] +} +*/ +contract Callee { function echo(bytes memory payload) public pure returns (bytes memory) { return payload; } - function call( - address callee, - bytes memory payload - ) public pure returns (bytes memory) { - return Call(callee).echo(payload); + receive() external payable {} +} + +contract Caller { + constructor() payable { + Callee callee = new Callee(); + payable(address(callee)).transfer(msg.value); + } + + function call(bytes memory payload) public returns (bytes memory) { + Callee callee = new Callee(); + return callee.echo(payload); } } diff --git a/crates/integration/contracts/Computation.sol b/crates/integration/contracts/Computation.sol index 3ba4dcd..2f40215 100644 --- a/crates/integration/contracts/Computation.sol +++ b/crates/integration/contracts/Computation.sol @@ -2,6 +2,44 @@ pragma solidity ^0.8; +/* runner.json +{ + "actions": [ + { + "Instantiate": {} + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "0f760610000000000000000000000000000000000000000000000000000000000000000d" + } + }, + { + "VerifyCall": { + "success": true, + "output": "000000000000000000000000000000000000000000000000000000000000005b" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "00261b660000000000000000000000000000000000000000000000000000000000000005" + } + }, + { + "VerifyCall": { + "success": true, + "output": "00000000000000000000000000000000000000000000000000000000000003b1" + } + } + ] +} +*/ + contract Computation { function triangle_number(int64 n) public pure returns (int64 sum) { unchecked { diff --git a/crates/integration/contracts/Context.sol b/crates/integration/contracts/Context.sol index 936da23..ca9fa22 100644 --- a/crates/integration/contracts/Context.sol +++ b/crates/integration/contracts/Context.sol @@ -2,6 +2,47 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Context" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "846a1ee1" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "fc9c8d39" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "3af973b1" + } + } + ] +} +*/ + contract Context { function address_this() public view returns (address ret) { ret = address(this); @@ -10,4 +51,12 @@ contract Context { function caller() public view returns (address ret) { ret = msg.sender; } + + function chain_id() public view returns (uint) { + uint256 id; + assembly { + id := chainid() + } + return id; + } } diff --git a/crates/integration/contracts/Create.sol b/crates/integration/contracts/Create.sol index c7e4cef..5a428d6 100644 --- a/crates/integration/contracts/Create.sol +++ b/crates/integration/contracts/Create.sol @@ -1,13 +1,64 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.24; +pragma solidity ^0.8; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Upload": { + "code": { + "Solidity": { + "contract": "CreateA" + } + } + } + }, + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "CreateB" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "value": 10000 + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + } + } + } + ] +} +*/ contract CreateA { - address creator; - - constructor() payable { - creator = msg.sender; - } + constructor() payable {} } contract CreateB { diff --git a/crates/integration/contracts/Crypto.sol b/crates/integration/contracts/Crypto.sol new file mode 100644 index 0000000..7c0937e --- /dev/null +++ b/crates/integration/contracts/Crypto.sol @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.24; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "TestSha3" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "f9fbd5540000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c68656c6c6f20776f726c64210000000000000000000000000000000000000000" + } + } + ] +} +*/ + +contract TestSha3 { + function test(string memory _pre) external payable returns (bytes32) { + bytes32 hash = keccak256(bytes(_pre)); + return bytes32(uint(hash) + 1); + } +} diff --git a/crates/integration/contracts/ERC20.sol b/crates/integration/contracts/ERC20.sol index 5b4dea3..34425f4 100644 --- a/crates/integration/contracts/ERC20.sol +++ b/crates/integration/contracts/ERC20.sol @@ -2,6 +2,32 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Upload": { + "code": { + "Solidity": { + "contract": "ERC20" + } + } + } + }, + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "ERC20Tester" + } + } + } + } + ] +} +*/ + // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/token/ERC20/IERC20.sol interface IERC20 { function totalSupply() external view returns (uint); @@ -72,3 +98,26 @@ contract ERC20 is IERC20 { emit Transfer(msg.sender, address(0), amount); } } + +contract ERC20Tester { + constructor() { + address BOB = address(0xffffffffffffffffffffffffffffffffffffff); + ERC20 token = new ERC20(); + assert(token.decimals() == 18); + + token.mint(300); + assert(token.balanceOf(address(this)) == 300); + token.transfer(BOB, 100); + assert(token.balanceOf(address(this)) == 200); + assert(token.balanceOf(BOB) == 100); + + token.approve(address(this), 100); + + token.transferFrom(address(this), BOB, 100); + assert(token.balanceOf(BOB) == 200); + assert(token.balanceOf(address(this)) == 100); + + token.burn(100); + assert(token.balanceOf(address(this)) == 0); + } +} diff --git a/crates/integration/contracts/Events.sol b/crates/integration/contracts/Events.sol index d52064b..8d88f1d 100644 --- a/crates/integration/contracts/Events.sol +++ b/crates/integration/contracts/Events.sol @@ -2,6 +2,39 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Events" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "4d43bec90000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "4d43bec9000000000000000000000000000000000000000000000000000000000000007b" + } + } + ] +} +*/ + contract Events { event A() anonymous; event E(uint, uint indexed, uint indexed, uint indexed); diff --git a/crates/integration/contracts/ExtCode.sol b/crates/integration/contracts/ExtCode.sol index 7d3223e..2fb089b 100644 --- a/crates/integration/contracts/ExtCode.sol +++ b/crates/integration/contracts/ExtCode.sol @@ -14,4 +14,16 @@ contract ExtCode { ret := codesize() } } + + function ExtCodeHash(address who) public view returns (bytes32 ret) { + assembly { + ret := extcodehash(who) + } + } + + function CodeHash() public view returns (bytes32 ret) { + assembly { + ret := extcodehash(address()) + } + } } diff --git a/crates/integration/contracts/Fibonacci.sol b/crates/integration/contracts/Fibonacci.sol index d8fbc98..c7253ec 100644 --- a/crates/integration/contracts/Fibonacci.sol +++ b/crates/integration/contracts/Fibonacci.sol @@ -2,7 +2,29 @@ pragma solidity ^0.8; -// https://medium.com/coinmonks/fibonacci-in-solidity-8477d907e22a +/* runner.json +{ + "actions": [ + { + "Instantiate": {} + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "6b83dd2e0000000000000000000000000000000000000000000000000000000000000006" + } + }, + { + "VerifyCall": { + "success": true, + "output": "0000000000000000000000000000000000000000000000000000000000000008" + } + } + ] +} +*/ contract FibonacciRecursive { function f(uint n) internal pure returns (uint) { @@ -36,6 +58,7 @@ contract FibonacciIterative { } } +// https://medium.com/coinmonks/fibonacci-in-solidity-8477d907e22a contract FibonacciBinet { function fib3(uint n) external pure returns (uint a) { if (n == 0) { diff --git a/crates/integration/contracts/Immutables.sol b/crates/integration/contracts/Immutables.sol new file mode 100644 index 0000000..01550a5 --- /dev/null +++ b/crates/integration/contracts/Immutables.sol @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Upload": { + "code": { + "Solidity": { + "contract": "ImmutablesTester" + } + } + } + }, + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Immutables" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + } + } + } + ] +} +*/ + +contract ImmutablesTester { + // Read should work in the runtime code + uint public immutable foo; + // Read should work in the runtime code + uint public immutable bar; + // Read should work in the runtime code + uint public immutable zoo; + + // Assign and read should work in the constructor + constructor(uint _foo) payable { + foo = _foo; + bar = foo + 1; + zoo = bar + 2; + + assert(zoo == _foo + 3); + } +} + +contract Immutables { + fallback() external { + ImmutablesTester tester = new ImmutablesTester(127); + + assert(tester.foo() == 127); + assert(tester.bar() == tester.foo() + 1); + assert(tester.zoo() == tester.bar() + 2); + } +} diff --git a/crates/integration/contracts/MCopy.sol b/crates/integration/contracts/MCopy.sol index 03431fa..4d746c7 100644 --- a/crates/integration/contracts/MCopy.sol +++ b/crates/integration/contracts/MCopy.sol @@ -2,6 +2,31 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "MCopy" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "0ee188b0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000030102030000000000000000000000000000000000000000000000000000000000" + } + } + ] +} +*/ + contract MCopy { function memcpy(bytes memory payload) public pure returns (bytes memory) { return payload; diff --git a/crates/integration/contracts/MSize.sol b/crates/integration/contracts/MSize.sol index 3500f4b..5fb2415 100644 --- a/crates/integration/contracts/MSize.sol +++ b/crates/integration/contracts/MSize.sol @@ -2,6 +2,40 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "MSize", + "solc_optimizer": false + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "f016832c" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "f4a63aa5" + } + } + ] +} +*/ + contract MSize { uint[] public data; diff --git a/crates/integration/contracts/MStore8.sol b/crates/integration/contracts/MStore8.sol new file mode 100644 index 0000000..e238fa8 --- /dev/null +++ b/crates/integration/contracts/MStore8.sol @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "MStore8" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000001" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000002" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad42100000000000000000000000000000000000000000000000000000000000000ff" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000100" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000101" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad4210000000000000000000000000000000000000000000000000000000000000102" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad42100000000000000000000000000000000000000000000000000000000075bcd15" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "b09ad421ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + } + ] +} +*/ + +contract MStore8 { + function mStore8(uint value) public pure returns (uint256 word) { + assembly { + mstore8(0x80, value) + word := mload(0x80) + } + } +} diff --git a/crates/integration/contracts/ReturnDataOob.sol b/crates/integration/contracts/ReturnDataOob.sol new file mode 100644 index 0000000..5137cd2 --- /dev/null +++ b/crates/integration/contracts/ReturnDataOob.sol @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Upload": { + "code": { + "Solidity": { + "contract": "Callee" + } + } + } + }, + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "ReturnDataOob" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + } + } + } + ] +} +*/ + +contract Callee { + function echo(bytes memory payload) public pure returns (bytes memory) { + return payload; + } +} + +contract ReturnDataOob { + fallback() external { + new Callee().echo(hex"1234"); + assembly { + let pos := mload(64) + let size := add(returndatasize(), 1) + returndatacopy(pos, 0, size) + } + } +} diff --git a/crates/integration/contracts/SHA1.sol b/crates/integration/contracts/SHA1.sol index db116e5..cac1563 100644 --- a/crates/integration/contracts/SHA1.sol +++ b/crates/integration/contracts/SHA1.sol @@ -1,6 +1,31 @@ // SPDX-License-Identifier: BSD-2-Clause pragma solidity ^0.8.4; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "SHA1" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "1605782b00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000200ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + } + ] +} +*/ + contract SHA1 { function sha1(bytes memory data) public pure returns (bytes20 ret) { assembly { diff --git a/crates/integration/contracts/Storage.sol b/crates/integration/contracts/Storage.sol index b0c474b..8ff549e 100644 --- a/crates/integration/contracts/Storage.sol +++ b/crates/integration/contracts/Storage.sol @@ -2,13 +2,54 @@ pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Storage" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "fabc9efaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "558b9f9bffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + } + } + ] +} +*/ + contract Storage { function transient(uint value) public returns (uint ret) { assembly { - let slot := 123 + let slot := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 tstore(slot, value) let success := call(0, 0, 0, 0, 0, 0, 0) ret := tload(slot) } } + + function persistent(uint value) public returns (uint ret) { + assembly { + let slot := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 + sstore(slot, value) + ret := sload(slot) + } + } } diff --git a/crates/integration/contracts/Transaction.sol b/crates/integration/contracts/Transaction.sol new file mode 100644 index 0000000..2455f70 --- /dev/null +++ b/crates/integration/contracts/Transaction.sol @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Upload": { + "code": { + "Solidity": { + "contract": "TransactionOrigin" + } + } + } + }, + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "TransactionTester" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "f8a8fd6d" + } + } + ] +} +*/ + +contract TransactionTester { + constructor() payable { + assert(tx.origin == new TransactionOrigin().test()); + } + + function test() public payable returns (address ret) { + ret = tx.origin; + } +} + +contract TransactionOrigin { + function test() public payable returns (address ret) { + assert(msg.sender != tx.origin); + + ret = tx.origin; + } +} diff --git a/crates/integration/contracts/Transfer.sol b/crates/integration/contracts/Transfer.sol new file mode 100644 index 0000000..84c7810 --- /dev/null +++ b/crates/integration/contracts/Transfer.sol @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Transfer" + } + }, + "value": 11 + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "1c8d16b30000000000000000000000000303030303030303030303030303030303030303000000000000000000000000000000000000000000000000000000000000000a" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "fb9e8d0500000000000000000000000003030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000001" + } + } + ] +} +*/ + +contract Transfer { + constructor() payable { + transfer_self(msg.value); + } + + function address_self() internal view returns (address payable) { + return payable(address(this)); + } + + function transfer_self(uint _amount) public payable { + transfer_to(address_self(), _amount); + } + + function transfer_to(address payable _dest, uint _amount) public payable { + _dest.transfer(_amount); + } +} diff --git a/crates/integration/contracts/Value.sol b/crates/integration/contracts/Value.sol index 5fa6bd8..95533e6 100644 --- a/crates/integration/contracts/Value.sol +++ b/crates/integration/contracts/Value.sol @@ -1,13 +1,66 @@ // SPDX-License-Identifier: MIT - pragma solidity ^0.8; +/* runner.json +{ + "differential": true, + "actions": [ + { + "Upload": { + "code": { + "Solidity": { + "contract": "ValueTester" + } + } + } + }, + { + "Instantiate": { + "value": 1024, + "code": { + "Solidity": { + "contract": "Value" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "value": 123, + "data": "3fa4f245" + } + } + ] +} +*/ + +contract ValueTester { + constructor() payable {} + + function balance_self() public view returns (uint ret) { + ret = address(this).balance; + } +} + contract Value { + constructor() payable { + ValueTester tester = new ValueTester{value: msg.value}(); + + // own account + assert(address(this).balance == 0); + + // tester account + assert(address(tester).balance == msg.value); + assert(tester.balance_self() == msg.value); + + // non-existant account + assert(address(0xdeadbeef).balance == 0); + } + function value() public payable returns (uint ret) { ret = msg.value; } - - function balance_of(address _address) public view returns (uint ret) { - ret = _address.balance; - } } diff --git a/crates/integration/contracts/flipper.sol b/crates/integration/contracts/flipper.sol index 08c48c3..0c2ef61 100644 --- a/crates/integration/contracts/flipper.sol +++ b/crates/integration/contracts/flipper.sol @@ -1,6 +1,44 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8; +/* runner.json +{ + "actions": [ + { + "Instantiate": { + "data": "0000000000000000000000000000000000000000000000000000000000000001" + } + }, + { + "VerifyStorage": { + "contract": { + "Instantiated": 0 + }, + "key": "0000000000000000000000000000000000000000000000000000000000000000", + "expected": "0100000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "cde4efa9" + } + }, + { + "VerifyStorage": { + "contract": { + "Instantiated": 0 + }, + "key": "0000000000000000000000000000000000000000000000000000000000000000", + "expected": "0000000000000000000000000000000000000000000000000000000000000000" + } + } + ] +} +*/ + contract Flipper { bool coin; diff --git a/crates/integration/contracts/mStore8.sol b/crates/integration/contracts/mStore8.sol deleted file mode 100644 index 3be7193..0000000 --- a/crates/integration/contracts/mStore8.sol +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8; - -contract MStore8 { - function mStore8(uint value) public pure returns (uint256 word) { - assembly { - mstore8(0x80, value) - word := mload(0x80) - } - } -} diff --git a/crates/integration/src/cases.rs b/crates/integration/src/cases.rs index 15100c2..7a141d8 100644 --- a/crates/integration/src/cases.rs +++ b/crates/integration/src/cases.rs @@ -1,7 +1,7 @@ -use alloy_primitives::{Address, I256, U256}; +use alloy_primitives::{Address, Bytes, I256, U256}; use alloy_sol_types::{sol, SolCall, SolConstructor}; -use crate::mock_runtime::{CallOutput, State}; +use revive_solidity::test_utils::*; #[derive(Clone)] pub struct Contract { @@ -11,45 +11,90 @@ pub struct Contract { pub calldata: Vec, } +macro_rules! case { + // Arguments: + // 1. The file name, expect to live under "../contracts/" + // 2. The Solidity contract name + // 3. The derived Solidity function call name + // 4. The method name on [Contract] + // 5. Any parameters to the Solidity functions + ($file_name:literal, $contract_name:ident, $contract_method:ident, $method_name:ident, $( $v:ident: $t:ty ),* ) => { + impl Contract { + pub fn $method_name($($v: $t),*) -> Self { + let code = include_str!(concat!("../contracts/", $file_name)); + let args = $contract_name::$contract_method::new(($($v,)*)).abi_encode(); + let name = stringify!($contract_name); + Contract::build(args, name, code) + } + } + }; + + // Arguments: + // 1. The file name, expect to live under "../contracts/" + // 2. The Solidity contract name + // 3. Raw Calldata + // 4. The method name on [Contract] + ($file_name:literal, $contract_name:literal, $calldata:expr, $method_name:ident) => { + impl Contract { + pub fn $method_name() -> Self { + let code = include_str!(concat!("../contracts/", $file_name)); + Contract::build($calldata, $contract_name, code) + } + } + }; +} + +case!("Create.sol", "CreateA", vec![0; 4], create_a); +case!("Create.sol", "CreateB", vec![0; 4], create_b); + sol!(contract Baseline { function baseline() public payable; }); +case!("Baseline.sol", Baseline, baselineCall, baseline,); sol!(contract Flipper { constructor (bool); function flip() public; }); +case!("flipper.sol", Flipper, flipCall, flipper,); +case!("flipper.sol", Flipper, constructorCall, flipper_constructor, coin: bool); sol!(contract Computation { function odd_product(int32 n) public pure returns (int64); function triangle_number(int64 n) public pure returns (int64 sum); }); +case!("Computation.sol", Computation, odd_productCall, odd_product, n: i32); +case!("Computation.sol", Computation, triangle_numberCall, triangle_number, n: i64); sol!( contract FibonacciRecursive { function fib3(uint n) public pure returns (uint); } ); +case!("Fibonacci.sol", FibonacciRecursive, fib3Call, fib_recursive, n: U256); sol!( contract FibonacciIterative { function fib3(uint n) external pure returns (uint b); } ); +case!("Fibonacci.sol", FibonacciIterative, fib3Call, fib_iterative, n: U256); sol!( contract FibonacciBinet { function fib3(uint n) external pure returns (uint a); } ); +case!("Fibonacci.sol", FibonacciBinet, fib3Call, fib_binet, n: U256); sol!( contract SHA1 { function sha1(bytes memory data) public pure returns (bytes20 ret); } ); +case!("SHA1.sol", SHA1, sha1Call, sha1, pre: Bytes); sol!( - interface IERC20 { + contract ERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); @@ -73,6 +118,7 @@ sol!( event Approval(address indexed owner, address indexed spender, uint value); } ); +case!("ERC20.sol", ERC20, totalSupplyCall, erc20,); sol!( contract Block { @@ -81,6 +127,8 @@ sol!( function number() public view returns (uint ret); } ); +case!("Block.sol", Block, numberCall, block_number,); +case!("Block.sol", Block, timestampCall, block_timestamp,); sol!( contract Context { @@ -89,6 +137,8 @@ sol!( function caller() public pure returns (address); } ); +case!("Context.sol", Context, address_thisCall, context_address,); +case!("Context.sol", Context, callerCall, context_caller,); sol!( contract DivisionArithmetics { @@ -101,12 +151,17 @@ sol!( function smod(int n, int d) public pure returns (int r); } ); +case!("DivisionArithmetics.sol", DivisionArithmetics, divCall, division_arithmetics_div, n: U256, d: U256); +case!("DivisionArithmetics.sol", DivisionArithmetics, sdivCall, division_arithmetics_sdiv, n: I256, d: I256); +case!("DivisionArithmetics.sol", DivisionArithmetics, modCall, division_arithmetics_mod, n: U256, d: U256); +case!("DivisionArithmetics.sol", DivisionArithmetics, smodCall, division_arithmetics_smod, n: I256, d: I256); sol!( contract MStore8 { function mStore8(uint value) public pure returns (uint256 word); } ); +case!("MStore8.sol", MStore8, mStore8Call, mstore8, value: U256); sol!( contract Events { @@ -116,26 +171,30 @@ sol!( function emitEvent(uint topics) public; } ); - -sol!( - contract CreateB { - fallback() external payable; - } -); +case!("Events.sol", Events, emitEventCall, event, topics: U256); sol!( contract ExtCode { function ExtCodeSize(address who) public view returns (uint ret); function CodeSize() public pure returns (uint ret); + + function ExtCodeHash(address who) public view returns (bytes32 ret); + + function CodeHash() public view returns (bytes32 ret); } ); +case!("ExtCode.sol", ExtCode, ExtCodeSizeCall, ext_code_size, address: Address); +case!("ExtCode.sol", ExtCode, CodeSizeCall, code_size,); +case!("ExtCode.sol", ExtCode, ExtCodeHashCall, ext_code_hash, address: Address); +case!("ExtCode.sol", ExtCode, CodeHashCall, code_hash,); sol!( contract MCopy { function memcpy(bytes memory payload) public pure returns (bytes memory); } ); +case!("MCopy.sol", MCopy, memcpyCall, memcpy, payload: Bytes); sol!( contract Call { @@ -149,420 +208,47 @@ sol!( ) public payable returns (bytes memory); } ); +case!("Call.sol", Call, value_transferCall, call_value_transfer, destination: Address); +case!("Call.sol", Call, callCall, call_call, destination: Address, payload: Bytes); +case!("Call.sol", "Call", vec![], call_constructor); sol!( contract Value { function balance_of(address _address) public view returns (uint ret); + function balance_self() public view returns (uint ret); } ); +case!("Value.sol", Value, balance_ofCall, value_balance_of, address: Address); +case!("Value.sol", Value, balance_selfCall, value_balance_self,); sol!( contract Bitwise { function opByte(uint i, uint x) public payable returns (uint ret); } ); +case!("Bitwise.sol", Bitwise, opByteCall, bitwise_byte, index: U256, value: U256); sol!( contract Storage { function transient(uint value) public returns (uint ret); } ); +case!("Storage.sol", Storage, transientCall, storage_transient, value: U256); impl Contract { - /// Execute the contract. - /// - /// Useful helper if the contract state can be ignored, - /// as it spares the deploy transaciton. - /// - /// - Inserts an account with given `code` into a new state. - /// - Callee and caller account will be `Transaction::default_address()`. - /// - Sets the calldata. - /// - Doesn't execute the constructor or deploy code. - /// - Calls the "call" export on a default backend config. - pub fn execute(&self) -> (State, CallOutput) { - State::default() - .transaction() - .with_default_account(&self.pvm_runtime) - .calldata(self.calldata.clone()) - .call() - } - - pub fn baseline() -> Self { - let code = include_str!("../contracts/Baseline.sol"); - let name = "Baseline"; - + fn build(calldata: Vec, name: &'static str, code: &str) -> Self { Self { name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Baseline::baselineCall::new(()).abi_encode(), - } - } - - pub fn odd_product(n: i32) -> Self { - let code = include_str!("../contracts/Computation.sol"); - let name = "Computation"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Computation::odd_productCall::new((n,)).abi_encode(), - } - } - - pub fn triangle_number(n: i64) -> Self { - let code = include_str!("../contracts/Computation.sol"); - let name = "Computation"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Computation::triangle_numberCall::new((n,)).abi_encode(), - } - } - - pub fn fib_recursive(n: u32) -> Self { - let code = include_str!("../contracts/Fibonacci.sol"); - let name = "FibonacciRecursive"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: FibonacciRecursive::fib3Call::new((U256::from(n),)).abi_encode(), - } - } - - pub fn fib_iterative(n: u32) -> Self { - let code = include_str!("../contracts/Fibonacci.sol"); - let name = "FibonacciIterative"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: FibonacciIterative::fib3Call::new((U256::from(n),)).abi_encode(), - } - } - - pub fn fib_binet(n: u32) -> Self { - let code = include_str!("../contracts/Fibonacci.sol"); - let name = "FibonacciBinet"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: FibonacciBinet::fib3Call::new((U256::from(n),)).abi_encode(), - } - } - - pub fn sha1(pre: Vec) -> Self { - let code = include_str!("../contracts/SHA1.sol"); - let name = "SHA1"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: SHA1::sha1Call::new((pre,)).abi_encode(), - } - } - - pub fn flipper() -> Self { - let code = include_str!("../contracts/flipper.sol"); - let name = "Flipper"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Flipper::flipCall::new(()).abi_encode(), - } - } - - pub fn flipper_constructor(coin: bool) -> Self { - let code = include_str!("../contracts/flipper.sol"); - let name = "Flipper"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Flipper::constructorCall::new((coin,)).abi_encode(), - } - } - - pub fn erc20() -> Self { - let code = include_str!("../contracts/ERC20.sol"); - let name = "ERC20"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: IERC20::totalSupplyCall::new(()).abi_encode(), - } - } - - pub fn block_number() -> Self { - let code = include_str!("../contracts/Block.sol"); - let name = "Block"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Block::numberCall::new(()).abi_encode(), - } - } - - pub fn block_timestamp() -> Self { - let code = include_str!("../contracts/Block.sol"); - let name = "Block"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Block::timestampCall::new(()).abi_encode(), - } - } - - pub fn context_address() -> Self { - let code = include_str!("../contracts/Context.sol"); - let name = "Context"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Context::address_thisCall::new(()).abi_encode(), - } - } - - pub fn context_caller() -> Self { - let code = include_str!("../contracts/Context.sol"); - let name = "Context"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Context::callerCall::new(()).abi_encode(), - } - } - - pub fn division_arithmetics_div(n: U256, d: U256) -> Self { - let code = include_str!("../contracts/DivisionArithmetics.sol"); - let name = "DivisionArithmetics"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: DivisionArithmetics::divCall::new((n, d)).abi_encode(), - } - } - - pub fn division_arithmetics_sdiv(n: I256, d: I256) -> Self { - let code = include_str!("../contracts/DivisionArithmetics.sol"); - let name = "DivisionArithmetics"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: DivisionArithmetics::sdivCall::new((n, d)).abi_encode(), - } - } - - pub fn division_arithmetics_mod(n: U256, d: U256) -> Self { - let code = include_str!("../contracts/DivisionArithmetics.sol"); - let name = "DivisionArithmetics"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: DivisionArithmetics::modCall::new((n, d)).abi_encode(), - } - } - - pub fn division_arithmetics_smod(n: I256, d: I256) -> Self { - let code = include_str!("../contracts/DivisionArithmetics.sol"); - let name = "DivisionArithmetics"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: DivisionArithmetics::smodCall::new((n, d)).abi_encode(), - } - } - - pub fn mstore8(value: U256) -> Self { - let code = include_str!("../contracts/mStore8.sol"); - let name = "MStore8"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: MStore8::mStore8Call::new((value,)).abi_encode(), - } - } - - pub fn event(topics: U256) -> Self { - let code = include_str!("../contracts/Events.sol"); - let name = "Events"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Events::emitEventCall::new((topics,)).abi_encode(), - } - } - - pub fn create_a() -> Self { - let code = include_str!("../contracts/Create.sol"); - let name = "CreateA"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: vec![0; 4], - } - } - - pub fn create_b() -> Self { - let code = include_str!("../contracts/Create.sol"); - let name = "CreateB"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: vec![0; 4], - } - } - - pub fn ext_code_size(address: Address) -> Self { - let code = include_str!("../contracts/ExtCode.sol"); - let name = "ExtCode"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: ExtCode::ExtCodeSizeCall::new((address,)).abi_encode(), - } - } - - pub fn code_size() -> Self { - let code = include_str!("../contracts/ExtCode.sol"); - let name = "ExtCode"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: ExtCode::CodeSizeCall::new(()).abi_encode(), - } - } - - pub fn memcpy(payload: Vec) -> Self { - let code = include_str!("../contracts/MCopy.sol"); - let name = "MCopy"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: MCopy::memcpyCall::new((payload,)).abi_encode(), - } - } - - pub fn call_value_transfer(destination: Address) -> Self { - let code = include_str!("../contracts/Call.sol"); - let name = "Call"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Call::value_transferCall::new((destination,)).abi_encode(), - } - } - - pub fn call_call(callee: Address, payload: Vec) -> Self { - let code = include_str!("../contracts/Call.sol"); - let name = "Call"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Call::callCall::new((callee, payload)).abi_encode(), - } - } - - pub fn call_constructor() -> Self { - let code = include_str!("../contracts/Call.sol"); - let name = "Call"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Default::default(), - } - } - - pub fn value_balance_of(address: Address) -> Self { - let code = include_str!("../contracts/Value.sol"); - let name = "Value"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Value::balance_ofCall::new((address,)).abi_encode(), - } - } - - pub fn bitwise_byte(index: U256, value: U256) -> Self { - let code = include_str!("../contracts/Bitwise.sol"); - let name = "Bitwise"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Bitwise::opByteCall::new((index, value)).abi_encode(), - } - } - - pub fn storage_transient(value: U256) -> Self { - let code = include_str!("../contracts/Storage.sol"); - let name = "Storage"; - - Self { - name, - evm_runtime: crate::compile_evm_bin_runtime(name, code), - pvm_runtime: crate::compile_blob(name, code), - calldata: Storage::transientCall::new((value,)).abi_encode(), + evm_runtime: compile_evm_bin_runtime(name, code), + pvm_runtime: compile_blob(name, code), + calldata, } } } #[cfg(test)] mod tests { - use alloy_primitives::U256; + use alloy_primitives::{Bytes, U256}; use rayon::iter::{IntoParallelIterator, ParallelIterator}; use serde::{de::Deserialize, Serialize}; use std::{collections::BTreeMap, fs::File}; @@ -605,9 +291,9 @@ mod tests { Contract::baseline as fn() -> Contract, Contract::flipper as fn() -> Contract, (|| Contract::odd_product(0)) as fn() -> Contract, - (|| Contract::fib_iterative(0)) as fn() -> Contract, + (|| Contract::fib_iterative(U256::ZERO)) as fn() -> Contract, Contract::erc20 as fn() -> Contract, - (|| Contract::sha1(Vec::new())) as fn() -> Contract, + (|| Contract::sha1(Bytes::new())) as fn() -> Contract, (|| Contract::division_arithmetics_div(U256::ZERO, U256::ZERO)) as fn() -> Contract, (|| Contract::event(U256::ZERO)) as fn() -> Contract, ] diff --git a/crates/integration/src/lib.rs b/crates/integration/src/lib.rs index 98b200e..3b9902c 100644 --- a/crates/integration/src/lib.rs +++ b/crates/integration/src/lib.rs @@ -1,150 +1,4 @@ -use alloy_primitives::{Address, U256}; -use cases::Contract; -use mock_runtime::{CallOutput, State}; - -use crate::mock_runtime::{Event, ReturnFlags}; - -use once_cell::sync::Lazy; -use std::{collections::HashMap, sync::Mutex}; - pub mod cases; -pub mod mock_runtime; #[cfg(test)] mod tests; - -pub(crate) static PVM_BLOB_CACHE: Lazy>>> = - Lazy::new(Default::default); -pub(crate) static EVM_BLOB_CACHE: Lazy>>> = - Lazy::new(Default::default); - -#[derive(Hash, PartialEq, Eq)] -struct CompiledBlobId { - contract_name: String, - solc_optimizer_enabled: bool, - pipeline: revive_solidity::SolcPipeline, -} - -/// Compile the blob of `contract_name` found in given `source_code`. -/// The `solc` optimizer will be enabled -pub fn compile_blob(contract_name: &str, source_code: &str) -> Vec { - compile_blob_with_options( - contract_name, - source_code, - true, - revive_solidity::SolcPipeline::Yul, - ) -} - -/// Compile the EVM bin-runtime of `contract_name` found in given `source_code`. -/// The `solc` optimizer will be enabled -pub fn compile_evm_bin_runtime(contract_name: &str, source_code: &str) -> Vec { - let pipeline = revive_solidity::SolcPipeline::Yul; - let solc_optimizer_enabled = true; - let id = CompiledBlobId { - contract_name: contract_name.to_owned(), - pipeline, - solc_optimizer_enabled, - }; - - if let Some(blob) = EVM_BLOB_CACHE.lock().unwrap().get(&id) { - return blob.clone(); - } - - let file_name = "contract.sol"; - let contracts = revive_solidity::test_utils::build_solidity_with_options_evm( - [(file_name.into(), source_code.into())].into(), - Default::default(), - None, - pipeline, - solc_optimizer_enabled, - ) - .expect("source should compile"); - let bin_runtime = &contracts - .get(contract_name) - .unwrap_or_else(|| panic!("contract '{}' didn't produce bin-runtime", contract_name)) - .object; - - let blob = hex::decode(bin_runtime).expect("bin-runtime shold be hex encoded"); - - EVM_BLOB_CACHE.lock().unwrap().insert(id, blob.clone()); - - blob -} - -/// Compile the blob of `contract_name` found in given `source_code`. -pub fn compile_blob_with_options( - contract_name: &str, - source_code: &str, - solc_optimizer_enabled: bool, - pipeline: revive_solidity::SolcPipeline, -) -> Vec { - let id = CompiledBlobId { - contract_name: contract_name.to_owned(), - solc_optimizer_enabled, - pipeline, - }; - - if let Some(blob) = PVM_BLOB_CACHE.lock().unwrap().get(&id) { - return blob.clone(); - } - - let file_name = "contract.sol"; - let contracts = revive_solidity::test_utils::build_solidity_with_options( - [(file_name.into(), source_code.into())].into(), - Default::default(), - None, - pipeline, - revive_llvm_context::OptimizerSettings::cycles(), - solc_optimizer_enabled, - ) - .expect("source should compile") - .contracts - .expect("source should contain at least one contract"); - - let bytecode = contracts[file_name][contract_name] - .evm - .as_ref() - .expect("source should produce EVM output") - .bytecode - .as_ref() - .expect("source should produce assembly text") - .object - .as_str(); - let blob = hex::decode(bytecode).expect("hex encoding should always be valid"); - - PVM_BLOB_CACHE.lock().unwrap().insert(id, blob.clone()); - - blob -} - -pub fn assert_success(contract: &Contract, differential: bool) -> (State, CallOutput) { - let (state, output) = contract.execute(); - assert_eq!(output.flags, ReturnFlags::Success); - - if differential { - let evm = - revive_differential::prepare(contract.evm_runtime.clone(), contract.calldata.clone()); - let (evm_output, evm_log) = revive_differential::execute(evm); - - assert_eq!(output.data.clone(), evm_output); - assert_eq!(output.events.len(), evm_log.len()); - assert_eq!( - output.events, - evm_log - .iter() - .map(|log| Event { - address: Address::from_slice(log.address.as_bytes()), - data: log.data.clone(), - topics: log - .topics - .iter() - .map(|topic| U256::from_be_bytes(topic.0)) - .collect(), - }) - .collect::>() - ); - } - - (state, output) -} diff --git a/crates/integration/src/mock_runtime.rs b/crates/integration/src/mock_runtime.rs deleted file mode 100644 index e89bdb5..0000000 --- a/crates/integration/src/mock_runtime.rs +++ /dev/null @@ -1,1018 +0,0 @@ -//! Mock environment used for integration tests. -use std::collections::HashMap; - -use alloy_primitives::{keccak256, Address, Keccak256, B256, U256}; -use polkavm::{ - Caller, Config, Engine, ExportIndex, GasMeteringKind, Instance, Linker, Module, ModuleConfig, - ProgramBlob, Trap, -}; -use revive_llvm_context::polkavm_const::runtime_api; - -/// The mocked blockchain account. -#[derive(Debug, Default, Clone)] -pub struct Account { - pub value: U256, - pub contract: Option, - pub storage: HashMap, -} - -/// Emitted event data. -#[derive(Debug, Default, Clone, PartialEq)] -pub struct Event { - pub address: Address, - pub data: Vec, - pub topics: Vec, -} - -/// The result of the contract call. -#[derive(Debug, Default, Clone)] -pub struct CallOutput { - /// The return flags. - pub flags: ReturnFlags, - /// The contract call output. - pub data: Vec, - /// The emitted events. - pub events: Vec, -} - -/// The contract blob export to be called. -#[derive(Clone, Debug, Default)] -enum Export { - #[default] - Call, - Deploy(B256), -} - -/// Possible contract call return flags. -#[derive(Debug, Default, Clone, PartialEq)] -#[repr(u32)] -pub enum ReturnFlags { - /// The contract execution returned normally. - Success = 0, - /// The contract execution returned normally but state changes should be reverted. - Revert = 1, - /// The contract trapped unexpectedly during execution. - #[default] - Trap = u32::MAX, -} - -impl From for ReturnFlags { - fn from(value: u32) -> Self { - match value { - 0 => Self::Success, - 1 => Self::Revert, - u32::MAX => Self::Trap, - _ => panic!("invalid return flag: {value}"), - } - } -} - -/// The local context inside the call stack. -#[derive(Debug, Clone)] -struct Frame { - /// The account that is being executed. - callee: Address, - /// The caller account. - caller: Address, - /// The value transferred with this transaction. - callvalue: U256, - /// The calldata for the contract execution. - input: Vec, - // The contract call output. - output: CallOutput, - /// The export to call. - export: Export, - /// The returndata from the last contract call. - returndata: Vec, -} - -impl Default for Frame { - fn default() -> Self { - Self { - callee: Transaction::default_address(), - caller: Transaction::default_address(), - callvalue: Default::default(), - input: Default::default(), - output: Default::default(), - export: Default::default(), - returndata: Default::default(), - } - } -} - -/// The transaction can modify the state by calling contracts. -/// -/// Use the [TransactionBuilder] to create new transactions. -#[derive(Default, Clone, Debug)] -pub struct Transaction { - state: State, - transient_state: State, - stack: Vec, -} - -impl Transaction { - pub const CALL_STACK_SIZE: usize = 1024; - - pub fn default_address() -> Address { - Address::default().create2(B256::default(), keccak256([]).0) - } - - fn top_frame(&self) -> &Frame { - self.stack.last().expect("transactions should have a frame") - } - - fn top_frame_mut(&mut self) -> &mut Frame { - self.stack - .last_mut() - .expect("transactions should have a frame") - } - - fn top_account_mut(&mut self) -> &mut Account { - let account = self.top_frame_mut().callee; - self.state - .accounts - .get_mut(&account) - .unwrap_or_else(|| panic!("callee has no associated account: {account}")) - } - - fn create2(&self, salt: B256, blob_hash: B256) -> Address { - self.top_frame().callee.create2(salt, blob_hash) - } - - fn transient_account_mut(&mut self) -> &mut Account { - let address = self.top_frame().callee; - let account = self - .transient_state - .accounts_mut() - .entry(address) - .or_default(); - account - } -} - -/// Helper to create valid transactions. -#[derive(Default, Clone, Debug)] -pub struct TransactionBuilder { - context: Transaction, - state_before: State, -} - -impl TransactionBuilder { - /// Set the caller account. - pub fn caller(mut self, account: Address) -> Self { - self.context.top_frame_mut().caller = account; - self - } - - /// Set the callee account. - pub fn callee(mut self, account: Address) -> Self { - self.context.top_frame_mut().callee = account; - self - } - - /// Set the transferred callvalue. - pub fn callvalue(mut self, amount: U256) -> Self { - self.context.top_frame_mut().callvalue = amount; - self - } - - /// Set the calldata. - pub fn calldata(mut self, data: Vec) -> Self { - self.context.top_frame_mut().input = data; - self - } - - /// Helper to setup the transaction for deploy code. - /// - Simulate an upload of the `code` - /// - Set the export to `deploy` - /// - Derive address based on the caller and `salt` value - /// - Set the callee to the derived address - /// - Create a new default account at the derived address - pub fn deploy(mut self, code: &[u8], salt: Option) -> Self { - let blob_hash = self.context.state.upload_code(code); - let address = self - .context - .top_frame() - .caller - .create2(salt.unwrap_or_default(), blob_hash); - - self.context.top_frame_mut().export = Export::Deploy(blob_hash); - self.context.top_frame_mut().callee = address; - self.context - .state - .create_account(address, Default::default(), blob_hash); - - self - } - - /// Set the account at [Transaction::default_address] to the given `code`. - /// - /// Useful helper to spare the deploy transaction. - pub fn with_default_account(mut self, code: &[u8]) -> Self { - self.context.state.upload_code(code); - self.context.state.create_account( - Transaction::default_address(), - Default::default(), - keccak256(code), - ); - self - } - - /// Execute the transaction with a default config backend. - /// - /// Reverts any state changes if the contract reverts or the exuection traps. - pub fn call(mut self) -> (State, CallOutput) { - let blob_hash = match self.context.top_frame().export { - Export::Call => self - .context - .top_account_mut() - .contract - .expect("balance transfer"), - Export::Deploy(blob_hash) => blob_hash, - }; - let code = self - .context - .state - .blobs - .get(&blob_hash) - .unwrap_or_else(|| panic!("contract code not found: {blob_hash}")); - let (mut instance, _) = prepare(code, None); - let export = match self.context.top_frame().export { - Export::Call => runtime_api::exports::CALL, - Export::Deploy(_) => runtime_api::exports::DEPLOY, - }; - let export = instance.module().lookup_export(export).unwrap(); - self.call_on(&mut instance, export) - } - - /// Execute the transaction on a given instance and export. - /// The `instance` and `export` are expected to match that of the `Transaction`. - - /// Reverts any state changes if the contract reverts or the exuection traps. - pub fn call_on( - mut self, - instance: &mut Instance, - export: ExportIndex, - ) -> (State, CallOutput) { - let mut state_args = polkavm::StateArgs::default(); - state_args.set_gas(polkavm::Gas::MAX); - - let callvalue = self.context.top_frame().callvalue; - self.context.top_account_mut().value += callvalue; - - let call_args = polkavm::CallArgs::new(&mut self.context, export); - - init_logs(); - - match instance.call(state_args, call_args) { - Err(polkavm::ExecutionError::Trap(_)) => self.finalize(), - Err(other) => panic!("unexpected error: {other}"), - Ok(_) => panic!("unexpected return"), - } - } - - /// Commits or reverts the state changes based on the call flags. - fn finalize(mut self) -> (State, CallOutput) { - let state = match self.context.top_frame().output.flags { - ReturnFlags::Success => self.context.state, - _ => self.state_before, - }; - let output = self.context.stack.pop().unwrap().output; - (state, output) - } -} - -impl From for TransactionBuilder { - fn from(state: State) -> Self { - TransactionBuilder { - state_before: state.clone(), - context: Transaction { - state, - transient_state: Default::default(), - stack: Default::default(), - }, - } - } -} - -/// The mocked blockchain state. -#[derive(Default, Clone, Debug)] -pub struct State { - blobs: HashMap>, - accounts: HashMap, -} - -impl State { - pub const BLOCK_NUMBER: u64 = 123; - pub const BLOCK_TIMESTAMP: u64 = 456; - - pub fn new_deployed(contract: crate::Contract) -> (Self, Address) { - let (state, output) = State::default() - .transaction() - .deploy(&contract.pvm_runtime, None) - .calldata(contract.calldata) - .call(); - assert_eq!(output.flags, ReturnFlags::Success); - - let address = *state.accounts().keys().next().unwrap(); - - (state, address) - } - - pub fn transaction(self) -> TransactionBuilder { - TransactionBuilder { - state_before: self.clone(), - context: Transaction { - state: self, - transient_state: Default::default(), - stack: vec![Default::default()], - }, - } - } - - pub fn upload_code(&mut self, code: &[u8]) -> B256 { - let blob_hash = keccak256(code); - self.blobs.insert(blob_hash, code.to_vec()); - blob_hash - } - - pub fn assert_storage_key(&self, account: Address, key: U256, expected: U256) { - assert_eq!( - self.accounts - .get(&account) - .unwrap_or_else(|| panic!("unknown account: {account}")) - .storage - .get(&key) - .copied() - .unwrap_or_default(), - expected - ); - } - - pub fn create_account(&mut self, address: Address, value: U256, blob_hash: B256) { - self.accounts.insert( - address, - Account { - value, - contract: Some(blob_hash), - storage: HashMap::new(), - }, - ); - } - - pub fn accounts(&self) -> &HashMap { - &self.accounts - } - - pub fn accounts_mut(&mut self) -> &mut HashMap { - &mut self.accounts - } -} - -fn link_host_functions(engine: &Engine) -> Linker { - let mut linker = Linker::new(engine); - - linker - .func_wrap( - runtime_api::imports::INPUT, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| -> Result<(), Trap> { - let (mut caller, transaction) = caller.split(); - - let input = &transaction.top_frame().input; - assert!(input.len() <= caller.read_u32(out_len_ptr).unwrap() as usize); - - caller.write_memory(out_ptr, input)?; - caller.write_memory(out_len_ptr, &(input.len() as u32).to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::RETURN, - |caller: Caller, - flags: u32, - data_ptr: u32, - data_len: u32| - -> Result<(), Trap> { - let (caller, transaction) = caller.split(); - - let frame = transaction.top_frame_mut(); - frame.output.flags = flags.into(); - frame.output.data = caller.read_memory_into_vec(data_ptr, data_len)?; - - Err(Default::default()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::VALUE_TRANSFERRED, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| -> Result<(), Trap> { - let (mut caller, transaction) = caller.split(); - - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_VALUE, - "spurious output buffer size: {out_len}" - ); - - let value = transaction.top_frame().callvalue.as_le_bytes(); - caller.write_memory(out_ptr, &value)?; - caller.write_memory(out_len_ptr, &(value.len() as u32).to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - "debug_message", - |caller: Caller, str_ptr: u32, str_len: u32| -> Result { - let (caller, _) = caller.split(); - - let data = caller.read_memory_into_vec(str_ptr, str_len)?; - print!("debug_message: {}", String::from_utf8(data).unwrap()); - - Ok(0) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::SET_STORAGE, - |caller: Caller, - transient: u32, - key_ptr: u32, - key_len: u32, - value_ptr: u32, - value_len: u32| - -> Result { - let (caller, transaction) = caller.split(); - - assert_eq!( - key_len as usize, - revive_common::BYTE_LENGTH_WORD, - "storage key must be 32 bytes" - ); - assert_eq!( - value_len as usize, - revive_common::BYTE_LENGTH_WORD, - "storage value must be 32 bytes" - ); - - let key = caller.read_memory_into_vec(key_ptr, key_len)?; - let value = caller.read_memory_into_vec(value_ptr, value_len)?; - - let key = U256::from_le_bytes::<32>(key.try_into().unwrap()); - let value = U256::from_le_bytes::<32>(value.try_into().unwrap()); - - log::info!("set storage {key} = {value}"); - - let storage = if transient == 0 { - &mut transaction.top_account_mut().storage - } else { - &mut transaction.transient_account_mut().storage - }; - storage.insert(key, value); - - Ok(0) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::GET_STORAGE, - |caller: Caller, - transient: u32, - key_ptr: u32, - key_len: u32, - out_ptr: u32, - out_len_ptr: u32| - -> Result { - let (mut caller, transaction) = caller.split(); - - let key = caller.read_memory_into_vec(key_ptr, key_len)?; - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_WORD, - "spurious output buffer size: {out_len}" - ); - - let key = U256::from_le_bytes::<32>(key.try_into().unwrap()); - - let storage = if transient == 0 { - &transaction.top_account_mut().storage - } else { - &transaction.transient_account_mut().storage - }; - let value = storage.get(&key).cloned().unwrap_or_default(); - - log::info!("get storage {key} = {value}"); - - caller.write_memory(out_ptr, &value.to_le_bytes::<32>())?; - caller.write_memory(out_len_ptr, &32u32.to_le_bytes())?; - - Ok(0) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::HASH_KECCAK_256, - |caller: Caller, - input_ptr: u32, - input_len: u32, - out_ptr: u32| - -> Result<(), Trap> { - let (mut caller, _) = caller.split(); - - let pre = caller.read_memory_into_vec(input_ptr, input_len)?; - - let mut hasher = Keccak256::new(); - hasher.update(&pre); - caller.write_memory(out_ptr, &hasher.finalize()[..])?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::NOW, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| { - let (mut caller, _) = caller.split(); - - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_BLOCK_TIMESTAMP, - "spurious output buffer size: {out_len}" - ); - - caller.write_memory(out_ptr, &State::BLOCK_TIMESTAMP.to_le_bytes())?; - caller.write_memory(out_len_ptr, &64u32.to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::BLOCK_NUMBER, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| { - let (mut caller, _) = caller.split(); - - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_BLOCK_NUMBER, - "spurious output buffer size: {out_len}" - ); - - caller.write_memory(out_ptr, &State::BLOCK_NUMBER.to_le_bytes())?; - caller.write_memory(out_len_ptr, &64u32.to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::ADDRESS, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| { - let (mut caller, transaction) = caller.split(); - - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_ETH_ADDRESS, - "spurious output buffer size: {out_len}" - ); - - let address = transaction.top_frame().callee.as_slice(); - caller.write_memory(out_ptr, address)?; - caller.write_memory(out_len_ptr, &(address.len() as u32).to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::CALLER, - |caller: Caller, out_ptr: u32, out_len_ptr: u32| { - let (mut caller, transaction) = caller.split(); - - let out_len = caller.read_u32(out_len_ptr)? as usize; - assert_eq!( - out_len, - revive_common::BYTE_LENGTH_ETH_ADDRESS, - "spurious output buffer size: {out_len}" - ); - - let address = transaction.top_frame().caller.as_slice(); - caller.write_memory(out_ptr, address)?; - caller.write_memory(out_len_ptr, &(address.len() as u32).to_le_bytes())?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::DEPOSIT_EVENT, - |caller: Caller, - topics_ptr: u32, - topics_len: u32, - data_ptr: u32, - data_len: u32| { - let (caller, transaction) = caller.split(); - - let address = transaction.top_frame().callee; - let data = if data_len != 0 { - caller.read_memory_into_vec(data_ptr, data_len)? - } else { - Default::default() - }; - let topics = if topics_len != 0 { - caller - .read_memory_into_vec(topics_ptr, topics_len)? - .chunks(32) - .map(|chunk| U256::from_be_slice(chunk)) - .collect() - } else { - Default::default() - }; - - transaction.top_frame_mut().output.events.push(Event { - address, - data, - topics, - }); - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::INSTANTIATE, - |caller: Caller, argument_ptr: u32| { - let (mut caller, transaction) = caller.split(); - - #[derive(Debug)] - #[repr(packed)] - struct Arguments { - code_hash_ptr: u32, - ref_time_limit: u64, - proof_size_limit: u64, - deposit_ptr: u32, - value_ptr: u32, - input_data_ptr: u32, - input_data_len: u32, - address_ptr: u32, - address_len_ptr: u32, - output_ptr: u32, - output_len_ptr: u32, - salt_ptr: u32, - salt_len: u32, - } - let mut buffer = [0; std::mem::size_of::()]; - caller.read_memory_into_slice(argument_ptr, &mut buffer)?; - let arguments: Arguments = unsafe { std::mem::transmute(buffer) }; - - assert_eq!({ arguments.ref_time_limit }, 0); - assert_eq!({ arguments.proof_size_limit }, 0); - assert_eq!({ arguments.deposit_ptr }, u32::MAX); - assert_eq!({ arguments.output_ptr }, u32::MAX); - assert_eq!({ arguments.output_len_ptr }, u32::MAX); - assert_eq!({ arguments.salt_len }, 32); - - if transaction.stack.len() >= Transaction::CALL_STACK_SIZE { - log::info!("deployment faild: maximum stack depth reached"); - caller.write_memory(arguments.address_ptr, &Address::ZERO.0 .0)?; - return Ok(()); - } - - let blob_hash = caller.read_memory_into_vec(arguments.code_hash_ptr, 32)?; - let blob_hash = B256::from_slice(&blob_hash); - let value = caller.read_memory_into_vec(arguments.value_ptr, 20)?; - let input_data = caller - .read_memory_into_vec(arguments.input_data_ptr, arguments.input_data_len)?; - - let address_len = caller.read_u32(arguments.address_len_ptr)?; - assert_eq!(address_len, 20); - - let salt = caller.read_memory_into_vec(arguments.salt_ptr, arguments.salt_len)?; - let salt = B256::from_slice(&salt); - let address = transaction.create2(salt, blob_hash); - if transaction.state.accounts.contains_key(&address) { - log::info!("deployment failed: address {address} already exists"); - caller.write_memory(arguments.address_ptr, &Address::ZERO.0 .0)?; - return Ok(()); - } - - let amount = U256::from_le_slice(&value); - match transaction.top_account_mut().value.checked_sub(amount) { - Some(deducted) => transaction.top_account_mut().value = deducted, - None => { - log::info!("deployment failed: insufficient balance {amount}"); - caller.write_memory(arguments.address_ptr, &Address::ZERO.0 .0)?; - return Ok(()); - } - } - - let (state, output) = transaction - .state - .clone() - .transaction() - .callee(address) - .deploy(transaction.state.blobs.get(&blob_hash).unwrap(), Some(salt)) - .callvalue(amount) - .calldata(input_data) - .call(); - - let result = if output.flags == ReturnFlags::Success { - log::info!("deployment succeeded"); - transaction.state = state; - address - } else { - log::info!("deployment failed: callee reverted {:?}", output.flags); - Address::ZERO - }; - caller.write_memory(arguments.address_ptr, &result.0 .0)?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::CALL, - |caller: Caller, argument_ptr: u32| -> Result { - let (mut caller, transaction) = caller.split(); - - #[derive(Debug)] - #[repr(packed)] - struct Arguments { - _flags: u32, - address_ptr: u32, - _ref_time_limit: u64, - proof_size_limit: u64, - deposit_ptr: u32, - value_ptr: u32, - input_data_ptr: u32, - input_data_len: u32, - output_ptr: u32, - output_len_ptr: u32, - } - let mut buffer = [0; std::mem::size_of::()]; - caller.read_memory_into_slice(argument_ptr, &mut buffer)?; - let arguments: Arguments = unsafe { std::mem::transmute(buffer) }; - - assert_eq!({ arguments.proof_size_limit }, 0); - assert_eq!({ arguments.deposit_ptr }, u32::MAX); - - let amount = if arguments.value_ptr != u32::MAX { - let value = caller.read_memory_into_vec(arguments.value_ptr, 32)?; - U256::from_le_slice(&value) - } else { - U256::ZERO - }; - - match transaction.top_account_mut().value.checked_sub(amount) { - Some(deducted) => transaction.top_account_mut().value = deducted, - None => { - log::info!("call failed: insufficient balance {amount}"); - return Ok(1); - } - } - - let bytes = caller.read_memory_into_vec(arguments.address_ptr, 32)?; - let word = U256::from_le_slice(&bytes); - let address = Address::from_word(word.into()); - log::info!("call {address}"); - - if !transaction.state.accounts.contains_key(&address) { - log::info!( - "balance transfer {amount} from {} to {address}", - transaction.top_frame().callee - ); - - transaction - .state - .accounts - .entry(address) - .or_insert_with(|| Account { - value: amount, - contract: None, - storage: Default::default(), - }); - - return Ok(0); - } - - if transaction.stack.len() >= Transaction::CALL_STACK_SIZE { - log::info!("deployment faild: maximum stack depth reached"); - return Ok(1); - } - - let calldata = caller - .read_memory_into_vec(arguments.input_data_ptr, arguments.input_data_len)?; - - let (state, output) = transaction - .state - .clone() - .transaction() - .callee(address) - .callvalue(amount) - .calldata(calldata) - .call(); - - let bytes_to_copy = caller.read_u32(arguments.output_len_ptr)? as usize; - let output_size = output.data.len(); - assert!( - bytes_to_copy <= output_size, - "output buffer of {bytes_to_copy}b too small for {output_size}b" - ); - - transaction.top_frame_mut().returndata = output.data.to_vec(); - caller.write_memory( - arguments.output_ptr, - &transaction.top_frame().returndata[..bytes_to_copy], - )?; - caller.write_memory(arguments.output_len_ptr, &output.data.len().to_le_bytes())?; - assert_eq!( - transaction.top_frame().returndata.len(), - caller.read_u32(arguments.output_len_ptr)? as usize - ); - - let success = if output.flags == ReturnFlags::Success { - log::info!("call succeeded"); - transaction.state = state; - 0 - } else { - log::info!("call failed: callee reverted {:?}", output.flags); - 1 - }; - - Ok(success) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::CODE_SIZE, - |caller: Caller, address_ptr: u32| { - let (caller, transaction) = caller.split(); - - let address = if address_ptr == u32::MAX { - transaction.top_frame().callee - } else { - let bytes = caller.read_memory_into_vec(address_ptr, 32)?; - let word = U256::from_le_slice(&bytes); - Address::from_word(word.into()) - }; - - let code_size = transaction - .state - .accounts - .get(&address) - .and_then(|account| account.contract) - .and_then(|blob_hash| transaction.state.blobs.get(&blob_hash)) - .map(|code| code.len()) - .unwrap_or_default() as u32; - - log::info!("code size of {address} = {code_size}"); - - Ok(code_size) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::RETURNDATACOPY, - |caller: Caller, - destination_ptr: u32, - offset: u32, - size: u32| - -> Result<(), Trap> { - let (mut caller, transaction) = caller.split(); - - let offset = offset as usize; - let slice_end = offset - .checked_add(size as usize) - .expect("offset + size overflows"); - - assert!( - slice_end <= transaction.top_frame().returndata.len(), - "offset + size is larger than RETURNDATASIZE" - ); - - caller.write_memory( - destination_ptr, - &transaction.top_frame().returndata[offset..slice_end], - )?; - - Ok(()) - }, - ) - .unwrap(); - - linker - .func_wrap( - runtime_api::imports::BALANCE, - |caller: Caller, address_ptr: u32, balance_ptr: u32| -> Result<(), Trap> { - let (mut caller, transaction) = caller.split(); - - let bytes = caller.read_memory_into_vec(address_ptr, 32)?; - let word = U256::from_le_slice(&bytes); - let address = Address::from_word(word.into()); - let balance = transaction - .state - .accounts() - .get(&address) - .map(|account| account.value) - .unwrap_or(U256::default()); - - caller.write_memory(balance_ptr, &balance.to_le_bytes::<32>())?; - - log::info!("account {address} balance {balance}"); - - Ok(()) - }, - ) - .unwrap(); - - linker -} - -pub fn setup(config: Option) -> Engine { - Engine::new(&config.unwrap_or_default()).unwrap() -} - -pub fn recompile_code(code: &[u8], engine: &Engine) -> Module { - let mut module_config = ModuleConfig::new(); - module_config.set_gas_metering(Some(GasMeteringKind::Sync)); - - Module::new(engine, &module_config, code.into()).unwrap() -} - -pub fn instantiate_module( - module: &Module, - engine: &Engine, -) -> (Instance, ExportIndex) { - let export = module.lookup_export(runtime_api::imports::CALL).unwrap(); - let func = link_host_functions(engine).instantiate_pre(module).unwrap(); - let instance = func.instantiate().unwrap(); - - (instance, export) -} - -pub fn prepare(code: &[u8], config: Option) -> (Instance, ExportIndex) { - let blob = ProgramBlob::parse(code.into()) - .unwrap_or_else(|err| panic!("{err}\n{}", hex::encode(code))); - - let engine = Engine::new(&config.unwrap_or_default()).unwrap(); - - let mut module_config = ModuleConfig::new(); - module_config.set_gas_metering(Some(GasMeteringKind::Sync)); - - let module = Module::from_blob(&engine, &module_config, blob).unwrap(); - let export = module.lookup_export(runtime_api::exports::CALL).unwrap(); - let func = link_host_functions(&engine) - .instantiate_pre(&module) - .unwrap(); - let instance = func.instantiate().unwrap(); - - (instance, export) -} - -fn init_logs() { - if std::env::var("RUST_LOG").is_ok() { - #[cfg(test)] - let test = true; - #[cfg(not(test))] - let test = false; - let _ = env_logger::builder().is_test(test).try_init(); - } -} diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index f9c25c5..810df50 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -1,464 +1,437 @@ use std::str::FromStr; -use alloy_primitives::{keccak256, Address, FixedBytes, B256, I256, U256}; -use alloy_sol_types::{sol, SolCall, SolValue}; -use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; -use sha1::Digest; +use alloy_primitives::*; +use revive_runner::*; +use SpecsAction::*; -use crate::{ - assert_success, - cases::Contract, - mock_runtime::{self, ReturnFlags, State, Transaction}, -}; +use crate::cases::Contract; -#[test] -fn fibonacci() { - let parameter = 6; +/// Parameters: +/// - The function name of the test +/// - The contract name to fill in empty code based on the file path +/// - The contract source file +macro_rules! test_spec { + ($test_name:ident, $contract_name:literal, $source_file:literal) => { + #[test] + fn $test_name() { + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("should always exist"); + let path = format!("{manifest_dir}/../integration/contracts/{}", $source_file); + Specs::from_comment($contract_name, &path).remove(0).run(); + } + }; +} - for contract in [ - Contract::fib_recursive(parameter), - Contract::fib_iterative(parameter), - Contract::fib_binet(parameter), - ] { - let (_, output) = assert_success(&contract, true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - let expected = U256::from(8); - assert_eq!(received, expected); +test_spec!(baseline, "Baseline", "Baseline.sol"); +test_spec!(flipper, "Flipper", "flipper.sol"); +test_spec!(fibonacci_recursive, "FibonacciRecursive", "Fibonacci.sol"); +test_spec!(fibonacci_iterative, "FibonacciIterative", "Fibonacci.sol"); +test_spec!(fibonacci_binet, "FibonacciBinet", "Fibonacci.sol"); +test_spec!(hash_keccak_256, "TestSha3", "Crypto.sol"); +test_spec!(erc20, "ERC20", "ERC20.sol"); +test_spec!(computation, "Computation", "Computation.sol"); +test_spec!(msize, "MSize", "MSize.sol"); +test_spec!(sha1, "SHA1", "SHA1.sol"); +test_spec!(block, "Block", "Block.sol"); +test_spec!(mcopy, "MCopy", "MCopy.sol"); +test_spec!(events, "Events", "Events.sol"); +test_spec!(storage, "Storage", "Storage.sol"); +test_spec!(mstore8, "MStore8", "MStore8.sol"); +test_spec!(address, "Context", "Context.sol"); +test_spec!(balance, "Value", "Value.sol"); +test_spec!(create, "CreateB", "Create.sol"); +test_spec!(call, "Caller", "Call.sol"); +test_spec!(transfer, "Transfer", "Transfer.sol"); +test_spec!(return_data_oob, "ReturnDataOob", "ReturnDataOob.sol"); +test_spec!(immutables, "Immutables", "Immutables.sol"); +test_spec!(transaction, "Transaction", "Transaction.sol"); + +fn instantiate(path: &str, contract: &str) -> Vec { + vec![Instantiate { + origin: TestAddress::Alice, + value: 0, + gas_limit: Some(GAS_LIMIT), + storage_deposit_limit: None, + code: Code::Solidity { + path: Some(path.into()), + contract: contract.to_string(), + solc_optimizer: None, + pipeline: None, + }, + data: vec![], + salt: OptionalHex::default(), + }] +} + +fn run_differential(actions: Vec) { + Specs { + differential: true, + actions, + ..Default::default() } + .run(); } #[test] -fn flipper() { - let (state, address) = State::new_deployed(Contract::flipper_constructor(true)); +fn bitwise_byte() { + let mut actions = instantiate("contracts/Bitwise.sol", "Bitwise"); - let contract = Contract::flipper(); - let (state, output) = state - .transaction() - .calldata(contract.calldata.clone()) - .callee(address) - .call(); - assert_eq!(output.flags, ReturnFlags::Success); - state.assert_storage_key(address, U256::ZERO, U256::ZERO); - - let (state, output) = state - .transaction() - .calldata(contract.calldata) - .callee(address) - .call(); - assert_eq!(output.flags, ReturnFlags::Success); - state.assert_storage_key(address, U256::ZERO, U256::from(1)); -} - -#[test] -fn hash_keccak_256() { - sol!( - #[derive(Debug, PartialEq, Eq)] - contract TestSha3 { - function test(string memory _pre) external payable returns (bytes32); - } - ); - let source = r#"contract TestSha3 { - function test(string memory _pre) external payable returns (bytes32 hash) { - hash = keccak256(bytes(_pre)); - } - }"#; - let code = crate::compile_blob("TestSha3", source); - - let param = "hello"; - let input = TestSha3::testCall::new((param.to_string(),)).abi_encode(); - - let (_, output) = State::default() - .transaction() - .with_default_account(&code) - .calldata(input) - .call(); - - assert_eq!(output.flags, ReturnFlags::Success); - - let expected = keccak256(param.as_bytes()); - let received = FixedBytes::<32>::from_slice(&output.data); - assert_eq!(received, expected); -} - -#[test] -fn erc20() { - let _ = crate::compile_blob("ERC20", include_str!("../contracts/ERC20.sol")); -} - -#[test] -fn triangle_number() { - let (_, output) = assert_success(&Contract::triangle_number(13), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - let expected = U256::try_from(91).unwrap(); - assert_eq!(received, expected); -} - -#[test] -fn odd_product() { - let (_, output) = assert_success(&Contract::odd_product(5), true); - let received = I256::from_be_bytes::<32>(output.data.try_into().unwrap()); - let expected = I256::try_from(945i64).unwrap(); - assert_eq!(received, expected); -} - -#[test] -fn msize_plain() { - sol!( - #[derive(Debug, PartialEq, Eq)] - contract MSize { - function mSize() public pure returns (uint); - } - ); - let code = crate::compile_blob_with_options( - "MSize", - include_str!("../contracts/MSize.sol"), - false, - revive_solidity::SolcPipeline::EVMLA, - ); - - let input = MSize::mSizeCall::new(()).abi_encode(); - let (_, output) = State::default() - .transaction() - .calldata(input) - .with_default_account(&code) - .call(); - - assert_eq!(output.flags, ReturnFlags::Success); - - // Solidity always stores the "free memory pointer" (32 byte int) at offset 64. - let expected = U256::try_from(64 + 32).unwrap(); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - assert_eq!(received, expected); -} - -#[test] -fn transferred_value() { - sol!( - contract Value { - function value() public payable returns (uint); - } - ); - let code = crate::compile_blob("Value", include_str!("../contracts/Value.sol")); - - let (_, output) = State::default() - .transaction() - .calldata(Value::valueCall::SELECTOR.to_vec()) - .callvalue(U256::from(123)) - .with_default_account(&code) - .call(); - - assert_eq!(output.flags, ReturnFlags::Success); - - let expected = I256::try_from(123).unwrap(); - let received = I256::from_be_bytes::<32>(output.data.try_into().unwrap()); - assert_eq!(received, expected); -} - -#[test] -fn msize_non_word_sized_access() { - sol!( - #[derive(Debug, PartialEq, Eq)] - contract MSize { - function mStore100() public pure returns (uint); - } - ); - let code = crate::compile_blob_with_options( - "MSize", - include_str!("../contracts/MSize.sol"), - false, - revive_solidity::SolcPipeline::Yul, - ); - - let input = MSize::mStore100Call::new(()).abi_encode(); - let (_, output) = State::default() - .transaction() - .with_default_account(&code) - .calldata(input) - .call(); - - assert_eq!(output.flags, ReturnFlags::Success); - - // https://docs.zksync.io/build/developer-reference/differences-with-ethereum.html#mstore-mload - // "Unlike EVM, where the memory growth is in words, on zkEVM the memory growth is counted in bytes." - // "For example, if you write mstore(100, 0) the msize on zkEVM will be 132, but on the EVM it will be 160." - let expected = U256::try_from(132).unwrap(); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - assert_eq!(received, expected); -} - -#[test] -fn mstore8() { - for (received, expected) in [ - (U256::MIN, U256::MIN), - ( - U256::from(1), - U256::from_str_radix( - "452312848583266388373324160190187140051835877600158453279131187530910662656", - 10, - ) - .unwrap(), - ), - ( - U256::from(2), - U256::from_str_radix( - "904625697166532776746648320380374280103671755200316906558262375061821325312", - 10, - ) - .unwrap(), - ), - ( - U256::from(255), - U256::from_str_radix( - "115339776388732929035197660848497720713218148788040405586178452820382218977280", - 10, - ) - .unwrap(), - ), - (U256::from(256), U256::from(0)), - ( - U256::from(257), - U256::from_str_radix( - "452312848583266388373324160190187140051835877600158453279131187530910662656", - 10, - ) - .unwrap(), - ), - ( - U256::from(258), - U256::from_str_radix( - "904625697166532776746648320380374280103671755200316906558262375061821325312", - 10, - ) - .unwrap(), - ), - ( - U256::from(123456789), - U256::from_str_radix( - "9498569820248594155839807363993929941088553429603327518861754938149123915776", - 10, - ) - .unwrap(), - ), - ( - U256::MAX, - U256::from_str_radix( - "115339776388732929035197660848497720713218148788040405586178452820382218977280", - 10, - ) - .unwrap(), - ), - ] - .par_iter() - .map(|(parameter, expected)| { - let (_, output) = assert_success(&Contract::mstore8(*parameter), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - (received, *expected) - }) - .collect::>() + let de_bruijn_sequence = + hex::decode("4060503824160d0784426150b864361d0f88c4a27148ac5a2f198d46e391d8f4").unwrap(); + let value = U256::from_be_bytes::<32>(de_bruijn_sequence.clone().try_into().unwrap()); + for input in de_bruijn_sequence + .iter() + .enumerate() + .map(|(index, _)| Contract::bitwise_byte(U256::from(index), value).calldata) + .chain([ + Contract::bitwise_byte(U256::ZERO, U256::ZERO).calldata, + Contract::bitwise_byte(U256::ZERO, U256::MAX).calldata, + Contract::bitwise_byte(U256::MAX, U256::ZERO).calldata, + Contract::bitwise_byte(U256::from_str("18446744073709551619").unwrap(), U256::MAX) + .calldata, + ]) { - assert_eq!(received, expected); + actions.push(Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: input, + }) } -} -#[test] -fn sha1() { - let pre = vec![0xffu8; 512]; - let mut hasher = sha1::Sha1::new(); - hasher.update(&pre); - let hash = hasher.finalize(); - - let (_, output) = assert_success(&Contract::sha1(pre), true); - let expected = FixedBytes::<20>::from_slice(&hash[..]); - let received = FixedBytes::<20>::from_slice(&output.data[..20]); - assert_eq!(received, expected); -} - -#[test] -fn block_number() { - let (_, output) = assert_success(&Contract::block_number(), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - let expected = U256::from(mock_runtime::State::BLOCK_NUMBER); - assert_eq!(received, expected); -} - -#[test] -fn block_timestamp() { - let (_, output) = assert_success(&Contract::block_timestamp(), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - let expected = U256::from(mock_runtime::State::BLOCK_TIMESTAMP); - assert_eq!(received, expected); -} - -#[test] -fn address() { - let contract = Contract::context_address(); - let (_, output) = assert_success(&contract, true); - let received = Address::from_slice(&output.data[12..]); - let expected = Transaction::default_address(); - assert_eq!(received, expected); -} - -#[test] -fn caller() { - let (_, output) = assert_success(&Contract::context_caller(), true); - let received = Address::from_slice(&output.data[12..]); - let expected = Transaction::default_address(); - assert_eq!(received, expected); + run_differential(actions); } #[test] fn unsigned_division() { + let mut actions = instantiate("contracts/DivisionArithmetics.sol", "DivisionArithmetics"); + let one = U256::from(1); let two = U256::from(2); let five = U256::from(5); - for (received, expected) in [ - (five, five, one), - (five, one, five), - (U256::ZERO, U256::MAX, U256::ZERO), - (five, two, two), - (one, U256::ZERO, U256::ZERO), - ] - .par_iter() - .map(|(n, d, q)| { - let (_, output) = assert_success(&Contract::division_arithmetics_div(*n, *d), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - (received, *q) - }) - .collect::>() - { - assert_eq!(received, expected) + for (n, d) in [ + (five, five), + (five, one), + (U256::ZERO, U256::MAX), + (five, two), + (one, U256::ZERO), + ] { + actions.push(Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::division_arithmetics_div(n, d).calldata, + }) } + + run_differential(actions); } #[test] fn signed_division() { + let mut actions = instantiate("contracts/DivisionArithmetics.sol", "DivisionArithmetics"); + let one = I256::try_from(1).unwrap(); let two = I256::try_from(2).unwrap(); let minus_two = I256::try_from(-2).unwrap(); let five = I256::try_from(5).unwrap(); let minus_five = I256::try_from(-5).unwrap(); - for (received, expected) in [ - (five, five, one), - (five, one, five), - (I256::ZERO, I256::MAX, I256::ZERO), - (I256::ZERO, I256::MINUS_ONE, I256::ZERO), - (five, two, two), - (five, I256::MINUS_ONE, minus_five), - (I256::MINUS_ONE, minus_two, I256::ZERO), - (minus_five, minus_five, one), - (minus_five, two, minus_two), - (I256::MINUS_ONE, I256::MIN, I256::ZERO), - (one, I256::ZERO, I256::ZERO), - ] - .par_iter() - .map(|(n, d, q)| { - let (_, output) = assert_success(&Contract::division_arithmetics_sdiv(*n, *d), true); - let received = I256::from_be_bytes::<32>(output.data.try_into().unwrap()); - (received, *q) - }) - .collect::>() - { - assert_eq!(received, expected); + for (n, d) in [ + (five, five), + (five, one), + (I256::ZERO, I256::MAX), + (I256::ZERO, I256::MINUS_ONE), + (five, two), + (five, I256::MINUS_ONE), + (I256::MINUS_ONE, minus_two), + (minus_five, minus_five), + (minus_five, two), + (I256::MINUS_ONE, I256::MIN), + (one, I256::ZERO), + ] { + actions.push(Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::division_arithmetics_sdiv(n, d).calldata, + }) } + + run_differential(actions); } #[test] fn unsigned_remainder() { + let mut actions = instantiate("contracts/DivisionArithmetics.sol", "DivisionArithmetics"); + let one = U256::from(1); let two = U256::from(2); let five = U256::from(5); - for (received, expected) in [ - (five, five, U256::ZERO), - (five, one, U256::ZERO), - (U256::ZERO, U256::MAX, U256::ZERO), - (U256::MAX, U256::MAX, U256::ZERO), - (five, two, one), - (two, five, two), - (U256::MAX, U256::ZERO, U256::ZERO), - ] - .par_iter() - .map(|(n, d, q)| { - let (_, output) = assert_success(&Contract::division_arithmetics_mod(*n, *d), true); - let received = U256::from_be_bytes::<32>(output.data.try_into().unwrap()); - (received, *q) - }) - .collect::>() - { - assert_eq!(received, expected); + for (n, d) in [ + (five, five), + (five, one), + (U256::ZERO, U256::MAX), + (U256::MAX, U256::MAX), + (five, two), + (two, five), + (U256::MAX, U256::ZERO), + ] { + actions.push(Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::division_arithmetics_mod(n, d).calldata, + }) } + + run_differential(actions); } #[test] fn signed_remainder() { + let mut actions = instantiate("contracts/DivisionArithmetics.sol", "DivisionArithmetics"); + let one = I256::try_from(1).unwrap(); let two = I256::try_from(2).unwrap(); let minus_two = I256::try_from(-2).unwrap(); let five = I256::try_from(5).unwrap(); let minus_five = I256::try_from(-5).unwrap(); - for (received, expected) in [ - (five, five, I256::ZERO), - (five, one, I256::ZERO), - (I256::ZERO, I256::MAX, I256::ZERO), - (I256::MAX, I256::MAX, I256::ZERO), - (five, two, one), - (two, five, two), - (five, minus_five, I256::ZERO), - (five, I256::MINUS_ONE, I256::ZERO), - (five, minus_two, one), - (minus_five, two, I256::MINUS_ONE), - (minus_two, five, minus_two), - (minus_five, minus_five, I256::ZERO), - (minus_five, I256::MINUS_ONE, I256::ZERO), - (minus_five, minus_two, I256::MINUS_ONE), - (minus_two, minus_five, minus_two), - (I256::MIN, I256::MINUS_ONE, I256::ZERO), - (I256::ZERO, I256::ZERO, I256::ZERO), - ] - .par_iter() - .map(|(n, d, q)| { - let (_, output) = assert_success(&Contract::division_arithmetics_smod(*n, *d), true); - let received = I256::from_be_bytes::<32>(output.data.try_into().unwrap()); - (received, *q) - }) - .collect::>() - { - assert_eq!(received, expected); + for (n, d) in [ + (five, five), + (five, one), + (I256::ZERO, I256::MAX), + (I256::MAX, I256::MAX), + (five, two), + (two, five), + (five, minus_five), + (five, I256::MINUS_ONE), + (five, minus_two), + (minus_five, two), + (minus_two, five), + (minus_five, minus_five), + (minus_five, I256::MINUS_ONE), + (minus_five, minus_two), + (minus_two, minus_five), + (I256::MIN, I256::MINUS_ONE), + (I256::ZERO, I256::ZERO), + ] { + actions.push(Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::division_arithmetics_smod(n, d).calldata, + }) } + + run_differential(actions); } #[test] -fn events() { - assert_success(&Contract::event(U256::ZERO), true); - assert_success(&Contract::event(U256::from(123)), true); +fn ext_code_hash() { + let mut actions = instantiate("contracts/ExtCode.sol", "ExtCode"); + + // First do contract instantiation to figure out address and code hash + let results = Specs { + actions: actions.clone(), + ..Default::default() + } + .run(); + let (addr, code_hash) = match results.first().cloned() { + Some(CallResult::Instantiate { + result, code_hash, .. + }) => (result.result.unwrap().addr, code_hash), + _ => panic!("instantiate contract failed"), + }; + + // code hash of itself + actions.push(Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::code_hash().calldata, + }); + actions.push(VerifyCall(VerifyCallExpectation { + success: true, + output: OptionalHex::from(code_hash.as_bytes().to_vec()), + gas_consumed: None, + })); + + // code hash for a given contract address + actions.push(Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::ext_code_hash(Address::from(addr.to_fixed_bytes())).calldata, + }); + actions.push(VerifyCall(VerifyCallExpectation { + success: true, + output: OptionalHex::from(code_hash.as_bytes().to_vec()), + gas_consumed: None, + })); + + // EOA returns fixed hash + actions.push(Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::ext_code_hash(Address::from(CHARLIE.to_fixed_bytes())).calldata, + }); + actions.push(VerifyCall(VerifyCallExpectation { + success: true, + output: OptionalHex::from( + hex!("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470").to_vec(), + ), + gas_consumed: None, + })); + + // non-existing account + actions.push(Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::ext_code_hash(Address::from([8u8; 20])).calldata, + }); + actions.push(VerifyCall(VerifyCallExpectation { + success: true, + output: OptionalHex::from([0u8; 32].to_vec()), + gas_consumed: None, + })); + + Specs { + actions, + ..Default::default() + } + .run(); } #[test] -fn create2() { - let mut state = State::default(); - let contract_a = Contract::create_a(); - state.upload_code(&contract_a.pvm_runtime); +fn ext_code_size() { + let alice = Address::from(ALICE.0); + let own_address = alice.create(0); + let baseline_address = alice.create2([0u8; 32], keccak256(Contract::baseline().pvm_runtime)); - let contract = Contract::create_b(); - let (state, output) = state - .transaction() - .with_default_account(&contract.pvm_runtime) - .calldata(contract.calldata) - .call(); + let own_code_size = U256::from( + Contract::ext_code_size(Default::default()) + .pvm_runtime + .len(), + ); + let baseline_code_size = U256::from(Contract::baseline().pvm_runtime.len()); - assert_eq!(output.flags, ReturnFlags::Success); - assert_eq!(state.accounts().len(), 2); - - for address in state.accounts().keys() { - if *address != Transaction::default_address() { - let derived_address = Transaction::default_address().create2( - B256::from(U256::from(1)), - keccak256(&contract_a.pvm_runtime).0, - ); - assert_eq!(*address, derived_address); - } + Specs { + actions: vec![ + // Instantiate the test contract + instantiate("contracts/ExtCode.sol", "ExtCode").remove(0), + // Instantiate the baseline contract + Instantiate { + origin: TestAddress::Alice, + value: 0, + gas_limit: Some(GAS_LIMIT), + storage_deposit_limit: None, + code: Code::Solidity { + path: Some("contracts/Baseline.sol".into()), + contract: "Baseline".to_string(), + solc_optimizer: None, + pipeline: None, + }, + data: vec![], + salt: OptionalHex::from([0; 32]), + }, + // Alice is not a contract and returns a code size of 0 + Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::ext_code_size(alice).calldata, + }, + VerifyCall(VerifyCallExpectation { + success: true, + output: OptionalHex::from([0u8; 32].to_vec()), + gas_consumed: None, + }), + // Unknown address returns a code size of 0 + Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::ext_code_size(Address::from([0xff; 20])).calldata, + }, + VerifyCall(VerifyCallExpectation { + success: true, + output: OptionalHex::from([0u8; 32].to_vec()), + gas_consumed: None, + }), + // Own address via extcodesize returns own code size + Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::ext_code_size(own_address).calldata, + }, + VerifyCall(VerifyCallExpectation { + success: true, + output: OptionalHex::from(own_code_size.to_be_bytes::<32>().to_vec()), + gas_consumed: None, + }), + // Own address via codesize returns own code size + Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::code_size().calldata, + }, + VerifyCall(VerifyCallExpectation { + success: true, + output: OptionalHex::from(own_code_size.to_be_bytes::<32>().to_vec()), + gas_consumed: None, + }), + // Baseline address returns the baseline code size + Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value: 0, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::ext_code_size(baseline_address).calldata, + }, + VerifyCall(VerifyCallExpectation { + success: true, + output: OptionalHex::from(baseline_code_size.to_be_bytes::<32>().to_vec()), + gas_consumed: None, + }), + ], + ..Default::default() } + .run(); } +/* +// These test were implement for the mock-runtime and need to be ported yet. + #[test] fn create2_failure() { let mut state = State::default(); @@ -484,155 +457,4 @@ fn create2_failure() { assert_eq!(output.flags, ReturnFlags::Revert); } - -#[test] -fn create_with_value() { - let mut state = State::default(); - state.upload_code(&Contract::create_a().pvm_runtime); - let amount = U256::from(123); - - let contract = Contract::create_b(); - let (state, output) = state - .transaction() - .with_default_account(&contract.pvm_runtime) - .callvalue(amount) - .call(); - - assert_eq!(output.flags, ReturnFlags::Success); - assert_eq!(state.accounts().len(), 2); - - for (address, account) in state.accounts() { - if *address == Transaction::default_address() { - assert_eq!(account.value, U256::ZERO); - } else { - assert_eq!(account.value, amount); - } - } -} - -#[test] -fn ext_code_size() { - let contract = Contract::ext_code_size(Transaction::default_address()); - let (_, output) = assert_success(&contract, false); - let received = U256::from_be_slice(&output.data); - let expected = U256::from(contract.pvm_runtime.len()); - assert_eq!(received, expected); - - let contract = Contract::ext_code_size(Default::default()); - let (_, output) = assert_success(&contract, false); - let received = U256::from_be_slice(&output.data); - let expected = U256::ZERO; - assert_eq!(received, expected); -} - -#[test] -fn code_size() { - let contract = Contract::code_size(); - let (_, output) = assert_success(&contract, false); - let expected = U256::from(contract.pvm_runtime.len()); - let received = U256::from_be_slice(&output.data); - assert_eq!(expected, received); -} - -#[test] -fn value_transfer() { - // Succeeds in remix (shanghai) but traps the interpreter - let (state, _) = assert_success(&Contract::call_value_transfer(Default::default()), false); - - assert_eq!(state.accounts().len(), 2); - assert!(state.accounts().get(&Address::default()).is_some()); -} - -#[test] -fn echo() { - let (state, address) = State::new_deployed(Contract::call_constructor()); - - let expected = vec![1, 2, 3, 4, 5]; - let contract = Contract::call_call(address, expected.clone()); - let (_, output) = state - .transaction() - .with_default_account(&contract.pvm_runtime) - .calldata(contract.calldata) - .call(); - - assert_eq!(output.flags, ReturnFlags::Success); - - let received = alloy_primitives::Bytes::abi_decode(&output.data, true) - .unwrap() - .to_vec(); - - assert_eq!(expected, received); -} - -#[test] -fn mcopy() { - let expected = vec![1, 2, 3]; - - let (_, output) = assert_success(&Contract::memcpy(expected.clone()), false); - - let received = alloy_primitives::Bytes::abi_decode(&output.data, true) - .unwrap() - .to_vec(); - - assert_eq!(expected, received); -} - -#[test] -fn balance() { - let (_, output) = assert_success(&Contract::value_balance_of(Default::default()), false); - - let expected = U256::ZERO; - let received = U256::from_be_slice(&output.data); - assert_eq!(expected, received); - - let expected = U256::from(54589); - let (mut state, address) = State::new_deployed(Contract::value_balance_of(Default::default())); - state.accounts_mut().get_mut(&address).unwrap().value = expected; - - let contract = Contract::value_balance_of(address); - let (_, output) = state - .transaction() - .with_default_account(&contract.pvm_runtime) - .calldata(contract.calldata) - .call(); - - assert_eq!(ReturnFlags::Success, output.flags); - - let received = U256::from_be_slice(&output.data); - assert_eq!(expected, received) -} - -#[test] -fn bitwise_byte() { - assert_success(&Contract::bitwise_byte(U256::ZERO, U256::ZERO), true); - assert_success(&Contract::bitwise_byte(U256::ZERO, U256::MAX), true); - assert_success(&Contract::bitwise_byte(U256::MAX, U256::ZERO), true); - assert_success( - &Contract::bitwise_byte(U256::from_str("18446744073709551619").unwrap(), U256::MAX), - true, - ); - - let de_bruijn_sequence = - hex::decode("4060503824160d0784426150b864361d0f88c4a27148ac5a2f198d46e391d8f4").unwrap(); - let value = U256::from_be_bytes::<32>(de_bruijn_sequence.clone().try_into().unwrap()); - - for (index, byte) in de_bruijn_sequence.iter().enumerate() { - let (_, output) = assert_success(&Contract::bitwise_byte(U256::from(index), value), true); - let expected = U256::from(*byte as i32); - let received = U256::abi_decode(&output.data, true).unwrap(); - assert_eq!(expected, received) - } -} - -#[test] -fn transient_storage() { - let expected = U256::MAX; - let (state, output) = assert_success(&Contract::storage_transient(expected), false); - let received = U256::abi_decode(&output.data, true).unwrap(); - assert_eq!(expected, received); - - assert!(state - .accounts() - .values() - .all(|account| account.storage.is_empty())); -} +*/ diff --git a/crates/linker/src/lib.rs b/crates/linker/src/lib.rs index 27994fd..b5c81cb 100644 --- a/crates/linker/src/lib.rs +++ b/crates/linker/src/lib.rs @@ -32,6 +32,7 @@ fn invoke_lld(cmd_args: &[&str]) -> bool { fn polkavm_linker>(code: T) -> anyhow::Result> { let mut config = polkavm_linker::Config::default(); config.set_strip(true); + config.set_optimize(true); polkavm_linker::program_from_elf(config, code.as_ref()) .map_err(|reason| anyhow::anyhow!("polkavm linker failed: {}", reason)) diff --git a/crates/llvm-context/Cargo.toml b/crates/llvm-context/Cargo.toml index f50c238..715e336 100644 --- a/crates/llvm-context/Cargo.toml +++ b/crates/llvm-context/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "revive-llvm-context" -version = "1.4.1" +version.workspace = true +license.workspace = true +edition.workspace = true +repository.workspace = true authors = [ "Oleksandr Zarudnyi ", "Cyrill Leutwiler ", ] -license = "MIT OR Apache-2.0" -edition = "2021" description = "Shared front end code of the revive PolkaVM compilers" [lib] @@ -32,10 +33,8 @@ inkwell = { workspace = true } polkavm-disassembler = { workspace = true } polkavm-common = { workspace = true } -zkevm_opcode_defs = { git = "https://github.com/matter-labs/era-zkevm_opcode_defs", branch = "v1.4.1" } -revive-common = { path = "../common" } - -pallet-contracts-pvm-llapi = { path = "../pallet-contracts-pvm-llapi" } -revive-linker = { path = "../linker" } -revive-builtins = { path = "../builtins" } -revive-stdlib = { path = "../stdlib" } +revive-common = { workspace = true } +revive-runtime-api = { workspace = true } +revive-linker = { workspace = true } +revive-builtins = { workspace = true } +revive-stdlib = { workspace = true } diff --git a/crates/llvm-context/src/lib.rs b/crates/llvm-context/src/lib.rs index d5c5920..82397fd 100644 --- a/crates/llvm-context/src/lib.rs +++ b/crates/llvm-context/src/lib.rs @@ -27,9 +27,11 @@ pub use self::polkavm::context::function::llvm_runtime::LLVMRuntime as PolkaVMLL pub use self::polkavm::context::function::r#return::Return as PolkaVMFunctionReturn; pub use self::polkavm::context::function::runtime::deploy_code::DeployCode as PolkaVMDeployCodeFunction; pub use self::polkavm::context::function::runtime::entry::Entry as PolkaVMEntryFunction; +pub use self::polkavm::context::function::runtime::immutable_data_load::ImmutableDataLoad as PolkaVMImmutableDataLoadFunction; pub use self::polkavm::context::function::runtime::runtime_code::RuntimeCode as PolkaVMRuntimeCodeFunction; pub use self::polkavm::context::function::runtime::FUNCTION_DEPLOY_CODE as PolkaVMFunctionDeployCode; pub use self::polkavm::context::function::runtime::FUNCTION_ENTRY as PolkaVMFunctionEntry; +pub use self::polkavm::context::function::runtime::FUNCTION_LOAD_IMMUTABLE_DATA as PolkaVMFunctionImmutableDataLoad; pub use self::polkavm::context::function::runtime::FUNCTION_RUNTIME_CODE as PolkaVMFunctionRuntimeCode; pub use self::polkavm::context::function::yul_data::YulData as PolkaVMFunctionYulData; pub use self::polkavm::context::function::Function as PolkaVMFunction; diff --git a/crates/llvm-context/src/optimizer/settings/mod.rs b/crates/llvm-context/src/optimizer/settings/mod.rs index 8d8df1b..ac312ff 100644 --- a/crates/llvm-context/src/optimizer/settings/mod.rs +++ b/crates/llvm-context/src/optimizer/settings/mod.rs @@ -21,8 +21,6 @@ pub struct Settings { /// Fallback to optimizing for size if the bytecode is too large. pub is_fallback_to_size_enabled: bool, - /// Whether the system request memoization is disabled. - pub is_system_request_memoization_disabled: bool, /// Whether the LLVM `verify each` option is enabled. pub is_verify_each_enabled: bool, @@ -43,7 +41,6 @@ impl Settings { level_back_end, is_fallback_to_size_enabled: false, - is_system_request_memoization_disabled: false, is_verify_each_enabled: false, is_debug_logging_enabled: false, @@ -65,7 +62,6 @@ impl Settings { level_back_end, is_fallback_to_size_enabled: false, - is_system_request_memoization_disabled: false, is_verify_each_enabled, is_debug_logging_enabled, @@ -206,20 +202,10 @@ impl Settings { self.is_fallback_to_size_enabled = true; } - /// Disables the system request memoization. - pub fn disable_system_request_memoization(&mut self) { - self.is_system_request_memoization_disabled = true; - } - /// Whether the fallback to optimizing for size is enabled. pub fn is_fallback_to_size_enabled(&self) -> bool { self.is_fallback_to_size_enabled } - - /// Whether the system request memoization is disabled. - pub fn is_system_request_memoization_disabled(&self) -> bool { - self.is_system_request_memoization_disabled - } } impl PartialEq for Settings { diff --git a/crates/llvm-context/src/polkavm/const/mod.rs b/crates/llvm-context/src/polkavm/const/mod.rs index 9cc454f..91e8177 100644 --- a/crates/llvm-context/src/polkavm/const/mod.rs +++ b/crates/llvm-context/src/polkavm/const/mod.rs @@ -1,14 +1,8 @@ //! The LLVM context constants. -/// Runtime API methods. -pub mod runtime_api; - /// The LLVM framework version. pub const LLVM_VERSION: semver::Version = semver::Version::new(18, 1, 4); -/// The PolkaVM version. -pub const ZKEVM_VERSION: semver::Version = semver::Version::new(1, 3, 2); - /// The register width sized type pub static XLEN: usize = revive_common::BIT_LENGTH_X32; @@ -21,55 +15,9 @@ pub static GLOBAL_CALLDATA_POINTER: &str = "ptr_calldata"; /// The calldata size global variable name. pub static GLOBAL_CALLDATA_SIZE: &str = "calldatasize"; -/// The return data pointer global variable name. -pub static GLOBAL_RETURN_DATA_POINTER: &str = "ptr_return_data"; - -/// The return data size pointer global variable name. -pub static GLOBAL_RETURN_DATA_SIZE: &str = "returndatasize"; - /// The call flags global variable name. pub static GLOBAL_CALL_FLAGS: &str = "call_flags"; -/// The extra ABI data global variable name. -pub static GLOBAL_EXTRA_ABI_DATA: &str = "extra_abi_data"; - -/// The constant array global variable name prefix. -pub static GLOBAL_CONST_ARRAY_PREFIX: &str = "const_array_"; - -/// The global verbatim getter identifier prefix. -pub static GLOBAL_VERBATIM_GETTER_PREFIX: &str = "get_global::"; - -/// The static word size. -pub static GLOBAL_I256_SIZE: &str = "i256_size"; - -/// The static value size. -pub static GLOBAL_I160_SIZE: &str = "i160_size"; - -/// The static i64 size. -pub static GLOBAL_I64_SIZE: &str = "i64_size"; - -/// The external call data offset in the auxiliary heap. -pub const HEAP_AUX_OFFSET_EXTERNAL_CALL: u64 = 0; - -/// The constructor return data offset in the auxiliary heap. -pub const HEAP_AUX_OFFSET_CONSTRUCTOR_RETURN_DATA: u64 = - 8 * (revive_common::BYTE_LENGTH_WORD as u64); - -/// The number of the extra ABI data arguments. -pub const EXTRA_ABI_DATA_SIZE: usize = 0; - -/// The `create` method deployer signature. -pub static DEPLOYER_SIGNATURE_CREATE: &str = "create(bytes32,bytes32,bytes)"; - -/// The `create2` method deployer signature. -pub static DEPLOYER_SIGNATURE_CREATE2: &str = "create2(bytes32,bytes32,bytes)"; - -/// The absence of system call bit. -pub const NO_SYSTEM_CALL_BIT: bool = false; - -/// The system call bit. -pub const SYSTEM_CALL_BIT: bool = true; - /// The deployer call header size that consists of: /// - bytecode hash (32 bytes) pub const DEPLOYER_CALL_HEADER_SIZE: usize = revive_common::BYTE_LENGTH_WORD; diff --git a/crates/llvm-context/src/polkavm/const/runtime_api.rs b/crates/llvm-context/src/polkavm/const/runtime_api.rs deleted file mode 100644 index 01b65ac..0000000 --- a/crates/llvm-context/src/polkavm/const/runtime_api.rs +++ /dev/null @@ -1,71 +0,0 @@ -//! Runtime API import and export symbols. - -pub mod exports { - /// The contract deploy export. - pub static CALL: &str = "call"; - - /// The contract call export. - pub static DEPLOY: &str = "deploy"; - - /// All exported symbols. - /// Useful for configuring common attributes and linkage. - pub static EXPORTS: [&str; 2] = [CALL, DEPLOY]; -} - -pub mod imports { - pub static ADDRESS: &str = "address"; - - pub static BALANCE: &str = "balance"; - - pub static BLOCK_NUMBER: &str = "block_number"; - - pub static CALL: &str = "seal_call"; - - pub static CALLER: &str = "caller"; - - pub static CODE_SIZE: &str = "code_size"; - - pub static DEPOSIT_EVENT: &str = "deposit_event"; - - pub static GET_STORAGE: &str = "get_storage"; - - pub static HASH_KECCAK_256: &str = "hash_keccak_256"; - - pub static INPUT: &str = "input"; - - pub static INSTANTIATE: &str = "instantiate"; - - pub static NOW: &str = "now"; - - pub static RETURN: &str = "seal_return"; - - pub static RETURNDATACOPY: &str = "returndatacopy"; - - pub static SET_STORAGE: &str = "set_storage"; - - pub static VALUE_TRANSFERRED: &str = "value_transferred"; - - /// All imported runtime API symbols. - /// Useful for configuring common attributes and linkage. - pub static IMPORTS: [&str; 16] = [ - ADDRESS, - BALANCE, - BLOCK_NUMBER, - CALL, - CALLER, - CODE_SIZE, - DEPOSIT_EVENT, - GET_STORAGE, - HASH_KECCAK_256, - INPUT, - INSTANTIATE, - NOW, - RETURN, - RETURNDATACOPY, - SET_STORAGE, - VALUE_TRANSFERRED, - ]; -} - -/// PolkaVM __sbrk API symbol to extend the heap memory. -pub static SBRK: &str = "__sbrk"; diff --git a/crates/llvm-context/src/polkavm/context/function/llvm_runtime.rs b/crates/llvm-context/src/polkavm/context/function/llvm_runtime.rs index 8f26288..fc5c05e 100644 --- a/crates/llvm-context/src/polkavm/context/function/llvm_runtime.rs +++ b/crates/llvm-context/src/polkavm/context/function/llvm_runtime.rs @@ -11,15 +11,6 @@ use crate::polkavm::context::function::Function; /// The functions are automatically linked to the LLVM implementations if the signatures match. #[derive(Debug)] pub struct LLVMRuntime<'ctx> { - /// The corresponding LLVM runtime function. - pub shl: FunctionDeclaration<'ctx>, - /// The corresponding LLVM runtime function. - pub shr: FunctionDeclaration<'ctx>, - /// The corresponding LLVM runtime function. - pub sar: FunctionDeclaration<'ctx>, - /// The corresponding LLVM runtime function. - pub byte: FunctionDeclaration<'ctx>, - /// The corresponding LLVM runtime function. pub add_mod: FunctionDeclaration<'ctx>, /// The corresponding LLVM runtime function. @@ -31,32 +22,9 @@ pub struct LLVMRuntime<'ctx> { /// The corresponding LLVM runtime function. pub sha3: FunctionDeclaration<'ctx>, - - /// The corresponding LLVM runtime function. - pub r#return: FunctionDeclaration<'ctx>, - /// The corresponding LLVM runtime function. - pub revert: FunctionDeclaration<'ctx>, } impl<'ctx> LLVMRuntime<'ctx> { - /// The LLVM personality function name. - pub const FUNCTION_PERSONALITY: &'static str = "__personality"; - - /// The LLVM exception throwing function name. - pub const FUNCTION_CXA_THROW: &'static str = "__cxa_throw"; - - /// The corresponding runtime function name. - pub const FUNCTION_SHL: &'static str = "__shl"; - - /// The corresponding runtime function name. - pub const FUNCTION_SHR: &'static str = "__shr"; - - /// The corresponding runtime function name. - pub const FUNCTION_SAR: &'static str = "__sar"; - - /// The corresponding runtime function name. - pub const FUNCTION_BYTE: &'static str = "__byte"; - /// The corresponding runtime function name. pub const FUNCTION_ADDMOD: &'static str = "__addmod"; @@ -72,121 +40,12 @@ impl<'ctx> LLVMRuntime<'ctx> { /// The corresponding runtime function name. pub const FUNCTION_SHA3: &'static str = "__sha3"; - /// The corresponding runtime function name. - pub const FUNCTION_SYSTEM_REQUEST: &'static str = "__system_request"; - - /// The corresponding runtime function name. - pub const FUNCTION_FARCALL: &'static str = "__farcall"; - - /// The corresponding runtime function name. - pub const FUNCTION_STATICCALL: &'static str = "__staticcall"; - - /// The corresponding runtime function name. - pub const FUNCTION_DELEGATECALL: &'static str = "__delegatecall"; - - /// The corresponding runtime function name. - pub const FUNCTION_MIMICCALL: &'static str = "__mimiccall"; - - /// The corresponding runtime function name. - pub const FUNCTION_FARCALL_BYREF: &'static str = "__farcall_byref"; - - /// The corresponding runtime function name. - pub const FUNCTION_STATICCALL_BYREF: &'static str = "__staticcall_byref"; - - /// The corresponding runtime function name. - pub const FUNCTION_DELEGATECALL_BYREF: &'static str = "__delegatecall_byref"; - - /// The corresponding runtime function name. - pub const FUNCTION_MIMICCALL_BYREF: &'static str = "__mimiccall_byref"; - - /// The corresponding runtime function name. - pub const FUNCTION_RETURN: &'static str = "__return"; - - /// The corresponding runtime function name. - pub const FUNCTION_REVERT: &'static str = "__revert"; - /// A shortcut constructor. pub fn new( llvm: &'ctx inkwell::context::Context, module: &inkwell::module::Module<'ctx>, optimizer: &Optimizer, ) -> Self { - let shl = Self::declare( - module, - Self::FUNCTION_SHL, - llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32) - .fn_type( - vec![ - llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32) - .as_basic_type_enum() - .into(); - 2 - ] - .as_slice(), - false, - ), - Some(inkwell::module::Linkage::External), - ); - Function::set_default_attributes(llvm, shl, optimizer); - Function::set_pure_function_attributes(llvm, shl); - - let shr = Self::declare( - module, - Self::FUNCTION_SHR, - llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32) - .fn_type( - vec![ - llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32) - .as_basic_type_enum() - .into(); - 2 - ] - .as_slice(), - false, - ), - Some(inkwell::module::Linkage::External), - ); - Function::set_default_attributes(llvm, shr, optimizer); - Function::set_pure_function_attributes(llvm, shr); - - let sar = Self::declare( - module, - Self::FUNCTION_SAR, - llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32) - .fn_type( - vec![ - llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32) - .as_basic_type_enum() - .into(); - 2 - ] - .as_slice(), - false, - ), - Some(inkwell::module::Linkage::External), - ); - Function::set_default_attributes(llvm, sar, optimizer); - Function::set_pure_function_attributes(llvm, sar); - - let byte = Self::declare( - module, - Self::FUNCTION_BYTE, - llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32) - .fn_type( - vec![ - llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32) - .as_basic_type_enum() - .into(); - 2 - ] - .as_slice(), - false, - ), - Some(inkwell::module::Linkage::External), - ); - Function::set_default_attributes(llvm, byte, optimizer); - Function::set_pure_function_attributes(llvm, byte); - let add_mod = Self::define(module, Self::FUNCTION_ADDMOD).expect("should be declared in stdlib"); Function::set_default_attributes(llvm, add_mod, optimizer); @@ -236,54 +95,13 @@ impl<'ctx> LLVMRuntime<'ctx> { false, ); - let r#return = Self::declare( - module, - Self::FUNCTION_RETURN, - llvm.void_type().fn_type( - vec![ - llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32) - .as_basic_type_enum() - .into(); - 3 - ] - .as_slice(), - false, - ), - Some(inkwell::module::Linkage::External), - ); - Function::set_default_attributes(llvm, r#return, optimizer); - let revert = Self::declare( - module, - Self::FUNCTION_REVERT, - llvm.void_type().fn_type( - vec![ - llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32) - .as_basic_type_enum() - .into(); - 3 - ] - .as_slice(), - false, - ), - Some(inkwell::module::Linkage::External), - ); - Function::set_default_attributes(llvm, revert, optimizer); - Self { - shl, - shr, - sar, - byte, - add_mod, mul_mod, exp, sign_extend, sha3, - - r#return, - revert, } } diff --git a/crates/llvm-context/src/polkavm/context/function/mod.rs b/crates/llvm-context/src/polkavm/context/function/mod.rs index ae6abb8..1a63631 100644 --- a/crates/llvm-context/src/polkavm/context/function/mod.rs +++ b/crates/llvm-context/src/polkavm/context/function/mod.rs @@ -48,12 +48,6 @@ pub struct Function<'ctx> { } impl<'ctx> Function<'ctx> { - /// The near call ABI function prefix. - pub const ZKSYNC_NEAR_CALL_ABI_PREFIX: &'static str = "ZKSYNC_NEAR_CALL"; - - /// The near call ABI exception handler name. - pub const ZKSYNC_NEAR_CALL_ABI_EXCEPTION_HANDLER: &'static str = "ZKSYNC_CATCH_NEAR_CALL"; - /// The stack hashmap default capacity. const STACK_HASHMAP_INITIAL_CAPACITY: usize = 64; @@ -91,13 +85,8 @@ impl<'ctx> Function<'ctx> { || (name.starts_with("__") && name != self::runtime::FUNCTION_ENTRY && name != self::runtime::FUNCTION_DEPLOY_CODE - && name != self::runtime::FUNCTION_RUNTIME_CODE) - } - - /// Checks whether the function is related to the near call ABI. - pub fn is_near_call_abi(name: &str) -> bool { - name.starts_with(Self::ZKSYNC_NEAR_CALL_ABI_PREFIX) - || name == Self::ZKSYNC_NEAR_CALL_ABI_EXCEPTION_HANDLER + && name != self::runtime::FUNCTION_RUNTIME_CODE + && name != self::runtime::FUNCTION_LOAD_IMMUTABLE_DATA) } /// Returns the LLVM function declaration. diff --git a/crates/llvm-context/src/polkavm/context/function/runtime/deploy_code.rs b/crates/llvm-context/src/polkavm/context/function/runtime/deploy_code.rs index 9e6a627..8649da3 100644 --- a/crates/llvm-context/src/polkavm/context/function/runtime/deploy_code.rs +++ b/crates/llvm-context/src/polkavm/context/function/runtime/deploy_code.rs @@ -42,8 +42,7 @@ where D: Dependency + Clone, { fn declare(&mut self, context: &mut Context) -> anyhow::Result<()> { - let function_type = - context.function_type::(vec![], 0, false); + let function_type = context.function_type::(vec![], 0); context.add_function( runtime::FUNCTION_DEPLOY_CODE, function_type, diff --git a/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs b/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs index 46f8ad7..397434a 100644 --- a/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs +++ b/crates/llvm-context/src/polkavm/context/function/runtime/entry.rs @@ -1,12 +1,10 @@ //! The entry function. use inkwell::types::BasicType; -use inkwell::values::BasicValue; use crate::polkavm::context::address_space::AddressSpace; use crate::polkavm::context::function::runtime; use crate::polkavm::context::Context; -use crate::polkavm::r#const::*; use crate::polkavm::Dependency; use crate::polkavm::WriteLLVM; @@ -20,14 +18,8 @@ impl Entry { /// The call flags argument index. pub const ARGUMENT_INDEX_CALL_FLAGS: usize = 0; - /// The number of mandatory arguments. - pub const MANDATORY_ARGUMENTS_COUNT: usize = 2; - - /// Reserve 1mb for calldata. - pub const MAX_CALLDATA_SIZE: usize = 1024 * 1024; - - /// Reserve 1mb for returndata. - pub const MAX_RETURNDATA_SIZE: usize = 1024 * 1024; + /// Reserve 1kb for calldata. + pub const MAX_CALLDATA_SIZE: usize = 1024; /// Initializes the global variables. /// The pointers are not initialized, because it's not possible to create a null pointer. @@ -43,14 +35,6 @@ impl Entry { calldata_type.get_undef(), ); - let returndata_type = context.array_type(context.byte_type(), Self::MAX_RETURNDATA_SIZE); - context.set_global( - crate::polkavm::GLOBAL_RETURN_DATA_POINTER, - returndata_type, - AddressSpace::Stack, - returndata_type.get_undef(), - ); - context.set_global( crate::polkavm::GLOBAL_HEAP_MEMORY_POINTER, context.llvm().ptr_type(AddressSpace::Heap.into()), @@ -61,7 +45,10 @@ impl Entry { context .get_global(crate::polkavm::GLOBAL_HEAP_MEMORY_POINTER)? .into(), - context.build_sbrk(context.integer_const(crate::polkavm::XLEN, 0))?, + context.build_sbrk( + context.xlen_type().const_zero(), + context.xlen_type().const_zero(), + )?, )?; context.set_global( @@ -70,12 +57,6 @@ impl Entry { AddressSpace::Stack, context.word_undef(), ); - context.set_global( - crate::polkavm::GLOBAL_RETURN_DATA_SIZE, - context.xlen_type(), - AddressSpace::Stack, - context.xlen_type().const_zero().as_basic_value_enum(), - ); context.set_global( crate::polkavm::GLOBAL_CALL_FLAGS, @@ -84,44 +65,6 @@ impl Entry { context.word_const(0), ); - let extra_abi_data_type = context.array_type( - context.word_type().as_basic_type_enum(), - crate::polkavm::EXTRA_ABI_DATA_SIZE, - ); - context.set_global( - crate::polkavm::GLOBAL_EXTRA_ABI_DATA, - extra_abi_data_type, - AddressSpace::Stack, - extra_abi_data_type.const_zero(), - ); - - context.set_global( - crate::polkavm::GLOBAL_I256_SIZE, - context.xlen_type(), - AddressSpace::Stack, - context.integer_const( - crate::polkavm::XLEN, - revive_common::BYTE_LENGTH_X64 as u64 * 4, - ), - ); - - context.set_global( - crate::polkavm::GLOBAL_I160_SIZE, - context.xlen_type(), - AddressSpace::Stack, - context.integer_const( - crate::polkavm::XLEN, - revive_common::BYTE_LENGTH_X64 as u64 * 2 + revive_common::BYTE_LENGTH_X32 as u64, - ), - ); - - context.set_global( - crate::polkavm::GLOBAL_I64_SIZE, - context.xlen_type(), - AddressSpace::Stack, - context.integer_const(crate::polkavm::XLEN, revive_common::BYTE_LENGTH_X64 as u64), - ); - Ok(()) } @@ -141,7 +84,7 @@ impl Entry { "input_pointer_casted", )?; - let length_pointer = context.build_alloca(context.xlen_type(), "len_ptr"); + let length_pointer = context.build_alloca_at_entry(context.xlen_type(), "len_ptr"); let length_pointer_casted = context.builder.build_ptr_to_int( length_pointer.value, context.xlen_type(), @@ -153,7 +96,7 @@ impl Entry { context.integer_const(crate::polkavm::XLEN, Self::MAX_CALLDATA_SIZE as u64), )?; context.build_runtime_call( - runtime_api::imports::INPUT, + revive_runtime_api::polkavm_imports::INPUT, &[input_pointer_casted.into(), length_pointer_casted.into()], ); @@ -232,12 +175,25 @@ where { fn declare(&mut self, context: &mut Context) -> anyhow::Result<()> { let entry_arguments = vec![context.bool_type().as_basic_type_enum()]; - let entry_function_type = context.function_type(entry_arguments, 0, false); - context.add_function(runtime::FUNCTION_ENTRY, entry_function_type, 0, None)?; + let entry_function_type = context.function_type(entry_arguments, 0); + context.add_function( + runtime::FUNCTION_ENTRY, + entry_function_type, + 0, + Some(inkwell::module::Linkage::External), + )?; - for symbol in runtime_api::exports::EXPORTS { - context.declare_extern_function(symbol)?; - } + context.declare_global( + revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_POINTER, + context.word_type().array_type(0), + AddressSpace::Stack, + ); + + context.declare_global( + revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_SIZE, + context.xlen_type(), + AddressSpace::Stack, + ); Ok(()) } @@ -258,26 +214,6 @@ where true, ); - context.set_current_function(runtime_api::exports::DEPLOY)?; - context.set_basic_block(context.current_function().borrow().entry_block()); - - assert!(context - .build_call(entry, &[context.bool_const(true).into()], "entry_deploy") - .is_none()); - - context.set_basic_block(context.current_function().borrow().return_block); - context.build_unreachable(); - - context.set_current_function(runtime_api::exports::CALL)?; - context.set_basic_block(context.current_function().borrow().entry_block()); - - assert!(context - .build_call(entry, &[context.bool_const(false).into()], "entry_call") - .is_none()); - - context.set_basic_block(context.current_function().borrow().return_block); - context.build_unreachable(); - context.set_current_function(runtime::FUNCTION_ENTRY)?; context.set_basic_block(context.current_function().borrow().entry_block()); diff --git a/crates/llvm-context/src/polkavm/context/function/runtime/immutable_data_load.rs b/crates/llvm-context/src/polkavm/context/function/runtime/immutable_data_load.rs new file mode 100644 index 0000000..e9e1665 --- /dev/null +++ b/crates/llvm-context/src/polkavm/context/function/runtime/immutable_data_load.rs @@ -0,0 +1,116 @@ +//! The immutable data runtime function. + +use crate::polkavm::context::address_space::AddressSpace; +use crate::polkavm::context::function::runtime; +use crate::polkavm::context::pointer::Pointer; +use crate::polkavm::context::Context; +use crate::polkavm::Dependency; +use crate::polkavm::WriteLLVM; + +/// A function for requesting the immutable data from the runtime. +/// This is a special function that is only used by the front-end generated code. +/// +/// The runtime API is called lazily and subsequent calls are no-ops. +/// +/// The bytes written is asserted to match the expected length. +/// This should never fail; the length is known. +/// However, this is a one time assertion, hence worth it. +#[derive(Debug)] +pub struct ImmutableDataLoad; + +impl WriteLLVM for ImmutableDataLoad +where + D: Dependency + Clone, +{ + fn declare(&mut self, context: &mut Context) -> anyhow::Result<()> { + context.add_function( + runtime::FUNCTION_LOAD_IMMUTABLE_DATA, + context.void_type().fn_type(Default::default(), false), + 0, + Some(inkwell::module::Linkage::Private), + )?; + + Ok(()) + } + + fn into_llvm(self, context: &mut Context) -> anyhow::Result<()> { + context.set_current_function(runtime::FUNCTION_LOAD_IMMUTABLE_DATA)?; + context.set_basic_block(context.current_function().borrow().entry_block()); + + let immutable_data_size_pointer = context + .get_global(revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_SIZE)? + .value + .as_pointer_value(); + let immutable_data_size = context.build_load( + Pointer::new( + context.xlen_type(), + AddressSpace::Stack, + immutable_data_size_pointer, + ), + "immutable_data_size_load", + )?; + + let load_immutable_data_block = context.append_basic_block("load_immutables_block"); + let return_block = context.current_function().borrow().return_block(); + let immutable_data_size_is_zero = context.builder().build_int_compare( + inkwell::IntPredicate::EQ, + context.xlen_type().const_zero(), + immutable_data_size.into_int_value(), + "immutable_data_size_is_zero", + )?; + context.build_conditional_branch( + immutable_data_size_is_zero, + return_block, + load_immutable_data_block, + )?; + + context.set_basic_block(load_immutable_data_block); + let output_pointer = context + .get_global(revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_POINTER)? + .value + .as_pointer_value(); + context.build_runtime_call( + revive_runtime_api::polkavm_imports::GET_IMMUTABLE_DATA, + &[ + context + .builder() + .build_ptr_to_int(output_pointer, context.xlen_type(), "ptr_to_xlen")? + .into(), + context + .builder() + .build_ptr_to_int( + immutable_data_size_pointer, + context.xlen_type(), + "ptr_to_xlen", + )? + .into(), + ], + ); + let bytes_written = context.builder().build_load( + context.xlen_type(), + immutable_data_size_pointer, + "bytes_written", + )?; + context.builder().build_store( + immutable_data_size_pointer, + context.xlen_type().const_zero(), + )?; + let overflow_block = context.append_basic_block("immutable_data_overflow"); + let is_overflow = context.builder().build_int_compare( + inkwell::IntPredicate::UGT, + immutable_data_size.into_int_value(), + bytes_written.into_int_value(), + "is_overflow", + )?; + context.build_conditional_branch(is_overflow, overflow_block, return_block)?; + + context.set_basic_block(overflow_block); + context.build_call(context.intrinsics().trap, &[], "invalid_trap"); + context.build_unreachable(); + + context.set_basic_block(return_block); + context.build_return(None); + + Ok(()) + } +} diff --git a/crates/llvm-context/src/polkavm/context/function/runtime/mod.rs b/crates/llvm-context/src/polkavm/context/function/runtime/mod.rs index 9d3bb42..0712f31 100644 --- a/crates/llvm-context/src/polkavm/context/function/runtime/mod.rs +++ b/crates/llvm-context/src/polkavm/context/function/runtime/mod.rs @@ -2,6 +2,7 @@ pub mod deploy_code; pub mod entry; +pub mod immutable_data_load; pub mod runtime_code; /// The main entry function name. @@ -12,3 +13,6 @@ pub const FUNCTION_DEPLOY_CODE: &str = "__deploy"; /// The runtime code function name. pub const FUNCTION_RUNTIME_CODE: &str = "__runtime"; + +/// The immutable data load function name. +pub const FUNCTION_LOAD_IMMUTABLE_DATA: &str = "__immutable_data_load"; diff --git a/crates/llvm-context/src/polkavm/context/function/runtime/runtime_code.rs b/crates/llvm-context/src/polkavm/context/function/runtime/runtime_code.rs index 5b9c05d..439340c 100644 --- a/crates/llvm-context/src/polkavm/context/function/runtime/runtime_code.rs +++ b/crates/llvm-context/src/polkavm/context/function/runtime/runtime_code.rs @@ -42,8 +42,7 @@ where D: Dependency + Clone, { fn declare(&mut self, context: &mut Context) -> anyhow::Result<()> { - let function_type = - context.function_type::(vec![], 0, false); + let function_type = context.function_type::(vec![], 0); context.add_function( runtime::FUNCTION_RUNTIME_CODE, function_type, diff --git a/crates/llvm-context/src/polkavm/context/global.rs b/crates/llvm-context/src/polkavm/context/global.rs index 4649169..0f44bf1 100644 --- a/crates/llvm-context/src/polkavm/context/global.rs +++ b/crates/llvm-context/src/polkavm/context/global.rs @@ -51,4 +51,31 @@ impl<'ctx> Global<'ctx> { global } + + /// Construct an external global. + pub fn declare( + context: &mut Context<'ctx, D>, + r#type: T, + address_space: AddressSpace, + name: &str, + ) -> Self + where + D: PolkaVMDependency + Clone, + T: BasicType<'ctx>, + { + let r#type = r#type.as_basic_type_enum(); + + let value = context + .module() + .add_global(r#type, Some(address_space.into()), name); + let global = Self { r#type, value }; + + global.value.set_linkage(inkwell::module::Linkage::External); + global + .value + .set_visibility(inkwell::GlobalVisibility::Default); + global.value.set_externally_initialized(true); + + global + } } diff --git a/crates/llvm-context/src/polkavm/context/mod.rs b/crates/llvm-context/src/polkavm/context/mod.rs index 931f9da..7b41346 100644 --- a/crates/llvm-context/src/polkavm/context/mod.rs +++ b/crates/llvm-context/src/polkavm/context/mod.rs @@ -26,7 +26,6 @@ use inkwell::values::BasicValue; use crate::optimizer::settings::Settings as OptimizerSettings; use crate::optimizer::Optimizer; -use crate::polkavm::r#const::*; use crate::polkavm::DebugConfig; use crate::polkavm::Dependency; use crate::target_machine::target::Target; @@ -124,29 +123,19 @@ where .expect("the stdlib module should be linkable"); } - /// Link in the PolkaVM guest module, containing imported and exported functions, + /// Link in the PolkaVM imports module, containing imported functions, /// and marking them as external (they need to be relocatable as too). - fn link_polkavm_guest_module( + fn link_polkavm_imports( llvm: &'ctx inkwell::context::Context, module: &inkwell::module::Module<'ctx>, ) { module .link_in_module( - pallet_contracts_pvm_llapi::polkavm_guest::module(llvm, "polkavm_guest").unwrap(), + revive_runtime_api::polkavm_imports::module(llvm, "polkavm_imports").unwrap(), ) - .expect("the PolkaVM guest API module should be linkable"); + .expect("the PolkaVM imports module should be linkable"); - for export in runtime_api::exports::EXPORTS { - module - .get_function(export) - .expect("should be declared") - .add_attribute( - inkwell::attributes::AttributeLoc::Function, - llvm.create_enum_attribute(Attribute::NoReturn as u32, 0), - ); - } - - for import in runtime_api::imports::IMPORTS { + for import in revive_runtime_api::polkavm_imports::IMPORTS { module .get_function(import) .expect("should be declared") @@ -154,6 +143,36 @@ where } } + fn link_polkavm_exports(&self, contract_path: &str) -> anyhow::Result<()> { + let exports = revive_runtime_api::polkavm_exports::module(self.llvm(), "polkavm_exports") + .map_err(|error| { + anyhow::anyhow!( + "The contract `{}` exports module loading error: {}", + contract_path, + error + ) + })?; + self.module.link_in_module(exports).map_err(|error| { + anyhow::anyhow!( + "The contract `{}` exports module linking error: {}", + contract_path, + error + ) + }) + } + + fn link_immutable_data(&self, contract_path: &str) -> anyhow::Result<()> { + let size = self.solidity().immutables_size() as u32; + let exports = revive_runtime_api::immutable_data::module(self.llvm(), size); + self.module.link_in_module(exports).map_err(|error| { + anyhow::anyhow!( + "The contract `{}` immutable data module linking error: {}", + contract_path, + error + ) + }) + } + /// Configure the PolkaVM minimum stack size. fn set_polkavm_stack_size( llvm: &'ctx inkwell::context::Context, @@ -161,7 +180,7 @@ where size: u32, ) { module - .link_in_module(pallet_contracts_pvm_llapi::polkavm_guest::min_stack_size( + .link_in_module(revive_runtime_api::calling_convention::min_stack_size( llvm, "polkavm_stack_size", size, @@ -191,7 +210,7 @@ where debug_config: Option, ) -> Self { Self::link_stdlib_module(llvm, &module); - Self::link_polkavm_guest_module(llvm, &module); + Self::link_polkavm_imports(llvm, &module); Self::set_polkavm_stack_size(llvm, &module, Self::POLKAVM_STACK_SIZE); Self::set_module_flags(llvm, &module); @@ -230,6 +249,9 @@ where ) -> anyhow::Result { let module_clone = self.module.clone(); + self.link_polkavm_exports(contract_path)?; + self.link_immutable_data(contract_path)?; + let target_machine = TargetMachine::new(Target::PVM, self.optimizer.settings())?; target_machine.set_target_data(self.module()); @@ -371,6 +393,15 @@ where } } + /// Declare an external global. + pub fn declare_global(&mut self, name: &str, r#type: T, address_space: AddressSpace) + where + T: BasicType<'ctx> + Clone + Copy, + { + let global = Global::declare(self, r#type, address_space, name); + self.globals.insert(name.to_owned(), global); + } + /// Returns the LLVM intrinsics collection reference. pub fn intrinsics(&self) -> &Intrinsics<'ctx> { &self.intrinsics @@ -381,47 +412,14 @@ where &self.llvm_runtime } - /// Declare a function already existing in the module. - pub fn declare_extern_function( - &mut self, - name: &str, - ) -> anyhow::Result>>> { - let function = self.module().get_function(name).ok_or_else(|| { - anyhow::anyhow!("Failed to activate an undeclared function `{}`", name) - })?; - - let basic_block = self.llvm.append_basic_block(function, name); - let declaration = FunctionDeclaration::new( - self.function_type::(vec![], 0, false), - function, - ); - let function = Function::new( - name.to_owned(), - declaration, - FunctionReturn::None, - basic_block, - basic_block, - ); - Function::set_default_attributes(self.llvm, function.declaration(), &self.optimizer); - - let function = Rc::new(RefCell::new(function)); - self.functions.insert(name.to_string(), function.clone()); - - Ok(function) - } - /// Appends a function to the current module. pub fn add_function( &mut self, name: &str, r#type: inkwell::types::FunctionType<'ctx>, return_values_length: usize, - mut linkage: Option, + linkage: Option, ) -> anyhow::Result>>> { - if Function::is_near_call_abi(name) && self.is_system_mode() { - linkage = Some(inkwell::module::Linkage::External); - } - let value = self.module().add_function(name, r#type, linkage); let entry_block = self.llvm.append_basic_block(value, "entry"); @@ -434,12 +432,6 @@ where let pointer = self.build_alloca(self.word_type(), "return_pointer"); FunctionReturn::primitive(pointer) } - size if name.starts_with(Function::ZKSYNC_NEAR_CALL_ABI_PREFIX) => { - let first_argument = value.get_first_param().expect("Always exists"); - let r#type = self.structure_type(vec![self.word_type(); size].as_slice()); - let pointer = first_argument.into_pointer_value(); - FunctionReturn::compound(Pointer::new(r#type, AddressSpace::Stack, pointer), size) - } size => { self.set_basic_block(entry_block); let pointer = self.build_alloca( @@ -460,10 +452,6 @@ where return_block, ); Function::set_default_attributes(self.llvm, function.declaration(), &self.optimizer); - if Function::is_near_call_abi(function.name()) && self.is_system_mode() { - Function::set_exception_handler_attributes(self.llvm, function.declaration()); - } - let function = Rc::new(RefCell::new(function)); self.functions.insert(name.to_string(), function.clone()); @@ -524,10 +512,6 @@ where manager, name, self.optimizer.settings().to_owned(), - self.yul_data - .as_ref() - .map(|data| data.is_system_mode()) - .unwrap_or_default(), self.include_metadata_hash, self.debug_config.clone(), ) @@ -585,59 +569,70 @@ where self.builder.get_insert_block().expect("Always exists") } - /// Builds a stack allocation instruction. - /// Sets the alignment to 128 bits. + /// Builds an aligned stack allocation at the function entry. + pub fn build_alloca_at_entry + Clone + Copy>( + &self, + r#type: T, + name: &str, + ) -> Pointer<'ctx> { + let current_block = self.basic_block(); + let entry_block = self.current_function().borrow().entry_block(); + + match entry_block.get_first_instruction() { + Some(instruction) => self.builder().position_before(&instruction), + None => self.builder().position_at_end(entry_block), + } + + let pointer = self.build_alloca(r#type, name); + self.set_basic_block(current_block); + pointer + } + + /// Builds an aligned stack allocation at the current position. + /// Use this if [`build_alloca_at_entry`] might change program semantics. + /// Otherwise, alloca should always be built at the function prelude! pub fn build_alloca + Clone + Copy>( &self, r#type: T, name: &str, ) -> Pointer<'ctx> { let pointer = self.builder.build_alloca(r#type, name).unwrap(); - self.basic_block() - .get_last_instruction() - .expect("Always exists") + pointer + .as_instruction() + .unwrap() .set_alignment(revive_common::BYTE_LENGTH_STACK_ALIGN as u32) .expect("Alignment is valid"); + Pointer::new(r#type, AddressSpace::Stack, pointer) } - /// Allocate an int of size `bit_length` on the stack. - /// Returns the allocation pointer and the length pointer. - /// - /// Useful helper for passing runtime API parameters on the stack. - pub fn build_stack_parameter( + /// Truncate `address` to the ethereum address length and store it as bytes on the stack. + /// The stack allocation will be at the function entry. Returns the stack pointer. + /// This helper should be used when passing address arguments to the runtime, ensuring correct size and endianness. + pub fn build_address_argument_store( &self, - bit_length: usize, - name: &str, - ) -> (Pointer<'ctx>, Pointer<'ctx>) { - let buffer_pointer = self.build_alloca(self.integer_type(bit_length), name); - let symbol = match bit_length { - revive_common::BIT_LENGTH_WORD => GLOBAL_I256_SIZE, - revive_common::BIT_LENGTH_ETH_ADDRESS => GLOBAL_I160_SIZE, - revive_common::BIT_LENGTH_BLOCK_NUMBER => GLOBAL_I64_SIZE, - _ => panic!("invalid stack parameter bit width: {bit_length}"), - }; - let length_pointer = self.get_global(symbol).expect("should be declared"); - (buffer_pointer, length_pointer.into()) + address: inkwell::values::IntValue<'ctx>, + ) -> anyhow::Result> { + let address_type = self.integer_type(revive_common::BIT_LENGTH_ETH_ADDRESS); + let address_pointer = self.build_alloca_at_entry(address_type, "address_pointer"); + let address_truncated = + self.builder() + .build_int_truncate(address, address_type, "address_truncated")?; + let address_swapped = self.build_byte_swap(address_truncated.into())?; + self.build_store(address_pointer, address_swapped)?; + Ok(address_pointer) } - /// Load the integer at given pointer and zero extend it to the VM word size. - pub fn build_load_word( + /// Load the address at given pointer and zero extend it to the VM word size. + pub fn build_load_address( &self, pointer: Pointer<'ctx>, - bit_length: usize, - name: &str, ) -> anyhow::Result> { - let value = self.build_load( - pointer.cast(self.integer_type(bit_length)), - &format!("load_{name}"), - )?; - let value_extended = self.builder().build_int_z_extend( - value.into_int_value(), - self.word_type(), - &format!("zext_{name}"), - )?; - Ok(value_extended.as_basic_value_enum()) + let address = self.build_byte_swap(self.build_load(pointer, "address_pointer")?)?; + Ok(self + .builder() + .build_int_z_extend(address.into_int_value(), self.word_type(), "address_zext")? + .into()) } /// Builds a stack load instruction. @@ -674,31 +669,25 @@ where self.build_byte_swap(value) } AddressSpace::Storage | AddressSpace::TransientStorage => { - let storage_key_value = self.builder().build_ptr_to_int( - pointer.value, - self.word_type(), - "storage_ptr_to_int", - )?; - let storage_key_pointer = self.build_alloca(self.word_type(), "storage_key"); - let storage_key_pointer_casted = self.builder().build_ptr_to_int( - storage_key_pointer.value, - self.xlen_type(), - "storage_key_pointer_casted", - )?; - self.builder() - .build_store(storage_key_pointer.value, storage_key_value)?; + let storage_value_pointer = + self.build_alloca(self.word_type(), "storage_value_pointer"); + self.build_store(storage_value_pointer, self.word_const(0))?; - let (storage_value_pointer, storage_value_length_pointer) = self - .build_stack_parameter(revive_common::BIT_LENGTH_WORD, "storage_value_pointer"); + let storage_value_length_pointer = + self.build_alloca(self.xlen_type(), "storage_value_length_pointer"); + self.build_store( + storage_value_length_pointer, + self.word_const(revive_common::BIT_LENGTH_WORD as u64), + )?; let transient = pointer.address_space == AddressSpace::TransientStorage; self.build_runtime_call( - runtime_api::imports::GET_STORAGE, + revive_runtime_api::polkavm_imports::GET_STORAGE, &[ self.xlen_type().const_int(transient as u64, false).into(), - storage_key_pointer_casted.into(), - self.integer_const(crate::polkavm::XLEN, 32).into(), + pointer.to_int(self).into(), + self.xlen_type().const_all_ones().into(), storage_value_pointer.to_int(self).into(), storage_value_length_pointer.to_int(self).into(), ], @@ -766,18 +755,6 @@ where self.word_type().as_basic_type_enum() ); - let storage_key_value = self.builder().build_ptr_to_int( - pointer.value, - self.word_type(), - "storage_ptr_to_int", - )?; - let storage_key_pointer = self.build_alloca(self.word_type(), "storage_key"); - let storage_key_pointer_casted = self.builder().build_ptr_to_int( - storage_key_pointer.value, - self.xlen_type(), - "storage_key_pointer_casted", - )?; - let storage_value_pointer = self.build_alloca(self.word_type(), "storage_value"); let storage_value_pointer_casted = self.builder().build_ptr_to_int( storage_value_pointer.value, @@ -785,19 +762,17 @@ where "storage_value_pointer_casted", )?; - self.builder() - .build_store(storage_key_pointer.value, storage_key_value)?; self.builder() .build_store(storage_value_pointer.value, value)?; let transient = pointer.address_space == AddressSpace::TransientStorage; self.build_runtime_call( - runtime_api::imports::SET_STORAGE, + revive_runtime_api::polkavm_imports::SET_STORAGE, &[ self.xlen_type().const_int(transient as u64, false).into(), - storage_key_pointer_casted.into(), - self.integer_const(crate::polkavm::XLEN, 32).into(), + pointer.to_int(self).into(), + self.xlen_type().const_all_ones().into(), storage_value_pointer_casted.into(), self.integer_const(crate::polkavm::XLEN, 32).into(), ], @@ -905,13 +880,29 @@ where .copied() .map(inkwell::values::BasicMetadataValueEnum::from) .collect::>(), - &format!("runtime API call {name}"), + &format!("runtime_api_{name}_return_value"), ) .unwrap() .try_as_basic_value() .left() } + /// Builds a call to the runtime API `import`, where `import` is a "getter" API. + /// This means that the supplied API method just writes back a single word. + /// `import` is thus expect to have a single parameter, the 32 bytes output buffer, + /// and no return value. + pub fn build_runtime_call_to_getter( + &self, + import: &'static str, + ) -> anyhow::Result> + where + D: Dependency + Clone, + { + let pointer = self.build_alloca_at_entry(self.word_type(), &format!("{import}_output")); + self.build_runtime_call(import, &[pointer.to_int(self).into()]); + self.build_load(pointer, import) + } + /// Builds a call. pub fn build_call( &self, @@ -1012,7 +1003,7 @@ where )?; self.build_runtime_call( - runtime_api::imports::RETURN, + revive_runtime_api::polkavm_imports::RETURN, &[flags.into(), offset_pointer.into(), length_pointer.into()], ); self.build_unreachable(); @@ -1070,16 +1061,20 @@ where Ok(truncated) } - /// Build a call to PolkaVM `sbrk` for extending the heap by `size`. + /// Build a call to PolkaVM `sbrk` for extending the heap from offset by `size`. + /// The allocation is aligned to 32 bytes. + /// + /// This emulates the EVM linear memory until the runtime supports metered memory. pub fn build_sbrk( &self, + offset: inkwell::values::IntValue<'ctx>, size: inkwell::values::IntValue<'ctx>, ) -> anyhow::Result> { Ok(self .builder() .build_call( - self.runtime_api_method(runtime_api::SBRK), - &[size.into()], + self.runtime_api_method(revive_runtime_api::polkavm_imports::SBRK), + &[offset.into(), size.into()], "call_sbrk", )? .try_as_basic_value() @@ -1088,14 +1083,29 @@ where .into_pointer_value()) } - /// Call PolkaVM `sbrk` for extending the heap by `size`, + /// Build a call to PolkaVM `msize` for querying the linear memory size. + pub fn build_msize(&self) -> anyhow::Result> { + Ok(self + .builder() + .build_call( + self.runtime_api_method(revive_runtime_api::polkavm_imports::MEMORY_SIZE), + &[], + "call_msize", + )? + .try_as_basic_value() + .left() + .expect("sbrk returns an int") + .into_int_value()) + } + + /// Call PolkaVM `sbrk` for extending the heap by `offset` + `size`, /// trapping the contract if the call failed. - /// Returns the end of memory pointer. pub fn build_heap_alloc( &self, + offset: inkwell::values::IntValue<'ctx>, size: inkwell::values::IntValue<'ctx>, - ) -> anyhow::Result> { - let end_of_memory = self.build_sbrk(size)?; + ) -> anyhow::Result<()> { + let end_of_memory = self.build_sbrk(offset, size)?; let return_is_nil = self.builder().build_int_compare( inkwell::IntPredicate::EQ, end_of_memory, @@ -1113,7 +1123,7 @@ where self.set_basic_block(continue_block); - Ok(end_of_memory) + Ok(()) } /// Returns a pointer to `offset` into the heap, allocating @@ -1128,40 +1138,12 @@ where assert_eq!(offset.get_type(), self.xlen_type()); assert_eq!(length.get_type(), self.xlen_type()); + self.build_heap_alloc(offset, length)?; + let heap_start = self .get_global(crate::polkavm::GLOBAL_HEAP_MEMORY_POINTER)? .value .as_pointer_value(); - let heap_end = self.build_sbrk(self.integer_const(crate::polkavm::XLEN, 0))?; - let value_end = self.build_gep( - Pointer::new(self.byte_type(), AddressSpace::Stack, heap_start), - &[self.builder().build_int_nuw_add(offset, length, "end")?], - self.byte_type(), - "heap_end_gep", - ); - let is_out_of_bounds = self.builder().build_int_compare( - inkwell::IntPredicate::UGT, - value_end.value, - heap_end, - "is_value_overflowing_heap", - )?; - - let out_of_bounds_block = self.append_basic_block("heap_offset_out_of_bounds"); - let heap_offset_block = self.append_basic_block("build_heap_pointer"); - self.build_conditional_branch(is_out_of_bounds, out_of_bounds_block, heap_offset_block)?; - - self.set_basic_block(out_of_bounds_block); - let size = self.builder().build_int_nuw_sub( - self.builder() - .build_ptr_to_int(value_end.value, self.xlen_type(), "value_end")?, - self.builder() - .build_ptr_to_int(heap_end, self.xlen_type(), "heap_end")?, - "heap_alloc_size", - )?; - self.build_heap_alloc(size)?; - self.build_unconditional_branch(heap_offset_block); - - self.set_basic_block(heap_offset_block); Ok(self.build_gep( Pointer::new(self.byte_type(), AddressSpace::Stack, heap_start), &[offset], @@ -1233,7 +1215,7 @@ where self.llvm.custom_width_int_type(crate::polkavm::XLEN as u32) } - /// Returns the register witdh sized type. + /// Returns the sentinel pointer value. pub fn sentinel_pointer(&self) -> Pointer<'ctx> { let sentinel_pointer = self .xlen_type() @@ -1282,12 +1264,11 @@ where &self, argument_types: Vec, return_values_size: usize, - is_near_call_abi: bool, ) -> inkwell::types::FunctionType<'ctx> where T: BasicType<'ctx>, { - let mut argument_types: Vec = argument_types + let argument_types: Vec = argument_types .as_slice() .iter() .map(T::as_basic_type_enum) @@ -1299,11 +1280,6 @@ where .void_type() .fn_type(argument_types.as_slice(), false), 1 => self.word_type().fn_type(argument_types.as_slice(), false), - _size if is_near_call_abi && self.is_system_mode() => { - let return_type = self.llvm().ptr_type(AddressSpace::Stack.into()); - argument_types.insert(0, return_type.as_basic_type_enum().into()); - return_type.fn_type(argument_types.as_slice(), false) - } size => self .structure_type(vec![self.word_type().as_basic_type_enum(); size].as_slice()) .fn_type(argument_types.as_slice(), false), @@ -1496,12 +1472,4 @@ where anyhow::bail!("The immutable size data is not available"); } } - - /// Whether the system mode is enabled. - pub fn is_system_mode(&self) -> bool { - self.yul_data - .as_ref() - .map(|data| data.is_system_mode()) - .unwrap_or_default() - } } diff --git a/crates/llvm-context/src/polkavm/context/solidity_data.rs b/crates/llvm-context/src/polkavm/context/solidity_data.rs index e4008a3..467c262 100644 --- a/crates/llvm-context/src/polkavm/context/solidity_data.rs +++ b/crates/llvm-context/src/polkavm/context/solidity_data.rs @@ -17,7 +17,7 @@ impl SolidityData { Self::default() } - /// Returns the current number of immutables values in the contract. + /// Returns the current size of immutable values in the contract. pub fn immutables_size(&self) -> usize { self.immutables.len() * revive_common::BYTE_LENGTH_WORD } diff --git a/crates/llvm-context/src/polkavm/context/yul_data.rs b/crates/llvm-context/src/polkavm/context/yul_data.rs index 41cc13b..74da649 100644 --- a/crates/llvm-context/src/polkavm/context/yul_data.rs +++ b/crates/llvm-context/src/polkavm/context/yul_data.rs @@ -8,28 +8,12 @@ use num::Zero; /// Describes some data that is only relevant to Yul. #[derive(Debug, Default)] pub struct YulData { - /// The system mode flag. - /// The call simulations only work if this mode is enabled. - is_system_mode: bool, /// The list of constant arrays in the code section. /// It is a temporary storage used until the finalization method is called. const_arrays: BTreeMap>, } impl YulData { - /// A shortcut constructor. - pub fn new(is_system_mode: bool) -> Self { - Self { - is_system_mode, - const_arrays: BTreeMap::new(), - } - } - - /// Whether the system mode is enabled. - pub fn is_system_mode(&self) -> bool { - self.is_system_mode - } - /// Declares a temporary constant array representation. pub fn const_array_declare(&mut self, index: u8, size: u16) -> anyhow::Result<()> { if self.const_arrays.contains_key(&index) { diff --git a/crates/llvm-context/src/polkavm/evm/call.rs b/crates/llvm-context/src/polkavm/evm/call.rs index 1215400..1cf67d2 100644 --- a/crates/llvm-context/src/polkavm/evm/call.rs +++ b/crates/llvm-context/src/polkavm/evm/call.rs @@ -5,18 +5,15 @@ use inkwell::values::BasicValue; use crate::polkavm::context::argument::Argument; use crate::polkavm::context::Context; use crate::polkavm::Dependency; -use crate::polkavm_const::runtime_api; -static STATIC_CALL_FLAG: u32 = 0b0001_0000; +const STATIC_CALL_FLAG: u32 = 0b0001_0000; +const REENTRANT_CALL_FLAG: u32 = 0b0000_1000; /// Translates a contract call. -/// -/// If the `simulation_address` is specified, the call is -/// substituted with another instruction according to the specification. #[allow(clippy::too_many_arguments)] pub fn call<'ctx, D>( context: &mut Context<'ctx, D>, - gas: inkwell::values::IntValue<'ctx>, + _gas: inkwell::values::IntValue<'ctx>, address: inkwell::values::IntValue<'ctx>, value: Option>, input_offset: inkwell::values::IntValue<'ctx>, @@ -29,59 +26,64 @@ pub fn call<'ctx, D>( where D: Dependency + Clone, { - let address_pointer = context.build_alloca(context.word_type(), "address_ptr"); - context.build_store(address_pointer, address)?; + let address_pointer = context.build_address_argument_store(address)?; - let value_pointer = if let Some(value) = value { - let value_pointer = context.build_alloca(context.value_type(), "value"); - context.build_store(value_pointer, value)?; - value_pointer - } else { - context.sentinel_pointer() - }; + let value = value.unwrap_or_else(|| context.word_const(0)); + let value_pointer = context.build_alloca_at_entry(context.word_type(), "value_pointer"); + context.build_store(value_pointer, value)?; let input_offset = context.safe_truncate_int_to_xlen(input_offset)?; let input_length = context.safe_truncate_int_to_xlen(input_length)?; let output_offset = context.safe_truncate_int_to_xlen(output_offset)?; let output_length = context.safe_truncate_int_to_xlen(output_length)?; - let gas = context + // TODO: What to supply here? Is there a weight to gas? + let _gas = context .builder() - .build_int_truncate(gas, context.integer_type(64), "gas")?; - - let flags = if static_call { STATIC_CALL_FLAG } else { 0 }; + .build_int_truncate(_gas, context.integer_type(64), "gas")?; let input_pointer = context.build_heap_gep(input_offset, input_length)?; let output_pointer = context.build_heap_gep(output_offset, output_length)?; - let output_length_pointer = context.get_global(crate::polkavm::GLOBAL_RETURN_DATA_SIZE)?; - context.build_store(output_length_pointer.into(), output_length)?; + let output_length_pointer = context.build_alloca_at_entry(context.xlen_type(), "output_length"); + context.build_store(output_length_pointer, output_length)?; - let argument_pointer = pallet_contracts_pvm_llapi::calling_convention::Spill::new( + let flags = if static_call { + REENTRANT_CALL_FLAG | STATIC_CALL_FLAG + } else { + REENTRANT_CALL_FLAG + }; + let flags = context.xlen_type().const_int(flags as u64, false); + + let argument_type = revive_runtime_api::calling_convention::call(context.llvm()); + let argument_pointer = context.build_alloca_at_entry(argument_type, "call_arguments"); + let arguments = &[ + flags.as_basic_value_enum(), + address_pointer.value.as_basic_value_enum(), + context.integer_const(64, 0).as_basic_value_enum(), + context.integer_const(64, 0).as_basic_value_enum(), + context.sentinel_pointer().value.as_basic_value_enum(), + value_pointer.value.as_basic_value_enum(), + input_pointer.value.as_basic_value_enum(), + input_length.as_basic_value_enum(), + output_pointer.value.as_basic_value_enum(), + output_length_pointer.value.as_basic_value_enum(), + ]; + revive_runtime_api::calling_convention::spill( context.builder(), - pallet_contracts_pvm_llapi::calling_convention::call(context.llvm()), - "call_arguments", - )? - .next(context.xlen_type().const_int(flags as u64, false))? - .next(address_pointer.value)? - .next(gas)? - .skip() - .next(context.sentinel_pointer().value)? - .next(value_pointer.value)? - .next(input_pointer.value)? - .next(input_length)? - .next(output_pointer.value)? - .next(output_length_pointer.value)? - .done(); + argument_pointer.value, + argument_type, + arguments, + )?; - let name = runtime_api::imports::CALL; - let arguments = context.builder().build_ptr_to_int( - argument_pointer, + let name = revive_runtime_api::polkavm_imports::CALL; + let argument_pointer = context.builder().build_ptr_to_int( + argument_pointer.value, context.xlen_type(), - "argument_pointer", + "call_argument_pointer", )?; let success = context - .build_runtime_call(name, &[arguments.into()]) + .build_runtime_call(name, &[argument_pointer.into()]) .unwrap_or_else(|| panic!("{name} should return a value")) .into_int_value(); diff --git a/crates/llvm-context/src/polkavm/evm/context.rs b/crates/llvm-context/src/polkavm/evm/context.rs index e270da4..f5d6650 100644 --- a/crates/llvm-context/src/polkavm/evm/context.rs +++ b/crates/llvm-context/src/polkavm/evm/context.rs @@ -4,7 +4,6 @@ use inkwell::values::BasicValue; use crate::polkavm::context::Context; use crate::polkavm::Dependency; -use crate::polkavm_const::runtime_api; /// Translates the `gas_limit` instruction. pub fn gas_limit<'ctx, D>( @@ -28,22 +27,29 @@ where /// Translates the `tx.origin` instruction. pub fn origin<'ctx, D>( - _context: &mut Context<'ctx, D>, + context: &mut Context<'ctx, D>, ) -> anyhow::Result> where D: Dependency + Clone, { - todo!() + let address_type = context.integer_type(revive_common::BIT_LENGTH_ETH_ADDRESS); + let address_pointer = context.build_alloca_at_entry(address_type, "origin_address"); + context.build_store(address_pointer, address_type.const_zero())?; + context.build_runtime_call( + revive_runtime_api::polkavm_imports::ORIGIN, + &[address_pointer.to_int(context).into()], + ); + context.build_load_address(address_pointer) } /// Translates the `chain_id` instruction. pub fn chain_id<'ctx, D>( - _context: &mut Context<'ctx, D>, + context: &mut Context<'ctx, D>, ) -> anyhow::Result> where D: Dependency + Clone, { - todo!() + context.build_runtime_call_to_getter(revive_runtime_api::polkavm_imports::CHAIN_ID) } /// Translates the `block_number` instruction. @@ -53,22 +59,7 @@ pub fn block_number<'ctx, D>( where D: Dependency + Clone, { - let (output_pointer, output_length_pointer) = context.build_stack_parameter( - revive_common::BIT_LENGTH_BLOCK_NUMBER, - "block_timestamp_output", - ); - context.build_runtime_call( - runtime_api::imports::BLOCK_NUMBER, - &[ - output_pointer.to_int(context).into(), - output_length_pointer.to_int(context).into(), - ], - ); - context.build_load_word( - output_pointer, - revive_common::BIT_LENGTH_BLOCK_NUMBER, - "block_number", - ) + context.build_runtime_call_to_getter(revive_runtime_api::polkavm_imports::BLOCK_NUMBER) } /// Translates the `block_timestamp` instruction. @@ -78,22 +69,7 @@ pub fn block_timestamp<'ctx, D>( where D: Dependency + Clone, { - let (output_pointer, output_length_pointer) = context.build_stack_parameter( - revive_common::BIT_LENGTH_BLOCK_TIMESTAMP, - "block_timestamp_output", - ); - context.build_runtime_call( - runtime_api::imports::NOW, - &[ - output_pointer.to_int(context).into(), - output_length_pointer.to_int(context).into(), - ], - ); - context.build_load_word( - output_pointer, - revive_common::BIT_LENGTH_BLOCK_TIMESTAMP, - "block_timestamp", - ) + context.build_runtime_call_to_getter(revive_runtime_api::polkavm_imports::NOW) } /// Translates the `block_hash` instruction. @@ -137,33 +113,6 @@ where Ok(context.word_const(0).as_basic_value_enum()) } -/// Translates the `msize` instruction. -pub fn msize<'ctx, D>( - context: &mut Context<'ctx, D>, -) -> anyhow::Result> -where - D: Dependency + Clone, -{ - let heap_end = context.build_sbrk(context.xlen_type().const_zero())?; - let heap_start = context - .get_global(crate::polkavm::GLOBAL_HEAP_MEMORY_POINTER)? - .value - .as_pointer_value(); - let heap_size = context.builder().build_int_nuw_sub( - context - .builder() - .build_ptr_to_int(heap_end, context.xlen_type(), "heap_end")?, - context - .builder() - .build_ptr_to_int(heap_start, context.xlen_type(), "heap_start")?, - "heap_size", - )?; - Ok(context - .builder() - .build_int_z_extend(heap_size, context.word_type(), "heap_size_extended")? - .as_basic_value_enum()) -} - /// Translates the `address` instruction. pub fn address<'ctx, D>( context: &mut Context<'ctx, D>, @@ -171,20 +120,15 @@ pub fn address<'ctx, D>( where D: Dependency + Clone, { - let (output_pointer, output_length_pointer) = - context.build_stack_parameter(revive_common::BIT_LENGTH_ETH_ADDRESS, "address_output"); - context.build_runtime_call( - runtime_api::imports::ADDRESS, - &[ - output_pointer.to_int(context).into(), - output_length_pointer.to_int(context).into(), - ], + let pointer = context.build_alloca_at_entry( + context.integer_type(revive_common::BIT_LENGTH_ETH_ADDRESS), + "address_output", ); - let value = context.build_byte_swap(context.build_load(output_pointer, "address")?)?; - Ok(context - .builder() - .build_int_z_extend(value.into_int_value(), context.word_type(), "address_zext")? - .into()) + context.build_runtime_call( + revive_runtime_api::polkavm_imports::ADDRESS, + &[pointer.to_int(context).into()], + ); + context.build_load_address(pointer) } /// Translates the `caller` instruction. @@ -194,18 +138,13 @@ pub fn caller<'ctx, D>( where D: Dependency + Clone, { - let (output_pointer, output_length_pointer) = - context.build_stack_parameter(revive_common::BIT_LENGTH_ETH_ADDRESS, "caller_output"); - context.build_runtime_call( - runtime_api::imports::CALLER, - &[ - output_pointer.to_int(context).into(), - output_length_pointer.to_int(context).into(), - ], + let pointer = context.build_alloca_at_entry( + context.integer_type(revive_common::BIT_LENGTH_ETH_ADDRESS), + "address_output", ); - let value = context.build_byte_swap(context.build_load(output_pointer, "caller")?)?; - Ok(context - .builder() - .build_int_z_extend(value.into_int_value(), context.word_type(), "caller_zext")? - .into()) + context.build_runtime_call( + revive_runtime_api::polkavm_imports::CALLER, + &[pointer.to_int(context).into()], + ); + context.build_load_address(pointer) } diff --git a/crates/llvm-context/src/polkavm/evm/create.rs b/crates/llvm-context/src/polkavm/evm/create.rs index ecb1967..1aee521 100644 --- a/crates/llvm-context/src/polkavm/evm/create.rs +++ b/crates/llvm-context/src/polkavm/evm/create.rs @@ -7,28 +7,15 @@ use crate::polkavm::context::argument::Argument; use crate::polkavm::context::code_type::CodeType; use crate::polkavm::context::Context; use crate::polkavm::Dependency; -use crate::polkavm_const::runtime_api; -/// Translates the contract `create` instruction. -/// The instruction is simulated by a call to a system contract. +/// Translates the contract `create` and `create2` instruction. +/// +/// A `salt` value of `None` is equivalent to `create1`. pub fn create<'ctx, D>( context: &mut Context<'ctx, D>, value: inkwell::values::IntValue<'ctx>, input_offset: inkwell::values::IntValue<'ctx>, input_length: inkwell::values::IntValue<'ctx>, -) -> anyhow::Result> -where - D: Dependency + Clone, -{ - self::create2(context, value, input_offset, input_length, None) -} - -/// Translates the contract `create2` instruction. -pub fn create2<'ctx, D>( - context: &mut Context<'ctx, D>, - value: inkwell::values::IntValue<'ctx>, - input_offset: inkwell::values::IntValue<'ctx>, - input_length: inkwell::values::IntValue<'ctx>, salt: Option>, ) -> anyhow::Result> where @@ -37,9 +24,6 @@ where let input_offset = context.safe_truncate_int_to_xlen(input_offset)?; let input_length = context.safe_truncate_int_to_xlen(input_length)?; - let value_pointer = context.build_alloca(context.value_type(), "value"); - context.build_store(value_pointer, value)?; - let code_hash_pointer = context.build_heap_gep(input_offset, input_length)?; let input_data_pointer = context.build_gep( @@ -48,53 +32,68 @@ where .xlen_type() .const_int(revive_common::BYTE_LENGTH_WORD as u64, false)], context.byte_type(), - "value_ptr_parameter_offset", + "input_ptr_parameter_offset", ); - let salt_pointer = context.build_alloca(context.word_type(), "salt"); - context.build_store(salt_pointer, salt.unwrap_or_else(|| context.word_const(0)))?; + let value_pointer = context.build_alloca_at_entry(context.value_type(), "transferred_value"); + context.build_store(value_pointer, value)?; - let (address_pointer, address_length_pointer) = - context.build_stack_parameter(revive_common::BIT_LENGTH_ETH_ADDRESS, "address_pointer"); + let salt_pointer = match salt { + Some(salt) => { + let salt_pointer = context.build_alloca_at_entry(context.word_type(), "salt_pointer"); + context.build_store(salt_pointer, salt)?; + salt_pointer + } + None => context.sentinel_pointer(), + }; + + let address_pointer = context.build_alloca_at_entry( + context.integer_type(revive_common::BIT_LENGTH_ETH_ADDRESS), + "address_pointer", + ); context.build_store(address_pointer, context.word_const(0))?; - let argument_pointer = pallet_contracts_pvm_llapi::calling_convention::Spill::new( + let argument_type = revive_runtime_api::calling_convention::instantiate(context.llvm()); + let argument_pointer = context.build_alloca_at_entry(argument_type, "instantiate_arguments"); + let arguments = &[ + code_hash_pointer.value.as_basic_value_enum(), + context.integer_const(64, 0).as_basic_value_enum(), + context.integer_const(64, 0).as_basic_value_enum(), + context.sentinel_pointer().value.as_basic_value_enum(), + value_pointer.value.as_basic_value_enum(), + input_data_pointer.value.as_basic_value_enum(), + input_length.as_basic_value_enum(), + address_pointer.value.as_basic_value_enum(), + context.sentinel_pointer().value.as_basic_value_enum(), + context.sentinel_pointer().value.as_basic_value_enum(), + salt_pointer.value.as_basic_value_enum(), + ]; + revive_runtime_api::calling_convention::spill( context.builder(), - pallet_contracts_pvm_llapi::calling_convention::instantiate(context.llvm()), - "create2_arguments", - )? - .next(code_hash_pointer.value)? - .skip() - .skip() - .next(context.sentinel_pointer().value)? - .next(value_pointer.value)? - .next(input_data_pointer.value)? - .next(input_length)? - .next(address_pointer.value)? - .next(address_length_pointer.value)? - .next(context.sentinel_pointer().value)? - .next(context.sentinel_pointer().value)? - .next(salt_pointer.value)? - .next( - context - .xlen_type() - .const_int(revive_common::BYTE_LENGTH_WORD as u64, false), - )? - .done(); + argument_pointer.value, + argument_type, + arguments, + )?; + let argument_pointer = context.builder().build_ptr_to_int( + argument_pointer.value, + context.xlen_type(), + "instantiate_argument_pointer", + )?; context.build_runtime_call( - runtime_api::imports::INSTANTIATE, - &[context - .builder() - .build_ptr_to_int(argument_pointer, context.xlen_type(), "argument_pointer")? - .into()], + revive_runtime_api::polkavm_imports::INSTANTIATE, + &[argument_pointer.into()], ); - context.build_load_word( - address_pointer, - revive_common::BIT_LENGTH_ETH_ADDRESS, - "address", - ) + let address = context.build_byte_swap(context.build_load(address_pointer, "address")?)?; + Ok(context + .builder() + .build_int_z_extend( + address.into_int_value(), + context.word_type(), + "address_zext", + )? + .into()) } /// Translates the contract hash instruction, which is actually used to set the hash of the contract diff --git a/crates/llvm-context/src/polkavm/evm/crypto.rs b/crates/llvm-context/src/polkavm/evm/crypto.rs index 3e83ea6..c3a11e7 100644 --- a/crates/llvm-context/src/polkavm/evm/crypto.rs +++ b/crates/llvm-context/src/polkavm/evm/crypto.rs @@ -2,7 +2,6 @@ use crate::polkavm::context::Context; use crate::polkavm::Dependency; -use crate::polkavm_const::runtime_api; /// Translates the `sha3` instruction. pub fn sha3<'ctx, D>( @@ -19,7 +18,7 @@ where let output_pointer = context.build_alloca(context.word_type(), "output_pointer"); context.build_runtime_call( - runtime_api::imports::HASH_KECCAK_256, + revive_runtime_api::polkavm_imports::HASH_KECCAK_256, &[ input_pointer.to_int(context).into(), length_casted.into(), diff --git a/crates/llvm-context/src/polkavm/evm/ether_gas.rs b/crates/llvm-context/src/polkavm/evm/ether_gas.rs index 5d2ac51..e59b9ba 100644 --- a/crates/llvm-context/src/polkavm/evm/ether_gas.rs +++ b/crates/llvm-context/src/polkavm/evm/ether_gas.rs @@ -4,7 +4,6 @@ use inkwell::values::BasicValue; use crate::polkavm::context::Context; use crate::polkavm::Dependency; -use crate::polkavm_const::runtime_api; /// Translates the `gas` instruction. pub fn gas<'ctx, D>( @@ -23,20 +22,13 @@ pub fn value<'ctx, D>( where D: Dependency + Clone, { - let (output_pointer, output_length_pointer) = - context.build_stack_parameter(revive_common::BIT_LENGTH_VALUE, "value_transferred_output"); + let output_pointer = context.build_alloca(context.value_type(), "value_transferred"); + context.build_store(output_pointer, context.word_const(0))?; context.build_runtime_call( - runtime_api::imports::VALUE_TRANSFERRED, - &[ - output_pointer.to_int(context).into(), - output_length_pointer.to_int(context).into(), - ], + revive_runtime_api::polkavm_imports::VALUE_TRANSFERRED, + &[output_pointer.to_int(context).into()], ); - context.build_load_word( - output_pointer, - revive_common::BIT_LENGTH_VALUE, - "value_transferred", - ) + context.build_load(output_pointer, "value_transferred") } /// Translates the `balance` instructions. @@ -47,24 +39,40 @@ pub fn balance<'ctx, D>( where D: Dependency + Clone, { - let balance_pointer = context.build_alloca(context.word_type(), "balance_pointer"); - let address_pointer = context.build_alloca(context.word_type(), "address_pointer"); - context.build_store(address_pointer, address)?; + let address_pointer = context.build_address_argument_store(address)?; + let balance_pointer = context.build_alloca(context.word_type(), "balance_pointer"); let balance = context.builder().build_ptr_to_int( balance_pointer.value, context.xlen_type(), "balance", )?; - let address = context.builder().build_ptr_to_int( - address_pointer.value, - context.xlen_type(), - "address", - )?; context.build_runtime_call( - runtime_api::imports::BALANCE, - &[address.into(), balance.into()], + revive_runtime_api::polkavm_imports::BALANCE_OF, + &[address_pointer.to_int(context).into(), balance.into()], + ); + + context.build_load(balance_pointer, "balance") +} + +/// Translates the `selfbalance` instructions. +pub fn self_balance<'ctx, D>( + context: &mut Context<'ctx, D>, +) -> anyhow::Result> +where + D: Dependency + Clone, +{ + let balance_pointer = context.build_alloca(context.word_type(), "balance_pointer"); + let balance = context.builder().build_ptr_to_int( + balance_pointer.value, + context.xlen_type(), + "balance", + )?; + + context.build_runtime_call( + revive_runtime_api::polkavm_imports::BALANCE, + &[balance.into()], ); context.build_load(balance_pointer, "balance") diff --git a/crates/llvm-context/src/polkavm/evm/event.rs b/crates/llvm-context/src/polkavm/evm/event.rs index 37ef12f..2c10c90 100644 --- a/crates/llvm-context/src/polkavm/evm/event.rs +++ b/crates/llvm-context/src/polkavm/evm/event.rs @@ -4,7 +4,6 @@ use inkwell::values::BasicValue; use crate::polkavm::context::Context; use crate::polkavm::Dependency; -use crate::polkavm_const::runtime_api; /// Translates a log or event call. /// @@ -43,6 +42,7 @@ where context.byte_type().array_type(topics_buffer_size as u32), "topics_buffer", ); + for (n, topic) in topics.iter().enumerate() { let topic_buffer_offset = context .xlen_type() @@ -57,6 +57,7 @@ where context.build_byte_swap(topic.as_basic_value_enum())?, )?; } + [ context .builder() @@ -68,14 +69,17 @@ where .as_basic_value_enum(), context .xlen_type() - .const_int(topics_buffer_size as u64, false) + .const_int(topics.len() as u64, false) .as_basic_value_enum(), input_pointer.as_basic_value_enum(), input_length.as_basic_value_enum(), ] }; - let _ = context.build_runtime_call(runtime_api::imports::DEPOSIT_EVENT, &arguments); + let _ = context.build_runtime_call( + revive_runtime_api::polkavm_imports::DEPOSIT_EVENT, + &arguments, + ); Ok(()) } diff --git a/crates/llvm-context/src/polkavm/evm/ext_code.rs b/crates/llvm-context/src/polkavm/evm/ext_code.rs index b34bdd8..c35022e 100644 --- a/crates/llvm-context/src/polkavm/evm/ext_code.rs +++ b/crates/llvm-context/src/polkavm/evm/ext_code.rs @@ -1,10 +1,7 @@ //! Translates the external code operations. -use inkwell::values::BasicValue; - use crate::polkavm::context::Context; use crate::polkavm::Dependency; -use crate::polkavm_const::runtime_api; /// Translates the `extcodesize` instruction if `address` is `Some`. /// Otherwise, translates the `codesize` instruction. @@ -15,41 +12,52 @@ pub fn size<'ctx, D>( where D: Dependency + Clone, { - let address_pointer = match address { - Some(address) => { - let address_pointer = context.build_alloca(context.word_type(), "value"); - context.build_store(address_pointer, address)?; - address_pointer - } - None => context.sentinel_pointer(), + let address = match address { + Some(address) => address, + None => super::context::address(context)?.into_int_value(), }; - let address_pointer_casted = context.builder().build_ptr_to_int( - address_pointer.value, - context.xlen_type(), - "address_pointer", - )?; - let value = context - .build_runtime_call( - runtime_api::imports::CODE_SIZE, - &[address_pointer_casted.into()], - ) - .unwrap_or_else(|| panic!("{} should return a value", runtime_api::imports::CODE_SIZE)) - .into_int_value(); + let address_pointer = context.build_address_argument_store(address)?; + let output_pointer = context.build_alloca_at_entry(context.word_type(), "output_pointer"); - Ok(context - .builder() - .build_int_z_extend(value, context.word_type(), "extcodesize")? - .as_basic_value_enum()) + context.build_runtime_call( + revive_runtime_api::polkavm_imports::CODE_SIZE, + &[ + address_pointer.to_int(context).into(), + output_pointer.to_int(context).into(), + ], + ); + + context.build_load(output_pointer, "code_size") } /// Translates the `extcodehash` instruction. pub fn hash<'ctx, D>( - _context: &mut Context<'ctx, D>, - _address: inkwell::values::IntValue<'ctx>, + context: &mut Context<'ctx, D>, + address: inkwell::values::IntValue<'ctx>, ) -> anyhow::Result> where D: Dependency + Clone, { - todo!() + let address_type = context.integer_type(revive_common::BIT_LENGTH_ETH_ADDRESS); + let address_pointer = context.build_alloca_at_entry(address_type, "address_pointer"); + let address_truncated = + context + .builder() + .build_int_truncate(address, address_type, "address_truncated")?; + let address_swapped = context.build_byte_swap(address_truncated.into())?; + context.build_store(address_pointer, address_swapped)?; + + let extcodehash_pointer = + context.build_alloca_at_entry(context.word_type(), "extcodehash_pointer"); + + context.build_runtime_call( + revive_runtime_api::polkavm_imports::CODE_HASH, + &[ + address_pointer.to_int(context).into(), + extcodehash_pointer.to_int(context).into(), + ], + ); + + context.build_byte_swap(context.build_load(extcodehash_pointer, "extcodehash_value")?) } diff --git a/crates/llvm-context/src/polkavm/evm/immutable.rs b/crates/llvm-context/src/polkavm/evm/immutable.rs index 863924b..f1f72cf 100644 --- a/crates/llvm-context/src/polkavm/evm/immutable.rs +++ b/crates/llvm-context/src/polkavm/evm/immutable.rs @@ -1,14 +1,19 @@ //! Translates the contract immutable operations. +use inkwell::types::BasicType; + use crate::polkavm::context::address_space::AddressSpace; use crate::polkavm::context::code_type::CodeType; +use crate::polkavm::context::function::runtime; use crate::polkavm::context::pointer::Pointer; use crate::polkavm::context::Context; use crate::polkavm::Dependency; /// Translates the contract immutable load. -/// In the deploy code the values are read from the auxiliary heap. -/// In the runtime code they are requested from the system contract. +/// +/// In deploy code the values are read from the stack. +/// +/// In runtime code they are loaded lazily with the `get_immutable_data` syscall. pub fn load<'ctx, D>( context: &mut Context<'ctx, D>, index: inkwell::values::IntValue<'ctx>, @@ -20,38 +25,27 @@ where None => { anyhow::bail!("Immutables are not available if the contract part is undefined"); } - Some(CodeType::Deploy) => { - let index_double = context.builder().build_int_mul( - index, - context.word_const(2), - "immutable_load_index_double", - )?; - let offset_absolute = context.builder().build_int_add( - index_double, - context.word_const( - crate::polkavm::HEAP_AUX_OFFSET_CONSTRUCTOR_RETURN_DATA - + (3 * revive_common::BYTE_LENGTH_WORD) as u64, - ), - "immutable_offset_absolute", - )?; - let immutable_pointer = Pointer::new_with_offset( - context, - AddressSpace::default(), - context.word_type(), - offset_absolute, - "immutable_pointer", - ); - context.build_load(immutable_pointer, "immutable_value") - } + Some(CodeType::Deploy) => load_from_memory(context, index), Some(CodeType::Runtime) => { - todo!() + context.build_call( + context + .get_function(runtime::FUNCTION_LOAD_IMMUTABLE_DATA) + .expect("is always declared for runtime code") + .borrow() + .declaration(), + &[], + runtime::FUNCTION_LOAD_IMMUTABLE_DATA, + ); + load_from_memory(context, index) } } } /// Translates the contract immutable store. -/// In the deploy code the values are written to the auxiliary heap at the predefined offset, -/// being prepared for returning to the system contract for saving. +/// +/// In deploy code the values are written to the stack at the predefined offset, +/// being prepared for storing them using the `set_immutable_data` syscall. +/// /// Ignored in the runtime code. pub fn store<'ctx, D>( context: &mut Context<'ctx, D>, @@ -66,46 +60,48 @@ where anyhow::bail!("Immutables are not available if the contract part is undefined"); } Some(CodeType::Deploy) => { - let index_double = context.builder().build_int_mul( - index, - context.word_const(2), - "immutable_load_index_double", - )?; - let index_offset_absolute = context.builder().build_int_add( - index_double, - context.word_const( - crate::polkavm::HEAP_AUX_OFFSET_CONSTRUCTOR_RETURN_DATA - + (2 * revive_common::BYTE_LENGTH_WORD) as u64, + let immutable_data_pointer = context + .get_global(revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_POINTER)? + .value + .as_pointer_value(); + let immutable_pointer = context.build_gep( + Pointer::new( + context.word_type(), + AddressSpace::Stack, + immutable_data_pointer, ), - "index_offset_absolute", - )?; - let index_offset_pointer = Pointer::new_with_offset( - context, - AddressSpace::default(), - context.word_type(), - index_offset_absolute, - "immutable_index_pointer", + &[index], + context.word_type().as_basic_type_enum(), + "immutable_variable_pointer", ); - context.build_store(index_offset_pointer, index)?; - - let value_offset_absolute = context.builder().build_int_add( - index_offset_absolute, - context.word_const(revive_common::BYTE_LENGTH_WORD as u64), - "value_offset_absolute", - )?; - let value_offset_pointer = Pointer::new_with_offset( - context, - AddressSpace::default(), - context.word_type(), - value_offset_absolute, - "immutable_value_pointer", - ); - context.build_store(value_offset_pointer, value)?; - - Ok(()) + context.build_store(immutable_pointer, value) } Some(CodeType::Runtime) => { anyhow::bail!("Immutable writes are not available in the runtime code"); } } } + +pub fn load_from_memory<'ctx, D>( + context: &mut Context<'ctx, D>, + index: inkwell::values::IntValue<'ctx>, +) -> anyhow::Result> +where + D: Dependency + Clone, +{ + let immutable_data_pointer = context + .get_global(revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_POINTER)? + .value + .as_pointer_value(); + let immutable_pointer = context.build_gep( + Pointer::new( + context.word_type(), + AddressSpace::Stack, + immutable_data_pointer, + ), + &[index], + context.word_type().as_basic_type_enum(), + "immutable_variable_pointer", + ); + context.build_load(immutable_pointer, "immutable_value") +} diff --git a/crates/llvm-context/src/polkavm/evm/memory.rs b/crates/llvm-context/src/polkavm/evm/memory.rs index fa1b82e..8db2db8 100644 --- a/crates/llvm-context/src/polkavm/evm/memory.rs +++ b/crates/llvm-context/src/polkavm/evm/memory.rs @@ -1,10 +1,29 @@ //! Translates the heap memory operations. +use inkwell::values::BasicValue; + use crate::polkavm::context::address_space::AddressSpace; use crate::polkavm::context::pointer::Pointer; use crate::polkavm::context::Context; use crate::polkavm::Dependency; +/// Translates the `msize` instruction. +pub fn msize<'ctx, D>( + context: &mut Context<'ctx, D>, +) -> anyhow::Result> +where + D: Dependency + Clone, +{ + Ok(context + .builder() + .build_int_z_extend( + context.build_msize()?, + context.word_type(), + "heap_size_extended", + )? + .as_basic_value_enum()) +} + /// Translates the `mload` instruction. /// Uses the main heap. pub fn load<'ctx, D>( diff --git a/crates/llvm-context/src/polkavm/evm/return.rs b/crates/llvm-context/src/polkavm/evm/return.rs index 8908ce1..f152ae9 100644 --- a/crates/llvm-context/src/polkavm/evm/return.rs +++ b/crates/llvm-context/src/polkavm/evm/return.rs @@ -1,5 +1,8 @@ //! Translates the transaction return operations. +use crate::polkavm::context::address_space::AddressSpace; +use crate::polkavm::context::code_type::CodeType; +use crate::polkavm::context::pointer::Pointer; use crate::polkavm::context::Context; use crate::polkavm::Dependency; @@ -12,8 +15,60 @@ pub fn r#return<'ctx, D>( where D: Dependency + Clone, { - if context.code_type().is_none() { - anyhow::bail!("Return is not available if the contract part is undefined"); + match context.code_type() { + None => anyhow::bail!("Return is not available if the contract part is undefined"), + Some(CodeType::Deploy) => { + let immutable_data_size_pointer = context + .get_global(revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_SIZE)? + .value + .as_pointer_value(); + let immutable_data_size = context.build_load( + Pointer::new( + context.xlen_type(), + AddressSpace::Stack, + immutable_data_size_pointer, + ), + "immutable_data_size_load", + )?; + + let write_immutable_data_block = context.append_basic_block("write_immutables_block"); + let join_return_block = context.append_basic_block("join_return_block"); + let immutable_data_size_is_zero = context.builder().build_int_compare( + inkwell::IntPredicate::EQ, + context.xlen_type().const_zero(), + immutable_data_size.into_int_value(), + "immutable_data_size_is_zero", + )?; + context.build_conditional_branch( + immutable_data_size_is_zero, + join_return_block, + write_immutable_data_block, + )?; + + context.set_basic_block(write_immutable_data_block); + let immutable_data_pointer = context + .get_global(revive_runtime_api::immutable_data::GLOBAL_IMMUTABLE_DATA_POINTER)? + .value + .as_pointer_value(); + context.build_runtime_call( + revive_runtime_api::polkavm_imports::SET_IMMUTABLE_DATA, + &[ + context + .builder() + .build_ptr_to_int( + immutable_data_pointer, + context.xlen_type(), + "immutable_data_pointer_to_xlen", + )? + .into(), + immutable_data_size, + ], + ); + context.build_unconditional_branch(join_return_block); + + context.set_basic_block(join_return_block); + } + Some(CodeType::Runtime) => {} } context.build_exit( diff --git a/crates/llvm-context/src/polkavm/evm/return_data.rs b/crates/llvm-context/src/polkavm/evm/return_data.rs index 7c7f97c..bd29f50 100644 --- a/crates/llvm-context/src/polkavm/evm/return_data.rs +++ b/crates/llvm-context/src/polkavm/evm/return_data.rs @@ -1,10 +1,7 @@ //! Translates the return data instructions. -use inkwell::values::BasicValue; - use crate::polkavm::context::Context; use crate::polkavm::Dependency; -use crate::polkavm_const::runtime_api; /// Translates the return data size. pub fn size<'ctx, D>( @@ -13,13 +10,17 @@ pub fn size<'ctx, D>( where D: Dependency + Clone, { - let value = context - .get_global_value(crate::polkavm::GLOBAL_RETURN_DATA_SIZE)? - .into_int_value(); - Ok(context - .builder() - .build_int_z_extend(value, context.word_type(), "calldatasize_extended")? - .as_basic_value_enum()) + let output_pointer = context.build_alloca_at_entry(context.word_type(), "return_data_size"); + let output_pointer_parameter = context.builder().build_ptr_to_int( + output_pointer.value, + context.xlen_type(), + "return_data_copy_output_pointer", + )?; + context.build_runtime_call( + revive_runtime_api::polkavm_imports::RETURNDATASIZE, + &[output_pointer_parameter.into()], + ); + context.build_load(output_pointer, "return_data_size_load") } /// Translates the return data copy, trapping if @@ -39,16 +40,49 @@ where let destination_offset = context.safe_truncate_int_to_xlen(destination_offset)?; let size = context.safe_truncate_int_to_xlen(size)?; - let destination_offset = context.builder().build_ptr_to_int( + let output_pointer = context.builder().build_ptr_to_int( context.build_heap_gep(destination_offset, size)?.value, context.xlen_type(), - "destination_offset", + "return_data_copy_output_pointer", + )?; + + let output_length_pointer = context.build_alloca_at_entry( + context.xlen_type(), + "return_data_copy_output_length_pointer", + ); + context.build_store(output_length_pointer, size)?; + let output_length_pointer_int = context.builder().build_ptr_to_int( + output_length_pointer.value, + context.xlen_type(), + "return_data_copy_output_length_pointer_int", )?; context.build_runtime_call( - runtime_api::imports::RETURNDATACOPY, - &[destination_offset.into(), source_offset.into(), size.into()], + revive_runtime_api::polkavm_imports::RETURNDATACOPY, + &[ + output_pointer.into(), + output_length_pointer_int.into(), + source_offset.into(), + ], ); + // Trap on OOB (will be different in EOF code) + let overflow_block = context.append_basic_block("return_data_overflow"); + let non_overflow_block = context.append_basic_block("return_data_non_overflow"); + let is_overflow = context.builder().build_int_compare( + inkwell::IntPredicate::UGT, + size, + context + .build_load(output_length_pointer, "bytes_written")? + .into_int_value(), + "is_overflow", + )?; + context.build_conditional_branch(is_overflow, overflow_block, non_overflow_block)?; + + context.set_basic_block(overflow_block); + context.build_call(context.intrinsics().trap, &[], "invalid_trap"); + context.build_unreachable(); + + context.set_basic_block(non_overflow_block); Ok(()) } diff --git a/crates/llvm-context/src/polkavm/evm/storage.rs b/crates/llvm-context/src/polkavm/evm/storage.rs index b399ac5..e7080a8 100644 --- a/crates/llvm-context/src/polkavm/evm/storage.rs +++ b/crates/llvm-context/src/polkavm/evm/storage.rs @@ -1,7 +1,6 @@ //! Translates the storage operations. use crate::polkavm::context::address_space::AddressSpace; -use crate::polkavm::context::pointer::Pointer; use crate::polkavm::context::Context; use crate::polkavm::Dependency; @@ -13,14 +12,10 @@ pub fn load<'ctx, D>( where D: Dependency + Clone, { - let position_pointer = Pointer::new_with_offset( - context, - AddressSpace::Storage, - context.word_type(), - position, - "storage_load_position_pointer", - ); - context.build_load(position_pointer, "storage_load_value") + let mut slot_ptr = context.build_alloca_at_entry(context.word_type(), "slot_pointer"); + slot_ptr.address_space = AddressSpace::Storage; + context.builder().build_store(slot_ptr.value, position)?; + context.build_load(slot_ptr, "storage_load_value") } /// Translates the storage store. @@ -32,14 +27,10 @@ pub fn store<'ctx, D>( where D: Dependency + Clone, { - let position_pointer = Pointer::new_with_offset( - context, - AddressSpace::Storage, - context.word_type(), - position, - "storage_store_position_pointer", - ); - context.build_store(position_pointer, value)?; + let mut slot_ptr = context.build_alloca_at_entry(context.word_type(), "slot_pointer"); + slot_ptr.address_space = AddressSpace::Storage; + context.builder().build_store(slot_ptr.value, position)?; + context.build_store(slot_ptr, value)?; Ok(()) } @@ -51,14 +42,10 @@ pub fn transient_load<'ctx, D>( where D: Dependency + Clone, { - let position_pointer = Pointer::new_with_offset( - context, - AddressSpace::TransientStorage, - context.word_type(), - position, - "transient_storage_load_position_pointer", - ); - context.build_load(position_pointer, "transient_storage_load_value") + let mut slot_ptr = context.build_alloca_at_entry(context.word_type(), "slot_pointer"); + slot_ptr.address_space = AddressSpace::TransientStorage; + context.builder().build_store(slot_ptr.value, position)?; + context.build_load(slot_ptr, "transient_storage_load_value") } /// Translates the transient storage store. @@ -70,13 +57,9 @@ pub fn transient_store<'ctx, D>( where D: Dependency + Clone, { - let position_pointer = Pointer::new_with_offset( - context, - AddressSpace::TransientStorage, - context.word_type(), - position, - "transient_storage_store_position_pointer", - ); - context.build_store(position_pointer, value)?; + let mut slot_ptr = context.build_alloca_at_entry(context.word_type(), "slot_pointer"); + slot_ptr.address_space = AddressSpace::TransientStorage; + context.builder().build_store(slot_ptr.value, position)?; + context.build_store(slot_ptr, value)?; Ok(()) } diff --git a/crates/llvm-context/src/polkavm/mod.rs b/crates/llvm-context/src/polkavm/mod.rs index c5549fb..5c88713 100644 --- a/crates/llvm-context/src/polkavm/mod.rs +++ b/crates/llvm-context/src/polkavm/mod.rs @@ -97,7 +97,6 @@ pub trait Dependency { dependency: Self, path: &str, optimizer_settings: OptimizerSettings, - is_system_mode: bool, include_metadata_hash: bool, debug_config: Option, ) -> anyhow::Result; @@ -118,7 +117,6 @@ impl Dependency for DummyDependency { _dependency: Self, _path: &str, _optimizer_settings: OptimizerSettings, - _is_system_mode: bool, _include_metadata_hash: bool, _debug_config: Option, ) -> anyhow::Result { diff --git a/crates/llvm-context/src/target_machine/mod.rs b/crates/llvm-context/src/target_machine/mod.rs index ab62569..805b23b 100644 --- a/crates/llvm-context/src/target_machine/mod.rs +++ b/crates/llvm-context/src/target_machine/mod.rs @@ -39,9 +39,9 @@ impl TargetMachine { /// LLVM target features. #[cfg(feature = "riscv-zbb")] - pub const VM_FEATURES: &'static str = "+zbb,+e,+m"; + pub const VM_FEATURES: &'static str = "+zbb,+a,+e,+m,+c,+fast-unaligned-access,+xtheadcondmov"; #[cfg(not(feature = "riscv-zbb"))] - pub const VM_FEATURES: &'static str = "+e,+m"; + pub const VM_FEATURES: &'static str = "+a,+e,+m,+c,+fast-unaligned-access,+xtheadcondmov"; /// A shortcut constructor. /// A separate instance for every optimization level is created. diff --git a/crates/pallet-contracts-pvm-llapi/Cargo.toml b/crates/pallet-contracts-pvm-llapi/Cargo.toml deleted file mode 100644 index 5b06be3..0000000 --- a/crates/pallet-contracts-pvm-llapi/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "pallet-contracts-pvm-llapi" -version = "0.1.0" -edition = "2021" - -[features] -riscv-64 = [] - -[dependencies] -anyhow = { workspace = true } -inkwell = { workspace = true, features = ["target-riscv", "no-libffi-linking", "llvm18-0"] } \ No newline at end of file diff --git a/crates/pallet-contracts-pvm-llapi/src/lib.rs b/crates/pallet-contracts-pvm-llapi/src/lib.rs deleted file mode 100644 index 34648d5..0000000 --- a/crates/pallet-contracts-pvm-llapi/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod calling_convention; -pub mod polkavm_guest; diff --git a/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.c b/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.c deleted file mode 100644 index b9e5d58..0000000 --- a/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.c +++ /dev/null @@ -1,134 +0,0 @@ -#include -#include - -#include "polkavm_guest.h" - - -// Missing builtins - -void * memset(void *b, int c, size_t len) { - uint8_t *dest = b; - while (len-- > 0) *dest++ = c; - return b; -} - -void * memcpy(void *dst, const void *_src, size_t len) { - uint8_t *dest = dst; - const uint8_t *src = _src; - - while (len--) *dest++ = *src++; - - return dst; -} - -void * memmove(void *dst, const void *src, size_t n) { - char *d = dst; - const char *s = src; - - if (d==s) return d; - if ((uintptr_t)s-(uintptr_t)d-n <= -2*n) return memcpy(d, s, n); - - if (d( - context: &'context Context, - module_name: &str, -) -> Result, LLVMString> { - let buf = MemoryBuffer::create_from_memory_range(BITCODE, module_name); - Module::parse_bitcode_from_buffer(&buf, context) -} - -/// Creates a module that sets the PolkaVM minimum stack size to [`size`] if linked in. -pub fn min_stack_size<'context>( - context: &'context Context, - module_name: &str, - size: u32, -) -> Module<'context> { - let module = context.create_module(module_name); - module.set_inline_assembly(&format!( - ".pushsection .polkavm_min_stack_size,\"\",@progbits - .word {size} - .popsection" - )); - module -} - -#[cfg(test)] -mod tests { - use crate::polkavm_guest; - - #[test] - fn it_works() { - inkwell::targets::Target::initialize_riscv(&Default::default()); - let context = inkwell::context::Context::create(); - let module = polkavm_guest::module(&context, "polkavm_guest").unwrap(); - - assert!(module.get_function("call").is_some()); - assert!(module.get_function("deploy").is_some()); - } -} diff --git a/crates/runner/Cargo.toml b/crates/runner/Cargo.toml index 21d8598..c4efd9c 100644 --- a/crates/runner/Cargo.toml +++ b/crates/runner/Cargo.toml @@ -4,14 +4,29 @@ version.workspace = true license.workspace = true edition.workspace = true repository.workspace = true -repository.authors = true -descritption = "Execute revive contracts in a simulated blockchain runtime" +authors.workspace = true +description = "Execute revive contracts in a simulated blockchain runtime" + +[features] +default = ["solidity"] +solidity = ["revive-solidity", "revive-differential"] [dependencies] serde = { workspace = true } serde_json = { workspace = true } +hex = { workspace = true, features = ["serde"] } codec = { workspace = true, default-features = false } scale-info = { workspace = true, default-features = false } -polkadot-sdk = { workspace = true, features = ["experimental", "runtime"] } +alloy-primitives = { workspace = true } +polkadot-sdk.workspace = true +polkadot-sdk.features = [ + "experimental", + "runtime", + "polkadot-runtime-common", + "pallet-revive", + "pallet-balances", + "pallet-timestamp" +] -revive-solidity = { workspace = true } \ No newline at end of file +revive-solidity = { workspace = true, optional = true } +revive-differential = { workspace = true, optional = true } diff --git a/crates/runner/fixtures/Baseline.pvm b/crates/runner/fixtures/Baseline.pvm index 850a5e1..29fcfa5 100644 Binary files a/crates/runner/fixtures/Baseline.pvm and b/crates/runner/fixtures/Baseline.pvm differ diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index c47a428..3ee0df7 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -7,49 +7,74 @@ //! ```rust //! use revive_runner::*; //! use SpecsAction::*; -//! run_test(Specs { +//! Specs { +//! differential: false, //! balances: vec![(ALICE, 1_000_000_000)], //! actions: vec![Instantiate { -//! origin: ALICE, +//! origin: TestAddress::Alice, //! value: 0, //! gas_limit: Some(GAS_LIMIT), //! storage_deposit_limit: Some(DEPOSIT_LIMIT), //! code: Code::Bytes(include_bytes!("../fixtures/Baseline.pvm").to_vec()), //! data: vec![], -//! salt: vec![], +//! salt: Default::default(), //! }], -//! }) +//! } +//! .run(); //! ``` +use std::time::Duration; + +use hex::{FromHex, ToHex}; +use pallet_revive::{AddressMapper, ExecReturnValue, InstantiateReturnValue}; use polkadot_sdk::*; use polkadot_sdk::{ - pallet_revive::{CollectEvents, ContractExecResult, ContractInstantiateResult, DebugInfo}, + pallet_revive::{CollectEvents, ContractResult, DebugInfo}, polkadot_runtime_common::BuildStorage, polkadot_sdk_frame::testing_prelude::*, + sp_core::{H160, H256}, sp_keystore::{testing::MemoryKeystore, KeystoreExt}, sp_runtime::AccountId32, }; use serde::{Deserialize, Serialize}; -mod runtime; use crate::runtime::*; +pub use crate::specs::*; -pub const ALICE: AccountId32 = AccountId32::new([1u8; 32]); -pub const BOB: AccountId32 = AccountId32::new([2u8; 32]); -pub const CHARLIE: AccountId32 = AccountId32::new([3u8; 32]); +mod runtime; +mod specs; + +#[cfg(not(feature = "revive-solidity"))] +pub(crate) const NO_SOLIDITY_FRONTEND: &str = + "revive-runner was built without the solidity frontend; please enable the 'solidity' feature!"; + +/// The alice test account +pub const ALICE: H160 = H160([1u8; 20]); +/// The bob test account +pub const BOB: H160 = H160([2u8; 20]); +/// The charlie test account +pub const CHARLIE: H160 = H160([3u8; 20]); +/// Default gas limit +pub const GAS_LIMIT: Weight = Weight::from_parts(100_000_000_000, 3 * 1024 * 1024); +/// Default deposit limit +pub const DEPOSIT_LIMIT: Balance = 10_000_000; /// Externalities builder #[derive(Default)] pub struct ExtBuilder { /// List of endowments at genesis - balance_genesis_config: Vec<(AccountId, Balance)>, + balance_genesis_config: Vec<(AccountId32, Balance)>, } impl ExtBuilder { /// Set the balance of an account at genesis - fn balance_genesis_config(mut self, value: Vec<(AccountId, Balance)>) -> Self { - self.balance_genesis_config = value; - self + fn balance_genesis_config(self, value: Vec<(H160, Balance)>) -> Self { + Self { + balance_genesis_config: value + .iter() + .map(|(address, balance)| (AccountId::to_fallback_account_id(address), *balance)) + .collect(), + } } /// Build the externalities @@ -71,28 +96,61 @@ impl ExtBuilder { } } -/// Default gas limit -pub const GAS_LIMIT: Weight = Weight::from_parts(100_000_000_000, 3 * 1024 * 1024); - -/// Default deposit limit -pub const DEPOSIT_LIMIT: Balance = 10_000_000; - /// Expectation for a call #[derive(Debug, Clone, Serialize, Deserialize)] pub struct VerifyCallExpectation { /// When provided, the expected gas consumed - gas_consumed: Option, + pub gas_consumed: Option, /// When provided, the expected output - output: Option>, + #[serde(default, with = "hex")] + pub output: OptionalHex>, ///Expected call result - success: bool, + pub success: bool, +} + +#[derive(Clone, Debug, Default, PartialEq)] +pub struct OptionalHex(Option); + +impl> FromHex for OptionalHex { + type Error = ::Error; + + fn from_hex>(hex: T) -> Result { + let value = I::from_hex(hex)?; + Ok(Self(Some(value))) + } +} + +impl> ToHex for &OptionalHex { + fn encode_hex>(&self) -> T { + match self.0.as_ref() { + None => T::from_iter("".chars()), + Some(data) => I::encode_hex::(data), + } + } + + fn encode_hex_upper>(&self) -> T { + match self.0.as_ref() { + None => T::from_iter("".chars()), + Some(data) => I::encode_hex_upper(data), + } + } +} + +impl> From for OptionalHex { + fn from(value: T) -> Self { + if value.as_ref().is_empty() { + OptionalHex(None) + } else { + OptionalHex(Some(value)) + } + } } impl Default for VerifyCallExpectation { fn default() -> Self { Self { gas_consumed: None, - output: None, + output: OptionalHex(None), success: true, } } @@ -100,62 +158,87 @@ impl Default for VerifyCallExpectation { impl VerifyCallExpectation { /// Verify that the expectations are met - fn verify(self, result: CallResult) { - dbg!(&result); - assert_eq!(self.success, result.is_ok()); + fn verify(self, result: &CallResult) { + assert_eq!( + self.success, + !result.did_revert(), + "contract execution result mismatch: {result:?}" + ); + if let Some(gas_consumed) = self.gas_consumed { assert_eq!(gas_consumed, result.gas_consumed()); } - if let Some(output) = self.output { - assert_eq!(output, result.output()); + + if let OptionalHex(Some(data)) = self.output { + assert_eq!(data, result.output()); } } } /// Result of a call -#[derive(Debug)] -enum CallResult { - Exec(ContractExecResult), - Instantiate(ContractInstantiateResult), +#[derive(Clone, Debug)] +pub enum CallResult { + Exec { + result: ContractResult, + wall_time: Duration, + }, + Instantiate { + result: ContractResult, + wall_time: Duration, + code_hash: H256, + }, } impl CallResult { /// Check if the call was successful - fn is_ok(&self) -> bool { + fn did_revert(&self) -> bool { match self { - Self::Exec(res) => res.result.is_ok(), - Self::Instantiate(res) => res.result.is_ok(), + Self::Exec { result, .. } => result + .result + .as_ref() + .map(|r| r.did_revert()) + .unwrap_or(true), + Self::Instantiate { result, .. } => result + .result + .as_ref() + .map(|r| r.result.did_revert()) + .unwrap_or(true), } } + /// Get the output of the call fn output(&self) -> Vec { match self { - Self::Exec(res) => res + Self::Exec { result, .. } => result .result .as_ref() .map(|r| r.data.clone()) .unwrap_or_default(), - Self::Instantiate(res) => res + Self::Instantiate { result, .. } => result .result .as_ref() .map(|r| r.result.data.clone()) .unwrap_or_default(), } } + /// Get the gas consumed by the call fn gas_consumed(&self) -> Weight { match self { - Self::Exec(res) => res.gas_consumed, - Self::Instantiate(res) => res.gas_consumed, + Self::Exec { result, .. } => result.gas_consumed, + Self::Instantiate { result, .. } => result.gas_consumed, } } } -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum Code { + #[cfg(feature = "revive-solidity")] /// Compile a single solidity source and use the blob of `contract` Solidity { - path: std::path::PathBuf, + path: Option, + solc_optimizer: Option, + pipeline: Option, contract: String, }, /// Read the contract blob from disk @@ -163,16 +246,36 @@ pub enum Code { /// A contract blob Bytes(Vec), /// Pre-existing contract hash - Hash(Hash), + Hash(crate::runtime::Hash), } -impl From for pallet_revive::Code { +impl Default for Code { + fn default() -> Self { + Self::Bytes(vec![]) + } +} + +impl From for pallet_revive::Code { fn from(val: Code) -> Self { match val { - Code::Solidity { path, contract } => { - pallet_revive::Code::Upload(revive_solidity::test_utils::compile_blob( - contract.as_str(), - std::fs::read_to_string(path).unwrap().as_str(), + #[cfg(feature = "solidity")] + Code::Solidity { + path, + contract, + solc_optimizer, + pipeline, + } => { + let Some(path) = path else { + panic!("Solidity source of contract '{contract}' missing path"); + }; + let Ok(source_code) = std::fs::read_to_string(&path) else { + panic!("Failed to reead source code from {}", path.display()); + }; + pallet_revive::Code::Upload(revive_solidity::test_utils::compile_blob_with_options( + &contract, + &source_code, + solc_optimizer.unwrap_or(true), + pipeline.unwrap_or(revive_solidity::SolcPipeline::Yul), )) } Code::Path(path) => pallet_revive::Code::Upload(std::fs::read(path).unwrap()), @@ -182,201 +285,41 @@ impl From for pallet_revive::Code { } } -/// An action to perform in a contract test -#[derive(Debug, Clone, Serialize, Deserialize)] -pub enum SpecsAction { - /// Instantiate a contract - Instantiate { - origin: AccountId, - #[serde(default)] - value: Balance, - #[serde(default)] - gas_limit: Option, - #[serde(default)] - storage_deposit_limit: Option, - code: Code, - #[serde(default)] - data: Vec, - #[serde(default)] - salt: Vec, - }, - /// Call a contract - Call { - origin: AccountId, - dest: AccountId, - #[serde(default)] - value: Balance, - #[serde(default)] - gas_limit: Option, - #[serde(default)] - storage_deposit_limit: Option, - #[serde(default)] - data: Vec, - }, - /// Verify the result of the last call, omitting this will simply ensure the last call was successful - VerifyCall(VerifyCallExpectation), - - /// Verify the balance of an account - VerifyBalance { - origin: AccountId, - expected: Balance, - }, - /// Verify the storage of a contract - VerifyStorage { - contract: AccountId, - key: Vec, - expected: Option>, - }, -} - -/// Specs for a contract test -#[derive(Default, Debug, Serialize, Deserialize)] -#[serde(default)] -pub struct Specs { - /// List of endowments at genesis - pub balances: Vec<(AccountId, Balance)>, - /// List of actions to perform - pub actions: Vec, -} - -impl Specs { - /// Get the list of actions to perform - /// A default [`SpecAction::VerifyCall`] is injected after each Instantiate or Call action when - /// missing - fn actions(&self) -> Vec { - self.actions - .iter() - .enumerate() - .flat_map(|(index, item)| { - let next_item = self.actions.get(index + 1); - if matches!( - item, - SpecsAction::Instantiate { .. } | SpecsAction::Call { .. } - ) && !matches!(next_item, Some(SpecsAction::VerifyCall(_))) - { - return vec![ - item.clone(), - SpecsAction::VerifyCall(VerifyCallExpectation::default()), - ]; - } - vec![item.clone()] - }) - .collect() - } -} - -/// Run a contract test -/// The test takes a [`Specs`] and executes the actions in order -pub fn run_test(specs: Specs) { - ExtBuilder::default() - .balance_genesis_config(specs.balances.clone()) - .build() - .execute_with(|| { - use SpecsAction::*; - - let mut res: Option = None; - let actions = specs.actions(); - - for action in actions { - match action { - Instantiate { - origin, - value, - gas_limit, - storage_deposit_limit, - code, - data, - salt, - } => { - res = Some(CallResult::Instantiate(Contracts::bare_instantiate( - RuntimeOrigin::signed(origin), - value, - gas_limit.unwrap_or(GAS_LIMIT), - storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), - code.into(), - data, - salt, - DebugInfo::Skip, - CollectEvents::Skip, - ))); - } - Call { - origin, - dest, - value, - gas_limit, - storage_deposit_limit, - data, - } => { - res = Some(CallResult::Exec(Contracts::bare_call( - RuntimeOrigin::signed(origin), - dest, - value, - gas_limit.unwrap_or(GAS_LIMIT), - storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), - data, - DebugInfo::Skip, - CollectEvents::Skip, - ))); - } - VerifyCall(expectation) => { - if let Some(res) = res.take() { - expectation.verify(res); - } else { - panic!("No call to verify"); - } - } - VerifyBalance { origin, expected } => { - assert_eq!(Balances::free_balance(&origin), expected); - } - VerifyStorage { - contract, - key, - expected, - } => { - let Ok(storage) = Contracts::get_storage(contract, key) else { - panic!("Error reading storage"); - }; - assert_eq!(storage, expected); - } - } - } - }); -} - #[cfg(test)] mod tests { - use super::*; + use crate::*; #[test] fn instantiate_works() { - use SpecsAction::*; - run_test(Specs { + use specs::SpecsAction::*; + let specs = Specs { + differential: false, balances: vec![(ALICE, 1_000_000_000)], actions: vec![Instantiate { - origin: ALICE, + origin: TestAddress::Alice, value: 0, gas_limit: Some(GAS_LIMIT), storage_deposit_limit: Some(DEPOSIT_LIMIT), code: Code::Bytes(include_bytes!("../fixtures/Baseline.pvm").to_vec()), data: vec![], - salt: vec![], + salt: OptionalHex::default(), }], - }) + }; + specs.run(); } #[test] fn instantiate_with_json() { - let specs = serde_json::from_str::( + serde_json::from_str::( r#" { "balances": [ - [ "5C62Ck4UrFPiBtoCmeSrgF7x9yv9mn38446dhCpsi2mLHiFT", 1000000000 ] + [ "0101010101010101010101010101010101010101", 1000000000 ] ], "actions": [ { "Instantiate": { - "origin": "5C62Ck4UrFPiBtoCmeSrgF7x9yv9mn38446dhCpsi2mLHiFT", + "origin": "Alice", "value": 0, "code": { "Path": "fixtures/Baseline.pvm" @@ -387,7 +330,7 @@ mod tests { } "#, ) - .unwrap(); - run_test(specs); + .unwrap() + .run(); } } diff --git a/crates/runner/src/runtime.rs b/crates/runner/src/runtime.rs index 31317a4..42f497a 100644 --- a/crates/runner/src/runtime.rs +++ b/crates/runner/src/runtime.rs @@ -1,5 +1,6 @@ use frame_support::runtime; +use pallet_revive::AccountId32Mapper; use polkadot_sdk::*; use polkadot_sdk::{ polkadot_sdk_frame::{log, runtime::prelude::*}, @@ -7,7 +8,7 @@ use polkadot_sdk::{ }; pub type Balance = u128; -pub type AccountId = AccountId32; +pub type AccountId = pallet_revive::AccountId32Mapper; pub type Block = frame_system::mocking::MockBlock; pub type Hash = ::Hash; pub type EventRecord = @@ -45,7 +46,7 @@ mod runtime { #[derive_impl(frame_system::config_preludes::SolochainDefaultConfig)] impl frame_system::Config for Runtime { type Block = Block; - type AccountId = AccountId; + type AccountId = AccountId32; type AccountData = pallet_balances::AccountData<::Balance>; } @@ -74,11 +75,13 @@ impl pallet_revive::Config for Runtime { type ChainExtension = (); type DepositPerByte = DepositPerByte; type DepositPerItem = DepositPerItem; - type AddressGenerator = pallet_revive::DefaultAddressGenerator; + type AddressMapper = AccountId32Mapper; + type RuntimeMemory = ConstU32<{ 512 * 1024 * 1024 }>; + type PVFMemory = ConstU32<{ 1024 * 1024 * 1024 }>; type UnsafeUnstableInterface = UnstableInterface; - type UploadOrigin = EnsureSigned; - type InstantiateOrigin = EnsureSigned; - type Migrations = (); + type UploadOrigin = EnsureSigned; + type InstantiateOrigin = EnsureSigned; type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; type Debug = (); + type ChainId = ConstU64<420_420_420>; } diff --git a/crates/runner/src/specs.rs b/crates/runner/src/specs.rs new file mode 100644 index 0000000..d60dcd4 --- /dev/null +++ b/crates/runner/src/specs.rs @@ -0,0 +1,539 @@ +use std::time::Instant; + +use serde::{Deserialize, Serialize}; + +use crate::*; +use alloy_primitives::{keccak256, Address}; +#[cfg(feature = "revive-solidity")] +use revive_differential::{Evm, EvmLog}; +#[cfg(feature = "revive-solidity")] +use revive_solidity::test_utils::*; + +const SPEC_MARKER_BEGIN: &str = "/* runner.json"; +const SPEC_MARKER_END: &str = "*/"; + +/// An action to perform in a contract test +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum SpecsAction { + /// Instantiate a contract + Instantiate { + #[serde(default)] + origin: TestAddress, + #[serde(default)] + value: Balance, + #[serde(default)] + gas_limit: Option, + #[serde(default)] + storage_deposit_limit: Option, + #[serde(default)] + code: Code, + #[serde(default, with = "hex::serde")] + data: Vec, + #[serde(default, with = "hex::serde")] + salt: OptionalHex<[u8; 32]>, + }, + /// Upload contract code without calling the constructor + Upload { + #[serde(default)] + origin: TestAddress, + #[serde(default)] + code: Code, + #[serde(default)] + storage_deposit_limit: Option, + }, + /// Call a contract + Call { + #[serde(default)] + origin: TestAddress, + dest: TestAddress, + #[serde(default)] + value: Balance, + #[serde(default)] + gas_limit: Option, + #[serde(default)] + storage_deposit_limit: Option, + #[serde(default, with = "hex::serde")] + data: Vec, + }, + /// Verify the result of the last call, omitting this will simply ensure the last call was successful + VerifyCall(VerifyCallExpectation), + /// Verify the balance of an account + VerifyBalance { + origin: TestAddress, + expected: Balance, + }, + /// Verify the storage of a contract + VerifyStorage { + contract: TestAddress, + #[serde(with = "hex::serde")] + key: [u8; 32], + #[serde(default, with = "hex::serde")] + expected: [u8; 32], + }, +} + +#[cfg(feature = "solidity")] +impl SpecsAction { + /// Derive verification actions from the EVM output log + pub fn derive_verification( + log: &EvmLog, + address_evm: Address, + account_pvm: TestAddress, + ) -> Vec { + let account = log + .state_dump + .accounts + .get(&address_evm) + .unwrap_or_else(|| panic!("account {address_evm} not in state dump")); + + let mut actions = vec![ + Self::VerifyCall(VerifyCallExpectation { + gas_consumed: None, + success: log.output.run_success(), + output: log.output.output.to_vec().into(), + }), + Self::VerifyBalance { + origin: account_pvm.clone(), + expected: account + .balance + .try_into() + .expect("balance should fit into u128"), + }, + ]; + + let Some(storage) = &account.storage else { + return actions; + }; + + for (key, expected) in storage { + let mut key = **key; + let mut expected = **expected; + key.reverse(); + expected.reverse(); + actions.push(Self::VerifyStorage { + contract: account_pvm.clone(), + key, + expected, + }); + } + + actions + } +} + +#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)] +pub enum TestAddress { + /// The ALICE account + #[default] + Alice, + /// The BOB account + Bob, + /// The CHARLIE account + Charlie, + /// AccountID that was created during the nth call in this run. + Instantiated(usize), + /// Arbitrary AccountID + AccountId(H160), +} + +impl TestAddress { + fn to_eth_addr(&self, results: &[CallResult]) -> H160 { + match self { + TestAddress::Alice => ALICE, + TestAddress::Bob => BOB, + TestAddress::Charlie => CHARLIE, + TestAddress::AccountId(account_id) => *account_id, + TestAddress::Instantiated(n) => match results + .get(*n) + .expect("should provide valid index into call results") + { + CallResult::Exec { .. } => panic!("call #{n} should be an instantiation"), + CallResult::Instantiate { result, .. } => { + result.result.as_ref().expect("call #{n} reverted").addr + } + }, + } + } + + fn to_account_id(&self, results: &[CallResult]) -> AccountId32 { + AccountId::to_account_id(&self.to_eth_addr(results)) + } +} + +/// Specs for a contract test +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(default)] +pub struct Specs { + /// Interpret EVM bytecode and assert output, storage and events + #[serde(default)] + pub differential: bool, + /// List of endowments at genesis + pub balances: Vec<(H160, Balance)>, + /// List of actions to perform + pub actions: Vec, +} + +impl Default for Specs { + fn default() -> Self { + Self { + differential: false, + balances: vec![ + (ALICE, 1_000_000_000), + (BOB, 1_000_000_000), + (CHARLIE, 1_000_000_000), + ], + actions: Default::default(), + } + } +} + +impl Specs { + /// Get the list of actions to perform + /// A default [`SpecAction::VerifyCall`] is injected after each Instantiate or Call action when + /// missing and not in differential mode + pub fn actions(&self) -> Vec { + self.actions + .iter() + .enumerate() + .flat_map(|(index, item)| { + let next_item = self.actions.get(index + 1); + if matches!( + item, + SpecsAction::Instantiate { .. } | SpecsAction::Call { .. } + ) && !matches!(next_item, Some(SpecsAction::VerifyCall { .. })) + && !self.differential + { + return vec![ + item.clone(), + SpecsAction::VerifyCall(VerifyCallExpectation::default()), + ]; + } + vec![item.clone()] + }) + .collect() + } + + /// Helper to allow not specifying the code bytes or path directly in the runner.json + /// - Replace `Code::Bytes(bytes)` if `bytes` are empty: read `contract_file` + /// - Replace `Code::Solidity{ path, ..}` if `path` is not provided: replace `path` with `contract_file` + pub fn replace_empty_code(&mut self, contract_name: &str, contract_path: &str) { + for action in self.actions.iter_mut() { + let code = match action { + SpecsAction::Instantiate { code, .. } | SpecsAction::Upload { code, .. } => code, + _ => continue, + }; + + match code { + #[cfg(feature = "revive-solidity")] + Code::Bytes(bytes) if bytes.is_empty() => { + let contract_source = match std::fs::read_to_string(contract_path) { + Err(err) => panic!("unable to read {contract_path}: {err}"), + Ok(solidity) => solidity, + }; + *bytes = compile_blob(contract_name, &contract_source) + } + #[cfg(not(feature = "revive-solidity"))] + Code::Bytes(_) => panic!("{NO_SOLIDITY_FRONTEND}"), + #[cfg(feature = "revive-solidity")] + Code::Solidity { path, .. } if path.is_none() => *path = Some(contract_path.into()), + _ => continue, + } + } + } + + /// Run a contract test + /// The test takes a [`Specs`] and executes the actions in order + pub fn run(self) -> Vec { + if self.differential { + #[cfg(not(feature = "solidity"))] + panic!("{NO_SOLIDITY_FRONTEND}"); + #[cfg(feature = "solidity")] + self.run_on_evm() + } else { + self + } + .run_on_pallet() + } + + #[cfg(feature = "solidity")] + fn run_on_evm(self) -> Self { + let mut derived_specs = Self { + actions: vec![], + ..self + }; + + let mut evm = Evm::default(); + let mut deployed_accounts = vec![]; + + for action in self.actions { + derived_specs.actions.push(action.clone()); + + use specs::SpecsAction::*; + match action { + Instantiate { + origin, + value, + gas_limit, + code, + data, + salt, + .. + } => { + let Code::Solidity { + path: Some(path), + solc_optimizer, + pipeline, + contract, + } = code + else { + panic!("the differential runner requires Code::Solidity source"); + }; + assert_ne!( + pipeline, + Some(revive_solidity::SolcPipeline::EVMLA), + "yul pipeline must be enabled in differential mode" + ); + assert!( + salt.0.is_none(), + "salt is not supported in differential mode" + ); + assert_eq!( + origin, + TestAddress::default(), + "configuring the origin is not supported in differential mode" + ); + + let deploy_code = match std::fs::read_to_string(&path) { + Ok(solidity_source) => hex::encode(compile_evm_deploy_code( + &contract, + &solidity_source, + solc_optimizer.unwrap_or(true), + )), + Err(err) => panic!( + "failed to read solidity source\n . path: '{}'\n . error: {:?}", + path.display(), + err + ), + }; + let mut vm = evm + .code_blob(deploy_code.as_bytes().to_vec()) + .sender(origin.to_eth_addr(&[]).0.into()) + .deploy(true); + if !data.is_empty() { + vm = vm.input(data.into()); + } + if value > 0 { + vm = vm.value(value); + } + if let Some(gas) = gas_limit { + vm = vm.gas(gas.ref_time()); + } + let mut log = vm.run(); + log.output.output = Default::default(); // PVM will not have constructor output + let deployed_account = log.account_deployed.expect("no account was created"); + let account_pvm = TestAddress::Instantiated(deployed_accounts.len()); + deployed_accounts.push(deployed_account); + derived_specs + .actions + .append(&mut SpecsAction::derive_verification( + &log, + deployed_account, + account_pvm, + )); + evm = Evm::from_genesis(log.state_dump.into()); + } + Call { + origin, + dest, + value, + gas_limit, + data, + .. + } => { + assert_eq!( + origin, + TestAddress::default(), + "configuring the origin is not supported in differential mode" + ); + let TestAddress::Instantiated(n) = dest else { + panic!("the differential runner requires TestAccountId::Instantiated(n) as dest"); + }; + let address = deployed_accounts + .get(n) + .unwrap_or_else(|| panic!("no account at index {n} ")); + let mut vm = evm + .receiver(*address) + .sender(origin.to_eth_addr(&[]).0.into()); + if !data.is_empty() { + vm = vm.input(data.into()); + } + if value > 0 { + vm = vm.value(value); + } + if let Some(gas) = gas_limit { + vm = vm.gas(gas.ref_time()); + } + + let log = vm.run(); + derived_specs + .actions + .append(&mut SpecsAction::derive_verification(&log, *address, dest)); + evm = Evm::from_genesis(log.state_dump.into()); + } + Upload { .. } => continue, + other => derived_specs.actions.push(other), + } + } + + derived_specs + } + + fn run_on_pallet(self) -> Vec { + let mut results = vec![]; + + ExtBuilder::default() + .balance_genesis_config(self.balances.clone()) + .build() + .execute_with(|| { + use specs::SpecsAction::*; + + for action in self.actions() { + match action { + Instantiate { + origin, + value, + gas_limit, + storage_deposit_limit, + code, + data, + salt, + } => { + let code: pallet_revive::Code = code.into(); + let code_hash = match code.clone() { + pallet_revive::Code::Existing(code_hash) => code_hash, + pallet_revive::Code::Upload(bytes) => { + H256::from_slice(keccak256(&bytes).as_slice()) + } + }; + let origin = RuntimeOrigin::signed(origin.to_account_id(&results)); + let time_start = Instant::now(); + let result = Contracts::bare_instantiate( + origin, + value, + gas_limit.unwrap_or(GAS_LIMIT), + storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), + code, + data, + salt.0, + DebugInfo::Skip, + CollectEvents::Skip, + ); + results.push(CallResult::Instantiate { + result, + wall_time: time_start.elapsed(), + code_hash, + }) + } + Upload { + origin, + code, + storage_deposit_limit, + } => Contracts::upload_code( + RuntimeOrigin::signed(origin.to_account_id(&results)), + match pallet_revive::Code::from(code) { + pallet_revive::Code::Existing(_) => continue, + pallet_revive::Code::Upload(bytes) => bytes, + }, + storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), + ) + .unwrap_or_else(|error| panic!("code upload failed: {error:?}")), + Call { + origin, + dest, + value, + gas_limit, + storage_deposit_limit, + data, + } => { + let time_start = Instant::now(); + let result = Contracts::bare_call( + RuntimeOrigin::signed(origin.to_account_id(&results)), + dest.to_eth_addr(&results), + value, + gas_limit.unwrap_or(GAS_LIMIT), + storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT), + data, + DebugInfo::Skip, + CollectEvents::Skip, + ); + results.push(CallResult::Exec { + result, + wall_time: time_start.elapsed(), + }); + } + VerifyCall(expectation) => { + expectation.verify(results.last().expect("No call to verify")); + } + VerifyBalance { origin, expected } => { + let balance = Balances::usable_balance(origin.to_account_id(&results)); + assert_eq!(balance, expected); + } + VerifyStorage { + contract, + key, + expected, + } => { + let address = contract.to_eth_addr(&results); + let Ok(value) = Contracts::get_storage(address, key) else { + panic!("error reading storage for address {address}"); + }; + let Some(value) = value else { + panic!("no value at {address} key 0x{}", hex::encode(key)); + }; + assert_eq!(value, expected, "at key 0x{}", hex::encode(key)); + } + } + } + }); + + results + } + + pub fn from_comment(contract_name: &str, path: &str) -> Vec { + let solidity = match std::fs::read_to_string(path) { + Err(err) => panic!("unable to read {path}: {err}"), + Ok(solidity) => solidity, + }; + let mut json_string = String::with_capacity(solidity.len()); + let mut is_reading = false; + let mut specs = Vec::new(); + + for line in solidity.lines() { + if line.starts_with(SPEC_MARKER_BEGIN) { + is_reading = true; + continue; + } + + if is_reading { + if line.starts_with(SPEC_MARKER_END) { + match serde_json::from_str::(&json_string) { + Ok(mut spec) => { + spec.replace_empty_code(contract_name, path); + specs.push(spec); + } + Err(e) => panic!("invalid spec JSON: {e}"), + } + is_reading = false; + json_string.clear(); + continue; + } + + json_string.push_str(line) + } + } + + assert!(!specs.is_empty(), "source does not contain any test spec"); + + specs + } +} diff --git a/crates/runtime-api/Cargo.toml b/crates/runtime-api/Cargo.toml new file mode 100644 index 0000000..f5dcc52 --- /dev/null +++ b/crates/runtime-api/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "revive-runtime-api" +version.workspace = true +license.workspace = true +edition.workspace = true +repository.workspace = true +authors.workspace = true +description = "Implements the low level runtime API bindings with pallet contracts" + +[features] +riscv-64 = [] + +[dependencies] +anyhow = { workspace = true } +inkwell = { workspace = true, features = ["target-riscv", "no-libffi-linking", "llvm18-0"] } + +revive-common = { workspace = true } diff --git a/crates/pallet-contracts-pvm-llapi/README.md b/crates/runtime-api/README.md similarity index 100% rename from crates/pallet-contracts-pvm-llapi/README.md rename to crates/runtime-api/README.md diff --git a/crates/pallet-contracts-pvm-llapi/build.rs b/crates/runtime-api/build.rs similarity index 63% rename from crates/pallet-contracts-pvm-llapi/build.rs rename to crates/runtime-api/build.rs index 6a17ac7..6559e57 100644 --- a/crates/pallet-contracts-pvm-llapi/build.rs +++ b/crates/runtime-api/build.rs @@ -20,7 +20,15 @@ const TARGET_ABI_FLAG: &str = "-mabi=ilp32e"; #[cfg(feature = "riscv-64")] const TARGET_ABI_FLAG: &str = "-mabi=lp64e"; -fn compile(bitcode_path: &str) { +const IMPORTS_SOUCE: &str = "src/polkavm_imports.c"; +const IMPORTS_BC: &str = "polkavm_imports.bc"; +const IMPORTS_RUST: &str = "polkavm_imports.rs"; + +const EXPORTS_SOUCE: &str = "src/polkavm_exports.c"; +const EXPORTS_BC: &str = "polkavm_exports.bc"; +const EXPORTS_RUST: &str = "polkavm_exports.rs"; + +fn compile(source_path: &str, bitcode_path: &str) { let output = Command::new("clang") .args([ TARGET_FLAG, @@ -35,9 +43,9 @@ fn compile(bitcode_path: &str) { "-O3", "-emit-llvm", "-c", - "src/polkavm_guest.c", "-o", bitcode_path, + source_path, ]) .output() .expect("should be able to invoke C clang"); @@ -49,19 +57,24 @@ fn compile(bitcode_path: &str) { ); } -fn main() { +fn build_module(source_path: &str, bitcode_path: &str, rust_file: &str) { let out_dir = env::var_os("OUT_DIR").expect("env should have $OUT_DIR"); - let lib = "polkavm_guest.bc"; - let bitcode_path = Path::new(&out_dir).join(lib); - compile(bitcode_path.to_str().expect("$OUT_DIR should be UTF-8")); + let lib = Path::new(&out_dir).join(bitcode_path); + compile(source_path, lib.to_str().expect("$OUT_DIR should be UTF-8")); - let bitcode = fs::read(bitcode_path).expect("bitcode should have been built"); + let bitcode = fs::read(lib).expect("bitcode should have been built"); let len = bitcode.len(); - let src_path = Path::new(&out_dir).join("polkavm_guest.rs"); - let src = format!("pub static BITCODE: &[u8; {len}] = include_bytes!(\"{lib}\");"); + let src_path = Path::new(&out_dir).join(rust_file); + let src = format!("pub static BITCODE: &[u8; {len}] = include_bytes!(\"{bitcode_path}\");"); fs::write(src_path, src).expect("should be able to write in $OUT_DIR"); +} + +fn main() { + build_module(IMPORTS_SOUCE, IMPORTS_BC, IMPORTS_RUST); + build_module(EXPORTS_SOUCE, EXPORTS_BC, EXPORTS_RUST); println!("cargo:rerun-if-changed=build.rs"); - println!("cargo:rerun-if-changed=src/polkavm_guest.c"); + println!("cargo:rerun-if-changed=src/polkavm_imports.c"); + println!("cargo:rerun-if-changed=src/polkavm_exports.c"); println!("cargo:rerun-if-changed=src/polkavm_guest.h"); } diff --git a/crates/runtime-api/polkavm_exports.bc b/crates/runtime-api/polkavm_exports.bc new file mode 100644 index 0000000..844092b Binary files /dev/null and b/crates/runtime-api/polkavm_exports.bc differ diff --git a/crates/runtime-api/polkavm_imports.bc b/crates/runtime-api/polkavm_imports.bc new file mode 100644 index 0000000..188d5f1 Binary files /dev/null and b/crates/runtime-api/polkavm_imports.bc differ diff --git a/crates/pallet-contracts-pvm-llapi/src/calling_convention.rs b/crates/runtime-api/src/calling_convention.rs similarity index 64% rename from crates/pallet-contracts-pvm-llapi/src/calling_convention.rs rename to crates/runtime-api/src/calling_convention.rs index df3472a..c92a266 100644 --- a/crates/pallet-contracts-pvm-llapi/src/calling_convention.rs +++ b/crates/runtime-api/src/calling_convention.rs @@ -1,60 +1,53 @@ use inkwell::{ builder::Builder, context::Context, + module::Module, types::{BasicType, StructType}, - values::{BasicValue, PointerValue}, + values::{BasicValueEnum, PointerValue}, }; -pub struct Spill<'a, 'ctx> { +/// Creates a module that sets the PolkaVM minimum stack size to [`size`] if linked in. +pub fn min_stack_size<'context>( + context: &'context Context, + module_name: &str, + size: u32, +) -> Module<'context> { + let module = context.create_module(module_name); + module.set_inline_assembly(&format!( + ".pushsection .polkavm_min_stack_size,\"\",@progbits + .word {size} + .popsection" + )); + module +} + +/// Helper for building function calls with stack spilled arguments. +/// - `pointer`: points to a struct of the packed argument struct type +/// - `type`: the packed argument struct type +/// - `arguments`: a correctly ordered list of the struct field values +pub fn spill<'ctx>( + builder: &Builder<'ctx>, pointer: PointerValue<'ctx>, - builder: &'a Builder<'ctx>, r#type: StructType<'ctx>, - current_field: u32, -} - -impl<'a, 'ctx> Spill<'a, 'ctx> { - pub fn new( - builder: &'a Builder<'ctx>, - r#type: StructType<'ctx>, - name: &str, - ) -> anyhow::Result { - Ok(Self { - pointer: builder.build_alloca(r#type, name)?, - builder, + arguments: &[BasicValueEnum<'ctx>], +) -> anyhow::Result<()> { + for index in 0..r#type.get_field_types().len() { + let field_pointer = builder.build_struct_gep( r#type, - current_field: 0, - }) - } - - pub fn next>(mut self, value: V) -> anyhow::Result { - let field_pointer = self.builder.build_struct_gep( - self.r#type, - self.pointer, - self.current_field, - &format!("spill_parameter_{}", self.current_field), + pointer, + index as u32, + &format!("spill_parameter_{}", index), )?; - self.builder.build_store(field_pointer, value)?; - self.current_field += 1; - Ok(self) + let field_value = arguments + .get(index) + .ok_or_else(|| anyhow::anyhow!("invalid index {index} for struct type {}", r#type))?; + builder.build_store(field_pointer, *field_value)?; } - pub fn skip(mut self) -> Self { - self.current_field += 1; - self - } - - pub fn done(self) -> PointerValue<'ctx> { - assert!( - self.r#type - .get_field_type_at_index(self.current_field) - .is_none(), - "there must not be any missing parameters" - ); - - self.pointer - } + Ok(()) } +/// Returns a packed struct argument type for the `instantiate` API. pub fn instantiate(context: &Context) -> StructType { context.struct_type( &[ @@ -74,21 +67,18 @@ pub fn instantiate(context: &Context) -> StructType { context.i32_type().as_basic_type_enum(), // address_ptr: u32, context.ptr_type(Default::default()).as_basic_type_enum(), - // address_len_ptr: u32, - context.ptr_type(Default::default()).as_basic_type_enum(), // output_ptr: u32, context.ptr_type(Default::default()).as_basic_type_enum(), // output_len_ptr: u32, context.ptr_type(Default::default()).as_basic_type_enum(), // salt_ptr: u32, context.ptr_type(Default::default()).as_basic_type_enum(), - // salt_len: u32 - context.i32_type().as_basic_type_enum(), ], true, ) } +/// Returns a packed struct argument type for the `call` API. pub fn call(context: &Context) -> StructType { context.struct_type( &[ diff --git a/crates/runtime-api/src/immutable_data.rs b/crates/runtime-api/src/immutable_data.rs new file mode 100644 index 0000000..eb26e3e --- /dev/null +++ b/crates/runtime-api/src/immutable_data.rs @@ -0,0 +1,89 @@ +//! Allocates memory for the immutable data in a separate module. +//! +//! Because we only know how many immutable variables were set after +//! translating the whole contract code, we want to set the size at +//! last. However, array types need a size upon declaration. +//! +//! A simple work around is to replace it during link time. +//! To quote the [LLVM docs][0]: +//! +//! > For global variable declarations [..] the allocation size and +//! > alignment of the definition it resolves to must be greater than +//! > or equal to that of the declaration [..] +//! +//! To adhere to this we initially declare a length of 0 in +//! `revive-llvm-context`. +//! +//! [0]: https://llvm.org/docs/LangRef.html#global-variables + +/// The immutable data module name. +pub static MODULE_NAME: &str = "__evm_immutables"; +/// The immutable data global pointer. +pub static GLOBAL_IMMUTABLE_DATA_POINTER: &str = "__immutable_data_ptr"; +/// The immutable data global size. +pub static GLOBAL_IMMUTABLE_DATA_SIZE: &str = "__immutable_data_size"; +/// The immutable data maximum size in bytes. +pub static IMMUTABLE_DATA_MAX_SIZE: u32 = 4 * 1024; + +/// Returns the immutable data global type. +pub fn data_type(context: &inkwell::context::Context, size: u32) -> inkwell::types::ArrayType { + context + .custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32) + .array_type(size) +} + +/// Returns the immutable data size global type. +pub fn size_type(context: &inkwell::context::Context) -> inkwell::types::IntType { + context.custom_width_int_type(revive_common::BIT_LENGTH_X32 as u32) +} + +/// Creates a LLVM module with the immutable data and its `size` in bytes. +pub fn module(context: &inkwell::context::Context, size: u32) -> inkwell::module::Module { + let module = context.create_module(MODULE_NAME); + let length = size / revive_common::BYTE_LENGTH_WORD as u32; + + let immutable_data = module.add_global( + data_type(context, length), + Default::default(), + GLOBAL_IMMUTABLE_DATA_POINTER, + ); + immutable_data.set_linkage(inkwell::module::Linkage::External); + immutable_data.set_visibility(inkwell::GlobalVisibility::Default); + immutable_data.set_initializer(&data_type(context, length).get_undef()); + + let immutable_data_size = module.add_global( + size_type(context), + Default::default(), + GLOBAL_IMMUTABLE_DATA_SIZE, + ); + immutable_data_size.set_linkage(inkwell::module::Linkage::External); + immutable_data_size.set_visibility(inkwell::GlobalVisibility::Default); + immutable_data_size.set_initializer(&size_type(context).const_int(size as u64, false)); + + module +} + +#[cfg(test)] +mod tests { + use crate::immutable_data::*; + + #[test] + fn it_works() { + inkwell::targets::Target::initialize_riscv(&Default::default()); + let context = inkwell::context::Context::create(); + let size = 512; + let module = crate::immutable_data::module(&context, size); + + let immutable_data_pointer = module.get_global(GLOBAL_IMMUTABLE_DATA_POINTER).unwrap(); + assert_eq!( + immutable_data_pointer.get_initializer().unwrap(), + data_type(&context, size / 32).get_undef() + ); + + let immutable_data_size = module.get_global(GLOBAL_IMMUTABLE_DATA_SIZE).unwrap(); + assert_eq!( + immutable_data_size.get_initializer().unwrap(), + size_type(&context).const_int(size as u64, false) + ); + } +} diff --git a/crates/runtime-api/src/lib.rs b/crates/runtime-api/src/lib.rs new file mode 100644 index 0000000..b0e5987 --- /dev/null +++ b/crates/runtime-api/src/lib.rs @@ -0,0 +1,12 @@ +//! This crate vendors the [PolkaVM][0] C API and provides a LLVM module for interacting +//! with the `pallet-revive` runtime API. +//! At present, the contracts pallet requires blobs to export `call` and `deploy`, +//! and offers a bunch of [runtime API methods][1]. The provided [module] implements +//! those exports and imports. +//! [0]: [https://crates.io/crates/polkavm] +//! [1]: [https://docs.rs/pallet-contracts/26.0.0/pallet_contracts/api_doc/index.html] + +pub mod calling_convention; +pub mod immutable_data; +pub mod polkavm_exports; +pub mod polkavm_imports; diff --git a/crates/runtime-api/src/polkavm_exports.c b/crates/runtime-api/src/polkavm_exports.c new file mode 100644 index 0000000..2402077 --- /dev/null +++ b/crates/runtime-api/src/polkavm_exports.c @@ -0,0 +1,16 @@ +#include + +#include "polkavm_guest.h" + +extern void __entry(bool); + +static void deploy() { + __entry(true); +} + +static void call() { + __entry(false); +} + +POLKAVM_EXPORT(void, deploy) +POLKAVM_EXPORT(void, call) diff --git a/crates/runtime-api/src/polkavm_exports.rs b/crates/runtime-api/src/polkavm_exports.rs new file mode 100644 index 0000000..dddf160 --- /dev/null +++ b/crates/runtime-api/src/polkavm_exports.rs @@ -0,0 +1,39 @@ +use inkwell::{context::Context, memory_buffer::MemoryBuffer, module::Module, support::LLVMString}; + +include!(concat!(env!("OUT_DIR"), "/polkavm_exports.rs")); + +/// The contract deploy export. +pub static CALL: &str = "call"; + +/// The contract call export. +pub static DEPLOY: &str = "deploy"; + +/// All exported symbols. +/// Useful for configuring common attributes and linkage. +pub static EXPORTS: [&str; 2] = [CALL, DEPLOY]; + +/// Creates a LLVM module from the [BITCODE]. +/// The module exports `call` and `deploy` functions (which are named thereafter). +/// Returns `Error` if the bitcode fails to parse, which should never happen. +pub fn module<'context>( + context: &'context Context, + module_name: &str, +) -> Result, LLVMString> { + let buf = MemoryBuffer::create_from_memory_range(BITCODE, module_name); + Module::parse_bitcode_from_buffer(&buf, context) +} + +#[cfg(test)] +mod tests { + use crate::polkavm_exports; + + #[test] + fn it_works() { + inkwell::targets::Target::initialize_riscv(&Default::default()); + let context = inkwell::context::Context::create(); + let module = polkavm_exports::module(&context, "polkavm_exports").unwrap(); + + assert!(module.get_function(polkavm_exports::CALL).is_some()); + assert!(module.get_function(polkavm_exports::DEPLOY).is_some()); + } +} diff --git a/crates/pallet-contracts-pvm-llapi/src/polkavm_guest.h b/crates/runtime-api/src/polkavm_guest.h similarity index 100% rename from crates/pallet-contracts-pvm-llapi/src/polkavm_guest.h rename to crates/runtime-api/src/polkavm_guest.h diff --git a/crates/runtime-api/src/polkavm_imports.c b/crates/runtime-api/src/polkavm_imports.c new file mode 100644 index 0000000..a5a28cb --- /dev/null +++ b/crates/runtime-api/src/polkavm_imports.c @@ -0,0 +1,111 @@ +#include +#include + +#include "polkavm_guest.h" + +// Missing builtins + +#define EVM_WORD_SIZE 32 +#define ALIGN(size) ((size + EVM_WORD_SIZE - 1) & ~(EVM_WORD_SIZE - 1)) +#define MAX_MEMORY_SIZE (64 * 1024) +static char __memory[MAX_MEMORY_SIZE]; +static uint32_t __memory_size = 0; + +void * __sbrk_internal(uint32_t offset, uint32_t size) { + if (offset >= MAX_MEMORY_SIZE || size > MAX_MEMORY_SIZE) { + return NULL; + } + + uint32_t new_size = ALIGN(offset + size); + if (new_size > MAX_MEMORY_SIZE) { + return NULL; + } + if (new_size > __memory_size) { + __memory_size = new_size; + } + + return (void *)&__memory[__memory_size]; +} + +uint32_t __msize() { + return __memory_size; +} + +void * memset(void *b, int c, size_t len) { + uint8_t *dest = b; + while (len-- > 0) *dest++ = c; + return b; +} + +void * memcpy(void *dst, const void *_src, size_t len) { + uint8_t *dest = dst; + const uint8_t *src = _src; + + while (len--) *dest++ = *src++; + + return dst; +} + +void * memmove(void *dst, const void *src, size_t n) { + char *d = dst; + const char *s = src; + + if (d==s) return d; + if ((uintptr_t)s-(uintptr_t)d-n <= -2*n) return memcpy(d, s, n); + + if (d( + context: &'context Context, + module_name: &str, +) -> Result, LLVMString> { + let buf = MemoryBuffer::create_from_memory_range(BITCODE, module_name); + Module::parse_bitcode_from_buffer(&buf, context) +} + +#[cfg(test)] +mod tests { + use crate::polkavm_imports; + + #[test] + fn it_works() { + inkwell::targets::Target::initialize_riscv(&Default::default()); + let context = inkwell::context::Context::create(); + let _ = polkavm_imports::module(&context, "polkavm_imports").unwrap(); + } +} diff --git a/crates/solidity/build.rs b/crates/solidity/build.rs new file mode 100644 index 0000000..abbf2e4 --- /dev/null +++ b/crates/solidity/build.rs @@ -0,0 +1,9 @@ +fn main() { + let git_rev = std::process::Command::new("git") + .args(["rev-parse", "--short", "HEAD"]) + .output() + .map(|out| String::from_utf8(out.stdout).unwrap_or_default()) + .unwrap_or("unknown".to_owned()); + + println!("cargo:rustc-env=GIT_COMMIT_HASH={}", git_rev.trim()); +} diff --git a/crates/solidity/src/build/mod.rs b/crates/solidity/src/build/mod.rs index ad2bd4d..5dd5d7e 100644 --- a/crates/solidity/src/build/mod.rs +++ b/crates/solidity/src/build/mod.rs @@ -5,9 +5,10 @@ pub mod contract; use std::collections::BTreeMap; use std::path::Path; -use crate::compiler::combined_json::CombinedJson; -use crate::compiler::standard_json::output::Output as StandardJsonOutput; -use crate::compiler::version::Version as SolcVersion; +use crate::solc::combined_json::CombinedJson; +use crate::solc::standard_json::output::Output as StandardJsonOutput; +use crate::solc::version::Version as SolcVersion; +use crate::ResolcVersion; use self::contract::Contract; @@ -40,11 +41,7 @@ impl Build { } /// Writes all contracts assembly and bytecode to the combined JSON. - pub fn write_to_combined_json( - self, - combined_json: &mut CombinedJson, - resolc_version: &semver::Version, - ) -> anyhow::Result<()> { + pub fn write_to_combined_json(self, combined_json: &mut CombinedJson) -> anyhow::Result<()> { for (path, contract) in self.contracts.into_iter() { let combined_json_contract = combined_json .contracts @@ -61,7 +58,7 @@ impl Build { contract.write_to_combined_json(combined_json_contract)?; } - combined_json.zk_version = Some(resolc_version.to_string()); + combined_json.revive_version = Some(ResolcVersion::default().long); Ok(()) } @@ -71,7 +68,6 @@ impl Build { mut self, standard_json: &mut StandardJsonOutput, solc_version: &SolcVersion, - resolc_version: &semver::Version, ) -> anyhow::Result<()> { let contracts = match standard_json.contracts.as_mut() { Some(contracts) => contracts, @@ -90,7 +86,7 @@ impl Build { standard_json.version = Some(solc_version.default.to_string()); standard_json.long_version = Some(solc_version.long.to_owned()); - standard_json.zk_version = Some(resolc_version.to_string()); + standard_json.revive_version = Some(ResolcVersion::default().long); Ok(()) } diff --git a/crates/solidity/src/evmla/assembly/mod.rs b/crates/solidity/src/evmla/assembly/mod.rs index 5a472d6..1887e90 100644 --- a/crates/solidity/src/evmla/assembly/mod.rs +++ b/crates/solidity/src/evmla/assembly/mod.rs @@ -199,6 +199,7 @@ where revive_llvm_context::PolkaVMDummyLLVMWritable::default(), ) .declare(context)?; + revive_llvm_context::PolkaVMImmutableDataLoadFunction.declare(context)?; entry.into_llvm(context)?; @@ -266,6 +267,7 @@ where revive_llvm_context::PolkaVMCodeType::Runtime, )) .into_llvm(context)?; + revive_llvm_context::PolkaVMImmutableDataLoadFunction.into_llvm(context)?; Ok(()) } diff --git a/crates/solidity/src/evmla/ethereal_ir/function/block/element/mod.rs b/crates/solidity/src/evmla/ethereal_ir/function/block/element/mod.rs index b285fde..dc4f963 100644 --- a/crates/solidity/src/evmla/ethereal_ir/function/block/element/mod.rs +++ b/crates/solidity/src/evmla/ethereal_ir/function/block/element/mod.rs @@ -45,7 +45,7 @@ impl Element { fn pop_arguments_llvm<'ctx, D>( &mut self, context: &mut revive_llvm_context::PolkaVMContext<'ctx, D>, - ) -> Vec> + ) -> anyhow::Result>> where D: revive_llvm_context::PolkaVMDependency + Clone, { @@ -57,15 +57,13 @@ impl Element { [self.stack.elements.len() + input_size - output_size - 1 - index] .to_llvm() .into_pointer_value(); - let value = context - .build_load( - revive_llvm_context::PolkaVMPointer::new_stack_field(context, pointer), - format!("argument_{index}").as_str(), - ) - .unwrap(); + let value = context.build_load( + revive_llvm_context::PolkaVMPointer::new_stack_field(context, pointer), + format!("argument_{index}").as_str(), + )?; arguments.push(value); } - arguments + Ok(arguments) } } @@ -426,7 +424,7 @@ where InstructionName::JUMPDEST => Ok(None), InstructionName::ADD => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_arithmetic::addition( context, arguments[0].into_int_value(), @@ -435,7 +433,7 @@ where .map(Some) } InstructionName::SUB => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_arithmetic::subtraction( context, arguments[0].into_int_value(), @@ -444,7 +442,7 @@ where .map(Some) } InstructionName::MUL => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_arithmetic::multiplication( context, arguments[0].into_int_value(), @@ -453,7 +451,7 @@ where .map(Some) } InstructionName::DIV => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_arithmetic::division( context, arguments[0].into_int_value(), @@ -462,7 +460,7 @@ where .map(Some) } InstructionName::MOD => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_arithmetic::remainder( context, arguments[0].into_int_value(), @@ -471,7 +469,7 @@ where .map(Some) } InstructionName::SDIV => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_arithmetic::division_signed( context, arguments[0].into_int_value(), @@ -480,7 +478,7 @@ where .map(Some) } InstructionName::SMOD => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_arithmetic::remainder_signed( context, arguments[0].into_int_value(), @@ -490,7 +488,7 @@ where } InstructionName::LT => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_comparison::compare( context, arguments[0].into_int_value(), @@ -500,7 +498,7 @@ where .map(Some) } InstructionName::GT => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_comparison::compare( context, arguments[0].into_int_value(), @@ -510,7 +508,7 @@ where .map(Some) } InstructionName::EQ => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_comparison::compare( context, arguments[0].into_int_value(), @@ -520,7 +518,7 @@ where .map(Some) } InstructionName::ISZERO => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_comparison::compare( context, arguments[0].into_int_value(), @@ -530,7 +528,7 @@ where .map(Some) } InstructionName::SLT => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_comparison::compare( context, arguments[0].into_int_value(), @@ -540,7 +538,7 @@ where .map(Some) } InstructionName::SGT => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_comparison::compare( context, arguments[0].into_int_value(), @@ -551,7 +549,7 @@ where } InstructionName::OR => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_bitwise::or( context, arguments[0].into_int_value(), @@ -560,7 +558,7 @@ where .map(Some) } InstructionName::XOR => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_bitwise::xor( context, arguments[0].into_int_value(), @@ -569,7 +567,7 @@ where .map(Some) } InstructionName::NOT => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_bitwise::xor( context, arguments[0].into_int_value(), @@ -578,7 +576,7 @@ where .map(Some) } InstructionName::AND => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_bitwise::and( context, arguments[0].into_int_value(), @@ -587,7 +585,7 @@ where .map(Some) } InstructionName::SHL => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_bitwise::shift_left( context, arguments[0].into_int_value(), @@ -596,7 +594,7 @@ where .map(Some) } InstructionName::SHR => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_bitwise::shift_right( context, arguments[0].into_int_value(), @@ -605,7 +603,7 @@ where .map(Some) } InstructionName::SAR => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_bitwise::shift_right_arithmetic( context, arguments[0].into_int_value(), @@ -614,7 +612,7 @@ where .map(Some) } InstructionName::BYTE => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_bitwise::byte( context, arguments[0].into_int_value(), @@ -624,7 +622,7 @@ where } InstructionName::ADDMOD => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_math::add_mod( context, arguments[0].into_int_value(), @@ -634,7 +632,7 @@ where .map(Some) } InstructionName::MULMOD => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_math::mul_mod( context, arguments[0].into_int_value(), @@ -644,7 +642,7 @@ where .map(Some) } InstructionName::EXP => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_math::exponent( context, arguments[0].into_int_value(), @@ -653,7 +651,7 @@ where .map(Some) } InstructionName::SIGNEXTEND => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_math::sign_extend( context, arguments[0].into_int_value(), @@ -663,7 +661,7 @@ where } InstructionName::SHA3 | InstructionName::KECCAK256 => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_crypto::sha3( context, arguments[0].into_int_value(), @@ -673,7 +671,7 @@ where } InstructionName::MLOAD => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_memory::load( context, arguments[0].into_int_value(), @@ -681,7 +679,7 @@ where .map(Some) } InstructionName::MSTORE => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_memory::store( context, arguments[0].into_int_value(), @@ -690,7 +688,7 @@ where .map(|_| None) } InstructionName::MSTORE8 => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_memory::store_byte( context, arguments[0].into_int_value(), @@ -699,7 +697,7 @@ where .map(|_| None) } InstructionName::MCOPY => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; let destination = revive_llvm_context::PolkaVMPointer::new_with_offset( context, revive_llvm_context::PolkaVMAddressSpace::Heap, @@ -725,7 +723,7 @@ where } InstructionName::SLOAD => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_storage::load( context, arguments[0].into_int_value(), @@ -733,7 +731,7 @@ where .map(Some) } InstructionName::SSTORE => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_storage::store( context, arguments[0].into_int_value(), @@ -742,7 +740,7 @@ where .map(|_| None) } InstructionName::TLOAD => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_storage::transient_load( context, arguments[0].into_int_value(), @@ -750,7 +748,7 @@ where .map(Some) } InstructionName::TSTORE => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_storage::transient_store( context, arguments[0].into_int_value(), @@ -766,27 +764,28 @@ where let offset = context .solidity_mut() - .get_or_allocate_immutable(key.as_str()); + .get_or_allocate_immutable(key.as_str()) + / revive_common::BYTE_LENGTH_WORD; - let index = context.word_const(offset as u64); + let index = context.xlen_type().const_int(offset as u64, false); revive_llvm_context::polkavm_evm_immutable::load(context, index).map(Some) } InstructionName::ASSIGNIMMUTABLE => { - let mut arguments = self.pop_arguments_llvm(context); + let mut arguments = self.pop_arguments_llvm(context)?; let key = self .instruction .value .ok_or_else(|| anyhow::anyhow!("Instruction value missing"))?; - let offset = context.solidity_mut().allocate_immutable(key.as_str()); + let offset = context.solidity_mut().allocate_immutable(key.as_str()) + / revive_common::BYTE_LENGTH_WORD; - let index = context.word_const(offset as u64); + let index = context.xlen_type().const_int(offset as u64, false); let value = arguments.pop().expect("Always exists").into_int_value(); revive_llvm_context::polkavm_evm_immutable::store(context, index, value) .map(|_| None) } - InstructionName::CALLDATALOAD => { match context .code_type() @@ -796,7 +795,7 @@ where Ok(Some(context.word_const(0).as_basic_value_enum())) } revive_llvm_context::PolkaVMCodeType::Runtime => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_calldata::load( context, arguments[0].into_int_value(), @@ -819,7 +818,7 @@ where } } InstructionName::CALLDATACOPY => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; match context .code_type() @@ -862,7 +861,7 @@ where } } InstructionName::CODECOPY => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; let parent = context.module().get_name().to_str().expect("Always valid"); let source = &self.stack_input.elements[1]; @@ -917,7 +916,7 @@ where revive_llvm_context::polkavm_evm_return_data::size(context).map(Some) } InstructionName::RETURNDATACOPY => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_return_data::copy( context, arguments[0].into_int_value(), @@ -927,7 +926,7 @@ where .map(|_| None) } InstructionName::EXTCODESIZE => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_ext_code::size( context, Some(arguments[0].into_int_value()), @@ -935,7 +934,7 @@ where .map(Some) } InstructionName::EXTCODEHASH => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_ext_code::hash( context, arguments[0].into_int_value(), @@ -944,7 +943,7 @@ where } InstructionName::RETURN => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_return::r#return( context, arguments[0].into_int_value(), @@ -953,7 +952,7 @@ where .map(|_| None) } InstructionName::REVERT => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_return::revert( context, arguments[0].into_int_value(), @@ -969,7 +968,7 @@ where } InstructionName::LOG0 => { - let mut arguments = self.pop_arguments_llvm(context); + let mut arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_event::log( context, arguments.remove(0).into_int_value(), @@ -982,7 +981,7 @@ where .map(|_| None) } InstructionName::LOG1 => { - let mut arguments = self.pop_arguments_llvm(context); + let mut arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_event::log( context, arguments.remove(0).into_int_value(), @@ -995,7 +994,7 @@ where .map(|_| None) } InstructionName::LOG2 => { - let mut arguments = self.pop_arguments_llvm(context); + let mut arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_event::log( context, arguments.remove(0).into_int_value(), @@ -1008,7 +1007,7 @@ where .map(|_| None) } InstructionName::LOG3 => { - let mut arguments = self.pop_arguments_llvm(context); + let mut arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_event::log( context, arguments.remove(0).into_int_value(), @@ -1021,7 +1020,7 @@ where .map(|_| None) } InstructionName::LOG4 => { - let mut arguments = self.pop_arguments_llvm(context); + let mut arguments = self.pop_arguments_llvm(context)?; revive_llvm_context::polkavm_evm_event::log( context, arguments.remove(0).into_int_value(), @@ -1035,7 +1034,7 @@ where } InstructionName::CALL => { - let mut arguments = self.pop_arguments_llvm(context); + let mut arguments = self.pop_arguments_llvm(context)?; let gas = arguments.remove(0).into_int_value(); let address = arguments.remove(0).into_int_value(); @@ -1060,7 +1059,7 @@ where .map(Some) } InstructionName::STATICCALL => { - let mut arguments = self.pop_arguments_llvm(context); + let mut arguments = self.pop_arguments_llvm(context)?; let gas = arguments.remove(0).into_int_value(); let address = arguments.remove(0).into_int_value(); @@ -1084,7 +1083,7 @@ where .map(Some) } InstructionName::DELEGATECALL => { - let mut arguments = self.pop_arguments_llvm(context); + let mut arguments = self.pop_arguments_llvm(context)?; let gas = arguments.remove(0).into_int_value(); let address = arguments.remove(0).into_int_value(); @@ -1108,7 +1107,7 @@ where } InstructionName::CREATE | InstructionName::ZK_CREATE => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; let value = arguments[0].into_int_value(); let input_offset = arguments[1].into_int_value(); @@ -1119,18 +1118,19 @@ where value, input_offset, input_length, + None, ) .map(Some) } InstructionName::CREATE2 | InstructionName::ZK_CREATE2 => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; let value = arguments[0].into_int_value(); let input_offset = arguments[1].into_int_value(); let input_length = arguments[2].into_int_value(); let salt = arguments[3].into_int_value(); - revive_llvm_context::polkavm_evm_create::create2( + revive_llvm_context::polkavm_evm_create::create( context, value, input_offset, @@ -1154,12 +1154,14 @@ where revive_llvm_context::polkavm_evm_ether_gas::gas(context).map(Some) } InstructionName::BALANCE => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; let address = arguments[0].into_int_value(); revive_llvm_context::polkavm_evm_ether_gas::balance(context, address).map(Some) } - InstructionName::SELFBALANCE => todo!(), + InstructionName::SELFBALANCE => { + revive_llvm_context::polkavm_evm_ether_gas::self_balance(context).map(Some) + } InstructionName::GASLIMIT => { revive_llvm_context::polkavm_evm_contract_context::gas_limit(context).map(Some) @@ -1181,7 +1183,7 @@ where revive_llvm_context::polkavm_evm_contract_context::block_number(context).map(Some) } InstructionName::BLOCKHASH => { - let arguments = self.pop_arguments_llvm(context); + let arguments = self.pop_arguments_llvm(context)?; let index = arguments[0].into_int_value(); revive_llvm_context::polkavm_evm_contract_context::block_hash(context, index) @@ -1204,7 +1206,7 @@ where anyhow::bail!("The `BLOBBASEFEE` instruction is not supported until zkVM v1.5.0"); } InstructionName::MSIZE => { - revive_llvm_context::polkavm_evm_contract_context::msize(context).map(Some) + revive_llvm_context::polkavm_evm_memory::msize(context).map(Some) } InstructionName::CALLCODE => { @@ -1219,7 +1221,7 @@ where anyhow::bail!("The `EXTCODECOPY` instruction is not supported"); } InstructionName::SELFDESTRUCT => { - let _arguments = self.pop_arguments_llvm(context); + let _arguments = self.pop_arguments_llvm(context)?; anyhow::bail!("The `SELFDESTRUCT` instruction is not supported"); } @@ -1231,7 +1233,7 @@ where return_address, .. } => { - let mut arguments = self.pop_arguments_llvm(context); + let mut arguments = self.pop_arguments_llvm(context)?; arguments.pop(); arguments.reverse(); arguments.pop(); @@ -1294,7 +1296,7 @@ where return Ok(()); } InstructionName::RecursiveReturn { .. } => { - let mut arguments = self.pop_arguments_llvm(context); + let mut arguments = self.pop_arguments_llvm(context)?; arguments.reverse(); arguments.pop(); diff --git a/crates/solidity/src/evmla/ethereal_ir/function/mod.rs b/crates/solidity/src/evmla/ethereal_ir/function/mod.rs index 0ecbb0e..d0bee17 100644 --- a/crates/solidity/src/evmla/ethereal_ir/function/mod.rs +++ b/crates/solidity/src/evmla/ethereal_ir/function/mod.rs @@ -1139,7 +1139,6 @@ where .integer_type(revive_common::BIT_LENGTH_BOOLEAN) .as_basic_type_enum()], output_size, - false, ); (r#type, output_size) } @@ -1156,7 +1155,6 @@ where input_size ], output_size, - false, ); (r#type, output_size) } diff --git a/crates/solidity/src/lib.rs b/crates/solidity/src/lib.rs index 5ec8486..286c097 100644 --- a/crates/solidity/src/lib.rs +++ b/crates/solidity/src/lib.rs @@ -8,6 +8,8 @@ pub(crate) mod evmla; pub(crate) mod missing_libraries; pub(crate) mod process; pub(crate) mod project; +pub(crate) mod solc; +pub(crate) mod version; pub(crate) mod warning; pub(crate) mod yul; @@ -46,6 +48,25 @@ pub use self::process::Process; pub use self::project::contract::Contract as ProjectContract; pub use self::project::Project; pub use self::r#const::*; +pub use self::solc::combined_json::contract::Contract as SolcCombinedJsonContract; +pub use self::solc::combined_json::CombinedJson as SolcCombinedJson; +pub use self::solc::pipeline::Pipeline as SolcPipeline; +pub use self::solc::standard_json::input::language::Language as SolcStandardJsonInputLanguage; +pub use self::solc::standard_json::input::settings::metadata::Metadata as SolcStandardJsonInputSettingsMetadata; +pub use self::solc::standard_json::input::settings::optimizer::Optimizer as SolcStandardJsonInputSettingsOptimizer; +pub use self::solc::standard_json::input::settings::selection::file::flag::Flag as SolcStandardJsonInputSettingsSelectionFileFlag; +pub use self::solc::standard_json::input::settings::selection::file::File as SolcStandardJsonInputSettingsSelectionFile; +pub use self::solc::standard_json::input::settings::selection::Selection as SolcStandardJsonInputSettingsSelection; +pub use self::solc::standard_json::input::settings::Settings as SolcStandardJsonInputSettings; +pub use self::solc::standard_json::input::source::Source as SolcStandardJsonInputSource; +pub use self::solc::standard_json::input::Input as SolcStandardJsonInput; +pub use self::solc::standard_json::output::contract::evm::bytecode::Bytecode as SolcStandardJsonOutputContractEVMBytecode; +pub use self::solc::standard_json::output::contract::evm::EVM as SolcStandardJsonOutputContractEVM; +pub use self::solc::standard_json::output::contract::Contract as SolcStandardJsonOutputContract; +pub use self::solc::standard_json::output::Output as SolcStandardJsonOutput; +pub use self::solc::version::Version as SolcVersion; +pub use self::solc::Compiler as SolcCompiler; +pub use self::version::Version as ResolcVersion; pub use self::warning::Warning; #[cfg(target_os = "emscripten")] pub mod libsolc; @@ -61,7 +82,6 @@ pub fn yul( input_files: &[PathBuf], solc: &mut T, optimizer_settings: revive_llvm_context::OptimizerSettings, - is_system_mode: bool, include_metadata_hash: bool, debug_config: Option, ) -> anyhow::Result { @@ -74,28 +94,17 @@ pub fn yul( ), }; - let solc_validator = if is_system_mode { - None - } else { - if solc.version()?.default != compiler::LAST_SUPPORTED_VERSION { - anyhow::bail!( + if solc.version()?.default != SolcCompiler::LAST_SUPPORTED_VERSION { + anyhow::bail!( "The Yul mode is only supported with the most recent version of the Solidity compiler: {}", compiler::LAST_SUPPORTED_VERSION, ); - } - - Some(&*solc) - }; + } + let solc_validator = Some(&*solc); let project = Project::try_from_yul_path(path, solc_validator)?; - let build = project.compile( - optimizer_settings, - is_system_mode, - include_metadata_hash, - false, - debug_config, - )?; + let build = project.compile(optimizer_settings, include_metadata_hash, debug_config)?; Ok(build) } @@ -104,7 +113,6 @@ pub fn yul( pub fn llvm_ir( input_files: &[PathBuf], optimizer_settings: revive_llvm_context::OptimizerSettings, - is_system_mode: bool, include_metadata_hash: bool, debug_config: Option, ) -> anyhow::Result { @@ -119,13 +127,7 @@ pub fn llvm_ir( let project = Project::try_from_llvm_ir_path(path)?; - let build = project.compile( - optimizer_settings, - is_system_mode, - include_metadata_hash, - false, - debug_config, - )?; + let build = project.compile(optimizer_settings, include_metadata_hash, debug_config)?; Ok(build) } @@ -140,7 +142,6 @@ pub fn standard_output( solc_optimizer_enabled: bool, optimizer_settings: revive_llvm_context::OptimizerSettings, force_evmla: bool, - is_system_mode: bool, include_metadata_hash: bool, base_path: Option, include_paths: Vec, @@ -164,7 +165,6 @@ pub fn standard_output( None, &solc_version.default, optimizer_settings.is_fallback_to_size_enabled(), - optimizer_settings.is_system_request_memoization_disabled(), ), None, solc_pipeline == SolcPipeline::Yul, @@ -210,13 +210,7 @@ pub fn standard_output( debug_config.as_ref(), )?; - let build = project.compile( - optimizer_settings, - is_system_mode, - include_metadata_hash, - false, - debug_config, - )?; + let build = project.compile(optimizer_settings, include_metadata_hash, debug_config)?; Ok(build) } @@ -227,7 +221,6 @@ pub fn standard_json( solc: &mut T, detect_missing_libraries: bool, force_evmla: bool, - is_system_mode: bool, base_path: Option, include_paths: Vec, allow_paths: Option, @@ -235,7 +228,6 @@ pub fn standard_json( ) -> anyhow::Result<()> { let solc_version = solc.version()?; let solc_pipeline = SolcPipeline::new(&solc_version, force_evmla); - let resolc_version = semver::Version::parse(env!("CARGO_PKG_VERSION")).expect("Always valid"); let solc_input = SolcStandardJsonInput::try_from_stdin(solc_pipeline)?; let source_code_files = solc_input @@ -282,20 +274,10 @@ pub fn standard_json( if detect_missing_libraries { let missing_libraries = project.get_missing_libraries(); - missing_libraries.write_to_standard_json( - &mut solc_output, - &solc_version, - &resolc_version, - )?; + missing_libraries.write_to_standard_json(&mut solc_output, &solc_version)?; } else { - let build = project.compile( - optimizer_settings, - is_system_mode, - include_metadata_hash, - false, - debug_config, - )?; - build.write_to_standard_json(&mut solc_output, &solc_version, &resolc_version)?; + let build = project.compile(optimizer_settings, include_metadata_hash, debug_config)?; + build.write_to_standard_json(&mut solc_output, &solc_version)?; } serde_json::to_writer(std::io::stdout(), &solc_output)?; std::process::exit(0); @@ -312,7 +294,6 @@ pub fn combined_json( solc_optimizer_enabled: bool, optimizer_settings: revive_llvm_context::OptimizerSettings, force_evmla: bool, - is_system_mode: bool, include_metadata_hash: bool, base_path: Option, include_paths: Vec, @@ -323,8 +304,6 @@ pub fn combined_json( output_directory: Option, overwrite: bool, ) -> anyhow::Result<()> { - let resolc_version = semver::Version::parse(env!("CARGO_PKG_VERSION")).expect("Always valid"); - let build = standard_output( input_files, libraries, @@ -333,7 +312,6 @@ pub fn combined_json( solc_optimizer_enabled, optimizer_settings, force_evmla, - is_system_mode, include_metadata_hash, base_path, include_paths, @@ -344,7 +322,7 @@ pub fn combined_json( )?; let mut combined_json = solc.combined_json(input_files, format.as_str())?; - build.write_to_combined_json(&mut combined_json, &resolc_version)?; + build.write_to_combined_json(&mut combined_json)?; match output_directory { Some(output_directory) => { diff --git a/crates/solidity/src/missing_libraries.rs b/crates/solidity/src/missing_libraries.rs index f1c5d6f..f14927f 100644 --- a/crates/solidity/src/missing_libraries.rs +++ b/crates/solidity/src/missing_libraries.rs @@ -3,8 +3,9 @@ use std::collections::BTreeMap; use std::collections::HashSet; -use crate::compiler::standard_json::output::Output as StandardJsonOutput; -use crate::compiler::version::Version as SolcVersion; +use crate::solc::standard_json::output::Output as StandardJsonOutput; +use crate::solc::version::Version as SolcVersion; +use crate::ResolcVersion; /// The missing Solidity libraries. pub struct MissingLibraries { @@ -23,7 +24,6 @@ impl MissingLibraries { mut self, standard_json: &mut StandardJsonOutput, solc_version: &SolcVersion, - resolc_version: &semver::Version, ) -> anyhow::Result<()> { let contracts = match standard_json.contracts.as_mut() { Some(contracts) => contracts, @@ -43,7 +43,7 @@ impl MissingLibraries { standard_json.version = Some(solc_version.default.to_string()); standard_json.long_version = Some(solc_version.long.to_owned()); - standard_json.zk_version = Some(resolc_version.to_string()); + standard_json.revive_version = Some(ResolcVersion::default().long); Ok(()) } diff --git a/crates/solidity/src/process/input.rs b/crates/solidity/src/process/input.rs index 9492318..203ea66 100644 --- a/crates/solidity/src/process/input.rs +++ b/crates/solidity/src/process/input.rs @@ -14,12 +14,8 @@ pub struct Input { pub contract: Contract, /// The project representation. pub project: Project, - /// The system mode flag. - pub is_system_mode: bool, /// Whether to append the metadata hash. pub include_metadata_hash: bool, - /// Enables the test bytecode encoding. - pub enable_test_encoding: bool, /// The optimizer settings. pub optimizer_settings: revive_llvm_context::OptimizerSettings, /// The debug output config. @@ -31,18 +27,14 @@ impl Input { pub fn new( contract: Contract, project: Project, - is_system_mode: bool, include_metadata_hash: bool, - enable_test_encoding: bool, optimizer_settings: revive_llvm_context::OptimizerSettings, debug_config: Option, ) -> Self { Self { contract, project, - is_system_mode, include_metadata_hash, - enable_test_encoding, optimizer_settings, debug_config, } diff --git a/crates/solidity/src/project/contract/metadata.rs b/crates/solidity/src/project/contract/metadata.rs index 931b27c..c7bc4ea 100644 --- a/crates/solidity/src/project/contract/metadata.rs +++ b/crates/solidity/src/project/contract/metadata.rs @@ -2,6 +2,8 @@ use serde::Serialize; +use crate::ResolcVersion; + /// The Solidity contract metadata. /// Is used to append the metadata hash to the contract bytecode. #[derive(Debug, Serialize)] @@ -9,11 +11,11 @@ pub struct Metadata { /// The `solc` metadata. pub solc_metadata: serde_json::Value, /// The `solc` version. - pub solc_version: semver::Version, - /// The zkVM `solc` edition. - pub solc_zkvm_edition: Option, + pub solc_version: String, + /// The pallet revive edition. + pub revive_pallet_version: Option, /// The PolkaVM compiler version. - pub zk_version: semver::Version, + pub revive_version: String, /// The PolkaVM compiler optimizer settings. pub optimizer_settings: revive_llvm_context::OptimizerSettings, } @@ -22,16 +24,15 @@ impl Metadata { /// A shortcut constructor. pub fn new( solc_metadata: serde_json::Value, - solc_version: semver::Version, - solc_zkvm_edition: Option, - zk_version: semver::Version, + solc_version: String, + revive_pallet_version: Option, optimizer_settings: revive_llvm_context::OptimizerSettings, ) -> Self { Self { solc_metadata, solc_version, - solc_zkvm_edition, - zk_version, + revive_pallet_version, + revive_version: ResolcVersion::default().long, optimizer_settings, } } diff --git a/crates/solidity/src/project/contract/mod.rs b/crates/solidity/src/project/contract/mod.rs index 10b2221..4d62acb 100644 --- a/crates/solidity/src/project/contract/mod.rs +++ b/crates/solidity/src/project/contract/mod.rs @@ -78,7 +78,6 @@ impl Contract { mut self, project: Project, optimizer_settings: revive_llvm_context::OptimizerSettings, - is_system_mode: bool, include_metadata_hash: bool, debug_config: Option, ) -> anyhow::Result { @@ -90,9 +89,8 @@ impl Contract { let metadata = Metadata::new( self.metadata_json.take(), - version.default.clone(), + version.long.clone(), version.l2_revision.clone(), - semver::Version::parse(env!("CARGO_PKG_VERSION")).expect("Always valid"), optimizer.settings().to_owned(), ); let metadata_json = serde_json::to_value(&metadata).expect("Always valid"); @@ -127,8 +125,7 @@ impl Contract { context.set_solidity_data(revive_llvm_context::PolkaVMContextSolidityData::default()); match self.ir { IR::Yul(_) => { - let yul_data = revive_llvm_context::PolkaVMContextYulData::new(is_system_mode); - context.set_yul_data(yul_data); + context.set_yul_data(Default::default()); } IR::EVMLA(_) => { let evmla_data = revive_llvm_context::PolkaVMContextEVMLAData::new(version.default); diff --git a/crates/solidity/src/project/mod.rs b/crates/solidity/src/project/mod.rs index f797914..312b71d 100644 --- a/crates/solidity/src/project/mod.rs +++ b/crates/solidity/src/project/mod.rs @@ -64,9 +64,7 @@ impl Project { pub fn compile( self, optimizer_settings: revive_llvm_context::OptimizerSettings, - is_system_mode: bool, include_metadata_hash: bool, - bytecode_encoding_testing: bool, debug_config: Option, ) -> anyhow::Result { let project = self.clone(); @@ -80,9 +78,7 @@ impl Project { let process_input = ProcessInput::new( contract, project.clone(), - is_system_mode, include_metadata_hash, - bytecode_encoding_testing, optimizer_settings.clone(), debug_config.clone(), ); @@ -255,7 +251,6 @@ impl revive_llvm_context::PolkaVMDependency for Project { project: Self, identifier: &str, optimizer_settings: revive_llvm_context::OptimizerSettings, - is_system_mode: bool, include_metadata_hash: bool, debug_config: Option, ) -> anyhow::Result { @@ -275,7 +270,6 @@ impl revive_llvm_context::PolkaVMDependency for Project { .compile( project, optimizer_settings, - is_system_mode, include_metadata_hash, debug_config, ) diff --git a/crates/solidity/src/resolc/arguments.rs b/crates/solidity/src/resolc/arguments.rs index aba46a1..e0d9847 100644 --- a/crates/solidity/src/resolc/arguments.rs +++ b/crates/solidity/src/resolc/arguments.rs @@ -58,10 +58,6 @@ pub struct Arguments { #[structopt(long = "fallback-Oz")] pub fallback_to_optimizing_for_size: bool, - /// Disable the system request memoization. - #[structopt(long = "disable-system-request-memoization")] - pub disable_system_request_memoization: bool, - /// Disable the `solc` optimizer. /// Use it if your project uses the `MSIZE` instruction, or in other cases. /// Beware that it will prevent libraries from being inlined. @@ -75,7 +71,7 @@ pub struct Arguments { pub solc: Option, /// The EVM target version to generate IR for. - /// See https://github.com/xermicus/revive/blob/main/crates/common/src/evm_version.rs for reference. + /// See https://github.com/paritytech/revive/blob/main/crates/common/src/evm_version.rs for reference. #[structopt(long = "evm-version")] pub evm_version: Option, @@ -119,13 +115,6 @@ pub struct Arguments { #[structopt(long = "force-evmla")] pub force_evmla: bool, - /// Enable system contract compilation mode. - /// In this mode PolkaVM extensions are enabled. For example, calls to addresses `0xFFFF` and below - /// are substituted by special PolkaVM instructions. - /// In the Yul mode, the `verbatim_*` instruction family is available. - #[structopt(long = "system-mode")] - pub is_system_mode: bool, - /// Set metadata hash mode. /// The only supported value is `none` that disables appending the metadata hash. /// Is enabled by default. @@ -185,6 +174,20 @@ impl Arguments { anyhow::bail!("No other options are allowed while getting the compiler version."); } + #[cfg(debug_assertions)] + if self.recursive_process_input.is_some() && !self.recursive_process { + anyhow::bail!("--process-input can be only used when --recursive-process is given"); + } + + #[cfg(debug_assertions)] + if self.recursive_process + && ((self.recursive_process_input.is_none() && std::env::args().count() > 2) + || (self.recursive_process_input.is_some() && std::env::args().count() > 4)) + { + anyhow::bail!("No other options are allowed in recursive mode."); + } + + #[cfg(not(debug_assertions))] if self.recursive_process && std::env::args().count() > 2 { anyhow::bail!("No other options are allowed in recursive mode."); } @@ -243,12 +246,6 @@ impl Arguments { if self.solc.is_some() { anyhow::bail!("`solc` is not used in LLVM IR and PolkaVM assembly modes."); } - - if self.is_system_mode { - anyhow::bail!( - "System contract mode is not supported in LLVM IR and PolkaVM assembly modes." - ); - } } if self.combined_json.is_some() { @@ -295,11 +292,6 @@ impl Arguments { "Falling back to -Oz must specified in standard JSON input settings." ); } - if self.disable_system_request_memoization { - anyhow::bail!( - "Disabling the system request memoization must specified in standard JSON input settings." - ); - } if self.metadata_hash.is_some() { anyhow::bail!("Metadata hash mode must specified in standard JSON input settings."); } diff --git a/crates/solidity/src/resolc/main.rs b/crates/solidity/src/resolc/main.rs index 0320a67..05596c7 100644 --- a/crates/solidity/src/resolc/main.rs +++ b/crates/solidity/src/resolc/main.rs @@ -34,10 +34,9 @@ fn main_inner() -> anyhow::Result<()> { if arguments.version { println!( - "{} v{} (LLVM build {:?})", + "{} version {}", env!("CARGO_PKG_DESCRIPTION"), - env!("CARGO_PKG_VERSION"), - inkwell::support::get_llvm_version() + revive_solidity::ResolcVersion::default().long ); return Ok(()); } @@ -106,9 +105,6 @@ fn main_inner() -> anyhow::Result<()> { if arguments.fallback_to_optimizing_for_size { optimizer_settings.enable_fallback_to_size(); } - if arguments.disable_system_request_memoization { - optimizer_settings.disable_system_request_memoization(); - } optimizer_settings.is_verify_each_enabled = arguments.llvm_verify_each; optimizer_settings.is_debug_logging_enabled = arguments.llvm_debug_logging; @@ -126,7 +122,6 @@ fn main_inner() -> anyhow::Result<()> { input_files.as_slice(), &mut solc, optimizer_settings, - arguments.is_system_mode, include_metadata_hash, debug_config, ) @@ -134,7 +129,6 @@ fn main_inner() -> anyhow::Result<()> { revive_solidity::llvm_ir( input_files.as_slice(), optimizer_settings, - arguments.is_system_mode, include_metadata_hash, debug_config, ) @@ -143,7 +137,6 @@ fn main_inner() -> anyhow::Result<()> { &mut solc, arguments.detect_missing_libraries, arguments.force_evmla, - arguments.is_system_mode, arguments.base_path, arguments.include_paths, arguments.allow_paths, @@ -160,7 +153,6 @@ fn main_inner() -> anyhow::Result<()> { !arguments.disable_solc_optimizer, optimizer_settings, arguments.force_evmla, - arguments.is_system_mode, include_metadata_hash, arguments.base_path, arguments.include_paths, @@ -181,7 +173,6 @@ fn main_inner() -> anyhow::Result<()> { !arguments.disable_solc_optimizer, optimizer_settings, arguments.force_evmla, - arguments.is_system_mode, include_metadata_hash, arguments.base_path, arguments.include_paths, diff --git a/crates/solidity/src/solc/combined_json/mod.rs b/crates/solidity/src/solc/combined_json/mod.rs index 696f6fe..0dd9c15 100644 --- a/crates/solidity/src/solc/combined_json/mod.rs +++ b/crates/solidity/src/solc/combined_json/mod.rs @@ -28,7 +28,7 @@ pub struct CombinedJson { pub version: String, /// The `resolc` compiler version. #[serde(skip_serializing_if = "Option::is_none")] - pub zk_version: Option, + pub revive_version: Option, } impl CombinedJson { diff --git a/crates/solidity/src/solc/mod.rs b/crates/solidity/src/solc/mod.rs index 6985ab8..8c0ec7a 100644 --- a/crates/solidity/src/solc/mod.rs +++ b/crates/solidity/src/solc/mod.rs @@ -37,7 +37,7 @@ impl Compiler { pub const FIRST_VIA_IR_VERSION: semver::Version = semver::Version::new(0, 8, 13); /// The last supported version of `solc`. - pub const LAST_SUPPORTED_VERSION: semver::Version = semver::Version::new(0, 8, 26); + pub const LAST_SUPPORTED_VERSION: semver::Version = semver::Version::new(0, 8, 28); /// A shortcut constructor. /// Different tools may use different `executable` names. For example, the integration tester @@ -129,7 +129,6 @@ impl Compiler { ) })?; output.preprocess_ast(&version, pipeline, suppressed_warnings.as_slice())?; - output.remove_evm(); Ok(output) } diff --git a/crates/solidity/src/solc/pipeline.rs b/crates/solidity/src/solc/pipeline.rs index 37412a5..f74313b 100644 --- a/crates/solidity/src/solc/pipeline.rs +++ b/crates/solidity/src/solc/pipeline.rs @@ -1,10 +1,12 @@ //! The Solidity compiler pipeline type. -use crate::compiler; -use crate::compiler::version::Version as SolcVersion; +use serde::{Deserialize, Serialize}; + +use crate::solc::version::Version as SolcVersion; +use crate::solc::Compiler as SolcCompiler; /// The Solidity compiler pipeline type. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[allow(non_camel_case_types)] #[allow(clippy::upper_case_acronyms)] pub enum Pipeline { diff --git a/crates/solidity/src/solc/standard_json/input/settings/optimizer/mod.rs b/crates/solidity/src/solc/standard_json/input/settings/optimizer/mod.rs index 4e7fb62..62b2391 100644 --- a/crates/solidity/src/solc/standard_json/input/settings/optimizer/mod.rs +++ b/crates/solidity/src/solc/standard_json/input/settings/optimizer/mod.rs @@ -22,9 +22,6 @@ pub struct Optimizer { /// Whether to try to recompile with -Oz if the bytecode is too large. #[serde(skip_serializing)] pub fallback_to_optimizing_for_size: Option, - /// Whether to disable the system request memoization. - #[serde(skip_serializing)] - pub disable_system_request_memoization: Option, } impl Optimizer { @@ -34,14 +31,12 @@ impl Optimizer { mode: Option, version: &semver::Version, fallback_to_optimizing_for_size: bool, - disable_system_request_memoization: bool, ) -> Self { Self { enabled, mode, details: Some(Details::disabled(version)), fallback_to_optimizing_for_size: Some(fallback_to_optimizing_for_size), - disable_system_request_memoization: Some(disable_system_request_memoization), } } @@ -66,9 +61,6 @@ impl TryFrom<&Optimizer> for revive_llvm_context::OptimizerSettings { if value.fallback_to_optimizing_for_size.unwrap_or_default() { result.enable_fallback_to_size(); } - if value.disable_system_request_memoization.unwrap_or_default() { - result.disable_system_request_memoization(); - } Ok(result) } } diff --git a/crates/solidity/src/solc/standard_json/input/settings/selection/file/flag.rs b/crates/solidity/src/solc/standard_json/input/settings/selection/file/flag.rs index 34ef39b..78ad15b 100644 --- a/crates/solidity/src/solc/standard_json/input/settings/selection/file/flag.rs +++ b/crates/solidity/src/solc/standard_json/input/settings/selection/file/flag.rs @@ -37,8 +37,13 @@ pub enum Flag { /// The EVM legacy assembly JSON. #[serde(rename = "evm.legacyAssembly")] EVMLA, + #[serde(rename = "evm.bytecode")] + EVMBC, #[serde(rename = "evm.deployedBytecode")] EVMDBC, + /// The assembly code + #[serde(rename = "evm.assembly")] + Assembly, } impl From for Flag { @@ -62,7 +67,9 @@ impl std::fmt::Display for Flag { Self::AST => write!(f, "ast"), Self::Yul => write!(f, "irOptimized"), Self::EVMLA => write!(f, "evm.legacyAssembly"), + Self::EVMBC => write!(f, "evm.bytecode"), Self::EVMDBC => write!(f, "evm.deployedBytecode"), + Self::Assembly => write!(f, "evm.assembly"), } } } diff --git a/crates/solidity/src/solc/standard_json/input/settings/selection/file/mod.rs b/crates/solidity/src/solc/standard_json/input/settings/selection/file/mod.rs index f699377..1468547 100644 --- a/crates/solidity/src/solc/standard_json/input/settings/selection/file/mod.rs +++ b/crates/solidity/src/solc/standard_json/input/settings/selection/file/mod.rs @@ -28,6 +28,7 @@ impl File { Self { per_file: Some(HashSet::from_iter([SelectionFlag::AST])), per_contract: Some(HashSet::from_iter([ + SelectionFlag::EVMBC, SelectionFlag::EVMDBC, SelectionFlag::MethodIdentifiers, SelectionFlag::Metadata, diff --git a/crates/solidity/src/solc/standard_json/output/contract/evm/mod.rs b/crates/solidity/src/solc/standard_json/output/contract/evm/mod.rs index 3ed4b7f..c5613cf 100644 --- a/crates/solidity/src/solc/standard_json/output/contract/evm/mod.rs +++ b/crates/solidity/src/solc/standard_json/output/contract/evm/mod.rs @@ -20,15 +20,19 @@ use self::extra_metadata::ExtraMetadata; #[serde(rename_all = "camelCase")] pub struct EVM { /// The contract EVM legacy assembly code. - #[serde(rename = "legacyAssembly")] + #[serde(rename = "legacyAssembly", skip_serializing_if = "Option::is_none")] pub assembly: Option, /// The contract PolkaVM assembly code. - #[serde(rename = "assembly")] + #[serde(rename = "assembly", skip_serializing_if = "Option::is_none")] pub assembly_text: Option, /// The contract bytecode. /// Is reset by that of PolkaVM before yielding the compiled project artifacts. + #[serde(skip_serializing_if = "Option::is_none")] pub bytecode: Option, - /// The contract deployed bytecode. + /// The deployed bytecode of the contract. + /// It is overwritten with the PolkaVM blob before yielding the compiled project artifacts. + /// Hence it will be the same as the runtime code but we keep both for compatibility reasons. + #[serde(skip_serializing_if = "Option::is_none")] pub deployed_bytecode: Option, /// The contract function signatures. #[serde(default, skip_serializing_if = "Option::is_none")] @@ -42,6 +46,7 @@ impl EVM { /// Sets the PolkaVM assembly and bytecode. pub fn modify(&mut self, assembly_text: String, bytecode: String) { self.assembly_text = Some(assembly_text); - self.bytecode = Some(Bytecode::new(bytecode)); + self.bytecode = Some(Bytecode::new(bytecode.clone())); + self.deployed_bytecode = Some(DeployedBytecode::new(bytecode)); } } diff --git a/crates/solidity/src/solc/standard_json/output/mod.rs b/crates/solidity/src/solc/standard_json/output/mod.rs index 3a0e527..86cce6b 100644 --- a/crates/solidity/src/solc/standard_json/output/mod.rs +++ b/crates/solidity/src/solc/standard_json/output/mod.rs @@ -45,7 +45,7 @@ pub struct Output { pub long_version: Option, /// The `resolc` compiler version. #[serde(skip_serializing_if = "Option::is_none")] - pub zk_version: Option, + pub revive_version: Option, } impl Output { @@ -138,19 +138,6 @@ impl Output { )) } - /// Removes EVM artifacts to prevent their accidental usage. - pub fn remove_evm(&mut self) { - if let Some(files) = self.contracts.as_mut() { - for (_, file) in files.iter_mut() { - for (_, contract) in file.iter_mut() { - if let Some(evm) = contract.evm.as_mut() { - evm.bytecode = None; - } - } - } - } - } - /// Traverses the AST and returns the list of additional errors and warnings. pub fn preprocess_ast( &mut self, diff --git a/crates/solidity/src/test_utils.rs b/crates/solidity/src/test_utils.rs index 003c4ae..e05f301 100644 --- a/crates/solidity/src/test_utils.rs +++ b/crates/solidity/src/test_utils.rs @@ -3,6 +3,9 @@ use std::collections::BTreeMap; use std::collections::BTreeSet; use std::path::PathBuf; use std::str::FromStr; +use std::sync::Mutex; + +use once_cell::sync::Lazy; use crate::compiler::pipeline::Pipeline as SolcPipeline; use crate::compiler::solc::SolcCompiler; @@ -14,6 +17,27 @@ use crate::compiler::standard_json::output::Output as SolcStandardJsonOutput; use crate::compiler::Compiler; use crate::project::Project; use crate::warning::Warning; +use crate::solc::pipeline::Pipeline as SolcPipeline; +use crate::solc::standard_json::input::settings::optimizer::Optimizer as SolcStandardJsonInputSettingsOptimizer; +use crate::solc::standard_json::input::settings::selection::Selection as SolcStandardJsonInputSettingsSelection; +use crate::solc::standard_json::input::Input as SolcStandardJsonInput; +use crate::solc::standard_json::output::contract::evm::bytecode::Bytecode; +use crate::solc::standard_json::output::contract::evm::bytecode::DeployedBytecode; +use crate::solc::standard_json::output::Output as SolcStandardJsonOutput; +use crate::solc::Compiler as SolcCompiler; +use crate::warning::Warning; + +static PVM_BLOB_CACHE: Lazy>>> = Lazy::new(Default::default); +static EVM_BLOB_CACHE: Lazy>>> = Lazy::new(Default::default); +static EVM_RUNTIME_BLOB_CACHE: Lazy>>> = + Lazy::new(Default::default); + +#[derive(Hash, PartialEq, Eq)] +struct CachedBlob { + contract_name: String, + solc_optimizer_enabled: bool, + pipeline: SolcPipeline, +} /// Checks if the required executables are present in `${PATH}`. fn check_dependencies() { @@ -80,7 +104,6 @@ pub fn build_solidity_with_options( None, &solc_version.default, false, - false, ), None, pipeline == SolcPipeline::Yul, @@ -91,24 +114,20 @@ pub fn build_solidity_with_options( let project = output.try_to_project(sources, libraries, pipeline, &solc_version, None)?; - let build: crate::Build = project.compile(optimizer_settings, false, false, false, None)?; - build.write_to_standard_json( - &mut output, - &solc_version, - &semver::Version::from_str(env!("CARGO_PKG_VERSION"))?, - )?; + let build: crate::Build = project.compile(optimizer_settings, false, None)?; + build.write_to_standard_json(&mut output, &solc_version)?; Ok(output) } -/// Build a Solidity contract and get the EVM bin-runtime. +/// Build a Solidity contract and get the EVM code pub fn build_solidity_with_options_evm( sources: BTreeMap, libraries: BTreeMap>, remappings: Option>, pipeline: SolcPipeline, solc_optimizer_enabled: bool, -) -> anyhow::Result> { +) -> anyhow::Result> { check_dependencies(); inkwell::support::enable_llvm_pretty_stack_trace(); @@ -130,7 +149,6 @@ pub fn build_solidity_with_options_evm( None, &solc_version.default, false, - false, ), None, pipeline == SolcPipeline::Yul, @@ -144,9 +162,12 @@ pub fn build_solidity_with_options_evm( for (_, file) in files.iter_mut() { for (name, contract) in file.iter_mut() { if let Some(evm) = contract.evm.as_mut() { - if let Some(deployed_bytecode) = evm.deployed_bytecode.as_ref() { - contracts.insert(name.clone(), deployed_bytecode.clone()); - } + let (Some(bytecode), Some(deployed_bytecode)) = + (evm.bytecode.as_ref(), evm.deployed_bytecode.as_ref()) + else { + continue; + }; + contracts.insert(name.clone(), (bytecode.clone(), deployed_bytecode.clone())); } } } @@ -177,13 +198,7 @@ pub fn build_solidity_and_detect_missing_libraries( libraries.clone(), None, SolcStandardJsonInputSettingsSelection::new_required(pipeline), - SolcStandardJsonInputSettingsOptimizer::new( - true, - None, - &solc_version.default, - false, - false, - ), + SolcStandardJsonInputSettingsOptimizer::new(true, None, &solc_version.default, false), None, pipeline == SolcPipeline::Yul, None, @@ -194,11 +209,7 @@ pub fn build_solidity_and_detect_missing_libraries( let project = output.try_to_project(sources, libraries, pipeline, &solc_version, None)?; let missing_libraries = project.get_missing_libraries(); - missing_libraries.write_to_standard_json( - &mut output, - &solc.version()?, - &semver::Version::from_str(env!("CARGO_PKG_VERSION"))?, - )?; + missing_libraries.write_to_standard_json(&mut output, &solc.version()?)?; Ok(output) } @@ -211,12 +222,9 @@ pub fn build_yul(source_code: &str) -> anyhow::Result<()> { revive_llvm_context::initialize_target(revive_llvm_context::Target::PVM); let optimizer_settings = revive_llvm_context::OptimizerSettings::none(); - let project = Project::try_from_yul_string::( - PathBuf::from("test.yul").as_path(), - source_code, - None, - )?; - let _build = project.compile(optimizer_settings, false, false, false, None)?; + let project = + Project::try_from_yul_string::(PathBuf::from("test.yul").as_path(), source_code, None)?; + let _build = project.compile(optimizer_settings, false, None)?; Ok(()) } @@ -227,14 +235,14 @@ pub fn check_solidity_warning( warning_substring: &str, libraries: BTreeMap>, pipeline: SolcPipeline, - skip_for_zkvm_edition: bool, + skip_for_revive_edition: bool, suppressed_warnings: Option>, ) -> anyhow::Result { check_dependencies(); let mut solc = SolcCompiler::new(SolcCompiler::DEFAULT_EXECUTABLE_NAME.to_owned())?; let solc_version = solc.version()?; - if skip_for_zkvm_edition && solc_version.l2_revision.is_some() { + if skip_for_revive_edition && solc_version.l2_revision.is_some() { return Ok(true); } @@ -246,13 +254,7 @@ pub fn check_solidity_warning( libraries, None, SolcStandardJsonInputSettingsSelection::new_required(pipeline), - SolcStandardJsonInputSettingsOptimizer::new( - true, - None, - &solc_version.default, - false, - false, - ), + SolcStandardJsonInputSettingsOptimizer::new(true, None, &solc_version.default, false), None, pipeline == SolcPipeline::Yul, suppressed_warnings, @@ -267,3 +269,117 @@ pub fn check_solidity_warning( Ok(contains_warning) } + +/// Compile the blob of `contract_name` found in given `source_code`. +/// The `solc` optimizer will be enabled +pub fn compile_blob(contract_name: &str, source_code: &str) -> Vec { + compile_blob_with_options(contract_name, source_code, true, SolcPipeline::Yul) +} + +/// Compile the EVM bin-runtime of `contract_name` found in given `source_code`. +/// The `solc` optimizer will be enabled +pub fn compile_evm_bin_runtime(contract_name: &str, source_code: &str) -> Vec { + compile_evm(contract_name, source_code, true, true) +} + +/// Compile the EVM bin of `contract_name` found in given `source_code`. +/// The `solc` optimizer will be enabled +pub fn compile_evm_deploy_code( + contract_name: &str, + source_code: &str, + solc_optimizer_enabled: bool, +) -> Vec { + compile_evm(contract_name, source_code, solc_optimizer_enabled, false) +} + +fn compile_evm( + contract_name: &str, + source_code: &str, + solc_optimizer_enabled: bool, + runtime: bool, +) -> Vec { + let pipeline = SolcPipeline::Yul; + let id = CachedBlob { + contract_name: contract_name.to_owned(), + pipeline, + solc_optimizer_enabled, + }; + + let cache = if runtime { + &EVM_RUNTIME_BLOB_CACHE + } else { + &EVM_BLOB_CACHE + }; + if let Some(blob) = cache.lock().unwrap().get(&id) { + return blob.clone(); + } + + let file_name = "contract.sol"; + let contracts = build_solidity_with_options_evm( + [(file_name.into(), source_code.into())].into(), + Default::default(), + None, + pipeline, + solc_optimizer_enabled, + ) + .expect("source should compile"); + let object = &contracts + .get(contract_name) + .unwrap_or_else(|| panic!("contract '{}' didn't produce bin-runtime", contract_name)); + let code = if runtime { + object.1.object.as_str() + } else { + object.0.object.as_str() + }; + let blob = hex::decode(code).expect("code shold be hex encoded"); + + cache.lock().unwrap().insert(id, blob.clone()); + + blob +} + +/// Compile the blob of `contract_name` found in given `source_code`. +pub fn compile_blob_with_options( + contract_name: &str, + source_code: &str, + solc_optimizer_enabled: bool, + pipeline: SolcPipeline, +) -> Vec { + let id = CachedBlob { + contract_name: contract_name.to_owned(), + solc_optimizer_enabled, + pipeline, + }; + + if let Some(blob) = PVM_BLOB_CACHE.lock().unwrap().get(&id) { + return blob.clone(); + } + + let file_name = "contract.sol"; + let contracts = build_solidity_with_options( + [(file_name.into(), source_code.into())].into(), + Default::default(), + None, + pipeline, + revive_llvm_context::OptimizerSettings::cycles(), + solc_optimizer_enabled, + ) + .expect("source should compile") + .contracts + .expect("source should contain at least one contract"); + + let bytecode = contracts[file_name][contract_name] + .evm + .as_ref() + .expect("source should produce EVM output") + .bytecode + .as_ref() + .expect("source should produce assembly text") + .object + .as_str(); + let blob = hex::decode(bytecode).expect("hex encoding should always be valid"); + + PVM_BLOB_CACHE.lock().unwrap().insert(id, blob.clone()); + + blob +} diff --git a/crates/solidity/src/tests/cli-tests/package.json b/crates/solidity/src/tests/cli-tests/package.json index a7df125..43a3d1e 100644 --- a/crates/solidity/src/tests/cli-tests/package.json +++ b/crates/solidity/src/tests/cli-tests/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "title": "resolc CLI Tests", "description": "Auto tests for verifying resolc CLI", - "repository": "https://github.com/xermicus/revive", + "repository": "https://github.com/paritytech/revive", "main": "index.js", "private": true, "scripts": { diff --git a/crates/solidity/src/version.rs b/crates/solidity/src/version.rs new file mode 100644 index 0000000..8b3b3e3 --- /dev/null +++ b/crates/solidity/src/version.rs @@ -0,0 +1,30 @@ +//! The resolc compiler version. + +use serde::Deserialize; +use serde::Serialize; + +/// The resolc compiler version. +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct Version { + /// The long version string. + pub long: String, + /// The short `semver`. + pub default: semver::Version, + /// The LLVM version string. + pub llvm: semver::Version, +} + +impl Default for Version { + fn default() -> Self { + let default = semver::Version::parse(env!("CARGO_PKG_VERSION")).expect("Always valid"); + let commit = env!("GIT_COMMIT_HASH"); + let (llvm_major, llvm_minor, llvm_patch) = inkwell::support::get_llvm_version(); + let llvm = semver::Version::new(llvm_major as u64, llvm_minor as u64, llvm_patch as u64); + + Self { + long: format!("{default}+commit.{commit}.llvm-{llvm}"), + default, + llvm, + } + } +} diff --git a/crates/solidity/src/yul/parser/statement/expression/function_call/mod.rs b/crates/solidity/src/yul/parser/statement/expression/function_call/mod.rs index 3e87bc8..dcc4423 100644 --- a/crates/solidity/src/yul/parser/statement/expression/function_call/mod.rs +++ b/crates/solidity/src/yul/parser/statement/expression/function_call/mod.rs @@ -125,13 +125,6 @@ impl FunctionCall { let location = self.location; match self.name { - Name::UserDefined(name) - if name.starts_with( - revive_llvm_context::PolkaVMFunction::ZKSYNC_NEAR_CALL_ABI_PREFIX, - ) && context.is_system_mode() => - { - unimplemented!(); - } Name::UserDefined(name) => { let mut values = Vec::with_capacity(self.arguments.len()); for argument in self.arguments.into_iter().rev() { @@ -501,25 +494,30 @@ impl FunctionCall { ) .map(|_| None) } - Name::LoadImmutable => todo!(), + Name::LoadImmutable => { + let mut arguments = self.pop_arguments::(context)?; + let key = arguments[0].original.take().ok_or_else(|| { + anyhow::anyhow!("{} `load_immutable` literal is missing", location) + })?; + let offset = context + .solidity_mut() + .get_or_allocate_immutable(key.as_str()) + / revive_common::BYTE_LENGTH_WORD; + let index = context.xlen_type().const_int(offset as u64, false); + revive_llvm_context::polkavm_evm_immutable::load(context, index).map(Some) + } Name::SetImmutable => { let mut arguments = self.pop_arguments::(context)?; let key = arguments[1].original.take().ok_or_else(|| { anyhow::anyhow!("{} `load_immutable` literal is missing", location) })?; - - if key.as_str() == "library_deploy_address" { - return Ok(None); - } - - let offset = context.solidity_mut().allocate_immutable(key.as_str()); - - let index = context.word_const(offset as u64); + let offset = context.solidity_mut().allocate_immutable(key.as_str()) + / revive_common::BYTE_LENGTH_WORD; + let index = context.xlen_type().const_int(offset as u64, false); let value = arguments[2].value.into_int_value(); revive_llvm_context::polkavm_evm_immutable::store(context, index, value) .map(|_| None) } - Name::CallDataLoad => { let arguments = self.pop_arguments_llvm::(context)?; @@ -831,6 +829,7 @@ impl FunctionCall { value, input_offset, input_length, + None, ) .map(Some) } @@ -842,7 +841,7 @@ impl FunctionCall { let input_length = arguments[2].into_int_value(); let salt = arguments[3].into_int_value(); - revive_llvm_context::polkavm_evm_create::create2( + revive_llvm_context::polkavm_evm_create::create( context, value, input_offset, @@ -912,7 +911,9 @@ impl FunctionCall { let address = arguments[0].into_int_value(); revive_llvm_context::polkavm_evm_ether_gas::balance(context, address).map(Some) } - Name::SelfBalance => todo!(), + Name::SelfBalance => { + revive_llvm_context::polkavm_evm_ether_gas::self_balance(context).map(Some) + } Name::GasLimit => { revive_llvm_context::polkavm_evm_contract_context::gas_limit(context).map(Some) @@ -962,9 +963,7 @@ impl FunctionCall { location ); } - Name::MSize => { - revive_llvm_context::polkavm_evm_contract_context::msize(context).map(Some) - } + Name::MSize => revive_llvm_context::polkavm_evm_memory::msize(context).map(Some), Name::Verbatim { input_size, diff --git a/crates/solidity/src/yul/parser/statement/function_definition.rs b/crates/solidity/src/yul/parser/statement/function_definition.rs index ee167b5..7ff9775 100644 --- a/crates/solidity/src/yul/parser/statement/function_definition.rs +++ b/crates/solidity/src/yul/parser/statement/function_definition.rs @@ -92,37 +92,7 @@ impl FunctionDefinition { } } - let (mut arguments, next) = Identifier::parse_typed_list(lexer, None)?; - if identifier - .inner - .contains(revive_llvm_context::PolkaVMFunction::ZKSYNC_NEAR_CALL_ABI_PREFIX) - { - if arguments.is_empty() { - return Err(ParserError::InvalidNumberOfArguments { - location, - identifier: identifier.inner, - expected: 1, - found: arguments.len(), - } - .into()); - } - - arguments.remove(0); - } - if identifier - .inner - .contains(revive_llvm_context::PolkaVMFunction::ZKSYNC_NEAR_CALL_ABI_EXCEPTION_HANDLER) - && !arguments.is_empty() - { - return Err(ParserError::InvalidNumberOfArguments { - location, - identifier: identifier.inner, - expected: 0, - found: arguments.len(), - } - .into()); - } - + let (arguments, next) = Identifier::parse_typed_list(lexer, None)?; match crate::yul::parser::take_or_next(next, lexer)? { Token { lexeme: Lexeme::Symbol(Symbol::ParenthesisRight), @@ -234,12 +204,7 @@ where }) .collect(); - let function_type = context.function_type( - argument_types, - self.result.len(), - self.identifier - .starts_with(revive_llvm_context::PolkaVMFunction::ZKSYNC_NEAR_CALL_ABI_PREFIX), - ); + let function_type = context.function_type(argument_types, self.result.len()); let function = context.add_function( self.identifier.as_str(), @@ -310,23 +275,12 @@ where yul_type.into_llvm(context) }) .collect(); - for (mut index, argument) in self.arguments.iter().enumerate() { + for (index, argument) in self.arguments.iter().enumerate() { let pointer = context.build_alloca(argument_types[index], argument.inner.as_str()); context .current_function() .borrow_mut() .insert_stack_pointer(argument.inner.clone(), pointer); - if self - .identifier - .starts_with(revive_llvm_context::PolkaVMFunction::ZKSYNC_NEAR_CALL_ABI_PREFIX) - && matches!( - context.current_function().borrow().r#return(), - revive_llvm_context::PolkaVMFunctionReturn::Compound { .. } - ) - && context.is_system_mode() - { - index += 1; - } context.build_store( pointer, context.current_function().borrow().get_nth_param(index), @@ -354,13 +308,6 @@ where let return_value = context.build_load(pointer, "return_value")?; context.build_return(Some(&return_value)); } - revive_llvm_context::PolkaVMFunctionReturn::Compound { pointer, .. } - if context.current_function().borrow().name().starts_with( - revive_llvm_context::PolkaVMFunction::ZKSYNC_NEAR_CALL_ABI_PREFIX, - ) => - { - context.build_return(Some(&pointer.value)); - } revive_llvm_context::PolkaVMFunctionReturn::Compound { pointer, .. } => { let return_value = context.build_load(pointer, "return_value")?; context.build_return(Some(&return_value)); @@ -524,80 +471,6 @@ object "Test" { ); } - #[test] - fn error_invalid_number_of_arguments_near_call_abi() { - let input = r#" -object "Test" { - code { - { - return(0, 0) - } - } - object "Test_deployed" { - code { - { - return(0, 0) - } - - function ZKSYNC_NEAR_CALL_test() -> result { - result := 42 - } - } - } -} - "#; - - let mut lexer = Lexer::new(input.to_owned()); - let result = Object::parse(&mut lexer, None); - assert_eq!( - result, - Err(Error::InvalidNumberOfArguments { - location: Location::new(14, 22), - identifier: "ZKSYNC_NEAR_CALL_test".to_owned(), - expected: 1, - found: 0, - } - .into()) - ); - } - - #[test] - fn error_invalid_number_of_arguments_near_call_abi_catch() { - let input = r#" -object "Test" { - code { - { - return(0, 0) - } - } - object "Test_deployed" { - code { - { - return(0, 0) - } - - function ZKSYNC_CATCH_NEAR_CALL(length) { - revert(0, length) - } - } - } -} - "#; - - let mut lexer = Lexer::new(input.to_owned()); - let result = Object::parse(&mut lexer, None); - assert_eq!( - result, - Err(Error::InvalidNumberOfArguments { - location: Location::new(14, 22), - identifier: "ZKSYNC_CATCH_NEAR_CALL".to_owned(), - expected: 0, - found: 1, - } - .into()) - ); - } - #[test] fn error_reserved_identifier() { let input = r#" diff --git a/crates/solidity/src/yul/parser/statement/object.rs b/crates/solidity/src/yul/parser/statement/object.rs index 42f9025..5c08d38 100644 --- a/crates/solidity/src/yul/parser/statement/object.rs +++ b/crates/solidity/src/yul/parser/statement/object.rs @@ -183,6 +183,7 @@ where &mut self, context: &mut revive_llvm_context::PolkaVMContext, ) -> anyhow::Result<()> { + revive_llvm_context::PolkaVMImmutableDataLoadFunction.declare(context)?; let mut entry = revive_llvm_context::PolkaVMEntryFunction::default(); entry.declare(context)?; @@ -199,6 +200,7 @@ where revive_llvm_context::PolkaVMFunctionDeployCode, revive_llvm_context::PolkaVMFunctionRuntimeCode, revive_llvm_context::PolkaVMFunctionEntry, + revive_llvm_context::PolkaVMFunctionImmutableDataLoad, ] .into_iter() { @@ -216,6 +218,7 @@ where fn into_llvm(self, context: &mut revive_llvm_context::PolkaVMContext) -> anyhow::Result<()> { if self.identifier.ends_with("_deployed") { + revive_llvm_context::PolkaVMImmutableDataLoadFunction.into_llvm(context)?; revive_llvm_context::PolkaVMRuntimeCodeFunction::new(self.code).into_llvm(context)?; } else { revive_llvm_context::PolkaVMDeployCodeFunction::new(self.code).into_llvm(context)?; diff --git a/utils/build-debian-builder.sh b/utils/build-debian-builder.sh new file mode 100755 index 0000000..87c81e0 --- /dev/null +++ b/utils/build-debian-builder.sh @@ -0,0 +1,7 @@ +#! /usr/bin/env bash + +CONTAINER=revive-builder-debian-x86 +VERSION=latest +DOCKERFILE=revive-builder-debian.dockerfile + +docker build --rm -t ${CONTAINER}:${VERSION} -f ${DOCKERFILE} $@ diff --git a/utils/build-revive.sh b/utils/build-revive.sh new file mode 100755 index 0000000..a1b1dde --- /dev/null +++ b/utils/build-revive.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env bash + +set -euo pipefail + +REVIVE_INSTALL_DIR=$(pwd)/target/release +while getopts "o:" option ; do + case $option in + o) # Output directory + REVIVE_INSTALL_DIR=$OPTARG + ;; + \?) echo "Error: Invalid option" + exit 1;; + esac +done +echo "Installing to ${REVIVE_INSTALL_DIR}" + +$(pwd)/build-llvm.sh +export PATH=$(pwd)/llvm18.0/bin:$PATH + +make install-revive REVIVE_INSTALL_DIR=${REVIVE_INSTALL_DIR} diff --git a/utils/revive-builder-debian.dockerfile b/utils/revive-builder-debian.dockerfile new file mode 100644 index 0000000..2631aed --- /dev/null +++ b/utils/revive-builder-debian.dockerfile @@ -0,0 +1,14 @@ +# syntax=docker/dockerfile:1 +# Dockerfile for building revive in a Debian container. +FROM debian:12 +RUN <