Support petersburg in evmVersion

This commit is contained in:
Alex Beregszaszi
2019-03-04 14:10:41 +01:00
committed by chriseth
parent 68e1bf47d5
commit ecd246aeb6
11 changed files with 28 additions and 19 deletions
+5 -3
View File
@@ -30,7 +30,7 @@ namespace langutil
/**
* A version specifier of the EVM we want to compile to.
* Defaults to the latest version.
* Defaults to the latest version deployed on Ethereum mainnet at the time of compiler release.
*/
class EVMVersion:
boost::less_than_comparable<EVMVersion>,
@@ -44,10 +44,11 @@ public:
static EVMVersion spuriousDragon() { return {Version::SpuriousDragon}; }
static EVMVersion byzantium() { return {Version::Byzantium}; }
static EVMVersion constantinople() { return {Version::Constantinople}; }
static EVMVersion petersburg() { return {Version::Petersburg}; }
static boost::optional<EVMVersion> fromString(std::string const& _version)
{
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople()})
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg()})
if (_version == v.name())
return v;
return {};
@@ -65,6 +66,7 @@ public:
case Version::SpuriousDragon: return "spuriousDragon";
case Version::Byzantium: return "byzantium";
case Version::Constantinople: return "constantinople";
case Version::Petersburg: return "petersburg";
}
return "INVALID";
}
@@ -81,7 +83,7 @@ public:
bool canOverchargeGasForCall() const { return *this >= tangerineWhistle(); }
private:
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople };
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg };
EVMVersion(Version _version): m_version(_version) {}