When changing compiler settings in Truffle config, always set all of them

This commit is contained in:
Kamil Śliwak 2020-12-08 16:21:46 +01:00
parent 5868eb7879
commit 8cd6e15333

View File

@ -139,7 +139,7 @@ function force_solc
printLog "Forcing solc version..."
cat >> "$config_file" <<EOF
module.exports['compilers'] = {solc: {version: "$dir/solc", settings: $(solc_settings "$OPTIMIZER_LEVEL" istanbul)}};
module.exports['compilers'] = $(truffle_compiler_settings "${dir}/solc" "$level" "$evm_version");
EOF
}
@ -159,7 +159,7 @@ function force_solc_settings
# 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.
echo "module.exports['compilers']['solc']['settings'] = $(solc_settings "$level" istanbul);" >> "$config_file"
echo "module.exports['compilers'] = $(truffle_compiler_settings "${DIR}/solc" "$level" "$evm_version");" >> "$config_file"
}
function verify_compiler_version
@ -222,6 +222,22 @@ function optimizer_settings_for_level {
esac
}
function truffle_compiler_settings {
local solc_path="$1"
local level="$2"
local evm_version="$3"
echo "{"
echo " solc: {"
echo " version: \"${solc_path}\","
echo " settings: {"
echo " optimizer: $(optimizer_settings_for_level "$level"),"
echo " evmVersion: \"${evm_version}\""
echo " }"
echo " }"
echo "}"
}
function truffle_run_test
{
local soljson="$1"