diff --git a/liblangutil/EVMVersion.h b/liblangutil/EVMVersion.h index 22f85c8af..7932ecdad 100644 --- a/liblangutil/EVMVersion.h +++ b/liblangutil/EVMVersion.h @@ -58,10 +58,11 @@ public: static EVMVersion berlin() { return {Version::Berlin}; } static EVMVersion london() { return {Version::London}; } static EVMVersion paris() { return {Version::Paris}; } + static EVMVersion shanghai() { return {Version::Shanghai}; } static std::optional 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()) return v; return std::nullopt; @@ -84,6 +85,7 @@ public: case Version::Berlin: return "berlin"; case Version::London: return "london"; case Version::Paris: return "paris"; + case Version::Shanghai: return "shanghai"; } return "INVALID"; } @@ -98,6 +100,7 @@ public: bool hasSelfBalance() const { return *this >= istanbul(); } bool hasBaseFee() const { return *this >= london(); } bool hasPrevRandao() const { return *this >= paris(); } + bool hasPush0() const { return *this >= shanghai(); } bool hasOpcode(evmasm::Instruction _opcode) const; @@ -106,7 +109,7 @@ public: bool canOverchargeGasForCall() const { return *this >= tangerineWhistle(); } 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) {} diff --git a/solc/CommandLineParser.cpp b/solc/CommandLineParser.cpp index f7c99fd38..6140df2e7 100644 --- a/solc/CommandLineParser.cpp +++ b/solc/CommandLineParser.cpp @@ -593,7 +593,7 @@ General Information)").c_str(), g_strEVMVersion.c_str(), po::value()->value_name("version")->default_value(EVMVersion{}.name()), "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.