diff --git a/.cargo/config.toml b/.cargo/config.toml index 319e6db..8dec717 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -12,7 +12,6 @@ rustflags = [ "-Clink-arg=-sALLOW_TABLE_GROWTH=1", "-Clink-arg=--js-library=js/embed/soljson_interface.js", "-Clink-arg=--pre-js=js/embed/pre.js", - "-Clink-arg=-sNODEJS_CATCH_EXIT=0", - "-Clink-arg=-sDISABLE_EXCEPTION_CATCHING=0", - "-Copt-level=3" + "-Clink-arg=-sSTACK_SIZE=128kb", + "-Clink-arg=-sNODEJS_CATCH_EXIT=0" ] diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5a7191f..40a0fdf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -30,11 +30,12 @@ jobs: tar Jxf llvm.tar.xz -C llvm18/ echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm18" >> $GITHUB_ENV - - name: Install apt dependencies + - name: Install geth run: | - sudo add-apt-repository -y ppa:ethereum/ethereum - sudo apt update - sudo apt install -y ethereum + git clone https://github.com/xermicus/go-ethereum --branch=cl/fix-runner-state-dump --depth=1 + cd go-ethereum + make all + echo "$(pwd)/build/bin/" >> $GITHUB_PATH - name: Machete uses: bnjbvr/cargo-machete@main diff --git a/CHANGELOG.md b/CHANGELOG.md index d3d2874..aeac301 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,41 @@ ## Unreleased +This is a development pre-release. + +Supported `polkadot-sdk` rev: `274a781e8ca1a9432c7ec87593bd93214abbff50` + +### Added +- Support for the `coinbase` opcode. + +### Changed +- Missing the `--overwrite` flag emits an error instead of a warning. +- The `resolc` executable prints the help by default. +- Removed support for legacy EVM assembly (EVMLA) translation. +- integration: identify cached code blobs on source code to fix potential confusions. +- Setting base, include or allow paths in emscripten is now a hard error. +- Employ a heuristic to detect `address.transfer` and `address.send` calls. + If detected, the re-entrant call flag is not set and 0 deposit limit is endowed. + +### Fixed +- Solidity: Add the solc `--libraries` files to sources. +- A data race in tests. +- Fix `broken pipe` errors. +- llvm-builder: Allow warnings. +- solidity: Fix the custom compiler warning messages. + +## v0.1.0-dev.9 + +This is a development pre-release. + +### Added + +### Changed +- Syscalls with more than 6 arguments now pack them into registers. + +### Fixed +- Remove reloading of the resolc.js file (fix issue with relative path in web worker) + ## v0.1.0-dev.8 This is a development pre-release. diff --git a/Cargo.lock b/Cargo.lock index ae21b01..eee21f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,6 +129,18 @@ dependencies = [ "winnow", ] +[[package]] +name = "alloy-eip2124" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "675264c957689f0fd75f5993a73123c2cc3b5c235a38f5b9037fe6c826bfb2c0" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "crc", + "thiserror 2.0.11", +] + [[package]] name = "alloy-eip2930" version = "0.1.0" @@ -154,25 +166,28 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.9.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52dd5869ed09e399003e0e0ec6903d981b2a92e74c5d37e6b40890bad2517526" +checksum = "7149e011edbd588f6df6564b369c75f6b538d76db14053d95e0b43b2d92e4266" dependencies = [ + "alloy-eip2124", "alloy-eip2930", "alloy-eip7702", "alloy-primitives", "alloy-rlp", "alloy-serde", + "auto_impl", "c-kzg", "derive_more 1.0.0", + "once_cell", "serde", ] [[package]] name = "alloy-genesis" -version = "0.9.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d2a7fe5c1a9bd6793829ea21a636f30fc2b3f5d2e7418ba86d96e41dd1f460" +checksum = "acaec0cc4c1489d61d6f33d0c3dd522c750025f4b5c8f59cd546221e4df660e5" dependencies = [ "alloy-eips", "alloy-primitives", @@ -244,9 +259,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.9.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae0465c71d4dced7525f408d84873aeebb71faf807d22d74c4a426430ccd9b55" +checksum = "86aa42c36e3c0db5bd9a7314e98aa261a61d5e3d6a0bd7e51fb8b0a3d6438481" dependencies = [ "alloy-primitives", "serde", @@ -942,7 +957,7 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "asset-test-utils" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", @@ -973,7 +988,7 @@ dependencies = [ [[package]] name = "assets-common" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1096,7 +1111,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "binary-merkle-tree" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "hash-db", "log", @@ -1276,7 +1291,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-runtime", "finality-grandpa", @@ -1287,13 +1302,13 @@ dependencies = [ "sp-consensus-grandpa", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "bp-messages" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-header-chain", "bp-runtime", @@ -1303,13 +1318,13 @@ dependencies = [ "serde", "sp-core", "sp-io", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "bp-parachains" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-header-chain", "bp-polkadot-core", @@ -1320,26 +1335,26 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "bp-polkadot" version = "0.5.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" 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=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "bp-polkadot-core" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-messages", "bp-runtime", @@ -1350,13 +1365,13 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "bp-relayers" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-header-chain", "bp-messages", @@ -1368,13 +1383,13 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "bp-runtime" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -1389,7 +1404,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-state-machine", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-trie", "trie-db", ] @@ -1397,7 +1412,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-header-chain", "bp-parachains", @@ -1410,14 +1425,14 @@ dependencies = [ "sp-consensus-grandpa", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-trie", ] [[package]] name = "bp-xcm-bridge-hub" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-messages", "bp-runtime", @@ -1427,14 +1442,14 @@ dependencies = [ "serde", "sp-core", "sp-io", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", ] [[package]] name = "bp-xcm-bridge-hub-router" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "scale-info", @@ -1446,7 +1461,7 @@ dependencies = [ [[package]] name = "bridge-hub-common" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1456,14 +1471,16 @@ dependencies = [ "snowbridge-core", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", ] [[package]] name = "bridge-hub-test-utils" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "asset-test-utils", "bp-header-chain", @@ -1473,8 +1490,6 @@ dependencies = [ "bp-relayers", "bp-runtime", "bp-test-utils", - "bp-xcm-bridge-hub", - "bridge-runtime-common", "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "frame-support", @@ -1497,7 +1512,8 @@ dependencies = [ "sp-io", "sp-keyring", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -1506,7 +1522,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-header-chain", "bp-messages", @@ -1514,7 +1530,6 @@ dependencies = [ "bp-polkadot-core", "bp-relayers", "bp-runtime", - "bp-xcm-bridge-hub", "frame-support", "frame-system", "log", @@ -1528,7 +1543,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-trie", "sp-weights", "staging-xcm", @@ -1609,6 +1624,7 @@ dependencies = [ "glob", "hex", "libc", + "once_cell", "serde", ] @@ -1994,6 +2010,21 @@ dependencies = [ "wasmtime-types", ] +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + [[package]] name = "crc32fast" version = "1.4.2" @@ -2130,7 +2161,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -2147,7 +2178,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -2164,7 +2195,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -2183,12 +2214,12 @@ dependencies = [ "polkadot-runtime-parachains", "scale-info", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-inherents", "sp-io", "sp-runtime", "sp-state-machine", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-trie", "sp-version", "staging-xcm", @@ -2199,7 +2230,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2210,7 +2241,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -2223,7 +2254,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-solo-to-para" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -2238,10 +2269,10 @@ dependencies = [ [[package]] name = "cumulus-pallet-weight-reclaim" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-storage-weight-reclaim", - "derivative", + "derive-where", "docify", "frame-benchmarking", "frame-support", @@ -2257,7 +2288,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -2272,7 +2303,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bounded-collections", "bp-xcm-bridge-hub-router", @@ -2297,7 +2328,7 @@ dependencies = [ [[package]] name = "cumulus-ping" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-pallet-xcm", "cumulus-primitives-core", @@ -2312,7 +2343,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-aura" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "sp-api", "sp-consensus-aura", @@ -2321,7 +2352,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -2337,7 +2368,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2351,17 +2382,17 @@ dependencies = [ [[package]] name = "cumulus-primitives-proof-size-hostfunction" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-trie", ] [[package]] name = "cumulus-primitives-storage-weight-reclaim" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-proof-size-hostfunction", @@ -2378,7 +2409,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-core", "sp-inherents", @@ -2388,7 +2419,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -2405,7 +2436,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -3246,7 +3277,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-support-procedural", @@ -3262,15 +3293,15 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "static_assertions", ] [[package]] name = "frame-benchmarking-pallet-pov" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -3298,7 +3329,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3309,7 +3340,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3325,7 +3356,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "aquamarine", "frame-support", @@ -3337,7 +3368,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] @@ -3366,7 +3397,7 @@ dependencies = [ [[package]] name = "frame-metadata-hash-extension" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "array-bytes", "const-hex", @@ -3382,7 +3413,7 @@ dependencies = [ [[package]] name = "frame-support" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "aquamarine", "array-bytes", @@ -3406,7 +3437,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-crypto-hashing-proc-macro", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-genesis-builder", "sp-inherents", "sp-io", @@ -3414,8 +3445,8 @@ dependencies = [ "sp-runtime", "sp-staking", "sp-state-machine", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-trie", "sp-weights", "static_assertions", @@ -3425,7 +3456,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "Inflector", "cfg-expr", @@ -3438,14 +3469,14 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "syn 2.0.96", ] [[package]] name = "frame-support-procedural-tools" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -3457,7 +3488,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "proc-macro2", "quote", @@ -3467,7 +3498,7 @@ dependencies = [ [[package]] name = "frame-system" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cfg-if", "docify", @@ -3486,7 +3517,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -3500,7 +3531,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "parity-scale-codec", @@ -3510,7 +3541,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "parity-scale-codec", @@ -4619,7 +4650,7 @@ checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "lld-sys" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "cc", "libc", @@ -4732,12 +4763,6 @@ dependencies = [ "rawpointer", ] -[[package]] -name = "md5" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" - [[package]] name = "memchr" version = "2.7.4" @@ -5037,9 +5062,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.68" +version = "0.10.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6" dependencies = [ "bitflags 2.8.0", "cfg-if", @@ -5069,9 +5094,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.104" +version = "0.9.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc" dependencies = [ "cc", "libc", @@ -5094,7 +5119,7 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "pallet-alliance" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5105,7 +5130,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-io", "sp-runtime", ] @@ -5113,7 +5138,7 @@ dependencies = [ [[package]] name = "pallet-asset-conversion" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5131,7 +5156,7 @@ dependencies = [ [[package]] name = "pallet-asset-conversion-ops" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5149,7 +5174,7 @@ dependencies = [ [[package]] name = "pallet-asset-conversion-tx-payment" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5164,7 +5189,7 @@ dependencies = [ [[package]] name = "pallet-asset-rate" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5178,7 +5203,7 @@ dependencies = [ [[package]] name = "pallet-asset-rewards" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5190,13 +5215,13 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "pallet-asset-tx-payment" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5213,7 +5238,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "29.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5229,22 +5254,19 @@ dependencies = [ [[package]] name = "pallet-assets-freezer" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", "log", "pallet-assets", "parity-scale-codec", + "polkadot-sdk-frame", "scale-info", - "sp-runtime", ] [[package]] name = "pallet-atomic-swap" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "polkadot-sdk-frame", @@ -5254,7 +5276,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -5270,7 +5292,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -5285,7 +5307,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -5298,7 +5320,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5321,7 +5343,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "aquamarine", "docify", @@ -5336,13 +5358,13 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "pallet-balances" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "frame-benchmarking", @@ -5351,13 +5373,14 @@ dependencies = [ "log", "parity-scale-codec", "scale-info", + "sp-core", "sp-runtime", ] [[package]] name = "pallet-beefy" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -5376,7 +5399,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "array-bytes", "binary-merkle-tree", @@ -5401,7 +5424,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5418,7 +5441,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-header-chain", "bp-runtime", @@ -5431,13 +5454,13 @@ dependencies = [ "scale-info", "sp-consensus-grandpa", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "pallet-bridge-messages" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-header-chain", "bp-messages", @@ -5449,14 +5472,14 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-trie", ] [[package]] name = "pallet-bridge-parachains" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-header-chain", "bp-parachains", @@ -5470,13 +5493,13 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "pallet-bridge-relayers" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-header-chain", "bp-messages", @@ -5494,13 +5517,13 @@ dependencies = [ "scale-info", "sp-arithmetic", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "pallet-broker" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bitvec", "frame-benchmarking", @@ -5518,7 +5541,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5536,7 +5559,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5555,7 +5578,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "frame-benchmarking", @@ -5572,7 +5595,7 @@ dependencies = [ [[package]] name = "pallet-collective-content" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5586,7 +5609,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bitflags 1.3.2", "environmental", @@ -5617,7 +5640,7 @@ dependencies = [ [[package]] name = "pallet-contracts-mock-network" version = "3.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -5626,11 +5649,8 @@ dependencies = [ "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", @@ -5642,7 +5662,7 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -5652,7 +5672,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "18.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "proc-macro2", "quote", @@ -5662,7 +5682,7 @@ dependencies = [ [[package]] name = "pallet-contracts-uapi" version = "5.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bitflags 1.3.2", "parity-scale-codec", @@ -5673,7 +5693,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "assert_matches", "frame-benchmarking", @@ -5689,7 +5709,7 @@ dependencies = [ [[package]] name = "pallet-core-fellowship" version = "12.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5707,7 +5727,7 @@ dependencies = [ [[package]] name = "pallet-delegated-staking" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -5722,7 +5742,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5739,7 +5759,7 @@ dependencies = [ [[package]] name = "pallet-dev-mode" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -5754,7 +5774,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5776,7 +5796,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5789,7 +5809,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5807,7 +5827,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "frame-benchmarking", @@ -5825,7 +5845,7 @@ dependencies = [ [[package]] name = "pallet-glutton" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "blake2", "frame-benchmarking", @@ -5843,7 +5863,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5865,7 +5885,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5881,7 +5901,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5900,7 +5920,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5909,27 +5929,24 @@ dependencies = [ "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=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ - "frame-support", - "frame-system", "parity-scale-codec", + "polkadot-sdk-frame", "safe-mix", "scale-info", - "sp-runtime", ] [[package]] name = "pallet-lottery" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5942,7 +5959,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -5958,7 +5975,7 @@ dependencies = [ [[package]] name = "pallet-message-queue" version = "31.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "environmental", "frame-benchmarking", @@ -5977,7 +5994,7 @@ dependencies = [ [[package]] name = "pallet-migrations" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cfg-if", "docify", @@ -5995,7 +6012,7 @@ dependencies = [ [[package]] name = "pallet-mixnet" version = "0.4.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "log", "parity-scale-codec", @@ -6009,24 +6026,19 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", "log", "parity-scale-codec", + "polkadot-sdk-frame", "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=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "log", "parity-scale-codec", @@ -6037,7 +6049,7 @@ dependencies = [ [[package]] name = "pallet-nft-fractionalization" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6053,7 +6065,7 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "22.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "enumflags2", "frame-benchmarking", @@ -6070,9 +6082,8 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ - "pallet-nfts", "parity-scale-codec", "sp-api", ] @@ -6080,7 +6091,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6095,7 +6106,7 @@ dependencies = [ [[package]] name = "pallet-node-authorization" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "log", "parity-scale-codec", @@ -6106,7 +6117,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "25.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -6118,13 +6129,13 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "pallet-nomination-pools-benchmarking" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6137,14 +6148,14 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-staking", ] [[package]] name = "pallet-nomination-pools-runtime-api" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -6154,12 +6165,11 @@ dependencies = [ [[package]] name = "pallet-offences" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", "log", - "pallet-balances", "parity-scale-codec", "scale-info", "serde", @@ -6170,7 +6180,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6193,10 +6203,9 @@ dependencies = [ [[package]] name = "pallet-paged-list" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", - "frame-benchmarking", "frame-support", "frame-system", "parity-scale-codec", @@ -6210,7 +6219,7 @@ dependencies = [ [[package]] name = "pallet-parameters" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "frame-benchmarking", @@ -6227,7 +6236,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6243,7 +6252,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "polkadot-sdk-frame", @@ -6253,7 +6262,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6271,7 +6280,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6285,7 +6294,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6302,7 +6311,7 @@ dependencies = [ [[package]] name = "pallet-remark" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6318,10 +6327,11 @@ dependencies = [ [[package]] name = "pallet-revive" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "derive_more 0.99.18", "environmental", + "ethabi-decode", "ethereum-types", "frame-benchmarking", "frame-support", @@ -6341,6 +6351,9 @@ dependencies = [ "serde", "sp-api", "sp-arithmetic", + "sp-consensus-aura", + "sp-consensus-babe", + "sp-consensus-slots", "sp-core", "sp-io", "sp-runtime", @@ -6352,7 +6365,7 @@ dependencies = [ [[package]] name = "pallet-revive-fixtures" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "anyhow", "polkavm-linker 0.19.0", @@ -6364,7 +6377,7 @@ dependencies = [ [[package]] name = "pallet-revive-mock-network" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -6383,7 +6396,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -6393,7 +6406,7 @@ dependencies = [ [[package]] name = "pallet-revive-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "proc-macro2", "quote", @@ -6403,7 +6416,7 @@ dependencies = [ [[package]] name = "pallet-revive-uapi" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bitflags 1.3.2", "pallet-revive-proc-macro", @@ -6416,7 +6429,7 @@ dependencies = [ [[package]] name = "pallet-root-offences" version = "25.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -6431,7 +6444,7 @@ dependencies = [ [[package]] name = "pallet-root-testing" version = "4.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -6445,7 +6458,7 @@ dependencies = [ [[package]] name = "pallet-safe-mode" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "frame-benchmarking", @@ -6463,7 +6476,7 @@ dependencies = [ [[package]] name = "pallet-salary" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "log", "pallet-ranked-collective", @@ -6475,7 +6488,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "frame-benchmarking", @@ -6492,7 +6505,7 @@ dependencies = [ [[package]] name = "pallet-scored-pool" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -6505,7 +6518,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -6526,7 +6539,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6542,7 +6555,7 @@ dependencies = [ [[package]] name = "pallet-skip-feeless-payment" version = "3.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -6554,7 +6567,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6571,7 +6584,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6592,7 +6605,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "log", "sp-arithmetic", @@ -6601,7 +6614,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "sp-api", @@ -6611,7 +6624,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6627,7 +6640,7 @@ dependencies = [ [[package]] name = "pallet-statement" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -6644,7 +6657,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "frame-benchmarking", @@ -6659,7 +6672,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "frame-benchmarking", @@ -6671,14 +6684,14 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-timestamp", ] [[package]] name = "pallet-tips" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6696,7 +6709,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6712,7 +6725,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -6724,7 +6737,7 @@ dependencies = [ [[package]] name = "pallet-transaction-storage" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6743,7 +6756,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "frame-benchmarking", @@ -6762,7 +6775,7 @@ dependencies = [ [[package]] name = "pallet-tx-pause" version = "9.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "frame-benchmarking", @@ -6779,7 +6792,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6793,7 +6806,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6808,7 +6821,7 @@ dependencies = [ [[package]] name = "pallet-verify-signature" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6824,7 +6837,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6838,7 +6851,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6852,7 +6865,7 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -6875,7 +6888,7 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -6893,7 +6906,7 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-messages", "bp-runtime", @@ -6906,7 +6919,7 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -6915,7 +6928,7 @@ dependencies = [ [[package]] name = "pallet-xcm-bridge-hub-router" version = "0.5.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bp-xcm-bridge-hub-router", "frame-benchmarking", @@ -6926,7 +6939,7 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-builder", ] @@ -6934,7 +6947,7 @@ dependencies = [ [[package]] name = "parachains-common" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-core", "cumulus-primitives-utility", @@ -6964,7 +6977,7 @@ dependencies = [ [[package]] name = "parachains-runtimes-test-utils" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", @@ -6985,7 +6998,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-parachain-info", "staging-xcm", "staging-xcm-executor", @@ -7177,9 +7190,9 @@ dependencies = [ [[package]] name = "polkadot-ckb-merkle-mountain-range" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b44320e5f7ce2c18227537a3032ae5b2c476a7e8eddba45333e1011fc31b92" +checksum = "221c71b432b38e494a0fdedb5f720e4cb974edf03a0af09e5b2238dbac7e6947" dependencies = [ "cfg-if", "itertools 0.10.5", @@ -7188,7 +7201,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "scale-info", @@ -7199,7 +7212,7 @@ dependencies = [ [[package]] name = "polkadot-parachain-primitives" version = "6.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bounded-collections", "derive_more 0.99.18", @@ -7215,7 +7228,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bitvec", "hex-literal", @@ -7236,14 +7249,14 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-staking", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "thiserror 1.0.69", ] [[package]] name = "polkadot-runtime-common" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bitvec", "frame-benchmarking", @@ -7293,19 +7306,19 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bs58", "frame-benchmarking", "parity-scale-codec", "polkadot-primitives", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "polkadot-runtime-parachains" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bitflags 1.3.2", "bitvec", @@ -7325,7 +7338,6 @@ dependencies = [ "pallet-session", "pallet-staking", "pallet-timestamp", - "pallet-vesting", "parity-scale-codec", "polkadot-core-primitives", "polkadot-parachain-primitives", @@ -7345,7 +7357,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-executor", ] @@ -7353,7 +7365,7 @@ dependencies = [ [[package]] name = "polkadot-sdk" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "asset-test-utils", "assets-common", @@ -7546,11 +7558,11 @@ dependencies = [ "sp-consensus-slots", "sp-core", "sp-core-hashing", - "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-crypto-ec-utils 0.10.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-crypto-hashing-proc-macro", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-genesis-builder", "sp-inherents", "sp-io", @@ -7562,22 +7574,22 @@ dependencies = [ "sp-npos-elections", "sp-offchain", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-session", "sp-staking", "sp-state-machine", "sp-statement-store", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-timestamp", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "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=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-weights", "staging-parachain-info", "staging-xcm", @@ -7600,7 +7612,7 @@ dependencies = [ [[package]] name = "polkadot-sdk-frame" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "frame-benchmarking", @@ -7626,7 +7638,7 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-transaction-pool", "sp-version", ] @@ -8263,7 +8275,7 @@ dependencies = [ [[package]] name = "revive-benchmarks" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "alloy-primitives", "criterion", @@ -8275,18 +8287,18 @@ dependencies = [ [[package]] name = "revive-build-utils" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" [[package]] name = "revive-builtins" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "revive-build-utils", ] [[package]] name = "revive-common" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "anyhow", "serde", @@ -8296,7 +8308,7 @@ dependencies = [ [[package]] name = "revive-differential" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "alloy-genesis", "alloy-primitives", @@ -8309,7 +8321,7 @@ dependencies = [ [[package]] name = "revive-integration" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -8324,7 +8336,7 @@ dependencies = [ [[package]] name = "revive-linker" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "anyhow", "libc", @@ -8336,7 +8348,7 @@ dependencies = [ [[package]] name = "revive-llvm-builder" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "anyhow", "assert_cmd", @@ -8357,13 +8369,12 @@ dependencies = [ [[package]] name = "revive-llvm-context" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "anyhow", "hex", "inkwell", "itertools 0.14.0", - "md5", "num", "polkavm-common 0.19.0", "polkavm-disassembler", @@ -8378,7 +8389,7 @@ dependencies = [ [[package]] name = "revive-runner" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "alloy-primitives", "hex", @@ -8393,7 +8404,7 @@ dependencies = [ [[package]] name = "revive-runtime-api" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "anyhow", "inkwell", @@ -8403,7 +8414,7 @@ dependencies = [ [[package]] name = "revive-solidity" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "anyhow", "clap", @@ -8411,7 +8422,6 @@ dependencies = [ "hex", "inkwell", "libc", - "md5", "mimalloc", "num", "once_cell", @@ -8430,7 +8440,7 @@ dependencies = [ [[package]] name = "revive-stdlib" -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" dependencies = [ "inkwell", "revive-build-utils", @@ -8495,7 +8505,7 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "polkadot-primitives", @@ -8696,18 +8706,18 @@ dependencies = [ [[package]] name = "sc-allocator" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "log", "sp-core", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "thiserror 1.0.69", ] [[package]] name = "sc-executor" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "parking_lot", @@ -8717,25 +8727,25 @@ dependencies = [ "schnellru", "sp-api", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-io", "sp-panic-handler", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-trie", "sp-version", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "tracing", ] [[package]] name = "sc-executor-common" version = "0.29.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "polkavm 0.18.0", "sc-allocator", "sp-maybe-compressed-blob", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "thiserror 1.0.69", "wasm-instrument", ] @@ -8743,18 +8753,18 @@ dependencies = [ [[package]] name = "sc-executor-polkavm" version = "0.29.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "log", "polkavm 0.18.0", "sc-executor-common", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "sc-executor-wasmtime" version = "0.29.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "anyhow", "cfg-if", @@ -8764,8 +8774,8 @@ dependencies = [ "rustix 0.36.17", "sc-allocator", "sc-executor-common", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "wasmtime", ] @@ -9304,7 +9314,7 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "slot-range-helper" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "enumn", "parity-scale-codec", @@ -9331,7 +9341,7 @@ dependencies = [ [[package]] name = "snowbridge-beacon-primitives" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "byte-slice-cast", "frame-support", @@ -9345,7 +9355,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "ssz_rs", "ssz_rs_derive", ] @@ -9353,7 +9363,7 @@ dependencies = [ [[package]] name = "snowbridge-core" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "ethabi-decode", "frame-support", @@ -9368,7 +9378,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-builder", ] @@ -9376,7 +9386,7 @@ dependencies = [ [[package]] name = "snowbridge-ethereum" version = "0.3.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "ethabi-decode", "ethbloom", @@ -9390,7 +9400,7 @@ dependencies = [ "serde-big-array", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] @@ -9411,7 +9421,7 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-merkle-tree" version = "0.3.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "scale-info", @@ -9422,20 +9432,20 @@ dependencies = [ [[package]] name = "snowbridge-outbound-queue-runtime-api" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" 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=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "snowbridge-pallet-ethereum-client" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -9452,26 +9462,26 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "static_assertions", ] [[package]] name = "snowbridge-pallet-ethereum-client-fixtures" version = "0.9.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "hex-literal", "snowbridge-beacon-primitives", "snowbridge-core", "sp-core", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "snowbridge-pallet-inbound-queue" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "alloy-core", "frame-benchmarking", @@ -9489,7 +9499,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-executor", ] @@ -9497,19 +9507,19 @@ dependencies = [ [[package]] name = "snowbridge-pallet-inbound-queue-fixtures" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "hex-literal", "snowbridge-beacon-primitives", "snowbridge-core", "sp-core", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "snowbridge-pallet-outbound-queue" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bridge-hub-common", "ethabi-decode", @@ -9525,13 +9535,13 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "snowbridge-pallet-system" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-benchmarking", "frame-support", @@ -9543,7 +9553,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-executor", ] @@ -9551,7 +9561,7 @@ dependencies = [ [[package]] name = "snowbridge-router-primitives" version = "0.9.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "hex-literal", @@ -9562,7 +9572,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-executor", ] @@ -9570,14 +9580,14 @@ dependencies = [ [[package]] name = "snowbridge-runtime-common" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "log", "parity-scale-codec", "snowbridge-core", "sp-arithmetic", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", @@ -9586,7 +9596,7 @@ dependencies = [ [[package]] name = "snowbridge-runtime-test-common" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-pallet-parachain-system", "frame-support", @@ -9617,12 +9627,12 @@ dependencies = [ [[package]] name = "snowbridge-system-runtime-api" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "snowbridge-core", "sp-api", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", ] @@ -9639,7 +9649,7 @@ dependencies = [ [[package]] name = "sp-api" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "hash-db", @@ -9648,10 +9658,10 @@ dependencies = [ "scale-info", "sp-api-proc-macro", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-metadata-ir", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-state-machine", "sp-trie", "sp-version", @@ -9661,7 +9671,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "Inflector", "blake2", @@ -9675,7 +9685,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "30.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "scale-info", @@ -9687,7 +9697,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "23.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "docify", "integer-sqrt", @@ -9719,7 +9729,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "scale-info", @@ -9731,7 +9741,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "sp-api", "sp-inherents", @@ -9741,7 +9751,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "async-trait", "parity-scale-codec", @@ -9757,7 +9767,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "async-trait", "parity-scale-codec", @@ -9775,7 +9785,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "scale-info", @@ -9783,7 +9793,7 @@ dependencies = [ "sp-api", "sp-application-crypto", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-io", "sp-keystore", "sp-mmr-primitives", @@ -9795,7 +9805,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "finality-grandpa", "log", @@ -9812,7 +9822,7 @@ dependencies = [ [[package]] name = "sp-consensus-pow" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "sp-api", @@ -9823,7 +9833,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.32.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "scale-info", @@ -9834,7 +9844,7 @@ dependencies = [ [[package]] name = "sp-core" version = "28.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "array-bytes", "bandersnatch_vrfs", @@ -9864,12 +9874,12 @@ dependencies = [ "secp256k1 0.28.2", "secrecy 0.8.0", "serde", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "ss58-registry", "substrate-bip39", "thiserror 1.0.69", @@ -9881,15 +9891,15 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "15.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "sp-crypto-ec-utils" version = "0.10.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "ark-bls12-377", "ark-bls12-377-ext", @@ -9903,7 +9913,7 @@ dependencies = [ "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=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] @@ -9943,7 +9953,7 @@ dependencies = [ [[package]] name = "sp-crypto-hashing" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "blake2b_simd", "byteorder", @@ -9956,17 +9966,17 @@ dependencies = [ [[package]] name = "sp-crypto-hashing-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "quote", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "syn 2.0.96", ] [[package]] name = "sp-debug-derive" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "proc-macro2", "quote", @@ -9986,11 +9996,11 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.25.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "environmental", "parity-scale-codec", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] @@ -10006,7 +10016,7 @@ dependencies = [ [[package]] name = "sp-genesis-builder" version = "0.8.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "scale-info", @@ -10018,7 +10028,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -10031,7 +10041,7 @@ dependencies = [ [[package]] name = "sp-io" version = "30.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bytes", "docify", @@ -10043,12 +10053,12 @@ dependencies = [ "rustversion", "secp256k1 0.28.2", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-keystore", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-state-machine", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-trie", "tracing", "tracing-core", @@ -10057,7 +10067,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "31.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "sp-core", "sp-runtime", @@ -10067,18 +10077,18 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.34.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "parking_lot", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] name = "sp-maybe-compressed-blob" version = "11.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "thiserror 1.0.69", "zstd 0.12.4", @@ -10087,7 +10097,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.6.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-metadata 18.0.0", "parity-scale-codec", @@ -10097,7 +10107,7 @@ dependencies = [ [[package]] name = "sp-mixnet" version = "0.4.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "scale-info", @@ -10108,7 +10118,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "log", "parity-scale-codec", @@ -10117,7 +10127,7 @@ dependencies = [ "serde", "sp-api", "sp-core", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-runtime", "thiserror 1.0.69", ] @@ -10125,7 +10135,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "scale-info", @@ -10138,7 +10148,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "sp-api", "sp-core", @@ -10148,7 +10158,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "backtrace", "regex", @@ -10157,7 +10167,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "31.0.1" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "binary-merkle-tree", "docify", @@ -10176,7 +10186,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-io", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-trie", "sp-weights", "tracing", @@ -10186,19 +10196,19 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "24.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", "polkavm-derive 0.18.0", "primitive-types 0.13.1", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "static_assertions", ] @@ -10224,7 +10234,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "Inflector", "expander", @@ -10250,7 +10260,7 @@ dependencies = [ [[package]] name = "sp-session" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "scale-info", @@ -10264,7 +10274,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -10277,7 +10287,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.35.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "hash-db", "log", @@ -10286,7 +10296,7 @@ dependencies = [ "rand", "smallvec", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-panic-handler", "sp-trie", "thiserror 1.0.69", @@ -10297,7 +10307,7 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "10.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "aes-gcm", "curve25519-dalek", @@ -10310,10 +10320,10 @@ dependencies = [ "sp-api", "sp-application-crypto", "sp-core", - "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-runtime", - "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "thiserror 1.0.69", "x25519-dalek", ] @@ -10321,7 +10331,7 @@ dependencies = [ [[package]] name = "sp-std" version = "14.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" [[package]] name = "sp-std" @@ -10331,13 +10341,13 @@ source = "git+https://github.com/paritytech/polkadot-sdk#d62a90c8c729acd98c7e9a5 [[package]] name = "sp-storage" version = "19.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] @@ -10355,7 +10365,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "async-trait", "parity-scale-codec", @@ -10367,7 +10377,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "16.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "tracing", @@ -10389,7 +10399,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "sp-api", "sp-runtime", @@ -10398,7 +10408,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "26.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "async-trait", "parity-scale-codec", @@ -10412,7 +10422,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "ahash", "hash-db", @@ -10424,7 +10434,7 @@ dependencies = [ "scale-info", "schnellru", "sp-core", - "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "thiserror 1.0.69", "tracing", "trie-db", @@ -10434,7 +10444,7 @@ dependencies = [ [[package]] name = "sp-version" version = "29.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "impl-serde", "parity-scale-codec", @@ -10443,7 +10453,7 @@ dependencies = [ "serde", "sp-crypto-hashing-proc-macro", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "sp-version-proc-macro", "thiserror 1.0.69", ] @@ -10451,7 +10461,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "13.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "parity-scale-codec", "proc-macro-warning", @@ -10463,7 +10473,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "20.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -10486,7 +10496,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "27.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "bounded-collections", "parity-scale-codec", @@ -10494,7 +10504,7 @@ dependencies = [ "serde", "smallvec", "sp-arithmetic", - "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", ] [[package]] @@ -10573,7 +10583,7 @@ dependencies = [ [[package]] name = "staging-parachain-info" version = "0.7.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -10586,11 +10596,11 @@ dependencies = [ [[package]] name = "staging-xcm" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "array-bytes", "bounded-collections", - "derivative", + "derive-where", "environmental", "frame-support", "hex-literal", @@ -10607,7 +10617,7 @@ dependencies = [ [[package]] name = "staging-xcm-builder" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -10629,7 +10639,7 @@ dependencies = [ [[package]] name = "staging-xcm-executor" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "environmental", "frame-benchmarking", @@ -10713,7 +10723,7 @@ dependencies = [ [[package]] name = "substrate-bip39" version = "0.4.7" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "hmac 0.12.1", "pbkdf2", @@ -10725,7 +10735,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "17.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "build-helper", "cargo_metadata", @@ -10930,7 +10940,7 @@ checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" [[package]] name = "testnet-parachains-constants" version = "1.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -11862,7 +11872,7 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "polkadot-primitives", @@ -12234,7 +12244,7 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "Inflector", "proc-macro2", @@ -12245,7 +12255,7 @@ dependencies = [ [[package]] name = "xcm-runtime-apis" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "parity-scale-codec", @@ -12259,7 +12269,7 @@ dependencies = [ [[package]] name = "xcm-simulator" version = "7.0.0" -source = "git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5#d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" +source = "git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50#274a781e8ca1a9432c7ec87593bd93214abbff50" dependencies = [ "frame-support", "frame-system", @@ -12272,7 +12282,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=d62a90c8c729acd98c7e9a5cab9803b8b211ffc5)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?rev=274a781e8ca1a9432c7ec87593bd93214abbff50)", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", diff --git a/Cargo.toml b/Cargo.toml index f9b3f2d..30d6148 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = ["crates/*"] [workspace.package] -version = "0.1.0-dev.8" +version = "0.1.0-dev.9" authors = [ "Cyrill Leutwiler ", "Parity Technologies ", @@ -14,35 +14,34 @@ repository = "https://github.com/paritytech/revive" rust-version = "1.81.0" [workspace.dependencies] -revive-benchmarks = { version = "0.1.0-dev.8", path = "crates/benchmarks" } -revive-builtins = { version = "0.1.0-dev.8", path = "crates/builtins" } -revive-common = { version = "0.1.0-dev.8", path = "crates/common" } -revive-differential = { version = "0.1.0-dev.8", path = "crates/differential" } -revive-integration = { version = "0.1.0-dev.8", path = "crates/integration" } -revive-linker = { version = "0.1.0-dev.8", path = "crates/linker" } -lld-sys = { version = "0.1.0-dev.8", path = "crates/lld-sys" } -revive-llvm-context = { version = "0.1.0-dev.8", path = "crates/llvm-context" } -revive-runtime-api = { version = "0.1.0-dev.8", path = "crates/runtime-api" } -revive-runner = { version = "0.1.0-dev.8", path = "crates/runner" } -revive-solidity = { version = "0.1.0-dev.8", path = "crates/solidity" } -revive-stdlib = { version = "0.1.0-dev.8", path = "crates/stdlib" } -revive-build-utils = { version = "0.1.0-dev.8", path = "crates/build-utils" } +revive-benchmarks = { version = "0.1.0-dev.9", path = "crates/benchmarks" } +revive-builtins = { version = "0.1.0-dev.9", path = "crates/builtins" } +revive-common = { version = "0.1.0-dev.9", path = "crates/common" } +revive-differential = { version = "0.1.0-dev.9", path = "crates/differential" } +revive-integration = { version = "0.1.0-dev.9", path = "crates/integration" } +revive-linker = { version = "0.1.0-dev.9", path = "crates/linker" } +lld-sys = { version = "0.1.0-dev.9", path = "crates/lld-sys" } +revive-llvm-context = { version = "0.1.0-dev.9", path = "crates/llvm-context" } +revive-runtime-api = { version = "0.1.0-dev.9", path = "crates/runtime-api" } +revive-runner = { version = "0.1.0-dev.9", path = "crates/runner" } +revive-solidity = { version = "0.1.0-dev.9", path = "crates/solidity" } +revive-stdlib = { version = "0.1.0-dev.9", path = "crates/stdlib" } +revive-build-utils = { version = "0.1.0-dev.9", path = "crates/build-utils" } hex = "0.4.3" cc = "1.0" libc = "0.2.169" tempfile = "3.8" anyhow = "1.0" -semver = { version = "1.0", features = [ "serde" ] } +semver = { version = "1.0", features = ["serde"] } itertools = "0.14" -serde = { version = "1.0", features = [ "derive" ] } -serde_json = { version = "1.0", features = [ "arbitrary_precision" ] } +serde = { version = "1.0", features = ["derive"] } +serde_json = { version = "1.0", features = ["arbitrary_precision"] } regex = "1.10" once_cell = "1.19" num = "0.4.3" sha1 = "0.10" sha3 = "0.10" -md5 = "0.7.0" thiserror = "2.0" which = "7.0" path-slash = "0.2" @@ -54,8 +53,8 @@ polkavm-disassembler = "0.19.0" polkavm = "0.19.0" alloy-primitives = { version = "0.8.19", features = ["serde"] } alloy-sol-types = "0.8.19" -alloy-genesis = "0.9.2" -alloy-serde = "0.9.2" +alloy-genesis = "0.11.0" +alloy-serde = "0.11.0" env_logger = { version = "0.11.6", default-features = false } serde_stacker = "0.1.11" criterion = { version = "0.5.1", features = ["html_reports"] } @@ -73,7 +72,7 @@ assert_fs = "1.1.2" # polkadot-sdk and friends codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" } scale-info = { version = "2.11.6", default-features = false } -polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "d62a90c8c729acd98c7e9a5cab9803b8b211ffc5" } +polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "274a781e8ca1a9432c7ec87593bd93214abbff50" } # llvm [workspace.dependencies.inkwell] diff --git a/Makefile b/Makefile index 8477557..da539be 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ format: cargo fmt --all --check clippy: - cargo clippy --all-features --workspace --tests --benches -- --deny warnings --allow dead_code + cargo clippy --all-features --workspace --tests --benches -- --deny warnings machete: cargo install cargo-machete diff --git a/README.md b/README.md index 4a4afae..5a97160 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # revive -YUL and EVM assembly recompiler to LLVM, targetting RISC-V on [PolkaVM](https://github.com/koute/polkavm). +YUL recompiler to LLVM, targetting RISC-V on [PolkaVM](https://github.com/koute/polkavm). Visit [contracts.polkadot.io](https://contracts.polkadot.io) to learn more about contracts on Polkadot! diff --git a/crates/common/src/extension.rs b/crates/common/src/extension.rs index d37fe4c..562acbb 100644 --- a/crates/common/src/extension.rs +++ b/crates/common/src/extension.rs @@ -12,12 +12,6 @@ pub static EXTENSION_ABI: &str = "abi"; /// The Yul IR file extension. pub static EXTENSION_YUL: &str = "yul"; -/// The EVM legacy assembly IR file extension. -pub static EXTENSION_EVMLA: &str = "evmla"; - -/// The Ethereal IR file extension. -pub static EXTENSION_ETHIR: &str = "ethir"; - /// The EVM file extension. pub static EXTENSION_EVM: &str = "evm"; diff --git a/crates/differential/genesis.json b/crates/differential/genesis.json index 2abb453..6a91218 100644 --- a/crates/differential/genesis.json +++ b/crates/differential/genesis.json @@ -16,9 +16,16 @@ "shanghaiTime": 0, "cancunTime": 0, "terminalTotalDifficulty": 0, - "terminalTotalDifficultyPassed": true + "terminalTotalDifficultyPassed": true, + "blobSchedule": { + "cancun": { + "target": 3, + "max": 6, + "baseFeeUpdateFraction": 3338477 + } + } }, - "coinbase": "0x0000000000000000000000000000000000000000", + "coinbase": "0xffffffffffffffffffffffffffffffffffffffff", "difficulty": "0x20000", "extraData": "", "gasLimit": "0xffffffff", diff --git a/crates/differential/src/lib.rs b/crates/differential/src/lib.rs index 2462b84..6be5bdb 100644 --- a/crates/differential/src/lib.rs +++ b/crates/differential/src/lib.rs @@ -413,7 +413,7 @@ impl Evm { 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(); + let mut log: EvmLog = format!("{stdout}{stderr}").as_str().into(); log.stderr = stderr.into(); if self.bench { log.parse_gas_used_from_bench(); diff --git a/crates/integration/contracts/Balance.sol b/crates/integration/contracts/Balance.sol new file mode 100644 index 0000000..4433d86 --- /dev/null +++ b/crates/integration/contracts/Balance.sol @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Upload": { + "code": { + "Solidity": { + "contract": "BalanceReceiver" + } + } + } + }, + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Balance" + } + }, + "value": 24 + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "1c8d16b30000000000000000000000000303030303030303030303030303030303030303000000000000000000000000000000000000000000000000000000000000000a" + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "6ada15d90000000000000000000000000303030303030303030303030303030303030303000000000000000000000000000000000000000000000000000000000000000a" + } + } + ] +} +*/ + +contract BalanceReceiver { + constructor() payable {} + + fallback() external payable {} +} + +contract Balance { + constructor() payable { + // 0 to EOA + transfer_to(payable(address(0xdeadbeef)), 0); + send_to(payable(address(0xdeadbeef)), 0); + + // 1 to EOA + transfer_to(payable(address(0xcafebabe)), 1); + send_to(payable(address(0xcafebabe)), 1); + + BalanceReceiver balanceReceiver = new BalanceReceiver(); + + // 0 to contract + transfer_to(payable(address(balanceReceiver)), 0); + send_to(payable(address(balanceReceiver)), 0); + + // 1 to contract + transfer_to(payable(address(balanceReceiver)), 1); + send_to(payable(address(balanceReceiver)), 1); + } + + function transfer_to(address payable _dest, uint _amount) public payable { + _dest.transfer(_amount); + } + + function send_to(address payable _dest, uint _amount) public payable { + require(_dest.send(_amount)); + } +} diff --git a/crates/integration/contracts/Coinbase.sol b/crates/integration/contracts/Coinbase.sol new file mode 100644 index 0000000..79d3b0d --- /dev/null +++ b/crates/integration/contracts/Coinbase.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Coinbase" + } + } + } + } + ] +} +*/ + +contract Coinbase { + constructor() payable { + address coinbase = address(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF); + assert(block.coinbase == coinbase); + } +} diff --git a/crates/integration/contracts/Create2.sol b/crates/integration/contracts/Create2.sol new file mode 100644 index 0000000..c3e508e --- /dev/null +++ b/crates/integration/contracts/Create2.sol @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Upload": { + "code": { + "Solidity": { + "contract": "CreateA" + } + } + } + }, + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "CreateB" + } + }, + "value": 100000 + } + } + ] +} +*/ + +contract CreateA { + constructor() payable {} +} + +contract CreateB { + constructor() payable { + bytes32 salt = hex"ff"; + + try new CreateA{salt: salt}() returns (CreateA) {} catch { + revert("the first instantiation should succeed"); + } + + try new CreateA{salt: salt}() returns (CreateA) {} catch { + return; + } + + revert("the second instantiation should have failed"); + } +} diff --git a/crates/integration/contracts/FunctionPointer.sol b/crates/integration/contracts/FunctionPointer.sol new file mode 100644 index 0000000..fbf18d1 --- /dev/null +++ b/crates/integration/contracts/FunctionPointer.sol @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +/* runner.json +{ + "differential": true, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "FunctionPointer" + } + } + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "26121ff0" + } + } + ] +} +*/ + +contract FunctionPointer { + bool public flag = false; + + function f0() public { + flag = true; + } + + function f() public returns (bool) { + function() internal x = f0; + x(); + return flag; + } +} diff --git a/crates/integration/contracts/Send.sol b/crates/integration/contracts/Send.sol new file mode 100644 index 0000000..470592b --- /dev/null +++ b/crates/integration/contracts/Send.sol @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8; + +/* runner.json +{ + "differential": false, + "actions": [ + { + "Instantiate": { + "code": { + "Solidity": { + "contract": "Send" + } + }, + "value": 211 + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "1c8d16b30000000000000000000000000303030303030303030303030303030303030303000000000000000000000000000000000000000000000000000000000000000a" + } + }, + { + "VerifyCall": { + "success": true + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "fb9e8d050000000000000000000000000000000000000000000000000000000000000001" + } + }, + { + "VerifyCall": { + "success": false + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "fb9e8d050000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "VerifyCall": { + "success": false + } + } + ] +} +*/ + +contract Send { + constructor() payable {} + + function transfer_self(uint _amount) public payable { + transfer_to(payable(address(this)), _amount); + } + + function transfer_to(address payable _dest, uint _amount) public payable { + if (_dest.send(_amount)) {} + } + + fallback() external {} + + receive() external payable {} +} diff --git a/crates/integration/contracts/Transfer.sol b/crates/integration/contracts/Transfer.sol index 84c7810..02ee701 100644 --- a/crates/integration/contracts/Transfer.sol +++ b/crates/integration/contracts/Transfer.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8; /* runner.json { - "differential": true, + "differential": false, "actions": [ { "Instantiate": { @@ -12,7 +12,7 @@ pragma solidity ^0.8; "contract": "Transfer" } }, - "value": 11 + "value": 211 } }, { @@ -23,12 +23,35 @@ pragma solidity ^0.8; "data": "1c8d16b30000000000000000000000000303030303030303030303030303030303030303000000000000000000000000000000000000000000000000000000000000000a" } }, + { + "VerifyCall": { + "success": true + } + }, { "Call": { "dest": { "Instantiated": 0 }, - "data": "fb9e8d0500000000000000000000000003030303030303030303030303030303030303030000000000000000000000000000000000000000000000000000000000000001" + "data": "fb9e8d050000000000000000000000000000000000000000000000000000000000000001" + } + }, + { + "VerifyCall": { + "success": false + } + }, + { + "Call": { + "dest": { + "Instantiated": 0 + }, + "data": "fb9e8d050000000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "VerifyCall": { + "success": false } } ] @@ -36,19 +59,17 @@ pragma solidity ^0.8; */ contract Transfer { - constructor() payable { - transfer_self(msg.value); - } - - function address_self() internal view returns (address payable) { - return payable(address(this)); - } + constructor() payable {} function transfer_self(uint _amount) public payable { - transfer_to(address_self(), _amount); + transfer_to(payable(address(this)), _amount); } function transfer_to(address payable _dest, uint _amount) public payable { _dest.transfer(_amount); } + + fallback() external {} + + receive() external payable {} } diff --git a/crates/integration/src/cases.rs b/crates/integration/src/cases.rs index 7a141d8..179122d 100644 --- a/crates/integration/src/cases.rs +++ b/crates/integration/src/cases.rs @@ -156,6 +156,20 @@ case!("DivisionArithmetics.sol", DivisionArithmetics, sdivCall, division_arithme 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 Send { + function transfer_self(uint _amount) public payable; + } +); +case!("Send.sol", Send, transfer_selfCall, send_self, amount: U256); + +sol!( + contract Transfer { + function transfer_self(uint _amount) public payable; + } +); +case!("Transfer.sol", Transfer, transfer_selfCall, transfer_self, amount: U256); + sol!( contract MStore8 { function mStore8(uint value) public pure returns (uint256 word); diff --git a/crates/integration/src/tests.rs b/crates/integration/src/tests.rs index d1145c7..ed874ea 100644 --- a/crates/integration/src/tests.rs +++ b/crates/integration/src/tests.rs @@ -37,10 +37,10 @@ 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!(value, "Value", "Value.sol"); test_spec!(create, "CreateB", "Create.sol"); test_spec!(call, "Caller", "Call.sol"); -test_spec!(transfer, "Transfer", "Transfer.sol"); +test_spec!(balance, "Balance", "Balance.sol"); test_spec!(return_data_oob, "ReturnDataOob", "ReturnDataOob.sol"); test_spec!(immutables, "Immutables", "Immutables.sol"); test_spec!(transaction, "Transaction", "Transaction.sol"); @@ -50,6 +50,11 @@ test_spec!(gas_price, "GasPrice", "GasPrice.sol"); test_spec!(gas_left, "GasLeft", "GasLeft.sol"); test_spec!(gas_limit, "GasLimit", "GasLimit.sol"); test_spec!(base_fee, "BaseFee", "BaseFee.sol"); +test_spec!(coinbase, "Coinbase", "Coinbase.sol"); +test_spec!(create2, "CreateB", "Create2.sol"); +test_spec!(transfer, "Transfer", "Transfer.sol"); +test_spec!(send, "Send", "Send.sol"); +test_spec!(function_pointer, "FunctionPointer", "FunctionPointer.sol"); fn instantiate(path: &str, contract: &str) -> Vec { vec![Instantiate { @@ -61,7 +66,6 @@ fn instantiate(path: &str, contract: &str) -> Vec { path: Some(path.into()), contract: contract.to_string(), solc_optimizer: None, - pipeline: None, }, data: vec![], salt: OptionalHex::default(), @@ -354,7 +358,6 @@ fn ext_code_size() { path: Some("contracts/Baseline.sol".into()), contract: "Baseline".to_string(), solc_optimizer: None, - pipeline: None, }, data: vec![], salt: OptionalHex::from([0; 32]), @@ -435,32 +438,46 @@ fn ext_code_size() { .run(); } -/* -// These test were implement for the mock-runtime and need to be ported yet. +#[test] +#[should_panic(expected = "ReentranceDenied")] +fn send_denies_reentrancy() { + let value = 1000; + Specs { + actions: vec![ + instantiate("contracts/Send.sol", "Send").remove(0), + Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::send_self(U256::from(value)).calldata, + }, + ], + differential: false, + ..Default::default() + } + .run(); +} #[test] -fn create2_failure() { - let mut state = State::default(); - let contract_a = Contract::create_a(); - state.upload_code(&contract_a.pvm_runtime); - - let contract = Contract::create_b(); - let (state, output) = state - .transaction() - .with_default_account(&contract.pvm_runtime) - .calldata(contract.calldata.clone()) - .call(); - - assert_eq!(output.flags, ReturnFlags::Success); - - // The address already exists, which should cause the contract to revert - - let (_, output) = state - .transaction() - .with_default_account(&contract.pvm_runtime) - .calldata(contract.calldata) - .call(); - - assert_eq!(output.flags, ReturnFlags::Revert); +#[should_panic(expected = "ReentranceDenied")] +fn transfer_denies_reentrancy() { + let value = 1000; + Specs { + actions: vec![ + instantiate("contracts/Transfer.sol", "Transfer").remove(0), + Call { + origin: TestAddress::Alice, + dest: TestAddress::Instantiated(0), + value, + gas_limit: None, + storage_deposit_limit: None, + data: Contract::transfer_self(U256::from(value)).calldata, + }, + ], + differential: false, + ..Default::default() + } + .run(); } -*/ diff --git a/crates/llvm-builder/src/platforms/shared.rs b/crates/llvm-builder/src/platforms/shared.rs index 71e2e03..7585a31 100644 --- a/crates/llvm-builder/src/platforms/shared.rs +++ b/crates/llvm-builder/src/platforms/shared.rs @@ -40,17 +40,9 @@ pub const SHARED_BUILD_OPTS_NOT_MUSL: [&str; 4] = [ /// The shared build options to treat warnings as errors. /// -/// Disabled on Windows due to the following upstream issue with MSYS2 with mingw-w64: -/// ProgramTest.cpp:23:15: error: '__p__environ' redeclared without 'dllimport' attribute -pub fn shared_build_opts_werror(target_env: TargetEnv) -> Vec { - vec![format!( - "-DLLVM_ENABLE_WERROR='{}'", - if cfg!(target_os = "windows") || target_env == TargetEnv::Emscripten { - "Off" - } else { - "On" - }, - )] +/// Disabled because it makes the build very brittle. +pub fn shared_build_opts_werror(_target_env: TargetEnv) -> Vec { + vec!["-DLLVM_ENABLE_WERROR='Off'".to_string()] } /// The build options to set the default target. diff --git a/crates/llvm-builder/src/platforms/wasm32_emscripten.rs b/crates/llvm-builder/src/platforms/wasm32_emscripten.rs index 5b209c2..fd6d204 100644 --- a/crates/llvm-builder/src/platforms/wasm32_emscripten.rs +++ b/crates/llvm-builder/src/platforms/wasm32_emscripten.rs @@ -141,7 +141,7 @@ fn build_target( Command::new("emcmake") .env("EMCC_DEBUG", "2") .env("CXXFLAGS", "-Dwait4=__syscall_wait4") - .env("LDFLAGS", "-lnodefs.js -s NO_INVOKE_RUN -s EXIT_RUNTIME -s INITIAL_MEMORY=64MB -s ALLOW_MEMORY_GROWTH -s EXPORTED_RUNTIME_METHODS=FS,callMain,NODEFS -s MODULARIZE -s EXPORT_ES6 -s WASM_BIGINT") + .env("LDFLAGS", "-lnodefs.js -s NO_INVOKE_RUN=1 -s EXIT_RUNTIME=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_RUNTIME_METHODS=FS,callMain,NODEFS -s MODULARIZE=1 -s WASM_BIGINT=1 -s ALLOW_TABLE_GROWTH=1 -s NODEJS_CATCH_EXIT=0 -sDYNAMIC_EXECUTION=0") .arg("cmake") .args([ "-S", diff --git a/crates/llvm-context/Cargo.toml b/crates/llvm-context/Cargo.toml index 5bfd4e4..85dda1b 100644 --- a/crates/llvm-context/Cargo.toml +++ b/crates/llvm-context/Cargo.toml @@ -21,7 +21,6 @@ serde = { workspace = true, features = ["derive"] } num = { workspace = true } hex = { workspace = true } sha3 = { workspace = true } -md5 = { workspace = true } inkwell = { workspace = true } polkavm-disassembler = { workspace = true } polkavm-common = { workspace = true } diff --git a/crates/llvm-context/src/debug_config/ir_type.rs b/crates/llvm-context/src/debug_config/ir_type.rs index 43a4448..195fc95 100644 --- a/crates/llvm-context/src/debug_config/ir_type.rs +++ b/crates/llvm-context/src/debug_config/ir_type.rs @@ -1,16 +1,11 @@ //! The debug IR type. /// The debug IR type. -#[allow(non_camel_case_types)] #[allow(clippy::upper_case_acronyms)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum IRType { /// Whether to dump the Yul code. Yul, - /// Whether to dump the EVM legacy assembly code. - EVMLA, - /// Whether to dump the Ethereal IR code. - EthIR, /// Whether to dump the LLVM IR code. LLVM, /// Whether to dump the assembly code. @@ -27,8 +22,6 @@ impl IRType { pub fn file_extension(&self) -> &'static str { match self { Self::Yul => revive_common::EXTENSION_YUL, - Self::EthIR => revive_common::EXTENSION_ETHIR, - Self::EVMLA => revive_common::EXTENSION_EVMLA, Self::LLVM => revive_common::EXTENSION_LLVM_SOURCE, Self::Assembly => revive_common::EXTENSION_POLKAVM_ASSEMBLY, #[cfg(debug_assertions)] diff --git a/crates/llvm-context/src/debug_config/mod.rs b/crates/llvm-context/src/debug_config/mod.rs index f60ae6e..e85c14d 100644 --- a/crates/llvm-context/src/debug_config/mod.rs +++ b/crates/llvm-context/src/debug_config/mod.rs @@ -39,30 +39,6 @@ impl DebugConfig { Ok(()) } - /// Dumps the EVM legacy assembly IR. - pub fn dump_evmla(&self, contract_path: &str, code: &str) -> anyhow::Result<()> { - if let Some(output_directory) = self.output_directory.as_ref() { - let mut file_path = output_directory.to_owned(); - let full_file_name = Self::full_file_name(contract_path, None, IRType::EVMLA); - file_path.push(full_file_name); - std::fs::write(file_path, code)?; - } - - Ok(()) - } - - /// Dumps the Ethereal IR. - pub fn dump_ethir(&self, contract_path: &str, code: &str) -> anyhow::Result<()> { - if let Some(output_directory) = self.output_directory.as_ref() { - let mut file_path = output_directory.to_owned(); - let full_file_name = Self::full_file_name(contract_path, None, IRType::EthIR); - file_path.push(full_file_name); - std::fs::write(file_path, code)?; - } - - Ok(()) - } - /// Dumps the unoptimized LLVM IR. pub fn dump_llvm_ir_unoptimized( &self, diff --git a/crates/llvm-context/src/lib.rs b/crates/llvm-context/src/lib.rs index 5d1c82b..e37ed68 100644 --- a/crates/llvm-context/src/lib.rs +++ b/crates/llvm-context/src/lib.rs @@ -17,12 +17,7 @@ pub use self::polkavm::context::attribute::Attribute as PolkaVMAttribute; pub use self::polkavm::context::build::Build as PolkaVMBuild; pub use self::polkavm::context::code_type::CodeType as PolkaVMCodeType; pub use self::polkavm::context::debug_info::DebugInfo; -pub use self::polkavm::context::evmla_data::EVMLAData as PolkaVMContextEVMLAData; -pub use self::polkavm::context::function::block::evmla_data::key::Key as PolkaVMFunctionBlockKey; -pub use self::polkavm::context::function::block::evmla_data::EVMLAData as PolkaVMFunctionBlockEVMLAData; -pub use self::polkavm::context::function::block::Block as PolkaVMFunctionBlock; pub use self::polkavm::context::function::declaration::Declaration as PolkaVMFunctionDeclaration; -pub use self::polkavm::context::function::evmla_data::EVMLAData as PolkaVMFunctionEVMLAData; pub use self::polkavm::context::function::intrinsics::Intrinsics as PolkaVMIntrinsicFunction; pub use self::polkavm::context::function::llvm_runtime::LLVMRuntime as PolkaVMLLVMRuntime; pub use self::polkavm::context::function::r#return::Return as PolkaVMFunctionReturn; diff --git a/crates/llvm-context/src/polkavm/context/evmla_data.rs b/crates/llvm-context/src/polkavm/context/evmla_data.rs deleted file mode 100644 index f9e27a0..0000000 --- a/crates/llvm-context/src/polkavm/context/evmla_data.rs +++ /dev/null @@ -1,27 +0,0 @@ -//! The LLVM IR generator EVM legacy assembly data. - -use crate::polkavm::context::argument::Argument; - -/// The LLVM IR generator EVM legacy assembly data. -/// Describes some data that is only relevant to the EVM legacy assembly. -#[derive(Debug, Clone)] -pub struct EVMLAData<'ctx> { - /// The Solidity compiler version. - /// Some instruction behave differenly depending on the version. - pub version: semver::Version, - /// The static stack allocated for the current function. - pub stack: Vec>, -} - -impl EVMLAData<'_> { - /// The default stack size. - pub const DEFAULT_STACK_SIZE: usize = 64; - - /// A shortcut constructor. - pub fn new(version: semver::Version) -> Self { - Self { - version, - stack: Vec::with_capacity(Self::DEFAULT_STACK_SIZE), - } - } -} diff --git a/crates/llvm-context/src/polkavm/context/function/block/evmla_data/key.rs b/crates/llvm-context/src/polkavm/context/function/block/evmla_data/key.rs deleted file mode 100644 index d890753..0000000 --- a/crates/llvm-context/src/polkavm/context/function/block/evmla_data/key.rs +++ /dev/null @@ -1,34 +0,0 @@ -//! The LLVM IR generator function block key. - -use crate::polkavm::context::code_type::CodeType; - -/// The LLVM IR generator function block key. -/// Is only relevant to the EVM legacy assembly. -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct Key { - /// The block code type. - pub code_type: CodeType, - /// The block tag. - pub tag: num::BigUint, -} - -impl Key { - /// A shortcut constructor. - pub fn new(code_type: CodeType, tag: num::BigUint) -> Self { - Self { code_type, tag } - } -} - -impl std::fmt::Display for Key { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "{}_{}", - match self.code_type { - CodeType::Deploy => "dt", - CodeType::Runtime => "rt", - }, - self.tag - ) - } -} diff --git a/crates/llvm-context/src/polkavm/context/function/block/evmla_data/mod.rs b/crates/llvm-context/src/polkavm/context/function/block/evmla_data/mod.rs deleted file mode 100644 index dbf18c7..0000000 --- a/crates/llvm-context/src/polkavm/context/function/block/evmla_data/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! The LLVM function block EVM legacy assembly data. - -pub mod key; - -/// The LLVM function block EVM legacy assembly data. -/// Describes some data that is only relevant to the EVM legacy assembly. -#[derive(Debug, Clone)] -pub struct EVMLAData { - /// The initial hashes of the allowed stack states. - pub stack_hashes: Vec, -} - -impl EVMLAData { - /// A shortcut constructor. - pub fn new(stack_hashes: Vec) -> Self { - Self { stack_hashes } - } -} diff --git a/crates/llvm-context/src/polkavm/context/function/block/mod.rs b/crates/llvm-context/src/polkavm/context/function/block/mod.rs deleted file mode 100644 index d8f6ca8..0000000 --- a/crates/llvm-context/src/polkavm/context/function/block/mod.rs +++ /dev/null @@ -1,52 +0,0 @@ -//! The LLVM IR generator function block. - -pub mod evmla_data; - -use self::evmla_data::EVMLAData; - -/// The LLVM IR generator function block. -#[derive(Debug, Clone)] -pub struct Block<'ctx> { - /// The inner block. - inner: inkwell::basic_block::BasicBlock<'ctx>, - /// The EVM legacy assembly compiler data. - evmla_data: Option, -} - -impl<'ctx> Block<'ctx> { - /// A shortcut constructor. - pub fn new(inner: inkwell::basic_block::BasicBlock<'ctx>) -> Self { - Self { - inner, - evmla_data: None, - } - } - - /// Sets the EVM legacy assembly data. - pub fn set_evmla_data(&mut self, data: EVMLAData) { - self.evmla_data = Some(data); - } - - /// The LLVM object reference. - pub fn inner(&self) -> inkwell::basic_block::BasicBlock<'ctx> { - self.inner - } - - /// Returns the EVM data reference. - /// # Panics - /// If the EVM data has not been initialized. - pub fn evm(&self) -> &EVMLAData { - self.evmla_data - .as_ref() - .expect("The EVM data must have been initialized") - } - - /// Returns the EVM data mutable reference. - /// # Panics - /// If the EVM data has not been initialized. - pub fn evm_mut(&mut self) -> &mut EVMLAData { - self.evmla_data - .as_mut() - .expect("The EVM data must have been initialized") - } -} diff --git a/crates/llvm-context/src/polkavm/context/function/evmla_data.rs b/crates/llvm-context/src/polkavm/context/function/evmla_data.rs deleted file mode 100644 index eeb1f32..0000000 --- a/crates/llvm-context/src/polkavm/context/function/evmla_data.rs +++ /dev/null @@ -1,74 +0,0 @@ -//! The LLVM function EVM legacy assembly data. - -use std::collections::BTreeMap; - -use crate::polkavm::context::function::block::evmla_data::key::Key as BlockKey; -use crate::polkavm::context::function::block::Block; - -/// The LLVM function EVM legacy assembly data. -/// Describes some data that is only relevant to the EVM legacy assembly. -#[derive(Debug)] -pub struct EVMLAData<'ctx> { - /// The ordinary blocks with numeric tags. - /// Is only used by the Solidity EVM compiler. - pub blocks: BTreeMap>>, - /// The function stack size. - pub stack_size: usize, -} - -impl<'ctx> EVMLAData<'ctx> { - /// A shortcut constructor. - pub fn new(stack_size: usize) -> Self { - Self { - blocks: BTreeMap::new(), - stack_size, - } - } - - /// Inserts a function block. - pub fn insert_block(&mut self, key: BlockKey, block: Block<'ctx>) { - if let Some(blocks) = self.blocks.get_mut(&key) { - blocks.push(block); - } else { - self.blocks.insert(key, vec![block]); - } - } - - /// Returns the block with the specified tag and initial stack pattern. - /// If there is only one block, it is returned unconditionally. - pub fn find_block( - &self, - key: &BlockKey, - stack_hash: &md5::Digest, - ) -> anyhow::Result> { - if self - .blocks - .get(key) - .ok_or_else(|| anyhow::anyhow!("Undeclared function block {}", key))? - .len() - == 1 - { - return self - .blocks - .get(key) - .ok_or_else(|| anyhow::anyhow!("Undeclared function block {}", key))? - .first() - .cloned() - .ok_or_else(|| anyhow::anyhow!("Undeclared function block {}", key)); - } - - self.blocks - .get(key) - .ok_or_else(|| anyhow::anyhow!("Undeclared function block {}", key))? - .iter() - .find(|block| { - block - .evm() - .stack_hashes - .iter() - .any(|hash| hash == stack_hash) - }) - .cloned() - .ok_or_else(|| anyhow::anyhow!("Undeclared function block {}", key)) - } -} diff --git a/crates/llvm-context/src/polkavm/context/function/mod.rs b/crates/llvm-context/src/polkavm/context/function/mod.rs index 9527e41..4280077 100644 --- a/crates/llvm-context/src/polkavm/context/function/mod.rs +++ b/crates/llvm-context/src/polkavm/context/function/mod.rs @@ -1,8 +1,6 @@ //! The LLVM IR generator function. -pub mod block; pub mod declaration; -pub mod evmla_data; pub mod intrinsics; pub mod llvm_runtime; pub mod r#return; @@ -19,7 +17,6 @@ use crate::polkavm::context::attribute::Attribute; use crate::polkavm::context::pointer::Pointer; use self::declaration::Declaration; -use self::evmla_data::EVMLAData; use self::r#return::Return; use self::yul_data::YulData; @@ -45,8 +42,6 @@ pub struct Function<'ctx> { /// The Yul compiler data. yul_data: Option, - /// The EVM legacy assembly compiler data. - evmla_data: Option>, } impl<'ctx> Function<'ctx> { @@ -72,7 +67,6 @@ impl<'ctx> Function<'ctx> { return_block, yul_data: None, - evmla_data: None, } } @@ -300,29 +294,6 @@ impl<'ctx> Function<'ctx> { self.return_block } - /// Sets the EVM legacy assembly data. - pub fn set_evmla_data(&mut self, data: EVMLAData<'ctx>) { - self.evmla_data = Some(data); - } - - /// Returns the EVM legacy assembly data reference. - /// # Panics - /// If the EVM data has not been initialized. - pub fn evmla(&self) -> &EVMLAData<'ctx> { - self.evmla_data - .as_ref() - .expect("The EVM data must have been initialized") - } - - /// Returns the EVM legacy assembly data mutable reference. - /// # Panics - /// If the EVM data has not been initialized. - pub fn evmla_mut(&mut self) -> &mut EVMLAData<'ctx> { - self.evmla_data - .as_mut() - .expect("The EVM data must have been initialized") - } - /// Sets the Yul data. pub fn set_yul_data(&mut self, data: YulData) { self.yul_data = Some(data); diff --git a/crates/llvm-context/src/polkavm/context/mod.rs b/crates/llvm-context/src/polkavm/context/mod.rs index 3fc45e4..502371e 100644 --- a/crates/llvm-context/src/polkavm/context/mod.rs +++ b/crates/llvm-context/src/polkavm/context/mod.rs @@ -6,7 +6,6 @@ pub mod attribute; pub mod build; pub mod code_type; pub mod debug_info; -pub mod evmla_data; pub mod function; pub mod global; pub mod r#loop; @@ -38,7 +37,6 @@ use self::attribute::Attribute; use self::build::Build; use self::code_type::CodeType; use self::debug_info::DebugInfo; -use self::evmla_data::EVMLAData; use self::function::declaration::Declaration as FunctionDeclaration; use self::function::intrinsics::Intrinsics; use self::function::llvm_runtime::LLVMRuntime; @@ -95,8 +93,6 @@ where solidity_data: Option, /// The Yul data. yul_data: Option, - /// The EVM legacy assembly data. - evmla_data: Option>, } impl<'ctx, D> Context<'ctx, D> @@ -257,7 +253,6 @@ where solidity_data: None, yul_data: None, - evmla_data: None, } } @@ -1339,11 +1334,17 @@ where self.llvm.custom_width_int_type(bit_length as u32) } - /// Returns the register witdh sized type. + /// Returns the XLEN witdh sized type. pub fn xlen_type(&self) -> inkwell::types::IntType<'ctx> { self.llvm.custom_width_int_type(crate::polkavm::XLEN as u32) } + /// Returns the PolkaVM native register width sized type. + pub fn register_type(&self) -> inkwell::types::IntType<'ctx> { + self.llvm + .custom_width_int_type(revive_common::BIT_LENGTH_X64 as u32) + } + /// Returns the sentinel pointer value. pub fn sentinel_pointer(&self) -> Pointer<'ctx> { let sentinel_pointer = self @@ -1568,29 +1569,6 @@ where .expect("The Yul data must have been initialized") } - /// Sets the EVM legacy assembly data. - pub fn set_evmla_data(&mut self, data: EVMLAData<'ctx>) { - self.evmla_data = Some(data); - } - - /// Returns the EVM legacy assembly data reference. - /// # Panics - /// If the EVM data has not been initialized. - pub fn evmla(&self) -> &EVMLAData<'ctx> { - self.evmla_data - .as_ref() - .expect("The EVMLA data must have been initialized") - } - - /// Returns the EVM legacy assembly data mutable reference. - /// # Panics - /// If the EVM data has not been initialized. - pub fn evmla_mut(&mut self) -> &mut EVMLAData<'ctx> { - self.evmla_data - .as_mut() - .expect("The EVMLA data must have been initialized") - } - /// Returns the current number of immutables values in the contract. /// If the size is set manually, then it is returned. Otherwise, the number of elements in /// the identifier-to-offset mapping tree is returned. diff --git a/crates/llvm-context/src/polkavm/evm/call.rs b/crates/llvm-context/src/polkavm/evm/call.rs index 88332e0..e5d1c5f 100644 --- a/crates/llvm-context/src/polkavm/evm/call.rs +++ b/crates/llvm-context/src/polkavm/evm/call.rs @@ -8,6 +8,7 @@ use crate::polkavm::Dependency; const STATIC_CALL_FLAG: u32 = 0b0001_0000; const REENTRANT_CALL_FLAG: u32 = 0b0000_1000; +const SOLIDITY_TRANSFER_GAS_STIPEND_THRESHOLD: u64 = 2300; /// Translates a contract call. #[allow(clippy::too_many_arguments)] @@ -37,60 +38,67 @@ where let output_offset = context.safe_truncate_int_to_xlen(output_offset)?; let output_length = context.safe_truncate_int_to_xlen(output_length)?; - // 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 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.build_alloca_at_entry(context.xlen_type(), "output_length"); context.build_store(output_length_pointer, output_length)?; - let deposit_pointer = context.build_alloca_at_entry(context.word_type(), "deposit_pointer"); - context.build_store(deposit_pointer, context.word_type().const_all_ones())?; - - let flags = if static_call { - REENTRANT_CALL_FLAG | STATIC_CALL_FLAG + let (flags, deposit_limit_value) = if static_call { + let flags = REENTRANT_CALL_FLAG | STATIC_CALL_FLAG; + ( + context.xlen_type().const_int(flags as u64, false), + context.word_type().const_zero(), + ) } else { - REENTRANT_CALL_FLAG + call_reentrancy_heuristic(context, gas, input_length, output_length)? }; - 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(revive_common::BIT_LENGTH_X64, u64::MAX) - .as_basic_value_enum(), - context - .integer_const(revive_common::BIT_LENGTH_X64, u64::MAX) - .as_basic_value_enum(), - deposit_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( + let deposit_pointer = context.build_alloca_at_entry(context.word_type(), "deposit_pointer"); + context.build_store(deposit_pointer, deposit_limit_value)?; + + let flags_and_callee = revive_runtime_api::calling_convention::pack_hi_lo_reg( context.builder(), - argument_pointer.value, - argument_type, - arguments, + context.llvm(), + flags, + address_pointer.to_int(context), + "address_and_callee", + )?; + let deposit_and_value = revive_runtime_api::calling_convention::pack_hi_lo_reg( + context.builder(), + context.llvm(), + deposit_pointer.to_int(context), + value_pointer.to_int(context), + "deposit_and_value", + )?; + let input_data = revive_runtime_api::calling_convention::pack_hi_lo_reg( + context.builder(), + context.llvm(), + input_length, + input_pointer.to_int(context), + "input_data", + )?; + let output_data = revive_runtime_api::calling_convention::pack_hi_lo_reg( + context.builder(), + context.llvm(), + output_length_pointer.to_int(context), + output_pointer.to_int(context), + "output_data", )?; let name = revive_runtime_api::polkavm_imports::CALL; - let argument_pointer = context.builder().build_ptr_to_int( - argument_pointer.value, - context.xlen_type(), - "call_argument_pointer", - )?; let success = context - .build_runtime_call(name, &[argument_pointer.into()]) + .build_runtime_call( + name, + &[ + flags_and_callee.into(), + context.register_type().const_all_ones().into(), + context.register_type().const_all_ones().into(), + deposit_and_value.into(), + input_data.into(), + output_data.into(), + ], + ) .unwrap_or_else(|| panic!("{name} should return a value")) .into_int_value(); @@ -110,7 +118,7 @@ where #[allow(clippy::too_many_arguments)] pub fn delegate_call<'ctx, D>( context: &mut Context<'ctx, D>, - gas: inkwell::values::IntValue<'ctx>, + _gas: inkwell::values::IntValue<'ctx>, address: inkwell::values::IntValue<'ctx>, input_offset: inkwell::values::IntValue<'ctx>, input_length: inkwell::values::IntValue<'ctx>, @@ -128,11 +136,6 @@ where let output_offset = context.safe_truncate_int_to_xlen(output_offset)?; let output_length = context.safe_truncate_int_to_xlen(output_length)?; - // 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 input_pointer = context.build_heap_gep(input_offset, input_length)?; let output_pointer = context.build_heap_gep(output_offset, output_length)?; @@ -144,38 +147,41 @@ where let flags = context.xlen_type().const_int(0u64, false); - let argument_type = revive_runtime_api::calling_convention::delegate_call(context.llvm()); - let argument_pointer = context.build_alloca_at_entry(argument_type, "delegate_call_arguments"); - let arguments = &[ - flags.as_basic_value_enum(), - address_pointer.value.as_basic_value_enum(), - context - .integer_const(revive_common::BIT_LENGTH_X64, u64::MAX) - .as_basic_value_enum(), - context - .integer_const(revive_common::BIT_LENGTH_X64, u64::MAX) - .as_basic_value_enum(), - deposit_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( + let flags_and_callee = revive_runtime_api::calling_convention::pack_hi_lo_reg( context.builder(), - argument_pointer.value, - argument_type, - arguments, + context.llvm(), + flags, + address_pointer.to_int(context), + "address_and_callee", + )?; + let input_data = revive_runtime_api::calling_convention::pack_hi_lo_reg( + context.builder(), + context.llvm(), + input_length, + input_pointer.to_int(context), + "input_data", + )?; + let output_data = revive_runtime_api::calling_convention::pack_hi_lo_reg( + context.builder(), + context.llvm(), + output_length_pointer.to_int(context), + output_pointer.to_int(context), + "output_data", )?; let name = revive_runtime_api::polkavm_imports::DELEGATE_CALL; - let argument_pointer = context.builder().build_ptr_to_int( - argument_pointer.value, - context.xlen_type(), - "delegate_call_argument_pointer", - )?; let success = context - .build_runtime_call(name, &[argument_pointer.into()]) + .build_runtime_call( + name, + &[ + flags_and_callee.into(), + context.register_type().const_all_ones().into(), + context.register_type().const_all_ones().into(), + deposit_pointer.to_int(context).into(), + input_data.into(), + output_data.into(), + ], + ) .unwrap_or_else(|| panic!("{name} should return a value")) .into_int_value(); @@ -209,3 +215,86 @@ where .resolve_library(path.as_str())? .as_basic_value_enum()) } + +/// The Solidity `address.transfer` and `address.send` call detection heuristic. +/// +/// # Why +/// This heuristic is an additional security feature to guard against re-entrancy attacks +/// in case contract authors violate Solidity best practices and use `address.transfer` or +/// `address.send`. +/// While contract authors are supposed to never use `address.transfer` or `address.send`, +/// for a small cost we can be extra defensive about it. +/// +/// # How +/// The gas stipend emitted by solc for `transfer` and `send` is not static, thus: +/// - Dynamically allow re-entrancy only for calls considered not transfer or send. +/// - Detected balance transfers will supply 0 deposit limit instead of `u256::MAX`. +/// +/// Calls are considered transfer or send if: +/// - (Input length | Output lenght) == 0; +/// - Gas <= 2300; +/// +/// # Returns +/// The call flags xlen `IntValue` and the deposit limit word `IntValue`. +fn call_reentrancy_heuristic<'ctx, D>( + context: &mut Context<'ctx, D>, + gas: inkwell::values::IntValue<'ctx>, + input_length: inkwell::values::IntValue<'ctx>, + output_length: inkwell::values::IntValue<'ctx>, +) -> anyhow::Result<( + inkwell::values::IntValue<'ctx>, + inkwell::values::IntValue<'ctx>, +)> +where + D: Dependency + Clone, +{ + // Branch-free SSA implementation: First derive the heuristic boolean (int1) value. + let input_length_or_output_length = + context + .builder() + .build_or(input_length, output_length, "input_length_or_output_length")?; + let is_no_input_no_output = context.builder().build_int_compare( + inkwell::IntPredicate::EQ, + context.xlen_type().const_zero(), + input_length_or_output_length, + "is_no_input_no_output", + )?; + let gas_stipend = context + .word_type() + .const_int(SOLIDITY_TRANSFER_GAS_STIPEND_THRESHOLD, false); + let is_gas_stipend_for_transfer_or_send = context.builder().build_int_compare( + inkwell::IntPredicate::ULE, + gas, + gas_stipend, + "is_gas_stipend_for_transfer_or_send", + )?; + let is_balance_transfer = context.builder().build_and( + is_no_input_no_output, + is_gas_stipend_for_transfer_or_send, + "is_balance_transfer", + )?; + let is_regular_call = context + .builder() + .build_not(is_balance_transfer, "is_balance_transfer_inverted")?; + + // Call flag: Left shift the heuristic boolean value. + let is_regular_call_xlen = context.builder().build_int_z_extend( + is_regular_call, + context.xlen_type(), + "is_balance_transfer_xlen", + )?; + let call_flags = context.builder().build_left_shift( + is_regular_call_xlen, + context.xlen_type().const_int(3, false), + "flags", + )?; + + // Deposit limit value: Sign-extended the heuristic boolean value. + let deposit_limit_value = context.builder().build_int_s_extend( + is_regular_call, + context.word_type(), + "deposit_limit_value", + )?; + + Ok((call_flags, deposit_limit_value)) +} diff --git a/crates/llvm-context/src/polkavm/evm/context.rs b/crates/llvm-context/src/polkavm/evm/context.rs index fc6c5d3..8a90e30 100644 --- a/crates/llvm-context/src/polkavm/evm/context.rs +++ b/crates/llvm-context/src/polkavm/evm/context.rs @@ -122,12 +122,20 @@ where /// Translates the `coinbase` instruction. pub fn coinbase<'ctx, D>( - _context: &mut Context<'ctx, D>, + context: &mut Context<'ctx, D>, ) -> anyhow::Result> where D: Dependency + Clone, { - todo!() + let pointer = context.build_alloca_at_entry( + context.integer_type(revive_common::BIT_LENGTH_ETH_ADDRESS), + "coinbase_output", + ); + context.build_runtime_call( + revive_runtime_api::polkavm_imports::BLOCK_AUTHOR, + &[pointer.to_int(context).into()], + ); + context.build_load_address(pointer) } /// Translates the `basefee` instruction. diff --git a/crates/llvm-context/src/polkavm/evm/create.rs b/crates/llvm-context/src/polkavm/evm/create.rs index 7632ac5..7d60b7a 100644 --- a/crates/llvm-context/src/polkavm/evm/create.rs +++ b/crates/llvm-context/src/polkavm/evm/create.rs @@ -26,15 +26,6 @@ where let code_hash_pointer = context.build_heap_gep(input_offset, input_length)?; - let input_data_pointer = context.build_gep( - code_hash_pointer, - &[context - .xlen_type() - .const_int(revive_common::BYTE_LENGTH_WORD as u64, false)], - context.byte_type(), - "input_ptr_parameter_offset", - ); - let value_pointer = context.build_alloca_at_entry(context.value_type(), "transferred_value"); context.build_store(value_pointer, value)?; @@ -56,40 +47,38 @@ where let deposit_pointer = context.build_alloca_at_entry(context.word_type(), "deposit_pointer"); context.build_store(deposit_pointer, context.word_type().const_all_ones())?; - 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(revive_common::BIT_LENGTH_X64, u64::MAX) - .as_basic_value_enum(), - context - .integer_const(revive_common::BIT_LENGTH_X64, u64::MAX) - .as_basic_value_enum(), - deposit_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( + let deposit_and_value = revive_runtime_api::calling_convention::pack_hi_lo_reg( context.builder(), - argument_pointer.value, - argument_type, - arguments, + context.llvm(), + deposit_pointer.to_int(context), + value_pointer.to_int(context), + "deposit_and_value", + )?; + let input_data = revive_runtime_api::calling_convention::pack_hi_lo_reg( + context.builder(), + context.llvm(), + input_length, + code_hash_pointer.to_int(context), + "input_data", + )?; + let address_and_salt = revive_runtime_api::calling_convention::pack_hi_lo_reg( + context.builder(), + context.llvm(), + address_pointer.to_int(context), + salt_pointer.to_int(context), + "output_data", )?; - let argument_pointer = context.builder().build_ptr_to_int( - argument_pointer.value, - context.xlen_type(), - "instantiate_argument_pointer", - )?; context.build_runtime_call( revive_runtime_api::polkavm_imports::INSTANTIATE, - &[argument_pointer.into()], + &[ + context.register_type().const_all_ones().into(), + context.register_type().const_all_ones().into(), + deposit_and_value.into(), + input_data.into(), + context.register_type().const_all_ones().into(), + address_and_salt.into(), + ], ); let address = context.build_byte_swap(context.build_load(address_pointer, "address")?)?; diff --git a/crates/llvm-context/src/polkavm/mod.rs b/crates/llvm-context/src/polkavm/mod.rs index f1d7037..f60857d 100644 --- a/crates/llvm-context/src/polkavm/mod.rs +++ b/crates/llvm-context/src/polkavm/mod.rs @@ -59,7 +59,6 @@ pub fn build_assembly_text( } /// Implemented by items which are translated into LLVM IR. -#[allow(clippy::upper_case_acronyms)] pub trait WriteLLVM where D: Dependency + Clone, diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index f648d62..dd58a3d 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -85,6 +85,7 @@ impl ExtBuilder { .unwrap(); pallet_balances::GenesisConfig:: { balances: self.balance_genesis_config, + dev_accounts: None, } .assimilate_storage(&mut t) .unwrap(); @@ -238,7 +239,6 @@ pub enum Code { Solidity { path: Option, solc_optimizer: Option, - pipeline: Option, contract: String, }, /// Read the contract blob from disk @@ -263,7 +263,6 @@ impl From for pallet_revive::Code { path, contract, solc_optimizer, - pipeline, } => { let Some(path) = path else { panic!("Solidity source of contract '{contract}' missing path"); @@ -275,7 +274,6 @@ impl From for pallet_revive::Code { &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()), diff --git a/crates/runner/src/runtime.rs b/crates/runner/src/runtime.rs index d351d40..d0d82ad 100644 --- a/crates/runner/src/runtime.rs +++ b/crates/runner/src/runtime.rs @@ -1,5 +1,4 @@ -use frame_support::{runtime, weights::constants::WEIGHT_REF_TIME_PER_SECOND}; - +use frame_support::{runtime, traits::FindAuthor, weights::constants::WEIGHT_REF_TIME_PER_SECOND}; use pallet_revive::AccountId32Mapper; use polkadot_sdk::*; use polkadot_sdk::{ @@ -11,8 +10,6 @@ pub type Balance = u128; pub type AccountId = pallet_revive::AccountId32Mapper; pub type Block = frame_system::mocking::MockBlock; pub type Hash = ::Hash; -pub type EventRecord = - frame_system::EventRecord<::RuntimeEvent, Hash>; #[runtime] mod runtime { @@ -26,7 +23,8 @@ mod runtime { RuntimeHoldReason, RuntimeSlashReason, RuntimeLockId, - RuntimeTask + RuntimeTask, + RuntimeViewFunction )] pub struct Runtime; @@ -87,6 +85,15 @@ impl pallet_revive::Config for Runtime { type UploadOrigin = EnsureSigned; type InstantiateOrigin = EnsureSigned; type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent; - type Debug = (); type ChainId = ConstU64<420_420_420>; + type FindAuthor = Self; +} + +impl FindAuthor<::AccountId> for Runtime { + fn find_author<'a, I>(_digests: I) -> Option<::AccountId> + where + I: 'a + IntoIterator, + { + Some([0xff; 32].into()) + } } diff --git a/crates/runner/src/specs.rs b/crates/runner/src/specs.rs index c61a423..403ead0 100644 --- a/crates/runner/src/specs.rs +++ b/crates/runner/src/specs.rs @@ -282,17 +282,11 @@ impl Specs { 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" diff --git a/crates/runtime-api/src/calling_convention.rs b/crates/runtime-api/src/calling_convention.rs index 3cf9e85..d480422 100644 --- a/crates/runtime-api/src/calling_convention.rs +++ b/crates/runtime-api/src/calling_convention.rs @@ -1,10 +1,4 @@ -use inkwell::{ - builder::Builder, - context::Context, - module::Module, - types::{BasicType, StructType}, - values::{BasicValueEnum, PointerValue}, -}; +use inkwell::{builder::Builder, context::Context, module::Module, values::IntValue}; /// Creates a module that sets the PolkaVM minimum stack size to [`size`] if linked in. pub fn min_stack_size<'context>( @@ -21,115 +15,23 @@ pub fn min_stack_size<'context>( 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>( +/// Helper for packing two 32 bit integer values into a 64 bit integer value. +pub fn pack_hi_lo_reg<'ctx>( builder: &Builder<'ctx>, - pointer: PointerValue<'ctx>, - r#type: StructType<'ctx>, - arguments: &[BasicValueEnum<'ctx>], -) -> anyhow::Result<()> { - for index in 0..r#type.get_field_types().len() { - let field_pointer = builder.build_struct_gep( - r#type, - pointer, - index as u32, - &format!("spill_parameter_{}", index), - )?; - 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)?; - } + context: &'ctx Context, + hi: IntValue<'ctx>, + lo: IntValue<'ctx>, + name: &str, +) -> anyhow::Result> { + assert_eq!(hi.get_type(), context.i32_type()); + assert_eq!(lo.get_type(), context.i32_type()); - Ok(()) -} - -/// Returns a packed struct argument type for the `instantiate` API. -pub fn instantiate(context: &Context) -> StructType { - context.struct_type( - &[ - // code_hash_ptr: u32, - context.i32_type().as_basic_type_enum(), - // ref_time_limit: u64, - context.i64_type().as_basic_type_enum(), - // proof_size_limit: u64, - context.i64_type().as_basic_type_enum(), - // deposit_ptr: u32, - context.i32_type().as_basic_type_enum(), - // value_ptr: u32, - context.i32_type().as_basic_type_enum(), - // input_data_ptr: u32, - context.i32_type().as_basic_type_enum(), - // input_data_len: u32, - context.i32_type().as_basic_type_enum(), - // address_ptr: u32, - context.i32_type().as_basic_type_enum(), - // output_ptr: u32, - context.i32_type().as_basic_type_enum(), - // output_len_ptr: u32, - context.i32_type().as_basic_type_enum(), - // salt_ptr: u32, - context.i32_type().as_basic_type_enum(), - ], - false, - ) -} - -/// Returns a packed struct argument type for the `call` API. -pub fn call(context: &Context) -> StructType { - context.struct_type( - &[ - // flags: u32, - context.i32_type().as_basic_type_enum(), - // address_ptr: - context.i32_type().as_basic_type_enum(), - // ref_time_limit: u64, - context.i64_type().as_basic_type_enum(), - // proof_size_limit: u64, - context.i64_type().as_basic_type_enum(), - // deposit_ptr: u32, - context.i32_type().as_basic_type_enum(), - // value_ptr: u32, - context.i32_type().as_basic_type_enum(), - // input_data_ptr: u32, - context.i32_type().as_basic_type_enum(), - // input_data_len: u32, - context.i32_type().as_basic_type_enum(), - // output_ptr: u32, - context.i32_type().as_basic_type_enum(), - // output_len_ptr: u32, - context.i32_type().as_basic_type_enum(), - ], - false, - ) -} - -/// Returns a packed struct argument type for the `delegate_call` API. -pub fn delegate_call(context: &Context) -> StructType { - context.struct_type( - &[ - // flags: u32, - context.i32_type().as_basic_type_enum(), - // address_ptr: - context.i32_type().as_basic_type_enum(), - // ref_time_limit: u64, - context.i64_type().as_basic_type_enum(), - // proof_size_limit: u64, - context.i64_type().as_basic_type_enum(), - // deposit_ptr: u32, - context.i32_type().as_basic_type_enum(), - // input_data_ptr: u32, - context.i32_type().as_basic_type_enum(), - // input_data_len: u32, - context.i32_type().as_basic_type_enum(), - // output_ptr: u32, - context.i32_type().as_basic_type_enum(), - // output_len_ptr: u32, - context.i32_type().as_basic_type_enum(), - ], - false, - ) + let lo_part = builder.build_int_z_extend(lo, context.i64_type(), &format!("{name}_lo_part"))?; + let hi_part = builder.build_int_z_extend(hi, context.i64_type(), &format!("{name}_hi_part"))?; + let hi_part_shifted = builder.build_left_shift( + hi_part, + context.i64_type().const_int(32, false), + &format!("{name}_hi_part_shifted"), + )?; + Ok(builder.build_or(hi_part_shifted, lo_part, name)?) } diff --git a/crates/runtime-api/src/polkavm_imports.c b/crates/runtime-api/src/polkavm_imports.c index 9e6eab6..e101fb8 100644 --- a/crates/runtime-api/src/polkavm_imports.c +++ b/crates/runtime-api/src/polkavm_imports.c @@ -72,11 +72,13 @@ POLKAVM_IMPORT(void, balance_of, uint32_t, uint32_t) POLKAVM_IMPORT(void, base_fee, uint32_t) +POLKAVM_IMPORT(void, block_author, uint32_t) + POLKAVM_IMPORT(void, block_hash, uint32_t, uint32_t) POLKAVM_IMPORT(void, block_number, uint32_t) -POLKAVM_IMPORT(uint64_t, call, uint32_t) +POLKAVM_IMPORT(uint64_t, call, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t) POLKAVM_IMPORT(uint64_t, call_data_copy, uint32_t, uint32_t, uint32_t) @@ -92,7 +94,7 @@ POLKAVM_IMPORT(uint64_t, code_size, uint32_t) POLKAVM_IMPORT(void, code_hash, uint32_t, uint32_t) -POLKAVM_IMPORT(uint64_t, delegate_call, uint32_t) +POLKAVM_IMPORT(uint64_t, delegate_call, uint64_t, uint64_t, uint64_t, uint32_t, uint64_t, uint64_t) POLKAVM_IMPORT(void, deposit_event, uint32_t, uint32_t, uint32_t, uint32_t) @@ -106,7 +108,7 @@ POLKAVM_IMPORT(uint64_t, get_storage, uint32_t, uint32_t, uint32_t, uint32_t, ui POLKAVM_IMPORT(void, hash_keccak_256, uint32_t, uint32_t, uint32_t) -POLKAVM_IMPORT(uint64_t, instantiate, uint32_t) +POLKAVM_IMPORT(uint64_t, instantiate, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t) POLKAVM_IMPORT(void, now, uint32_t) diff --git a/crates/runtime-api/src/polkavm_imports.rs b/crates/runtime-api/src/polkavm_imports.rs index be40232..a14a12b 100644 --- a/crates/runtime-api/src/polkavm_imports.rs +++ b/crates/runtime-api/src/polkavm_imports.rs @@ -22,6 +22,8 @@ pub static BALANCE_OF: &str = "balance_of"; pub static BASE_FEE: &str = "base_fee"; +pub static BLOCK_AUTHOR: &str = "block_author"; + pub static BLOCK_HASH: &str = "block_hash"; pub static BLOCK_NUMBER: &str = "block_number"; @@ -80,13 +82,14 @@ pub static WEIGHT_TO_FEE: &str = "weight_to_fee"; /// All imported runtime API symbols. /// Useful for configuring common attributes and linkage. -pub static IMPORTS: [&str; 34] = [ +pub static IMPORTS: [&str; 35] = [ SBRK, MEMORY_SIZE, ADDRESS, BALANCE, BALANCE_OF, BASE_FEE, + BLOCK_AUTHOR, BLOCK_HASH, BLOCK_NUMBER, CALL, diff --git a/crates/solidity/Cargo.toml b/crates/solidity/Cargo.toml index 410eac1..e2bc150 100644 --- a/crates/solidity/Cargo.toml +++ b/crates/solidity/Cargo.toml @@ -33,7 +33,6 @@ regex = { workspace = true } hex = { workspace = true } num = { workspace = true } sha3 = { workspace = true } -md5 = { workspace = true } inkwell = { workspace = true } revive-common = { workspace = true } diff --git a/crates/solidity/src/build/contract.rs b/crates/solidity/src/build/contract.rs index 8f92552..b2d75ed 100644 --- a/crates/solidity/src/build/contract.rs +++ b/crates/solidity/src/build/contract.rs @@ -64,7 +64,7 @@ impl Contract { file_path.push(file_name); if file_path.exists() && !overwrite { - eprintln!( + anyhow::bail!( "Refusing to overwrite an existing file {file_path:?} (use --overwrite to force)." ); } else { @@ -87,7 +87,7 @@ impl Contract { file_path.push(file_name); if file_path.exists() && !overwrite { - eprintln!( + anyhow::bail!( "Refusing to overwrite an existing file {file_path:?} (use --overwrite to force)." ); } else { diff --git a/crates/solidity/src/const.rs b/crates/solidity/src/const.rs index bec342d..519584a 100644 --- a/crates/solidity/src/const.rs +++ b/crates/solidity/src/const.rs @@ -1,7 +1,5 @@ //! Solidity to PolkaVM compiler constants. -#![allow(dead_code)] - /// The default executable name. pub static DEFAULT_EXECUTABLE_NAME: &str = "resolc"; diff --git a/crates/solidity/src/evmla/assembly/data.rs b/crates/solidity/src/evmla/assembly/data.rs deleted file mode 100644 index f9ad0df..0000000 --- a/crates/solidity/src/evmla/assembly/data.rs +++ /dev/null @@ -1,67 +0,0 @@ -//! The inner JSON legacy assembly code element. - -use std::collections::HashSet; - -use serde::Deserialize; -use serde::Serialize; - -use crate::evmla::assembly::Assembly; - -/// The inner JSON legacy assembly code element. -#[derive(Debug, Deserialize, Serialize, Clone)] -#[serde(untagged)] -pub enum Data { - /// The assembly code wrapper. - Assembly(Assembly), - /// The hash. - Hash(String), - /// The full contract path after the factory dependencies replacing pass. - Path(String), -} - -impl Data { - /// Returns the inner assembly reference if it is present. - pub fn get_assembly(&self) -> Option<&Assembly> { - match self { - Self::Assembly(ref assembly) => Some(assembly), - Self::Hash(_) => None, - Self::Path(_) => None, - } - } - /// Returns the inner assembly mutable reference if it is present. - pub fn get_assembly_mut(&mut self) -> Option<&mut Assembly> { - match self { - Self::Assembly(ref mut assembly) => Some(assembly), - Self::Hash(_) => None, - Self::Path(_) => None, - } - } - - /// Get the list of missing deployable libraries. - pub fn get_missing_libraries(&self) -> HashSet { - match self { - Self::Assembly(assembly) => assembly.get_missing_libraries(), - Self::Hash(_) => HashSet::new(), - Self::Path(_) => HashSet::new(), - } - } - - /// Gets the contract `keccak256` hash. - pub fn keccak256(&self) -> String { - match self { - Self::Assembly(assembly) => assembly.keccak256(), - Self::Hash(hash) => panic!("Expected assembly, found hash `{hash}`"), - Self::Path(path) => panic!("Expected assembly, found path `{path}`"), - } - } -} - -impl std::fmt::Display for Data { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Assembly(inner) => writeln!(f, "{inner}"), - Self::Hash(inner) => writeln!(f, "Hash `{inner}`"), - Self::Path(inner) => writeln!(f, "Path `{inner}`"), - } - } -} diff --git a/crates/solidity/src/evmla/assembly/instruction/codecopy.rs b/crates/solidity/src/evmla/assembly/instruction/codecopy.rs deleted file mode 100644 index 33d7aeb..0000000 --- a/crates/solidity/src/evmla/assembly/instruction/codecopy.rs +++ /dev/null @@ -1,79 +0,0 @@ -//! Translates the CODECOPY use cases. - -/// Translates the contract hash copying. -pub fn contract_hash<'ctx, D>( - context: &mut revive_llvm_context::PolkaVMContext<'ctx, D>, - offset: inkwell::values::IntValue<'ctx>, - value: inkwell::values::IntValue<'ctx>, -) -> anyhow::Result<()> -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - let offset = context.builder().build_int_add( - offset, - context - .word_const((revive_common::BYTE_LENGTH_X32 + revive_common::BYTE_LENGTH_WORD) as u64), - "datacopy_contract_hash_offset", - )?; - - revive_llvm_context::polkavm_evm_memory::store(context, offset, value)?; - - Ok(()) -} - -/// Translates the library marker copying. -pub fn library_marker( - context: &mut revive_llvm_context::PolkaVMContext, - offset: u64, - value: u64, -) -> anyhow::Result<()> -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - revive_llvm_context::polkavm_evm_memory::store_byte( - context, - context.word_const(offset), - context.word_const(value), - )?; - - Ok(()) -} - -/// Translates the static data copying. -pub fn static_data<'ctx, D>( - context: &mut revive_llvm_context::PolkaVMContext<'ctx, D>, - destination: inkwell::values::IntValue<'ctx>, - source: &str, -) -> anyhow::Result<()> -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - let mut offset = 0; - for (index, chunk) in source - .chars() - .collect::>() - .chunks(revive_common::BYTE_LENGTH_WORD * 2) - .enumerate() - { - let mut value_string = chunk.iter().collect::(); - value_string.push_str( - "0".repeat((revive_common::BYTE_LENGTH_WORD * 2) - chunk.len()) - .as_str(), - ); - - let datacopy_destination = context.builder().build_int_add( - destination, - context.word_const(offset as u64), - format!("datacopy_destination_index_{index}").as_str(), - )?; - let datacopy_value = context.word_const_str_hex(value_string.as_str()); - revive_llvm_context::polkavm_evm_memory::store( - context, - datacopy_destination, - datacopy_value, - )?; - offset += chunk.len() / 2; - } - - Ok(()) -} diff --git a/crates/solidity/src/evmla/assembly/instruction/jump.rs b/crates/solidity/src/evmla/assembly/instruction/jump.rs deleted file mode 100644 index 5ca34f6..0000000 --- a/crates/solidity/src/evmla/assembly/instruction/jump.rs +++ /dev/null @@ -1,69 +0,0 @@ -//! Translates the jump operations. - -/// Translates the unconditional jump. -pub fn unconditional( - context: &mut revive_llvm_context::PolkaVMContext, - destination: num::BigUint, - stack_hash: md5::Digest, -) -> anyhow::Result<()> -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - let code_type = context - .code_type() - .ok_or_else(|| anyhow::anyhow!("The contract code part type is undefined"))?; - let block_key = revive_llvm_context::PolkaVMFunctionBlockKey::new(code_type, destination); - - let block = context - .current_function() - .borrow() - .evmla() - .find_block(&block_key, &stack_hash)?; - context.build_unconditional_branch(block.inner()); - - Ok(()) -} - -/// Translates the conditional jump. -pub fn conditional( - context: &mut revive_llvm_context::PolkaVMContext, - destination: num::BigUint, - stack_hash: md5::Digest, - stack_height: usize, -) -> anyhow::Result<()> -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - let code_type = context - .code_type() - .ok_or_else(|| anyhow::anyhow!("The contract code part type is undefined"))?; - let block_key = revive_llvm_context::PolkaVMFunctionBlockKey::new(code_type, destination); - - let condition_pointer = context.evmla().stack[stack_height] - .to_llvm() - .into_pointer_value(); - let condition = context.build_load( - revive_llvm_context::PolkaVMPointer::new_stack_field(context, condition_pointer), - format!("conditional_{block_key}_condition").as_str(), - )?; - let condition = context.builder().build_int_compare( - inkwell::IntPredicate::NE, - condition.into_int_value(), - context.word_const(0), - format!("conditional_{block_key}_condition_compared").as_str(), - )?; - - let then_block = context - .current_function() - .borrow() - .evmla() - .find_block(&block_key, &stack_hash)?; - let join_block = - context.append_basic_block(format!("conditional_{block_key}_join_block").as_str()); - - context.build_conditional_branch(condition, then_block.inner(), join_block)?; - - context.set_basic_block(join_block); - - Ok(()) -} diff --git a/crates/solidity/src/evmla/assembly/instruction/mod.rs b/crates/solidity/src/evmla/assembly/instruction/mod.rs deleted file mode 100644 index 7cd54b2..0000000 --- a/crates/solidity/src/evmla/assembly/instruction/mod.rs +++ /dev/null @@ -1,382 +0,0 @@ -//! The EVM instruction. - -pub mod codecopy; -pub mod jump; -pub mod name; -pub mod stack; - -use std::collections::BTreeMap; - -use serde::Deserialize; -use serde::Serialize; - -use self::name::Name; - -/// The EVM instruction. -#[derive(Debug, Deserialize, Serialize, Clone)] -pub struct Instruction { - /// The opcode or tag identifier. - pub name: Name, - /// The optional value argument. - pub value: Option, - - /// The source code identifier. - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, - /// The source code location begin. - pub begin: isize, - /// The source code location end. - pub end: isize, -} - -impl Instruction { - /// Returns the number of input stack arguments. - pub const fn input_size(&self, version: &semver::Version) -> usize { - match self.name { - Name::POP => 1, - - Name::JUMP => 1, - Name::JUMPI => 2, - - Name::ADD => 2, - Name::SUB => 2, - Name::MUL => 2, - Name::DIV => 2, - Name::MOD => 2, - Name::SDIV => 2, - Name::SMOD => 2, - - Name::LT => 2, - Name::GT => 2, - Name::EQ => 2, - Name::ISZERO => 1, - Name::SLT => 2, - Name::SGT => 2, - - Name::OR => 2, - Name::XOR => 2, - Name::NOT => 1, - Name::AND => 2, - Name::SHL => 2, - Name::SHR => 2, - Name::SAR => 2, - Name::BYTE => 2, - - Name::ADDMOD => 3, - Name::MULMOD => 3, - Name::EXP => 2, - Name::SIGNEXTEND => 2, - Name::SHA3 => 2, - Name::KECCAK256 => 2, - - Name::MLOAD => 1, - Name::MSTORE => 2, - Name::MSTORE8 => 2, - Name::MCOPY => 3, - - Name::SLOAD => 1, - Name::SSTORE => 2, - Name::TLOAD => 1, - Name::TSTORE => 2, - Name::PUSHIMMUTABLE => 0, - Name::ASSIGNIMMUTABLE => { - if version.minor >= 8 { - 2 - } else { - 1 - } - } - - Name::CALLDATALOAD => 1, - Name::CALLDATACOPY => 3, - Name::CODECOPY => 3, - Name::RETURNDATACOPY => 3, - Name::EXTCODESIZE => 1, - Name::EXTCODEHASH => 1, - - Name::CALL => 7, - Name::CALLCODE => 7, - Name::STATICCALL => 6, - Name::DELEGATECALL => 6, - - Name::RETURN => 2, - Name::REVERT => 2, - Name::SELFDESTRUCT => 1, - - Name::LOG0 => 2, - Name::LOG1 => 3, - Name::LOG2 => 4, - Name::LOG3 => 5, - Name::LOG4 => 6, - - Name::CREATE => 3, - Name::CREATE2 => 4, - - Name::ZK_CREATE => 3, - Name::ZK_CREATE2 => 4, - - Name::BALANCE => 1, - - Name::BLOCKHASH => 1, - Name::BLOBHASH => 1, - - Name::EXTCODECOPY => 4, - - Name::RecursiveCall { input_size, .. } => input_size, - Name::RecursiveReturn { input_size } => input_size, - - _ => 0, - } - } - - /// Returns the number of output stack arguments. - pub const fn output_size(&self) -> usize { - match self.name { - Name::PUSH => 1, - Name::PUSH_Data => 1, - Name::PUSH_Tag => 1, - Name::PUSH_ContractHash => 1, - Name::PUSH_ContractHashSize => 1, - Name::PUSHLIB => 1, - Name::PUSHDEPLOYADDRESS => 1, - - Name::PUSH1 => 1, - Name::PUSH2 => 1, - Name::PUSH3 => 1, - Name::PUSH4 => 1, - Name::PUSH5 => 1, - Name::PUSH6 => 1, - Name::PUSH7 => 1, - Name::PUSH8 => 1, - Name::PUSH9 => 1, - Name::PUSH10 => 1, - Name::PUSH11 => 1, - Name::PUSH12 => 1, - Name::PUSH13 => 1, - Name::PUSH14 => 1, - Name::PUSH15 => 1, - Name::PUSH16 => 1, - Name::PUSH17 => 1, - Name::PUSH18 => 1, - Name::PUSH19 => 1, - Name::PUSH20 => 1, - Name::PUSH21 => 1, - Name::PUSH22 => 1, - Name::PUSH23 => 1, - Name::PUSH24 => 1, - Name::PUSH25 => 1, - Name::PUSH26 => 1, - Name::PUSH27 => 1, - Name::PUSH28 => 1, - Name::PUSH29 => 1, - Name::PUSH30 => 1, - Name::PUSH31 => 1, - Name::PUSH32 => 1, - - Name::DUP1 => 1, - Name::DUP2 => 1, - Name::DUP3 => 1, - Name::DUP4 => 1, - Name::DUP5 => 1, - Name::DUP6 => 1, - Name::DUP7 => 1, - Name::DUP8 => 1, - Name::DUP9 => 1, - Name::DUP10 => 1, - Name::DUP11 => 1, - Name::DUP12 => 1, - Name::DUP13 => 1, - Name::DUP14 => 1, - Name::DUP15 => 1, - Name::DUP16 => 1, - - Name::ADD => 1, - Name::SUB => 1, - Name::MUL => 1, - Name::DIV => 1, - Name::MOD => 1, - Name::SDIV => 1, - Name::SMOD => 1, - - Name::LT => 1, - Name::GT => 1, - Name::EQ => 1, - Name::ISZERO => 1, - Name::SLT => 1, - Name::SGT => 1, - - Name::OR => 1, - Name::XOR => 1, - Name::NOT => 1, - Name::AND => 1, - Name::SHL => 1, - Name::SHR => 1, - Name::SAR => 1, - Name::BYTE => 1, - - Name::ADDMOD => 1, - Name::MULMOD => 1, - Name::EXP => 1, - Name::SIGNEXTEND => 1, - Name::SHA3 => 1, - Name::KECCAK256 => 1, - - Name::MLOAD => 1, - - Name::SLOAD => 1, - Name::TLOAD => 1, - Name::PUSHIMMUTABLE => 1, - - Name::CALLDATALOAD => 1, - Name::CALLDATASIZE => 1, - Name::CODESIZE => 1, - Name::PUSHSIZE => 1, - Name::RETURNDATASIZE => 1, - Name::EXTCODESIZE => 1, - Name::EXTCODEHASH => 1, - - Name::CALL => 1, - Name::CALLCODE => 1, - Name::STATICCALL => 1, - Name::DELEGATECALL => 1, - - Name::CREATE => 1, - Name::CREATE2 => 1, - - Name::ZK_CREATE => 1, - Name::ZK_CREATE2 => 1, - - Name::ADDRESS => 1, - Name::CALLER => 1, - Name::TIMESTAMP => 1, - Name::NUMBER => 1, - - Name::CALLVALUE => 1, - Name::GAS => 1, - Name::BALANCE => 1, - Name::SELFBALANCE => 1, - - Name::GASLIMIT => 1, - Name::GASPRICE => 1, - Name::ORIGIN => 1, - Name::CHAINID => 1, - Name::BLOCKHASH => 1, - Name::BLOBHASH => 1, - Name::DIFFICULTY => 1, - Name::PREVRANDAO => 1, - Name::COINBASE => 1, - Name::MSIZE => 1, - - Name::BASEFEE => 1, - Name::BLOBBASEFEE => 1, - Name::PC => 1, - - Name::RecursiveCall { output_size, .. } => output_size, - - _ => 0, - } - } - - /// Replaces the instruction data aliases with the actual data. - pub fn replace_data_aliases( - instructions: &mut [Self], - mapping: &BTreeMap, - ) -> anyhow::Result<()> { - for instruction in instructions.iter_mut() { - match instruction { - Instruction { - name: Name::PUSH_ContractHash | Name::PUSH_ContractHashSize, - value: Some(value), - .. - } => { - *value = mapping.get(value.as_str()).cloned().ok_or_else(|| { - anyhow::anyhow!("Contract alias `{}` data not found", value) - })?; - } - Instruction { - name: Name::PUSH_Data, - value: Some(value), - .. - } => { - let mut key_extended = - "0".repeat(revive_common::BYTE_LENGTH_WORD * 2 - value.len()); - key_extended.push_str(value.as_str()); - - *value = mapping.get(key_extended.as_str()).cloned().ok_or_else(|| { - anyhow::anyhow!("Data chunk alias `{}` data not found", key_extended) - })?; - } - _ => {} - } - } - - Ok(()) - } - - /// Initializes an `INVALID` instruction to terminate an invalid unreachable block part. - pub fn invalid(previous: &Self) -> Self { - Self { - name: Name::INVALID, - value: None, - - source: previous.source, - begin: previous.begin, - end: previous.end, - } - } - - /// Initializes a recursive function `Call` instruction. - pub fn recursive_call( - name: String, - entry_key: revive_llvm_context::PolkaVMFunctionBlockKey, - stack_hash: md5::Digest, - input_size: usize, - output_size: usize, - return_address: revive_llvm_context::PolkaVMFunctionBlockKey, - previous: &Self, - ) -> Self { - Self { - name: Name::RecursiveCall { - name, - entry_key, - stack_hash, - input_size, - output_size, - return_address, - }, - value: None, - - source: previous.source, - begin: previous.begin, - end: previous.end, - } - } - - /// Initializes a recursive function `Return` instruction. - pub fn recursive_return(input_size: usize, previous: &Self) -> Self { - Self { - name: Name::RecursiveReturn { input_size }, - value: None, - - source: previous.source, - begin: previous.begin, - end: previous.end, - } - } -} - -impl std::fmt::Display for Instruction { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let name = self.name.to_string(); - match self.name { - Name::Tag => write!(f, "{:4}", name), - _ => write!(f, "{:15}", name), - }?; - match self.value { - Some(ref value) if value.len() <= 64 => write!(f, "{}", value)?, - Some(ref value) => write!(f, "... {}", &value[value.len() - 60..])?, - None => {} - } - Ok(()) - } -} diff --git a/crates/solidity/src/evmla/assembly/instruction/name.rs b/crates/solidity/src/evmla/assembly/instruction/name.rs deleted file mode 100644 index 3f0b953..0000000 --- a/crates/solidity/src/evmla/assembly/instruction/name.rs +++ /dev/null @@ -1,417 +0,0 @@ -//! The EVM instruction name. - -use serde::Deserialize; -use serde::Serialize; - -/// The EVM instruction name. -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)] -#[allow(non_camel_case_types)] -#[allow(clippy::upper_case_acronyms)] -pub enum Name { - /// The eponymous EVM instruction. - PUSH, - /// Pushes a constant tag index. - #[serde(rename = "PUSH [tag]")] - PUSH_Tag, - /// Pushes an unknown `data` value. - #[serde(rename = "PUSH data")] - PUSH_Data, - /// Pushes a contract hash size. - #[serde(rename = "PUSH #[$]")] - PUSH_ContractHashSize, - /// Pushes a contract hash. - #[serde(rename = "PUSH [$]")] - PUSH_ContractHash, - - /// The eponymous EVM instruction. - PUSH1, - /// The eponymous EVM instruction. - PUSH2, - /// The eponymous EVM instruction. - PUSH3, - /// The eponymous EVM instruction. - PUSH4, - /// The eponymous EVM instruction. - PUSH5, - /// The eponymous EVM instruction. - PUSH6, - /// The eponymous EVM instruction. - PUSH7, - /// The eponymous EVM instruction. - PUSH8, - /// The eponymous EVM instruction. - PUSH9, - /// The eponymous EVM instruction. - PUSH10, - /// The eponymous EVM instruction. - PUSH11, - /// The eponymous EVM instruction. - PUSH12, - /// The eponymous EVM instruction. - PUSH13, - /// The eponymous EVM instruction. - PUSH14, - /// The eponymous EVM instruction. - PUSH15, - /// The eponymous EVM instruction. - PUSH16, - /// The eponymous EVM instruction. - PUSH17, - /// The eponymous EVM instruction. - PUSH18, - /// The eponymous EVM instruction. - PUSH19, - /// The eponymous EVM instruction. - PUSH20, - /// The eponymous EVM instruction. - PUSH21, - /// The eponymous EVM instruction. - PUSH22, - /// The eponymous EVM instruction. - PUSH23, - /// The eponymous EVM instruction. - PUSH24, - /// The eponymous EVM instruction. - PUSH25, - /// The eponymous EVM instruction. - PUSH26, - /// The eponymous EVM instruction. - PUSH27, - /// The eponymous EVM instruction. - PUSH28, - /// The eponymous EVM instruction. - PUSH29, - /// The eponymous EVM instruction. - PUSH30, - /// The eponymous EVM instruction. - PUSH31, - /// The eponymous EVM instruction. - PUSH32, - - /// The eponymous EVM instruction. - DUP1, - /// The eponymous EVM instruction. - DUP2, - /// The eponymous EVM instruction. - DUP3, - /// The eponymous EVM instruction. - DUP4, - /// The eponymous EVM instruction. - DUP5, - /// The eponymous EVM instruction. - DUP6, - /// The eponymous EVM instruction. - DUP7, - /// The eponymous EVM instruction. - DUP8, - /// The eponymous EVM instruction. - DUP9, - /// The eponymous EVM instruction. - DUP10, - /// The eponymous EVM instruction. - DUP11, - /// The eponymous EVM instruction. - DUP12, - /// The eponymous EVM instruction. - DUP13, - /// The eponymous EVM instruction. - DUP14, - /// The eponymous EVM instruction. - DUP15, - /// The eponymous EVM instruction. - DUP16, - - /// The eponymous EVM instruction. - SWAP1, - /// The eponymous EVM instruction. - SWAP2, - /// The eponymous EVM instruction. - SWAP3, - /// The eponymous EVM instruction. - SWAP4, - /// The eponymous EVM instruction. - SWAP5, - /// The eponymous EVM instruction. - SWAP6, - /// The eponymous EVM instruction. - SWAP7, - /// The eponymous EVM instruction. - SWAP8, - /// The eponymous EVM instruction. - SWAP9, - /// The eponymous EVM instruction. - SWAP10, - /// The eponymous EVM instruction. - SWAP11, - /// The eponymous EVM instruction. - SWAP12, - /// The eponymous EVM instruction. - SWAP13, - /// The eponymous EVM instruction. - SWAP14, - /// The eponymous EVM instruction. - SWAP15, - /// The eponymous EVM instruction. - SWAP16, - - /// The eponymous EVM instruction. - POP, - - /// Sets the current basic code block. - #[serde(rename = "tag")] - Tag, - /// The eponymous EVM instruction. - JUMP, - /// The eponymous EVM instruction. - JUMPI, - /// The eponymous EVM instruction. - JUMPDEST, - - /// The eponymous EVM instruction. - ADD, - /// The eponymous EVM instruction. - SUB, - /// The eponymous EVM instruction. - MUL, - /// The eponymous EVM instruction. - DIV, - /// The eponymous EVM instruction. - MOD, - /// The eponymous EVM instruction. - SDIV, - /// The eponymous EVM instruction. - SMOD, - - /// The eponymous EVM instruction. - LT, - /// The eponymous EVM instruction. - GT, - /// The eponymous EVM instruction. - EQ, - /// The eponymous EVM instruction. - ISZERO, - /// The eponymous EVM instruction. - SLT, - /// The eponymous EVM instruction. - SGT, - - /// The eponymous EVM instruction. - OR, - /// The eponymous EVM instruction. - XOR, - /// The eponymous EVM instruction. - NOT, - /// The eponymous EVM instruction. - AND, - /// The eponymous EVM instruction. - SHL, - /// The eponymous EVM instruction. - SHR, - /// The eponymous EVM instruction. - SAR, - /// The eponymous EVM instruction. - BYTE, - - /// The eponymous EVM instruction. - ADDMOD, - /// The eponymous EVM instruction. - MULMOD, - /// The eponymous EVM instruction. - EXP, - /// The eponymous EVM instruction. - SIGNEXTEND, - /// The eponymous EVM instruction. - SHA3, - /// The eponymous EVM instruction. - KECCAK256, - - /// The eponymous EVM instruction. - MLOAD, - /// The eponymous EVM instruction. - MSTORE, - /// The eponymous EVM instruction. - MSTORE8, - /// The eponymous EVM instruction. - MCOPY, - - /// The eponymous EVM instruction. - SLOAD, - /// The eponymous EVM instruction. - SSTORE, - /// The eponymous EVM instruction. - TLOAD, - /// The eponymous EVM instruction. - TSTORE, - /// The eponymous EVM instruction. - PUSHIMMUTABLE, - /// The eponymous EVM instruction. - ASSIGNIMMUTABLE, - - /// The eponymous EVM instruction. - CALLDATALOAD, - /// The eponymous EVM instruction. - CALLDATASIZE, - /// The eponymous EVM instruction. - CALLDATACOPY, - /// The eponymous EVM instruction. - CODESIZE, - /// The eponymous EVM instruction. - CODECOPY, - /// The eponymous EVM instruction. - PUSHSIZE, - /// The eponymous EVM instruction. - EXTCODESIZE, - /// The eponymous EVM instruction. - EXTCODEHASH, - /// The eponymous EVM instruction. - RETURNDATASIZE, - /// The eponymous EVM instruction. - RETURNDATACOPY, - - /// The eponymous EVM instruction. - RETURN, - /// The eponymous EVM instruction. - REVERT, - /// The eponymous EVM instruction. - STOP, - /// The eponymous EVM instruction. - INVALID, - - /// The eponymous EVM instruction. - LOG0, - /// The eponymous EVM instruction. - LOG1, - /// The eponymous EVM instruction. - LOG2, - /// The eponymous EVM instruction. - LOG3, - /// The eponymous EVM instruction. - LOG4, - - /// The eponymous EVM instruction. - CALL, - /// The eponymous EVM instruction. - STATICCALL, - /// The eponymous EVM instruction. - DELEGATECALL, - - /// The eponymous EVM instruction. - CREATE, - /// The eponymous EVM instruction. - CREATE2, - - /// The eponymous PolkaVM instruction. - #[serde(rename = "$ZK_CREATE")] - ZK_CREATE, - /// The eponymous PolkaVM instruction. - #[serde(rename = "$ZK_CREATE2")] - ZK_CREATE2, - - /// The eponymous EVM instruction. - ADDRESS, - /// The eponymous EVM instruction. - CALLER, - - /// The eponymous EVM instruction. - CALLVALUE, - /// The eponymous EVM instruction. - GAS, - /// The eponymous EVM instruction. - BALANCE, - /// The eponymous EVM instruction. - SELFBALANCE, - - /// The eponymous EVM instruction. - PUSHLIB, - /// The eponymous EVM instruction. - PUSHDEPLOYADDRESS, - - /// The eponymous EVM instruction. - GASLIMIT, - /// The eponymous EVM instruction. - GASPRICE, - /// The eponymous EVM instruction. - ORIGIN, - /// The eponymous EVM instruction. - CHAINID, - /// The eponymous EVM instruction. - TIMESTAMP, - /// The eponymous EVM instruction. - NUMBER, - /// The eponymous EVM instruction. - BLOCKHASH, - /// The eponymous EVM instruction. - BLOBHASH, - /// The eponymous EVM instruction. - DIFFICULTY, - /// The eponymous EVM instruction. - PREVRANDAO, - /// The eponymous EVM instruction. - COINBASE, - /// The eponymous EVM instruction. - BASEFEE, - /// The eponymous EVM instruction. - BLOBBASEFEE, - /// The eponymous EVM instruction. - MSIZE, - - /// The eponymous EVM instruction. - CALLCODE, - /// The eponymous EVM instruction. - PC, - /// The eponymous EVM instruction. - EXTCODECOPY, - /// The eponymous EVM instruction. - SELFDESTRUCT, - - /// The recursive function call instruction. - #[serde(skip)] - RecursiveCall { - /// The called function name. - name: String, - /// The called function key. - entry_key: revive_llvm_context::PolkaVMFunctionBlockKey, - /// The stack state hash after return. - stack_hash: md5::Digest, - /// The input size. - input_size: usize, - /// The output size. - output_size: usize, - /// The return address. - return_address: revive_llvm_context::PolkaVMFunctionBlockKey, - }, - /// The recursive function return instruction. - #[serde(skip)] - RecursiveReturn { - /// The output size. - input_size: usize, - }, -} - -impl std::fmt::Display for Name { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Tag => write!(f, "Tag"), - Self::RecursiveCall { - name, - entry_key, - input_size, - output_size, - return_address, - .. - } => write!( - f, - "RECURSIVE_CALL({}_{}, {}, {}, {})", - name, entry_key, input_size, output_size, return_address - ), - Self::RecursiveReturn { input_size } => write!(f, "RECURSIVE_RETURN({})", input_size), - _ => write!( - f, - "{}", - serde_json::to_string(self) - .expect("Always valid") - .trim_matches('\"') - ), - } - } -} diff --git a/crates/solidity/src/evmla/assembly/instruction/stack.rs b/crates/solidity/src/evmla/assembly/instruction/stack.rs deleted file mode 100644 index 1d70f3c..0000000 --- a/crates/solidity/src/evmla/assembly/instruction/stack.rs +++ /dev/null @@ -1,106 +0,0 @@ -//! Translates the stack memory operations. - -use inkwell::values::BasicValue; - -/// Translates the ordinar value push. -pub fn push<'ctx, D>( - context: &mut revive_llvm_context::PolkaVMContext<'ctx, D>, - value: String, -) -> anyhow::Result> -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - let result = context - .word_type() - .const_int_from_string( - value.to_ascii_uppercase().as_str(), - inkwell::types::StringRadix::Hexadecimal, - ) - .expect("Always valid") - .as_basic_value_enum(); - Ok(result) -} - -/// Translates the block tag label push. -pub fn push_tag<'ctx, D>( - context: &mut revive_llvm_context::PolkaVMContext<'ctx, D>, - value: String, -) -> anyhow::Result> -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - let result = context - .word_type() - .const_int_from_string(value.as_str(), inkwell::types::StringRadix::Decimal) - .expect("Always valid"); - Ok(result.as_basic_value_enum()) -} - -/// Translates the stack memory duplicate. -pub fn dup<'ctx, D>( - context: &mut revive_llvm_context::PolkaVMContext<'ctx, D>, - offset: usize, - height: usize, - original: &mut Option, -) -> anyhow::Result> -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - let element = &context.evmla().stack[height - offset - 1]; - let value = context.build_load( - revive_llvm_context::PolkaVMPointer::new_stack_field( - context, - element.to_llvm().into_pointer_value(), - ), - format!("dup{offset}").as_str(), - )?; - - element.original.clone_into(original); - - Ok(value) -} - -/// Translates the stack memory swap. -pub fn swap( - context: &mut revive_llvm_context::PolkaVMContext, - offset: usize, - height: usize, -) -> anyhow::Result<()> -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - let top_element = context.evmla().stack[height - 1].to_owned(); - let top_pointer = revive_llvm_context::PolkaVMPointer::new_stack_field( - context, - top_element.to_llvm().into_pointer_value(), - ); - let top_value = context.build_load(top_pointer, format!("swap{offset}_top_value").as_str())?; - - let swap_element = context.evmla().stack[height - offset - 1].to_owned(); - let swap_pointer = revive_llvm_context::PolkaVMPointer::new_stack_field( - context, - swap_element.to_llvm().into_pointer_value(), - ); - let swap_value = - context.build_load(swap_pointer, format!("swap{offset}_swap_value").as_str())?; - - swap_element - .original - .clone_into(&mut context.evmla_mut().stack[height - 1].original); - top_element - .original - .clone_into(&mut context.evmla_mut().stack[height - offset - 1].original); - - context.build_store(top_pointer, swap_value)?; - context.build_store(swap_pointer, top_value)?; - - Ok(()) -} - -/// Translates the stack memory pop. -pub fn pop(_context: &mut revive_llvm_context::PolkaVMContext) -> anyhow::Result<()> -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - Ok(()) -} diff --git a/crates/solidity/src/evmla/assembly/mod.rs b/crates/solidity/src/evmla/assembly/mod.rs deleted file mode 100644 index bf3502e..0000000 --- a/crates/solidity/src/evmla/assembly/mod.rs +++ /dev/null @@ -1,295 +0,0 @@ -//! The `solc --asm-json` output. - -pub mod data; -pub mod instruction; - -use std::collections::BTreeMap; -use std::collections::HashSet; - -use serde::Deserialize; -use serde::Serialize; -use sha3::Digest; - -use crate::evmla::ethereal_ir::entry_link::EntryLink; -use crate::evmla::ethereal_ir::EtherealIR; -use crate::solc::standard_json::output::contract::evm::extra_metadata::ExtraMetadata; - -use self::data::Data; -use self::instruction::name::Name as InstructionName; -use self::instruction::Instruction; - -/// The JSON assembly. -#[derive(Debug, Serialize, Deserialize, Clone)] -pub struct Assembly { - /// The metadata string. - #[serde(rename = ".auxdata")] - pub auxdata: Option, - /// The deploy code instructions. - #[serde(rename = ".code")] - pub code: Option>, - /// The runtime code. - #[serde(rename = ".data")] - pub data: Option>, - - /// The full contract path. - #[serde(skip_serializing_if = "Option::is_none")] - pub full_path: Option, - /// The factory dependency paths. - #[serde(default = "HashSet::new")] - pub factory_dependencies: HashSet, - /// The EVMLA extra metadata. - #[serde(skip_serializing_if = "Option::is_none")] - pub extra_metadata: Option, -} - -impl Assembly { - /// Gets the contract `keccak256` hash. - pub fn keccak256(&self) -> String { - let json = serde_json::to_vec(self).expect("Always valid"); - hex::encode(sha3::Keccak256::digest(json.as_slice())) - } - - /// Sets the full contract path. - pub fn set_full_path(&mut self, full_path: String) { - self.full_path = Some(full_path); - } - - /// Returns the full contract path if it is set, or `` otherwise. - /// # Panics - /// If the `full_path` has not been set. - pub fn full_path(&self) -> &str { - self.full_path - .as_deref() - .unwrap_or_else(|| panic!("The full path of some contracts is unset")) - } - - /// Get the list of missing deployable libraries. - pub fn get_missing_libraries(&self) -> HashSet { - let mut missing_libraries = HashSet::new(); - if let Some(code) = self.code.as_ref() { - for instruction in code.iter() { - if let InstructionName::PUSHLIB = instruction.name { - let library_path = instruction.value.to_owned().expect("Always exists"); - missing_libraries.insert(library_path); - } - } - } - if let Some(data) = self.data.as_ref() { - for (_, data) in data.iter() { - missing_libraries.extend(data.get_missing_libraries()); - } - } - missing_libraries - } - - /// Replaces the deploy code dependencies with full contract path and returns the list. - pub fn deploy_dependencies_pass( - &mut self, - full_path: &str, - hash_data_mapping: &BTreeMap, - ) -> anyhow::Result> { - let mut index_path_mapping = BTreeMap::new(); - let index = "0".repeat(revive_common::BYTE_LENGTH_WORD * 2); - index_path_mapping.insert(index, full_path.to_owned()); - - let dependencies = match self.data.as_mut() { - Some(dependencies) => dependencies, - None => return Ok(index_path_mapping), - }; - for (index, data) in dependencies.iter_mut() { - if index == "0" { - continue; - } - - let mut index_extended = "0".repeat(revive_common::BYTE_LENGTH_WORD * 2 - index.len()); - index_extended.push_str(index.as_str()); - - *data = match data { - Data::Assembly(assembly) => { - let hash = assembly.keccak256(); - let full_path = - hash_data_mapping - .get(hash.as_str()) - .cloned() - .ok_or_else(|| { - anyhow::anyhow!("Contract path not found for hash `{}`", hash) - })?; - self.factory_dependencies.insert(full_path.to_owned()); - - index_path_mapping.insert(index_extended, full_path.clone()); - Data::Path(full_path) - } - Data::Hash(hash) => { - index_path_mapping.insert(index_extended, hash.to_owned()); - continue; - } - _ => continue, - }; - } - - Ok(index_path_mapping) - } - - /// Replaces the runtime code dependencies with full contract path and returns the list. - pub fn runtime_dependencies_pass( - &mut self, - full_path: &str, - hash_data_mapping: &BTreeMap, - ) -> anyhow::Result> { - let mut index_path_mapping = BTreeMap::new(); - let index = "0".repeat(revive_common::BYTE_LENGTH_WORD * 2); - index_path_mapping.insert(index, full_path.to_owned()); - - let dependencies = match self - .data - .as_mut() - .and_then(|data| data.get_mut("0")) - .and_then(|data| data.get_assembly_mut()) - .and_then(|assembly| assembly.data.as_mut()) - { - Some(dependencies) => dependencies, - None => return Ok(index_path_mapping), - }; - for (index, data) in dependencies.iter_mut() { - let mut index_extended = "0".repeat(revive_common::BYTE_LENGTH_WORD * 2 - index.len()); - index_extended.push_str(index.as_str()); - - *data = match data { - Data::Assembly(assembly) => { - let hash = assembly.keccak256(); - let full_path = - hash_data_mapping - .get(hash.as_str()) - .cloned() - .ok_or_else(|| { - anyhow::anyhow!("Contract path not found for hash `{}`", hash) - })?; - self.factory_dependencies.insert(full_path.to_owned()); - - index_path_mapping.insert(index_extended, full_path.clone()); - Data::Path(full_path) - } - Data::Hash(hash) => { - index_path_mapping.insert(index_extended, hash.to_owned()); - continue; - } - _ => continue, - }; - } - - Ok(index_path_mapping) - } -} - -impl revive_llvm_context::PolkaVMWriteLLVM for Assembly -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - fn declare( - &mut self, - context: &mut revive_llvm_context::PolkaVMContext, - ) -> anyhow::Result<()> { - let mut entry = revive_llvm_context::PolkaVMEntryFunction::default(); - entry.declare(context)?; - - revive_llvm_context::PolkaVMDeployCodeFunction::new( - revive_llvm_context::PolkaVMDummyLLVMWritable::default(), - ) - .declare(context)?; - revive_llvm_context::PolkaVMRuntimeCodeFunction::new( - revive_llvm_context::PolkaVMDummyLLVMWritable::default(), - ) - .declare(context)?; - revive_llvm_context::PolkaVMImmutableDataLoadFunction.declare(context)?; - - entry.into_llvm(context)?; - - Ok(()) - } - - fn into_llvm( - mut self, - context: &mut revive_llvm_context::PolkaVMContext, - ) -> anyhow::Result<()> { - let full_path = self.full_path().to_owned(); - - context - .debug_config() - .dump_evmla(full_path.as_str(), self.to_string().as_str())?; - - let deploy_code_blocks = EtherealIR::get_blocks( - context.evmla().version.to_owned(), - revive_llvm_context::PolkaVMCodeType::Deploy, - self.code - .as_deref() - .ok_or_else(|| anyhow::anyhow!("Deploy code instructions not found"))?, - )?; - - let data = self - .data - .ok_or_else(|| anyhow::anyhow!("Runtime code data not found"))? - .remove("0") - .expect("Always exists"); - - context - .debug_config() - .dump_evmla(full_path.as_str(), data.to_string().as_str())?; - - let runtime_code_instructions = match data { - Data::Assembly(assembly) => assembly - .code - .ok_or_else(|| anyhow::anyhow!("Runtime code instructions not found"))?, - Data::Hash(hash) => { - anyhow::bail!("Expected runtime code instructions, found hash `{}`", hash) - } - Data::Path(path) => { - anyhow::bail!("Expected runtime code instructions, found path `{}`", path) - } - }; - let runtime_code_blocks = EtherealIR::get_blocks( - context.evmla().version.to_owned(), - revive_llvm_context::PolkaVMCodeType::Runtime, - runtime_code_instructions.as_slice(), - )?; - - let extra_metadata = self.extra_metadata.take().unwrap_or_default(); - let mut blocks = deploy_code_blocks; - blocks.extend(runtime_code_blocks); - let mut ethereal_ir = - EtherealIR::new(context.evmla().version.to_owned(), extra_metadata, blocks)?; - - context - .debug_config() - .dump_ethir(full_path.as_str(), ethereal_ir.to_string().as_str())?; - - ethereal_ir.declare(context)?; - ethereal_ir.into_llvm(context)?; - - revive_llvm_context::PolkaVMDeployCodeFunction::new(EntryLink::new( - revive_llvm_context::PolkaVMCodeType::Deploy, - )) - .into_llvm(context)?; - revive_llvm_context::PolkaVMRuntimeCodeFunction::new(EntryLink::new( - revive_llvm_context::PolkaVMCodeType::Runtime, - )) - .into_llvm(context)?; - revive_llvm_context::PolkaVMImmutableDataLoadFunction.into_llvm(context)?; - - Ok(()) - } -} - -impl std::fmt::Display for Assembly { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - if let Some(instructions) = self.code.as_ref() { - for (index, instruction) in instructions.iter().enumerate() { - match instruction.name { - InstructionName::Tag => writeln!(f, "{index:03} {instruction}")?, - _ => writeln!(f, "{index:03} {instruction}")?, - } - } - } - - Ok(()) - } -} diff --git a/crates/solidity/src/evmla/ethereal_ir/entry_link.rs b/crates/solidity/src/evmla/ethereal_ir/entry_link.rs deleted file mode 100644 index 075148d..0000000 --- a/crates/solidity/src/evmla/ethereal_ir/entry_link.rs +++ /dev/null @@ -1,48 +0,0 @@ -//! The Ethereal IR entry function link. - -use inkwell::values::BasicValue; - -use crate::evmla::ethereal_ir::EtherealIR; - -/// The Ethereal IR entry function link. -/// The link represents branching between the deploy and runtime code. -#[derive(Debug, Clone)] -pub struct EntryLink { - /// The code part type. - pub code_type: revive_llvm_context::PolkaVMCodeType, -} - -impl EntryLink { - /// A shortcut constructor. - pub fn new(code_type: revive_llvm_context::PolkaVMCodeType) -> Self { - Self { code_type } - } -} - -impl revive_llvm_context::PolkaVMWriteLLVM for EntryLink -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - fn into_llvm(self, context: &mut revive_llvm_context::PolkaVMContext) -> anyhow::Result<()> { - let target = context - .get_function(EtherealIR::DEFAULT_ENTRY_FUNCTION_NAME) - .expect("Always exists") - .borrow() - .declaration(); - let is_deploy_code = match self.code_type { - revive_llvm_context::PolkaVMCodeType::Deploy => context - .integer_type(revive_common::BIT_LENGTH_BOOLEAN) - .const_int(1, false), - revive_llvm_context::PolkaVMCodeType::Runtime => context - .integer_type(revive_common::BIT_LENGTH_BOOLEAN) - .const_int(0, false), - }; - context.build_call( - target, - &[is_deploy_code.as_basic_value_enum()], - format!("call_link_{}", EtherealIR::DEFAULT_ENTRY_FUNCTION_NAME).as_str(), - ); - - 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 deleted file mode 100644 index bde58a2..0000000 --- a/crates/solidity/src/evmla/ethereal_ir/function/block/element/mod.rs +++ /dev/null @@ -1,1362 +0,0 @@ -//! The Ethereal IR block element. - -pub mod stack; - -use inkwell::values::BasicValue; - -use crate::evmla::assembly::instruction::codecopy; -use crate::evmla::assembly::instruction::name::Name as InstructionName; -use crate::evmla::assembly::instruction::Instruction; - -use self::stack::element::Element as StackElement; -use self::stack::Stack; - -/// The Ethereal IR block element. -#[derive(Debug, Clone)] -pub struct Element { - /// The Solidity compiler version. - pub solc_version: semver::Version, - /// The instruction. - pub instruction: Instruction, - /// The stack data. - pub stack: Stack, - /// The stack input. - pub stack_input: Stack, - /// The stack output. - pub stack_output: Stack, -} - -impl Element { - /// A shortcut constructor. - pub fn new(solc_version: semver::Version, instruction: Instruction) -> Self { - let input_size = instruction.input_size(&solc_version); - let output_size = instruction.output_size(); - - Self { - solc_version, - instruction, - stack: Stack::new(), - stack_input: Stack::with_capacity(input_size), - stack_output: Stack::with_capacity(output_size), - } - } - - /// Pops the specified number of arguments, converted into their LLVM values. - fn pop_arguments_llvm<'ctx, D>( - &mut self, - context: &mut revive_llvm_context::PolkaVMContext<'ctx, D>, - ) -> anyhow::Result>> - where - D: revive_llvm_context::PolkaVMDependency + Clone, - { - let input_size = self.instruction.input_size(&context.evmla().version); - let output_size = self.instruction.output_size(); - let mut arguments = Vec::with_capacity(input_size); - for index in 0..input_size { - let pointer = context.evmla().stack - [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(), - )?; - arguments.push(value); - } - Ok(arguments) - } -} - -impl revive_llvm_context::PolkaVMWriteLLVM for Element -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - fn into_llvm( - mut self, - context: &mut revive_llvm_context::PolkaVMContext<'_, D>, - ) -> anyhow::Result<()> { - let mut original = self.instruction.value.clone(); - - let result = match self.instruction.name.clone() { - InstructionName::PUSH - | InstructionName::PUSH1 - | InstructionName::PUSH2 - | InstructionName::PUSH3 - | InstructionName::PUSH4 - | InstructionName::PUSH5 - | InstructionName::PUSH6 - | InstructionName::PUSH7 - | InstructionName::PUSH8 - | InstructionName::PUSH9 - | InstructionName::PUSH10 - | InstructionName::PUSH11 - | InstructionName::PUSH12 - | InstructionName::PUSH13 - | InstructionName::PUSH14 - | InstructionName::PUSH15 - | InstructionName::PUSH16 - | InstructionName::PUSH17 - | InstructionName::PUSH18 - | InstructionName::PUSH19 - | InstructionName::PUSH20 - | InstructionName::PUSH21 - | InstructionName::PUSH22 - | InstructionName::PUSH23 - | InstructionName::PUSH24 - | InstructionName::PUSH25 - | InstructionName::PUSH26 - | InstructionName::PUSH27 - | InstructionName::PUSH28 - | InstructionName::PUSH29 - | InstructionName::PUSH30 - | InstructionName::PUSH31 - | InstructionName::PUSH32 => crate::evmla::assembly::instruction::stack::push( - context, - self.instruction - .value - .ok_or_else(|| anyhow::anyhow!("Instruction value missing"))?, - ) - .map(Some), - InstructionName::PUSH_Tag => crate::evmla::assembly::instruction::stack::push_tag( - context, - self.instruction - .value - .ok_or_else(|| anyhow::anyhow!("Instruction value missing"))?, - ) - .map(Some), - InstructionName::PUSH_ContractHash => { - revive_llvm_context::polkavm_evm_create::contract_hash( - context, - self.instruction - .value - .ok_or_else(|| anyhow::anyhow!("Instruction value missing"))?, - ) - .map(|argument| Some(argument.value)) - } - InstructionName::PUSH_ContractHashSize => { - revive_llvm_context::polkavm_evm_create::header_size( - context, - self.instruction - .value - .ok_or_else(|| anyhow::anyhow!("Instruction value missing"))?, - ) - .map(|argument| Some(argument.value)) - } - InstructionName::PUSHLIB => { - let path = self - .instruction - .value - .ok_or_else(|| anyhow::anyhow!("Instruction value missing"))?; - - Ok(Some( - context - .resolve_library(path.as_str())? - .as_basic_value_enum(), - )) - } - InstructionName::PUSH_Data => { - let value = self - .instruction - .value - .ok_or_else(|| anyhow::anyhow!("Instruction value missing"))?; - - if value.len() > revive_common::BYTE_LENGTH_WORD * 2 { - Ok(Some(context.word_const(0).as_basic_value_enum())) - } else { - crate::evmla::assembly::instruction::stack::push(context, value).map(Some) - } - } - InstructionName::PUSHDEPLOYADDRESS => { - revive_llvm_context::polkavm_evm_contract_context::address(context).map(Some) - } - - InstructionName::DUP1 => crate::evmla::assembly::instruction::stack::dup( - context, - 1, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP2 => crate::evmla::assembly::instruction::stack::dup( - context, - 2, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP3 => crate::evmla::assembly::instruction::stack::dup( - context, - 3, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP4 => crate::evmla::assembly::instruction::stack::dup( - context, - 4, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP5 => crate::evmla::assembly::instruction::stack::dup( - context, - 5, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP6 => crate::evmla::assembly::instruction::stack::dup( - context, - 6, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP7 => crate::evmla::assembly::instruction::stack::dup( - context, - 7, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP8 => crate::evmla::assembly::instruction::stack::dup( - context, - 8, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP9 => crate::evmla::assembly::instruction::stack::dup( - context, - 9, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP10 => crate::evmla::assembly::instruction::stack::dup( - context, - 10, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP11 => crate::evmla::assembly::instruction::stack::dup( - context, - 11, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP12 => crate::evmla::assembly::instruction::stack::dup( - context, - 12, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP13 => crate::evmla::assembly::instruction::stack::dup( - context, - 13, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP14 => crate::evmla::assembly::instruction::stack::dup( - context, - 14, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP15 => crate::evmla::assembly::instruction::stack::dup( - context, - 15, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - InstructionName::DUP16 => crate::evmla::assembly::instruction::stack::dup( - context, - 16, - self.stack.elements.len(), - &mut original, - ) - .map(Some), - - InstructionName::SWAP1 => crate::evmla::assembly::instruction::stack::swap( - context, - 1, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP2 => crate::evmla::assembly::instruction::stack::swap( - context, - 2, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP3 => crate::evmla::assembly::instruction::stack::swap( - context, - 3, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP4 => crate::evmla::assembly::instruction::stack::swap( - context, - 4, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP5 => crate::evmla::assembly::instruction::stack::swap( - context, - 5, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP6 => crate::evmla::assembly::instruction::stack::swap( - context, - 6, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP7 => crate::evmla::assembly::instruction::stack::swap( - context, - 7, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP8 => crate::evmla::assembly::instruction::stack::swap( - context, - 8, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP9 => crate::evmla::assembly::instruction::stack::swap( - context, - 9, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP10 => crate::evmla::assembly::instruction::stack::swap( - context, - 10, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP11 => crate::evmla::assembly::instruction::stack::swap( - context, - 11, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP12 => crate::evmla::assembly::instruction::stack::swap( - context, - 12, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP13 => crate::evmla::assembly::instruction::stack::swap( - context, - 13, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP14 => crate::evmla::assembly::instruction::stack::swap( - context, - 14, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP15 => crate::evmla::assembly::instruction::stack::swap( - context, - 15, - self.stack.elements.len(), - ) - .map(|_| None), - InstructionName::SWAP16 => crate::evmla::assembly::instruction::stack::swap( - context, - 16, - self.stack.elements.len(), - ) - .map(|_| None), - - InstructionName::POP => { - crate::evmla::assembly::instruction::stack::pop(context).map(|_| None) - } - - InstructionName::Tag => { - let destination: num::BigUint = self - .instruction - .value - .expect("Always exists") - .parse() - .expect("Always valid"); - - crate::evmla::assembly::instruction::jump::unconditional( - context, - destination, - self.stack.hash(), - ) - .map(|_| None) - } - InstructionName::JUMP => { - let destination = self.stack_input.pop_tag()?; - - crate::evmla::assembly::instruction::jump::unconditional( - context, - destination, - self.stack.hash(), - ) - .map(|_| None) - } - InstructionName::JUMPI => { - let destination = self.stack_input.pop_tag()?; - let _condition = self.stack_input.pop(); - - crate::evmla::assembly::instruction::jump::conditional( - context, - destination, - self.stack.hash(), - self.stack.elements.len(), - ) - .map(|_| None) - } - InstructionName::JUMPDEST => Ok(None), - - InstructionName::ADD => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_arithmetic::addition( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::SUB => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_arithmetic::subtraction( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::MUL => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_arithmetic::multiplication( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::DIV => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_arithmetic::division( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::MOD => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_arithmetic::remainder( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::SDIV => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_arithmetic::division_signed( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::SMOD => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_arithmetic::remainder_signed( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - - InstructionName::LT => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_comparison::compare( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - inkwell::IntPredicate::ULT, - ) - .map(Some) - } - InstructionName::GT => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_comparison::compare( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - inkwell::IntPredicate::UGT, - ) - .map(Some) - } - InstructionName::EQ => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_comparison::compare( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - inkwell::IntPredicate::EQ, - ) - .map(Some) - } - InstructionName::ISZERO => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_comparison::compare( - context, - arguments[0].into_int_value(), - context.word_const(0), - inkwell::IntPredicate::EQ, - ) - .map(Some) - } - InstructionName::SLT => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_comparison::compare( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - inkwell::IntPredicate::SLT, - ) - .map(Some) - } - InstructionName::SGT => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_comparison::compare( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - inkwell::IntPredicate::SGT, - ) - .map(Some) - } - - InstructionName::OR => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_bitwise::or( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::XOR => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_bitwise::xor( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::NOT => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_bitwise::xor( - context, - arguments[0].into_int_value(), - context.word_type().const_all_ones(), - ) - .map(Some) - } - InstructionName::AND => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_bitwise::and( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::SHL => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_bitwise::shift_left( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::SHR => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_bitwise::shift_right( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::SAR => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_bitwise::shift_right_arithmetic( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::BYTE => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_bitwise::byte( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - - InstructionName::ADDMOD => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_math::add_mod( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - arguments[2].into_int_value(), - ) - .map(Some) - } - InstructionName::MULMOD => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_math::mul_mod( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - arguments[2].into_int_value(), - ) - .map(Some) - } - InstructionName::EXP => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_math::exponent( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - InstructionName::SIGNEXTEND => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_math::sign_extend( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - - InstructionName::SHA3 | InstructionName::KECCAK256 => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_crypto::sha3( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(Some) - } - - InstructionName::MLOAD => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_memory::load( - context, - arguments[0].into_int_value(), - ) - .map(Some) - } - InstructionName::MSTORE => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_memory::store( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(|_| None) - } - InstructionName::MSTORE8 => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_memory::store_byte( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(|_| None) - } - InstructionName::MCOPY => { - let arguments = self.pop_arguments_llvm(context)?; - let destination = revive_llvm_context::PolkaVMPointer::new_with_offset( - context, - revive_llvm_context::PolkaVMAddressSpace::Heap, - context.byte_type(), - arguments[0].into_int_value(), - "mcopy_destination", - ); - let source = revive_llvm_context::PolkaVMPointer::new_with_offset( - context, - revive_llvm_context::PolkaVMAddressSpace::Heap, - context.byte_type(), - arguments[1].into_int_value(), - "mcopy_source", - ); - - context.build_memcpy( - destination, - source, - arguments[2].into_int_value(), - "mcopy_size", - )?; - Ok(None) - } - - InstructionName::SLOAD => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_storage::load( - context, - arguments[0].into_int_value(), - ) - .map(Some) - } - InstructionName::SSTORE => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_storage::store( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(|_| None) - } - InstructionName::TLOAD => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_storage::transient_load( - context, - arguments[0].into_int_value(), - ) - .map(Some) - } - InstructionName::TSTORE => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_storage::transient_store( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(|_| None) - } - InstructionName::PUSHIMMUTABLE => { - let key = self - .instruction - .value - .ok_or_else(|| anyhow::anyhow!("Instruction value missing"))?; - - 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) - } - InstructionName::ASSIGNIMMUTABLE => { - 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()) - / revive_common::BYTE_LENGTH_WORD; - - 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() - .ok_or_else(|| anyhow::anyhow!("The contract code part type is undefined"))? - { - revive_llvm_context::PolkaVMCodeType::Deploy => { - Ok(Some(context.word_const(0).as_basic_value_enum())) - } - revive_llvm_context::PolkaVMCodeType::Runtime => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_calldata::load( - context, - arguments[0].into_int_value(), - ) - .map(Some) - } - } - } - InstructionName::CALLDATASIZE => { - match context - .code_type() - .ok_or_else(|| anyhow::anyhow!("The contract code part type is undefined"))? - { - revive_llvm_context::PolkaVMCodeType::Deploy => { - Ok(Some(context.word_const(0).as_basic_value_enum())) - } - revive_llvm_context::PolkaVMCodeType::Runtime => { - revive_llvm_context::polkavm_evm_calldata::size(context).map(Some) - } - } - } - InstructionName::CALLDATACOPY => { - let arguments = self.pop_arguments_llvm(context)?; - - match context - .code_type() - .ok_or_else(|| anyhow::anyhow!("The contract code part type is undefined"))? - { - revive_llvm_context::PolkaVMCodeType::Deploy => { - let calldata_size = - revive_llvm_context::polkavm_evm_calldata::size(context)?; - - revive_llvm_context::polkavm_evm_calldata::copy( - context, - arguments[0].into_int_value(), - calldata_size.into_int_value(), - arguments[2].into_int_value(), - ) - .map(|_| None) - } - revive_llvm_context::PolkaVMCodeType::Runtime => { - revive_llvm_context::polkavm_evm_calldata::copy( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - arguments[2].into_int_value(), - ) - .map(|_| None) - } - } - } - InstructionName::CODESIZE => { - match context - .code_type() - .ok_or_else(|| anyhow::anyhow!("The contract code part type is undefined"))? - { - revive_llvm_context::PolkaVMCodeType::Deploy => { - revive_llvm_context::polkavm_evm_calldata::size(context).map(Some) - } - revive_llvm_context::PolkaVMCodeType::Runtime => { - revive_llvm_context::polkavm_evm_ext_code::size(context, None).map(Some) - } - } - } - InstructionName::CODECOPY => { - 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]; - let destination = &self.stack_input.elements[2]; - - let library_marker: u64 = 0x0b; - let library_flag: u64 = 0x73; - - match (source, destination) { - (_, StackElement::Constant(destination)) - if destination == &num::BigUint::from(library_marker) => - { - codecopy::library_marker(context, library_marker, library_flag) - } - (StackElement::Data(data), _) => { - codecopy::static_data(context, arguments[0].into_int_value(), data.as_str()) - } - (StackElement::Path(source), _) if source != parent => codecopy::contract_hash( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ), - _ => { - match context.code_type().ok_or_else(|| { - anyhow::anyhow!("The contract code part type is undefined") - })? { - revive_llvm_context::PolkaVMCodeType::Deploy => { - revive_llvm_context::polkavm_evm_calldata::copy( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - arguments[2].into_int_value(), - ) - } - revive_llvm_context::PolkaVMCodeType::Runtime => { - let calldata_size = - revive_llvm_context::polkavm_evm_calldata::size(context)?; - revive_llvm_context::polkavm_evm_calldata::copy( - context, - arguments[0].into_int_value(), - calldata_size.into_int_value(), - arguments[2].into_int_value(), - ) - } - } - } - } - .map(|_| None) - } - InstructionName::PUSHSIZE => Ok(Some(context.word_const(0).as_basic_value_enum())), - InstructionName::RETURNDATASIZE => { - revive_llvm_context::polkavm_evm_return_data::size(context).map(Some) - } - InstructionName::RETURNDATACOPY => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_return_data::copy( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - arguments[2].into_int_value(), - ) - .map(|_| None) - } - InstructionName::EXTCODESIZE => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_ext_code::size( - context, - Some(arguments[0].into_int_value()), - ) - .map(Some) - } - InstructionName::EXTCODEHASH => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_ext_code::hash( - context, - arguments[0].into_int_value(), - ) - .map(Some) - } - - InstructionName::RETURN => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_return::r#return( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(|_| None) - } - InstructionName::REVERT => { - let arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_return::revert( - context, - arguments[0].into_int_value(), - arguments[1].into_int_value(), - ) - .map(|_| None) - } - InstructionName::STOP => { - revive_llvm_context::polkavm_evm_return::stop(context).map(|_| None) - } - InstructionName::INVALID => { - revive_llvm_context::polkavm_evm_return::invalid(context).map(|_| None) - } - - InstructionName::LOG0 => { - let mut arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_event::log( - context, - arguments.remove(0).into_int_value(), - arguments.remove(0).into_int_value(), - arguments - .into_iter() - .map(|argument| argument.into_int_value()) - .collect(), - ) - .map(|_| None) - } - InstructionName::LOG1 => { - let mut arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_event::log( - context, - arguments.remove(0).into_int_value(), - arguments.remove(0).into_int_value(), - arguments - .into_iter() - .map(|argument| argument.into_int_value()) - .collect(), - ) - .map(|_| None) - } - InstructionName::LOG2 => { - let mut arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_event::log( - context, - arguments.remove(0).into_int_value(), - arguments.remove(0).into_int_value(), - arguments - .into_iter() - .map(|argument| argument.into_int_value()) - .collect(), - ) - .map(|_| None) - } - InstructionName::LOG3 => { - let mut arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_event::log( - context, - arguments.remove(0).into_int_value(), - arguments.remove(0).into_int_value(), - arguments - .into_iter() - .map(|argument| argument.into_int_value()) - .collect(), - ) - .map(|_| None) - } - InstructionName::LOG4 => { - let mut arguments = self.pop_arguments_llvm(context)?; - revive_llvm_context::polkavm_evm_event::log( - context, - arguments.remove(0).into_int_value(), - arguments.remove(0).into_int_value(), - arguments - .into_iter() - .map(|argument| argument.into_int_value()) - .collect(), - ) - .map(|_| None) - } - - InstructionName::CALL => { - let mut arguments = self.pop_arguments_llvm(context)?; - - let gas = arguments.remove(0).into_int_value(); - let address = arguments.remove(0).into_int_value(); - let value = arguments.remove(0).into_int_value(); - let input_offset = arguments.remove(0).into_int_value(); - let input_size = arguments.remove(0).into_int_value(); - let output_offset = arguments.remove(0).into_int_value(); - let output_size = arguments.remove(0).into_int_value(); - - revive_llvm_context::polkavm_evm_call::call( - context, - gas, - address, - Some(value), - input_offset, - input_size, - output_offset, - output_size, - vec![], - false, - ) - .map(Some) - } - InstructionName::STATICCALL => { - let mut arguments = self.pop_arguments_llvm(context)?; - - let gas = arguments.remove(0).into_int_value(); - let address = arguments.remove(0).into_int_value(); - let input_offset = arguments.remove(0).into_int_value(); - let input_size = arguments.remove(0).into_int_value(); - let output_offset = arguments.remove(0).into_int_value(); - let output_size = arguments.remove(0).into_int_value(); - - revive_llvm_context::polkavm_evm_call::call( - context, - gas, - address, - None, - input_offset, - input_size, - output_offset, - output_size, - vec![], - true, - ) - .map(Some) - } - InstructionName::DELEGATECALL => { - let mut arguments = self.pop_arguments_llvm(context)?; - - let gas = arguments.remove(0).into_int_value(); - let address = arguments.remove(0).into_int_value(); - let input_offset = arguments.remove(0).into_int_value(); - let input_size = arguments.remove(0).into_int_value(); - let output_offset = arguments.remove(0).into_int_value(); - let output_size = arguments.remove(0).into_int_value(); - - revive_llvm_context::polkavm_evm_call::delegate_call( - context, - gas, - address, - input_offset, - input_size, - output_offset, - output_size, - vec![], - ) - .map(Some) - } - - InstructionName::CREATE | InstructionName::ZK_CREATE => { - 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(); - - revive_llvm_context::polkavm_evm_create::create( - context, - value, - input_offset, - input_length, - None, - ) - .map(Some) - } - InstructionName::CREATE2 | InstructionName::ZK_CREATE2 => { - 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::create( - context, - value, - input_offset, - input_length, - Some(salt), - ) - .map(Some) - } - - InstructionName::ADDRESS => { - revive_llvm_context::polkavm_evm_contract_context::address(context).map(Some) - } - InstructionName::CALLER => { - revive_llvm_context::polkavm_evm_contract_context::caller(context).map(Some) - } - - InstructionName::CALLVALUE => { - revive_llvm_context::polkavm_evm_ether_gas::value(context).map(Some) - } - InstructionName::GAS => { - revive_llvm_context::polkavm_evm_ether_gas::gas(context).map(Some) - } - InstructionName::BALANCE => { - 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 => { - 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) - } - InstructionName::GASPRICE => { - revive_llvm_context::polkavm_evm_contract_context::gas_price(context).map(Some) - } - InstructionName::ORIGIN => { - revive_llvm_context::polkavm_evm_contract_context::origin(context).map(Some) - } - InstructionName::CHAINID => { - revive_llvm_context::polkavm_evm_contract_context::chain_id(context).map(Some) - } - InstructionName::TIMESTAMP => { - revive_llvm_context::polkavm_evm_contract_context::block_timestamp(context) - .map(Some) - } - InstructionName::NUMBER => { - revive_llvm_context::polkavm_evm_contract_context::block_number(context).map(Some) - } - InstructionName::BLOCKHASH => { - 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) - .map(Some) - } - InstructionName::BLOBHASH => { - let _arguments = self.pop_arguments_llvm(context); - anyhow::bail!("The `BLOBHASH` instruction is not supported until zkVM v1.5.0"); - } - InstructionName::DIFFICULTY | InstructionName::PREVRANDAO => { - revive_llvm_context::polkavm_evm_contract_context::difficulty(context).map(Some) - } - InstructionName::COINBASE => { - revive_llvm_context::polkavm_evm_contract_context::coinbase(context).map(Some) - } - InstructionName::BASEFEE => { - revive_llvm_context::polkavm_evm_contract_context::basefee(context).map(Some) - } - InstructionName::BLOBBASEFEE => { - anyhow::bail!("The `BLOBBASEFEE` instruction is not supported until zkVM v1.5.0"); - } - InstructionName::MSIZE => { - revive_llvm_context::polkavm_evm_memory::msize(context).map(Some) - } - - InstructionName::CALLCODE => { - let mut _arguments = self.pop_arguments_llvm(context); - anyhow::bail!("The `CALLCODE` instruction is not supported"); - } - InstructionName::PC => { - anyhow::bail!("The `PC` instruction is not supported"); - } - InstructionName::EXTCODECOPY => { - let _arguments = self.pop_arguments_llvm(context); - anyhow::bail!("The `EXTCODECOPY` instruction is not supported"); - } - InstructionName::SELFDESTRUCT => { - let _arguments = self.pop_arguments_llvm(context)?; - anyhow::bail!("The `SELFDESTRUCT` instruction is not supported"); - } - - InstructionName::RecursiveCall { - name, - entry_key, - stack_hash, - output_size, - return_address, - .. - } => { - let mut arguments = self.pop_arguments_llvm(context)?; - arguments.pop(); - arguments.reverse(); - arguments.pop(); - - let function = context - .get_function(format!("{name}_{entry_key}").as_str()) - .expect("Always exists") - .borrow() - .declaration(); - let result = context.build_call( - function, - arguments.as_slice(), - format!("call_{}", name).as_str(), - ); - match result { - Some(value) if value.is_int_value() => { - let pointer = context.evmla().stack - [self.stack.elements.len() - output_size] - .to_llvm() - .into_pointer_value(); - context.build_store( - revive_llvm_context::PolkaVMPointer::new_stack_field(context, pointer), - value, - )?; - } - Some(value) if value.is_struct_value() => { - let return_value = value.into_struct_value(); - for index in 0..output_size { - let value = context - .builder() - .build_extract_value( - return_value, - index as u32, - format!("return_value_element_{}", index).as_str(), - ) - .expect("Always exists"); - let pointer = revive_llvm_context::PolkaVMPointer::new( - context.word_type(), - revive_llvm_context::PolkaVMAddressSpace::Stack, - context.evmla().stack - [self.stack.elements.len() - output_size + index] - .to_llvm() - .into_pointer_value(), - ); - context.build_store(pointer, value)?; - } - } - Some(_) => { - panic!("Only integers and structures can be returned from Ethir functions") - } - None => {} - } - - let return_block = context - .current_function() - .borrow() - .evmla() - .find_block(&return_address, &stack_hash)?; - context.build_unconditional_branch(return_block.inner()); - return Ok(()); - } - InstructionName::RecursiveReturn { .. } => { - let mut arguments = self.pop_arguments_llvm(context)?; - arguments.reverse(); - arguments.pop(); - - match context.current_function().borrow().r#return() { - revive_llvm_context::PolkaVMFunctionReturn::None => {} - revive_llvm_context::PolkaVMFunctionReturn::Primitive { pointer } => { - assert_eq!(arguments.len(), 1); - context.build_store(pointer, arguments.remove(0))?; - } - revive_llvm_context::PolkaVMFunctionReturn::Compound { pointer, .. } => { - for (index, argument) in arguments.into_iter().enumerate() { - let element_pointer = context.build_gep( - pointer, - &[ - context.word_const(0), - context - .integer_const(revive_common::BIT_LENGTH_X32, index as u64), - ], - context.word_type(), - format!("return_value_pointer_element_{}", index).as_str(), - ); - context.build_store(element_pointer, argument)?; - } - } - } - - let return_block = context.current_function().borrow().return_block(); - context.build_unconditional_branch(return_block); - Ok(None) - } - }?; - - if let Some(result) = result { - let pointer = context.evmla().stack[self.stack.elements.len() - 1] - .to_llvm() - .into_pointer_value(); - context.build_store( - revive_llvm_context::PolkaVMPointer::new_stack_field(context, pointer), - result, - )?; - context.evmla_mut().stack[self.stack.elements.len() - 1].original = original; - } - - Ok(()) - } -} - -impl std::fmt::Display for Element { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let mut stack = self.stack.to_owned(); - for _ in 0..self.stack_output.len() { - let _ = stack.pop(); - } - - write!(f, "{:80}{}", self.instruction.to_string(), stack)?; - if !self.stack_input.is_empty() { - write!(f, " - {}", self.stack_input)?; - } - if !self.stack_output.is_empty() { - write!(f, " + {}", self.stack_output)?; - } - Ok(()) - } -} diff --git a/crates/solidity/src/evmla/ethereal_ir/function/block/element/stack/element.rs b/crates/solidity/src/evmla/ethereal_ir/function/block/element/stack/element.rs deleted file mode 100644 index 10c1f53..0000000 --- a/crates/solidity/src/evmla/ethereal_ir/function/block/element/stack/element.rs +++ /dev/null @@ -1,37 +0,0 @@ -//! The Ethereal IR block element stack element. - -/// The Ethereal IR block element stack element. -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum Element { - /// The runtime value. - Value(String), - /// The compile-time value. - Constant(num::BigUint), - /// The compile-time destination tag. - Tag(num::BigUint), - /// The compile-time path. - Path(String), - /// The compile-time hexadecimal data chunk. - Data(String), - /// The recursive function return address. - ReturnAddress(usize), -} - -impl Element { - pub fn value(identifier: String) -> Self { - Self::Value(identifier) - } -} - -impl std::fmt::Display for Element { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Value(identifier) => write!(f, "V_{identifier}"), - Self::Constant(value) => write!(f, "{value:X}"), - Self::Tag(tag) => write!(f, "T_{tag}"), - Self::Path(path) => write!(f, "{path}"), - Self::Data(data) => write!(f, "{data}"), - Self::ReturnAddress(_) => write!(f, "RETURN_ADDRESS"), - } - } -} diff --git a/crates/solidity/src/evmla/ethereal_ir/function/block/element/stack/mod.rs b/crates/solidity/src/evmla/ethereal_ir/function/block/element/stack/mod.rs deleted file mode 100644 index f62a0f2..0000000 --- a/crates/solidity/src/evmla/ethereal_ir/function/block/element/stack/mod.rs +++ /dev/null @@ -1,120 +0,0 @@ -//! The Ethereal IR block element stack. - -pub mod element; - -use self::element::Element; - -/// The Ethereal IR block element stack. -#[derive(Debug, Default, Clone)] -pub struct Stack { - /// The stack elements. - pub elements: Vec, -} - -impl Stack { - /// The default stack size. - pub const DEFAULT_STACK_SIZE: usize = 16; - - /// A shortcut constructor. - pub fn new() -> Self { - Self { - elements: Vec::with_capacity(Self::DEFAULT_STACK_SIZE), - } - } - - /// A shortcut constructor. - pub fn with_capacity(capacity: usize) -> Self { - Self { - elements: Vec::with_capacity(capacity), - } - } - - /// A shortcut constructor. - pub fn new_with_elements(elements: Vec) -> Self { - Self { elements } - } - - /// The stack state hash, which acts as a block identifier. - /// Each block clone has its own initial stack state, which uniquely identifies the block. - pub fn hash(&self) -> md5::Digest { - let mut hash_context = md5::Context::new(); - for element in self.elements.iter() { - match element { - Element::Tag(tag) => hash_context.consume(tag.to_bytes_be()), - _ => hash_context.consume([0]), - } - } - hash_context.compute() - } - - /// Pushes an element onto the stack. - pub fn push(&mut self, element: Element) { - self.elements.push(element); - } - - /// Appends another stack on top of this one. - pub fn append(&mut self, other: &mut Self) { - self.elements.append(&mut other.elements); - } - - /// Pops a stack element. - pub fn pop(&mut self) -> anyhow::Result { - self.elements - .pop() - .ok_or_else(|| anyhow::anyhow!("Stack underflow")) - } - - /// Pops the tag from the top. - pub fn pop_tag(&mut self) -> anyhow::Result { - match self.elements.pop() { - Some(Element::Tag(tag)) => Ok(tag), - Some(element) => anyhow::bail!("Expected tag, found {}", element), - None => anyhow::bail!("Stack underflow"), - } - } - - /// Swaps two stack elements. - pub fn swap(&mut self, index: usize) -> anyhow::Result<()> { - if self.elements.len() < index + 1 { - anyhow::bail!("Stack underflow"); - } - - let length = self.elements.len(); - self.elements.swap(length - 1, length - 1 - index); - - Ok(()) - } - - /// Duplicates a stack element. - pub fn dup(&mut self, index: usize) -> anyhow::Result { - if self.elements.len() < index { - anyhow::bail!("Stack underflow"); - } - - Ok(self.elements[self.elements.len() - index].to_owned()) - } - - /// Returns the stack length. - pub fn len(&self) -> usize { - self.elements.len() - } - - /// Returns an emptiness flag. - pub fn is_empty(&self) -> bool { - self.elements.len() == 0 - } -} - -impl std::fmt::Display for Stack { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "[ {} ]", - self.elements - .iter() - .map(Element::to_string) - .collect::>() - .join(" | ") - ) - } -} diff --git a/crates/solidity/src/evmla/ethereal_ir/function/block/mod.rs b/crates/solidity/src/evmla/ethereal_ir/function/block/mod.rs deleted file mode 100644 index 9732286..0000000 --- a/crates/solidity/src/evmla/ethereal_ir/function/block/mod.rs +++ /dev/null @@ -1,156 +0,0 @@ -//! The Ethereal IR block. - -pub mod element; - -use std::collections::HashSet; - -use num::Zero; - -use crate::evmla::assembly::instruction::name::Name as InstructionName; -use crate::evmla::assembly::instruction::Instruction; - -use self::element::stack::Stack as ElementStack; -use self::element::Element; - -/// The Ethereal IR block. -#[derive(Debug, Clone)] -pub struct Block { - /// The Solidity compiler version. - pub solc_version: semver::Version, - /// The block key. - pub key: revive_llvm_context::PolkaVMFunctionBlockKey, - /// The block instance. - pub instance: Option, - /// The block elements relevant to the stack consistency. - pub elements: Vec, - /// The block predecessors. - pub predecessors: HashSet<(revive_llvm_context::PolkaVMFunctionBlockKey, usize)>, - /// The initial stack state. - pub initial_stack: ElementStack, - /// The stack. - pub stack: ElementStack, - /// The extra block hashes for alternative routes. - pub extra_hashes: Vec, -} - -impl Block { - /// The elements vector initial capacity. - pub const ELEMENTS_VECTOR_DEFAULT_CAPACITY: usize = 64; - /// The predecessors hashset initial capacity. - pub const PREDECESSORS_HASHSET_DEFAULT_CAPACITY: usize = 4; - - /// Assembles a block from the sequence of instructions. - pub fn try_from_instructions( - solc_version: semver::Version, - code_type: revive_llvm_context::PolkaVMCodeType, - slice: &[Instruction], - ) -> anyhow::Result<(Self, usize)> { - let mut cursor = 0; - - let tag: num::BigUint = match slice[cursor].name { - InstructionName::Tag => { - let tag = slice[cursor] - .value - .as_deref() - .expect("Always exists") - .parse() - .expect("Always valid"); - cursor += 1; - tag - } - _ => num::BigUint::zero(), - }; - - let mut block = Self { - solc_version: solc_version.clone(), - key: revive_llvm_context::PolkaVMFunctionBlockKey::new(code_type, tag), - instance: None, - elements: Vec::with_capacity(Self::ELEMENTS_VECTOR_DEFAULT_CAPACITY), - predecessors: HashSet::with_capacity(Self::PREDECESSORS_HASHSET_DEFAULT_CAPACITY), - initial_stack: ElementStack::new(), - stack: ElementStack::new(), - extra_hashes: vec![], - }; - - let mut dead_code = false; - while cursor < slice.len() { - if !dead_code { - let element: Element = Element::new(solc_version.clone(), slice[cursor].to_owned()); - block.elements.push(element); - } - - match slice[cursor].name { - InstructionName::RETURN - | InstructionName::REVERT - | InstructionName::STOP - | InstructionName::INVALID => { - cursor += 1; - dead_code = true; - } - InstructionName::JUMP => { - cursor += 1; - dead_code = true; - } - InstructionName::Tag => { - break; - } - _ => { - cursor += 1; - } - } - } - - Ok((block, cursor)) - } - - /// Inserts a predecessor tag. - pub fn insert_predecessor( - &mut self, - key: revive_llvm_context::PolkaVMFunctionBlockKey, - instance: usize, - ) { - self.predecessors.insert((key, instance)); - } -} - -impl revive_llvm_context::PolkaVMWriteLLVM for Block -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - fn into_llvm(self, context: &mut revive_llvm_context::PolkaVMContext) -> anyhow::Result<()> { - context.set_code_type(self.key.code_type); - - for element in self.elements.into_iter() { - element.into_llvm(context)?; - } - - Ok(()) - } -} - -impl std::fmt::Display for Block { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - writeln!( - f, - "block_{}/{}: {}", - self.key, - self.instance.unwrap_or_default(), - if self.predecessors.is_empty() { - "".to_owned() - } else { - format!( - "(predecessors: {})", - self.predecessors - .iter() - .map(|(key, instance)| format!("{}/{}", key, instance)) - .collect::>() - .join(", ") - ) - }, - )?; - for element in self.elements.iter() { - writeln!(f, " {element}")?; - } - Ok(()) - } -} diff --git a/crates/solidity/src/evmla/ethereal_ir/function/mod.rs b/crates/solidity/src/evmla/ethereal_ir/function/mod.rs deleted file mode 100644 index 4ad7ed3..0000000 --- a/crates/solidity/src/evmla/ethereal_ir/function/mod.rs +++ /dev/null @@ -1,1329 +0,0 @@ -//! The Ethereal IR function. - -pub mod block; -pub mod queue_element; -pub mod r#type; -pub mod visited_element; - -use std::collections::BTreeMap; -use std::collections::BTreeSet; -use std::collections::HashMap; - -use inkwell::types::BasicType; -use inkwell::values::BasicValue; -use num::CheckedAdd; -use num::CheckedDiv; -use num::CheckedMul; -use num::CheckedSub; -use num::Num; -use num::One; -use num::ToPrimitive; -use num::Zero; - -use crate::evmla::assembly::instruction::name::Name as InstructionName; -use crate::evmla::assembly::instruction::Instruction; -use crate::evmla::ethereal_ir::function::block::element::stack::element::Element; -use crate::evmla::ethereal_ir::function::block::element::stack::Stack; -use crate::evmla::ethereal_ir::EtherealIR; -use crate::solc::standard_json::output::contract::evm::extra_metadata::recursive_function::RecursiveFunction; -use crate::solc::standard_json::output::contract::evm::extra_metadata::ExtraMetadata; - -use self::block::element::stack::element::Element as StackElement; -use self::block::element::Element as BlockElement; -use self::block::Block; -use self::queue_element::QueueElement; -use self::r#type::Type; -use self::visited_element::VisitedElement; - -/// The Ethereal IR function. -#[derive(Debug, Clone)] -pub struct Function { - /// The Solidity compiler version. - pub solc_version: semver::Version, - /// The function name. - pub name: String, - /// The separately labelled blocks. - pub blocks: BTreeMap>, - /// The function type. - pub r#type: Type, - /// The function stack size. - pub stack_size: usize, -} - -impl Function { - /// A shortcut constructor. - pub fn new(solc_version: semver::Version, r#type: Type) -> Self { - let name = match r#type { - Type::Initial => EtherealIR::DEFAULT_ENTRY_FUNCTION_NAME.to_string(), - Type::Recursive { - ref name, - ref block_key, - .. - } => format!("{name}_{block_key}"), - }; - - Self { - solc_version, - name, - blocks: BTreeMap::new(), - r#type, - stack_size: 0, - } - } - - /// Runs the function block traversal. - pub fn traverse( - &mut self, - blocks: &HashMap, - functions: &mut BTreeMap, - extra_metadata: &ExtraMetadata, - visited_functions: &mut BTreeSet, - ) -> anyhow::Result<()> { - let mut visited_blocks = BTreeSet::new(); - - match self.r#type { - Type::Initial => { - for code_type in [ - revive_llvm_context::PolkaVMCodeType::Deploy, - revive_llvm_context::PolkaVMCodeType::Runtime, - ] { - self.consume_block( - blocks, - functions, - extra_metadata, - visited_functions, - &mut visited_blocks, - QueueElement::new( - revive_llvm_context::PolkaVMFunctionBlockKey::new( - code_type, - num::BigUint::zero(), - ), - None, - Stack::new(), - ), - )?; - } - } - Type::Recursive { - ref block_key, - input_size, - output_size, - .. - } => { - let mut stack = Stack::with_capacity(1 + input_size); - stack.push(Element::ReturnAddress(output_size)); - stack.append(&mut Stack::new_with_elements(vec![ - Element::value( - "ARGUMENT".to_owned() - ); - input_size - ])); - - self.consume_block( - blocks, - functions, - extra_metadata, - visited_functions, - &mut visited_blocks, - QueueElement::new(block_key.to_owned(), None, stack), - )?; - } - } - - self.finalize(); - - Ok(()) - } - - /// Consumes the entry or a conditional block attached to another one. - fn consume_block( - &mut self, - blocks: &HashMap, - functions: &mut BTreeMap, - extra_metadata: &ExtraMetadata, - visited_functions: &mut BTreeSet, - visited_blocks: &mut BTreeSet, - mut queue_element: QueueElement, - ) -> anyhow::Result<()> { - let version = self.solc_version.to_owned(); - - let mut queue = vec![]; - - let mut block = blocks - .get(&queue_element.block_key) - .cloned() - .ok_or_else(|| { - anyhow::anyhow!("Undeclared destination block {}", queue_element.block_key) - })?; - block.initial_stack = queue_element.stack.clone(); - let block = self.insert_block(block); - block.stack = block.initial_stack.clone(); - if let Some(predecessor) = queue_element.predecessor.take() { - block.insert_predecessor(predecessor.0, predecessor.1); - } - - let visited_element = - VisitedElement::new(queue_element.block_key.clone(), queue_element.stack.hash()); - if visited_blocks.contains(&visited_element) { - return Ok(()); - } - visited_blocks.insert(visited_element); - - let mut block_size = 0; - for block_element in block.elements.iter_mut() { - block_size += 1; - - if Self::handle_instruction( - blocks, - functions, - extra_metadata, - visited_functions, - block.key.code_type, - block.instance.unwrap_or_default(), - &mut block.stack, - block_element, - &version, - &mut queue, - &mut queue_element, - ) - .is_err() - { - block_element.instruction = Instruction::invalid(&block_element.instruction); - block_element.stack = block.stack.clone(); - break; - } - } - block.elements.truncate(block_size); - - for element in queue.into_iter() { - self.consume_block( - blocks, - functions, - extra_metadata, - visited_functions, - visited_blocks, - element, - )?; - } - - Ok(()) - } - - /// Processes an instruction, returning an error, if there is an invalid stack state. - /// The blocks with an invalid stack state are considered being partially unreachable, and - /// the invalid part is truncated after terminating with an `INVALID` instruction. - #[allow(clippy::too_many_arguments)] - fn handle_instruction( - blocks: &HashMap, - functions: &mut BTreeMap, - extra_metadata: &ExtraMetadata, - visited_functions: &mut BTreeSet, - code_type: revive_llvm_context::PolkaVMCodeType, - instance: usize, - block_stack: &mut Stack, - block_element: &mut BlockElement, - version: &semver::Version, - queue: &mut Vec, - queue_element: &mut QueueElement, - ) -> anyhow::Result<()> { - let (stack_output, queue_element) = match block_element.instruction { - Instruction { - name: InstructionName::PUSH_Tag, - value: Some(ref tag), - .. - } => { - let tag: num::BigUint = tag.parse().expect("Always valid"); - (vec![Element::Tag(tag & num::BigUint::from(u64::MAX))], None) - } - ref instruction @ Instruction { - name: InstructionName::JUMP, - .. - } => { - queue_element.predecessor = Some((queue_element.block_key.clone(), instance)); - - let block_key = match block_stack - .elements - .last() - .ok_or_else(|| anyhow::anyhow!("Destination tag is missing"))? - { - Element::Tag(destination) if destination > &num::BigUint::from(u32::MAX) => { - revive_llvm_context::PolkaVMFunctionBlockKey::new( - revive_llvm_context::PolkaVMCodeType::Runtime, - destination.to_owned() - num::BigUint::from(1u64 << 32), - ) - } - Element::Tag(destination) => revive_llvm_context::PolkaVMFunctionBlockKey::new( - code_type, - destination.to_owned(), - ), - Element::ReturnAddress(output_size) => { - block_element.instruction = - Instruction::recursive_return(1 + output_size, instruction); - Self::update_io_data(block_stack, block_element, 1 + output_size, vec![])?; - return Ok(()); - } - element => { - return Err(anyhow::anyhow!( - "The {} instruction expected a tag or return address, found {}", - instruction.name, - element - )); - } - }; - - let (next_block_key, stack_output) = - if let Some(recursive_function) = extra_metadata.get(&block_key) { - Self::handle_recursive_function_call( - recursive_function, - blocks, - functions, - extra_metadata, - visited_functions, - block_key, - block_stack, - block_element, - version, - )? - } else { - (block_key, vec![]) - }; - - ( - stack_output, - Some(QueueElement::new( - next_block_key, - queue_element.predecessor.clone(), - Stack::new(), - )), - ) - } - ref instruction @ Instruction { - name: InstructionName::JUMPI, - .. - } => { - queue_element.predecessor = Some((queue_element.block_key.clone(), instance)); - - let block_key = match block_stack - .elements - .last() - .ok_or_else(|| anyhow::anyhow!("Destination tag is missing"))? - { - Element::Tag(destination) if destination > &num::BigUint::from(u32::MAX) => { - revive_llvm_context::PolkaVMFunctionBlockKey::new( - revive_llvm_context::PolkaVMCodeType::Runtime, - destination.to_owned() - num::BigUint::from(1u64 << 32), - ) - } - Element::Tag(destination) => revive_llvm_context::PolkaVMFunctionBlockKey::new( - code_type, - destination.to_owned(), - ), - element => { - return Err(anyhow::anyhow!( - "The {} instruction expected a tag or return address, found {}", - instruction.name, - element - )); - } - }; - - ( - vec![], - Some(QueueElement::new( - block_key, - queue_element.predecessor.clone(), - Stack::new(), - )), - ) - } - Instruction { - name: InstructionName::Tag, - value: Some(ref tag), - .. - } => { - let tag: num::BigUint = tag.parse().expect("Always valid"); - let block_key = revive_llvm_context::PolkaVMFunctionBlockKey::new(code_type, tag); - - queue_element.predecessor = Some((queue_element.block_key.clone(), instance)); - queue_element.block_key = block_key.clone(); - - ( - vec![], - Some(QueueElement::new( - block_key, - queue_element.predecessor.clone(), - Stack::new(), - )), - ) - } - - Instruction { - name: InstructionName::SWAP1, - .. - } => { - block_stack.swap(1)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP2, - .. - } => { - block_stack.swap(2)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP3, - .. - } => { - block_stack.swap(3)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP4, - .. - } => { - block_stack.swap(4)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP5, - .. - } => { - block_stack.swap(5)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP6, - .. - } => { - block_stack.swap(6)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP7, - .. - } => { - block_stack.swap(7)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP8, - .. - } => { - block_stack.swap(8)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP9, - .. - } => { - block_stack.swap(9)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP10, - .. - } => { - block_stack.swap(10)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP11, - .. - } => { - block_stack.swap(11)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP12, - .. - } => { - block_stack.swap(12)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP13, - .. - } => { - block_stack.swap(13)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP14, - .. - } => { - block_stack.swap(14)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP15, - .. - } => { - block_stack.swap(15)?; - (vec![], None) - } - Instruction { - name: InstructionName::SWAP16, - .. - } => { - block_stack.swap(16)?; - (vec![], None) - } - - Instruction { - name: InstructionName::DUP1, - .. - } => (vec![block_stack.dup(1)?], None), - Instruction { - name: InstructionName::DUP2, - .. - } => (vec![block_stack.dup(2)?], None), - Instruction { - name: InstructionName::DUP3, - .. - } => (vec![block_stack.dup(3)?], None), - Instruction { - name: InstructionName::DUP4, - .. - } => (vec![block_stack.dup(4)?], None), - Instruction { - name: InstructionName::DUP5, - .. - } => (vec![block_stack.dup(5)?], None), - Instruction { - name: InstructionName::DUP6, - .. - } => (vec![block_stack.dup(6)?], None), - Instruction { - name: InstructionName::DUP7, - .. - } => (vec![block_stack.dup(7)?], None), - Instruction { - name: InstructionName::DUP8, - .. - } => (vec![block_stack.dup(8)?], None), - Instruction { - name: InstructionName::DUP9, - .. - } => (vec![block_stack.dup(9)?], None), - Instruction { - name: InstructionName::DUP10, - .. - } => (vec![block_stack.dup(10)?], None), - Instruction { - name: InstructionName::DUP11, - .. - } => (vec![block_stack.dup(11)?], None), - Instruction { - name: InstructionName::DUP12, - .. - } => (vec![block_stack.dup(12)?], None), - Instruction { - name: InstructionName::DUP13, - .. - } => (vec![block_stack.dup(13)?], None), - Instruction { - name: InstructionName::DUP14, - .. - } => (vec![block_stack.dup(14)?], None), - Instruction { - name: InstructionName::DUP15, - .. - } => (vec![block_stack.dup(15)?], None), - Instruction { - name: InstructionName::DUP16, - .. - } => (vec![block_stack.dup(16)?], None), - - Instruction { - name: - InstructionName::PUSH - | InstructionName::PUSH1 - | InstructionName::PUSH2 - | InstructionName::PUSH3 - | InstructionName::PUSH4 - | InstructionName::PUSH5 - | InstructionName::PUSH6 - | InstructionName::PUSH7 - | InstructionName::PUSH8 - | InstructionName::PUSH9 - | InstructionName::PUSH10 - | InstructionName::PUSH11 - | InstructionName::PUSH12 - | InstructionName::PUSH13 - | InstructionName::PUSH14 - | InstructionName::PUSH15 - | InstructionName::PUSH16 - | InstructionName::PUSH17 - | InstructionName::PUSH18 - | InstructionName::PUSH19 - | InstructionName::PUSH20 - | InstructionName::PUSH21 - | InstructionName::PUSH22 - | InstructionName::PUSH23 - | InstructionName::PUSH24 - | InstructionName::PUSH25 - | InstructionName::PUSH26 - | InstructionName::PUSH27 - | InstructionName::PUSH28 - | InstructionName::PUSH29 - | InstructionName::PUSH30 - | InstructionName::PUSH31 - | InstructionName::PUSH32, - value: Some(ref constant), - .. - } => ( - vec![num::BigUint::from_str_radix( - constant.as_str(), - revive_common::BASE_HEXADECIMAL, - ) - .map(StackElement::Constant)?], - None, - ), - Instruction { - name: - InstructionName::PUSH_ContractHash - | InstructionName::PUSH_ContractHashSize - | InstructionName::PUSHLIB, - value: Some(ref path), - .. - } => (vec![StackElement::Path(path.to_owned())], None), - Instruction { - name: InstructionName::PUSH_Data, - value: Some(ref data), - .. - } => (vec![StackElement::Data(data.to_owned())], None), - ref instruction @ Instruction { - name: InstructionName::PUSHDEPLOYADDRESS, - .. - } => ( - vec![StackElement::value(instruction.name.to_string())], - None, - ), - - ref instruction @ Instruction { - name: InstructionName::ADD, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[1], &operands[0]) { - (Element::Tag(operand_1), Element::Constant(operand_2)) - | (Element::Constant(operand_1), Element::Tag(operand_2)) - | (Element::Tag(operand_1), Element::Tag(operand_2)) => { - match operand_1.checked_add(operand_2) { - Some(result) if Self::is_tag_value_valid(blocks, &result) => { - Element::Tag(result) - } - Some(_result) => Element::value(instruction.name.to_string()), - None => Element::value(instruction.name.to_string()), - } - } - (Element::Constant(operand_1), Element::Constant(operand_2)) => { - match operand_1.checked_add(operand_2) { - Some(result) => Element::Constant(result), - None => Element::value(instruction.name.to_string()), - } - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::SUB, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[1], &operands[0]) { - (Element::Tag(operand_1), Element::Constant(operand_2)) - | (Element::Constant(operand_1), Element::Tag(operand_2)) - | (Element::Tag(operand_1), Element::Tag(operand_2)) => { - match operand_1.checked_sub(operand_2) { - Some(result) if Self::is_tag_value_valid(blocks, &result) => { - Element::Tag(result) - } - Some(_result) => Element::value(instruction.name.to_string()), - None => Element::value(instruction.name.to_string()), - } - } - (Element::Constant(operand_1), Element::Constant(operand_2)) => { - match operand_1.checked_sub(operand_2) { - Some(result) => Element::Constant(result), - None => Element::value(instruction.name.to_string()), - } - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::MUL, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[1], &operands[0]) { - (Element::Tag(operand_1), Element::Constant(operand_2)) - | (Element::Constant(operand_1), Element::Tag(operand_2)) - | (Element::Tag(operand_1), Element::Tag(operand_2)) => { - match operand_1.checked_mul(operand_2) { - Some(result) if Self::is_tag_value_valid(blocks, &result) => { - Element::Tag(result) - } - Some(_result) => Element::value(instruction.name.to_string()), - None => Element::value(instruction.name.to_string()), - } - } - (Element::Constant(operand_1), Element::Constant(operand_2)) => { - match operand_1.checked_mul(operand_2) { - Some(result) => Element::Constant(result), - None => Element::value(instruction.name.to_string()), - } - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::DIV, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[1], &operands[0]) { - (Element::Tag(operand_1), Element::Constant(operand_2)) - | (Element::Constant(operand_1), Element::Tag(operand_2)) - | (Element::Tag(operand_1), Element::Tag(operand_2)) => { - if operand_2.is_zero() { - Element::Tag(num::BigUint::zero()) - } else { - match operand_1.checked_div(operand_2) { - Some(result) if Self::is_tag_value_valid(blocks, &result) => { - Element::Tag(result) - } - Some(_result) => Element::value(instruction.name.to_string()), - None => Element::value(instruction.name.to_string()), - } - } - } - (Element::Constant(operand_1), Element::Constant(operand_2)) => { - if operand_2.is_zero() { - Element::Constant(num::BigUint::zero()) - } else { - match operand_1.checked_div(operand_2) { - Some(result) => Element::Constant(result), - None => Element::value(instruction.name.to_string()), - } - } - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::MOD, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[1], &operands[0]) { - (Element::Tag(operand_1), Element::Constant(operand_2)) - | (Element::Constant(operand_1), Element::Tag(operand_2)) - | (Element::Tag(operand_1), Element::Tag(operand_2)) => { - if operand_2.is_zero() { - Element::Tag(num::BigUint::zero()) - } else { - let result = operand_1 % operand_2; - if Self::is_tag_value_valid(blocks, &result) { - Element::Tag(result) - } else { - Element::value(instruction.name.to_string()) - } - } - } - (Element::Constant(operand_1), Element::Constant(operand_2)) => { - if operand_2.is_zero() { - Element::Constant(num::BigUint::zero()) - } else { - Element::Constant(operand_1 % operand_2) - } - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::SHL, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[0], &operands[1]) { - (Element::Tag(tag), Element::Constant(offset)) => { - let offset = offset % revive_common::BIT_LENGTH_WORD; - let offset = offset.to_u64().expect("Always valid"); - let result = tag << offset; - if Self::is_tag_value_valid(blocks, &result) { - Element::Tag(result) - } else { - Element::value(instruction.name.to_string()) - } - } - (Element::Constant(constant), Element::Constant(offset)) => { - let offset = offset % revive_common::BIT_LENGTH_WORD; - let offset = offset.to_u64().expect("Always valid"); - Element::Constant(constant << offset) - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::SHR, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[0], &operands[1]) { - (Element::Tag(tag), Element::Constant(offset)) => { - let offset = offset % revive_common::BIT_LENGTH_WORD; - let offset = offset.to_u64().expect("Always valid"); - let result = tag >> offset; - if Self::is_tag_value_valid(blocks, &result) { - Element::Tag(result) - } else { - Element::value(instruction.name.to_string()) - } - } - (Element::Constant(constant), Element::Constant(offset)) => { - let offset = offset % revive_common::BIT_LENGTH_WORD; - let offset = offset.to_u64().expect("Always valid"); - Element::Constant(constant >> offset) - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::OR, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[1], &operands[0]) { - (Element::Tag(operand_1), Element::Tag(operand_2)) - | (Element::Tag(operand_1), Element::Constant(operand_2)) - | (Element::Constant(operand_1), Element::Tag(operand_2)) => { - let result = operand_1 | operand_2; - if Self::is_tag_value_valid(blocks, &result) { - Element::Tag(result) - } else { - Element::value(instruction.name.to_string()) - } - } - (Element::Constant(operand_1), Element::Constant(operand_2)) => { - Element::Constant(operand_1 | operand_2) - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::XOR, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[1], &operands[0]) { - (Element::Tag(operand_1), Element::Tag(operand_2)) - | (Element::Tag(operand_1), Element::Constant(operand_2)) - | (Element::Constant(operand_1), Element::Tag(operand_2)) => { - let result = operand_1 ^ operand_2; - if Self::is_tag_value_valid(blocks, &result) { - Element::Tag(result) - } else { - Element::value(instruction.name.to_string()) - } - } - (Element::Constant(operand_1), Element::Constant(operand_2)) => { - Element::Constant(operand_1 ^ operand_2) - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::AND, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[1], &operands[0]) { - (Element::Tag(operand_1), Element::Tag(operand_2)) - | (Element::Tag(operand_1), Element::Constant(operand_2)) - | (Element::Constant(operand_1), Element::Tag(operand_2)) => { - let result = operand_1 & operand_2; - if Self::is_tag_value_valid(blocks, &result) { - Element::Tag(result) - } else { - Element::value(instruction.name.to_string()) - } - } - (Element::Constant(operand_1), Element::Constant(operand_2)) => { - Element::Constant(operand_1 & operand_2) - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - - ref instruction @ Instruction { - name: InstructionName::LT, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[1], &operands[0]) { - (Element::Tag(operand_1), Element::Tag(operand_2)) => { - Element::Constant(num::BigUint::from(u64::from(operand_1 < operand_2))) - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::GT, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[1], &operands[0]) { - (Element::Tag(operand_1), Element::Tag(operand_2)) => { - Element::Constant(num::BigUint::from(u64::from(operand_1 > operand_2))) - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::EQ, - .. - } => { - let operands = &block_stack.elements[block_stack.elements.len() - 2..]; - - let result = match (&operands[1], &operands[0]) { - (Element::Tag(operand_1), Element::Tag(operand_2)) => { - Element::Constant(num::BigUint::from(u64::from(operand_1 == operand_2))) - } - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - ref instruction @ Instruction { - name: InstructionName::ISZERO, - .. - } => { - let operand = block_stack - .elements - .last() - .ok_or_else(|| anyhow::anyhow!("Operand is missing"))?; - - let result = match operand { - Element::Tag(operand) => Element::Constant(if operand.is_zero() { - num::BigUint::one() - } else { - num::BigUint::zero() - }), - _ => Element::value(instruction.name.to_string()), - }; - - (vec![result], None) - } - - ref instruction => ( - vec![Element::value(instruction.name.to_string()); instruction.output_size()], - None, - ), - }; - - Self::update_io_data( - block_stack, - block_element, - block_element.instruction.input_size(version), - stack_output, - )?; - - if let Some(mut queue_element) = queue_element { - block_element.stack.clone_into(&mut queue_element.stack); - queue.push(queue_element); - } - - Ok(()) - } - - /// Updates the stack data with input and output data. - fn update_io_data( - block_stack: &mut Stack, - block_element: &mut BlockElement, - input_size: usize, - output_data: Vec, - ) -> anyhow::Result<()> { - if block_stack.len() < input_size { - anyhow::bail!("Stack underflow"); - } - block_element.stack_input = Stack::new_with_elements( - block_stack - .elements - .drain(block_stack.len() - input_size..) - .collect(), - ); - block_element.stack_output = Stack::new_with_elements(output_data); - block_stack.append(&mut block_element.stack_output.clone()); - block_element.stack = block_stack.clone(); - Ok(()) - } - - /// Handles the recursive function call. - #[allow(clippy::too_many_arguments)] - fn handle_recursive_function_call( - recursive_function: &RecursiveFunction, - blocks: &HashMap, - functions: &mut BTreeMap, - extra_metadata: &ExtraMetadata, - visited_functions: &mut BTreeSet, - block_key: revive_llvm_context::PolkaVMFunctionBlockKey, - block_stack: &mut Stack, - block_element: &mut BlockElement, - version: &semver::Version, - ) -> anyhow::Result<(revive_llvm_context::PolkaVMFunctionBlockKey, Vec)> { - let return_address_offset = block_stack.elements.len() - 2 - recursive_function.input_size; - let input_arguments_offset = return_address_offset + 1; - let callee_tag_offset = input_arguments_offset + recursive_function.input_size; - - let return_address = match block_stack.elements[return_address_offset] { - Element::Tag(ref return_address) => revive_llvm_context::PolkaVMFunctionBlockKey::new( - block_key.code_type, - return_address.to_owned(), - ), - ref element => anyhow::bail!("Expected the function return address, found {}", element), - }; - let mut stack = Stack::with_capacity(1 + recursive_function.input_size); - stack.push(StackElement::ReturnAddress( - 1 + recursive_function.output_size, - )); - stack.append(&mut Stack::new_with_elements( - block_stack.elements[input_arguments_offset..callee_tag_offset].to_owned(), - )); - let stack_hash = stack.hash(); - - let visited_element = VisitedElement::new(block_key.clone(), stack_hash); - if !visited_functions.contains(&visited_element) { - let mut function = Self::new( - version.to_owned(), - Type::new_recursive( - recursive_function.name.to_owned(), - block_key.clone(), - recursive_function.input_size, - recursive_function.output_size, - ), - ); - visited_functions.insert(visited_element); - function.traverse(blocks, functions, extra_metadata, visited_functions)?; - functions.insert(block_key.clone(), function); - } - - let stack_output = - vec![Element::value("RETURN_VALUE".to_owned()); recursive_function.output_size]; - let mut return_stack = Stack::new_with_elements( - block_stack.elements[..block_stack.len() - recursive_function.input_size - 2] - .to_owned(), - ); - return_stack.append(&mut Stack::new_with_elements(stack_output.clone())); - let return_stack_hash = return_stack.hash(); - - block_element.instruction = Instruction::recursive_call( - recursive_function.name.to_owned(), - block_key, - return_stack_hash, - recursive_function.input_size + 2, - recursive_function.output_size, - return_address.clone(), - &block_element.instruction, - ); - - Ok((return_address, stack_output)) - } - - /// Pushes a block into the function. - fn insert_block(&mut self, mut block: Block) -> &mut Block { - let key = block.key.clone(); - - if let Some(entry) = self.blocks.get_mut(&key) { - if entry.iter().all(|existing_block| { - existing_block.initial_stack.hash() != block.initial_stack.hash() - }) { - block.instance = Some(entry.len()); - entry.push(block); - } - } else { - block.instance = Some(0); - self.blocks.insert(block.key.clone(), vec![block]); - } - - self.blocks - .get_mut(&key) - .expect("Always exists") - .last_mut() - .expect("Always exists") - } - - /// Checks whether the tag value actually references an existing block. - /// Checks both deploy and runtime code. - fn is_tag_value_valid( - blocks: &HashMap, - tag: &num::BigUint, - ) -> bool { - blocks.contains_key(&revive_llvm_context::PolkaVMFunctionBlockKey::new( - revive_llvm_context::PolkaVMCodeType::Deploy, - tag & num::BigUint::from(u32::MAX), - )) || blocks.contains_key(&revive_llvm_context::PolkaVMFunctionBlockKey::new( - revive_llvm_context::PolkaVMCodeType::Runtime, - tag & num::BigUint::from(u32::MAX), - )) - } - - /// Finalizes the function data. - fn finalize(&mut self) { - for (_tag, blocks) in self.blocks.iter() { - for block in blocks.iter() { - for block_element in block.elements.iter() { - let total_length = block_element.stack.elements.len() - + block_element.stack_input.len() - + block_element.stack_output.len(); - if total_length > self.stack_size { - self.stack_size = total_length; - } - } - } - } - } -} - -impl revive_llvm_context::PolkaVMWriteLLVM for Function -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - fn declare( - &mut self, - context: &mut revive_llvm_context::PolkaVMContext, - ) -> anyhow::Result<()> { - let (function_type, output_size) = match self.r#type { - Type::Initial => { - let output_size = 0; - let r#type = context.function_type( - vec![context - .integer_type(revive_common::BIT_LENGTH_BOOLEAN) - .as_basic_type_enum()], - output_size, - ); - (r#type, output_size) - } - Type::Recursive { - input_size, - output_size, - .. - } => { - let r#type = context.function_type( - vec![ - context - .integer_type(revive_common::BIT_LENGTH_WORD) - .as_basic_type_enum(); - input_size - ], - output_size, - ); - (r#type, output_size) - } - }; - let function = context.add_function( - self.name.as_str(), - function_type, - output_size, - Some(inkwell::module::Linkage::External), - )?; - function - .borrow_mut() - .set_evmla_data(revive_llvm_context::PolkaVMFunctionEVMLAData::new( - self.stack_size, - )); - - Ok(()) - } - - fn into_llvm(self, context: &mut revive_llvm_context::PolkaVMContext) -> anyhow::Result<()> { - context.set_current_function(self.name.as_str(), None)?; - - for (key, blocks) in self.blocks.iter() { - for (index, block) in blocks.iter().enumerate() { - let inner = context.append_basic_block(format!("block_{key}/{index}").as_str()); - let mut stack_hashes = vec![block.initial_stack.hash()]; - stack_hashes.extend_from_slice(block.extra_hashes.as_slice()); - let evmla_data = - revive_llvm_context::PolkaVMFunctionBlockEVMLAData::new(stack_hashes); - let mut block = revive_llvm_context::PolkaVMFunctionBlock::new(inner); - block.set_evmla_data(evmla_data); - context - .current_function() - .borrow_mut() - .evmla_mut() - .insert_block(key.to_owned(), block); - } - } - - context.set_basic_block(context.current_function().borrow().entry_block()); - let mut stack_variables = Vec::with_capacity(self.stack_size); - for stack_index in 0..self.stack_size { - let pointer = context.build_alloca( - context.word_type(), - format!("stack_var_{stack_index:03}").as_str(), - ); - let value = match self.r#type { - Type::Recursive { input_size, .. } - if stack_index >= 1 && stack_index <= input_size => - { - context - .current_function() - .borrow() - .declaration() - .value - .get_nth_param((stack_index - 1) as u32) - .expect("Always valid") - } - _ => context.word_const(0).as_basic_value_enum(), - }; - context.build_store(pointer, value)?; - stack_variables.push(revive_llvm_context::PolkaVMArgument::new( - pointer.value.as_basic_value_enum(), - )); - } - context.evmla_mut().stack = stack_variables; - - match self.r#type { - Type::Initial => { - let is_deploy_code_flag = context - .current_function() - .borrow() - .get_nth_param(0) - .into_int_value(); - let deploy_code_block = context.current_function().borrow().evmla().find_block( - &revive_llvm_context::PolkaVMFunctionBlockKey::new( - revive_llvm_context::PolkaVMCodeType::Deploy, - num::BigUint::zero(), - ), - &Stack::default().hash(), - )?; - let runtime_code_block = context.current_function().borrow().evmla().find_block( - &revive_llvm_context::PolkaVMFunctionBlockKey::new( - revive_llvm_context::PolkaVMCodeType::Runtime, - num::BigUint::zero(), - ), - &Stack::default().hash(), - )?; - context.build_conditional_branch( - is_deploy_code_flag, - deploy_code_block.inner(), - runtime_code_block.inner(), - )?; - } - Type::Recursive { ref block_key, .. } => { - let initial_block = context - .current_function() - .borrow() - .evmla() - .blocks - .get(block_key) - .expect("Always exists") - .first() - .expect("Always exists") - .inner(); - context.build_unconditional_branch(initial_block); - } - } - - for (key, blocks) in self.blocks.into_iter() { - for (llvm_block, ir_block) in context - .current_function() - .borrow() - .evmla() - .blocks - .get(&key) - .cloned() - .ok_or_else(|| anyhow::anyhow!("Undeclared function block {}", key))? - .into_iter() - .map(|block| block.inner()) - .zip(blocks) - { - context.set_basic_block(llvm_block); - ir_block.into_llvm(context)?; - } - } - - context.set_basic_block(context.current_function().borrow().return_block()); - match context.current_function().borrow().r#return() { - revive_llvm_context::PolkaVMFunctionReturn::None => { - context.build_return(None); - } - revive_llvm_context::PolkaVMFunctionReturn::Primitive { pointer } => { - let return_value = context.build_load(pointer, "return_value")?; - context.build_return(Some(&return_value)); - } - revive_llvm_context::PolkaVMFunctionReturn::Compound { pointer, .. } => { - let return_value = context.build_load(pointer, "return_value")?; - context.build_return(Some(&return_value)); - } - } - - context.pop_debug_scope(); - - Ok(()) - } -} - -impl std::fmt::Display for Function { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self.r#type { - Type::Initial => writeln!(f, "function {} {{", self.name), - Type::Recursive { - input_size, - output_size, - .. - } => writeln!( - f, - "function {}({}) -> {} {{", - self.name, input_size, output_size - ), - }?; - writeln!(f, " stack_usage: {}", self.stack_size)?; - for (_key, blocks) in self.blocks.iter() { - for block in blocks.iter() { - write!(f, "{block}")?; - } - } - writeln!(f, "}}")?; - Ok(()) - } -} diff --git a/crates/solidity/src/evmla/ethereal_ir/function/queue_element.rs b/crates/solidity/src/evmla/ethereal_ir/function/queue_element.rs deleted file mode 100644 index 6a28d31..0000000 --- a/crates/solidity/src/evmla/ethereal_ir/function/queue_element.rs +++ /dev/null @@ -1,29 +0,0 @@ -//! The Ethereal IR block queue element. - -use crate::evmla::ethereal_ir::function::block::element::stack::Stack; - -/// The Ethereal IR block queue element. -#[derive(Debug, Clone)] -pub struct QueueElement { - /// The block key. - pub block_key: revive_llvm_context::PolkaVMFunctionBlockKey, - /// The block predecessor. - pub predecessor: Option<(revive_llvm_context::PolkaVMFunctionBlockKey, usize)>, - /// The predecessor's last stack state. - pub stack: Stack, -} - -impl QueueElement { - /// A shortcut constructor. - pub fn new( - block_key: revive_llvm_context::PolkaVMFunctionBlockKey, - predecessor: Option<(revive_llvm_context::PolkaVMFunctionBlockKey, usize)>, - stack: Stack, - ) -> Self { - Self { - block_key, - predecessor, - stack, - } - } -} diff --git a/crates/solidity/src/evmla/ethereal_ir/function/type.rs b/crates/solidity/src/evmla/ethereal_ir/function/type.rs deleted file mode 100644 index 1dbeffa..0000000 --- a/crates/solidity/src/evmla/ethereal_ir/function/type.rs +++ /dev/null @@ -1,41 +0,0 @@ -//! The Ethereal IR function type. - -/// The Ethereal IR function type. -#[derive(Debug, Clone)] -pub enum Type { - /// The initial function, combining deploy and runtime code. - Initial, - /// The recursive function with a specific block starting its recursive context. - Recursive { - /// The function name. - name: String, - /// The function initial block key. - block_key: revive_llvm_context::PolkaVMFunctionBlockKey, - /// The size of stack input (in cells or 256-bit words). - input_size: usize, - /// The size of stack output (in cells or 256-bit words). - output_size: usize, - }, -} - -impl Type { - /// A shortcut constructor. - pub fn new_initial() -> Self { - Self::Initial - } - - /// A shortcut constructor. - pub fn new_recursive( - name: String, - block_key: revive_llvm_context::PolkaVMFunctionBlockKey, - input_size: usize, - output_size: usize, - ) -> Self { - Self::Recursive { - name, - block_key, - input_size, - output_size, - } - } -} diff --git a/crates/solidity/src/evmla/ethereal_ir/function/visited_element.rs b/crates/solidity/src/evmla/ethereal_ir/function/visited_element.rs deleted file mode 100644 index c8456eb..0000000 --- a/crates/solidity/src/evmla/ethereal_ir/function/visited_element.rs +++ /dev/null @@ -1,65 +0,0 @@ -//! The Ethereal IR block visited element. - -use std::cmp::Ordering; - -/// The Ethereal IR block visited element. -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct VisitedElement { - /// The block key. - pub block_key: revive_llvm_context::PolkaVMFunctionBlockKey, - /// The initial stack state hash. - pub stack_hash: md5::Digest, -} - -impl VisitedElement { - /// A shortcut constructor. - pub fn new( - block_key: revive_llvm_context::PolkaVMFunctionBlockKey, - stack_hash: md5::Digest, - ) -> Self { - Self { - block_key, - stack_hash, - } - } -} - -impl PartialOrd for VisitedElement { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - -impl Ord for VisitedElement { - fn cmp(&self, other: &Self) -> Ordering { - match (self.block_key.code_type, other.block_key.code_type) { - ( - revive_llvm_context::PolkaVMCodeType::Deploy, - revive_llvm_context::PolkaVMCodeType::Runtime, - ) => Ordering::Less, - ( - revive_llvm_context::PolkaVMCodeType::Runtime, - revive_llvm_context::PolkaVMCodeType::Deploy, - ) => Ordering::Greater, - ( - revive_llvm_context::PolkaVMCodeType::Deploy, - revive_llvm_context::PolkaVMCodeType::Deploy, - ) - | ( - revive_llvm_context::PolkaVMCodeType::Runtime, - revive_llvm_context::PolkaVMCodeType::Runtime, - ) => { - let tag_comparison = self.block_key.tag.cmp(&other.block_key.tag); - if tag_comparison == Ordering::Equal { - if self.stack_hash == other.stack_hash { - Ordering::Equal - } else { - Ordering::Less - } - } else { - tag_comparison - } - } - } - } -} diff --git a/crates/solidity/src/evmla/ethereal_ir/mod.rs b/crates/solidity/src/evmla/ethereal_ir/mod.rs deleted file mode 100644 index 4dd229f..0000000 --- a/crates/solidity/src/evmla/ethereal_ir/mod.rs +++ /dev/null @@ -1,134 +0,0 @@ -//! The Ethereal IR of the EVM bytecode. - -pub mod entry_link; -pub mod function; - -use std::collections::BTreeMap; -use std::collections::BTreeSet; -use std::collections::HashMap; - -use crate::evmla::assembly::instruction::Instruction; -use crate::solc::standard_json::output::contract::evm::extra_metadata::ExtraMetadata; - -use self::function::block::Block; -use self::function::r#type::Type as FunctionType; -use self::function::Function; - -/// The Ethereal IR of the EVM bytecode. -/// The Ethereal IR (EthIR) is a special IR between the EVM legacy assembly and LLVM IR. It is -/// created to facilitate the translation and provide an additional environment for applying some -/// transformations, duplicating parts of the call and control flow graphs, tracking the -/// data flow, and a few more algorithms of static analysis. -/// The most important feature of EthIR is flattening the block tags and duplicating blocks for -/// each of initial states of the stack. The LLVM IR supports only static control flow, so the -/// stack state must be known all the way throughout the program. -#[derive(Debug)] -pub struct EtherealIR { - /// The Solidity compiler version. - pub solc_version: semver::Version, - /// The EVMLA extra metadata. - pub extra_metadata: ExtraMetadata, - /// The all-inlined function. - pub entry_function: Function, - /// The recursive functions. - pub recursive_functions: BTreeMap, -} - -impl EtherealIR { - /// The default entry function name. - pub const DEFAULT_ENTRY_FUNCTION_NAME: &'static str = "main"; - - /// The blocks hashmap initial capacity. - pub const BLOCKS_HASHMAP_DEFAULT_CAPACITY: usize = 64; - - /// Assembles a sequence of functions from the sequence of instructions. - pub fn new( - solc_version: semver::Version, - extra_metadata: ExtraMetadata, - blocks: HashMap, - ) -> anyhow::Result { - let mut entry_function = Function::new(solc_version.clone(), FunctionType::new_initial()); - let mut recursive_functions = BTreeMap::new(); - let mut visited_functions = BTreeSet::new(); - entry_function.traverse( - &blocks, - &mut recursive_functions, - &extra_metadata, - &mut visited_functions, - )?; - - Ok(Self { - solc_version, - extra_metadata, - entry_function, - recursive_functions, - }) - } - - /// Gets blocks for the specified type of the contract code. - pub fn get_blocks( - solc_version: semver::Version, - code_type: revive_llvm_context::PolkaVMCodeType, - instructions: &[Instruction], - ) -> anyhow::Result> { - let mut blocks = HashMap::with_capacity(Self::BLOCKS_HASHMAP_DEFAULT_CAPACITY); - let mut offset = 0; - - while offset < instructions.len() { - let (block, size) = Block::try_from_instructions( - solc_version.clone(), - code_type, - &instructions[offset..], - )?; - blocks.insert( - revive_llvm_context::PolkaVMFunctionBlockKey::new(code_type, block.key.tag.clone()), - block, - ); - offset += size; - } - - Ok(blocks) - } -} - -impl revive_llvm_context::PolkaVMWriteLLVM for EtherealIR -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - fn declare( - &mut self, - context: &mut revive_llvm_context::PolkaVMContext, - ) -> anyhow::Result<()> { - self.entry_function.declare(context)?; - - for (_key, function) in self.recursive_functions.iter_mut() { - function.declare(context)?; - } - - Ok(()) - } - - fn into_llvm(self, context: &mut revive_llvm_context::PolkaVMContext) -> anyhow::Result<()> { - context.evmla_mut().stack = vec![]; - - self.entry_function.into_llvm(context)?; - - for (_key, function) in self.recursive_functions.into_iter() { - function.into_llvm(context)?; - } - - Ok(()) - } -} - -impl std::fmt::Display for EtherealIR { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - writeln!(f, "{}", self.entry_function)?; - - for (_key, function) in self.recursive_functions.iter() { - writeln!(f, "{}", function)?; - } - - Ok(()) - } -} diff --git a/crates/solidity/src/evmla/mod.rs b/crates/solidity/src/evmla/mod.rs deleted file mode 100644 index 93b907d..0000000 --- a/crates/solidity/src/evmla/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -//! The EVM legacy assembly compiling tools. - -pub mod assembly; -pub mod ethereal_ir; diff --git a/crates/solidity/src/lib.rs b/crates/solidity/src/lib.rs index ea71225..7214120 100644 --- a/crates/solidity/src/lib.rs +++ b/crates/solidity/src/lib.rs @@ -2,7 +2,6 @@ pub(crate) mod build; pub(crate) mod r#const; -pub(crate) mod evmla; pub(crate) mod missing_libraries; pub(crate) mod process; pub(crate) mod project; @@ -26,7 +25,6 @@ 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; #[cfg(not(target_os = "emscripten"))] pub use self::solc::solc_compiler::SolcCompiler; #[cfg(target_os = "emscripten")] @@ -53,6 +51,7 @@ pub mod test_utils; pub mod tests; use std::collections::BTreeSet; +use std::io::Write; use std::path::PathBuf; /// Runs the Yul mode. @@ -119,7 +118,6 @@ pub fn standard_output( evm_version: Option, solc_optimizer_enabled: bool, optimizer_settings: revive_llvm_context::OptimizerSettings, - force_evmla: bool, include_metadata_hash: bool, base_path: Option, include_paths: Vec, @@ -129,7 +127,6 @@ pub fn standard_output( debug_config: revive_llvm_context::DebugConfig, ) -> anyhow::Result { let solc_version = solc.version()?; - let solc_pipeline = SolcPipeline::new(&solc_version, force_evmla); let solc_input = SolcStandardJsonInput::try_from_paths( SolcStandardJsonInputLanguage::Solidity, @@ -137,7 +134,7 @@ pub fn standard_output( input_files, libraries, remappings, - SolcStandardJsonInputSettingsSelection::new_required(solc_pipeline), + SolcStandardJsonInputSettingsSelection::new_required(), SolcStandardJsonInputSettingsOptimizer::new( solc_optimizer_enabled, None, @@ -145,7 +142,6 @@ pub fn standard_output( optimizer_settings.is_fallback_to_size_enabled(), ), None, - solc_pipeline == SolcPipeline::Yul, suppressed_warnings, )?; @@ -156,13 +152,7 @@ pub fn standard_output( .collect(); let libraries = solc_input.settings.libraries.clone().unwrap_or_default(); - let mut solc_output = solc.standard_json( - solc_input, - solc_pipeline, - base_path, - include_paths, - allow_paths, - )?; + let mut solc_output = solc.standard_json(solc_input, base_path, include_paths, allow_paths)?; if let Some(errors) = solc_output.errors.as_deref() { let mut has_errors = false; @@ -172,7 +162,7 @@ pub fn standard_output( has_errors = true; } - eprintln!("{error}"); + writeln!(std::io::stderr(), "{error}")?; } if has_errors { @@ -180,13 +170,8 @@ pub fn standard_output( } } - let project = solc_output.try_to_project( - source_code_files, - libraries, - solc_pipeline, - &solc_version, - &debug_config, - )?; + let project = + solc_output.try_to_project(source_code_files, libraries, &solc_version, &debug_config)?; let build = project.compile(optimizer_settings, include_metadata_hash, debug_config)?; @@ -194,20 +179,17 @@ pub fn standard_output( } /// Runs the standard JSON mode. -#[allow(clippy::too_many_arguments)] pub fn standard_json( solc: &mut T, detect_missing_libraries: bool, - force_evmla: bool, base_path: Option, include_paths: Vec, allow_paths: Option, debug_config: revive_llvm_context::DebugConfig, ) -> anyhow::Result<()> { let solc_version = solc.version()?; - let solc_pipeline = SolcPipeline::new(&solc_version, force_evmla); - let solc_input = SolcStandardJsonInput::try_from_stdin(solc_pipeline)?; + let solc_input = SolcStandardJsonInput::try_from_stdin()?; let source_code_files = solc_input .sources .iter() @@ -225,13 +207,7 @@ pub fn standard_json( }; let libraries = solc_input.settings.libraries.clone().unwrap_or_default(); - let mut solc_output = solc.standard_json( - solc_input, - solc_pipeline, - base_path, - include_paths, - allow_paths, - )?; + let mut solc_output = solc.standard_json(solc_input, base_path, include_paths, allow_paths)?; if let Some(errors) = solc_output.errors.as_deref() { for error in errors.iter() { @@ -242,13 +218,8 @@ pub fn standard_json( } } - let project = solc_output.try_to_project( - source_code_files, - libraries, - solc_pipeline, - &solc_version, - &debug_config, - )?; + let project = + solc_output.try_to_project(source_code_files, libraries, &solc_version, &debug_config)?; if detect_missing_libraries { let missing_libraries = project.get_missing_libraries(); @@ -271,7 +242,6 @@ pub fn combined_json( evm_version: Option, solc_optimizer_enabled: bool, optimizer_settings: revive_llvm_context::OptimizerSettings, - force_evmla: bool, include_metadata_hash: bool, base_path: Option, include_paths: Vec, @@ -289,7 +259,6 @@ pub fn combined_json( evm_version, solc_optimizer_enabled, optimizer_settings, - force_evmla, include_metadata_hash, base_path, include_paths, @@ -309,10 +278,11 @@ pub fn combined_json( combined_json.write_to_directory(output_directory.as_path(), overwrite)?; } None => { - println!( + writeln!( + std::io::stdout(), "{}", serde_json::to_string(&combined_json).expect("Always valid") - ); + )?; } } std::process::exit(0); diff --git a/crates/solidity/src/project/contract/ir/evmla.rs b/crates/solidity/src/project/contract/ir/evmla.rs deleted file mode 100644 index 9a1367d..0000000 --- a/crates/solidity/src/project/contract/ir/evmla.rs +++ /dev/null @@ -1,47 +0,0 @@ -//! The contract EVM legacy assembly source code. - -use std::collections::HashSet; - -use serde::Deserialize; -use serde::Serialize; - -use crate::evmla::assembly::Assembly; -use crate::solc::standard_json::output::contract::evm::extra_metadata::ExtraMetadata; - -/// The contract EVM legacy assembly source code. -#[derive(Debug, Serialize, Deserialize, Clone)] -#[allow(non_camel_case_types)] -#[allow(clippy::upper_case_acronyms)] -pub struct EVMLA { - /// The EVM legacy assembly source code. - pub assembly: Assembly, -} - -impl EVMLA { - /// A shortcut constructor. - pub fn new(mut assembly: Assembly, extra_metadata: ExtraMetadata) -> Self { - assembly.extra_metadata = Some(extra_metadata); - Self { assembly } - } - - /// Get the list of missing deployable libraries. - pub fn get_missing_libraries(&self) -> HashSet { - self.assembly.get_missing_libraries() - } -} - -impl revive_llvm_context::PolkaVMWriteLLVM for EVMLA -where - D: revive_llvm_context::PolkaVMDependency + Clone, -{ - fn declare( - &mut self, - context: &mut revive_llvm_context::PolkaVMContext, - ) -> anyhow::Result<()> { - self.assembly.declare(context) - } - - fn into_llvm(self, context: &mut revive_llvm_context::PolkaVMContext) -> anyhow::Result<()> { - self.assembly.into_llvm(context) - } -} diff --git a/crates/solidity/src/project/contract/ir/mod.rs b/crates/solidity/src/project/contract/ir/mod.rs index a1d9f53..70f349d 100644 --- a/crates/solidity/src/project/contract/ir/mod.rs +++ b/crates/solidity/src/project/contract/ir/mod.rs @@ -1,6 +1,5 @@ //! The contract source code. -pub mod evmla; pub mod llvm_ir; pub mod yul; @@ -9,24 +8,17 @@ use std::collections::HashSet; use serde::Deserialize; use serde::Serialize; -use crate::evmla::assembly::Assembly; -use crate::solc::standard_json::output::contract::evm::extra_metadata::ExtraMetadata; use crate::yul::parser::statement::object::Object; -use self::evmla::EVMLA; use self::llvm_ir::LLVMIR; use self::yul::Yul; /// The contract source code. #[derive(Debug, Serialize, Deserialize, Clone)] -#[allow(non_camel_case_types)] #[allow(clippy::upper_case_acronyms)] -#[allow(clippy::enum_variant_names)] pub enum IR { /// The Yul source code. Yul(Yul), - /// The EVM legacy assembly source code. - EVMLA(EVMLA), /// The LLVM IR source code. LLVMIR(LLVMIR), } @@ -37,11 +29,6 @@ impl IR { Self::Yul(Yul::new(source_code, object)) } - /// A shortcut constructor. - pub fn new_evmla(assembly: Assembly, extra_metadata: ExtraMetadata) -> Self { - Self::EVMLA(EVMLA::new(assembly, extra_metadata)) - } - /// A shortcut constructor. pub fn new_llvm_ir(path: String, source: String) -> Self { Self::LLVMIR(LLVMIR::new(path, source)) @@ -51,7 +38,6 @@ impl IR { pub fn get_missing_libraries(&self) -> HashSet { match self { Self::Yul(inner) => inner.get_missing_libraries(), - Self::EVMLA(inner) => inner.get_missing_libraries(), Self::LLVMIR(_inner) => HashSet::new(), } } @@ -67,7 +53,6 @@ where ) -> anyhow::Result<()> { match self { Self::Yul(inner) => inner.declare(context), - Self::EVMLA(inner) => inner.declare(context), Self::LLVMIR(_inner) => Ok(()), } } @@ -75,7 +60,6 @@ where fn into_llvm(self, context: &mut revive_llvm_context::PolkaVMContext) -> anyhow::Result<()> { match self { Self::Yul(inner) => inner.into_llvm(context), - Self::EVMLA(inner) => inner.into_llvm(context), Self::LLVMIR(_inner) => Ok(()), } } diff --git a/crates/solidity/src/project/contract/mod.rs b/crates/solidity/src/project/contract/mod.rs index 24d56fd..8b6e958 100644 --- a/crates/solidity/src/project/contract/mod.rs +++ b/crates/solidity/src/project/contract/mod.rs @@ -54,12 +54,10 @@ impl Contract { /// Returns the contract identifier, which is: /// - the Yul object identifier for Yul - /// - the full contract path for EVM legacy assembly /// - the module name for LLVM IR pub fn identifier(&self) -> &str { match self.ir { IR::Yul(ref yul) => yul.object.identifier.as_str(), - IR::EVMLA(ref evm) => evm.assembly.full_path(), IR::LLVMIR(ref llvm_ir) => llvm_ir.path.as_str(), } } @@ -68,7 +66,6 @@ impl Contract { pub fn drain_factory_dependencies(&mut self) -> HashSet { match self.ir { IR::Yul(ref mut yul) => yul.object.factory_dependencies.drain().collect(), - IR::EVMLA(ref mut evm) => evm.assembly.factory_dependencies.drain().collect(), IR::LLVMIR(_) => HashSet::new(), } } @@ -129,10 +126,6 @@ impl Contract { IR::Yul(_) => { context.set_yul_data(Default::default()); } - IR::EVMLA(_) => { - let evmla_data = revive_llvm_context::PolkaVMContextEVMLAData::new(version.default); - context.set_evmla_data(evmla_data); - } IR::LLVMIR(_) => {} } diff --git a/crates/solidity/src/resolc/arguments.rs b/crates/solidity/src/resolc/arguments.rs index 01d997a..e0e9e92 100644 --- a/crates/solidity/src/resolc/arguments.rs +++ b/crates/solidity/src/resolc/arguments.rs @@ -13,14 +13,14 @@ use path_slash::PathExt; /// output directory. /// Example: resolc ERC20.sol -O3 --bin --output-dir './build/' #[derive(Debug, Parser)] -#[structopt(name = "The PolkaVM Solidity compiler")] +#[command(name = "The PolkaVM Solidity compiler", arg_required_else_help = true)] pub struct Arguments { /// Print the version and exit. - #[structopt(long = "version")] + #[arg(long = "version")] pub version: bool, /// Print the licence and exit. - #[structopt(long = "license")] + #[arg(long = "license")] pub license: bool, /// Specify the input paths and remappings. @@ -31,159 +31,141 @@ pub struct Arguments { /// Set the given path as the root of the source tree instead of the root of the filesystem. /// Passed to `solc` without changes. - #[structopt(long = "base-path")] + #[arg(long = "base-path")] pub base_path: Option, /// Make an additional source directory available to the default import callback. /// Can be used multiple times. Can only be used if the base path has a non-empty value. /// Passed to `solc` without changes. - #[structopt(long = "include-path")] + #[arg(long = "include-path")] pub include_paths: Vec, /// Allow a given path for imports. A list of paths can be supplied by separating them with a comma. /// Passed to `solc` without changes. - #[structopt(long = "allow-paths")] + #[arg(long = "allow-paths")] pub allow_paths: Option, /// Create one file per component and contract/file at the specified directory, if given. - #[structopt(short = 'o', long = "output-dir")] + #[arg(short = 'o', long = "output-dir")] pub output_directory: Option, /// Overwrite existing files (used together with -o). - #[structopt(long = "overwrite")] + #[arg(long = "overwrite")] pub overwrite: bool, /// Set the optimization parameter -O[0 | 1 | 2 | 3 | s | z]. /// Use `3` for best performance and `z` for minimal size. - #[structopt(short = 'O', long = "optimization")] + #[arg(short = 'O', long = "optimization")] pub optimization: Option, /// Try to recompile with -Oz if the bytecode is too large. - #[structopt(long = "fallback-Oz")] + #[arg(long = "fallback-Oz")] pub fallback_to_optimizing_for_size: 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. - #[structopt(long = "disable-solc-optimizer")] + #[arg(long = "disable-solc-optimizer")] pub disable_solc_optimizer: bool, /// Specify the path to the `solc` executable. By default, the one in `${PATH}` is used. /// Yul mode: `solc` is used for source code validation, as `resolc` itself assumes that the input Yul is valid. /// LLVM IR mode: `solc` is unused. - #[structopt(long = "solc")] + #[arg(long = "solc")] pub solc: Option, /// The EVM target version to generate IR for. /// See https://github.com/paritytech/revive/blob/main/crates/common/src/evm_version.rs for reference. - #[structopt(long = "evm-version")] + #[arg(long = "evm-version")] pub evm_version: Option, /// Specify addresses of deployable libraries. Syntax: `=
[, or whitespace] ...`. /// Addresses are interpreted as hexadecimal strings prefixed with `0x`. - #[structopt(short = 'l', long = "libraries")] + #[arg(short = 'l', long = "libraries")] pub libraries: Vec, /// Output a single JSON document containing the specified information. /// Available arguments: `abi`, `hashes`, `metadata`, `devdoc`, `userdoc`, `storage-layout`, `ast`, `asm`, `bin`, `bin-runtime`. - #[structopt(long = "combined-json")] + #[arg(long = "combined-json")] pub combined_json: Option, /// Switch to standard JSON input/output mode. Read from stdin, write the result to stdout. /// This is the default used by the Hardhat plugin. - #[structopt(long = "standard-json")] + #[arg(long = "standard-json")] pub standard_json: bool, /// Switch to missing deployable libraries detection mode. /// Only available for standard JSON input/output mode. /// Contracts are not compiled in this mode, and all compilation artifacts are not included. - #[structopt(long = "detect-missing-libraries")] + #[arg(long = "detect-missing-libraries")] pub detect_missing_libraries: bool, /// Switch to Yul mode. /// Only one input Yul file is allowed. /// Cannot be used with combined and standard JSON modes. - #[structopt(long = "yul")] + #[arg(long = "yul")] pub yul: bool, /// Switch to LLVM IR mode. /// Only one input LLVM IR file is allowed. /// Cannot be used with combined and standard JSON modes. /// Use this mode at your own risk, as LLVM IR input validation is not implemented. - #[structopt(long = "llvm-ir")] + #[arg(long = "llvm-ir")] pub llvm_ir: bool, - /// Forcibly switch to EVM legacy assembly pipeline. - /// It is useful for older revisions of `solc` 0.8, where Yul was considered highly experimental - /// and contained more bugs than today. - #[structopt(long = "force-evmla")] - pub force_evmla: bool, - /// Set metadata hash mode. /// The only supported value is `none` that disables appending the metadata hash. /// Is enabled by default. - #[structopt(long = "metadata-hash")] + #[arg(long = "metadata-hash")] pub metadata_hash: Option, /// Output PolkaVM assembly of the contracts. - #[structopt(long = "asm")] + #[arg(long = "asm")] pub output_assembly: bool, /// Output PolkaVM bytecode of the contracts. - #[structopt(long = "bin")] + #[arg(long = "bin")] pub output_binary: bool, /// Suppress specified warnings. /// Available arguments: `ecrecover`, `sendtransfer`, `extcodesize`, `txorigin`, `blocktimestamp`, `blocknumber`, `blockhash`. - #[structopt(long = "suppress-warnings")] + #[arg(long = "suppress-warnings")] pub suppress_warnings: Option>, /// Generate source based debug information in the output code file. This only has an effect /// with the LLVM-IR code generator and is ignored otherwise. - #[structopt(short = 'g')] + #[arg(short = 'g')] pub emit_source_debug_info: bool, /// Dump all IRs to files in the specified directory. /// Only for testing and debugging. - #[structopt(long = "debug-output-dir")] + #[arg(long = "debug-output-dir")] pub debug_output_directory: Option, /// Set the verify-each option in LLVM. /// Only for testing and debugging. - #[structopt(long = "llvm-verify-each")] + #[arg(long = "llvm-verify-each")] pub llvm_verify_each: bool, /// Set the debug-logging option in LLVM. /// Only for testing and debugging. - #[structopt(long = "llvm-debug-logging")] + #[arg(long = "llvm-debug-logging")] pub llvm_debug_logging: bool, /// Run this process recursively and provide JSON input to compile a single contract. /// Only for usage from within the compiler. - #[structopt(long = "recursive-process")] + #[arg(long = "recursive-process")] pub recursive_process: bool, /// Specify the input file to use instead of stdin when --recursive-process is given. /// This is only intended for use when developing the compiler. #[cfg(debug_assertions)] - #[structopt(long = "recursive-process-input")] + #[arg(long = "recursive-process-input")] pub recursive_process_input: Option, } -impl Default for Arguments { - fn default() -> Self { - Self::new() - } -} - impl Arguments { - /// A shortcut constructor. - pub fn new() -> Self { - Self::parse() - } - /// Validates the arguments. - #[allow(clippy::collapsible_if)] pub fn validate(&self) -> anyhow::Result<()> { if self.version && std::env::args().count() > 2 { anyhow::bail!("No other options are allowed while getting the compiler version."); @@ -248,27 +230,19 @@ impl Arguments { ); } - if self.force_evmla { - anyhow::bail!("EVM legacy assembly mode is not supported in Yul, LLVM IR and PolkaVM assembly modes."); - } - if self.disable_solc_optimizer { anyhow::bail!("Disabling the solc optimizer is not supported in Yul, LLVM IR and PolkaVM assembly modes."); } } - if self.llvm_ir { - if self.solc.is_some() { - anyhow::bail!("`solc` is not used in LLVM IR and PolkaVM assembly modes."); - } + if self.llvm_ir && self.solc.is_some() { + anyhow::bail!("`solc` is not used in LLVM IR and PolkaVM assembly modes."); } - if self.combined_json.is_some() { - if self.output_assembly || self.output_binary { - anyhow::bail!( - "Cannot output assembly or binary outside of JSON in combined JSON mode." - ); - } + if self.combined_json.is_some() && (self.output_assembly || self.output_binary) { + anyhow::bail!( + "Cannot output assembly or binary outside of JSON in combined JSON mode." + ); } if self.standard_json { diff --git a/crates/solidity/src/resolc/main.rs b/crates/solidity/src/resolc/main.rs index a8884e2..b308771 100644 --- a/crates/solidity/src/resolc/main.rs +++ b/crates/solidity/src/resolc/main.rs @@ -2,6 +2,7 @@ pub mod arguments; +use std::io::Write; use std::str::FromStr; use revive_solidity::Process; @@ -16,28 +17,27 @@ const RAYON_WORKER_STACK_SIZE: usize = 16 * 1024 * 1024; #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; -/// The application entry point. -fn main() { +fn main() -> anyhow::Result<()> { std::process::exit(match main_inner() { Ok(()) => revive_common::EXIT_CODE_SUCCESS, Err(error) => { - eprintln!("{error}"); + writeln!(std::io::stderr(), "{error}")?; revive_common::EXIT_CODE_FAILURE } }) } -/// The auxiliary `main` function to facilitate the `?` error conversion operator. fn main_inner() -> anyhow::Result<()> { - let arguments = Arguments::new(); + let arguments = ::try_parse()?; arguments.validate()?; if arguments.version { - println!( + writeln!( + std::io::stdout(), "{} version {}", env!("CARGO_PKG_DESCRIPTION"), revive_solidity::ResolcVersion::default().long - ); + )?; return Ok(()); } @@ -45,7 +45,7 @@ fn main_inner() -> anyhow::Result<()> { let license_mit = include_str!("../../../../LICENSE-MIT"); let license_apache = include_str!("../../../../LICENSE-APACHE"); - println!("{}\n{}\n", license_mit, license_apache); + writeln!(std::io::stdout(), "{}\n{}\n", license_mit, license_apache)?; return Ok(()); } @@ -103,7 +103,7 @@ fn main_inner() -> anyhow::Result<()> { let mut solc = { #[cfg(target_os = "emscripten")] { - revive_solidity::SoljsonCompiler { version: None } + revive_solidity::SoljsonCompiler } #[cfg(not(target_os = "emscripten"))] @@ -157,7 +157,6 @@ fn main_inner() -> anyhow::Result<()> { revive_solidity::standard_json( &mut solc, arguments.detect_missing_libraries, - arguments.force_evmla, arguments.base_path, arguments.include_paths, arguments.allow_paths, @@ -173,7 +172,6 @@ fn main_inner() -> anyhow::Result<()> { evm_version, !arguments.disable_solc_optimizer, optimizer_settings, - arguments.force_evmla, include_metadata_hash, arguments.base_path, arguments.include_paths, @@ -193,7 +191,6 @@ fn main_inner() -> anyhow::Result<()> { evm_version, !arguments.disable_solc_optimizer, optimizer_settings, - arguments.force_evmla, include_metadata_hash, arguments.base_path, arguments.include_paths, @@ -214,26 +211,36 @@ fn main_inner() -> anyhow::Result<()> { arguments.overwrite, )?; - eprintln!( + writeln!( + std::io::stderr(), "Compiler run successful. Artifact(s) can be found in directory {output_directory:?}." - ); + )?; } else if arguments.output_assembly || arguments.output_binary { for (path, contract) in build.contracts.into_iter() { if arguments.output_assembly { let assembly_text = contract.build.assembly_text; - println!("Contract `{}` assembly:\n\n{}", path, assembly_text); + writeln!( + std::io::stdout(), + "Contract `{}` assembly:\n\n{}", + path, + assembly_text + )?; } if arguments.output_binary { - println!( + writeln!( + std::io::stdout(), "Contract `{}` bytecode: 0x{}", path, hex::encode(contract.build.bytecode) - ); + )?; } } } else { - eprintln!("Compiler run successful. No output requested. Use --asm and --bin flags."); + writeln!( + std::io::stderr(), + "Compiler run successful. No output requested. Use --asm and --bin flags." + )?; } Ok(()) diff --git a/crates/solidity/src/solc/combined_json/mod.rs b/crates/solidity/src/solc/combined_json/mod.rs index 0dd9c15..17ca906 100644 --- a/crates/solidity/src/solc/combined_json/mod.rs +++ b/crates/solidity/src/solc/combined_json/mod.rs @@ -80,10 +80,9 @@ impl CombinedJson { file_path.push(format!("combined.{}", revive_common::EXTENSION_JSON)); if file_path.exists() && !overwrite { - eprintln!( + anyhow::bail!( "Refusing to overwrite an existing file {file_path:?} (use --overwrite to force)." ); - return Ok(()); } File::create(&file_path) diff --git a/crates/solidity/src/solc/mod.rs b/crates/solidity/src/solc/mod.rs index 55a47af..c2c7ad9 100644 --- a/crates/solidity/src/solc/mod.rs +++ b/crates/solidity/src/solc/mod.rs @@ -1,7 +1,6 @@ //! The Solidity compiler. pub mod combined_json; -pub mod pipeline; #[cfg(not(target_os = "emscripten"))] pub mod solc_compiler; #[cfg(target_os = "emscripten")] @@ -9,35 +8,22 @@ pub mod soljson_compiler; pub mod standard_json; pub mod version; -use once_cell::sync::Lazy; -use semver::VersionReq; use std::path::Path; use std::path::PathBuf; use self::combined_json::CombinedJson; -use self::pipeline::Pipeline; use self::standard_json::input::Input as StandardJsonInput; use self::standard_json::output::Output as StandardJsonOutput; use self::version::Version; /// The first version of `solc` with the support of standard JSON interface. -pub const FIRST_SUPPORTED_VERSION: semver::Version = semver::Version::new(0, 4, 12); - -/// The first version of `solc`, where Yul codegen is considered robust enough. -pub const FIRST_YUL_VERSION: semver::Version = semver::Version::new(0, 8, 0); - -/// The first version of `solc`, where `--via-ir` codegen mode is supported. -pub const FIRST_VIA_IR_VERSION: semver::Version = semver::Version::new(0, 8, 13); +pub const FIRST_SUPPORTED_VERSION: semver::Version = semver::Version::new(0, 8, 0); /// The last supported version of `solc`. pub const LAST_SUPPORTED_VERSION: semver::Version = semver::Version::new(0, 8, 28); -/// `--base-path` was introduced in 0.6.9 -pub static FIRST_SUPPORTS_BASE_PATH: Lazy = - Lazy::new(|| VersionReq::parse(">=0.6.9").unwrap()); -/// `--include-path` was introduced in 0.8.8 -pub static FIRST_SUPPORTS_INCLUDE_PATH: Lazy = - Lazy::new(|| VersionReq::parse(">=0.8.8").unwrap()); +/// `--include-path` was introduced in solc `0.8.8` +pub const FIRST_INCLUDE_PATH_VERSION: semver::Version = semver::Version::new(0, 8, 8); /// The Solidity compiler. pub trait Compiler { @@ -45,7 +31,6 @@ pub trait Compiler { fn standard_json( &mut self, input: StandardJsonInput, - pipeline: Pipeline, base_path: Option, include_paths: Vec, allow_paths: Option, diff --git a/crates/solidity/src/solc/pipeline.rs b/crates/solidity/src/solc/pipeline.rs deleted file mode 100644 index 9b398e8..0000000 --- a/crates/solidity/src/solc/pipeline.rs +++ /dev/null @@ -1,27 +0,0 @@ -//! The Solidity compiler pipeline type. - -use serde::{Deserialize, Serialize}; - -use crate::solc::version::Version as SolcVersion; - -/// The Solidity compiler pipeline type. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] -#[allow(non_camel_case_types)] -#[allow(clippy::upper_case_acronyms)] -pub enum Pipeline { - /// The Yul IR. - Yul, - /// The EVM legacy assembly IR. - EVMLA, -} - -impl Pipeline { - /// We always use EVMLA for Solidity <=0.7, or if the user does not want to compile via Yul. - pub fn new(solc_version: &SolcVersion, force_evmla: bool) -> Self { - if solc_version.default < crate::solc::FIRST_YUL_VERSION || force_evmla { - Self::EVMLA - } else { - Self::Yul - } - } -} diff --git a/crates/solidity/src/solc/solc_compiler.rs b/crates/solidity/src/solc/solc_compiler.rs index 44c740e..947e97b 100644 --- a/crates/solidity/src/solc/solc_compiler.rs +++ b/crates/solidity/src/solc/solc_compiler.rs @@ -1,24 +1,20 @@ -//! The Solidity compiler. +//! The Solidity compiler solc interface. use std::io::Write; use std::path::Path; use std::path::PathBuf; use crate::solc::combined_json::CombinedJson; -use crate::solc::pipeline::Pipeline; use crate::solc::standard_json::input::Input as StandardJsonInput; use crate::solc::standard_json::output::Output as StandardJsonOutput; use crate::solc::version::Version; use super::Compiler; -use crate::solc::{FIRST_SUPPORTS_BASE_PATH, FIRST_SUPPORTS_INCLUDE_PATH}; /// The Solidity compiler. pub struct SolcCompiler { /// The binary executable name. pub executable: String, - /// The lazily-initialized compiler version. - pub version: Option, } impl SolcCompiler { @@ -35,10 +31,7 @@ impl SolcCompiler { error ); } - Ok(Self { - executable, - version: None, - }) + Ok(Self { executable }) } } @@ -47,45 +40,31 @@ impl Compiler for SolcCompiler { fn standard_json( &mut self, mut input: StandardJsonInput, - pipeline: Pipeline, base_path: Option, include_paths: Vec, allow_paths: Option, ) -> anyhow::Result { - let version = self.version()?; + let version = self.version()?.validate(&include_paths)?.default; let mut command = std::process::Command::new(self.executable.as_str()); command.stdin(std::process::Stdio::piped()); command.stdout(std::process::Stdio::piped()); command.arg("--standard-json"); - if let Some(base_path) = &base_path { - if !FIRST_SUPPORTS_BASE_PATH.matches(&version.default) { - anyhow::bail!( - "--base-path not supported this version {} of solc", - &version.default - ); - } - command.arg("--base-path").arg(base_path); - } - - if !include_paths.is_empty() && !FIRST_SUPPORTS_INCLUDE_PATH.matches(&version.default) { - anyhow::bail!( - "--include-path not supported this version {} of solc", - &version.default - ); - } - for include_path in include_paths.into_iter() { command.arg("--include-path"); command.arg(include_path); } + if let Some(base_path) = base_path { + command.arg("--base-path"); + command.arg(base_path); + } if let Some(allow_paths) = allow_paths { command.arg("--allow-paths"); command.arg(allow_paths); } - input.normalize(&version.default); + input.normalize(&version); let suppressed_warnings = input.suppressed_warnings.take().unwrap_or_default(); @@ -129,7 +108,7 @@ impl Compiler for SolcCompiler { ), ) })?; - output.preprocess_ast(&version, pipeline, suppressed_warnings.as_slice())?; + output.preprocess_ast(suppressed_warnings.as_slice())?; Ok(output) } @@ -163,8 +142,16 @@ impl Compiler for SolcCompiler { anyhow::anyhow!("{} subprocess error: {:?}", self.executable, error) })?; if !output.status.success() { - println!("{}", String::from_utf8_lossy(output.stdout.as_slice())); - println!("{}", String::from_utf8_lossy(output.stderr.as_slice())); + writeln!( + std::io::stdout(), + "{}", + String::from_utf8_lossy(output.stdout.as_slice()) + )?; + writeln!( + std::io::stdout(), + "{}", + String::from_utf8_lossy(output.stderr.as_slice()) + )?; anyhow::bail!( "{} error: {}", self.executable, @@ -228,10 +215,6 @@ impl Compiler for SolcCompiler { /// The `solc --version` mini-parser. fn version(&mut self) -> anyhow::Result { - if let Some(version) = self.version.as_ref() { - return Ok(version.to_owned()); - } - let mut command = std::process::Command::new(self.executable.as_str()); command.arg("--version"); let output = command.output().map_err(|error| { @@ -277,24 +260,6 @@ impl Compiler for SolcCompiler { .and_then(|line| line.split('-').nth(1)) .and_then(|version| version.parse().ok()); - let version = Version::new(long, default, l2_revision); - if version.default < super::FIRST_SUPPORTED_VERSION { - anyhow::bail!( - "`solc` versions <{} are not supported, found {}", - super::FIRST_SUPPORTED_VERSION, - version.default - ); - } - if version.default > super::LAST_SUPPORTED_VERSION { - anyhow::bail!( - "`solc` versions >{} are not supported, found {}", - super::LAST_SUPPORTED_VERSION, - version.default - ); - } - - self.version = Some(version.clone()); - - Ok(version) + Ok(Version::new(long, default, l2_revision)) } } diff --git a/crates/solidity/src/solc/soljson_compiler.rs b/crates/solidity/src/solc/soljson_compiler.rs index c2472e6..0c94664 100644 --- a/crates/solidity/src/solc/soljson_compiler.rs +++ b/crates/solidity/src/solc/soljson_compiler.rs @@ -1,10 +1,9 @@ -//! The Solidity compiler. +//! The Solidity compiler solJson interface. use std::path::Path; use std::path::PathBuf; use crate::solc::combined_json::CombinedJson; -use crate::solc::pipeline::Pipeline; use crate::solc::standard_json::input::Input as StandardJsonInput; use crate::solc::standard_json::output::Output as StandardJsonOutput; use crate::solc::version::Version; @@ -19,23 +18,30 @@ extern "C" { } /// The Solidity compiler. -pub struct SoljsonCompiler { - /// The lazily-initialized compiler version. - pub version: Option, -} +pub struct SoljsonCompiler; impl Compiler for SoljsonCompiler { /// Compiles the Solidity `--standard-json` input into Yul IR. fn standard_json( &mut self, mut input: StandardJsonInput, - pipeline: Pipeline, - _base_path: Option, - _include_paths: Vec, - _allow_paths: Option, + base_path: Option, + include_paths: Vec, + allow_paths: Option, ) -> anyhow::Result { - let version = self.version()?; - input.normalize(&version.default); + if !include_paths.is_empty() { + anyhow::bail!("configuring include paths is not supported with solJson") + } + if base_path.is_some() { + anyhow::bail!("configuring the base path is not supported with solJson") + } + if allow_paths.is_some() { + anyhow::bail!("configuring allow paths is not supported with solJson") + } + + let version = self.version()?.validate(&include_paths)?.default; + input.normalize(&version); + let suppressed_warnings = input.suppressed_warnings.take().unwrap_or_default(); let input_json = serde_json::to_string(&input).expect("Always valid"); @@ -50,7 +56,7 @@ impl Compiler for SoljsonCompiler { .unwrap_or_else(|_| String::from_utf8_lossy(out.as_bytes()).to_string()), ) })?; - output.preprocess_ast(&version, pipeline, suppressed_warnings.as_slice())?; + output.preprocess_ast(suppressed_warnings.as_slice())?; Ok(output) } @@ -76,31 +82,11 @@ impl Compiler for SoljsonCompiler { .ok_or_else(|| anyhow::anyhow!("Soljson version parsing: metadata dropping"))? .parse() .map_err(|error| anyhow::anyhow!("Soljson version parsing: {}", error))?; - let l2_revision: Option = version .split('-') .nth(1) .and_then(|version| version.parse().ok()); - - let version = Version::new(long, default, l2_revision); - if version.default < super::FIRST_SUPPORTED_VERSION { - anyhow::bail!( - "`Soljson` versions <{} are not supported, found {}", - super::FIRST_SUPPORTED_VERSION, - version.default - ); - } - if version.default > super::LAST_SUPPORTED_VERSION { - anyhow::bail!( - "`Soljson` versions >{} are not supported, found {}", - super::LAST_SUPPORTED_VERSION, - version.default - ); - } - - self.version = Some(version.clone()); - - Ok(version) + Ok(Version::new(long, default, l2_revision)) } } diff --git a/crates/solidity/src/solc/standard_json/input/mod.rs b/crates/solidity/src/solc/standard_json/input/mod.rs index 409130e..41e7263 100644 --- a/crates/solidity/src/solc/standard_json/input/mod.rs +++ b/crates/solidity/src/solc/standard_json/input/mod.rs @@ -13,7 +13,6 @@ use rayon::iter::{IntoParallelIterator, ParallelIterator}; use serde::Deserialize; use serde::Serialize; -use crate::solc::pipeline::Pipeline as SolcPipeline; use crate::solc::standard_json::input::settings::metadata::Metadata as SolcStandardJsonInputSettingsMetadata; use crate::solc::standard_json::input::settings::optimizer::Optimizer as SolcStandardJsonInputSettingsOptimizer; use crate::solc::standard_json::input::settings::selection::Selection as SolcStandardJsonInputSettingsSelection; @@ -40,13 +39,13 @@ pub struct Input { impl Input { /// A shortcut constructor from stdin. - pub fn try_from_stdin(solc_pipeline: SolcPipeline) -> anyhow::Result { + pub fn try_from_stdin() -> anyhow::Result { let mut input: Self = serde_json::from_reader(std::io::BufReader::new(std::io::stdin()))?; input .settings .output_selection .get_or_insert_with(SolcStandardJsonInputSettingsSelection::default) - .extend_with_required(solc_pipeline); + .extend_with_required(); Ok(input) } @@ -61,15 +60,16 @@ impl Input { output_selection: SolcStandardJsonInputSettingsSelection, optimizer: SolcStandardJsonInputSettingsOptimizer, metadata: Option, - via_ir: bool, suppressed_warnings: Option>, ) -> anyhow::Result { - #[cfg(feature = "parallel")] - let iter = paths.into_par_iter(); // Parallel iterator + let mut paths: BTreeSet = paths.iter().cloned().collect(); + let libraries = Settings::parse_libraries(library_map)?; + for library_file in libraries.keys() { + paths.insert(PathBuf::from(library_file)); + } - #[cfg(not(feature = "parallel"))] - let iter = paths.iter(); // Sequential iterator - let sources = iter + let sources = paths + .iter() .map(|path| { let source = Source::try_from(path.as_path()).unwrap_or_else(|error| { panic!("Source code file {path:?} reading error: {error}") @@ -78,8 +78,6 @@ impl Input { }) .collect(); - let libraries = Settings::parse_libraries(library_map)?; - Ok(Self { language, sources, @@ -88,7 +86,6 @@ impl Input { libraries, remappings, output_selection, - via_ir, optimizer, metadata, ), @@ -107,7 +104,6 @@ impl Input { output_selection: SolcStandardJsonInputSettingsSelection, optimizer: SolcStandardJsonInputSettingsOptimizer, metadata: Option, - via_ir: bool, suppressed_warnings: Option>, ) -> anyhow::Result { #[cfg(feature = "parallel")] @@ -127,7 +123,6 @@ impl Input { libraries, remappings, output_selection, - via_ir, optimizer, metadata, ), diff --git a/crates/solidity/src/solc/standard_json/input/settings/mod.rs b/crates/solidity/src/solc/standard_json/input/settings/mod.rs index a089ac2..dff5a83 100644 --- a/crates/solidity/src/solc/standard_json/input/settings/mod.rs +++ b/crates/solidity/src/solc/standard_json/input/settings/mod.rs @@ -51,7 +51,6 @@ impl Settings { libraries: BTreeMap>, remappings: Option>, output_selection: Selection, - via_ir: bool, optimizer: Optimizer, metadata: Option, ) -> Self { @@ -60,9 +59,9 @@ impl Settings { libraries: Some(libraries), remappings, output_selection: Some(output_selection), - via_ir: if via_ir { Some(true) } else { None }, optimizer, metadata, + via_ir: Some(true), } } 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 ad6efc6..c80e85e 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 @@ -3,12 +3,8 @@ use serde::Deserialize; use serde::Serialize; -use crate::solc::pipeline::Pipeline as SolcPipeline; - /// The `solc --standard-json` expected output selection flag. #[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)] -#[allow(non_camel_case_types)] -#[allow(clippy::upper_case_acronyms)] pub enum Flag { /// The ABI JSON. #[serde(rename = "abi")] @@ -46,15 +42,6 @@ pub enum Flag { Assembly, } -impl From for Flag { - fn from(pipeline: SolcPipeline) -> Self { - match pipeline { - SolcPipeline::Yul => Self::Yul, - SolcPipeline::EVMLA => Self::EVMLA, - } - } -} - impl std::fmt::Display for Flag { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { 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 df232c3..a960ca9 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 @@ -7,8 +7,6 @@ use std::collections::HashSet; use serde::Deserialize; use serde::Serialize; -use crate::solc::pipeline::Pipeline as SolcPipeline; - use self::flag::Flag as SelectionFlag; /// The `solc --standard-json` output file selection. @@ -24,7 +22,7 @@ pub struct File { impl File { /// Creates the selection required by our compilation process. - pub fn new_required(pipeline: SolcPipeline) -> Self { + pub fn new_required() -> Self { Self { per_file: Some(HashSet::from_iter([SelectionFlag::AST])), per_contract: Some(HashSet::from_iter([ @@ -32,14 +30,14 @@ impl File { SelectionFlag::EVMDBC, SelectionFlag::MethodIdentifiers, SelectionFlag::Metadata, - SelectionFlag::from(pipeline), + SelectionFlag::Yul, ])), } } /// Extends the user's output selection with flag required by our compilation process. - pub fn extend_with_required(&mut self, pipeline: SolcPipeline) -> &mut Self { - let required = Self::new_required(pipeline); + pub fn extend_with_required(&mut self) -> &mut Self { + let required = Self::new_required(); self.per_file .get_or_insert_with(HashSet::default) diff --git a/crates/solidity/src/solc/standard_json/input/settings/selection/mod.rs b/crates/solidity/src/solc/standard_json/input/settings/selection/mod.rs index 13d316f..d332f15 100644 --- a/crates/solidity/src/solc/standard_json/input/settings/selection/mod.rs +++ b/crates/solidity/src/solc/standard_json/input/settings/selection/mod.rs @@ -5,8 +5,6 @@ pub mod file; use serde::Deserialize; use serde::Serialize; -use crate::solc::pipeline::Pipeline as SolcPipeline; - use self::file::File as FileSelection; /// The `solc --standard-json` output selection. @@ -19,17 +17,17 @@ pub struct Selection { impl Selection { /// Creates the selection required by our compilation process. - pub fn new_required(pipeline: SolcPipeline) -> Self { + pub fn new_required() -> Self { Self { - all: Some(FileSelection::new_required(pipeline)), + all: Some(FileSelection::new_required()), } } /// Extends the user's output selection with flag required by our compilation process. - pub fn extend_with_required(&mut self, pipeline: SolcPipeline) -> &mut Self { + pub fn extend_with_required(&mut self) -> &mut Self { self.all - .get_or_insert_with(|| FileSelection::new_required(pipeline)) - .extend_with_required(pipeline); + .get_or_insert_with(FileSelection::new_required) + .extend_with_required(); self } } diff --git a/crates/solidity/src/solc/standard_json/output/contract/evm/extra_metadata/mod.rs b/crates/solidity/src/solc/standard_json/output/contract/evm/extra_metadata/mod.rs deleted file mode 100644 index f734419..0000000 --- a/crates/solidity/src/solc/standard_json/output/contract/evm/extra_metadata/mod.rs +++ /dev/null @@ -1,46 +0,0 @@ -//! The `solc --standard-json` output contract EVM extra metadata. - -pub mod recursive_function; - -use serde::Deserialize; -use serde::Serialize; - -use self::recursive_function::RecursiveFunction; - -/// The `solc --standard-json` output contract EVM extra metadata. -#[derive(Debug, Default, Serialize, Deserialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct ExtraMetadata { - /// The list of recursive functions. - #[serde(default = "Vec::new")] - pub recursive_functions: Vec, -} - -impl ExtraMetadata { - /// Returns the recursive function reference for the specified tag. - pub fn get( - &self, - block_key: &revive_llvm_context::PolkaVMFunctionBlockKey, - ) -> Option<&RecursiveFunction> { - for function in self.recursive_functions.iter() { - match block_key.code_type { - revive_llvm_context::PolkaVMCodeType::Deploy => { - if let Some(creation_tag) = function.creation_tag { - if num::BigUint::from(creation_tag) == block_key.tag { - return Some(function); - } - } - } - revive_llvm_context::PolkaVMCodeType::Runtime => { - if let Some(runtime_tag) = function.runtime_tag { - if num::BigUint::from(runtime_tag) == block_key.tag { - return Some(function); - } - } - } - } - } - - None - } -} diff --git a/crates/solidity/src/solc/standard_json/output/contract/evm/extra_metadata/recursive_function.rs b/crates/solidity/src/solc/standard_json/output/contract/evm/extra_metadata/recursive_function.rs deleted file mode 100644 index 188060f..0000000 --- a/crates/solidity/src/solc/standard_json/output/contract/evm/extra_metadata/recursive_function.rs +++ /dev/null @@ -1,22 +0,0 @@ -//! The `solc --standard-json` output contract EVM recursive function. - -use serde::Deserialize; -use serde::Serialize; - -/// The `solc --standard-json` output contract EVM recursive function. -#[derive(Debug, Serialize, Deserialize, Clone)] -#[serde(rename_all = "camelCase")] -pub struct RecursiveFunction { - /// The function name. - pub name: String, - /// The creation code function block tag. - pub creation_tag: Option, - /// The runtime code function block tag. - pub runtime_tag: Option, - /// The number of input arguments. - #[serde(rename = "totalParamSize")] - pub input_size: usize, - /// The number of output arguments. - #[serde(rename = "totalRetParamSize")] - pub output_size: usize, -} 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 c5613cf..6e57bdd 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 @@ -1,27 +1,20 @@ //! The `solc --standard-json` output contract EVM data. pub mod bytecode; -pub mod extra_metadata; use std::collections::BTreeMap; use serde::Deserialize; use serde::Serialize; -use crate::evmla::assembly::Assembly; - use self::bytecode::Bytecode; use self::bytecode::DeployedBytecode; -use self::extra_metadata::ExtraMetadata; /// The `solc --standard-json` output contract EVM data. /// It is replaced by PolkaVM data after compiling. #[derive(Debug, Serialize, Deserialize, Clone)] #[serde(rename_all = "camelCase")] pub struct EVM { - /// The contract EVM legacy assembly code. - #[serde(rename = "legacyAssembly", skip_serializing_if = "Option::is_none")] - pub assembly: Option, /// The contract PolkaVM assembly code. #[serde(rename = "assembly", skip_serializing_if = "Option::is_none")] pub assembly_text: Option, @@ -37,9 +30,6 @@ pub struct EVM { /// The contract function signatures. #[serde(default, skip_serializing_if = "Option::is_none")] pub method_identifiers: Option>, - /// The extra EVMLA metadata. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub extra_metadata: Option, } impl EVM { diff --git a/crates/solidity/src/solc/standard_json/output/error/mod.rs b/crates/solidity/src/solc/standard_json/output/error/mod.rs index f9442e2..95505d0 100644 --- a/crates/solidity/src/solc/standard_json/output/error/mod.rs +++ b/crates/solidity/src/solc/standard_json/output/error/mod.rs @@ -33,13 +33,12 @@ impl Error { /// Returns the `ecrecover` function usage warning. pub fn message_ecrecover(src: Option<&str>) -> Self { let message = r#" -┌──────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Warning: It looks like you are using 'ecrecover' to validate a signature of a user account. │ -│ Polkadot comes with native account abstraction support, therefore it is highly recommended NOT │ -│ to rely on the fact that the account has an ECDSA private key attached to it since accounts might│ -│ implement other signature schemes. │ -└──────────────────────────────────────────────────────────────────────────────────────────────────┘"# - .to_owned(); +Warning: It looks like you are using 'ecrecover' to validate a signature of a user account. +Polkadot comes with native account abstraction support, therefore it is highly recommended NOT +to rely on the fact that the account has an ECDSA private key attached to it since accounts might +implement other signature schemes. +"# + .to_owned(); Self { component: "general".to_owned(), @@ -55,17 +54,16 @@ impl Error { /// Returns the `
`'s `send` and `transfer` methods usage error. pub fn message_send_and_transfer(src: Option<&str>) -> Self { let message = r#" -┌──────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Warning: It looks like you are using '
.send/transfer()' without providing │ -│ the gas amount. Such calls will fail depending on the pubdata costs. │ -│ This might be a false positive if you are using an interface (like IERC20) instead of the │ -│ native Solidity `send/transfer`. │ -│ Please use 'payable(
).call{value: }("")' instead, but be careful with the reentrancy │ -│ attack. `send` and `transfer` send limited amount of gas that prevents reentrancy, whereas │ -│ `
.call{value: }` sends all gas to the callee. Learn more on │ -│ https://docs.soliditylang.org/en/latest/security-considerations.html#reentrancy │ -└──────────────────────────────────────────────────────────────────────────────────────────────────┘"# - .to_owned(); +Warning: It looks like you are using '
.send/transfer()'. +Using '
.send/transfer()' is deprecated and strongly discouraged! +The resolc compiler uses a heuristic to detect '
.send/transfer()' calls, +which disables call re-entrancy and supplies all remaining gas instead of the 2300 gas stipend. +However, detection is not guaranteed. You are advised to carefully test this, employ +re-entrancy guards or use the withdrawal pattern instead! +Learn more on https://docs.soliditylang.org/en/latest/security-considerations.html#reentrancy +and https://docs.soliditylang.org/en/latest/common-patterns.html#withdrawal-from-contracts +"# + .to_owned(); Self { component: "general".to_owned(), @@ -81,16 +79,15 @@ impl Error { /// Returns the `extcodesize` instruction usage warning. pub fn message_extcodesize(src: Option<&str>) -> Self { let message = r#" -┌──────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Warning: Your code or one of its dependencies uses the 'extcodesize' instruction, which is │ -│ usually needed in the following cases: │ -│ 1. To detect whether an address belongs to a smart contract. │ -│ 2. To detect whether the deploy code execution has finished. │ -│ Polkadot comes with native account abstraction support (so smart contracts are just accounts │ -│ coverned by code), and you should avoid differentiating between contracts and non-contract | -| addresses. │ -└──────────────────────────────────────────────────────────────────────────────────────────────────┘"# - .to_owned(); +Warning: Your code or one of its dependencies uses the 'extcodesize' instruction, which is +usually needed in the following cases: + 1. To detect whether an address belongs to a smart contract. + 2. To detect whether the deploy code execution has finished. +Polkadot comes with native account abstraction support (so smart contracts are just accounts +coverned by code), and you should avoid differentiating between contracts and non-contract +addresses. +"# + .to_owned(); Self { component: "general".to_owned(), @@ -106,13 +103,12 @@ impl Error { /// Returns the `origin` instruction usage warning. pub fn message_tx_origin(src: Option<&str>) -> Self { let message = r#" -┌──────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Warning: You are checking for 'tx.origin' in your code, which might lead to unexpected behavior. │ -│ Polkadot comes with native account abstraction support, and therefore the initiator of a │ -│ transaction might be different from the contract calling your code. It is highly recommended NOT │ -│ to rely on tx.origin, but use msg.sender instead. │ -└──────────────────────────────────────────────────────────────────────────────────────────────────┘"# - .to_owned(); +Warning: You are checking for 'tx.origin' in your code, which might lead to unexpected behavior. +Polkadot comes with native account abstraction support, and therefore the initiator of a +transaction might be different from the contract calling your code. It is highly recommended NOT +to rely on tx.origin, but use msg.sender instead. +"# + .to_owned(); Self { component: "general".to_owned(), @@ -125,26 +121,6 @@ impl Error { } } - /// Returns the internal function pointer usage error. - pub fn message_internal_function_pointer(src: Option<&str>) -> Self { - let message = r#" -┌──────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Error: Internal function pointers are not supported in EVM legacy assembly pipeline. │ -│ Please use the Yul IR codegen instead. │ -└──────────────────────────────────────────────────────────────────────────────────────────────────┘"# - .to_owned(); - - Self { - component: "general".to_owned(), - error_code: None, - formatted_message: message.clone(), - message, - severity: "error".to_owned(), - source_location: src.map(SourceLocation::from_str).and_then(Result::ok), - r#type: "Error".to_owned(), - } - } - /// Appends the contract path to the message.. pub fn push_contract_path(&mut self, path: &str) { self.formatted_message diff --git a/crates/solidity/src/solc/standard_json/output/mod.rs b/crates/solidity/src/solc/standard_json/output/mod.rs index 751cdcd..5ea4100 100644 --- a/crates/solidity/src/solc/standard_json/output/mod.rs +++ b/crates/solidity/src/solc/standard_json/output/mod.rs @@ -10,12 +10,9 @@ use serde::Deserialize; use serde::Serialize; use sha3::Digest; -use crate::evmla::assembly::instruction::Instruction; -use crate::evmla::assembly::Assembly; use crate::project::contract::ir::IR as ProjectContractIR; use crate::project::contract::Contract as ProjectContract; use crate::project::Project; -use crate::solc::pipeline::Pipeline as SolcPipeline; use crate::solc::version::Version as SolcVersion; use crate::warning::Warning; use crate::yul::lexer::Lexer; @@ -53,14 +50,9 @@ impl Output { &mut self, source_code_files: BTreeMap, libraries: BTreeMap>, - pipeline: SolcPipeline, solc_version: &SolcVersion, debug_config: &revive_llvm_context::DebugConfig, ) -> anyhow::Result { - if let SolcPipeline::EVMLA = pipeline { - self.preprocess_dependencies()?; - } - let files = match self.contracts.as_ref() { Some(files) => files, None => match &self.errors { @@ -76,38 +68,22 @@ impl Output { for (name, contract) in contracts.iter() { let full_path = format!("{path}:{name}"); - let source = match pipeline { - SolcPipeline::Yul => { - let ir_optimized = match contract.ir_optimized.to_owned() { - Some(ir_optimized) => ir_optimized, - None => continue, - }; - if ir_optimized.is_empty() { - continue; - } - - debug_config.dump_yul(full_path.as_str(), ir_optimized.as_str())?; - - let mut lexer = Lexer::new(ir_optimized.to_owned()); - let object = Object::parse(&mut lexer, None).map_err(|error| { - anyhow::anyhow!("Contract `{}` parsing error: {:?}", full_path, error) - })?; - - ProjectContractIR::new_yul(ir_optimized.to_owned(), object) - } - SolcPipeline::EVMLA => { - let evm = contract.evm.as_ref(); - let assembly = match evm.and_then(|evm| evm.assembly.to_owned()) { - Some(assembly) => assembly.to_owned(), - None => continue, - }; - let extra_metadata = evm - .and_then(|evm| evm.extra_metadata.to_owned()) - .unwrap_or_default(); - - ProjectContractIR::new_evmla(assembly, extra_metadata) - } + let ir_optimized = match contract.ir_optimized.to_owned() { + Some(ir_optimized) => ir_optimized, + None => continue, }; + if ir_optimized.is_empty() { + continue; + } + + debug_config.dump_yul(full_path.as_str(), ir_optimized.as_str())?; + + let mut lexer = Lexer::new(ir_optimized.to_owned()); + let object = Object::parse(&mut lexer, None).map_err(|error| { + anyhow::anyhow!("Contract `{}` parsing error: {:?}", full_path, error) + })?; + + let source = ProjectContractIR::new_yul(ir_optimized.to_owned(), object); let source_code = source_code_files .get(path.as_str()) @@ -133,12 +109,7 @@ impl Output { } /// Traverses the AST and returns the list of additional errors and warnings. - pub fn preprocess_ast( - &mut self, - version: &SolcVersion, - pipeline: SolcPipeline, - suppressed_warnings: &[Warning], - ) -> anyhow::Result<()> { + pub fn preprocess_ast(&mut self, suppressed_warnings: &[Warning]) -> anyhow::Result<()> { let sources = match self.sources.as_ref() { Some(sources) => sources, None => return Ok(()), @@ -147,8 +118,7 @@ impl Output { let mut messages = Vec::new(); for (path, source) in sources.iter() { if let Some(ast) = source.ast.as_ref() { - let mut polkavm_messages = - Source::get_messages(ast, version, pipeline, suppressed_warnings); + let mut polkavm_messages = Source::get_messages(ast, suppressed_warnings); for message in polkavm_messages.iter_mut() { message.push_contract_path(path.as_str()); } @@ -165,83 +135,4 @@ impl Output { Ok(()) } - - /// The pass, which replaces with dependency indexes with actual data. - fn preprocess_dependencies(&mut self) -> anyhow::Result<()> { - let files = match self.contracts.as_mut() { - Some(files) => files, - None => return Ok(()), - }; - let mut hash_path_mapping = BTreeMap::new(); - - for (path, contracts) in files.iter() { - for (name, contract) in contracts.iter() { - let full_path = format!("{path}:{name}"); - let hash = match contract - .evm - .as_ref() - .and_then(|evm| evm.assembly.as_ref()) - .map(|assembly| assembly.keccak256()) - { - Some(hash) => hash, - None => continue, - }; - - hash_path_mapping.insert(hash, full_path); - } - } - - for (path, contracts) in files.iter_mut() { - for (name, contract) in contracts.iter_mut() { - let assembly = match contract.evm.as_mut().and_then(|evm| evm.assembly.as_mut()) { - Some(assembly) => assembly, - None => continue, - }; - - let full_path = format!("{path}:{name}"); - Self::preprocess_dependency_level( - full_path.as_str(), - assembly, - &hash_path_mapping, - )?; - } - } - - Ok(()) - } - - /// Preprocesses an assembly JSON structure dependency data map. - fn preprocess_dependency_level( - full_path: &str, - assembly: &mut Assembly, - hash_path_mapping: &BTreeMap, - ) -> anyhow::Result<()> { - assembly.set_full_path(full_path.to_owned()); - - let deploy_code_index_path_mapping = - assembly.deploy_dependencies_pass(full_path, hash_path_mapping)?; - if let Some(deploy_code_instructions) = assembly.code.as_deref_mut() { - Instruction::replace_data_aliases( - deploy_code_instructions, - &deploy_code_index_path_mapping, - )?; - }; - - let runtime_code_index_path_mapping = - assembly.runtime_dependencies_pass(full_path, hash_path_mapping)?; - if let Some(runtime_code_instructions) = assembly - .data - .as_mut() - .and_then(|data_map| data_map.get_mut("0")) - .and_then(|data| data.get_assembly_mut()) - .and_then(|assembly| assembly.code.as_deref_mut()) - { - Instruction::replace_data_aliases( - runtime_code_instructions, - &runtime_code_index_path_mapping, - )?; - } - - Ok(()) - } } diff --git a/crates/solidity/src/solc/standard_json/output/source.rs b/crates/solidity/src/solc/standard_json/output/source.rs index 1424b5b..97b2e14 100644 --- a/crates/solidity/src/solc/standard_json/output/source.rs +++ b/crates/solidity/src/solc/standard_json/output/source.rs @@ -3,9 +3,7 @@ use serde::Deserialize; use serde::Serialize; -use crate::solc::pipeline::Pipeline as SolcPipeline; use crate::solc::standard_json::output::error::Error as SolcStandardJsonOutputError; -use crate::solc::version::Version as SolcVersion; use crate::warning::Warning; /// The `solc --standard-json` output source. @@ -132,37 +130,9 @@ impl Source { )) } - /// Checks the AST node for the internal function pointers value usage. - pub fn check_internal_function_pointer( - ast: &serde_json::Value, - ) -> Option { - let ast = ast.as_object()?; - - if ast.get("nodeType")?.as_str()? != "VariableDeclaration" { - return None; - } - - let type_descriptions = ast.get("typeDescriptions")?.as_object()?; - if !type_descriptions - .get("typeIdentifier")? - .as_str()? - .contains("function_internal") - { - return None; - } - - Some( - SolcStandardJsonOutputError::message_internal_function_pointer( - ast.get("src")?.as_str(), - ), - ) - } - /// Returns the list of messages for some specific parts of the AST. pub fn get_messages( ast: &serde_json::Value, - version: &SolcVersion, - pipeline: SolcPipeline, suppressed_warnings: &[Warning], ) -> Vec { let mut messages = Vec::new(); @@ -189,31 +159,16 @@ impl Source { messages.push(message); } } - if SolcPipeline::EVMLA == pipeline && version.l2_revision.is_none() { - if let Some(message) = Self::check_internal_function_pointer(ast) { - messages.push(message); - } - } match ast { serde_json::Value::Array(array) => { for element in array.iter() { - messages.extend(Self::get_messages( - element, - version, - pipeline, - suppressed_warnings, - )); + messages.extend(Self::get_messages(element, suppressed_warnings)); } } serde_json::Value::Object(object) => { for (_key, value) in object.iter() { - messages.extend(Self::get_messages( - value, - version, - pipeline, - suppressed_warnings, - )); + messages.extend(Self::get_messages(value, suppressed_warnings)); } } _ => {} diff --git a/crates/solidity/src/solc/version.rs b/crates/solidity/src/solc/version.rs index 88613d0..e1ab041 100644 --- a/crates/solidity/src/solc/version.rs +++ b/crates/solidity/src/solc/version.rs @@ -36,4 +36,26 @@ impl Version { l2_revision: None, } } + + pub fn validate(self, include_paths: &[String]) -> anyhow::Result { + if self.default < super::FIRST_SUPPORTED_VERSION { + anyhow::bail!( + "`solc` versions <{} are not supported, found {}", + super::FIRST_SUPPORTED_VERSION, + self.default + ); + } + if self.default > super::LAST_SUPPORTED_VERSION { + anyhow::bail!( + "`solc` versions >{} are not supported, found {}", + super::LAST_SUPPORTED_VERSION, + self.default + ); + } + if !include_paths.is_empty() && self.default < super::FIRST_INCLUDE_PATH_VERSION { + anyhow::bail!("--include-path is not supported in solc {}", self.default); + } + + Ok(self) + } } diff --git a/crates/solidity/src/test_utils.rs b/crates/solidity/src/test_utils.rs index 2ef5c86..f3a35f8 100644 --- a/crates/solidity/src/test_utils.rs +++ b/crates/solidity/src/test_utils.rs @@ -8,7 +8,6 @@ use std::sync::Mutex; use once_cell::sync::Lazy; use crate::project::Project; -use crate::solc::pipeline::Pipeline as SolcPipeline; use crate::solc::solc_compiler::SolcCompiler; use crate::solc::standard_json::input::settings::optimizer::Optimizer as SolcStandardJsonInputSettingsOptimizer; use crate::solc::standard_json::input::settings::selection::Selection as SolcStandardJsonInputSettingsSelection; @@ -30,8 +29,8 @@ const DEBUG_CONFIG: revive_llvm_context::DebugConfig = #[derive(Hash, PartialEq, Eq)] struct CachedBlob { contract_name: String, + solidity: String, solc_optimizer_enabled: bool, - pipeline: SolcPipeline, } /// Checks if the required executables are present in `${PATH}`. @@ -54,17 +53,9 @@ pub fn build_solidity( sources: BTreeMap, libraries: BTreeMap>, remappings: Option>, - pipeline: SolcPipeline, optimizer_settings: revive_llvm_context::OptimizerSettings, ) -> anyhow::Result { - build_solidity_with_options( - sources, - libraries, - remappings, - pipeline, - optimizer_settings, - true, - ) + build_solidity_with_options(sources, libraries, remappings, optimizer_settings, true) } /// Builds the Solidity project and returns the standard JSON output. @@ -74,7 +65,6 @@ pub fn build_solidity_with_options( sources: BTreeMap, libraries: BTreeMap>, remappings: Option>, - pipeline: SolcPipeline, optimizer_settings: revive_llvm_context::OptimizerSettings, solc_optimizer_enabled: bool, ) -> anyhow::Result { @@ -93,7 +83,7 @@ pub fn build_solidity_with_options( sources.clone(), libraries.clone(), remappings, - SolcStandardJsonInputSettingsSelection::new_required(pipeline), + SolcStandardJsonInputSettingsSelection::new_required(), SolcStandardJsonInputSettingsOptimizer::new( solc_optimizer_enabled, None, @@ -101,14 +91,12 @@ pub fn build_solidity_with_options( false, ), None, - pipeline == SolcPipeline::Yul, None, )?; - let mut output = solc.standard_json(input, pipeline, None, vec![], None)?; + let mut output = solc.standard_json(input, None, vec![], None)?; - let project = - output.try_to_project(sources, libraries, pipeline, &solc_version, &DEBUG_CONFIG)?; + let project = output.try_to_project(sources, libraries, &solc_version, &DEBUG_CONFIG)?; let build: crate::Build = project.compile(optimizer_settings, false, DEBUG_CONFIG)?; build.write_to_standard_json(&mut output, &solc_version)?; @@ -121,7 +109,6 @@ pub fn build_solidity_with_options_evm( sources: BTreeMap, libraries: BTreeMap>, remappings: Option>, - pipeline: SolcPipeline, solc_optimizer_enabled: bool, ) -> anyhow::Result> { check_dependencies(); @@ -139,7 +126,7 @@ pub fn build_solidity_with_options_evm( sources.clone(), libraries.clone(), remappings, - SolcStandardJsonInputSettingsSelection::new_required(pipeline), + SolcStandardJsonInputSettingsSelection::new_required(), SolcStandardJsonInputSettingsOptimizer::new( solc_optimizer_enabled, None, @@ -147,11 +134,10 @@ pub fn build_solidity_with_options_evm( false, ), None, - pipeline == SolcPipeline::Yul, None, )?; - let mut output = solc.standard_json(input, pipeline, None, vec![], None)?; + let mut output = solc.standard_json(input, None, vec![], None)?; let mut contracts = BTreeMap::new(); if let Some(files) = output.contracts.as_mut() { @@ -176,7 +162,6 @@ pub fn build_solidity_with_options_evm( pub fn build_solidity_and_detect_missing_libraries( sources: BTreeMap, libraries: BTreeMap>, - pipeline: SolcPipeline, ) -> anyhow::Result { check_dependencies(); @@ -193,17 +178,15 @@ pub fn build_solidity_and_detect_missing_libraries( sources.clone(), libraries.clone(), None, - SolcStandardJsonInputSettingsSelection::new_required(pipeline), + SolcStandardJsonInputSettingsSelection::new_required(), SolcStandardJsonInputSettingsOptimizer::new(true, None, &solc_version.default, false), None, - pipeline == SolcPipeline::Yul, None, )?; - let mut output = solc.standard_json(input, pipeline, None, vec![], None)?; + let mut output = solc.standard_json(input, None, vec![], None)?; - let project = - output.try_to_project(sources, libraries, pipeline, &solc_version, &DEBUG_CONFIG)?; + let project = output.try_to_project(sources, libraries, &solc_version, &DEBUG_CONFIG)?; let missing_libraries = project.get_missing_libraries(); missing_libraries.write_to_standard_json(&mut output, &solc.version()?)?; @@ -234,7 +217,6 @@ pub fn check_solidity_warning( source_code: &str, warning_substring: &str, libraries: BTreeMap>, - pipeline: SolcPipeline, skip_for_revive_edition: bool, suppressed_warnings: Option>, ) -> anyhow::Result { @@ -253,14 +235,13 @@ pub fn check_solidity_warning( sources.clone(), libraries, None, - SolcStandardJsonInputSettingsSelection::new_required(pipeline), + SolcStandardJsonInputSettingsSelection::new_required(), SolcStandardJsonInputSettingsOptimizer::new(true, None, &solc_version.default, false), None, - pipeline == SolcPipeline::Yul, suppressed_warnings, )?; - let output = solc.standard_json(input, pipeline, None, vec![], None)?; + let output = solc.standard_json(input, None, vec![], None)?; let contains_warning = output .errors .ok_or_else(|| anyhow::anyhow!("Solidity compiler messages not found"))? @@ -273,7 +254,7 @@ pub fn check_solidity_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_blob_with_options(contract_name, source_code, true) } /// Compile the EVM bin-runtime of `contract_name` found in given `source_code`. @@ -298,10 +279,9 @@ fn compile_evm( solc_optimizer_enabled: bool, runtime: bool, ) -> Vec { - let pipeline = SolcPipeline::Yul; let id = CachedBlob { contract_name: contract_name.to_owned(), - pipeline, + solidity: source_code.to_owned(), solc_optimizer_enabled, }; @@ -319,7 +299,6 @@ fn compile_evm( [(file_name.into(), source_code.into())].into(), Default::default(), None, - pipeline, solc_optimizer_enabled, ) .expect("source should compile"); @@ -343,12 +322,11 @@ 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(), + solidity: source_code.to_owned(), solc_optimizer_enabled, - pipeline, }; if let Some(blob) = PVM_BLOB_CACHE.lock().unwrap().get(&id) { @@ -360,7 +338,6 @@ pub fn compile_blob_with_options( [(file_name.into(), source_code.into())].into(), Default::default(), None, - pipeline, revive_llvm_context::OptimizerSettings::cycles(), solc_optimizer_enabled, ) diff --git a/crates/solidity/src/tests/cli-tests/junit.xml b/crates/solidity/src/tests/cli-tests/junit.xml new file mode 100644 index 0000000..7c013eb --- /dev/null +++ b/crates/solidity/src/tests/cli-tests/junit.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/crates/solidity/src/tests/cli-tests/tests/common.test.ts b/crates/solidity/src/tests/cli-tests/tests/common.test.ts index 65fbb91..0ed795f 100644 --- a/crates/solidity/src/tests/cli-tests/tests/common.test.ts +++ b/crates/solidity/src/tests/cli-tests/tests/common.test.ts @@ -10,7 +10,7 @@ describe("Run resolc without any options", () => { const result = executeCommand(command); it("Info with help is presented", () => { - expect(result.output).toMatch(/(No input sources specified|Error(s) found.)/i); + expect(result.output).toMatch(/(Usage: resolc)/i); }); it("Exit code = 1", () => { @@ -28,7 +28,7 @@ describe("Run resolc without any options", () => { //#1713 describe("Default run a command from the help", () => { - const command = `resolc ${paths.pathToBasicSolContract} -O3 --bin --output-dir "${paths.pathToOutputDir}"`; // potential issue on resolc with full path on Windows cmd + const command = `resolc ${paths.pathToBasicSolContract} --overwrite -O3 --bin --output-dir "${paths.pathToOutputDir}"`; // potential issue on resolc with full path on Windows cmd const result = executeCommand(command); it("Compiler run successful", () => { @@ -54,7 +54,7 @@ describe("Default run a command from the help", () => { //#1818 describe("Default run a command from the help", () => { - const command = `resolc ${paths.pathToBasicSolContract} -O3 --bin --asm --output-dir "${paths.pathToOutputDir}"`; // potential issue on resolc with full path on Windows cmd + const command = `resolc ${paths.pathToBasicSolContract} --overwrite -O3 --bin --asm --output-dir "${paths.pathToOutputDir}"`; // potential issue on resolc with full path on Windows cmd const result = executeCommand(command); it("Compiler run successful", () => { @@ -81,8 +81,8 @@ describe("Default run a command from the help", () => { describe("Run resolc with source debug information", () => { const commands = [ - `resolc -g ${paths.pathToBasicSolContract} --bin --asm --output-dir "${paths.pathToOutputDir}"`, - `resolc --disable-solc-optimizer -g ${paths.pathToBasicSolContract} --bin --asm --output-dir "${paths.pathToOutputDir}"` + `resolc -g ${paths.pathToBasicSolContract} --overwrite --bin --asm --output-dir "${paths.pathToOutputDir}"`, + `resolc --disable-solc-optimizer -g ${paths.pathToBasicSolContract} --overwrite --bin --asm --output-dir "${paths.pathToOutputDir}"` ]; // potential issue on resolc with full path on Windows cmd`; for (var idx in commands) { @@ -114,8 +114,8 @@ describe("Run resolc with source debug information", () => { describe("Run resolc with source debug information, check LLVM debug-info", () => { const commands = [ - `resolc -g ${paths.pathToBasicSolContract} --debug-output-dir="${paths.pathToOutputDir}"`, - `resolc -g --disable-solc-optimizer ${paths.pathToBasicSolContract} --debug-output-dir="${paths.pathToOutputDir}"` + `resolc -g ${paths.pathToBasicSolContract} --overwrite --debug-output-dir="${paths.pathToOutputDir}"`, + `resolc -g --disable-solc-optimizer ${paths.pathToBasicSolContract} --overwrite --debug-output-dir="${paths.pathToOutputDir}"` ]; // potential issue on resolc with full path on Windows cmd`; for (var idx in commands) { diff --git a/crates/solidity/src/tests/combined-json.tests.ts b/crates/solidity/src/tests/combined-json.tests.ts new file mode 100644 index 0000000..6dc1b25 --- /dev/null +++ b/crates/solidity/src/tests/combined-json.tests.ts @@ -0,0 +1,153 @@ +import { executeCommand } from "../src/helper"; +import { paths } from '../src/entities'; + + +describe("Set of --combined-json tests", () => { + const zksolcCommand = 'zksolc'; + const solcCommand = 'solc'; + const json_args: string[] = [`abi`, `hashes`, `metadata`, `devdoc`, `userdoc`, `storage-layout`, `ast`, `asm`, `bin`, `bin-runtime`]; + + //id1742:I + describe(`Run ${zksolcCommand} with just --combined-json`, () => { + const args = [`--combined-json`]; + const result = executeCommand(zksolcCommand, args); + + it("Valid command exit code = 1", () => { + expect(result.exitCode).toBe(1); + }); + + it("--combined-json error is presented", () => { + expect(result.output).toMatch(/(requires a value but none was supplied)/i); + }); + + it("solc exit code == zksolc exit code", () => { + const solcResult = executeCommand(solcCommand, args); + expect(solcResult.exitCode).toBe(result.exitCode); + }); + }); + + //id1742:II + describe(`Run ${zksolcCommand} with Sol contract and --combined-json`, () => { + const args = [`${paths.pathToBasicSolContract}`, `--combined-json`]; + const result = executeCommand(zksolcCommand, args); + + it("Valid command exit code = 1", () => { + expect(result.exitCode).toBe(1); + }); + + it("--combined-json error is presented", () => { + expect(result.output).toMatch(/(requires a value but none was supplied)/i); + }); + + it("solc exit code == zksolc exit code", () => { + const solcResult = executeCommand(solcCommand, args); + expect(solcResult.exitCode).toBe(result.exitCode); + }); + }); + + //id1742:III + for (let i = 0; i < json_args.length; i++) { + describe(`Run ${zksolcCommand} with Sol, --combined-json and ARG: ${json_args[i]}`, () => { + const args = [`${paths.pathToBasicSolContract}`, `--combined-json`, `${json_args[i]}`]; + const result = executeCommand(zksolcCommand, args); + + it("Valid command exit code = 0", () => { + expect(result.exitCode).toBe(0); + }); + + it("--combined-json error is presented", () => { + expect(result.output).toMatch(/(contracts)/i); + }); + + it("solc exit code == zksolc exit code", () => { + const solcResult = executeCommand(solcCommand, args); + expect(solcResult.exitCode).toBe(result.exitCode); + }); + }); + } + + //id1829:I + for (let i = 0; i < json_args.length; i++) { + describe(`Run ${zksolcCommand} with Sol, --combined-json and wrong ARG: --${json_args[i]}`, () => { + const args = [`${paths.pathToBasicSolContract}`, `--combined-json`, `--${json_args[i]}`]; + const result = executeCommand(zksolcCommand, args); + + it("Valid command exit code = 1", () => { + expect(result.exitCode).toBe(1); + }); + + it("--combined-json error is presented", () => { + expect(result.output).toMatch(/(Invalid option|error)/i); + }); + + it("solc exit code == zksolc exit code", () => { + const solcResult = executeCommand(solcCommand, args); + expect(solcResult.exitCode).toBe(result.exitCode); + }); + }); + } + + //id1829:II + for (let i = 0; i < json_args.length; i++) { + describe(`Run ${zksolcCommand} with Sol, --combined-json and multiple ARG: ${json_args[i]} ${json_args[i]}`, () => { + const args = [`${paths.pathToBasicSolContract}`, `--combined-json`, `${json_args[i]}`, `${json_args[i]}`]; + const result = executeCommand(zksolcCommand, args); + + xit("Valid command exit code = 1", () => { + expect(result.exitCode).toBe(1); + }); + + it("--combined-json error is presented", () => { + expect(result.output).toMatch(/(No such file or directory|cannot find the file specified)/i); // Hopefully we should have more precise message here! + }); + + xit("solc exit code == zksolc exit code", () => { + const solcResult = executeCommand(solcCommand, args); + expect(solcResult.exitCode).toBe(result.exitCode); + }); + }); + } + + //id1829:III + for (let i = 0; i < json_args.length; i++) { + describe(`Run ${zksolcCommand} with Sol, and multiple (--combined-json ${json_args[i]})`, () => { + const args = [`${paths.pathToBasicSolContract}`, `--combined-json`, `${json_args[i]}`, `--combined-json`, `${json_args[i]}`]; + const result = executeCommand(zksolcCommand, args); + + it("Valid command exit code = 1", () => { + expect(result.exitCode).toBe(1); + }); + + it("--combined-json error is presented", () => { + expect(result.output).toMatch(/(cannot be used multiple times)/i); + }); + + it("solc exit code == zksolc exit code", () => { + const solcResult = executeCommand(solcCommand, args); + expect(solcResult.exitCode).toBe(result.exitCode); + }); + }); + } + + //id1830 + for (let i = 0; i < json_args.length; i++) { + describe(`Run ${zksolcCommand} with Yul, and --combined-json ${json_args[i]}`, () => { + const args = [`${paths.pathToBasicYulContract}`, `--combined-json`, `${json_args[i]}`]; + const result = executeCommand(zksolcCommand, args); + + it("Valid command exit code = 1", () => { + expect(result.exitCode).toBe(1); + }); + + it("--combined-json error is presented", () => { + expect(result.output).toMatch(/(ParserError: Expected identifier)/i); + }); + asd + + it("solc exit code == zksolc exit code", () => { + const solcResult = executeCommand(solcCommand, args); + expect(solcResult.exitCode).toBe(result.exitCode); + }); + }); + } +}); diff --git a/crates/solidity/src/tests/factory_dependency.rs b/crates/solidity/src/tests/factory_dependency.rs index 2cae2c0..3788672 100644 --- a/crates/solidity/src/tests/factory_dependency.rs +++ b/crates/solidity/src/tests/factory_dependency.rs @@ -4,8 +4,6 @@ use std::collections::BTreeMap; -use crate::solc::pipeline::Pipeline as SolcPipeline; - pub const MAIN_CODE: &str = r#" // SPDX-License-Identifier: MIT @@ -51,7 +49,6 @@ fn default() { sources, BTreeMap::new(), None, - SolcPipeline::Yul, revive_llvm_context::OptimizerSettings::cycles(), ) .expect("Build failure"); diff --git a/crates/solidity/src/tests/ir_artifacts.rs b/crates/solidity/src/tests/ir_artifacts.rs index 7e01cd5..d5be735 100644 --- a/crates/solidity/src/tests/ir_artifacts.rs +++ b/crates/solidity/src/tests/ir_artifacts.rs @@ -5,8 +5,6 @@ use std::collections::BTreeMap; -use crate::solc::pipeline::Pipeline as SolcPipeline; - #[test] fn yul() { let source_code = r#" @@ -27,7 +25,6 @@ contract Test { sources, BTreeMap::new(), None, - SolcPipeline::Yul, revive_llvm_context::OptimizerSettings::cycles(), ) .expect("Test failure"); @@ -45,75 +42,4 @@ contract Test { .is_some(), "Yul IR is missing" ); - assert!( - build - .contracts - .as_ref() - .expect("Always exists") - .get("test.sol") - .expect("Always exists") - .get("Test") - .expect("Always exists") - .evm - .as_ref() - .expect("EVM object is missing") - .assembly - .is_none(), - "EVMLA IR is present although not requested" - ); -} - -#[test] -fn evmla() { - let source_code = r#" -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -contract Test { - function main() public view returns (uint) { - return 42; - } -} - "#; - - let mut sources = BTreeMap::new(); - sources.insert("test.sol".to_owned(), source_code.to_owned()); - - let build = super::build_solidity( - sources, - BTreeMap::new(), - None, - SolcPipeline::EVMLA, - revive_llvm_context::OptimizerSettings::cycles(), - ) - .expect("Test failure"); - assert!( - build - .contracts - .as_ref() - .expect("Always exists") - .get("test.sol") - .expect("Always exists") - .get("Test") - .expect("Always exists") - .evm - .as_ref() - .expect("EVM object is missing") - .assembly - .is_some(), - "EVMLA IR is missing", - ); - assert!( - build - .contracts - .as_ref() - .expect("Always exists") - .get("test.sol") - .expect("Always exists") - .get("Test") - .expect("Always exists") - .ir_optimized - .is_none(), - "Yul IR is present although not requested", - ); } diff --git a/crates/solidity/src/tests/libraries.rs b/crates/solidity/src/tests/libraries.rs index 75b573f..0178602 100644 --- a/crates/solidity/src/tests/libraries.rs +++ b/crates/solidity/src/tests/libraries.rs @@ -4,8 +4,6 @@ use std::collections::BTreeMap; -use crate::solc::pipeline::Pipeline as SolcPipeline; - pub const LIBRARY_TEST_SOURCE: &str = r#" // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; @@ -38,29 +36,24 @@ fn not_specified() { let mut sources = BTreeMap::new(); sources.insert("test.sol".to_owned(), LIBRARY_TEST_SOURCE.to_owned()); - for pipeline in [SolcPipeline::EVMLA, SolcPipeline::Yul] { - let output = super::build_solidity_and_detect_missing_libraries( - sources.clone(), - BTreeMap::new(), - pipeline, - ) - .expect("Test failure"); - assert!( - output - .contracts - .as_ref() - .expect("Always exists") - .get("test.sol") - .expect("Always exists") - .get("SimpleContract") - .expect("Always exists") - .missing_libraries - .as_ref() - .expect("Always exists") - .contains("test.sol:SimpleLibrary"), - "Missing library not detected" - ); - } + let output = + super::build_solidity_and_detect_missing_libraries(sources.clone(), BTreeMap::new()) + .expect("Test failure"); + assert!( + output + .contracts + .as_ref() + .expect("Always exists") + .get("test.sol") + .expect("Always exists") + .get("SimpleContract") + .expect("Always exists") + .missing_libraries + .as_ref() + .expect("Always exists") + .contains("test.sol:SimpleLibrary"), + "Missing library not detected" + ); } #[test] @@ -75,28 +68,23 @@ fn specified() { .entry("SimpleLibrary".to_string()) .or_insert("0x00000000000000000000000000000000DEADBEEF".to_string()); - for pipeline in [SolcPipeline::EVMLA, SolcPipeline::Yul] { - let output = super::build_solidity_and_detect_missing_libraries( - sources.clone(), - libraries.clone(), - pipeline, - ) - .expect("Test failure"); - assert!( - output - .contracts - .as_ref() - .expect("Always exists") - .get("test.sol") - .expect("Always exists") - .get("SimpleContract") - .expect("Always exists") - .missing_libraries - .as_ref() - .cloned() - .unwrap_or_default() - .is_empty(), - "The list of missing libraries must be empty" - ); - } + let output = + super::build_solidity_and_detect_missing_libraries(sources.clone(), libraries.clone()) + .expect("Test failure"); + assert!( + output + .contracts + .as_ref() + .expect("Always exists") + .get("test.sol") + .expect("Always exists") + .get("SimpleContract") + .expect("Always exists") + .missing_libraries + .as_ref() + .cloned() + .unwrap_or_default() + .is_empty(), + "The list of missing libraries must be empty" + ); } diff --git a/crates/solidity/src/tests/messages.rs b/crates/solidity/src/tests/messages.rs index bcadcf1..d0ce0af 100644 --- a/crates/solidity/src/tests/messages.rs +++ b/crates/solidity/src/tests/messages.rs @@ -4,7 +4,6 @@ use std::collections::BTreeMap; -use crate::solc::pipeline::Pipeline as SolcPipeline; use crate::warning::Warning; pub const ECRECOVER_TEST_SOURCE: &str = r#" @@ -30,7 +29,6 @@ fn ecrecover() { ECRECOVER_TEST_SOURCE, "Warning: It looks like you are using 'ecrecover' to validate a signature of a user account.", BTreeMap::new(), - SolcPipeline::Yul, false, None, ).expect("Test failure") @@ -44,7 +42,6 @@ fn ecrecover_suppressed() { ECRECOVER_TEST_SOURCE, "Warning: It looks like you are using 'ecrecover' to validate a signature of a user account.", BTreeMap::new(), - SolcPipeline::Yul, false, Some(vec![Warning::EcRecover]), ).expect("Test failure") @@ -67,34 +64,33 @@ contract SendExample { require(success, "Failed to send Ether"); } } - "#; +"#; + +pub const BALANCE_CALLS_MESSAGE: &str = + "Warning: It looks like you are using '
.send/transfer()'"; #[test] fn send() { - assert!( - super::check_solidity_warning( - SEND_TEST_SOURCE, - "Warning: It looks like you are using '
.send/transfer()' without providing", - BTreeMap::new(), - SolcPipeline::Yul, - false, - None, - ).expect("Test failure") - ); + assert!(super::check_solidity_warning( + SEND_TEST_SOURCE, + BALANCE_CALLS_MESSAGE, + BTreeMap::new(), + false, + None, + ) + .expect("Test failure")); } #[test] fn send_suppressed() { - assert!( - !super::check_solidity_warning( - SEND_TEST_SOURCE, - "Warning: It looks like you are using '
.send/transfer()' without providing", - BTreeMap::new(), - SolcPipeline::Yul, - false, - Some(vec![Warning::SendTransfer]), - ).expect("Test failure") - ); + assert!(!super::check_solidity_warning( + SEND_TEST_SOURCE, + BALANCE_CALLS_MESSAGE, + BTreeMap::new(), + false, + Some(vec![Warning::SendTransfer]), + ) + .expect("Test failure")); } pub const TRANSFER_TEST_SOURCE: &str = r#" @@ -116,30 +112,26 @@ contract TransferExample { #[test] fn transfer() { - assert!( - super::check_solidity_warning( - TRANSFER_TEST_SOURCE, - "Warning: It looks like you are using '
.send/transfer()' without providing", - BTreeMap::new(), - SolcPipeline::Yul, - false, - None, - ).expect("Test failure") - ); + assert!(super::check_solidity_warning( + TRANSFER_TEST_SOURCE, + BALANCE_CALLS_MESSAGE, + BTreeMap::new(), + false, + None, + ) + .expect("Test failure")); } #[test] fn transfer_suppressed() { - assert!( - !super::check_solidity_warning( - TRANSFER_TEST_SOURCE, - "Warning: It looks like you are using '
.send/transfer()' without providing", - BTreeMap::new(), - SolcPipeline::Yul, - false, - Some(vec![Warning::SendTransfer]), - ).expect("Test failure") - ); + assert!(!super::check_solidity_warning( + TRANSFER_TEST_SOURCE, + BALANCE_CALLS_MESSAGE, + BTreeMap::new(), + false, + Some(vec![Warning::SendTransfer]), + ) + .expect("Test failure")); } pub const EXTCODESIZE_TEST_SOURCE: &str = r#" @@ -163,7 +155,6 @@ fn extcodesize() { EXTCODESIZE_TEST_SOURCE, "Warning: Your code or one of its dependencies uses the 'extcodesize' instruction,", BTreeMap::new(), - SolcPipeline::Yul, false, None, ) @@ -176,7 +167,6 @@ fn extcodesize_suppressed() { EXTCODESIZE_TEST_SOURCE, "Warning: Your code or one of its dependencies uses the 'extcodesize' instruction,", BTreeMap::new(), - SolcPipeline::Yul, false, Some(vec![Warning::ExtCodeSize]), ) @@ -200,7 +190,6 @@ fn tx_origin() { TX_ORIGIN_TEST_SOURCE, "Warning: You are checking for 'tx.origin' in your code, which might lead to", BTreeMap::new(), - SolcPipeline::Yul, false, None, ) @@ -213,7 +202,6 @@ fn tx_origin_suppressed() { TX_ORIGIN_TEST_SOURCE, "Warning: You are checking for 'tx.origin' in your code, which might lead to", BTreeMap::new(), - SolcPipeline::Yul, false, Some(vec![Warning::TxOrigin]), ) @@ -244,7 +232,6 @@ fn tx_origin_assembly() { TX_ORIGIN_ASSEMBLY_TEST_SOURCE, "Warning: You are checking for 'tx.origin' in your code, which might lead to", BTreeMap::new(), - SolcPipeline::Yul, false, None, ) @@ -257,136 +244,8 @@ fn tx_origin_assembly_suppressed() { TX_ORIGIN_ASSEMBLY_TEST_SOURCE, "Warning: You are checking for 'tx.origin' in your code, which might lead to", BTreeMap::new(), - SolcPipeline::Yul, false, Some(vec![Warning::TxOrigin]), ) .expect("Test failure")); } - -#[test] -fn internal_function_pointer_argument() { - let source_code = r#" -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -contract InternalFunctionPointerExample { - function add(uint256 a, uint256 b) internal pure returns (uint256) { - return a + b; - } - - function sub(uint256 a, uint256 b) internal pure returns (uint256) { - return a - b; - } - - function executeOperation( - function (uint256, uint256) internal pure returns (uint256) operation, - uint256 a, - uint256 b - ) private pure returns (uint256) { - return operation(a, b); - } - - function testAdd(uint256 a, uint256 b) public pure returns (uint256) { - return executeOperation(add, a, b); - } - - function testSub(uint256 a, uint256 b) public pure returns (uint256) { - return executeOperation(sub, a, b); - } -} - "#; - - assert!(super::check_solidity_warning( - source_code, - "Error: Internal function pointers are not supported in EVM legacy assembly pipeline.", - BTreeMap::new(), - SolcPipeline::EVMLA, - true, - None, - ) - .expect("Test failure")); -} - -#[test] -fn internal_function_pointer_stack() { - let source_code = r#" -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -contract StackFunctionPointerExample { - function add(uint256 a, uint256 b) internal pure returns (uint256) { - return a + b; - } - - function sub(uint256 a, uint256 b) internal pure returns (uint256) { - return a - b; - } - - function testAdd(uint256 a, uint256 b) public pure returns (uint256) { - function (uint256, uint256) internal pure returns (uint256) operation = add; - return operation(a, b); - } - - function testSub(uint256 a, uint256 b) public pure returns (uint256) { - function (uint256, uint256) internal pure returns (uint256) operation = sub; - return operation(a, b); - } -} - "#; - - assert!(super::check_solidity_warning( - source_code, - "Error: Internal function pointers are not supported in EVM legacy assembly pipeline.", - BTreeMap::new(), - SolcPipeline::EVMLA, - true, - None, - ) - .expect("Test failure")); -} - -#[test] -fn internal_function_pointer_storage() { - let source_code = r#" -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -contract StorageFunctionPointerExample { - function add(uint256 a, uint256 b) internal pure returns (uint256) { - return a + b; - } - - function sub(uint256 a, uint256 b) internal pure returns (uint256) { - return a - b; - } - - function (uint256, uint256) internal pure returns (uint256) operation; - bool private isOperationSet = false; - - function setOperation(bool isAdd) public { - if (isAdd) { - operation = add; - } else { - operation = sub; - } - isOperationSet = true; - } - - function executeOperation(uint256 a, uint256 b) public view returns (uint256) { - require(isOperationSet, "Operation not set"); - return operation(a, b); - } -} - "#; - - assert!(super::check_solidity_warning( - source_code, - "Error: Internal function pointers are not supported in EVM legacy assembly pipeline.", - BTreeMap::new(), - SolcPipeline::EVMLA, - true, - None, - ) - .expect("Test failure")); -} diff --git a/crates/solidity/src/tests/optimizer.rs b/crates/solidity/src/tests/optimizer.rs index 78abb4b..aa58936 100644 --- a/crates/solidity/src/tests/optimizer.rs +++ b/crates/solidity/src/tests/optimizer.rs @@ -4,8 +4,6 @@ use std::collections::BTreeMap; -use crate::solc::pipeline::Pipeline as SolcPipeline; - pub const SOURCE_CODE: &str = r#" // SPDX-License-Identifier: MIT @@ -54,7 +52,6 @@ fn optimizer() { sources.clone(), BTreeMap::new(), None, - SolcPipeline::Yul, revive_llvm_context::OptimizerSettings::none(), ) .expect("Build failure"); @@ -62,7 +59,6 @@ fn optimizer() { sources.clone(), BTreeMap::new(), None, - SolcPipeline::Yul, revive_llvm_context::OptimizerSettings::cycles(), ) .expect("Build failure"); @@ -70,7 +66,6 @@ fn optimizer() { sources, BTreeMap::new(), None, - SolcPipeline::Yul, revive_llvm_context::OptimizerSettings::size(), ) .expect("Build failure"); diff --git a/crates/solidity/src/tests/remappings.rs b/crates/solidity/src/tests/remappings.rs index b34d76c..15dc31e 100644 --- a/crates/solidity/src/tests/remappings.rs +++ b/crates/solidity/src/tests/remappings.rs @@ -5,8 +5,6 @@ use std::collections::BTreeMap; use std::collections::BTreeSet; -use crate::solc::pipeline::Pipeline as SolcPipeline; - pub const CALLEE_TEST_SOURCE: &str = r#" // SPDX-License-Identifier: MIT @@ -46,7 +44,6 @@ fn default() { sources, BTreeMap::new(), Some(remappings), - SolcPipeline::Yul, revive_llvm_context::OptimizerSettings::cycles(), ) .expect("Test failure"); diff --git a/crates/solidity/src/tests/runtime_code.rs b/crates/solidity/src/tests/runtime_code.rs index 65dfe0e..6080311 100644 --- a/crates/solidity/src/tests/runtime_code.rs +++ b/crates/solidity/src/tests/runtime_code.rs @@ -4,8 +4,6 @@ use std::collections::BTreeMap; -use crate::solc::pipeline::Pipeline as SolcPipeline; - #[test] #[should_panic(expected = "runtimeCode is not supported")] fn default() { @@ -29,7 +27,6 @@ contract Test { sources, BTreeMap::new(), None, - SolcPipeline::Yul, revive_llvm_context::OptimizerSettings::cycles(), ) .expect("Test failure"); diff --git a/crates/solidity/src/tests/unsupported_opcodes.rs b/crates/solidity/src/tests/unsupported_opcodes.rs index ec72436..b6479a0 100644 --- a/crates/solidity/src/tests/unsupported_opcodes.rs +++ b/crates/solidity/src/tests/unsupported_opcodes.rs @@ -4,8 +4,6 @@ use std::collections::BTreeMap; -use crate::solc::pipeline::Pipeline as SolcPipeline; - #[test] #[should_panic(expected = "The `CODECOPY` instruction is not supported")] fn codecopy_yul_runtime() { @@ -34,7 +32,6 @@ contract FixedCodeCopy { sources, BTreeMap::new(), None, - SolcPipeline::Yul, revive_llvm_context::OptimizerSettings::cycles(), ) .expect("Test failure"); @@ -63,22 +60,6 @@ contract CallcodeTest { } "#; -#[test] -#[should_panic(expected = "The `CALLCODE` instruction is not supported")] -fn callcode_evmla() { - let mut sources = BTreeMap::new(); - sources.insert("test.sol".to_owned(), CALLCODE_TEST_SOURCE.to_owned()); - - super::build_solidity( - sources, - BTreeMap::new(), - None, - SolcPipeline::EVMLA, - revive_llvm_context::OptimizerSettings::cycles(), - ) - .expect("Test failure"); -} - #[test] #[should_panic(expected = "The `CALLCODE` instruction is not supported")] fn callcode_yul() { @@ -89,7 +70,6 @@ fn callcode_yul() { sources, BTreeMap::new(), None, - SolcPipeline::Yul, revive_llvm_context::OptimizerSettings::cycles(), ) .expect("Test failure"); @@ -137,22 +117,6 @@ contract ExternalCodeCopy { } "#; -#[test] -#[should_panic(expected = "The `EXTCODECOPY` instruction is not supported")] -fn extcodecopy_evmla() { - let mut sources = BTreeMap::new(); - sources.insert("test.sol".to_owned(), EXTCODECOPY_TEST_SOURCE.to_owned()); - - super::build_solidity( - sources, - BTreeMap::new(), - None, - SolcPipeline::EVMLA, - revive_llvm_context::OptimizerSettings::cycles(), - ) - .expect("Test failure"); -} - #[test] #[should_panic(expected = "The `EXTCODECOPY` instruction is not supported")] fn extcodecopy_yul() { @@ -163,7 +127,6 @@ fn extcodecopy_yul() { sources, BTreeMap::new(), None, - SolcPipeline::Yul, revive_llvm_context::OptimizerSettings::cycles(), ) .expect("Test failure"); @@ -187,22 +150,6 @@ contract MinimalDestructible { } "#; -#[test] -#[should_panic(expected = "The `SELFDESTRUCT` instruction is not supported")] -fn selfdestruct_evmla() { - let mut sources = BTreeMap::new(); - sources.insert("test.sol".to_owned(), SELFDESTRUCT_TEST_SOURCE.to_owned()); - - super::build_solidity( - sources, - BTreeMap::new(), - None, - SolcPipeline::EVMLA, - revive_llvm_context::OptimizerSettings::cycles(), - ) - .expect("Test failure"); -} - #[test] #[should_panic(expected = "The `SELFDESTRUCT` instruction is not supported")] fn selfdestruct_yul() { @@ -213,7 +160,6 @@ fn selfdestruct_yul() { sources, BTreeMap::new(), None, - SolcPipeline::Yul, revive_llvm_context::OptimizerSettings::cycles(), ) .expect("Test failure"); diff --git a/crates/solidity/src/yul/lexer/mod.rs b/crates/solidity/src/yul/lexer/mod.rs index ca26e8f..1ae2bea 100644 --- a/crates/solidity/src/yul/lexer/mod.rs +++ b/crates/solidity/src/yul/lexer/mod.rs @@ -42,7 +42,6 @@ impl Lexer { } /// Advances the lexer, returning the next lexeme. - #[allow(clippy::should_implement_trait)] pub fn next(&mut self) -> Result { if let Some(peeked) = self.peeked.take() { return Ok(peeked); diff --git a/js/e2e/web.test.js b/js/e2e/web.test.js index 020e8c9..31c01e7 100644 --- a/js/e2e/web.test.js +++ b/js/e2e/web.test.js @@ -111,3 +111,35 @@ test("should return not found error for missing imports in browser", async ({ 'Source "nonexistent/console.sol" not found', ); }); + +test('should successfully compile a valid Solidity contract that instantiates another contract in the browser', async ({ page }) => { + await loadTestPage(page); + const standardInput = loadFixture('instantiate.json') + const result = await runWorker(page, standardInput); + + expect(typeof result).toBe('string'); + let output = JSON.parse(result); + expect(output).toHaveProperty('contracts'); + expect(output.contracts['fixtures/instantiate.sol']).toHaveProperty('ChildContract'); + expect(output.contracts['fixtures/instantiate.sol'].ChildContract).toHaveProperty('abi'); + expect(output.contracts['fixtures/instantiate.sol'].ChildContract).toHaveProperty('evm'); + expect(output.contracts['fixtures/instantiate.sol'].ChildContract.evm).toHaveProperty('bytecode'); + expect(output.contracts['fixtures/instantiate.sol']).toHaveProperty('MainContract'); + expect(output.contracts['fixtures/instantiate.sol'].MainContract).toHaveProperty('abi'); + expect(output.contracts['fixtures/instantiate.sol'].MainContract).toHaveProperty('evm'); + expect(output.contracts['fixtures/instantiate.sol'].MainContract.evm).toHaveProperty('bytecode'); +}); + +test('should successfully compile a valid Solidity contract that instantiates the token contracts in the browser', async ({ page }) => { + await loadTestPage(page); + const standardInput = loadFixture('instantiate_tokens.json') + const result = await runWorker(page, standardInput); + + expect(typeof result).toBe('string'); + let output = JSON.parse(result); + expect(output).toHaveProperty('contracts'); + expect(output.contracts['fixtures/instantiate_tokens.sol']).toHaveProperty('TokensFactory'); + expect(output.contracts['fixtures/instantiate_tokens.sol'].TokensFactory).toHaveProperty('abi'); + expect(output.contracts['fixtures/instantiate_tokens.sol'].TokensFactory).toHaveProperty('evm'); + expect(output.contracts['fixtures/instantiate_tokens.sol'].TokensFactory.evm).toHaveProperty('bytecode'); +}); diff --git a/js/fixtures/instantiate.json b/js/fixtures/instantiate.json new file mode 100644 index 0000000..af790c9 --- /dev/null +++ b/js/fixtures/instantiate.json @@ -0,0 +1,20 @@ +{ + "language": "Solidity", + "sources": { + "fixtures/instantiate.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.8.2 <0.9.0;\ncontract ChildContract {\n constructor() {\n }\n}\ncontract MainContract {\n constructor() {\n ChildContract newContract = new ChildContract();\n }\n}" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": ["abi"] + } + } + } + } + \ No newline at end of file diff --git a/js/fixtures/instantiate_tokens.json b/js/fixtures/instantiate_tokens.json new file mode 100644 index 0000000..9e8dce6 --- /dev/null +++ b/js/fixtures/instantiate_tokens.json @@ -0,0 +1,81 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC5267.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.20;\n\ninterface IERC5267 {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC6093.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC20Metadata} from \"./extensions/IERC20Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {IERC20Errors} from \"../../interfaces/draft-IERC6093.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account => uint256) private _balances;\n\n mapping(address account => mapping(address spender => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Skips emitting an {Approval} event indicating an allowance update. This is not\n * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance < value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value <= fromBalance <= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n * true using the following override:\n *\n * ```solidity\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n if (currentAllowance < value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20Permit} from \"./IERC20Permit.sol\";\nimport {ERC20} from \"../ERC20.sol\";\nimport {ECDSA} from \"../../../utils/cryptography/ECDSA.sol\";\nimport {EIP712} from \"../../../utils/cryptography/EIP712.sol\";\nimport {Nonces} from \"../../../utils/Nonces.sol\";\n\n/**\n * @dev Implementation of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712, Nonces {\n bytes32 private constant PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n\n /**\n * @dev Permit deadline has expired.\n */\n error ERC2612ExpiredSignature(uint256 deadline);\n\n /**\n * @dev Mismatched signature.\n */\n error ERC2612InvalidSigner(address signer, address owner);\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC-20 token name.\n */\n constructor(string memory name) EIP712(name, \"1\") {}\n\n /**\n * @inheritdoc IERC20Permit\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual {\n if (block.timestamp > deadline) {\n revert ERC2612ExpiredSignature(deadline);\n }\n\n bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n if (signer != owner) {\n revert ERC2612InvalidSigner(signer, owner);\n }\n\n _approve(owner, spender, value);\n }\n\n /**\n * @inheritdoc IERC20Permit\n */\n function nonces(address owner) public view virtual override(IERC20Permit, Nonces) returns (uint256) {\n return super.nonces(owner);\n }\n\n /**\n * @inheritdoc IERC20Permit\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {\n return _domainSeparatorV4();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Permit.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[ERC-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC-20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * ==== Security Considerations\n *\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\n * generally recommended is:\n *\n * ```solidity\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\n * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\n * doThing(..., value);\n * }\n *\n * function doThing(..., uint256 value) public {\n * token.safeTransferFrom(msg.sender, address(this), value);\n * ...\n * }\n * ```\n *\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\n * {SafeERC20-safeTransferFrom}).\n *\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\n * contracts should have entry points that don't rely on permit.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n *\n * CAUTION: See Security Considerations above.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Nonces.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Nonces.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides tracking nonces for addresses. Nonces will only increment.\n */\nabstract contract Nonces {\n /**\n * @dev The nonce used for an `account` is not the expected current nonce.\n */\n error InvalidAccountNonce(address account, uint256 currentNonce);\n\n mapping(address account => uint256) private _nonces;\n\n /**\n * @dev Returns the next unused nonce for an address.\n */\n function nonces(address owner) public view virtual returns (uint256) {\n return _nonces[owner];\n }\n\n /**\n * @dev Consumes a nonce.\n *\n * Returns the current value and increments nonce.\n */\n function _useNonce(address owner) internal virtual returns (uint256) {\n // For each account, the nonce has an initial value of 0, can only be incremented by one, and cannot be\n // decremented or reset. This guarantees that the nonce never overflows.\n unchecked {\n // It is important to do x++ and not ++x here.\n return _nonces[owner]++;\n }\n }\n\n /**\n * @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`.\n */\n function _useCheckedNonce(address owner, uint256 nonce) internal virtual {\n uint256 current = _useNonce(owner);\n if (nonce != current) {\n revert InvalidAccountNonce(owner, current);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Panic.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Helper library for emitting standardized panic codes.\n *\n * ```solidity\n * contract Example {\n * using Panic for uint256;\n *\n * // Use any of the declared internal constants\n * function foo() { Panic.GENERIC.panic(); }\n *\n * // Alternatively\n * function foo() { Panic.panic(Panic.GENERIC); }\n * }\n * ```\n *\n * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].\n *\n * _Available since v5.1._\n */\n// slither-disable-next-line unused-state\nlibrary Panic {\n /// @dev generic / unspecified error\n uint256 internal constant GENERIC = 0x00;\n /// @dev used by the assert() builtin\n uint256 internal constant ASSERT = 0x01;\n /// @dev arithmetic underflow or overflow\n uint256 internal constant UNDER_OVERFLOW = 0x11;\n /// @dev division or modulo by zero\n uint256 internal constant DIVISION_BY_ZERO = 0x12;\n /// @dev enum conversion error\n uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;\n /// @dev invalid encoding in storage\n uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;\n /// @dev empty array pop\n uint256 internal constant EMPTY_ARRAY_POP = 0x31;\n /// @dev array out of bounds access\n uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;\n /// @dev resource error (too large allocation or too large array)\n uint256 internal constant RESOURCE_ERROR = 0x41;\n /// @dev calling invalid internal function\n uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;\n\n /// @dev Reverts with a panic code. Recommended to use with\n /// the internal constants with predefined codes.\n function panic(uint256 code) internal pure {\n assembly (\"memory-safe\") {\n mstore(0x00, 0x4e487b71)\n mstore(0x20, code)\n revert(0x1c, 0x24)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/ShortStrings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.20;\n\nimport {StorageSlot} from \"./StorageSlot.sol\";\n\n// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |\n// | length | 0x BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n * using ShortStrings for *;\n *\n * ShortString private immutable _name;\n * string private _nameFallback;\n *\n * constructor(string memory contractName) {\n * _name = contractName.toShortStringWithFallback(_nameFallback);\n * }\n *\n * function name() external view returns (string memory) {\n * return _name.toStringWithFallback(_nameFallback);\n * }\n * }\n * ```\n */\nlibrary ShortStrings {\n // Used as an identifier for strings longer than 31 bytes.\n bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n error StringTooLong(string str);\n error InvalidShortString();\n\n /**\n * @dev Encode a string of at most 31 chars into a `ShortString`.\n *\n * This will trigger a `StringTooLong` error is the input string is too long.\n */\n function toShortString(string memory str) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n if (bstr.length > 31) {\n revert StringTooLong(str);\n }\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n }\n\n /**\n * @dev Decode a `ShortString` back to a \"normal\" string.\n */\n function toString(ShortString sstr) internal pure returns (string memory) {\n uint256 len = byteLength(sstr);\n // using `new string(len)` would work locally but is not memory safe.\n string memory str = new string(32);\n assembly (\"memory-safe\") {\n mstore(str, len)\n mstore(add(str, 0x20), sstr)\n }\n return str;\n }\n\n /**\n * @dev Return the length of a `ShortString`.\n */\n function byteLength(ShortString sstr) internal pure returns (uint256) {\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n if (result > 31) {\n revert InvalidShortString();\n }\n return result;\n }\n\n /**\n * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n */\n function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n if (bytes(value).length < 32) {\n return toShortString(value);\n } else {\n StorageSlot.getStringSlot(store).value = value;\n return ShortString.wrap(FALLBACK_SENTINEL);\n }\n }\n\n /**\n * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n */\n function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return toString(value);\n } else {\n return store;\n }\n }\n\n /**\n * @dev Return the length of a string that was encoded to `ShortString` or written to storage using\n * {setWithFallback}.\n *\n * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n */\n function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {\n return byteLength(value);\n } else {\n return bytes(store).length;\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC-1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n * // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * TIP: Consider using this library along with {SlotDerivation}.\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n struct Int256Slot {\n int256 value;\n }\n\n struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `Int256Slot` with member `value` located at `slot`.\n */\n function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns a `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns a `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n assembly (\"memory-safe\") {\n r.slot := store.slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/Strings.sol)\n\npragma solidity ^0.8.20;\n\nimport {Math} from \"./math/Math.sol\";\nimport {SignedMath} from \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\n uint8 private constant ADDRESS_LENGTH = 20;\n\n /**\n * @dev The `value` string doesn't fit in the specified `length`.\n */\n error StringsInsufficientHexLength(uint256 value, uint256 length);\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = Math.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n assembly (\"memory-safe\") {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n assembly (\"memory-safe\") {\n mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `int256` to its ASCII `string` decimal representation.\n */\n function toStringSigned(int256 value) internal pure returns (string memory) {\n return string.concat(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value)));\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, Math.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n uint256 localValue = value;\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = HEX_DIGITS[localValue & 0xf];\n localValue >>= 4;\n }\n if (localValue != 0) {\n revert StringsInsufficientHexLength(value, length);\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal\n * representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its checksummed ASCII `string` hexadecimal\n * representation, according to EIP-55.\n */\n function toChecksumHexString(address addr) internal pure returns (string memory) {\n bytes memory buffer = bytes(toHexString(addr));\n\n // hash the hex part of buffer (skip length + 2 bytes, length 40)\n uint256 hashValue;\n assembly (\"memory-safe\") {\n hashValue := shr(96, keccak256(add(buffer, 0x22), 40))\n }\n\n for (uint256 i = 41; i > 1; --i) {\n // possible values for buffer[i] are 48 (0) to 57 (9) and 97 (a) to 102 (f)\n if (hashValue & 0xf > 7 && uint8(buffer[i]) > 96) {\n // case shift by xoring with 0x20\n buffer[i] ^= 0x20;\n }\n hashValue >>= 4;\n }\n return string(buffer);\n }\n\n /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS\n }\n\n /**\n * @dev The signature derives the `address(0)`.\n */\n error ECDSAInvalidSignature();\n\n /**\n * @dev The signature has an invalid length.\n */\n error ECDSAInvalidSignatureLength(uint256 length);\n\n /**\n * @dev The signature has an S value that is in the upper half order.\n */\n error ECDSAInvalidSignatureS(bytes32 s);\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not\n * return address(0) without also returning an error description. Errors are documented using an enum (error type)\n * and a bytes32 providing additional information about the error.\n *\n * If no error is returned, then the address can be used for verification purposes.\n *\n * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n */\n function tryRecover(\n bytes32 hash,\n bytes memory signature\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n assembly (\"memory-safe\") {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n unchecked {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n // We do not check for an overflow here since the shift operation results in 0 or 1.\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n */\n function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS, s);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature, bytes32(0));\n }\n\n return (signer, RecoverError.NoError, bytes32(0));\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);\n _throwError(error, errorArg);\n return recovered;\n }\n\n /**\n * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.\n */\n function _throwError(RecoverError error, bytes32 errorArg) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert ECDSAInvalidSignature();\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert ECDSAInvalidSignatureLength(uint256(errorArg));\n } else if (error == RecoverError.InvalidSignatureS) {\n revert ECDSAInvalidSignatureS(errorArg);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.20;\n\nimport {MessageHashUtils} from \"./MessageHashUtils.sol\";\nimport {ShortStrings, ShortString} from \"../ShortStrings.sol\";\nimport {IERC5267} from \"../../interfaces/IERC5267.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose\n * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract\n * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to\n * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable\n */\nabstract contract EIP712 is IERC5267 {\n using ShortStrings for *;\n\n bytes32 private constant TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _cachedDomainSeparator;\n uint256 private immutable _cachedChainId;\n address private immutable _cachedThis;\n\n bytes32 private immutable _hashedName;\n bytes32 private immutable _hashedVersion;\n\n ShortString private immutable _name;\n ShortString private immutable _version;\n string private _nameFallback;\n string private _versionFallback;\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n _name = name.toShortStringWithFallback(_nameFallback);\n _version = version.toShortStringWithFallback(_versionFallback);\n _hashedName = keccak256(bytes(name));\n _hashedVersion = keccak256(bytes(version));\n\n _cachedChainId = block.chainid;\n _cachedDomainSeparator = _buildDomainSeparator();\n _cachedThis = address(this);\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n return _cachedDomainSeparator;\n } else {\n return _buildDomainSeparator();\n }\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev See {IERC-5267}.\n */\n function eip712Domain()\n public\n view\n virtual\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n return (\n hex\"0f\", // 01111\n _EIP712Name(),\n _EIP712Version(),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n\n /**\n * @dev The name parameter for the EIP712 domain.\n *\n * NOTE: By default this function reads _name which is an immutable value.\n * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n */\n // solhint-disable-next-line func-name-mixedcase\n function _EIP712Name() internal view returns (string memory) {\n return _name.toStringWithFallback(_nameFallback);\n }\n\n /**\n * @dev The version parameter for the EIP712 domain.\n *\n * NOTE: By default this function reads _version which is an immutable value.\n * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).\n */\n // solhint-disable-next-line func-name-mixedcase\n function _EIP712Version() internal view returns (string memory) {\n return _version.toStringWithFallback(_versionFallback);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/cryptography/MessageHashUtils.sol)\n\npragma solidity ^0.8.20;\n\nimport {Strings} from \"../Strings.sol\";\n\n/**\n * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.\n *\n * The library provides methods for generating a hash of a message that conforms to the\n * https://eips.ethereum.org/EIPS/eip-191[ERC-191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]\n * specifications.\n */\nlibrary MessageHashUtils {\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x45` (`personal_sign` messages).\n *\n * The digest is calculated by prefixing a bytes32 `messageHash` with\n * `\"\\x19Ethereum Signed Message:\\n32\"` and hashing the result. It corresponds with the\n * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.\n *\n * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with\n * keccak256, although any bytes32 value can be safely used because the final digest will\n * be re-hashed.\n *\n * See {ECDSA-recover}.\n */\n function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\") // 32 is the bytes-length of messageHash\n mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix\n digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)\n }\n }\n\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x45` (`personal_sign` messages).\n *\n * The digest is calculated by prefixing an arbitrary `message` with\n * `\"\\x19Ethereum Signed Message:\\n\" + len(message)` and hashing the result. It corresponds with the\n * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.\n *\n * See {ECDSA-recover}.\n */\n function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {\n return\n keccak256(bytes.concat(\"\\x19Ethereum Signed Message:\\n\", bytes(Strings.toString(message.length)), message));\n }\n\n /**\n * @dev Returns the keccak256 digest of an ERC-191 signed data with version\n * `0x00` (data with intended validator).\n *\n * The digest is calculated by prefixing an arbitrary `data` with `\"\\x19\\x00\"` and the intended\n * `validator` address. Then hashing the result.\n *\n * See {ECDSA-recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(hex\"19_00\", validator, data));\n }\n\n /**\n * @dev Returns the keccak256 digest of an EIP-712 typed data (ERC-191 version `0x01`).\n *\n * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with\n * `\\x19\\x01` and hashing the result. It corresponds to the hash signed by the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.\n *\n * See {ECDSA-recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {\n assembly (\"memory-safe\") {\n let ptr := mload(0x40)\n mstore(ptr, hex\"19_01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n digest := keccak256(ptr, 0x42)\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\nimport {Panic} from \"../Panic.sol\";\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Floor, // Toward negative infinity\n Ceil, // Toward positive infinity\n Trunc, // Toward zero\n Expand // Away from zero\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, with an success flag (no overflow).\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an success flag (no overflow).\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an success flag (no overflow).\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a success flag (no division by zero).\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n *\n * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n * one branch when needed, making this function more expensive.\n */\n function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {\n unchecked {\n // branchless ternary works because:\n // b ^ (a ^ b) == a\n // b ^ 0 == b\n return b ^ ((a ^ b) * SafeCast.toUint(condition));\n }\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return ternary(a > b, a, b);\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return ternary(a < b, a, b);\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds towards infinity instead\n * of rounding towards zero.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n if (b == 0) {\n // Guarantee the same behavior as in a regular Solidity division.\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n\n // The following calculation ensures accurate ceiling division without overflow.\n // Since a is non-zero, (a - 1) / b will not overflow.\n // The largest possible result occurs when (a - 1) / b is type(uint256).max,\n // but the largest value we can obtain is type(uint256).max - 1, which happens\n // when a = type(uint256).max and b = 1.\n unchecked {\n return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);\n }\n }\n\n /**\n * @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n * denominator == 0.\n *\n * Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n * Uniswap Labs also under MIT license.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use\n // the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2²⁵⁶ + prod0.\n uint256 prod0 = x * y; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.\n if (denominator <= prod1) {\n Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));\n }\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n uint256 twos = denominator & (0 - denominator);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such\n // that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv ≡ 1 mod 2⁴.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n // works in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2⁸\n inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶\n inverse *= 2 - denominator * inverse; // inverse mod 2³²\n inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴\n inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸\n inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2²⁵⁶. Since the preconditions guarantee that the outcome is\n // less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @dev Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);\n }\n\n /**\n * @dev Calculate the modular multiplicative inverse of a number in Z/nZ.\n *\n * If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.\n * If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.\n *\n * If the input value is not inversible, 0 is returned.\n *\n * NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the\n * inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.\n */\n function invMod(uint256 a, uint256 n) internal pure returns (uint256) {\n unchecked {\n if (n == 0) return 0;\n\n // The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)\n // Used to compute integers x and y such that: ax + ny = gcd(a, n).\n // When the gcd is 1, then the inverse of a modulo n exists and it's x.\n // ax + ny = 1\n // ax = 1 + (-y)n\n // ax ≡ 1 (mod n) # x is the inverse of a modulo n\n\n // If the remainder is 0 the gcd is n right away.\n uint256 remainder = a % n;\n uint256 gcd = n;\n\n // Therefore the initial coefficients are:\n // ax + ny = gcd(a, n) = n\n // 0a + 1n = n\n int256 x = 0;\n int256 y = 1;\n\n while (remainder != 0) {\n uint256 quotient = gcd / remainder;\n\n (gcd, remainder) = (\n // The old remainder is the next gcd to try.\n remainder,\n // Compute the next remainder.\n // Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd\n // where gcd is at most n (capped to type(uint256).max)\n gcd - remainder * quotient\n );\n\n (x, y) = (\n // Increment the coefficient of a.\n y,\n // Decrement the coefficient of n.\n // Can overflow, but the result is casted to uint256 so that the\n // next value of y is \"wrapped around\" to a value between 0 and n - 1.\n x - y * int256(quotient)\n );\n }\n\n if (gcd != 1) return 0; // No inverse exists.\n return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.\n }\n }\n\n /**\n * @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.\n *\n * From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is\n * prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that\n * `a**(p-2)` is the modular multiplicative inverse of a in Fp.\n *\n * NOTE: this function does NOT check that `p` is a prime greater than `2`.\n */\n function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {\n unchecked {\n return Math.modExp(a, p - 2, p);\n }\n }\n\n /**\n * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)\n *\n * Requirements:\n * - modulus can't be zero\n * - underlying staticcall to precompile must succeed\n *\n * IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make\n * sure the chain you're using it on supports the precompiled contract for modular exponentiation\n * at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,\n * the underlying function will succeed given the lack of a revert, but the result may be incorrectly\n * interpreted as 0.\n */\n function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {\n (bool success, uint256 result) = tryModExp(b, e, m);\n if (!success) {\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n return result;\n }\n\n /**\n * @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).\n * It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying\n * to operate modulo 0 or if the underlying precompile reverted.\n *\n * IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain\n * you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in\n * https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack\n * of a revert, but the result may be incorrectly interpreted as 0.\n */\n function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {\n if (m == 0) return (false, 0);\n assembly (\"memory-safe\") {\n let ptr := mload(0x40)\n // | Offset | Content | Content (Hex) |\n // |-----------|------------|--------------------------------------------------------------------|\n // | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 |\n // | 0x60:0x7f | value of b | 0x<.............................................................b> |\n // | 0x80:0x9f | value of e | 0x<.............................................................e> |\n // | 0xa0:0xbf | value of m | 0x<.............................................................m> |\n mstore(ptr, 0x20)\n mstore(add(ptr, 0x20), 0x20)\n mstore(add(ptr, 0x40), 0x20)\n mstore(add(ptr, 0x60), b)\n mstore(add(ptr, 0x80), e)\n mstore(add(ptr, 0xa0), m)\n\n // Given the result < m, it's guaranteed to fit in 32 bytes,\n // so we can use the memory scratch space located at offset 0.\n success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)\n result := mload(0x00)\n }\n }\n\n /**\n * @dev Variant of {modExp} that supports inputs of arbitrary length.\n */\n function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {\n (bool success, bytes memory result) = tryModExp(b, e, m);\n if (!success) {\n Panic.panic(Panic.DIVISION_BY_ZERO);\n }\n return result;\n }\n\n /**\n * @dev Variant of {tryModExp} that supports inputs of arbitrary length.\n */\n function tryModExp(\n bytes memory b,\n bytes memory e,\n bytes memory m\n ) internal view returns (bool success, bytes memory result) {\n if (_zeroBytes(m)) return (false, new bytes(0));\n\n uint256 mLen = m.length;\n\n // Encode call args in result and move the free memory pointer\n result = abi.encodePacked(b.length, e.length, mLen, b, e, m);\n\n assembly (\"memory-safe\") {\n let dataPtr := add(result, 0x20)\n // Write result on top of args to avoid allocating extra memory.\n success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)\n // Overwrite the length.\n // result.length > returndatasize() is guaranteed because returndatasize() == m.length\n mstore(result, mLen)\n // Set the memory pointer after the returned data.\n mstore(0x40, add(dataPtr, mLen))\n }\n }\n\n /**\n * @dev Returns whether the provided byte array is zero.\n */\n function _zeroBytes(bytes memory byteArray) private pure returns (bool) {\n for (uint256 i = 0; i < byteArray.length; ++i) {\n if (byteArray[i] != 0) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n * towards zero.\n *\n * This method is based on Newton's method for computing square roots; the algorithm is restricted to only\n * using integer operations.\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n unchecked {\n // Take care of easy edge cases when a == 0 or a == 1\n if (a <= 1) {\n return a;\n }\n\n // In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a\n // sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between\n // the current value as `ε_n = | x_n - sqrt(a) |`.\n //\n // For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root\n // of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is\n // bigger than any uint256.\n //\n // By noticing that\n // `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`\n // we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar\n // to the msb function.\n uint256 aa = a;\n uint256 xn = 1;\n\n if (aa >= (1 << 128)) {\n aa >>= 128;\n xn <<= 64;\n }\n if (aa >= (1 << 64)) {\n aa >>= 64;\n xn <<= 32;\n }\n if (aa >= (1 << 32)) {\n aa >>= 32;\n xn <<= 16;\n }\n if (aa >= (1 << 16)) {\n aa >>= 16;\n xn <<= 8;\n }\n if (aa >= (1 << 8)) {\n aa >>= 8;\n xn <<= 4;\n }\n if (aa >= (1 << 4)) {\n aa >>= 4;\n xn <<= 2;\n }\n if (aa >= (1 << 2)) {\n xn <<= 1;\n }\n\n // We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).\n //\n // We can refine our estimation by noticing that the middle of that interval minimizes the error.\n // If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).\n // This is going to be our x_0 (and ε_0)\n xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)\n\n // From here, Newton's method give us:\n // x_{n+1} = (x_n + a / x_n) / 2\n //\n // One should note that:\n // x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a\n // = ((x_n² + a) / (2 * x_n))² - a\n // = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a\n // = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)\n // = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)\n // = (x_n² - a)² / (2 * x_n)²\n // = ((x_n² - a) / (2 * x_n))²\n // ≥ 0\n // Which proves that for all n ≥ 1, sqrt(a) ≤ x_n\n //\n // This gives us the proof of quadratic convergence of the sequence:\n // ε_{n+1} = | x_{n+1} - sqrt(a) |\n // = | (x_n + a / x_n) / 2 - sqrt(a) |\n // = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |\n // = | (x_n - sqrt(a))² / (2 * x_n) |\n // = | ε_n² / (2 * x_n) |\n // = ε_n² / | (2 * x_n) |\n //\n // For the first iteration, we have a special case where x_0 is known:\n // ε_1 = ε_0² / | (2 * x_0) |\n // ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))\n // ≤ 2**(2*e-4) / (3 * 2**(e-1))\n // ≤ 2**(e-3) / 3\n // ≤ 2**(e-3-log2(3))\n // ≤ 2**(e-4.5)\n //\n // For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:\n // ε_{n+1} = ε_n² / | (2 * x_n) |\n // ≤ (2**(e-k))² / (2 * 2**(e-1))\n // ≤ 2**(2*e-2*k) / 2**e\n // ≤ 2**(e-2*k)\n xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above\n xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5\n xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9\n xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18\n xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36\n xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72\n\n // Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision\n // ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either\n // sqrt(a) or sqrt(a) + 1.\n return xn - SafeCast.toUint(xn > a / xn);\n }\n }\n\n /**\n * @dev Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);\n }\n }\n\n /**\n * @dev Return the log in base 2 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n uint256 exp;\n unchecked {\n exp = 128 * SafeCast.toUint(value > (1 << 128) - 1);\n value >>= exp;\n result += exp;\n\n exp = 64 * SafeCast.toUint(value > (1 << 64) - 1);\n value >>= exp;\n result += exp;\n\n exp = 32 * SafeCast.toUint(value > (1 << 32) - 1);\n value >>= exp;\n result += exp;\n\n exp = 16 * SafeCast.toUint(value > (1 << 16) - 1);\n value >>= exp;\n result += exp;\n\n exp = 8 * SafeCast.toUint(value > (1 << 8) - 1);\n value >>= exp;\n result += exp;\n\n exp = 4 * SafeCast.toUint(value > (1 << 4) - 1);\n value >>= exp;\n result += exp;\n\n exp = 2 * SafeCast.toUint(value > (1 << 2) - 1);\n value >>= exp;\n result += exp;\n\n result += SafeCast.toUint(value > 1);\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);\n }\n }\n\n /**\n * @dev Return the log in base 10 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10 ** 64) {\n value /= 10 ** 64;\n result += 64;\n }\n if (value >= 10 ** 32) {\n value /= 10 ** 32;\n result += 32;\n }\n if (value >= 10 ** 16) {\n value /= 10 ** 16;\n result += 16;\n }\n if (value >= 10 ** 8) {\n value /= 10 ** 8;\n result += 8;\n }\n if (value >= 10 ** 4) {\n value /= 10 ** 4;\n result += 4;\n }\n if (value >= 10 ** 2) {\n value /= 10 ** 2;\n result += 2;\n }\n if (value >= 10 ** 1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);\n }\n }\n\n /**\n * @dev Return the log in base 256 of a positive value rounded towards zero.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n uint256 isGt;\n unchecked {\n isGt = SafeCast.toUint(value > (1 << 128) - 1);\n value >>= isGt * 128;\n result += isGt * 16;\n\n isGt = SafeCast.toUint(value > (1 << 64) - 1);\n value >>= isGt * 64;\n result += isGt * 8;\n\n isGt = SafeCast.toUint(value > (1 << 32) - 1);\n value >>= isGt * 32;\n result += isGt * 4;\n\n isGt = SafeCast.toUint(value > (1 << 16) - 1);\n value >>= isGt * 16;\n result += isGt * 2;\n\n result += SafeCast.toUint(value > (1 << 8) - 1);\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);\n }\n }\n\n /**\n * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n */\n function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n return uint8(rounding) % 2 == 1;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SafeCast.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeCast {\n /**\n * @dev Value doesn't fit in an uint of `bits` size.\n */\n error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);\n\n /**\n * @dev An int value doesn't fit in an uint of `bits` size.\n */\n error SafeCastOverflowedIntToUint(int256 value);\n\n /**\n * @dev Value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);\n\n /**\n * @dev An uint value doesn't fit in an int of `bits` size.\n */\n error SafeCastOverflowedUintToInt(uint256 value);\n\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n if (value > type(uint248).max) {\n revert SafeCastOverflowedUintDowncast(248, value);\n }\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n if (value > type(uint240).max) {\n revert SafeCastOverflowedUintDowncast(240, value);\n }\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n if (value > type(uint232).max) {\n revert SafeCastOverflowedUintDowncast(232, value);\n }\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n if (value > type(uint224).max) {\n revert SafeCastOverflowedUintDowncast(224, value);\n }\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n if (value > type(uint216).max) {\n revert SafeCastOverflowedUintDowncast(216, value);\n }\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n if (value > type(uint208).max) {\n revert SafeCastOverflowedUintDowncast(208, value);\n }\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n if (value > type(uint200).max) {\n revert SafeCastOverflowedUintDowncast(200, value);\n }\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n if (value > type(uint192).max) {\n revert SafeCastOverflowedUintDowncast(192, value);\n }\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n if (value > type(uint184).max) {\n revert SafeCastOverflowedUintDowncast(184, value);\n }\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n if (value > type(uint176).max) {\n revert SafeCastOverflowedUintDowncast(176, value);\n }\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n if (value > type(uint168).max) {\n revert SafeCastOverflowedUintDowncast(168, value);\n }\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n if (value > type(uint160).max) {\n revert SafeCastOverflowedUintDowncast(160, value);\n }\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n if (value > type(uint152).max) {\n revert SafeCastOverflowedUintDowncast(152, value);\n }\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n if (value > type(uint144).max) {\n revert SafeCastOverflowedUintDowncast(144, value);\n }\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n if (value > type(uint136).max) {\n revert SafeCastOverflowedUintDowncast(136, value);\n }\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n if (value > type(uint128).max) {\n revert SafeCastOverflowedUintDowncast(128, value);\n }\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n if (value > type(uint120).max) {\n revert SafeCastOverflowedUintDowncast(120, value);\n }\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n if (value > type(uint112).max) {\n revert SafeCastOverflowedUintDowncast(112, value);\n }\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n if (value > type(uint104).max) {\n revert SafeCastOverflowedUintDowncast(104, value);\n }\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n if (value > type(uint96).max) {\n revert SafeCastOverflowedUintDowncast(96, value);\n }\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n if (value > type(uint88).max) {\n revert SafeCastOverflowedUintDowncast(88, value);\n }\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n if (value > type(uint80).max) {\n revert SafeCastOverflowedUintDowncast(80, value);\n }\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n if (value > type(uint72).max) {\n revert SafeCastOverflowedUintDowncast(72, value);\n }\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n if (value > type(uint64).max) {\n revert SafeCastOverflowedUintDowncast(64, value);\n }\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n if (value > type(uint56).max) {\n revert SafeCastOverflowedUintDowncast(56, value);\n }\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n if (value > type(uint48).max) {\n revert SafeCastOverflowedUintDowncast(48, value);\n }\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n if (value > type(uint40).max) {\n revert SafeCastOverflowedUintDowncast(40, value);\n }\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n if (value > type(uint32).max) {\n revert SafeCastOverflowedUintDowncast(32, value);\n }\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n if (value > type(uint24).max) {\n revert SafeCastOverflowedUintDowncast(24, value);\n }\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n if (value > type(uint16).max) {\n revert SafeCastOverflowedUintDowncast(16, value);\n }\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n if (value > type(uint8).max) {\n revert SafeCastOverflowedUintDowncast(8, value);\n }\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n if (value < 0) {\n revert SafeCastOverflowedIntToUint(value);\n }\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(248, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(240, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(232, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(224, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(216, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(208, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(200, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(192, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(184, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(176, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(168, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(160, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(152, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(144, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(136, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(128, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(120, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(112, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(104, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(96, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(88, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(80, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(72, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(64, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(56, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(48, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(40, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(32, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(24, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(16, value);\n }\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n if (downcasted != value) {\n revert SafeCastOverflowedIntDowncast(8, value);\n }\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n if (value > uint256(type(int256).max)) {\n revert SafeCastOverflowedUintToInt(value);\n }\n return int256(value);\n }\n\n /**\n * @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.\n */\n function toUint(bool b) internal pure returns (uint256 u) {\n assembly (\"memory-safe\") {\n u := iszero(iszero(b))\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/SignedMath.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.20;\n\nimport {SafeCast} from \"./SafeCast.sol\";\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.\n *\n * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.\n * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute\n * one branch when needed, making this function more expensive.\n */\n function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) {\n unchecked {\n // branchless ternary works because:\n // b ^ (a ^ b) == a\n // b ^ 0 == b\n return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));\n }\n }\n\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return ternary(a > b, a, b);\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return ternary(a < b, a, b);\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // Formula from the \"Bit Twiddling Hacks\" by Sean Eron Anderson.\n // Since `n` is a signed integer, the generated bytecode will use the SAR opcode to perform the right shift,\n // taking advantage of the most significant (or \"sign\" bit) in two's complement representation.\n // This opcode adds new most significant bits set to the value of the previous most significant bit. As a result,\n // the mask will either be `bytes32(0)` (if n is positive) or `~bytes32(0)` (if n is negative).\n int256 mask = n >> 255;\n\n // A `bytes32(0)` mask leaves the input unchanged, while a `~bytes32(0)` mask complements it.\n return uint256((n + mask) ^ mask);\n }\n }\n}\n" + }, + "fixtures/instantiate_tokens.sol": { + "content": "// SPDX-License-Identifier: MIT\n// Compatible with OpenZeppelin Contracts ^5.0.0\npragma solidity ^0.8.22;\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol\";\ncontract MyToken is ERC20, ERC20Permit {\n constructor(string memory name, string memory symbol)\n ERC20(name, symbol)\n ERC20Permit(symbol)\n {\n _mint(msg.sender, 100 * 10 ** decimals());\n }\n}\ncontract TokensFactory {\n constructor() {\n MyToken t1 = new MyToken(\"token_1\", \"T1\");\n MyToken t2 = new MyToken(\"token_2\", \"T2\");\n MyToken t3 = new MyToken(\"token_3\", \"T3\");\n MyToken t4 = new MyToken(\"token_4\", \"T4\");\n MyToken t5 = new MyToken(\"token_5\", \"T5\");\n }\n}" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi" + ] + } + } + } +} diff --git a/js/tests/node.test.mjs b/js/tests/node.test.mjs index ec93a35..2ea3a73 100644 --- a/js/tests/node.test.mjs +++ b/js/tests/node.test.mjs @@ -57,6 +57,27 @@ describe("Compile Function Tests", function () { output.contracts["fixtures/token.sol"].MyToken.evm, ).to.have.property("bytecode"); }); + + it("should successfully compile a valid Solidity contract that instantiates the token contracts", async function () { + const standardInput = loadFixture("instantiate_tokens.json"); + + const result = await compile(standardInput); + expect(result).to.be.a("string"); + const output = JSON.parse(result); + expect(output).to.have.property("contracts"); + expect(output.contracts["fixtures/instantiate_tokens.sol"]).to.have.property( + "TokensFactory", + ); + expect(output.contracts["fixtures/instantiate_tokens.sol"].TokensFactory).to.have.property( + "abi", + ); + expect(output.contracts["fixtures/instantiate_tokens.sol"].TokensFactory).to.have.property( + "evm", + ); + expect( + output.contracts["fixtures/instantiate_tokens.sol"].TokensFactory.evm, + ).to.have.property("bytecode"); + }); } it("should throw an error for invalid Solidity code", async function () { @@ -85,4 +106,38 @@ describe("Compile Function Tests", function () { 'Source "nonexistent/console.sol" not found', ); }); + + it("should successfully compile a valid Solidity contract that instantiates another contract", async function () { + const standardInput = loadFixture("instantiate.json"); + + const result = await compile(standardInput); + expect(result).to.be.a("string"); + const output = JSON.parse(result); + expect(output).to.have.property("contracts"); + expect(output.contracts["fixtures/instantiate.sol"]).to.have.property( + "ChildContract", + ); + expect(output.contracts["fixtures/instantiate.sol"].ChildContract).to.have.property( + "abi", + ); + expect(output.contracts["fixtures/instantiate.sol"].ChildContract).to.have.property( + "evm", + ); + expect( + output.contracts["fixtures/instantiate.sol"].ChildContract.evm, + ).to.have.property("bytecode"); + expect(output.contracts["fixtures/instantiate.sol"]).to.have.property( + "MainContract", + ); + expect(output.contracts["fixtures/instantiate.sol"].MainContract).to.have.property( + "abi", + ); + expect(output.contracts["fixtures/instantiate.sol"].MainContract).to.have.property( + "evm", + ); + expect( + output.contracts["fixtures/instantiate.sol"].MainContract.evm, + ).to.have.property("bytecode"); + }); + });