Merge pull request #6155 from ethereum/defaultToPetersburg

Set default EVM version to petersburg
This commit is contained in:
chriseth 2019-03-04 17:36:42 +01:00 committed by GitHub
commit 9c80f0fc76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 99 additions and 97 deletions

View File

@ -6,7 +6,7 @@ Language Features:
Compiler Features:
* Support ``petersburg`` as ``evmVersion``.
* Support ``petersburg`` as ``evmVersion`` and set as default.
* Inline Assembly: Consider ``extcodehash`` as part of Constantinople.
* Inline Assembly: Instructions unavailable to the currently configured EVM are errors now.
* SMTChecker: Do not report underflow/overflow if they always revert. This removes false positives when using ``SafeMath``.

View File

@ -112,7 +112,7 @@ at each version. Backward compatibility is not guaranteed between each version.
- All gas sent by default for external calls, previously a certain amount had to be retained.
- ``spuriousDragon``
- Gas cost for the ``exp`` opcode increased, relevant for gas estimation and the optimizer.
- ``byzantium`` (**default**)
- ``byzantium``
- Opcodes ``returndatacopy``, ``returndatasize`` and ``staticcall`` are available in assembly.
- The ``staticcall`` opcode is used when calling non-library view or pure functions, which prevents the functions from modifying state at the EVM level, i.e., even applies when you use invalid type conversions.
- It is possible to access dynamic data returned from function calls.
@ -120,7 +120,7 @@ at each version. Backward compatibility is not guaranteed between each version.
- ``constantinople``
- Opcodes ``create2`, ``extcodehash``, ``shl``, ``shr`` and ``sar`` are available in assembly.
- Shifting operators use shifting opcodes and thus need less gas.
- ``petersburg``
- ``petersburg`` (**default**)
- The compiler behaves the same way as with constantinople.

View File

@ -87,7 +87,7 @@ private:
EVMVersion(Version _version): m_version(_version) {}
Version m_version = Version::Byzantium;
Version m_version = Version::Petersburg;
};

View File

@ -325,7 +325,7 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
analysisInfo,
errorsIgnored,
errorTypeForLoose,
yul::EVMDialect::looseAssemblyForEVM(EVMVersion::petersburg()),
yul::EVMDialect::looseAssemblyForEVM(EVMVersion{}),
resolver
).analyze(_inlineAssembly.operations());
return false;

View File

@ -1042,7 +1042,7 @@ ASTPointer<InlineAssembly> Parser::parseInlineAssembly(ASTPointer<ASTString> con
}
// Using latest EVM Version for now, it will be run again later.
yul::Parser asmParser(m_errorReporter, yul::EVMDialect::looseAssemblyForEVM(EVMVersion::petersburg()));
yul::Parser asmParser(m_errorReporter, yul::EVMDialect::looseAssemblyForEVM(EVMVersion{}));
shared_ptr<yul::Block> block = asmParser.parse(m_scanner, true);
if (block == nullptr)
BOOST_THROW_EXCEPTION(FatalError());

View File

@ -607,7 +607,7 @@ Allowed options)",
(
g_strEVMVersion.c_str(),
po::value<string>()->value_name("version"),
"Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, byzantium (default), constantinople or petersburg."
"Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, byzantium, constantinople or petersburg (default)."
)
(g_argOptimize.c_str(), "Enable bytecode optimizer.")
(

View File

@ -2,6 +2,6 @@
======= data_storage/input.sol:C =======
Gas estimation:
construction:
306 + 264400 = 264706
300 + 258600 = 258900
external:
f(): 263
f(): 258

View File

@ -2,11 +2,11 @@
======= gas_test_abiv2/input.sol:C =======
Gas estimation:
construction:
1154 + 1109000 = 1110154
1147 + 1103200 = 1104347
external:
a(): 535
b(uint256): 1129
f1(uint256): 591
a(): 530
b(uint256): 1124
f1(uint256): 586
f2(uint256[],string[],uint16,address): infinite
f3(uint16[],string[],uint16,address): infinite
f4(uint32[],string[12],bytes[2][],address): infinite

View File

@ -2,11 +2,11 @@
======= gas_test_abiv2_optimize_yul/input.sol:C =======
Gas estimation:
construction:
676 + 641600 = 642276
651 + 617600 = 618251
external:
a(): 434
b(uint256): 892
f1(uint256): 356
a(): 429
b(uint256): 887
f1(uint256): 351
f2(uint256[],string[],uint16,address): infinite
f3(uint16[],string[],uint16,address): infinite
f4(uint32[],string[12],bytes[2][],address): infinite

View File

@ -2,52 +2,52 @@
======= gas_test_dispatch/input.sol:Large =======
Gas estimation:
construction:
1034 + 998400 = 999434
683 + 650600 = 651283
external:
a(): 456
b(uint256): 857
f0(uint256): 438
f1(uint256): 40781
f2(uint256): 20722
f3(uint256): 20810
f4(uint256): 20788
f5(uint256): 20766
f6(uint256): 20789
f7(uint256): 20701
f8(uint256): 20701
f9(uint256): 20723
g0(uint256): 324
g1(uint256): 40736
g2(uint256): 20699
g3(uint256): 20787
g4(uint256): 20765
g5(uint256): 20721
g6(uint256): 20744
g7(uint256): 20743
g8(uint256): 20721
g9(uint256): 20678
a(): 451
b(uint256): 852
f0(uint256): 433
f1(uint256): 40764
f2(uint256): 20705
f3(uint256): 20793
f4(uint256): 20771
f5(uint256): 20749
f6(uint256): 20772
f7(uint256): 20684
f8(uint256): 20684
f9(uint256): 20706
g0(uint256): 319
g1(uint256): 40719
g2(uint256): 20682
g3(uint256): 20770
g4(uint256): 20748
g5(uint256): 20704
g6(uint256): 20727
g7(uint256): 20726
g8(uint256): 20704
g9(uint256): 20661
======= gas_test_dispatch/input.sol:Medium =======
Gas estimation:
construction:
411 + 376600 = 377011
300 + 256800 = 257100
external:
a(): 433
b(uint256): 857
f1(uint256): 40692
f2(uint256): 20722
f3(uint256): 20766
g0(uint256): 324
g7(uint256): 20721
g8(uint256): 20699
g9(uint256): 20655
a(): 428
b(uint256): 852
f1(uint256): 40675
f2(uint256): 20705
f3(uint256): 20749
g0(uint256): 319
g7(uint256): 20704
g8(uint256): 20682
g9(uint256): 20638
======= gas_test_dispatch/input.sol:Small =======
Gas estimation:
construction:
153 + 107800 = 107953
129 + 83000 = 83129
external:
fallback: 123
a(): 388
b(uint256): 813
f1(uint256): 40692
fallback: 118
a(): 383
b(uint256): 808
f1(uint256): 40675

View File

@ -2,52 +2,52 @@
======= gas_test_dispatch_optimize/input.sol:Large =======
Gas estimation:
construction:
300 + 262000 = 262300
300 + 259200 = 259500
external:
a(): 463
b(uint256): 1173
f0(uint256): 399
f1(uint256): 41164
f2(uint256): 21224
f3(uint256): 21312
f4(uint256): 21290
f5(uint256): 21268
f6(uint256): 21180
f7(uint256): 20960
f8(uint256): 21092
f9(uint256): 21114
g0(uint256): 639
g1(uint256): 40876
g2(uint256): 20958
g3(uint256): 21046
g4(uint256): 21024
g5(uint256): 21112
g6(uint256): 20892
g7(uint256): 21002
g8(uint256): 20980
g9(uint256): 20826
a(): 398
b(uint256): 1108
f0(uint256): 334
f1(uint256): 40898
f2(uint256): 20958
f3(uint256): 21046
f4(uint256): 21024
f5(uint256): 21002
f6(uint256): 20914
f7(uint256): 20694
f8(uint256): 20826
f9(uint256): 20848
g0(uint256): 574
g1(uint256): 40610
g2(uint256): 20692
g3(uint256): 20780
g4(uint256): 20758
g5(uint256): 20846
g6(uint256): 20626
g7(uint256): 20736
g8(uint256): 20714
g9(uint256): 20560
======= gas_test_dispatch_optimize/input.sol:Medium =======
Gas estimation:
construction:
190 + 143000 = 143190
183 + 140200 = 140383
external:
a(): 463
b(uint256): 931
f1(uint256): 40944
f2(uint256): 20982
f3(uint256): 21026
g0(uint256): 397
g7(uint256): 20892
g8(uint256): 20870
g9(uint256): 20826
a(): 398
b(uint256): 866
f1(uint256): 40678
f2(uint256): 20716
f3(uint256): 20760
g0(uint256): 332
g7(uint256): 20626
g8(uint256): 20604
g9(uint256): 20560
======= gas_test_dispatch_optimize/input.sol:Small =======
Gas estimation:
construction:
117 + 67400 = 67517
117 + 64600 = 64717
external:
fallback: 183
a(): 441
b(uint256): 821
f1(uint256): 40878
fallback: 118
a(): 376
b(uint256): 756
f1(uint256): 40612

View File

@ -1 +1 @@
{"contracts":{"A":{"C":{"evm":{"gasEstimates":{"creation":{"codeDepositCost":"25600","executionCost":"75","totalCost":"25675"},"external":{"f()":"127"}}}}}},"sources":{"A":{"id":0}}}
{"contracts":{"A":{"C":{"evm":{"gasEstimates":{"creation":{"codeDepositCost":"19800","executionCost":"75","totalCost":"19875"},"external":{"f()":"122"}}}}}},"sources":{"A":{"id":0}}}

View File

@ -105,4 +105,6 @@ test_truffle Zeppelin https://github.com/OpenZeppelin/openzeppelin-solidity.git
# Disabled temporarily as it needs to be updated to latest Truffle first.
#test_truffle Gnosis https://github.com/axic/pm-contracts.git solidity-050
test_truffle GnosisSafe https://github.com/gnosis/safe-contracts.git development
# Disabled temporarily because it is incompatible with petersburg EVM and
# there is no easy way to set the EVM version in truffle pre 5.0.
#test_truffle GnosisSafe https://github.com/gnosis/safe-contracts.git development

View File

@ -855,7 +855,7 @@ BOOST_AUTO_TEST_CASE(evm_version)
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"petersburg\"") != string::npos);
// test default
result = compile(inputForVersion(""));
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"byzantium\"") != string::npos);
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"petersburg\"") != string::npos);
// test invalid
result = compile(inputForVersion("\"evmVersion\": \"invalid\","));
BOOST_CHECK(result["errors"][0]["message"].asString() == "Invalid EVM version requested.");

View File

@ -206,7 +206,7 @@ public:
private:
ErrorList m_errors;
shared_ptr<yul::Block> m_ast;
shared_ptr<Dialect> m_dialect{EVMDialect::strictAssemblyForEVMObjects(EVMVersion::petersburg())};
shared_ptr<Dialect> m_dialect{EVMDialect::strictAssemblyForEVMObjects(EVMVersion{})};
shared_ptr<AsmAnalysisInfo> m_analysisInfo;
shared_ptr<NameDispenser> m_nameDispenser;
};