Skip to content

Commit af1dabb

Browse files
committed
Added EVMVersion london.
Also set the value of `block_base_fee` for testing to 7 wei.
1 parent 543ccf5 commit af1dabb

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.circleci/soltest_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ set -e
2828

2929
REPODIR="$(realpath "$(dirname "$0")"/..)"
3030

31-
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin)
31+
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london)
3232
DEFAULT_EVM=berlin
3333
[[ " ${EVM_VALUES[*]} " =~ $DEFAULT_EVM ]]
3434
OPTIMIZE_VALUES=(0 1)

liblangutil/EVMVersion.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ class EVMVersion:
5151
static EVMVersion petersburg() { return {Version::Petersburg}; }
5252
static EVMVersion istanbul() { return {Version::Istanbul}; }
5353
static EVMVersion berlin() { return {Version::Berlin}; }
54+
static EVMVersion london() { return {Version::London}; }
5455

5556
static std::optional<EVMVersion> fromString(std::string const& _version)
5657
{
57-
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin()})
58+
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin(), london()})
5859
if (_version == v.name())
5960
return v;
6061
return std::nullopt;
@@ -75,6 +76,7 @@ class EVMVersion:
7576
case Version::Petersburg: return "petersburg";
7677
case Version::Istanbul: return "istanbul";
7778
case Version::Berlin: return "berlin";
79+
case Version::London: return "london";
7880
}
7981
return "INVALID";
8082
}
@@ -87,6 +89,7 @@ class EVMVersion:
8789
bool hasExtCodeHash() const { return *this >= constantinople(); }
8890
bool hasChainID() const { return *this >= istanbul(); }
8991
bool hasSelfBalance() const { return *this >= istanbul(); }
92+
bool hasBaseFee() const { return *this >= london(); }
9093

9194
bool hasOpcode(evmasm::Instruction _opcode) const;
9295

@@ -95,7 +98,7 @@ class EVMVersion:
9598
bool canOverchargeGasForCall() const { return *this >= tangerineWhistle(); }
9699

97100
private:
98-
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin };
101+
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London };
99102

100103
EVMVersion(Version _version): m_version(_version) {}
101104

test/EVMHost.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ EVMHost::EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm):
122122
m_evmRevision = EVMC_ISTANBUL;
123123
else if (_evmVersion == langutil::EVMVersion::berlin())
124124
m_evmRevision = EVMC_BERLIN;
125+
else if (_evmVersion == langutil::EVMVersion::london())
126+
m_evmRevision = EVMC_LONDON;
125127
else
126128
assertThrow(false, Exception, "Unsupported EVM version");
127129

@@ -132,6 +134,8 @@ EVMHost::EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm):
132134
tx_context.tx_origin = 0x9292929292929292929292929292929292929292_address;
133135
// Mainnet according to EIP-155
134136
tx_context.chain_id = evmc::uint256be{1};
137+
// The minimum value of basefee
138+
tx_context.block_base_fee = evmc::bytes32{7};
135139

136140
// Reserve space for recording calls.
137141
if (!recorded_calls.capacity())

0 commit comments

Comments
 (0)