Merge pull request #10336 from ethereum/enablecoderv2bydefault

[BREAKING] Enable ABI coder v2 by default.
This commit is contained in:
chriseth 2020-12-09 18:05:07 +01:00 committed by GitHub
commit 3f748bbb94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 253 additions and 198 deletions

View File

@ -11,7 +11,7 @@
# #
# EVM=version_string Specifies EVM version to compile for (such as homestead, etc) # EVM=version_string Specifies EVM version to compile for (such as homestead, etc)
# OPTIMIZE=1 Enables backend optimizer # OPTIMIZE=1 Enables backend optimizer
# ABI_ENCODER_V2=1 Enables ABI encoder version 2 # ABI_ENCODER_V1=1 Forcibly enables ABI coder version 1
# SOLTEST_FLAGS=<flags> Appends <flags> to default SOLTEST_ARGS # SOLTEST_FLAGS=<flags> Appends <flags> to default SOLTEST_ARGS
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -49,7 +49,7 @@ ulimit -s 16384
get_logfile_basename() { get_logfile_basename() {
local filename="${EVM}" local filename="${EVM}"
test "${OPTIMIZE}" = "1" && filename="${filename}_opt" test "${OPTIMIZE}" = "1" && filename="${filename}_opt"
test "${ABI_ENCODER_V2}" = "1" && filename="${filename}_abiv2" test "${ABI_ENCODER_V1}" = "1" && filename="${filename}_abiv1"
echo -ne "${filename}" echo -ne "${filename}"
} }
@ -57,7 +57,7 @@ get_logfile_basename() {
BOOST_TEST_ARGS="--color_output=no --show_progress=yes --logger=JUNIT,error,test_results/`get_logfile_basename`.xml ${BOOST_TEST_ARGS}" BOOST_TEST_ARGS="--color_output=no --show_progress=yes --logger=JUNIT,error,test_results/`get_logfile_basename`.xml ${BOOST_TEST_ARGS}"
SOLTEST_ARGS="--evm-version=$EVM $SOLTEST_FLAGS" SOLTEST_ARGS="--evm-version=$EVM $SOLTEST_FLAGS"
test "${OPTIMIZE}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --optimize" test "${OPTIMIZE}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --optimize"
test "${ABI_ENCODER_V2}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --abiencoderv2" test "${ABI_ENCODER_V1}" = "1" && SOLTEST_ARGS="${SOLTEST_ARGS} --abiencoderv1"
echo "Running ${REPODIR}/build/test/soltest ${BOOST_TEST_ARGS} -- ${SOLTEST_ARGS}" echo "Running ${REPODIR}/build/test/soltest ${BOOST_TEST_ARGS} -- ${SOLTEST_ARGS}"

View File

@ -58,11 +58,11 @@ echo "Running steps $RUN_STEPS..."
STEP=1 STEP=1
# Run SMTChecker tests separately, as the heaviest expected run. # Run SMTChecker tests separately, as the heaviest expected run.
[[ " $RUN_STEPS " =~ " $STEP " ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V2=1 BOOST_TEST_ARGS="-t smtCheckerTests/*" "${REPODIR}/.circleci/soltest.sh" [[ " $RUN_STEPS " =~ " $STEP " ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t smtCheckerTests/*" "${REPODIR}/.circleci/soltest.sh"
STEP=$(($STEP + 1)) STEP=$(($STEP + 1))
# Run without SMTChecker tests. # Run without SMTChecker tests.
[[ " $RUN_STEPS " =~ " $STEP " ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V2=1 BOOST_TEST_ARGS="-t !smtCheckerTests" "${REPODIR}/.circleci/soltest.sh" [[ " $RUN_STEPS " =~ " $STEP " ]] && EVM=istanbul OPTIMIZE=1 ABI_ENCODER_V1=1 BOOST_TEST_ARGS="-t !smtCheckerTests" "${REPODIR}/.circleci/soltest.sh"
STEP=$(($STEP + 1)) STEP=$(($STEP + 1))
for OPTIMIZE in ${OPTIMIZE_VALUES[@]} for OPTIMIZE in ${OPTIMIZE_VALUES[@]}

View File

@ -8,6 +8,7 @@ Breaking Changes:
* Command Line Interface: JSON fields `abi`, `devdoc`, `userdoc` and `storage-layout` are now sub-objects rather than strings. * Command Line Interface: JSON fields `abi`, `devdoc`, `userdoc` and `storage-layout` are now sub-objects rather than strings.
* Command Line Interface: Remove the ``--old-reporter`` option. * Command Line Interface: Remove the ``--old-reporter`` option.
* Command Line Interface: Remove the legacy ``--ast-json`` option. Only the ``--ast-compact-json`` option is supported now. * Command Line Interface: Remove the legacy ``--ast-json`` option. Only the ``--ast-compact-json`` option is supported now.
* General: Enable ABI coder v2 by default.
* General: Remove global functions ``log0``, ``log1``, ``log2``, ``log3`` and ``log4``. * General: Remove global functions ``log0``, ``log1``, ``log2``, ``log3`` and ``log4``.
* Parser: Exponentiation is right associative. ``a**b**c`` is parsed as ``a**(b**c)``. * Parser: Exponentiation is right associative. ``a**b**c`` is parsed as ``a**(b**c)``.
* Scanner: Remove support for the ``\b``, ``\f``, and ``\v`` escape sequences. * Scanner: Remove support for the ``\b``, ``\f``, and ``\v`` escape sequences.

View File

@ -19,6 +19,17 @@ the compiler notifying you about it.
Checks for overflow are very common, so we made them the default to increase readability of code, Checks for overflow are very common, so we made them the default to increase readability of code,
even if it comes at a slight increase of gas costs. even if it comes at a slight increase of gas costs.
* ABI coder v2 is activated by default.
You can choose to use the old behaviour using ``pragma abicoder v1;``.
The pragma ``pragma experimental ABIEncoderV2;`` is still valid, but it is deprecated and has no effect.
If you want to be explicit, please use ``pragma abicoder v2;`` instead.
Note that ABI coder v2 supports more types than v1 and performs more sanity checks on the inputs.
ABI coder v2 makes some function calls more expensive and it can also make contract calls
revert that did not revert with ABI coder v1 when they contain data that does not conform to the
parameter types.
* Exponentiation is right associative, i.e., the expression ``a**b**c`` is parsed as ``a**(b**c)``. * Exponentiation is right associative, i.e., the expression ``a**b**c`` is parsed as ``a**(b**c)``.
Before 0.8.0, it was parsed as ``(a**b)**c``. Before 0.8.0, it was parsed as ``(a**b)**c``.

View File

@ -74,7 +74,7 @@ void SyntaxChecker::endVisit(SourceUnit const& _sourceUnit)
m_errorReporter.warning(3420_error, {-1, -1, _sourceUnit.location().source}, errorString); m_errorReporter.warning(3420_error, {-1, -1, _sourceUnit.location().source}, errorString);
} }
if (!m_sourceUnit->annotation().useABICoderV2.set()) if (!m_sourceUnit->annotation().useABICoderV2.set())
m_sourceUnit->annotation().useABICoderV2 = false; m_sourceUnit->annotation().useABICoderV2 = true;
m_sourceUnit = nullptr; m_sourceUnit = nullptr;
} }

View File

@ -90,19 +90,19 @@ for optimize in "" "--optimize"
do do
for vm in $EVM_VERSIONS for vm in $EVM_VERSIONS
do do
FORCE_ABIV2_RUNS="no" FORCE_ABIV1_RUNS="no"
if [[ "$vm" == "istanbul" ]] if [[ "$vm" == "istanbul" ]]
then then
FORCE_ABIV2_RUNS="no yes" # run both in istanbul FORCE_ABIV1_RUNS="no yes" # run both in istanbul
fi fi
for abiv2 in $FORCE_ABIV2_RUNS for abiv1 in $FORCE_ABIV1_RUNS
do do
force_abiv2_flag="" force_abiv1_flag=""
if [[ "$abiv2" == "yes" ]] if [[ "$abiv1" == "yes" ]]
then then
force_abiv2_flag="--abiencoderv2" force_abiv1_flag="--abiencoderv1"
fi fi
printTask "--> Running tests using "$optimize" --evm-version "$vm" $force_abiv2_flag..." printTask "--> Running tests using "$optimize" --evm-version "$vm" $force_abiv1_flag..."
log="" log=""
if [ -n "$log_directory" ] if [ -n "$log_directory" ]
@ -119,7 +119,7 @@ do
[ "${vm}" = "byzantium" ] && [ "${optimize}" = "" ] && EWASM_ARGS="--ewasm" [ "${vm}" = "byzantium" ] && [ "${optimize}" = "" ] && EWASM_ARGS="--ewasm"
set +e set +e
"${SOLIDITY_BUILD_DIR}"/test/soltest --show-progress $log -- ${EWASM_ARGS} --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$vm" $SMT_FLAGS $force_abiv2_flag "${SOLIDITY_BUILD_DIR}"/test/soltest --show-progress $log -- ${EWASM_ARGS} --testpath "$REPO_ROOT"/test "$optimize" --evm-version "$vm" $SMT_FLAGS $force_abiv1_flag
if test "0" -ne "$?"; then if test "0" -ne "$?"; then
exit 1 exit 1

View File

@ -98,7 +98,7 @@ CommonOptions::CommonOptions(std::string _caption):
("no-smt", po::bool_switch(&disableSMT), "disable SMT checker") ("no-smt", po::bool_switch(&disableSMT), "disable SMT checker")
("optimize", po::bool_switch(&optimize), "enables optimization") ("optimize", po::bool_switch(&optimize), "enables optimization")
("enforce-via-yul", po::bool_switch(&enforceViaYul), "Enforce compiling all tests via yul to see if additional tests can be activated.") ("enforce-via-yul", po::bool_switch(&enforceViaYul), "Enforce compiling all tests via yul to see if additional tests can be activated.")
("abiencoderv2", po::bool_switch(&useABIEncoderV2), "enables abi encoder v2") ("abiencoderv1", po::bool_switch(&useABIEncoderV1), "enables abi encoder v1")
("show-messages", po::bool_switch(&showMessages), "enables message output") ("show-messages", po::bool_switch(&showMessages), "enables message output")
("show-metadata", po::bool_switch(&showMetadata), "enables metadata output"); ("show-metadata", po::bool_switch(&showMetadata), "enables metadata output");
} }

View File

@ -57,7 +57,7 @@ struct CommonOptions: boost::noncopyable
bool optimize = false; bool optimize = false;
bool enforceViaYul = false; bool enforceViaYul = false;
bool disableSMT = false; bool disableSMT = false;
bool useABIEncoderV2 = false; bool useABIEncoderV1 = false;
bool showMessages = false; bool showMessages = false;
bool showMetadata = false; bool showMetadata = false;

View File

@ -1 +1 @@
{"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"immutableReferences":{"6":[{"length":32,"start":77}]}}}}}},"sources":{"a.sol":{"id":0}}} {"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"immutableReferences":{"6":[{"length":32,"start":75}]}}}}}},"sources":{"a.sol":{"id":0}}}

View File

@ -468,7 +468,7 @@ BOOST_AUTO_TEST_CASE(creation)
{ {
deployWallet(200); deployWallet(200);
BOOST_REQUIRE(callContractFunction("isOwner(address)", m_sender) == encodeArgs(true)); BOOST_REQUIRE(callContractFunction("isOwner(address)", m_sender) == encodeArgs(true));
bool v2 = solidity::test::CommonOptions::get().useABIEncoderV2; bool v2 = !solidity::test::CommonOptions::get().useABIEncoderV1;
BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(~0)) == (v2 ? encodeArgs() : encodeArgs(false))); BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(~0)) == (v2 ? encodeArgs() : encodeArgs(false)));
} }

View File

@ -37,17 +37,6 @@ namespace solidity::frontend::test
BOOST_FIXTURE_TEST_SUITE(ABIDecoderTest, SolidityExecutionFramework) BOOST_FIXTURE_TEST_SUITE(ABIDecoderTest, SolidityExecutionFramework)
BOOST_AUTO_TEST_CASE(both_encoders_macro)
{
// This tests that the "both decoders macro" at least runs twice and
// modifies the source.
string sourceCode;
int runs = 0;
BOTH_ENCODERS(runs++;)
BOOST_CHECK(sourceCode == NewEncoderPragma);
BOOST_CHECK_EQUAL(runs, 2);
}
BOOST_AUTO_TEST_CASE(value_types) BOOST_AUTO_TEST_CASE(value_types)
{ {
string sourceCode = R"( string sourceCode = R"(
@ -334,7 +323,7 @@ BOOST_AUTO_TEST_CASE(validation_function_type)
function i(function () external[] calldata a) external pure returns (uint r) { a[0]; r = 4; } function i(function () external[] calldata a) external pure returns (uint r) { a[0]; r = 4; }
} }
)"; )";
bool newDecoder = solidity::test::CommonOptions::get().useABIEncoderV2; bool newDecoder = false;
string validFun{"01234567890123456789abcd"}; string validFun{"01234567890123456789abcd"};
string invalidFun{"01234567890123456789abcdX"}; string invalidFun{"01234567890123456789abcdX"};
BOTH_ENCODERS( BOTH_ENCODERS(

View File

@ -48,17 +48,6 @@ namespace solidity::frontend::test
BOOST_FIXTURE_TEST_SUITE(ABIEncoderTest, SolidityExecutionFramework) BOOST_FIXTURE_TEST_SUITE(ABIEncoderTest, SolidityExecutionFramework)
BOOST_AUTO_TEST_CASE(both_encoders_macro)
{
// This tests that the "both encoders macro" at least runs twice and
// modifies the source.
string sourceCode;
int runs = 0;
BOTH_ENCODERS(runs++;)
BOOST_CHECK(sourceCode == NewEncoderPragma);
BOOST_CHECK_EQUAL(runs, 2);
}
BOOST_AUTO_TEST_CASE(value_types) BOOST_AUTO_TEST_CASE(value_types)
{ {
string sourceCode = R"( string sourceCode = R"(
@ -166,7 +155,7 @@ BOOST_AUTO_TEST_CASE(memory_array_one_dim)
} }
)"; )";
if (!solidity::test::CommonOptions::get().useABIEncoderV2) if (solidity::test::CommonOptions::get().useABIEncoderV1)
{ {
compileAndRun(sourceCode); compileAndRun(sourceCode);
callContractFunction("f()"); callContractFunction("f()");
@ -174,9 +163,11 @@ BOOST_AUTO_TEST_CASE(memory_array_one_dim)
REQUIRE_LOG_DATA(encodeArgs(10, 0x60, 11, 3, u256("0xfffffffe"), u256("0xffffffff"), u256("0x100000000"))); REQUIRE_LOG_DATA(encodeArgs(10, 0x60, 11, 3, u256("0xfffffffe"), u256("0xffffffff"), u256("0x100000000")));
} }
compileAndRun(NewEncoderPragma + sourceCode); NEW_ENCODER(
callContractFunction("f()"); compileAndRun(sourceCode);
REQUIRE_LOG_DATA(encodeArgs(10, 0x60, 11, 3, u256(-2), u256(-1), u256(0))); callContractFunction("f()");
REQUIRE_LOG_DATA(encodeArgs(10, 0x60, 11, 3, u256(-2), u256(-1), u256(0)));
)
} }
BOOST_AUTO_TEST_CASE(memory_array_two_dim) BOOST_AUTO_TEST_CASE(memory_array_two_dim)

View File

@ -21,17 +21,25 @@
namespace solidity::frontend::test namespace solidity::frontend::test
{ {
static std::string const NewEncoderPragma = "pragma experimental ABIEncoderV2;\n";
#define NEW_ENCODER(CODE) \ #define NEW_ENCODER(CODE) \
{ \ { \
sourceCode = NewEncoderPragma + sourceCode; \ string sourceCodeTmp = sourceCode; \
sourceCode = "pragma abicoder v2;\n" + sourceCode; \
{ CODE } \ { CODE } \
sourceCode = sourceCodeTmp; \
}
#define OLD_ENCODER(CODE) \
{ \
string sourceCodeTmp = sourceCode; \
sourceCode = "pragma abicoder v1;\n" + sourceCode; \
{ CODE } \
sourceCode = sourceCodeTmp; \
} }
#define BOTH_ENCODERS(CODE) \ #define BOTH_ENCODERS(CODE) \
{ \ { \
{ CODE } \ OLD_ENCODER(CODE) \
NEW_ENCODER(CODE) \ NEW_ENCODER(CODE) \
} }

View File

@ -158,6 +158,7 @@ BOOST_AUTO_TEST_SUITE(Assembly)
BOOST_AUTO_TEST_CASE(location_test) BOOST_AUTO_TEST_CASE(location_test)
{ {
auto sourceCode = make_shared<CharStream>(R"( auto sourceCode = make_shared<CharStream>(R"(
pragma abicoder v1;
contract test { contract test {
function f() public returns (uint256 a) { function f() public returns (uint256 a) {
return 16; return 16;
@ -172,18 +173,18 @@ BOOST_AUTO_TEST_CASE(location_test)
vector<SourceLocation> locations; vector<SourceLocation> locations;
if (solidity::test::CommonOptions::get().optimize) if (solidity::test::CommonOptions::get().optimize)
locations = locations =
vector<SourceLocation>(31, SourceLocation{2, 82, sourceCode}) + vector<SourceLocation>(31, SourceLocation{23, 103, sourceCode}) +
vector<SourceLocation>(21, SourceLocation{20, 79, sourceCode}) + vector<SourceLocation>(21, SourceLocation{41, 100, sourceCode}) +
vector<SourceLocation>(1, SourceLocation{72, 74, sourceCode}) + vector<SourceLocation>(1, SourceLocation{93, 95, sourceCode}) +
vector<SourceLocation>(2, SourceLocation{20, 79, sourceCode}); vector<SourceLocation>(2, SourceLocation{41, 100, sourceCode});
else else
locations = locations =
vector<SourceLocation>(hasShifts ? 31 : 32, SourceLocation{2, 82, sourceCode}) + vector<SourceLocation>(hasShifts ? 31 : 32, SourceLocation{23, 103, sourceCode}) +
vector<SourceLocation>(24, SourceLocation{20, 79, sourceCode}) + vector<SourceLocation>(24, SourceLocation{41, 100, sourceCode}) +
vector<SourceLocation>(1, SourceLocation{49, 58, sourceCode}) + vector<SourceLocation>(1, SourceLocation{70, 79, sourceCode}) +
vector<SourceLocation>(1, SourceLocation{72, 74, sourceCode}) + vector<SourceLocation>(1, SourceLocation{93, 95, sourceCode}) +
vector<SourceLocation>(2, SourceLocation{65, 74, sourceCode}) + vector<SourceLocation>(2, SourceLocation{86, 95, sourceCode}) +
vector<SourceLocation>(2, SourceLocation{20, 79, sourceCode}); vector<SourceLocation>(2, SourceLocation{41, 100, sourceCode});
checkAssemblyLocations(items, locations); checkAssemblyLocations(items, locations);
} }
@ -191,6 +192,7 @@ BOOST_AUTO_TEST_CASE(location_test)
BOOST_AUTO_TEST_CASE(jump_type) BOOST_AUTO_TEST_CASE(jump_type)
{ {
auto sourceCode = make_shared<CharStream>(R"( auto sourceCode = make_shared<CharStream>(R"(
pragma abicoder v1;
contract C { contract C {
function f(uint a) public pure returns (uint t) { function f(uint a) public pure returns (uint t) {
assembly { assembly {

View File

@ -97,9 +97,14 @@ BOOST_AUTO_TEST_CASE(string_storage)
auto evmVersion = solidity::test::CommonOptions::get().evmVersion(); auto evmVersion = solidity::test::CommonOptions::get().evmVersion();
if (evmVersion <= EVMVersion::byzantium()) if (evmVersion <= EVMVersion::byzantium())
CHECK_DEPLOY_GAS(133045, 129731, evmVersion); {
if (CommonOptions::get().useABIEncoderV1)
CHECK_DEPLOY_GAS(133045, 129731, evmVersion);
else
CHECK_DEPLOY_GAS(152657, 135201, evmVersion);
}
// This is only correct on >=Constantinople. // This is only correct on >=Constantinople.
else if (CommonOptions::get().useABIEncoderV2) else if (!CommonOptions::get().useABIEncoderV1)
{ {
if (CommonOptions::get().optimize) if (CommonOptions::get().optimize)
{ {
@ -126,9 +131,9 @@ BOOST_AUTO_TEST_CASE(string_storage)
{ {
callContractFunction("f()"); callContractFunction("f()");
if (evmVersion == EVMVersion::byzantium()) if (evmVersion == EVMVersion::byzantium())
CHECK_GAS(21545, 21526, 20); CHECK_GAS(21712, 21555, 20);
// This is only correct on >=Constantinople. // This is only correct on >=Constantinople.
else if (CommonOptions::get().useABIEncoderV2) else if (!CommonOptions::get().useABIEncoderV1)
{ {
if (CommonOptions::get().optimize) if (CommonOptions::get().optimize)
{ {

View File

@ -62,9 +62,9 @@ public:
// costs for transaction // costs for transaction
gas += gasForTransaction(m_compiler.object(m_compiler.lastContractName()).bytecode, true); gas += gasForTransaction(m_compiler.object(m_compiler.lastContractName()).bytecode, true);
// Skip the tests when we force ABIEncoderV2. // Skip the tests when we use ABIEncoderV2.
// TODO: We should enable this again once the yul optimizer is activated. // TODO: We should enable this again once the yul optimizer is activated.
if (!solidity::test::CommonOptions::get().useABIEncoderV2) if (solidity::test::CommonOptions::get().useABIEncoderV1)
{ {
BOOST_REQUIRE(!gas.isInfinite); BOOST_REQUIRE(!gas.isInfinite);
BOOST_CHECK_LE(m_gasUsed, gas.value); BOOST_CHECK_LE(m_gasUsed, gas.value);
@ -91,9 +91,9 @@ public:
*m_compiler.runtimeAssemblyItems(m_compiler.lastContractName()), *m_compiler.runtimeAssemblyItems(m_compiler.lastContractName()),
_sig _sig
); );
// Skip the tests when we force ABIEncoderV2. // Skip the tests when we use ABIEncoderV2.
// TODO: We should enable this again once the yul optimizer is activated. // TODO: We should enable this again once the yul optimizer is activated.
if (!solidity::test::CommonOptions::get().useABIEncoderV2) if (solidity::test::CommonOptions::get().useABIEncoderV1)
{ {
BOOST_REQUIRE(!gas.isInfinite); BOOST_REQUIRE(!gas.isInfinite);
BOOST_CHECK_LE(m_gasUsed, gas.value); BOOST_CHECK_LE(m_gasUsed, gas.value);

View File

@ -88,7 +88,7 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer
m_runWithEwasm = false; m_runWithEwasm = false;
m_runWithABIEncoderV1Only = m_reader.boolSetting("ABIEncoderV1Only", false); m_runWithABIEncoderV1Only = m_reader.boolSetting("ABIEncoderV1Only", false);
if (m_runWithABIEncoderV1Only && solidity::test::CommonOptions::get().useABIEncoderV2) if (m_runWithABIEncoderV1Only && !solidity::test::CommonOptions::get().useABIEncoderV1)
m_shouldRun = false; m_shouldRun = false;
auto revertStrings = revertStringsFromString(m_reader.stringSetting("revertStrings", "default")); auto revertStrings = revertStringsFromString(m_reader.stringSetting("revertStrings", "default"));

View File

@ -136,10 +136,10 @@ string SolidityExecutionFramework::addPreamble(string const& _sourceCode)
// Silence compiler version warning // Silence compiler version warning
string preamble = "pragma solidity >=0.0;\n// SPDX-License-Identifier: unlicensed\n"; string preamble = "pragma solidity >=0.0;\n// SPDX-License-Identifier: unlicensed\n";
if ( if (
solidity::test::CommonOptions::get().useABIEncoderV2 && solidity::test::CommonOptions::get().useABIEncoderV1 &&
_sourceCode.find("pragma experimental ABIEncoderV2;") == string::npos && _sourceCode.find("pragma experimental ABIEncoderV2;") == string::npos &&
_sourceCode.find("pragma abicoder") == string::npos _sourceCode.find("pragma abicoder") == string::npos
) )
preamble += "pragma abicoder v2;\n"; preamble += "pragma abicoder v1;\n";
return preamble + _sourceCode; return preamble + _sourceCode;
} }

View File

@ -69,8 +69,8 @@ public:
std::map<std::string, solidity::test::Address> const& _libraryAddresses = {} std::map<std::string, solidity::test::Address> const& _libraryAddresses = {}
); );
/// Returns @param _sourceCode prefixed with the version pragma and the ABIEncoderV2 pragma, /// Returns @param _sourceCode prefixed with the version pragma and the abi coder v1 pragma,
/// the latter only if it is required. /// the latter only if it is forced.
static std::string addPreamble(std::string const& _sourceCode); static std::string addPreamble(std::string const& _sourceCode);
protected: protected:

View File

@ -13,8 +13,8 @@ contract C {
} }
// ---- // ----
// creation: // creation:
// codeDepositCost: 257000 // codeDepositCost: 376800
// executionCost: 300 // executionCost: 411
// totalCost: 257300 // totalCost: 377211
// external: // external:
// f(): 252 // f(): 399

View File

@ -24,29 +24,29 @@ contract Large {
} }
// ---- // ----
// creation: // creation:
// codeDepositCost: 961600 // codeDepositCost: 913400
// executionCost: 1001 // executionCost: 948
// totalCost: 962601 // totalCost: 914348
// external: // external:
// a(): 1051 // a(): 1175
// b(uint256): 2046 // b(uint256): infinite
// f0(uint256): 427 // f0(uint256): infinite
// f1(uint256): 41352 // f1(uint256): infinite
// f2(uint256): 21293 // f2(uint256): infinite
// f3(uint256): 21381 // f3(uint256): infinite
// f4(uint256): 21359 // f4(uint256): infinite
// f5(uint256): 21337 // f5(uint256): infinite
// f6(uint256): 21360 // f6(uint256): infinite
// f7(uint256): 21272 // f7(uint256): infinite
// f8(uint256): 21272 // f8(uint256): infinite
// f9(uint256): 21294 // f9(uint256): infinite
// g0(uint256): 313 // g0(uint256): infinite
// g1(uint256): 41307 // g1(uint256): infinite
// g2(uint256): 21270 // g2(uint256): infinite
// g3(uint256): 21358 // g3(uint256): infinite
// g4(uint256): 21336 // g4(uint256): infinite
// g5(uint256): 21292 // g5(uint256): infinite
// g6(uint256): 21315 // g6(uint256): infinite
// g7(uint256): 21314 // g7(uint256): infinite
// g8(uint256): 21292 // g8(uint256): infinite
// g9(uint256): 21249 // g9(uint256): infinite

View File

@ -27,29 +27,29 @@ contract Large {
// optimize-runs: 2 // optimize-runs: 2
// ---- // ----
// creation: // creation:
// codeDepositCost: 301200 // codeDepositCost: 270600
// executionCost: 343 // executionCost: 312
// totalCost: 301543 // totalCost: 270912
// external: // external:
// a(): 998 // a(): 1028
// b(uint256): 2305 // b(uint256): 2370
// f0(uint256): 334 // f0(uint256): 399
// f1(uint256): 41474 // f1(uint256): 41539
// f2(uint256): 21540 // f2(uint256): 21605
// f3(uint256): 21628 // f3(uint256): 21693
// f4(uint256): 21606 // f4(uint256): 21671
// f5(uint256): 21584 // f5(uint256): 21649
// f6(uint256): 21496 // f6(uint256): 21561
// f7(uint256): 21276 // f7(uint256): 21341
// f8(uint256): 21408 // f8(uint256): 21473
// f9(uint256): 21430 // f9(uint256): 21495
// g0(uint256): 574 // g0(uint256): 639
// g1(uint256): 41186 // g1(uint256): 41251
// g2(uint256): 21274 // g2(uint256): 21339
// g3(uint256): 21362 // g3(uint256): 21427
// g4(uint256): 21340 // g4(uint256): 21405
// g5(uint256): 21428 // g5(uint256): 21493
// g6(uint256): 21208 // g6(uint256): 21273
// g7(uint256): 21318 // g7(uint256): 21383
// g8(uint256): 21296 // g8(uint256): 21361
// g9(uint256): 21142 // g9(uint256): 21207

View File

@ -11,16 +11,16 @@ contract Medium {
} }
// ---- // ----
// creation: // creation:
// codeDepositCost: 361800 // codeDepositCost: 360400
// executionCost: 399 // executionCost: 399
// totalCost: 362199 // totalCost: 360799
// external: // external:
// a(): 1028 // a(): 1152
// b(uint256): 2046 // b(uint256): infinite
// f1(uint256): 41263 // f1(uint256): infinite
// f2(uint256): 21293 // f2(uint256): infinite
// f3(uint256): 21337 // f3(uint256): infinite
// g0(uint256): 313 // g0(uint256): infinite
// g7(uint256): 21292 // g7(uint256): infinite
// g8(uint256): 21270 // g8(uint256): infinite
// g9(uint256): 21226 // g9(uint256): infinite

View File

@ -14,16 +14,16 @@ contract Medium {
// optimize-runs: 2 // optimize-runs: 2
// ---- // ----
// creation: // creation:
// codeDepositCost: 169600 // codeDepositCost: 161000
// executionCost: 214 // executionCost: 208
// totalCost: 169814 // totalCost: 161208
// external: // external:
// a(): 998 // a(): 1028
// b(uint256): 2063 // b(uint256): 2128
// f1(uint256): 41254 // f1(uint256): 41319
// f2(uint256): 21298 // f2(uint256): 21363
// f3(uint256): 21342 // f3(uint256): 21407
// g0(uint256): 332 // g0(uint256): 397
// g7(uint256): 21208 // g7(uint256): 21273
// g8(uint256): 21186 // g8(uint256): 21251
// g9(uint256): 21142 // g9(uint256): 21207

View File

@ -6,11 +6,11 @@ contract Small {
} }
// ---- // ----
// creation: // creation:
// codeDepositCost: 103400 // codeDepositCost: 123600
// executionCost: 153 // executionCost: 171
// totalCost: 103553 // totalCost: 123771
// external: // external:
// fallback: 129 // fallback: 129
// a(): 983 // a(): 1107
// b(uint256): 2002 // b(uint256): infinite
// f1(uint256): 41263 // f1(uint256): infinite

View File

@ -9,11 +9,11 @@ contract Small {
// optimize-runs: 2 // optimize-runs: 2
// ---- // ----
// creation: // creation:
// codeDepositCost: 72800 // codeDepositCost: 76200
// executionCost: 123 // executionCost: 123
// totalCost: 72923 // totalCost: 76323
// external: // external:
// fallback: 118 // fallback: 118
// a(): 976 // a(): 1006
// b(uint256): 1953 // b(uint256): 2018
// f1(uint256): 41188 // f1(uint256): 41253

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
struct Item { struct Item {
uint x; uint x;
uint y; uint y;

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
struct Item { struct Item {
uint x; uint x;
uint y; uint y;
@ -13,5 +14,5 @@ contract D {
} }
} }
// ---- // ----
// TypeError 7364: (202-240): Different number of components on the left hand side (1) than on the right hand side (2). // TypeError 7364: (222-260): Different number of components on the left hand side (1) than on the right hand side (2).
// TypeError 9574: (202-240): Type uint256 is not implicitly convertible to expected type struct Item memory. // TypeError 9574: (222-260): Type uint256 is not implicitly convertible to expected type struct Item memory.

View File

@ -9,6 +9,7 @@ library L {
function set(Item storage _item) external view {} function set(Item storage _item) external view {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract Test { contract Test {

View File

@ -9,6 +9,7 @@ contract C {
constructor(Item memory _item) {} constructor(Item memory _item) {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract Test { contract Test {
@ -17,4 +18,4 @@ contract Test {
} }
} }
// ---- // ----
// TypeError 2443: (B:71-80): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 2443: (B:91-100): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ contract C {
function set(uint _x, string memory _y, Item memory _item, bool _z) external view {} function set(uint _x, string memory _y, Item memory _item, bool _z) external view {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract Test { contract Test {
@ -17,4 +18,4 @@ contract Test {
} }
} }
// ---- // ----
// TypeError 2443: (B:99-109): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 2443: (B:119-129): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ contract C {
function get(Item memory _item) external {} function get(Item memory _item) external {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract Test { contract Test {
@ -19,4 +20,4 @@ contract Test {
} }
} }
// ---- // ----
// TypeError 2443: (B:146-155): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 2443: (B:166-175): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -5,6 +5,7 @@ contract C {
function f() external view returns (string[] memory) {} function f() external view returns (string[] memory) {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract D { contract D {
@ -13,4 +14,4 @@ contract D {
} }
} }
// ---- // ----
// TypeError 2428: (B:65-85): The type of return parameter 1, string[], is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 2428: (B:85-105): The type of return parameter 1, string[], is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ contract C {
function get() external view returns(Item memory) {} function get() external view returns(Item memory) {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract Test { contract Test {
@ -17,4 +18,4 @@ contract Test {
} }
} }
// ---- // ----
// TypeError 2428: (B:70-92): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 2428: (B:90-112): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ contract C {
function get() external view returns(Item memory) {} function get() external view returns(Item memory) {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract Test { contract Test {
@ -17,4 +18,4 @@ contract Test {
} }
} }
// ---- // ----
// TypeError 2428: (B:70-92): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 2428: (B:90-112): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -8,6 +8,7 @@ library L {
event E(Item _value); event E(Item _value);
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract Test { contract Test {
@ -16,4 +17,4 @@ contract Test {
} }
} }
// ---- // ----
// TypeError 2443: (B:74-84): The type of this parameter, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 2443: (B:94-104): The type of this parameter, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ library L {
function f(uint) external view returns (Item memory) {} function f(uint) external view returns (Item memory) {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract D { contract D {
@ -19,4 +20,4 @@ contract D {
} }
} }
// ---- // ----
// TypeError 2428: (B:86-97): The type of return parameter 1, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 2428: (B:106-117): The type of return parameter 1, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ library L {
function get(Item storage _item) external view {} function get(Item storage _item) external view {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract Test { contract Test {

View File

@ -9,6 +9,7 @@ library L {
function get() external view returns(Item memory) {} function get() external view returns(Item memory) {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract Test { contract Test {
@ -17,4 +18,4 @@ contract Test {
} }
} }
// ---- // ----
// TypeError 2428: (B:70-77): The type of return parameter 1, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 2428: (B:90-97): The type of return parameter 1, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -16,6 +16,7 @@ contract B {
} }
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract C is B { contract C is B {

View File

@ -21,10 +21,12 @@ contract B {
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract C is B {} contract C is B {}
==== Source: C ==== ==== Source: C ====
pragma abicoder v1;
import "B"; import "B";
contract D is C { contract D is C {

View File

@ -19,6 +19,7 @@ contract B {
} }
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract C is B {} contract C is B {}

View File

@ -9,6 +9,7 @@ contract C {
event Ev(Item); event Ev(Item);
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract D is C {} contract D is C {}

View File

@ -9,8 +9,9 @@ contract C {
function get(Item memory) external view {} function get(Item memory) external view {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract D is C {} contract D is C {}
// ---- // ----
// TypeError 6594: (B:13-31): Contract "D" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature. // TypeError 6594: (B:33-51): Contract "D" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.

View File

@ -9,8 +9,9 @@ contract C {
function get() external view returns(Item memory) {} function get() external view returns(Item memory) {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract D is C {} contract D is C {}
// ---- // ----
// TypeError 6594: (B:13-31): Contract "D" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature. // TypeError 6594: (B:33-51): Contract "D" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.

View File

@ -15,6 +15,7 @@ contract C {
} }
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract D is C {} contract D is C {}

View File

@ -17,6 +17,7 @@ contract B {
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract C is B { contract C is B {

View File

@ -1,4 +1,5 @@
==== Source: C ==== ==== Source: C ====
pragma abicoder v1;
import "X"; import "X";
import "V1A"; import "V1A";
import "V2A"; import "V2A";
@ -14,6 +15,7 @@ contract C is V1A, V2A, V1B {
} }
} }
==== Source: V1A ==== ==== Source: V1A ====
pragma abicoder v1;
import "X"; import "X";
contract V1A { contract V1A {
@ -22,6 +24,7 @@ contract V1A {
} }
} }
==== Source: V1B ==== ==== Source: V1B ====
pragma abicoder v1;
import "X"; import "X";
contract V1B { contract V1B {

View File

@ -9,6 +9,7 @@ contract A {
function get() public view returns (Data memory) {} function get() public view returns (Data memory) {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract B { contract B {
@ -18,6 +19,7 @@ contract B {
} }
} }
==== Source: C ==== ==== Source: C ====
pragma abicoder v1;
import "B"; import "B";
contract C is B { contract C is B {
@ -27,4 +29,4 @@ contract C is B {
{} {}
} }
// ---- // ----
// TypeError 2428: (B:60-82): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 2428: (B:80-102): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -9,6 +9,7 @@ contract A {
function get() public view returns (Data memory) {} function get() public view returns (Data memory) {}
} }
==== Source: B ==== ==== Source: B ====
pragma abicoder v1;
import "A"; import "A";
contract B { contract B {
@ -29,4 +30,4 @@ contract C is B {
{} {}
} }
// ---- // ----
// TypeError 2428: (B:60-82): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 2428: (B:80-102): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,7 +1,8 @@
pragma abicoder v1;
contract Test { contract Test {
function f(uint[][] calldata) external { } function f(uint[][] calldata) external { }
function g(uint[][1] calldata) external { } function g(uint[][1] calldata) external { }
} }
// ---- // ----
// TypeError 4957: (31-48): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 4957: (51-68): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
// TypeError 4957: (78-96): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 4957: (98-116): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,5 +1,6 @@
pragma abicoder v1;
contract C { contract C {
constructor(uint[][][] memory t) {} constructor(uint[][][] memory t) {}
} }
// ---- // ----
// TypeError 4957: (26-45): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. Alternatively, make the contract abstract and supply the constructor arguments from a derived contract. // TypeError 4957: (46-65): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. Alternatively, make the contract abstract and supply the constructor arguments from a derived contract.

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
abstract contract C { abstract contract C {
constructor(uint[][][] memory t) {} constructor(uint[][][] memory t) {}
} }

View File

@ -1,5 +1,6 @@
pragma abicoder v1;
contract c { contract c {
event E(uint[][]); event E(uint[][]);
} }
// ---- // ----
// TypeError 3061: (25-33): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 3061: (45-53): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,6 +1,7 @@
pragma abicoder v1;
contract c { contract c {
struct S { uint x; uint[][] arr; } struct S { uint x; uint[][] arr; }
event E(S); event E(S);
} }
// ---- // ----
// TypeError 3061: (61-62): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 3061: (81-82): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,6 +1,7 @@
pragma abicoder v1;
contract c { contract c {
struct S { uint a ; } struct S { uint a ; }
event E(S); event E(S);
} }
// ---- // ----
// TypeError 3061: (51-52): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 3061: (71-72): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,6 +1,7 @@
pragma abicoder v1;
contract c { contract c {
struct S { uint a ; } struct S { uint a ; }
event E(S indexed); event E(S indexed);
} }
// ---- // ----
// TypeError 3061: (51-60): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 3061: (71-80): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
contract C { contract C {
struct Y { struct Y {
uint b; uint b;
@ -8,4 +9,4 @@ contract C {
mapping(uint256 => X) public m; mapping(uint256 => X) public m;
} }
// ---- // ----
// TypeError 2763: (88-118): The following types are only supported for getters in ABI coder v2: struct C.Y memory. Either remove "public" or use "pragma abicoder v2;" to enable the feature. // TypeError 2763: (108-138): The following types are only supported for getters in ABI coder v2: struct C.Y memory. Either remove "public" or use "pragma abicoder v2;" to enable the feature.

View File

@ -13,7 +13,8 @@ pragma abicoder v2;
import "./A.sol"; import "./A.sol";
contract B is A { } contract B is A { }
==== Source: C.sol ==== ==== Source: C.sol ====
pragma abicoder v1;
import "./B.sol"; import "./B.sol";
contract C is B { } contract C is B { }
// ---- // ----
// TypeError 6594: (C.sol:18-37): Contract "C" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature. // TypeError 6594: (C.sol:38-57): Contract "C" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.

View File

@ -8,10 +8,12 @@ contract A
function f(S memory _s) public returns (S memory,S memory) { } function f(S memory _s) public returns (S memory,S memory) { }
} }
==== Source: B.sol ==== ==== Source: B.sol ====
pragma abicoder v1;
import "./A.sol"; import "./A.sol";
contract B is A { } contract B is A { }
==== Source: C.sol ==== ==== Source: C.sol ====
pragma abicoder v1;
import "./B.sol"; import "./B.sol";
contract C is B { } contract C is B { }
// ---- // ----
// TypeError 6594: (B.sol:18-37): Contract "B" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature. // TypeError 6594: (B.sol:38-57): Contract "B" does not use ABI coder v2 but wants to inherit from a contract which uses types that require it. Use "pragma abicoder v2;" for the inheriting contract as well to enable the feature.

View File

@ -1,5 +1,6 @@
pragma abicoder v1;
contract C { contract C {
function f() public pure returns (string[][] memory) {} function f() public pure returns (string[][] memory) {}
} }
// ---- // ----
// TypeError 4957: (51-68): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 4957: (71-88): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,5 +1,6 @@
pragma abicoder v1;
contract C { contract C {
function f() public pure returns (uint[][2] memory) {} function f() public pure returns (uint[][2] memory) {}
} }
// ---- // ----
// TypeError 4957: (51-67): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 4957: (71-87): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,6 +1,7 @@
pragma abicoder v1;
contract C { contract C {
struct S { string[] s; } struct S { string[] s; }
function f() public pure returns (S memory x) {} function f() public pure returns (S memory x) {}
} }
// ---- // ----
// TypeError 4957: (80-90): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature. // TypeError 4957: (100-110): This type is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
contract C { contract C {
struct s { uint a; uint b; } struct s { uint a; uint b; }
function f() pure public { function f() pure public {
@ -5,4 +6,4 @@ contract C {
} }
} }
// ---- // ----
// TypeError 9611: (98-99): Decoding type struct C.s memory not supported. // TypeError 9611: (118-119): Decoding type struct C.s memory not supported.

View File

@ -6,7 +6,7 @@ contract A {
} }
} }
// ---- // ----
// UnimplementedFeatureError: Not yet implemented - FixedPointType. // UnimplementedFeatureError: Fixed point types not implemented.
// Warning 5667: (52-60): Unused function parameter. Remove or comment out the variable name to silence this warning. // Warning 5667: (52-60): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning 5667: (62-74): Unused function parameter. Remove or comment out the variable name to silence this warning. // Warning 5667: (62-74): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning 2072: (93-104): Unused local variable. // Warning 2072: (93-104): Unused local variable.

View File

@ -1,7 +1,8 @@
pragma abicoder v1;
contract C { contract C {
function f() public pure { function f() public pure {
abi.encodePacked([new uint[](5), new uint[](7)]); abi.encodePacked([new uint[](5), new uint[](7)]);
} }
} }
// ---- // ----
// TypeError 9578: (69-99): Type not supported in packed mode. // TypeError 9578: (89-119): Type not supported in packed mode.

View File

@ -1,7 +1,8 @@
pragma abicoder v1;
contract C { contract C {
function test() public pure { function test() public pure {
abi.encode([new uint[](5), new uint[](7)]); abi.encode([new uint[](5), new uint[](7)]);
} }
} }
// ---- // ----
// TypeError 2056: (66-96): This type cannot be encoded. // TypeError 2056: (86-116): This type cannot be encoded.

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
contract C { contract C {
struct S { uint x; } struct S { uint x; }
S s; S s;
@ -11,7 +12,7 @@ contract C {
} }
} }
// ---- // ----
// TypeError 2056: (131-132): This type cannot be encoded. // TypeError 2056: (151-152): This type cannot be encoded.
// TypeError 2056: (134-135): This type cannot be encoded. // TypeError 2056: (154-155): This type cannot be encoded.
// TypeError 9578: (200-201): Type not supported in packed mode. // TypeError 9578: (220-221): Type not supported in packed mode.
// TypeError 9578: (203-204): Type not supported in packed mode. // TypeError 9578: (223-224): Type not supported in packed mode.

View File

@ -1,7 +1,8 @@
pragma abicoder v1;
contract C { contract C {
function f() public pure { function f() public pure {
abi.decode("1234", (uint[][3])); abi.decode("1234", (uint[][3]));
} }
} }
// ---- // ----
// TypeError 9611: (72-81): Decoding type uint256[] memory[3] memory not supported. // TypeError 9611: (92-101): Decoding type uint256[] memory[3] memory not supported.

View File

@ -1,3 +1,4 @@
pragma abicoder v1;
struct S { struct S {
uint x; uint x;
} }
@ -8,4 +9,4 @@ contract C {
} }
} }
// ---- // ----
// TypeError 9611: (98-99): Decoding type struct S memory not supported. // TypeError 9611: (118-119): Decoding type struct S memory not supported.