diff --git a/.github/workflows/scheduled.yaml b/.github/workflows/scheduled.yaml new file mode 100644 index 00000000..ba0a66e9 --- /dev/null +++ b/.github/workflows/scheduled.yaml @@ -0,0 +1,79 @@ +name: Scheduled + +# This workflow is triggered by a schedule or manually +# It allows to run integration tests +# for all supported platforms by user's choice + +on: + schedule: + - cron: '0 0 * * 0' # every week + workflow_dispatch: + inputs: + run_macos_amd64: + description: "Run MacOS amd64?" + required: false + type: boolean + default: true + run_macos_arm64: + description: "Run MacOS arm64?" + required: false + type: boolean + default: true + run_linux_amd64: + description: "Run Linux amd64?" + required: false + type: boolean + default: true + run_linux_arm64: + description: "Run Linux arm64?" + required: false + type: boolean + default: true + run_windows_amd64: + description: "Run Windows amd64?" + required: false + type: boolean + default: true + + +jobs: + + prepare-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.prepare-matrix.outputs.matrix }} + steps: + - name: Prepare matrix + id: prepare-matrix + run: | + # Define general matrix parameters + # Windows is not supported yet on era-compiler-tester side + WINDOWS='{"name":"Windows-x86","runner":"windows-2019-github-hosted-64core"}' + MACOS_AMD64='{"name":"MacOS-x86","runner":"macos-12-large"}' + MACOS_ARM64='{"name":"MacOS-arm64","runner":["self-hosted","macOS","ARM64"]}' + LINUX_AMD64='{"name":"Linux-AMD64","runner":"matterlabs-ci-runner-high-performance","image":"ghcr.io/matter-labs/zksync-llvm-runner:latest"}' + LINUX_ARM64='{"name":"Linux-ARM64","runner":"matterlabs-ci-runner-arm","image":"ghcr.io/matter-labs/zksync-llvm-runner:latest"}' + # Disable platforms for non-tag builds if user requested + if [ ${GITHUB_EVENT_NAME} = workflow_dispatch ]; then + [ ${{ github.event.inputs.run_windows_amd64 }} != true ] && WINDOWS= + [ ${{ github.event.inputs.run_macos_amd64 }} != true ] && MACOS_AMD64= + [ ${{ github.event.inputs.run_macos_arm64 }} != true ] && MACOS_ARM64= + [ ${{ github.event.inputs.run_linux_amd64 }} != true ] && LINUX_AMD64= + [ ${{ github.event.inputs.run_linux_arm64 }} != true ] && LINUX_ARM64= + fi + PLATFORMS=(${WINDOWS} ${MACOS_AMD64} ${MACOS_ARM64} ${LINUX_AMD64} ${LINUX_ARM64}) + echo "matrix={ \"include\": [ $(IFS=, ; echo "${PLATFORMS[*]}") ] }" | tee -a "${GITHUB_OUTPUT}" + + + integration-tests: + needs: prepare-matrix + uses: matter-labs/era-compiler-ci/.github/workflows/integration-tests.yaml@v1 + secrets: inherit + strategy: + fail-fast: false + matrix: + target: [ 'eravm' ] + with: + ccache-key-type: 'static' # rotate ccache key every month + target-machine: ${{ matrix.target }} + platforms-matrix: ${{ needs.prepare-matrix.outputs.matrix }} diff --git a/Cargo.lock b/Cargo.lock index e2781d99..068057f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -83,9 +83,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.18" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "788bb18e8f61d5d9340b52143f27771daf7e1dccbaf2741621d2493f9debf52e" +checksum = "ec878088ec6283ce1e90d280316aadd3d6ce3de06ff63d68953c855e7e447e92" dependencies = [ "alloy-rlp", "bytes", @@ -109,9 +109,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f542548a609dca89fcd72b3b9f355928cf844d4363c5eed9c5273a3dd225e097" +checksum = "3d6c1d995bff8d011f7cd6c81820d51825e6e06d6db73914c1630ecf544d83d6" dependencies = [ "alloy-rlp-derive", "arrayvec 0.7.6", @@ -120,13 +120,13 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a833d97bf8a5f0f878daf2c8451fff7de7f9de38baa5a45d936ec718d81255a" +checksum = "a40e1ef334153322fd878d07e86af7a529bcb86b2439525920a88eba87bcf943" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -185,11 +185,12 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", + "once_cell", "windows-sys 0.59.0", ] @@ -353,13 +354,13 @@ dependencies = [ [[package]] name = "auto_impl" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" +checksum = "e12882f59de5360c748c4cbf569a042d5fb0eb515f7bea9c1f470b47f6ffbd73" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -465,9 +466,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" dependencies = [ "serde", ] @@ -599,9 +600,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.7" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" dependencies = [ "shlex", ] @@ -675,7 +676,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -874,15 +875,15 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +checksum = "0e60eed09d8c01d3cee5b7d30acb059b76614c918fa0f992e0dd6eeb10daad6f" [[package]] name = "data-encoding-macro" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1559b6cba622276d6d63706db152618eeb15b89b3e4041446b05876e352e639" +checksum = "5b16d9d0d88a5273d830dac8b78ceb217ffc9b1d5404e5597a3542515329405b" dependencies = [ "data-encoding", "data-encoding-macro-internal", @@ -890,12 +891,12 @@ dependencies = [ [[package]] name = "data-encoding-macro-internal" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "332d754c0af53bc87c108fed664d121ecf59207ec4196041f04d6ab9002ad33f" +checksum = "1145d32e826a7748b69ee8fc62d3e6355ff7f1051df53141e7048162fc90481b" dependencies = [ "data-encoding", - "syn 1.0.109", + "syn 2.0.96", ] [[package]] @@ -930,7 +931,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.1", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -950,7 +951,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", "unicode-xid", ] @@ -983,7 +984,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -1050,7 +1051,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -1061,7 +1062,7 @@ checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -1116,8 +1117,8 @@ dependencies = [ [[package]] name = "era-compiler-solidity" -version = "1.5.9" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#2333c0e275e4a83f494990ae3ce7484c643a908d" +version = "1.5.10" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#8eceeacecd12b7e87c2662a3ba0501b36d05f894" dependencies = [ "anyhow", "clap", @@ -1167,8 +1168,8 @@ dependencies = [ [[package]] name = "era-solc" -version = "1.5.9" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#2333c0e275e4a83f494990ae3ce7484c643a908d" +version = "1.5.10" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#8eceeacecd12b7e87c2662a3ba0501b36d05f894" dependencies = [ "anyhow", "boolinator", @@ -1184,8 +1185,8 @@ dependencies = [ [[package]] name = "era-yul" -version = "1.5.9" -source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#2333c0e275e4a83f494990ae3ce7484c643a908d" +version = "1.5.10" +source = "git+https://github.com/matter-labs/era-compiler-solidity?branch=main#8eceeacecd12b7e87c2662a3ba0501b36d05f894" dependencies = [ "anyhow", "regex", @@ -1431,7 +1432,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -1887,7 +1888,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -1946,14 +1947,14 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] name = "indexmap" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", "hashbrown 0.15.2", @@ -1981,7 +1982,7 @@ source = "git+https://github.com/matter-labs-forks/inkwell?branch=llvm-17#c5d783 dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -2009,9 +2010,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] name = "is_terminal_polyfill" @@ -2045,9 +2046,9 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", @@ -2138,7 +2139,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.8.0", "libc", "redox_syscall", ] @@ -2180,9 +2181,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] name = "md5" @@ -2213,9 +2214,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" +checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924" dependencies = [ "adler2", ] @@ -2385,7 +2386,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -2415,7 +2416,7 @@ version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.8.0", "cfg-if", "foreign-types", "libc", @@ -2432,7 +2433,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -2558,7 +2559,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 2.0.10", + "thiserror 2.0.11", "ucd-trie", ] @@ -2579,7 +2580,7 @@ checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -2662,9 +2663,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] @@ -2677,7 +2678,7 @@ checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.6.0", + "bitflags 2.8.0", "lazy_static", "num-traits", "rand", @@ -2726,7 +2727,7 @@ dependencies = [ "rustc-hash", "rustls", "socket2", - "thiserror 2.0.10", + "thiserror 2.0.11", "tokio", "tracing", ] @@ -2745,7 +2746,7 @@ dependencies = [ "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.10", + "thiserror 2.0.11", "tinyvec", "tracing", "web-time", @@ -2845,7 +2846,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.8.0", ] [[package]] @@ -3015,7 +3016,7 @@ dependencies = [ "alloy-eips", "alloy-primitives", "auto_impl", - "bitflags 2.6.0", + "bitflags 2.8.0", "bitvec", "c-kzg", "cfg-if", @@ -3077,7 +3078,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ "base64 0.21.7", - "bitflags 2.6.0", + "bitflags 2.8.0", "serde", "serde_derive", ] @@ -3156,7 +3157,7 @@ version = "0.38.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.8.0", "errno", "libc", "linux-raw-sys", @@ -3165,9 +3166,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.20" +version = "0.23.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" +checksum = "8f287924602bf649d949c63dc8ac8b235fa5387d394020705b80c4eb597ce5b8" dependencies = [ "once_cell", "ring", @@ -3215,6 +3216,12 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustversion" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" + [[package]] name = "rusty-fork" version = "0.3.0" @@ -3267,7 +3274,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -3342,7 +3349,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.8.0", "core-foundation", "core-foundation-sys", "libc", @@ -3412,7 +3419,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -3668,9 +3675,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.95" +version = "2.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a" +checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" dependencies = [ "proc-macro2", "quote", @@ -3700,7 +3707,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -3755,11 +3762,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ac7f54ca534db81081ef1c1e7f6ea8a3ef428d2fc069097c079443d24124d3" +checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" dependencies = [ - "thiserror-impl 2.0.10", + "thiserror-impl 2.0.11", ] [[package]] @@ -3770,18 +3777,18 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] name = "thiserror-impl" -version = "2.0.10" +version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e9465d30713b56a37ede7185763c3492a91be2f5fa68d958c44e41ab9248beb" +checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -3900,7 +3907,7 @@ checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "toml_datetime", - "winnow 0.6.22", + "winnow 0.6.24", ] [[package]] @@ -3949,7 +3956,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -4064,9 +4071,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "valuable" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "vcpkg" @@ -4112,34 +4119,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.49" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", @@ -4150,9 +4158,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4160,28 +4168,31 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.99" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "web-sys" -version = "0.3.76" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", @@ -4445,9 +4456,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.22" +version = "0.6.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" +checksum = "c8d71a593cc5c42ad7876e2c1fda56f314f3754c084128833e64f1345ff8a03a" dependencies = [ "memchr", ] @@ -4509,7 +4520,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", "synstructure", ] @@ -4531,7 +4542,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -4551,7 +4562,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", "synstructure", ] @@ -4572,7 +4583,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -4594,7 +4605,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.95", + "syn 2.0.96", ] [[package]] @@ -4631,7 +4642,7 @@ version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "762b5f1c1b283c5388995a85d40a05aef1c14f50eb904998b7e9364739f5b899" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.8.0", "blake2", "ethereum-types", "k256", diff --git a/compiler_tester/src/compilers/solidity/mod.rs b/compiler_tester/src/compilers/solidity/mod.rs index 38a5af88..6db0b4a9 100644 --- a/compiler_tester/src/compilers/solidity/mod.rs +++ b/compiler_tester/src/compilers/solidity/mod.rs @@ -212,11 +212,8 @@ impl SolidityCompiler { output_selection, era_solc::StandardJsonInputMetadata::default(), vec![], - vec![ - era_solc::StandardJsonInputErrorType::SendTransfer, - era_solc::StandardJsonInputErrorType::AssemblyCreate, - ], - vec![], + vec![era_solc::StandardJsonInputErrorType::SendTransfer], + vec![era_solc::StandardJsonInputWarningType::AssemblyCreate], false, mode.via_ir, ) diff --git a/compiler_tester/src/directories/matter_labs/mod.rs b/compiler_tester/src/directories/matter_labs/mod.rs index 6d3e5479..0afee5e8 100644 --- a/compiler_tester/src/directories/matter_labs/mod.rs +++ b/compiler_tester/src/directories/matter_labs/mod.rs @@ -36,36 +36,29 @@ impl Collection for MatterLabsDirectory { let entry = entry?; let path = entry.path(); let entry_type = entry.file_type().map_err(|error| { - anyhow::anyhow!( - "Failed to get the type of file `{}`: {}", - path.to_string_lossy(), - error - ) + anyhow::anyhow!("Failed to get the type of file {path:?}: {error}") })?; if entry_type.is_dir() { tests.extend(Self::read_all( _target, - &path, + path.as_path(), extension, summary.clone(), filters, )?); continue; } else if !entry_type.is_file() { - anyhow::bail!("Invalid type of file `{}`", path.to_string_lossy()); + anyhow::bail!("Invalid type of file {path:?}"); } if entry.file_name().to_string_lossy().starts_with('.') { continue; } - let file_extension = path.extension().ok_or_else(|| { - anyhow::anyhow!( - "Failed to get the extension of file `{}`", - path.to_string_lossy() - ) - })?; + let file_extension = path + .extension() + .ok_or_else(|| anyhow::anyhow!("Failed to get the extension of file {path:?}"))?; if file_extension != extension { continue; } diff --git a/compiler_tester/src/lib.rs b/compiler_tester/src/lib.rs index ff5c2a57..caca803a 100644 --- a/compiler_tester/src/lib.rs +++ b/compiler_tester/src/lib.rs @@ -18,7 +18,7 @@ pub(crate) mod utils; pub(crate) mod vm; pub(crate) mod workflow; -use std::path::Path; +use std::path::PathBuf; use std::sync::Arc; use std::sync::Mutex; @@ -281,7 +281,7 @@ impl CompilerTester { tests.extend(self.directory::( target, - Self::SOLIDITY_SIMPLE, + PathBuf::from(Self::SOLIDITY_SIMPLE.replace("/", std::path::MAIN_SEPARATOR_STR)), era_compiler_common::EXTENSION_SOLIDITY, match toolchain { Toolchain::IrLLVM => solidity_compiler.clone(), @@ -291,14 +291,14 @@ impl CompilerTester { if let era_compiler_common::Target::EraVM = target { tests.extend(self.directory::( target, - Self::VYPER_SIMPLE, + PathBuf::from(Self::VYPER_SIMPLE.replace("/", std::path::MAIN_SEPARATOR_STR)), era_compiler_common::EXTENSION_VYPER, vyper_compiler.clone(), )?); } tests.extend(self.directory::( target, - Self::YUL_SIMPLE, + PathBuf::from(Self::YUL_SIMPLE.replace("/", std::path::MAIN_SEPARATOR_STR)), era_compiler_common::EXTENSION_YUL, match toolchain { Toolchain::IrLLVM => yul_compiler.clone(), @@ -307,20 +307,20 @@ impl CompilerTester { )?); tests.extend(self.directory::( target, - Self::LLVM_SIMPLE, + PathBuf::from(Self::LLVM_SIMPLE.replace("/", std::path::MAIN_SEPARATOR_STR)), era_compiler_common::EXTENSION_LLVM_SOURCE, llvm_compiler, )?); tests.extend(self.directory::( target, - Self::ERAVM_SIMPLE, + PathBuf::from(Self::ERAVM_SIMPLE.replace("/", std::path::MAIN_SEPARATOR_STR)), era_compiler_common::EXTENSION_ERAVM_ASSEMBLY, eravm_compiler, )?); tests.extend(self.directory::( target, - Self::SOLIDITY_COMPLEX, + PathBuf::from(Self::SOLIDITY_COMPLEX.replace("/", std::path::MAIN_SEPARATOR_STR)), era_compiler_common::EXTENSION_JSON, match toolchain { Toolchain::IrLLVM => solidity_compiler.clone(), @@ -330,28 +330,33 @@ impl CompilerTester { if let era_compiler_common::Target::EraVM = target { tests.extend(self.directory::( target, - Self::VYPER_COMPLEX, + PathBuf::from(Self::VYPER_COMPLEX.replace("/", std::path::MAIN_SEPARATOR_STR)), era_compiler_common::EXTENSION_JSON, vyper_compiler.clone(), )?); } - tests.extend(self.directory::( - target, - match target { - era_compiler_common::Target::EraVM => Self::SOLIDITY_ETHEREUM, - era_compiler_common::Target::EVM => Self::SOLIDITY_ETHEREUM_UPSTREAM, - }, - era_compiler_common::EXTENSION_SOLIDITY, - match toolchain { - Toolchain::IrLLVM => solidity_compiler.clone(), - Toolchain::Solc | Toolchain::SolcLLVM => solidity_upstream_compiler.clone(), - }, - )?); + tests.extend( + self.directory::( + target, + PathBuf::from( + match target { + era_compiler_common::Target::EraVM => Self::SOLIDITY_ETHEREUM, + era_compiler_common::Target::EVM => Self::SOLIDITY_ETHEREUM_UPSTREAM, + } + .replace("/", std::path::MAIN_SEPARATOR_STR), + ), + era_compiler_common::EXTENSION_SOLIDITY, + match toolchain { + Toolchain::IrLLVM => solidity_compiler.clone(), + Toolchain::Solc | Toolchain::SolcLLVM => solidity_upstream_compiler.clone(), + }, + )?, + ); if let era_compiler_common::Target::EraVM = target { tests.extend(self.directory::( target, - Self::VYPER_ETHEREUM, + PathBuf::from(Self::VYPER_ETHEREUM.replace("/", std::path::MAIN_SEPARATOR_STR)), era_compiler_common::EXTENSION_VYPER, vyper_compiler, )?); @@ -366,7 +371,7 @@ impl CompilerTester { fn directory( &self, target: era_compiler_common::Target, - path: &str, + path: PathBuf, extension: &'static str, compiler: Arc, ) -> anyhow::Result> @@ -375,12 +380,12 @@ impl CompilerTester { { Ok(T::read_all( target, - Path::new(path), + path.as_path(), extension, self.summary.clone(), &self.filters, ) - .map_err(|error| anyhow::anyhow!("Failed to read the tests directory `{path}`: {error}"))? + .map_err(|error| anyhow::anyhow!("Failed to read the tests directory {path:?}: {error}"))? .into_iter() .map(|test| Arc::new(test) as Arc) .cartesian_product(compiler.all_modes()) diff --git a/compiler_tester/src/vm/eravm/system_contracts.rs b/compiler_tester/src/vm/eravm/system_contracts.rs index faf0c818..88aa8130 100644 --- a/compiler_tester/src/vm/eravm/system_contracts.rs +++ b/compiler_tester/src/vm/eravm/system_contracts.rs @@ -5,7 +5,6 @@ use std::collections::HashMap; use std::fs::File; use std::path::PathBuf; -use std::str::FromStr; use std::time::Instant; use colored::Colorize; @@ -36,12 +35,16 @@ pub struct SystemContracts { impl SystemContracts { /// The empty contract implementation path. - const PATH_EMPTY_CONTRACT: &'static str = - "era-contracts/system-contracts/contracts/EmptyContract.sol:EmptyContract"; + const PATH_EMPTY_CONTRACT: (&'static str, &'static str) = ( + "era-contracts/system-contracts/contracts/EmptyContract.sol", + "EmptyContract", + ); /// The default account abstraction contract implementation path. - const PATH_DEFAULT_AA: &'static str = - "era-contracts/system-contracts/contracts/DefaultAccount.sol:DefaultAccount"; + const PATH_DEFAULT_AA: (&'static str, &'static str) = ( + "era-contracts/system-contracts/contracts/DefaultAccount.sol", + "DefaultAccount", + ); /// The EVM emulator system contract implementation path. const PATH_EVM_EMULATOR: &'static str = @@ -60,7 +63,8 @@ impl SystemContracts { "era-contracts/system-contracts/contracts/precompiles/SHA256.yul"; /// The `identity` system contract implementation path. - const PATH_IDENTITY: &'static str = "tests/solidity/simple/system/identity.sol:Identity"; + const PATH_IDENTITY: (&'static str, &'static str) = + ("tests/solidity/simple/system/identity.sol", "Identity"); /// The `ecadd` system contract implementation path. const PATH_ECADD: &'static str = @@ -71,36 +75,52 @@ impl SystemContracts { "era-contracts/system-contracts/contracts/precompiles/EcMul.yul"; /// The account code storage system contract implementation path. - const PATH_ACCOUNT_CODE_STORAGE: &'static str = - "era-contracts/system-contracts/contracts/AccountCodeStorage.sol:AccountCodeStorage"; + const PATH_ACCOUNT_CODE_STORAGE: (&'static str, &'static str) = ( + "era-contracts/system-contracts/contracts/AccountCodeStorage.sol", + "AccountCodeStorage", + ); /// The contract deployer system contract implementation path. - const PATH_CONTRACT_DEPLOYER: &'static str = - "era-contracts/system-contracts/contracts/ContractDeployer.sol:ContractDeployer"; + const PATH_CONTRACT_DEPLOYER: (&'static str, &'static str) = ( + "era-contracts/system-contracts/contracts/ContractDeployer.sol", + "ContractDeployer", + ); /// The nonce holder system contract implementation path. - const PATH_NONCE_HOLDER: &'static str = - "era-contracts/system-contracts/contracts/NonceHolder.sol:NonceHolder"; + const PATH_NONCE_HOLDER: (&'static str, &'static str) = ( + "era-contracts/system-contracts/contracts/NonceHolder.sol", + "NonceHolder", + ); /// The knows codes storage system contract implementation path. - const PATH_KNOWN_CODES_STORAGE: &'static str = - "era-contracts/system-contracts/contracts/KnownCodesStorage.sol:KnownCodesStorage"; + const PATH_KNOWN_CODES_STORAGE: (&'static str, &'static str) = ( + "era-contracts/system-contracts/contracts/KnownCodesStorage.sol", + "KnownCodesStorage", + ); /// The immutable simulator system contract implementation path. - const PATH_IMMUTABLE_SIMULATOR: &'static str = - "era-contracts/system-contracts/contracts/ImmutableSimulator.sol:ImmutableSimulator"; + const PATH_IMMUTABLE_SIMULATOR: (&'static str, &'static str) = ( + "era-contracts/system-contracts/contracts/ImmutableSimulator.sol", + "ImmutableSimulator", + ); /// The L1-messenger system contract implementation path. - const PATH_L1_MESSENGER: &'static str = - "era-contracts/system-contracts/contracts/L1Messenger.sol:L1Messenger"; + const PATH_L1_MESSENGER: (&'static str, &'static str) = ( + "era-contracts/system-contracts/contracts/L1Messenger.sol", + "L1Messenger", + ); /// The `msg.value` simulator system contract implementation path. - const PATH_MSG_VALUE_SIMULATOR: &'static str = - "era-contracts/system-contracts/contracts/MsgValueSimulator.sol:MsgValueSimulator"; + const PATH_MSG_VALUE_SIMULATOR: (&'static str, &'static str) = ( + "era-contracts/system-contracts/contracts/MsgValueSimulator.sol", + "MsgValueSimulator", + ); /// The system context system contract implementation path. - const PATH_SYSTEM_CONTEXT: &'static str = - "era-contracts/system-contracts/contracts/SystemContext.sol:SystemContext"; + const PATH_SYSTEM_CONTEXT: (&'static str, &'static str) = ( + "era-contracts/system-contracts/contracts/SystemContext.sol", + "SystemContext", + ); /// The event writer system contract implementation path. const PATH_EVENT_WRITER: &'static str = @@ -111,8 +131,10 @@ impl SystemContracts { "era-contracts/system-contracts/contracts/precompiles/CodeOracle.yul"; /// The base token system contract implementation path. - const PATH_BASE_TOKEN: &'static str = - "era-contracts/system-contracts/contracts/L2BaseToken.sol:L2BaseToken"; + const PATH_BASE_TOKEN: (&'static str, &'static str) = ( + "era-contracts/system-contracts/contracts/L2BaseToken.sol", + "L2BaseToken", + ); /// The EVM gas manager system contract implementation path. const PATH_EVM_GAS_MANAGER: &'static str = @@ -157,107 +179,131 @@ impl SystemContracts { let yul_system_contracts = [ ( web3::types::Address::from_low_u64_be(zkevm_opcode_defs::ADDRESS_KECCAK256.into()), - Self::PATH_KECCAK256, + Self::PATH_KECCAK256.to_owned(), ), ( web3::types::Address::from_low_u64_be(zkevm_opcode_defs::ADDRESS_ECRECOVER.into()), - Self::PATH_ECRECOVER, + Self::PATH_ECRECOVER.to_owned(), ), ( web3::types::Address::from_low_u64_be(zkevm_opcode_defs::ADDRESS_SHA256.into()), - Self::PATH_SHA256, + Self::PATH_SHA256.to_owned(), ), ( web3::types::Address::from_low_u64_be( zkevm_opcode_defs::system_params::ADDRESS_ECADD.into(), ), - Self::PATH_ECADD, + Self::PATH_ECADD.to_owned(), ), ( web3::types::Address::from_low_u64_be( zkevm_opcode_defs::system_params::ADDRESS_ECMUL.into(), ), - Self::PATH_ECMUL, + Self::PATH_ECMUL.to_owned(), ), ( web3::types::Address::from_low_u64_be( zkevm_opcode_defs::ADDRESS_EVENT_WRITER.into(), ), - Self::PATH_EVENT_WRITER, + Self::PATH_EVENT_WRITER.to_owned(), ), ( web3::types::Address::from_low_u64_be(0x8012), - Self::PATH_CODE_ORACLE, + Self::PATH_CODE_ORACLE.to_owned(), ), ( web3::types::Address::from_low_u64_be(ADDRESS_EVM_GAS_MANAGER.into()), - Self::PATH_EVM_GAS_MANAGER, + Self::PATH_EVM_GAS_MANAGER.to_owned(), ), ]; let solidity_system_contracts = vec![ - (web3::types::Address::zero(), Self::PATH_EMPTY_CONTRACT), + ( + web3::types::Address::zero(), + Self::normalize_name_fs( + Self::PATH_EMPTY_CONTRACT.0, + Some(Self::PATH_EMPTY_CONTRACT.1), + ), + ), ( web3::types::Address::from_low_u64_be(zkevm_opcode_defs::ADDRESS_IDENTITY.into()), - Self::PATH_IDENTITY, + Self::normalize_name_fs(Self::PATH_IDENTITY.0, Some(Self::PATH_IDENTITY.1)), ), ( web3::types::Address::from_low_u64_be( zkevm_opcode_defs::ADDRESS_ACCOUNT_CODE_STORAGE.into(), ), - Self::PATH_ACCOUNT_CODE_STORAGE, + Self::normalize_name_fs( + Self::PATH_ACCOUNT_CODE_STORAGE.0, + Some(Self::PATH_ACCOUNT_CODE_STORAGE.1), + ), ), ( web3::types::Address::from_low_u64_be( zkevm_opcode_defs::ADDRESS_NONCE_HOLDER.into(), ), - Self::PATH_NONCE_HOLDER, + Self::normalize_name_fs(Self::PATH_NONCE_HOLDER.0, Some(Self::PATH_NONCE_HOLDER.1)), ), ( web3::types::Address::from_low_u64_be( zkevm_opcode_defs::ADDRESS_KNOWN_CODES_STORAGE.into(), ), - Self::PATH_KNOWN_CODES_STORAGE, + Self::normalize_name_fs( + Self::PATH_KNOWN_CODES_STORAGE.0, + Some(Self::PATH_KNOWN_CODES_STORAGE.1), + ), ), ( web3::types::Address::from_low_u64_be( zkevm_opcode_defs::ADDRESS_IMMUTABLE_SIMULATOR.into(), ), - Self::PATH_IMMUTABLE_SIMULATOR, + Self::normalize_name_fs( + Self::PATH_IMMUTABLE_SIMULATOR.0, + Some(Self::PATH_IMMUTABLE_SIMULATOR.1), + ), ), ( web3::types::Address::from_low_u64_be( zkevm_opcode_defs::ADDRESS_CONTRACT_DEPLOYER.into(), ), - Self::PATH_CONTRACT_DEPLOYER, + Self::normalize_name_fs( + Self::PATH_CONTRACT_DEPLOYER.0, + Some(Self::PATH_CONTRACT_DEPLOYER.1), + ), ), ( web3::types::Address::from_low_u64_be( zkevm_opcode_defs::ADDRESS_L1_MESSENGER.into(), ), - Self::PATH_L1_MESSENGER, + Self::normalize_name_fs(Self::PATH_L1_MESSENGER.0, Some(Self::PATH_L1_MESSENGER.1)), ), ( web3::types::Address::from_low_u64_be(zkevm_opcode_defs::ADDRESS_MSG_VALUE.into()), - Self::PATH_MSG_VALUE_SIMULATOR, + Self::normalize_name_fs( + Self::PATH_MSG_VALUE_SIMULATOR.0, + Some(Self::PATH_MSG_VALUE_SIMULATOR.1), + ), ), ( web3::types::Address::from_low_u64_be( zkevm_opcode_defs::ADDRESS_SYSTEM_CONTEXT.into(), ), - Self::PATH_SYSTEM_CONTEXT, + Self::normalize_name_fs( + Self::PATH_SYSTEM_CONTEXT.0, + Some(Self::PATH_SYSTEM_CONTEXT.1), + ), ), ( web3::types::Address::from_low_u64_be(zkevm_opcode_defs::ADDRESS_ETH_TOKEN.into()), - Self::PATH_BASE_TOKEN, + Self::normalize_name_fs(Self::PATH_BASE_TOKEN.0, Some(Self::PATH_BASE_TOKEN.1)), ), ]; let mut yul_file_paths = Vec::with_capacity(yul_system_contracts.len() + 1); - for (_, path) in yul_system_contracts.into_iter() { - yul_file_paths.push(path.to_owned()); + for (_, path) in yul_system_contracts.iter() { + yul_file_paths.push(PathBuf::from(path)); } - yul_file_paths.push(Self::PATH_EVM_EMULATOR.to_owned()); + yul_file_paths.push(PathBuf::from(Self::PATH_EVM_EMULATOR)); let yul_optimizer_settings = era_compiler_llvm_context::OptimizerSettings::cycles(); let yul_mode = YulMode::new(yul_optimizer_settings, true).into(); let yul_llvm_options = vec![ @@ -289,9 +335,12 @@ impl SystemContracts { "era-contracts/system-contracts/contracts/interfaces/**/*.sol", "era-contracts/system-contracts/contracts/openzeppelin/**/*.sol", "tests/solidity/complex/interpreter/*.sol", - ] { - for path in glob::glob(pattern)?.filter_map(Result::ok) { - let path = path.to_string_lossy().to_string(); + ] + .into_iter() + .map(PathBuf::from) + { + for path in glob::glob(pattern.to_str().expect("Always valid"))?.filter_map(Result::ok) + { if !solidity_file_paths.contains(&path) { solidity_file_paths.push(path); } @@ -317,12 +366,19 @@ impl SystemContracts { debug_config, )?); - let default_aa = builds.remove(Self::PATH_DEFAULT_AA).ok_or_else(|| { - anyhow::anyhow!("The default AA code not found in the compiler build artifacts") - })?; - let evm_emulator = builds.remove(Self::PATH_EVM_EMULATOR).ok_or_else(|| { - anyhow::anyhow!("The EVM emulator code not found in the compiler build artifacts") - })?; + let default_aa = builds + .remove( + Self::normalize_name_solc(Self::PATH_DEFAULT_AA.0, Some(Self::PATH_DEFAULT_AA.1)) + .as_str(), + ) + .ok_or_else(|| { + anyhow::anyhow!("The default AA code not found in the compiler build artifacts") + })?; + let evm_emulator = builds + .remove(Self::normalize_name_solc(Self::PATH_EVM_EMULATOR, None).as_str()) + .ok_or_else(|| { + anyhow::anyhow!("The EVM emulator code not found in the compiler build artifacts") + })?; let mut system_contracts = Vec::with_capacity(solidity_system_contracts.len() + yul_system_contracts.len()); @@ -332,7 +388,7 @@ impl SystemContracts { let mut deployed_contracts = Vec::with_capacity(system_contracts.len()); for (address, path) in system_contracts.into_iter() { let build = builds - .remove(path) + .remove(Self::normalize_name_solc(path.as_str(), None).as_str()) .unwrap_or_else(|| panic!("System contract `{path}` not found in the builds")); deployed_contracts.push((address, build)); } @@ -359,9 +415,7 @@ impl SystemContracts { let system_contracts: SystemContracts = bincode::deserialize_from(system_contracts_file) .map_err(|error| { anyhow::anyhow!( - "System contract {:?} deserialization: {}", - system_contracts_path, - error + "System contract {system_contracts_path:?} deserialization: {error}" ) })?; println!( @@ -378,11 +432,7 @@ impl SystemContracts { fn save(&self, system_contracts_path: PathBuf) -> anyhow::Result<()> { let system_contracts_file = File::create(system_contracts_path.as_path())?; bincode::serialize_into(system_contracts_file, self).map_err(|error| { - anyhow::anyhow!( - "System contracts {:?} serialization: {}", - system_contracts_path, - error - ) + anyhow::anyhow!("System contracts {system_contracts_path:?} serialization: {error}") })?; println!( @@ -393,12 +443,34 @@ impl SystemContracts { Ok(()) } + /// + /// Normalizes contract names with respect to the file system. + /// + fn normalize_name_fs(path: &str, name: Option<&str>) -> String { + let contract_name = era_compiler_common::ContractName::new( + path.replace("/", std::path::MAIN_SEPARATOR_STR), + name.map(|name| name.to_string()), + ); + contract_name.full_path + } + + /// + /// Normalizes contract names with respect to `solc`. + /// + fn normalize_name_solc(path: &str, name: Option<&str>) -> String { + let contract_name = era_compiler_common::ContractName::new( + path.replace(std::path::MAIN_SEPARATOR_STR, "/"), + name.map(|name| name.to_string()), + ); + contract_name.full_path + } + /// /// Compiles the system contracts. /// fn compile( compiler: C, - paths: Vec, + paths: Vec, mode: &Mode, llvm_options: Vec, debug_config: Option, @@ -408,30 +480,19 @@ impl SystemContracts { { let mut sources = Vec::new(); for path in paths.into_iter() { - let file_path = if compiler.allows_multi_contract_files() { - path.split(':').next().expect("Always valid").to_string() - } else { - path - }; - - let mut source = std::fs::read_to_string( - PathBuf::from_str(file_path.as_str()) - .expect("Always valid") - .as_path(), - ) - .map_err(|error| { - anyhow::anyhow!( - "System contract file `{}` reading error: {}", - file_path, - error - ) + let mut source = std::fs::read_to_string(path.as_path()).map_err(|error| { + anyhow::anyhow!("System contract file {path:?} reading error: {error}",) })?; - if file_path == "era-contracts/system-contracts/contracts/Constants.sol" { + if path == PathBuf::from("era-contracts/system-contracts/contracts/Constants.sol") { source = source.replace("{{SYSTEM_CONTRACTS_OFFSET}}", "0x8000"); } - sources.push((file_path.to_string(), source)); + let path = path + .to_string_lossy() + .replace(std::path::MAIN_SEPARATOR_STR, "/"); + + sources.push((path, source)); } compiler diff --git a/configs/solc-bin-default.json b/configs/solc-bin-default.json index e07047a8..7c27387e 100644 --- a/configs/solc-bin-default.json +++ b/configs/solc-bin-default.json @@ -497,6 +497,7 @@ "linux-amd64": "linux-amd64", "linux-arm64": "linux-arm64", "macos-amd64": "macosx-amd64", - "macos-arm64": "macosx-arm64" + "macos-arm64": "macosx-arm64", + "windows-amd64": "windows-amd64" } } diff --git a/configs/solc-bin-system-contracts.json b/configs/solc-bin-system-contracts.json index ce5d3f44..5a02de3c 100644 --- a/configs/solc-bin-system-contracts.json +++ b/configs/solc-bin-system-contracts.json @@ -11,6 +11,7 @@ "linux-amd64": "linux-amd64", "linux-arm64": "linux-arm64", "macos-amd64": "macosx-amd64", - "macos-arm64": "macosx-arm64" + "macos-arm64": "macosx-arm64", + "windows-amd64": "windows-amd64" } } diff --git a/configs/solc-bin-upstream.json b/configs/solc-bin-upstream.json index df4e1bf6..84382a44 100644 --- a/configs/solc-bin-upstream.json +++ b/configs/solc-bin-upstream.json @@ -497,6 +497,7 @@ "linux-amd64": "linux-amd64", "linux-arm64": "linux-amd64", "macos-amd64": "macosx-amd64", - "macos-arm64": "macosx-amd64" + "macos-arm64": "macosx-arm64", + "windows-amd64": "windows-amd64" } } \ No newline at end of file diff --git a/configs/vyper-bin-default.json b/configs/vyper-bin-default.json index 8a9ca42c..5629a37a 100644 --- a/configs/vyper-bin-default.json +++ b/configs/vyper-bin-default.json @@ -29,6 +29,7 @@ "linux-amd64": "linux", "linux-arm64": "linux", "macos-amd64": "darwin", - "macos-arm64": "darwin" + "macos-arm64": "darwin", + "windows-amd64": "windows" } } diff --git a/solidity_adapter/src/lib.rs b/solidity_adapter/src/lib.rs index c19e079c..80d9da23 100644 --- a/solidity_adapter/src/lib.rs +++ b/solidity_adapter/src/lib.rs @@ -30,14 +30,18 @@ pub const DEFAULT_CONTRACT_ADDRESS: &str = "c06afe3a8444fc0004668591e8306bfb9968 /// The index of the account used as the default caller. pub const DEFAULT_ACCOUNT_INDEX: usize = 0; -/// /// First pre-generated account address. -/// const ZERO_ADDRESS: &str = "1212121212121212121212121212120000000012"; /// The caller address multiplier. const ADDRESS_INDEX_MULTIPLIER: usize = 4096; // 16^3 +/// The cross-platform new line character. +#[cfg(windows)] +const NEW_LINE: &str = "\r\n"; +#[cfg(not(windows))] +const NEW_LINE: &str = "\n"; + /// /// Returns address of pre-generated account by index. /// diff --git a/solidity_adapter/src/test/function_call/parser/lexical/stream/comment/tests.rs b/solidity_adapter/src/test/function_call/parser/lexical/stream/comment/tests.rs index b94ed95d..7b25741b 100644 --- a/solidity_adapter/src/test/function_call/parser/lexical/stream/comment/tests.rs +++ b/solidity_adapter/src/test/function_call/parser/lexical/stream/comment/tests.rs @@ -32,7 +32,10 @@ is the mega ultra test application! input.len(), 3, 1, - Comment::new(" This\nis the mega ultra test application!\n".to_owned()), + Comment::new(format!( + " This{0}is the mega ultra test application!{0}", + crate::NEW_LINE + )), )); let result = parse(input); assert_eq!(result, expected); diff --git a/solidity_adapter/src/test/mod.rs b/solidity_adapter/src/test/mod.rs index f20a5248..c7cc778b 100644 --- a/solidity_adapter/src/test/mod.rs +++ b/solidity_adapter/src/test/mod.rs @@ -32,12 +32,8 @@ impl TryFrom<&Path> for Test { type Error = anyhow::Error; fn try_from(path: &Path) -> Result { - let mut file = fs::File::open(path)?; - - let mut data = String::new(); - file.read_to_string(&mut data).map_err(|error| { - anyhow::anyhow!("Failed to read test file (1, {:?}): {}", file, error) - })?; + let data = std::fs::read_to_string(path) + .map_err(|error| anyhow::anyhow!("Failed to read test file {path:?}: {error}"))?; let comment_start = if path .extension() @@ -52,11 +48,11 @@ impl TryFrom<&Path> for Test { let sources = process_sources(&data, path)?; let (data, function_calls) = data - .split_once(&format!("{comment_start}----\n")) + .split_once(&format!("{comment_start}----{}", crate::NEW_LINE)) .ok_or_else(|| anyhow::anyhow!("Invalid test format"))?; let params = data - .split_once(&format!("{comment_start}====\n")) + .split_once(&format!("{comment_start}===={}", crate::NEW_LINE)) .map(|parts| parts.1) .unwrap_or_default(); @@ -65,7 +61,7 @@ impl TryFrom<&Path> for Test { .filter_map(|line| line.strip_prefix(&comment_start)) .map(|line| { let mut line = line.to_owned(); - line.push('\n'); + line.push_str(crate::NEW_LINE); line }) .collect::>() @@ -79,7 +75,7 @@ impl TryFrom<&Path> for Test { .filter_map(|line| line.strip_prefix(&comment_start)) .map(|line| { let mut line = line.to_owned(); - line.push('\n'); + line.push_str(crate::NEW_LINE); line }) .collect::>() @@ -112,7 +108,7 @@ fn process_sources(data: &str, path: &Path) -> anyhow::Result captures, None => { source.push_str(line); - source.push('\n'); + source.push_str(crate::NEW_LINE); continue; } };