diff --git a/.circleci/config.yml b/.circleci/config.yml index 8c81fd561..c10310c8f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -131,6 +131,7 @@ commands: --silent \ --fail \ --show-error \ + --header "Authorization: Bearer ${GITHUB_ACCESS_TOKEN}" \ "https://api.github.com/repos/${FOUNDRY_REPO}/git/refs/tags/${FOUNDRY_VERSION}" \ | jq --raw-output .object.sha \ ) @@ -570,6 +571,8 @@ defaults: # Parameterized Job Templates # Separate compile-only runs of those external tests where a full run takes much longer. + # Also see https://github.com/ethereum/solidity/pull/14234 for why we excluded those + # external tests from the nightly jobs. - job_ems_compile_ext_colony: &job_ems_compile_ext_colony <<: *requires_b_ems name: t_ems_compile_ext_colony @@ -684,15 +687,6 @@ defaults: binary_type: native image: cimg/node:18.11 - - job_ems_test_ext_colony: &job_ems_test_ext_colony - <<: *requires_b_ems - name: t_ems_test_ext_colony - project: colony - binary_type: solcjs - image: cimg/node:14.20 - resource_class: medium - python2: true - - job_b_ubu_asan_clang: &job_b_ubu_asan_clang <<: *on_all_tags_and_branches name: b_ubu_asan_clang @@ -1783,7 +1777,3 @@ workflows: - b_ubu_san_clang: *job_b_ubu_ubsan_clang - t_ubu_ubsan_clang_soltest: *requires_b_ubu_ubsan_clang - t_ubu_ubsan_clang_cli: *requires_b_ubu_ubsan_clang - - # Emscripten build and tests that take more than 15 minutes to execute - - b_ems: *requires_nothing - - t_ext: *job_ems_test_ext_colony diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 39b2df131..34fc9644e 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -248,6 +248,8 @@ ASTPointer Parser::parsePragmaDirective(bool const _finishedPar if (literals.size() >= 2 && literals[0] == "experimental" && literals[1] == "solidity") { + if (m_evmVersion < EVMVersion::constantinople()) + fatalParserError(7637_error, "Experimental solidity requires Constantinople EVM version at the minimum."); if (_finishedParsingTopLevelPragmas) fatalParserError(8185_error, "Experimental pragma \"solidity\" can only be set at the beginning of the source unit."); m_experimentalSolidityEnabledInCurrentSourceUnit = true; diff --git a/scripts/ci/notification/matrix_notification.sh b/scripts/ci/notification/matrix_notification.sh index cbe290af4..f7bd1949b 100755 --- a/scripts/ci/notification/matrix_notification.sh +++ b/scripts/ci/notification/matrix_notification.sh @@ -1,7 +1,6 @@ #!/bin/bash set -euo pipefail -shopt -s inherit_errexit SCRIPT_DIR="$(dirname "$0")" @@ -28,6 +27,7 @@ function notify() { curl "https://${MATRIX_SERVER}/_matrix/client/v3/rooms/${MATRIX_NOTIFY_ROOM_ID}/send/m.room.message" \ --request POST \ --include \ + --fail \ --header "Content-Type: application/json" \ --header "Accept: application/json" \ --header "Authorization: Bearer ${MATRIX_ACCESS_TOKEN}" \ @@ -63,10 +63,14 @@ function format_predefined_message() { [[ -z "$template" ]] && fail "Message template for event [$event] not defined." - # Export variables that must be substituted - export WORKFLOW_NAME JOB BRANCH TAG BUILD_URL BUILD_NUM - envsubst < "$template" - unset WORKFLOW_NAME JOB BRANCH TAG BUILD_URL BUILD_NUM + # shellcheck disable=SC2016 + sed -e 's|${WORKFLOW_NAME}|'"${WORKFLOW_NAME}"'|' \ + -e 's|${JOB}|'"${JOB}"'|' \ + -e 's|${BRANCH}|'"${BRANCH}"'|' \ + -e 's|${TAG}|'"${TAG}"'|' \ + -e 's|${BUILD_URL}|'"${BUILD_URL}"'|' \ + -e 's|${BUILD_NUM}|'"${BUILD_NUM}"'|' \ + "$template" } # Set message environment variables based on CI backend diff --git a/scripts/test_antlr_grammar.sh b/scripts/test_antlr_grammar.sh index 6ab28fc5f..e84f9b064 100755 --- a/scripts/test_antlr_grammar.sh +++ b/scripts/test_antlr_grammar.sh @@ -110,7 +110,7 @@ do SOL_FILES+=("$line") done < <( grep --include "*.sol" -riL -E \ - "^\/\/ (Syntax|Type|Declaration)Error|^\/\/ ParserError (1684|2837|3716|3997|5333|6275|6281|6933|7319|8185)|^==== Source:" \ + "^\/\/ (Syntax|Type|Declaration)Error|^\/\/ ParserError (1684|2837|3716|3997|5333|6275|6281|6933|7319|8185|7637)|^==== Source:" \ "${ROOT_DIR}/test/libsolidity/syntaxTests" \ "${ROOT_DIR}/test/libsolidity/semanticTests" | # Skipping the unicode tests as I couldn't adapt the lexical grammar to recursively counting RLO/LRO/PDF's. diff --git a/test/externalTests/gp2.sh b/test/externalTests/gp2.sh index 4dae6f0c3..25403a879 100755 --- a/test/externalTests/gp2.sh +++ b/test/externalTests/gp2.sh @@ -69,6 +69,14 @@ function gp2_test force_hardhat_unlimited_contract_size "$config_file" "$config_var" yarn + # Workaround for error caused by the last release of hardhat-waffle@2.0.6 that bumps ethereum-waffle + # to version 4.0.10 and breaks gp2 build with the following error: + # + # Cannot find module 'ethereum-waffle/dist/cjs/src/deployContract' + # + # See: https://github.com/NomicFoundation/hardhat-waffle/commit/83ee9cb36ee59d0bedacbbd00043f030af104ad0 + yarn add '@nomiclabs/hardhat-waffle@2.0.5' + # Some dependencies come with pre-built artifacts. We want to build from scratch. rm -r node_modules/@gnosis.pm/safe-contracts/build/ diff --git a/test/externalTests/prb-math.sh b/test/externalTests/prb-math.sh index 99c7c2716..614c285f7 100755 --- a/test/externalTests/prb-math.sh +++ b/test/externalTests/prb-math.sh @@ -96,6 +96,14 @@ function prb_math_test yarn install --no-lock-file yarn add hardhat-gas-reporter + # Workaround for error caused by the last release of hardhat-waffle@2.0.6 that bumps ethereum-waffle + # to version 4.0.10 and breaks prb-math build with the following error: + # + # Cannot find module 'ethereum-waffle/dist/cjs/src/deployContract' + # + # See: https://github.com/NomicFoundation/hardhat-waffle/commit/83ee9cb36ee59d0bedacbbd00043f030af104ad0 + yarn add '@nomiclabs/hardhat-waffle@2.0.5' + replace_version_pragmas for preset in $SELECTED_PRESETS; do diff --git a/test/libsolidity/ASTJSON/pragma_experimental_solidity.json b/test/libsolidity/ASTJSON/pragma_experimental_solidity.json index d2f7e56ad..66ece94e0 100644 --- a/test/libsolidity/ASTJSON/pragma_experimental_solidity.json +++ b/test/libsolidity/ASTJSON/pragma_experimental_solidity.json @@ -17,5 +17,5 @@ "src": "0:29:1" } ], - "src": "0:30:1" + "src": "0:70:1" } diff --git a/test/libsolidity/ASTJSON/pragma_experimental_solidity.sol b/test/libsolidity/ASTJSON/pragma_experimental_solidity.sol index e0c1c81aa..b902bb061 100644 --- a/test/libsolidity/ASTJSON/pragma_experimental_solidity.sol +++ b/test/libsolidity/ASTJSON/pragma_experimental_solidity.sol @@ -1,3 +1,4 @@ pragma experimental solidity; - +// ==== +// EVMVersion: >=constantinople // ---- diff --git a/test/libsolidity/ASTJSON/pragma_experimental_solidity_parseOnly.json b/test/libsolidity/ASTJSON/pragma_experimental_solidity_parseOnly.json index a1a3410ff..b1ac937a2 100644 --- a/test/libsolidity/ASTJSON/pragma_experimental_solidity_parseOnly.json +++ b/test/libsolidity/ASTJSON/pragma_experimental_solidity_parseOnly.json @@ -16,5 +16,5 @@ "src": "0:29:1" } ], - "src": "0:30:1" + "src": "0:70:1" } diff --git a/test/libsolidity/ASTJSONTest.cpp b/test/libsolidity/ASTJSONTest.cpp index 3602e1485..6f264fc13 100644 --- a/test/libsolidity/ASTJSONTest.cpp +++ b/test/libsolidity/ASTJSONTest.cpp @@ -181,7 +181,8 @@ void ASTJSONTest::validateTestConfiguration() const } } -ASTJSONTest::ASTJSONTest(string const& _filename) +ASTJSONTest::ASTJSONTest(string const& _filename): + EVMVersionRestrictedTestCase(_filename) { if (!boost::algorithm::ends_with(_filename, ".sol")) BOOST_THROW_EXCEPTION(runtime_error("Invalid test contract file name: \"" + _filename + "\".")); diff --git a/test/libsolidity/ASTJSONTest.h b/test/libsolidity/ASTJSONTest.h index 648f3bbc3..1e74b62fe 100644 --- a/test/libsolidity/ASTJSONTest.h +++ b/test/libsolidity/ASTJSONTest.h @@ -35,7 +35,7 @@ class CompilerStack; namespace solidity::frontend::test { -class ASTJSONTest: public TestCase +class ASTJSONTest: public EVMVersionRestrictedTestCase { public: struct TestVariant diff --git a/test/libsolidity/syntaxTests/pragma/experimental_solidity.sol b/test/libsolidity/syntaxTests/pragma/experimental_solidity.sol index 9bb74a7ec..b6f871d87 100644 --- a/test/libsolidity/syntaxTests/pragma/experimental_solidity.sol +++ b/test/libsolidity/syntaxTests/pragma/experimental_solidity.sol @@ -1,3 +1,5 @@ pragma experimental solidity; +// ==== +// EVMVersion: >=constantinople // ---- // Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments. diff --git a/test/libsolidity/syntaxTests/pragma/experimental_solidity_multisource_not_all_enable.sol b/test/libsolidity/syntaxTests/pragma/experimental_solidity_multisource_not_all_enable.sol index 747b8e166..fe4125e84 100644 --- a/test/libsolidity/syntaxTests/pragma/experimental_solidity_multisource_not_all_enable.sol +++ b/test/libsolidity/syntaxTests/pragma/experimental_solidity_multisource_not_all_enable.sol @@ -18,6 +18,8 @@ import "A.sol"; contract D { A a; } +// ==== +// EVMVersion: >=constantinople // ---- // ParserError 2141: (B.sol:0-29): File declares "pragma experimental solidity". If you want to enable the experimental mode, all source units must include the pragma. // ParserError 2141: (C.sol:0-29): File declares "pragma experimental solidity". If you want to enable the experimental mode, all source units must include the pragma. diff --git a/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_1.sol b/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_1.sol index 5fde260f6..d6741b0d3 100644 --- a/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_1.sol +++ b/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_1.sol @@ -1,5 +1,7 @@ contract A {} pragma experimental solidity; +// ==== +// EVMVersion: >=constantinople // ---- // ParserError 8185: (45-45): Experimental pragma "solidity" can only be set at the beginning of the source unit. diff --git a/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_2.sol b/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_2.sol index 3748a5c76..940bd3fbb 100644 --- a/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_2.sol +++ b/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_2.sol @@ -9,5 +9,7 @@ struct A { uint256 x; } +// ==== +// EVMVersion: >=constantinople // ---- // ParserError 8185: (83-89): Experimental pragma "solidity" can only be set at the beginning of the source unit. diff --git a/test/libsolidity/syntaxTests/pragma/experimental_solidity_wrong_evm_version.sol b/test/libsolidity/syntaxTests/pragma/experimental_solidity_wrong_evm_version.sol new file mode 100644 index 000000000..3e070535b --- /dev/null +++ b/test/libsolidity/syntaxTests/pragma/experimental_solidity_wrong_evm_version.sol @@ -0,0 +1,8 @@ +pragma experimental solidity; + +contract C {} + +// ==== +// EVMVersion: