Merge pull request #7759 from ethereum/abiEncoderV2NoWarn

Do not warn about enabled ABIEncoderV2 anymore.
This commit is contained in:
chriseth 2019-11-26 16:14:31 +01:00 committed by GitHub
commit f4f1d6f238
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 31 additions and 67 deletions

View File

@ -34,6 +34,7 @@ Language Features:
Compiler Features: Compiler Features:
* Allow revert strings to be stripped from the binary using the ``--revert-strings`` option or the ``settings.debug.revertStrings`` setting. * Allow revert strings to be stripped from the binary using the ``--revert-strings`` option or the ``settings.debug.revertStrings`` setting.
* ABIEncoderV2: Do not warn about enabled ABIEncoderV2 anymore (the pragma is still needed, though).
### 0.5.14 (unreleased) ### 0.5.14 (unreleased)

View File

@ -106,7 +106,7 @@ bool SyntaxChecker::visit(PragmaDirective const& _pragma)
{ {
auto feature = ExperimentalFeatureNames.at(literal); auto feature = ExperimentalFeatureNames.at(literal);
m_sourceUnit->annotation().experimentalFeatures.insert(feature); m_sourceUnit->annotation().experimentalFeatures.insert(feature);
if (!ExperimentalFeatureOnlyAnalysis.count(feature)) if (!ExperimentalFeatureWithoutWarning.count(feature))
m_errorReporter.warning(_pragma.location(), "Experimental features are turned on. Do not use experimental features on live deployments."); m_errorReporter.warning(_pragma.location(), "Experimental features are turned on. Do not use experimental features on live deployments.");
} }
} }

View File

@ -21,6 +21,7 @@
#pragma once #pragma once
#include <map> #include <map>
#include <set>
namespace dev namespace dev
{ {
@ -35,10 +36,11 @@ enum class ExperimentalFeature
TestOnlyAnalysis TestOnlyAnalysis
}; };
static std::map<ExperimentalFeature, bool> const ExperimentalFeatureOnlyAnalysis = static std::set<ExperimentalFeature> const ExperimentalFeatureWithoutWarning =
{ {
{ ExperimentalFeature::SMTChecker, true }, ExperimentalFeature::ABIEncoderV2,
{ ExperimentalFeature::TestOnlyAnalysis, true }, ExperimentalFeature::SMTChecker,
ExperimentalFeature::TestOnlyAnalysis,
}; };
static std::map<std::string, ExperimentalFeature> const ExperimentalFeatureNames = static std::map<std::string, ExperimentalFeature> const ExperimentalFeatureNames =

View File

@ -982,7 +982,7 @@ namespace
bool onlySafeExperimentalFeaturesActivated(set<ExperimentalFeature> const& features) bool onlySafeExperimentalFeaturesActivated(set<ExperimentalFeature> const& features)
{ {
for (auto const feature: features) for (auto const feature: features)
if (!ExperimentalFeatureOnlyAnalysis.count(feature)) if (!ExperimentalFeatureWithoutWarning.count(feature))
return false; return false;
return true; return true;
} }

View File

@ -0,0 +1 @@
--hashes

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1,7 @@
pragma solidity >=0.0;
pragma experimental ABIEncoderV2;
contract C {
struct S { uint x; }
function f(S memory) public pure {
}
}

View File

@ -0,0 +1,4 @@
======= abiencoderv2_no_warning/input.sol:C =======
Function signatures:
3fc03eeb: f((uint256))

View File

@ -107,16 +107,16 @@ BOOST_AUTO_TEST_CASE(string_storage)
{ {
// Costs with 0 are cases which cannot be triggered in tests. // Costs with 0 are cases which cannot be triggered in tests.
if (evmVersion < EVMVersion::istanbul()) if (evmVersion < EVMVersion::istanbul())
CHECK_DEPLOY_GAS(0, 127721, evmVersion); CHECK_DEPLOY_GAS(0, 123969, evmVersion);
else else
CHECK_DEPLOY_GAS(0, 113993, evmVersion); CHECK_DEPLOY_GAS(0, 113993, evmVersion);
} }
else else
{ {
if (evmVersion < EVMVersion::istanbul()) if (evmVersion < EVMVersion::istanbul())
CHECK_DEPLOY_GAS(151523, 135371, evmVersion); CHECK_DEPLOY_GAS(147771, 131687, evmVersion);
else else
CHECK_DEPLOY_GAS(134883, 120083, evmVersion); CHECK_DEPLOY_GAS(131859, 117231, evmVersion);
} }
} }
else if (evmVersion < EVMVersion::istanbul()) else if (evmVersion < EVMVersion::istanbul())

View File

@ -14,9 +14,9 @@ contract C {
} }
// ---- // ----
// creation: // creation:
// codeDepositCost: 1122800 // codeDepositCost: 1120000
// executionCost: 1167 // executionCost: 1160
// totalCost: 1123967 // totalCost: 1121160
// external: // external:
// a(): 530 // a(): 530
// b(uint256): infinite // b(uint256): infinite

View File

@ -17,9 +17,9 @@ contract C {
// optimize-yul: true // optimize-yul: true
// ---- // ----
// creation: // creation:
// codeDepositCost: 608600 // codeDepositCost: 605800
// executionCost: 645 // executionCost: 638
// totalCost: 609245 // totalCost: 606438
// external: // external:
// a(): 429 // a(): 429
// b(uint256): 884 // b(uint256): 884

View File

@ -5,7 +5,6 @@ contract C {
} }
} }
// ---- // ----
// Warning: (31-64): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning: (162-165): Assertion checker does not yet implement type abi // Warning: (162-165): Assertion checker does not yet implement type abi
// Warning: (162-176): Assertion checker does not yet implement this type of function call. // Warning: (162-176): Assertion checker does not yet implement this type of function call.
// Warning: (178-181): Assertion checker does not yet implement type abi // Warning: (178-181): Assertion checker does not yet implement type abi

View File

@ -8,7 +8,6 @@ contract C {
} }
} }
// ---- // ----
// Warning: (32-67): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning: (151-159): Assertion checker does not yet support the type of this variable. // Warning: (151-159): Assertion checker does not yet support the type of this variable.
// Warning: (188-191): Assertion checker does not yet implement type abi // Warning: (188-191): Assertion checker does not yet implement type abi
// Warning: (207-208): Assertion checker does not yet implement type type(struct C.S storage pointer) // Warning: (207-208): Assertion checker does not yet implement type type(struct C.S storage pointer)

View File

@ -10,7 +10,6 @@ contract C {
} }
} }
// ---- // ----
// Warning: (32-67): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning: (125-132): Unused local variable. // Warning: (125-132): Unused local variable.
// Warning: (183-190): Unused local variable. // Warning: (183-190): Unused local variable.
// Warning: (136-139): Assertion checker does not yet implement type abi // Warning: (136-139): Assertion checker does not yet implement type abi

View File

