mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Set default EVM version to Petersburg.
This commit is contained in:
parent
cc4598a5ed
commit
9a949c1bda
@ -6,7 +6,7 @@ Language Features:
|
|||||||
|
|
||||||
|
|
||||||
Compiler 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: Consider ``extcodehash`` as part of Constantinople.
|
||||||
* Inline Assembly: Instructions unavailable to the currently configured EVM are errors now.
|
* 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``.
|
* SMTChecker: Do not report underflow/overflow if they always revert. This removes false positives when using ``SafeMath``.
|
||||||
|
@ -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.
|
- All gas sent by default for external calls, previously a certain amount had to be retained.
|
||||||
- ``spuriousDragon``
|
- ``spuriousDragon``
|
||||||
- Gas cost for the ``exp`` opcode increased, relevant for gas estimation and the optimizer.
|
- 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.
|
- 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.
|
- 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.
|
- 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``
|
- ``constantinople``
|
||||||
- Opcodes ``create2`, ``extcodehash``, ``shl``, ``shr`` and ``sar`` are available in assembly.
|
- Opcodes ``create2`, ``extcodehash``, ``shl``, ``shr`` and ``sar`` are available in assembly.
|
||||||
- Shifting operators use shifting opcodes and thus need less gas.
|
- Shifting operators use shifting opcodes and thus need less gas.
|
||||||
- ``petersburg``
|
- ``petersburg`` (**default**)
|
||||||
- The compiler behaves the same way as with constantinople.
|
- The compiler behaves the same way as with constantinople.
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ private:
|
|||||||
|
|
||||||
EVMVersion(Version _version): m_version(_version) {}
|
EVMVersion(Version _version): m_version(_version) {}
|
||||||
|
|
||||||
Version m_version = Version::Byzantium;
|
Version m_version = Version::Petersburg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
|
|||||||
analysisInfo,
|
analysisInfo,
|
||||||
errorsIgnored,
|
errorsIgnored,
|
||||||
errorTypeForLoose,
|
errorTypeForLoose,
|
||||||
yul::EVMDialect::looseAssemblyForEVM(EVMVersion::petersburg()),
|
yul::EVMDialect::looseAssemblyForEVM(EVMVersion{}),
|
||||||
resolver
|
resolver
|
||||||
).analyze(_inlineAssembly.operations());
|
).analyze(_inlineAssembly.operations());
|
||||||
return false;
|
return false;
|
||||||
|
@ -1042,7 +1042,7 @@ ASTPointer<InlineAssembly> Parser::parseInlineAssembly(ASTPointer<ASTString> con
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Using latest EVM Version for now, it will be run again later.
|
// 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);
|
shared_ptr<yul::Block> block = asmParser.parse(m_scanner, true);
|
||||||
if (block == nullptr)
|
if (block == nullptr)
|
||||||
BOOST_THROW_EXCEPTION(FatalError());
|
BOOST_THROW_EXCEPTION(FatalError());
|
||||||
|
@ -607,7 +607,7 @@ Allowed options)",
|
|||||||
(
|
(
|
||||||
g_strEVMVersion.c_str(),
|
g_strEVMVersion.c_str(),
|
||||||
po::value<string>()->value_name("version"),
|
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.")
|
(g_argOptimize.c_str(), "Enable bytecode optimizer.")
|
||||||
(
|
(
|
||||||
|
@ -855,7 +855,7 @@ BOOST_AUTO_TEST_CASE(evm_version)
|
|||||||
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"petersburg\"") != string::npos);
|
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"petersburg\"") != string::npos);
|
||||||
// test default
|
// test default
|
||||||
result = compile(inputForVersion(""));
|
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
|
// test invalid
|
||||||
result = compile(inputForVersion("\"evmVersion\": \"invalid\","));
|
result = compile(inputForVersion("\"evmVersion\": \"invalid\","));
|
||||||
BOOST_CHECK(result["errors"][0]["message"].asString() == "Invalid EVM version requested.");
|
BOOST_CHECK(result["errors"][0]["message"].asString() == "Invalid EVM version requested.");
|
||||||
|
@ -206,7 +206,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
ErrorList m_errors;
|
ErrorList m_errors;
|
||||||
shared_ptr<yul::Block> m_ast;
|
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<AsmAnalysisInfo> m_analysisInfo;
|
||||||
shared_ptr<NameDispenser> m_nameDispenser;
|
shared_ptr<NameDispenser> m_nameDispenser;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user