mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add evm version shanghai
This commit is contained in:
parent
e1ca3312e5
commit
3d73f36b12
@ -57,10 +57,11 @@ public:
|
|||||||
static EVMVersion berlin() { return {Version::Berlin}; }
|
static EVMVersion berlin() { return {Version::Berlin}; }
|
||||||
static EVMVersion london() { return {Version::London}; }
|
static EVMVersion london() { return {Version::London}; }
|
||||||
static EVMVersion paris() { return {Version::Paris}; }
|
static EVMVersion paris() { return {Version::Paris}; }
|
||||||
|
static EVMVersion shanghai() { return {Version::Shanghai}; }
|
||||||
|
|
||||||
static std::optional<EVMVersion> fromString(std::string const& _version)
|
static std::optional<EVMVersion> fromString(std::string const& _version)
|
||||||
{
|
{
|
||||||
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin(), london(), paris()})
|
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin(), london(), paris(), shanghai()})
|
||||||
if (_version == v.name())
|
if (_version == v.name())
|
||||||
return v;
|
return v;
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
@ -83,6 +84,7 @@ public:
|
|||||||
case Version::Berlin: return "berlin";
|
case Version::Berlin: return "berlin";
|
||||||
case Version::London: return "london";
|
case Version::London: return "london";
|
||||||
case Version::Paris: return "paris";
|
case Version::Paris: return "paris";
|
||||||
|
case Version::Shanghai: return "shanghai";
|
||||||
}
|
}
|
||||||
return "INVALID";
|
return "INVALID";
|
||||||
}
|
}
|
||||||
@ -104,7 +106,7 @@ public:
|
|||||||
bool canOverchargeGasForCall() const { return *this >= tangerineWhistle(); }
|
bool canOverchargeGasForCall() const { return *this >= tangerineWhistle(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London, Paris };
|
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London, Paris, Shanghai };
|
||||||
|
|
||||||
EVMVersion(Version _version): m_version(_version) {}
|
EVMVersion(Version _version): m_version(_version) {}
|
||||||
|
|
||||||
|
@ -590,7 +590,7 @@ General Information)").c_str(),
|
|||||||
g_strEVMVersion.c_str(),
|
g_strEVMVersion.c_str(),
|
||||||
po::value<string>()->value_name("version")->default_value(EVMVersion{}.name()),
|
po::value<string>()->value_name("version")->default_value(EVMVersion{}.name()),
|
||||||
"Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, "
|
"Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, "
|
||||||
"byzantium, constantinople, petersburg, istanbul, berlin, london or paris."
|
"byzantium, constantinople, petersburg, istanbul, berlin, london, paris or shanghai."
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
if (!_forHelp) // Note: We intentionally keep this undocumented for now.
|
if (!_forHelp) // Note: We intentionally keep this undocumented for now.
|
||||||
|
@ -124,6 +124,8 @@ EVMHost::EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm):
|
|||||||
m_evmRevision = EVMC_LONDON;
|
m_evmRevision = EVMC_LONDON;
|
||||||
else if (_evmVersion == langutil::EVMVersion::paris())
|
else if (_evmVersion == langutil::EVMVersion::paris())
|
||||||
m_evmRevision = EVMC_PARIS;
|
m_evmRevision = EVMC_PARIS;
|
||||||
|
else if (_evmVersion == langutil::EVMVersion::shanghai())
|
||||||
|
m_evmRevision = EVMC_SHANGHAI;
|
||||||
else
|
else
|
||||||
assertThrow(false, Exception, "Unsupported EVM version");
|
assertThrow(false, Exception, "Unsupported EVM version");
|
||||||
|
|
||||||
|
@ -1084,6 +1084,8 @@ BOOST_AUTO_TEST_CASE(evm_version)
|
|||||||
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"london\"") != string::npos);
|
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"london\"") != string::npos);
|
||||||
result = compile(inputForVersion("\"evmVersion\": \"paris\","));
|
result = compile(inputForVersion("\"evmVersion\": \"paris\","));
|
||||||
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"paris\"") != string::npos);
|
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"paris\"") != string::npos);
|
||||||
|
result = compile(inputForVersion("\"evmVersion\": \"shanghai\","));
|
||||||
|
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"shanghai\"") != string::npos);
|
||||||
// test default
|
// test default
|
||||||
result = compile(inputForVersion(""));
|
result = compile(inputForVersion(""));
|
||||||
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"london\"") != string::npos);
|
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"london\"") != string::npos);
|
||||||
|
Loading…
Reference in New Issue
Block a user