@ -3,4 +3,3 @@ contract Test {
function f(uint[3] calldata) external { } function f(uint[3] calldata) external { }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -3,5 +3,4 @@ contract Test {
function f(uint256[] calldata s) external { s[0] = 4; } function f(uint256[] calldata s) external { s[0] = 4; }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (98-102): Calldata arrays are read-only. // TypeError: (98-102): Calldata arrays are read-only.

View File

@ -3,4 +3,3 @@ contract Test {
function f(uint[] calldata) external { } function f(uint[] calldata) external { }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -3,4 +3,3 @@ contract Test {
function f(uint[3][4] calldata) external { } function f(uint[3][4] calldata) external { }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -3,4 +3,3 @@ contract Test {
function f(uint[][] calldata) external { } function f(uint[][] calldata) external { }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -7,4 +7,3 @@ contract C {
} }
} }
// ---- // ----
// Warning: (52-85): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -5,6 +5,5 @@ contract C {
function f(uint[2**30][2**30][][] memory) public pure {} function f(uint[2**30][2**30][][] memory) public pure {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (61-101): Array is too large to be encoded. // TypeError: (61-101): Array is too large to be encoded.
// TypeError: (131-160): Array is too large to be encoded. // TypeError: (131-160): Array is too large to be encoded.

View File

@ -3,4 +3,3 @@ contract c {
event E(uint[] indexed); event E(uint[] indexed);
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -3,4 +3,3 @@ contract c {
event E(uint[]); event E(uint[]);
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -3,4 +3,3 @@ contract c {
event E(uint[][] indexed); event E(uint[][] indexed);
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -3,4 +3,3 @@ contract c {
event E(uint[][]); event E(uint[][]);
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -4,4 +4,3 @@ contract c {
event E(S indexed); event E(S indexed);
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -4,4 +4,3 @@ contract c {
event E(S); event E(S);
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -18,6 +18,3 @@ pragma experimental ABIEncoderV2;
import "./B.sol"; import "./B.sol";
contract C is B { } contract C is B { }
// ---- // ----
// Warning: (A.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning: (B.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning: (C.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -16,6 +16,4 @@ contract B is A { }
import "./B.sol"; import "./B.sol";
contract C is B { } contract C is B { }
// ---- // ----
// Warning: (A.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning: (B.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (C.sol:18-37): Contract "C" does not use the new experimental ABI encoder but wants to inherit from a contract which uses types that require it. Use "pragma experimental ABIEncoderV2;" for the inheriting contract as well to enable the feature. // TypeError: (C.sol:18-37): Contract "C" does not use the new experimental ABI encoder but wants to inherit from a contract which uses types that require it. Use "pragma experimental ABIEncoderV2;" for the inheriting contract as well to enable the feature.

View File

@ -14,5 +14,4 @@ contract B is A { }
import "./B.sol"; import "./B.sol";
contract C is B { } contract C is B { }
// ---- // ----
// Warning: (A.sol:0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (B.sol:18-37): Contract "B" does not use the new experimental ABI encoder but wants to inherit from a contract which uses types that require it. Use "pragma experimental ABIEncoderV2;" for the inheriting contract as well to enable the feature. // TypeError: (B.sol:18-37): Contract "B" does not use the new experimental ABI encoder but wants to inherit from a contract which uses types that require it. Use "pragma experimental ABIEncoderV2;" for the inheriting contract as well to enable the feature.

View File

@ -14,4 +14,3 @@ contract C is I {
function i(S memory) public override payable {} function i(S memory) public override payable {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -14,4 +14,3 @@ contract B is A {
function i(S memory) public override payable {} function i(S memory) public override payable {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -6,5 +6,4 @@ contract C {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (128-131): Calldata structs are read-only. // TypeError: (128-131): Calldata structs are read-only.

View File

@ -7,5 +7,4 @@ contract C {
function f(S2 memory) public pure {} function f(S2 memory) public pure {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (143-179): Function overload clash during conversion to external types for arguments. // TypeError: (143-179): Function overload clash during conversion to external types for arguments.

View File

@ -7,4 +7,3 @@ contract C {
function f(S2 memory) public pure {} function f(S2 memory) public pure {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -5,5 +5,4 @@ contract C {
function f(S memory) public {} function f(S memory) public {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (103-111): Internal type is not allowed for public or external functions. // TypeError: (103-111): Internal type is not allowed for public or external functions.

View File

@ -5,5 +5,4 @@ contract C {
function f(S memory) public {} function f(S memory) public {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (105-113): Only libraries are allowed to use the mapping type in public or external functions. // TypeError: (105-113): Only libraries are allowed to use the mapping type in public or external functions.

View File

@ -6,5 +6,4 @@ contract C {
function f(S memory) public {} function f(S memory) public {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (132-140): Only libraries are allowed to use the mapping type in public or external functions. // TypeError: (132-140): Only libraries are allowed to use the mapping type in public or external functions.

View File

@ -4,4 +4,3 @@ contract C {
function f() public pure returns (string[][] memory) {} function f() public pure returns (string[][] memory) {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -5,4 +5,3 @@ contract C {
function f() public pure returns (S memory) {} function f() public pure returns (S memory) {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -4,4 +4,3 @@ library c {
function f() public returns (S memory) {} function f() public returns (S memory) {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -6,4 +6,3 @@ contract C {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -9,4 +9,3 @@ contract A {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -9,4 +9,3 @@ contract C {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -11,6 +11,5 @@ contract C {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (191-192): Type not supported in packed mode. // TypeError: (191-192): Type not supported in packed mode.
// TypeError: (194-195): Type not supported in packed mode. // TypeError: (194-195): Type not supported in packed mode.

View File

@ -17,7 +17,6 @@ contract C {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (193-195): Type not supported in packed mode. // TypeError: (193-195): Type not supported in packed mode.
// TypeError: (323-324): Type not supported in packed mode. // TypeError: (323-324): Type not supported in packed mode.
// TypeError: (326-327): Type not supported in packed mode. // TypeError: (326-327): Type not supported in packed mode.

View File

@ -7,4 +7,3 @@ contract C {
} }
} }
// ---- // ----
// Warning: (0-35): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -7,4 +7,3 @@ contract C {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -5,4 +5,3 @@ contract Test {
function f(S[][] calldata) external { } function f(S[][] calldata) external { }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -4,4 +4,3 @@ contract Test {
function f(S calldata) external { } function f(S calldata) external { }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -6,5 +6,4 @@ contract Test {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (144-147): Calldata structs are read-only. // TypeError: (144-147): Calldata structs are read-only.

View File

@ -4,5 +4,4 @@ contract Test {
function f(S calldata s) external { s.a = 4; } function f(S calldata s) external { s.a = 4; }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (114-117): Calldata structs are read-only. // TypeError: (114-117): Calldata structs are read-only.

View File

@ -4,4 +4,3 @@ contract Test {
function f(S calldata) external { } function f(S calldata) external { }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -6,4 +6,3 @@ contract C {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -5,7 +5,6 @@ contract Test {
function g(S calldata s) external { S memory m; s = m; } function g(S calldata s) external { S memory m; s = m; }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (114-115): External function arguments of reference type are read-only. // TypeError: (114-115): External function arguments of reference type are read-only.
// TypeError: (118-122): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata. // TypeError: (118-122): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata.
// TypeError: (178-179): External function arguments of reference type are read-only. // TypeError: (178-179): External function arguments of reference type are read-only.

View File

@ -12,4 +12,3 @@ contract C {
function f(T memory) public pure { } function f(T memory) public pure { }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -12,4 +12,3 @@ contract TestContract
function addTestStruct(TestStruct memory) public pure {} function addTestStruct(TestStruct memory) public pure {}
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.

View File

@ -10,5 +10,4 @@ library Test {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (146-168): Recursive structs can only be passed as storage pointers to libraries, not as memory objects to contract functions. // TypeError: (146-168): Recursive structs can only be passed as storage pointers to libraries, not as memory objects to contract functions.

View File

@ -7,5 +7,4 @@ contract Data {
struct S { S x; } struct S { S x; }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (63-78): Recursive type not allowed for public or external contract functions. // TypeError: (63-78): Recursive type not allowed for public or external contract functions.

View File

@ -5,5 +5,4 @@ contract C {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (126-129): Fractional numbers cannot yet be encoded. // TypeError: (126-129): Fractional numbers cannot yet be encoded.

View File

@ -5,6 +5,5 @@ contract C {
} }
} }
// ---- // ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (132-135): Fractional numbers cannot yet be encoded. // TypeError: (132-135): Fractional numbers cannot yet be encoded.
// TypeError: (137-138): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. // TypeError: (137-138): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.