mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into breaking
This commit is contained in:
commit
017519f555
@ -352,7 +352,7 @@ defaults:
|
|||||||
|
|
||||||
- base_osx: &base_osx
|
- base_osx: &base_osx
|
||||||
macos:
|
macos:
|
||||||
xcode: "11.0.0"
|
xcode: "13.2.0"
|
||||||
environment:
|
environment:
|
||||||
TERM: xterm
|
TERM: xterm
|
||||||
MAKEFLAGS: -j 5
|
MAKEFLAGS: -j 5
|
||||||
@ -1054,8 +1054,9 @@ jobs:
|
|||||||
docker:
|
docker:
|
||||||
- image: circleci/node:<<parameters.nodejs_version>>
|
- image: circleci/node:<<parameters.nodejs_version>>
|
||||||
resource_class: <<parameters.resource_class>>
|
resource_class: <<parameters.resource_class>>
|
||||||
# NOTE: Each external test does 3 separate compile&test runs
|
# NOTE: Each external test runs up to 6 independent settings presets. If parallelism is higher than
|
||||||
parallelism: 3
|
# actual preset count, some runs will exit immediately. If it's lower, some runs will get more than one preset.
|
||||||
|
parallelism: 6
|
||||||
environment:
|
environment:
|
||||||
TERM: xterm
|
TERM: xterm
|
||||||
COMPILE_ONLY: <<parameters.compile_only>>
|
COMPILE_ONLY: <<parameters.compile_only>>
|
||||||
|
@ -21,7 +21,7 @@ include(EthPolicy)
|
|||||||
eth_policy()
|
eth_policy()
|
||||||
|
|
||||||
# project name and version should be set after cmake_policy CMP0048
|
# project name and version should be set after cmake_policy CMP0048
|
||||||
set(PROJECT_VERSION "0.8.11")
|
set(PROJECT_VERSION "0.8.12")
|
||||||
# OSX target needed in order to support std::visit
|
# OSX target needed in order to support std::visit
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
|
||||||
project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX)
|
project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX)
|
||||||
|
14
Changelog.md
14
Changelog.md
@ -8,7 +8,19 @@ Breaking changes:
|
|||||||
* Commandline Interface: Assembler mode no longer enables all outputs by default.
|
* Commandline Interface: Assembler mode no longer enables all outputs by default.
|
||||||
|
|
||||||
|
|
||||||
### 0.8.11 (unreleased)
|
### 0.8.12 (unreleased)
|
||||||
|
|
||||||
|
Compiler Features:
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
|
||||||
|
|
||||||
|
Solc-Js:
|
||||||
|
* The wrapper now requires at least nodejs v10.
|
||||||
|
|
||||||
|
|
||||||
|
### 0.8.11 (2021-12-20)
|
||||||
|
|
||||||
Language Features:
|
Language Features:
|
||||||
* General: New builtin function ``abi.encodeCall(functionPointer, (arg1, arg2, ...))`` that type-checks the arguments and returns the ABI-encoded function call data.
|
* General: New builtin function ``abi.encodeCall(functionPointer, (arg1, arg2, ...))`` that type-checks the arguments and returns the ABI-encoded function call data.
|
||||||
|
@ -1548,6 +1548,10 @@
|
|||||||
"bugs": [],
|
"bugs": [],
|
||||||
"released": "2021-11-09"
|
"released": "2021-11-09"
|
||||||
},
|
},
|
||||||
|
"0.8.11": {
|
||||||
|
"bugs": [],
|
||||||
|
"released": "2021-12-20"
|
||||||
|
},
|
||||||
"0.8.2": {
|
"0.8.2": {
|
||||||
"bugs": [
|
"bugs": [
|
||||||
"SignedImmutables",
|
"SignedImmutables",
|
||||||
|
@ -592,8 +592,15 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!getter.interfaceFunctionType())
|
if (!getter.interfaceFunctionType())
|
||||||
|
{
|
||||||
|
solAssert(getter.returnParameterNames().size() == getter.returnParameterTypes().size());
|
||||||
|
solAssert(getter.parameterNames().size() == getter.parameterTypes().size());
|
||||||
|
if (getter.returnParameterTypes().empty() && getter.parameterTypes().empty())
|
||||||
|
m_errorReporter.typeError(5359_error, _variable.location(), "The struct has all its members omitted, therefore the getter cannot return any values.");
|
||||||
|
else
|
||||||
m_errorReporter.typeError(6744_error, _variable.location(), "Internal or recursive type is not allowed for public state variables.");
|
m_errorReporter.typeError(6744_error, _variable.location(), "Internal or recursive type is not allowed for public state variables.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool isStructMemberDeclaration = dynamic_cast<StructDefinition const*>(_variable.scope()) != nullptr;
|
bool isStructMemberDeclaration = dynamic_cast<StructDefinition const*>(_variable.scope()) != nullptr;
|
||||||
if (isStructMemberDeclaration)
|
if (isStructMemberDeclaration)
|
||||||
|
@ -72,7 +72,7 @@ optional<LineColumn> parseLineColumn(Json::Value const& _lineColumn)
|
|||||||
return nullopt;
|
return nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr int toDiagnosticSeverity(Error::Type _errorType)
|
int toDiagnosticSeverity(Error::Type _errorType)
|
||||||
{
|
{
|
||||||
// 1=Error, 2=Warning, 3=Info, 4=Hint
|
// 1=Error, 2=Warning, 3=Info, 4=Hint
|
||||||
switch (Error::errorSeverity(_errorType))
|
switch (Error::errorSeverity(_errorType))
|
||||||
|
@ -211,6 +211,7 @@ function safe_kill
|
|||||||
|
|
||||||
function circleci_select_steps
|
function circleci_select_steps
|
||||||
{
|
{
|
||||||
|
# We expect multiple lines in $all_steps, one step per line
|
||||||
local all_steps="$1"
|
local all_steps="$1"
|
||||||
(( $# == 1 )) || assertFail
|
(( $# == 1 )) || assertFail
|
||||||
|
|
||||||
@ -222,11 +223,26 @@ function circleci_select_steps
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function circleci_select_steps_multiarg
|
||||||
|
{
|
||||||
|
# We expect multiple arguments, one step per argument.
|
||||||
|
circleci_select_steps "$(printf '%s\n' "$@")"
|
||||||
|
}
|
||||||
|
|
||||||
function circleci_step_selected
|
function circleci_step_selected
|
||||||
{
|
{
|
||||||
local selected_steps="$1"
|
local selected_steps="$1"
|
||||||
local step="$2"
|
local step="$2"
|
||||||
|
(( $# == 2 )) || assertFail
|
||||||
[[ $step != *" "* ]] || assertFail "Step names must not contain spaces."
|
[[ $step != *" "* ]] || assertFail "Step names must not contain spaces."
|
||||||
|
|
||||||
[[ " $selected_steps " == *" $step "* ]] || return 1
|
[[ " $selected_steps " == *" $step "* ]] || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function first_word
|
||||||
|
{
|
||||||
|
local words="$1"
|
||||||
|
(( $# == 1 )) || assertFail
|
||||||
|
|
||||||
|
echo "$words" | cut -d " " -f 1
|
||||||
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
#include <boost/rational.hpp>
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
namespace solidity::frontend::test
|
namespace solidity::frontend::test
|
||||||
|
@ -36,20 +36,29 @@ function colony_test
|
|||||||
local repo="https://github.com/solidity-external-tests/colonyNetwork.git"
|
local repo="https://github.com/solidity-external-tests/colonyNetwork.git"
|
||||||
local branch=develop_080
|
local branch=develop_080
|
||||||
local config_file="truffle.js"
|
local config_file="truffle.js"
|
||||||
# On levels 1 and 2 it compiles but tests run out of gas
|
|
||||||
local min_optimizer_level=3
|
|
||||||
local max_optimizer_level=3
|
|
||||||
|
|
||||||
local selected_optimizer_levels
|
local compile_only_presets=(
|
||||||
selected_optimizer_levels=$(circleci_select_steps "$(seq "$min_optimizer_level" "$max_optimizer_level")")
|
ir-no-optimize # Compiles but tests run out of gas
|
||||||
print_optimizer_levels_or_exit "$selected_optimizer_levels"
|
ir-optimize-evm-only # Compiles but tests run out of gas
|
||||||
|
legacy-no-optimize # Compiles but tests run out of gas
|
||||||
|
legacy-optimize-evm-only # Compiles but tests run out of gas
|
||||||
|
)
|
||||||
|
local settings_presets=(
|
||||||
|
"${compile_only_presets[@]}"
|
||||||
|
ir-optimize-evm+yul
|
||||||
|
legacy-optimize-evm+yul
|
||||||
|
)
|
||||||
|
|
||||||
|
local selected_optimizer_presets
|
||||||
|
selected_optimizer_presets=$(circleci_select_steps_multiarg "${settings_presets[@]}")
|
||||||
|
print_optimizer_presets_or_exit "$selected_optimizer_presets"
|
||||||
|
|
||||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
||||||
download_project "$repo" "$branch" "$DIR"
|
download_project "$repo" "$branch" "$DIR"
|
||||||
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
|
[[ $BINARY_TYPE == native ]] && replace_global_solc "$BINARY_PATH"
|
||||||
|
|
||||||
neutralize_package_json_hooks
|
neutralize_package_json_hooks
|
||||||
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$min_optimizer_level"
|
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$(first_word "$selected_optimizer_presets")"
|
||||||
yarn install
|
yarn install
|
||||||
git submodule update --init
|
git submodule update --init
|
||||||
|
|
||||||
@ -61,8 +70,8 @@ function colony_test
|
|||||||
replace_version_pragmas
|
replace_version_pragmas
|
||||||
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc"
|
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc"
|
||||||
|
|
||||||
for level in $selected_optimizer_levels; do
|
for preset in $selected_optimizer_presets; do
|
||||||
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$level" compile_fn test_fn
|
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,13 +24,13 @@ set -e
|
|||||||
|
|
||||||
CURRENT_EVM_VERSION=london
|
CURRENT_EVM_VERSION=london
|
||||||
|
|
||||||
function print_optimizer_levels_or_exit
|
function print_optimizer_presets_or_exit
|
||||||
{
|
{
|
||||||
local selected_levels="$1"
|
local selected_presets="$1"
|
||||||
|
|
||||||
[[ $selected_levels != "" ]] || { printWarning "No steps to run. Exiting."; exit 0; }
|
[[ $selected_presets != "" ]] || { printWarning "No presets to run. Exiting."; exit 0; }
|
||||||
|
|
||||||
printLog "Selected optimizer levels: ${selected_levels}"
|
printLog "Selected settings presets: ${selected_presets}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function verify_input
|
function verify_input
|
||||||
@ -141,7 +141,7 @@ function force_truffle_compiler_settings
|
|||||||
local config_file="$1"
|
local config_file="$1"
|
||||||
local binary_type="$2"
|
local binary_type="$2"
|
||||||
local solc_path="$3"
|
local solc_path="$3"
|
||||||
local level="$4"
|
local preset="$4"
|
||||||
local evm_version="${5:-"$CURRENT_EVM_VERSION"}"
|
local evm_version="${5:-"$CURRENT_EVM_VERSION"}"
|
||||||
|
|
||||||
[[ $binary_type == native || $binary_type == solcjs ]] || assertFail
|
[[ $binary_type == native || $binary_type == solcjs ]] || assertFail
|
||||||
@ -153,14 +153,16 @@ function force_truffle_compiler_settings
|
|||||||
echo "Config file: $config_file"
|
echo "Config file: $config_file"
|
||||||
echo "Binary type: $binary_type"
|
echo "Binary type: $binary_type"
|
||||||
echo "Compiler path: $solc_path"
|
echo "Compiler path: $solc_path"
|
||||||
echo "Optimization level: $level"
|
echo "Settings preset: ${preset}"
|
||||||
echo "Optimizer settings: $(optimizer_settings_for_level "$level")"
|
echo "Settings: $(settings_from_preset "$preset" "$evm_version")"
|
||||||
echo "EVM version: $evm_version"
|
echo "EVM version: $evm_version"
|
||||||
|
echo "Compiler version: ${SOLCVERSION_SHORT}"
|
||||||
|
echo "Compiler version (full): ${SOLCVERSION}"
|
||||||
echo "-------------------------------------"
|
echo "-------------------------------------"
|
||||||
|
|
||||||
# Forcing the settings should always work by just overwriting the solc object. Forcing them by using a
|
# Forcing the settings should always work by just overwriting the solc object. Forcing them by using a
|
||||||
# dedicated settings objects should only be the fallback.
|
# dedicated settings objects should only be the fallback.
|
||||||
echo "module.exports['compilers'] = $(truffle_compiler_settings "$solc_path" "$level" "$evm_version");" >> "$config_file"
|
echo "module.exports['compilers'] = $(truffle_compiler_settings "$solc_path" "$preset" "$evm_version");" >> "$config_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
function force_hardhat_compiler_binary
|
function force_hardhat_compiler_binary
|
||||||
@ -180,14 +182,14 @@ function force_hardhat_compiler_binary
|
|||||||
function force_hardhat_compiler_settings
|
function force_hardhat_compiler_settings
|
||||||
{
|
{
|
||||||
local config_file="$1"
|
local config_file="$1"
|
||||||
local level="$2"
|
local preset="$2"
|
||||||
local evm_version="${3:-"$CURRENT_EVM_VERSION"}"
|
local evm_version="${3:-"$CURRENT_EVM_VERSION"}"
|
||||||
|
|
||||||
printLog "Configuring Hardhat..."
|
printLog "Configuring Hardhat..."
|
||||||
echo "-------------------------------------"
|
echo "-------------------------------------"
|
||||||
echo "Config file: ${config_file}"
|
echo "Config file: ${config_file}"
|
||||||
echo "Optimization level: ${level}"
|
echo "Settings preset: ${preset}"
|
||||||
echo "Optimizer settings: $(optimizer_settings_for_level "$level")"
|
echo "Settings: $(settings_from_preset "$preset" "$evm_version")"
|
||||||
echo "EVM version: ${evm_version}"
|
echo "EVM version: ${evm_version}"
|
||||||
echo "Compiler version: ${SOLCVERSION_SHORT}"
|
echo "Compiler version: ${SOLCVERSION_SHORT}"
|
||||||
echo "Compiler version (full): ${SOLCVERSION}"
|
echo "Compiler version (full): ${SOLCVERSION}"
|
||||||
@ -195,7 +197,7 @@ function force_hardhat_compiler_settings
|
|||||||
|
|
||||||
{
|
{
|
||||||
echo -n 'module.exports["solidity"] = '
|
echo -n 'module.exports["solidity"] = '
|
||||||
hardhat_compiler_settings "$SOLCVERSION_SHORT" "$level" "$evm_version"
|
hardhat_compiler_settings "$SOLCVERSION_SHORT" "$preset" "$evm_version"
|
||||||
} >> "$config_file"
|
} >> "$config_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,22 +238,27 @@ function run_test
|
|||||||
replace_version_pragmas
|
replace_version_pragmas
|
||||||
|
|
||||||
printLog "Running compile function..."
|
printLog "Running compile function..."
|
||||||
$compile_fn
|
time $compile_fn
|
||||||
|
|
||||||
printLog "Running test function..."
|
printLog "Running test function..."
|
||||||
$test_fn
|
$test_fn
|
||||||
}
|
}
|
||||||
|
|
||||||
function optimizer_settings_for_level
|
function settings_from_preset
|
||||||
{
|
{
|
||||||
local level="$1"
|
local preset="$1"
|
||||||
|
local evm_version="$2"
|
||||||
|
|
||||||
case "$level" in
|
case "$preset" in
|
||||||
1) echo "{enabled: false}" ;;
|
# NOTE: Remember to update `parallelism` of `t_ems_ext` job in CI config if you add/remove presets
|
||||||
2) echo "{enabled: true, details: {yul: false}}" ;;
|
legacy-no-optimize) echo "{evmVersion: '${evm_version}', viaIR: false, optimizer: {enabled: false}}" ;;
|
||||||
3) echo "{enabled: true, details: {yul: true}}" ;;
|
ir-no-optimize) echo "{evmVersion: '${evm_version}', viaIR: true, optimizer: {enabled: false}}" ;;
|
||||||
|
legacy-optimize-evm-only) echo "{evmVersion: '${evm_version}', viaIR: false, optimizer: {enabled: true, details: {yul: false}}}" ;;
|
||||||
|
ir-optimize-evm-only) echo "{evmVersion: '${evm_version}', viaIR: true, optimizer: {enabled: true, details: {yul: false}}}" ;;
|
||||||
|
legacy-optimize-evm+yul) echo "{evmVersion: '${evm_version}', viaIR: false, optimizer: {enabled: true, details: {yul: true}}}" ;;
|
||||||
|
ir-optimize-evm+yul) echo "{evmVersion: '${evm_version}', viaIR: true, optimizer: {enabled: true, details: {yul: true}}}" ;;
|
||||||
*)
|
*)
|
||||||
fail "Optimizer level not found. Please define OPTIMIZER_LEVEL=[1, 2, 3]"
|
fail "Unknown settings preset: '${preset}'."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
@ -269,16 +276,13 @@ function replace_global_solc
|
|||||||
function truffle_compiler_settings
|
function truffle_compiler_settings
|
||||||
{
|
{
|
||||||
local solc_path="$1"
|
local solc_path="$1"
|
||||||
local level="$2"
|
local preset="$2"
|
||||||
local evm_version="$3"
|
local evm_version="$3"
|
||||||
|
|
||||||
echo "{"
|
echo "{"
|
||||||
echo " solc: {"
|
echo " solc: {"
|
||||||
echo " version: \"${solc_path}\","
|
echo " version: \"${solc_path}\","
|
||||||
echo " settings: {"
|
echo " settings: $(settings_from_preset "$preset" "$evm_version")"
|
||||||
echo " optimizer: $(optimizer_settings_for_level "$level"),"
|
|
||||||
echo " evmVersion: \"${evm_version}\""
|
|
||||||
echo " }"
|
|
||||||
echo " }"
|
echo " }"
|
||||||
echo "}"
|
echo "}"
|
||||||
}
|
}
|
||||||
@ -310,15 +314,12 @@ function hardhat_solc_build_subtask {
|
|||||||
|
|
||||||
function hardhat_compiler_settings {
|
function hardhat_compiler_settings {
|
||||||
local solc_version="$1"
|
local solc_version="$1"
|
||||||
local level="$2"
|
local preset="$2"
|
||||||
local evm_version="$3"
|
local evm_version="$3"
|
||||||
|
|
||||||
echo "{"
|
echo "{"
|
||||||
echo " version: '${solc_version}',"
|
echo " version: '${solc_version}',"
|
||||||
echo " settings: {"
|
echo " settings: $(settings_from_preset "$preset" "$evm_version")"
|
||||||
echo " optimizer: $(optimizer_settings_for_level "$level"),"
|
|
||||||
echo " evmVersion: '${evm_version}'"
|
|
||||||
echo " }"
|
|
||||||
echo "}"
|
echo "}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,12 +328,16 @@ function compile_and_run_test
|
|||||||
local compile_fn="$1"
|
local compile_fn="$1"
|
||||||
local test_fn="$2"
|
local test_fn="$2"
|
||||||
local verify_fn="$3"
|
local verify_fn="$3"
|
||||||
|
local preset="$4"
|
||||||
|
local compile_only_presets="$5"
|
||||||
|
|
||||||
|
[[ $preset != *" "* ]] || assertFail "Preset names must not contain spaces."
|
||||||
|
|
||||||
printLog "Running compile function..."
|
printLog "Running compile function..."
|
||||||
$compile_fn
|
time $compile_fn
|
||||||
$verify_fn "$SOLCVERSION_SHORT" "$SOLCVERSION"
|
$verify_fn "$SOLCVERSION_SHORT" "$SOLCVERSION"
|
||||||
|
|
||||||
if [[ "$COMPILE_ONLY" == 1 ]]; then
|
if [[ "$COMPILE_ONLY" == 1 || " $compile_only_presets " == *" $preset "* ]]; then
|
||||||
printLog "Skipping test function..."
|
printLog "Skipping test function..."
|
||||||
else
|
else
|
||||||
printLog "Running test function..."
|
printLog "Running test function..."
|
||||||
@ -345,25 +350,27 @@ function truffle_run_test
|
|||||||
local config_file="$1"
|
local config_file="$1"
|
||||||
local binary_type="$2"
|
local binary_type="$2"
|
||||||
local solc_path="$3"
|
local solc_path="$3"
|
||||||
local optimizer_level="$4"
|
local preset="$4"
|
||||||
local compile_fn="$5"
|
local compile_only_presets="$5"
|
||||||
local test_fn="$6"
|
local compile_fn="$6"
|
||||||
|
local test_fn="$7"
|
||||||
|
|
||||||
truffle_clean
|
truffle_clean
|
||||||
force_truffle_compiler_settings "$config_file" "$binary_type" "$solc_path" "$optimizer_level"
|
force_truffle_compiler_settings "$config_file" "$binary_type" "$solc_path" "$preset"
|
||||||
compile_and_run_test compile_fn test_fn truffle_verify_compiler_version
|
compile_and_run_test compile_fn test_fn truffle_verify_compiler_version "$preset" "$compile_only_presets"
|
||||||
}
|
}
|
||||||
|
|
||||||
function hardhat_run_test
|
function hardhat_run_test
|
||||||
{
|
{
|
||||||
local config_file="$1"
|
local config_file="$1"
|
||||||
local optimizer_level="$2"
|
local preset="$2"
|
||||||
local compile_fn="$3"
|
local compile_only_presets="$3"
|
||||||
local test_fn="$4"
|
local compile_fn="$4"
|
||||||
|
local test_fn="$5"
|
||||||
|
|
||||||
hardhat_clean
|
hardhat_clean
|
||||||
force_hardhat_compiler_settings "$config_file" "$optimizer_level"
|
force_hardhat_compiler_settings "$config_file" "$preset"
|
||||||
compile_and_run_test compile_fn test_fn hardhat_verify_compiler_version
|
compile_and_run_test compile_fn test_fn hardhat_verify_compiler_version "$preset" "$compile_only_presets"
|
||||||
}
|
}
|
||||||
|
|
||||||
function external_test
|
function external_test
|
||||||
|
@ -36,12 +36,21 @@ function ens_test
|
|||||||
local repo="https://github.com/ensdomains/ens.git"
|
local repo="https://github.com/ensdomains/ens.git"
|
||||||
local branch=master
|
local branch=master
|
||||||
local config_file="truffle.js"
|
local config_file="truffle.js"
|
||||||
local min_optimizer_level=1
|
|
||||||
local max_optimizer_level=3
|
|
||||||
|
|
||||||
local selected_optimizer_levels
|
local compile_only_presets=()
|
||||||
selected_optimizer_levels=$(circleci_select_steps "$(seq "$min_optimizer_level" "$max_optimizer_level")")
|
local settings_presets=(
|
||||||
print_optimizer_levels_or_exit "$selected_optimizer_levels"
|
"${compile_only_presets[@]}"
|
||||||
|
#ir-no-optimize # "YulException: Variable var_ttl_236 is 1 slot(s) too deep inside the stack."
|
||||||
|
#ir-optimize-evm-only # "YulException: Variable var_ttl_236 is 1 slot(s) too deep inside the stack."
|
||||||
|
ir-optimize-evm+yul
|
||||||
|
legacy-no-optimize
|
||||||
|
legacy-optimize-evm-only
|
||||||
|
legacy-optimize-evm+yul
|
||||||
|
)
|
||||||
|
|
||||||
|
local selected_optimizer_presets
|
||||||
|
selected_optimizer_presets=$(circleci_select_steps_multiarg "${settings_presets[@]}")
|
||||||
|
print_optimizer_presets_or_exit "$selected_optimizer_presets"
|
||||||
|
|
||||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
||||||
download_project "$repo" "$branch" "$DIR"
|
download_project "$repo" "$branch" "$DIR"
|
||||||
@ -52,14 +61,14 @@ function ens_test
|
|||||||
|
|
||||||
neutralize_package_lock
|
neutralize_package_lock
|
||||||
neutralize_package_json_hooks
|
neutralize_package_json_hooks
|
||||||
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$min_optimizer_level"
|
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$(first_word "$selected_optimizer_presets")"
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
replace_version_pragmas
|
replace_version_pragmas
|
||||||
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc"
|
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc"
|
||||||
|
|
||||||
for level in $selected_optimizer_levels; do
|
for preset in $selected_optimizer_presets; do
|
||||||
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$level" compile_fn test_fn
|
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,13 +36,22 @@ function gnosis_safe_test
|
|||||||
local repo="https://github.com/solidity-external-tests/safe-contracts.git"
|
local repo="https://github.com/solidity-external-tests/safe-contracts.git"
|
||||||
local branch=v2_080
|
local branch=v2_080
|
||||||
local config_file="truffle-config.js"
|
local config_file="truffle-config.js"
|
||||||
# level 1: "Error: while migrating GnosisSafe: Returned error: base fee exceeds gas limit"
|
|
||||||
local min_optimizer_level=2
|
|
||||||
local max_optimizer_level=3
|
|
||||||
|
|
||||||
local selected_optimizer_levels
|
local compile_only_presets=(
|
||||||
selected_optimizer_levels=$(circleci_select_steps "$(seq "$min_optimizer_level" "$max_optimizer_level")")
|
legacy-no-optimize # "Error: while migrating GnosisSafe: Returned error: base fee exceeds gas limit"
|
||||||
print_optimizer_levels_or_exit "$selected_optimizer_levels"
|
)
|
||||||
|
local settings_presets=(
|
||||||
|
"${compile_only_presets[@]}"
|
||||||
|
#ir-no-optimize # "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
|
||||||
|
#ir-optimize-evm-only # "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
|
||||||
|
ir-optimize-evm+yul
|
||||||
|
legacy-optimize-evm-only
|
||||||
|
legacy-optimize-evm+yul
|
||||||
|
)
|
||||||
|
|
||||||
|
local selected_optimizer_presets
|
||||||
|
selected_optimizer_presets=$(circleci_select_steps_multiarg "${settings_presets[@]}")
|
||||||
|
print_optimizer_presets_or_exit "$selected_optimizer_presets"
|
||||||
|
|
||||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
||||||
download_project "$repo" "$branch" "$DIR"
|
download_project "$repo" "$branch" "$DIR"
|
||||||
@ -53,14 +62,14 @@ function gnosis_safe_test
|
|||||||
|
|
||||||
neutralize_package_lock
|
neutralize_package_lock
|
||||||
neutralize_package_json_hooks
|
neutralize_package_json_hooks
|
||||||
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$min_optimizer_level"
|
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$(first_word "$selected_optimizer_presets")"
|
||||||
npm install --package-lock
|
npm install --package-lock
|
||||||
|
|
||||||
replace_version_pragmas
|
replace_version_pragmas
|
||||||
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc"
|
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc"
|
||||||
|
|
||||||
for level in $selected_optimizer_levels; do
|
for preset in $selected_optimizer_presets; do
|
||||||
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$level" compile_fn test_fn
|
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,13 +36,21 @@ function gnosis_safe_test
|
|||||||
local repo="https://github.com/solidity-external-tests/safe-contracts.git"
|
local repo="https://github.com/solidity-external-tests/safe-contracts.git"
|
||||||
local branch=development_080
|
local branch=development_080
|
||||||
local config_file="truffle-config.js"
|
local config_file="truffle-config.js"
|
||||||
# levels 1 and 2: "Stack too deep" error
|
|
||||||
local min_optimizer_level=3
|
|
||||||
local max_optimizer_level=3
|
|
||||||
|
|
||||||
local selected_optimizer_levels
|
local compile_only_presets=()
|
||||||
selected_optimizer_levels=$(circleci_select_steps "$(seq "$min_optimizer_level" "$max_optimizer_level")")
|
local settings_presets=(
|
||||||
print_optimizer_levels_or_exit "$selected_optimizer_levels"
|
"${compile_only_presets[@]}"
|
||||||
|
#ir-no-optimize # "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
|
||||||
|
#ir-optimize-evm-only # "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack."
|
||||||
|
ir-optimize-evm+yul
|
||||||
|
#legacy-no-optimize # "Stack too deep" error
|
||||||
|
#legacy-optimize-evm-only # "Stack too deep" error
|
||||||
|
legacy-optimize-evm+yul
|
||||||
|
)
|
||||||
|
|
||||||
|
local selected_optimizer_presets
|
||||||
|
selected_optimizer_presets=$(circleci_select_steps_multiarg "${settings_presets[@]}")
|
||||||
|
print_optimizer_presets_or_exit "$selected_optimizer_presets"
|
||||||
|
|
||||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
||||||
download_project "$repo" "$branch" "$DIR"
|
download_project "$repo" "$branch" "$DIR"
|
||||||
@ -52,14 +60,14 @@ function gnosis_safe_test
|
|||||||
|
|
||||||
neutralize_package_lock
|
neutralize_package_lock
|
||||||
neutralize_package_json_hooks
|
neutralize_package_json_hooks
|
||||||
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$min_optimizer_level"
|
force_truffle_compiler_settings "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$(first_word "$selected_optimizer_presets")"
|
||||||
npm install --package-lock
|
npm install --package-lock
|
||||||
|
|
||||||
replace_version_pragmas
|
replace_version_pragmas
|
||||||
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc"
|
[[ $BINARY_TYPE == solcjs ]] && force_solc_modules "${DIR}/solc"
|
||||||
|
|
||||||
for level in $selected_optimizer_levels; do
|
for preset in $selected_optimizer_presets; do
|
||||||
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$level" compile_fn test_fn
|
truffle_run_test "$config_file" "$BINARY_TYPE" "${DIR}/solc" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,17 +4,17 @@ const solc = require('../index.js');
|
|||||||
|
|
||||||
tape('Deterministic Compilation', function (t) {
|
tape('Deterministic Compilation', function (t) {
|
||||||
t.test('DAO', function (st) {
|
t.test('DAO', function (st) {
|
||||||
var input = {};
|
const input = {};
|
||||||
var prevBytecode = null;
|
let prevBytecode = null;
|
||||||
var testdir = 'test/DAO/';
|
const testdir = 'test/DAO/';
|
||||||
var files = ['DAO.sol', 'Token.sol', 'TokenCreation.sol', 'ManagedAccount.sol'];
|
const files = ['DAO.sol', 'Token.sol', 'TokenCreation.sol', 'ManagedAccount.sol'];
|
||||||
var i;
|
let i;
|
||||||
for (i in files) {
|
for (i in files) {
|
||||||
var file = files[i];
|
const file = files[i];
|
||||||
input[file] = { content: fs.readFileSync(testdir + file, 'utf8') };
|
input[file] = { content: fs.readFileSync(testdir + file, 'utf8') };
|
||||||
}
|
}
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
var output = JSON.parse(solc.compile(JSON.stringify({
|
const output = JSON.parse(solc.compile(JSON.stringify({
|
||||||
language: 'Solidity',
|
language: 'Solidity',
|
||||||
settings: {
|
settings: {
|
||||||
optimizer: {
|
optimizer: {
|
||||||
@ -31,9 +31,9 @@ tape('Deterministic Compilation', function (t) {
|
|||||||
st.ok(output);
|
st.ok(output);
|
||||||
st.ok(output.contracts);
|
st.ok(output.contracts);
|
||||||
st.ok(output.contracts['DAO.sol']);
|
st.ok(output.contracts['DAO.sol']);
|
||||||
st.ok(output.contracts['DAO.sol']['DAO']);
|
st.ok(output.contracts['DAO.sol'].DAO);
|
||||||
st.ok(output.contracts['DAO.sol']['DAO'].evm.bytecode.object);
|
st.ok(output.contracts['DAO.sol'].DAO.evm.bytecode.object);
|
||||||
var bytecode = output.contracts['DAO.sol']['DAO'].evm.bytecode.object;
|
const bytecode = output.contracts['DAO.sol'].DAO.evm.bytecode.object;
|
||||||
st.ok(bytecode.length > 0);
|
st.ok(bytecode.length > 0);
|
||||||
if (prevBytecode !== null) {
|
if (prevBytecode !== null) {
|
||||||
st.equal(prevBytecode, bytecode);
|
st.equal(prevBytecode, bytecode);
|
||||||
|
@ -36,25 +36,35 @@ function zeppelin_test
|
|||||||
local repo="https://github.com/OpenZeppelin/openzeppelin-contracts.git"
|
local repo="https://github.com/OpenZeppelin/openzeppelin-contracts.git"
|
||||||
local branch=master
|
local branch=master
|
||||||
local config_file="hardhat.config.js"
|
local config_file="hardhat.config.js"
|
||||||
local min_optimizer_level=1
|
|
||||||
local max_optimizer_level=3
|
|
||||||
|
|
||||||
local selected_optimizer_levels
|
local compile_only_presets=(
|
||||||
selected_optimizer_levels=$(circleci_select_steps "$(seq "$min_optimizer_level" "$max_optimizer_level")")
|
ir-optimize-evm+yul # Compiles but tests fail. See https://github.com/nomiclabs/hardhat/issues/2115
|
||||||
print_optimizer_levels_or_exit "$selected_optimizer_levels"
|
)
|
||||||
|
local settings_presets=(
|
||||||
|
"${compile_only_presets[@]}"
|
||||||
|
#ir-no-optimize # "YulException: Variable var_account_852 is 4 slot(s) too deep inside the stack."
|
||||||
|
#ir-optimize-evm-only # "YulException: Variable var_account_852 is 4 slot(s) too deep inside the stack."
|
||||||
|
legacy-no-optimize
|
||||||
|
legacy-optimize-evm-only
|
||||||
|
legacy-optimize-evm+yul
|
||||||
|
)
|
||||||
|
|
||||||
|
local selected_optimizer_presets
|
||||||
|
selected_optimizer_presets=$(circleci_select_steps_multiarg "${settings_presets[@]}")
|
||||||
|
print_optimizer_presets_or_exit "$selected_optimizer_presets"
|
||||||
|
|
||||||
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
setup_solc "$DIR" "$BINARY_TYPE" "$BINARY_PATH"
|
||||||
download_project "$repo" "$branch" "$DIR"
|
download_project "$repo" "$branch" "$DIR"
|
||||||
|
|
||||||
neutralize_package_json_hooks
|
neutralize_package_json_hooks
|
||||||
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
|
force_hardhat_compiler_binary "$config_file" "$BINARY_TYPE" "$BINARY_PATH"
|
||||||
force_hardhat_compiler_settings "$config_file" "$min_optimizer_level"
|
force_hardhat_compiler_settings "$config_file" "$(first_word "$selected_optimizer_presets")"
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
replace_version_pragmas
|
replace_version_pragmas
|
||||||
|
|
||||||
for level in $selected_optimizer_levels; do
|
for preset in $selected_optimizer_presets; do
|
||||||
hardhat_run_test "$config_file" "$level" compile_fn test_fn
|
hardhat_run_test "$config_file" "$preset" "${compile_only_presets[*]}" compile_fn test_fn
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,4 +3,4 @@ contract test {
|
|||||||
Data public data;
|
Data public data;
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// TypeError 6744: (58-74): Internal or recursive type is not allowed for public state variables.
|
// TypeError 5359: (58-74): The struct has all its members omitted, therefore the getter cannot return any values.
|
||||||
|
Loading…
Reference in New Issue
Block a user