Skip to content

Commit ad0d100

Browse files
committed
Add EVMVersion::current() helper
1 parent 03fde2a commit ad0d100

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

liblangutil/EVMVersion.h

+7-9
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#include <string>
2929
#include <vector>
3030

31-
#include <boost/operators.hpp>
32-
3331

3432
namespace solidity::evmasm
3533
{
@@ -44,13 +42,13 @@ namespace solidity::langutil
4442
* A version specifier of the EVM we want to compile to.
4543
* Defaults to the latest version deployed on Ethereum Mainnet at the time of compiler release.
4644
*/
47-
class EVMVersion:
48-
boost::less_than_comparable<EVMVersion>,
49-
boost::equality_comparable<EVMVersion>
45+
class EVMVersion
5046
{
5147
public:
5248
EVMVersion() = default;
5349

50+
static EVMVersion current() { return {currentVersion}; }
51+
5452
static EVMVersion homestead() { return {Version::Homestead}; }
5553
static EVMVersion tangerineWhistle() { return {Version::TangerineWhistle}; }
5654
static EVMVersion spuriousDragon() { return {Version::SpuriousDragon}; }
@@ -96,11 +94,10 @@ class EVMVersion:
9694
static EVMVersion firstWithEOF() { return {Version::Osaka}; }
9795

9896
bool isExperimental() const {
99-
return *this > EVMVersion{};
97+
return m_version > currentVersion;
10098
}
10199

102-
bool operator==(EVMVersion const& _other) const { return m_version == _other.m_version; }
103-
bool operator<(EVMVersion const& _other) const { return m_version < _other.m_version; }
100+
auto operator<=>(EVMVersion const&) const = default;
104101

105102
std::string name() const
106103
{
@@ -164,10 +161,11 @@ class EVMVersion:
164161
Prague,
165162
Osaka,
166163
};
164+
static auto constexpr currentVersion = Version::Cancun;
167165

168166
EVMVersion(Version _version): m_version(_version) {}
169167

170-
Version m_version = Version::Cancun;
168+
Version m_version = currentVersion;
171169
};
172170

173171
}

0 commit comments

Comments
 (0)