Skip to content

Commit 802f895

Browse files
committed
feat: introduce EVM Version Shanghai
Note: Paris is still the default
1 parent 0bfcdaf commit 802f895

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

liblangutil/EVMVersion.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ class EVMVersion:
5858
static EVMVersion berlin() { return {Version::Berlin}; }
5959
static EVMVersion london() { return {Version::London}; }
6060
static EVMVersion paris() { return {Version::Paris}; }
61+
static EVMVersion shanghai() { return {Version::Shanghai}; }
6162

6263
static std::optional<EVMVersion> fromString(std::string const& _version)
6364
{
64-
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin(), london(), paris()})
65+
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin(), london(), paris(), shanghai()})
6566
if (_version == v.name())
6667
return v;
6768
return std::nullopt;
@@ -84,6 +85,7 @@ class EVMVersion:
8485
case Version::Berlin: return "berlin";
8586
case Version::London: return "london";
8687
case Version::Paris: return "paris";
88+
case Version::Shanghai: return "shanghai";
8789
}
8890
return "INVALID";
8991
}
@@ -98,6 +100,7 @@ class EVMVersion:
98100
bool hasSelfBalance() const { return *this >= istanbul(); }
99101
bool hasBaseFee() const { return *this >= london(); }
100102
bool hasPrevRandao() const { return *this >= paris(); }
103+
bool hasPush0() const { return *this >= shanghai(); }
101104

102105
bool hasOpcode(evmasm::Instruction _opcode) const;
103106

@@ -106,7 +109,7 @@ class EVMVersion:
106109
bool canOverchargeGasForCall() const { return *this >= tangerineWhistle(); }
107110

108111
private:
109-
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London, Paris };
112+
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London, Paris, Shanghai };
110113

111114
EVMVersion(Version _version): m_version(_version) {}
112115

solc/CommandLineParser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ General Information)").c_str(),
593593
g_strEVMVersion.c_str(),
594594
po::value<string>()->value_name("version")->default_value(EVMVersion{}.name()),
595595
"Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, "
596-
"byzantium, constantinople, petersburg, istanbul, berlin, london or paris."
596+
"byzantium, constantinople, petersburg, istanbul, berlin, london, paris or shanghai."
597597
)
598598
;
599599
if (!_forHelp) // Note: We intentionally keep this undocumented for now.

0 commit comments

Comments
 (0)