Skip to content

Commit

Permalink
Merge pull request #14705 from ethereum/add-cancun-evm-version
Browse files Browse the repository at this point in the history
Introduce `Cancun` EVM version
  • Loading branch information
ekpyron authored Dec 13, 2023
2 parents cdf2f5e + 0022089 commit ad9271e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .circleci/soltest_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ REPODIR="$(realpath "$(dirname "$0")"/..)"
# shellcheck source=scripts/common.sh
source "${REPODIR}/scripts/common.sh"

EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london paris shanghai)
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london paris shanghai cancun)
DEFAULT_EVM=shanghai
[[ " ${EVM_VALUES[*]} " =~ $DEFAULT_EVM ]]
OPTIMIZE_VALUES=(0 1)
Expand Down
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Language Features:


Compiler Features:

* EVM: Support for the EVM Version "Cancun".

Bugfixes:
* AST import: Fix bug when importing inline assembly with empty ``let`` variable declaration.
Expand Down
6 changes: 4 additions & 2 deletions liblangutil/EVMVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ class EVMVersion:
static EVMVersion london() { return {Version::London}; }
static EVMVersion paris() { return {Version::Paris}; }
static EVMVersion shanghai() { return {Version::Shanghai}; }
static EVMVersion cancun() { return {Version::Cancun}; }

static std::optional<EVMVersion> fromString(std::string const& _version)
{
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin(), london(), paris(), shanghai()})
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin(), london(), paris(), shanghai(), cancun()})
if (_version == v.name())
return v;
return std::nullopt;
Expand All @@ -86,6 +87,7 @@ class EVMVersion:
case Version::London: return "london";
case Version::Paris: return "paris";
case Version::Shanghai: return "shanghai";
case Version::Cancun: return "cancun";
}
return "INVALID";
}
Expand All @@ -109,7 +111,7 @@ class EVMVersion:
bool canOverchargeGasForCall() const { return *this >= tangerineWhistle(); }

private:
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London, Paris, Shanghai };
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London, Paris, Shanghai, Cancun };

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

Expand Down
2 changes: 1 addition & 1 deletion scripts/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ EVM_VERSIONS="homestead byzantium"

if [ -z "$CI" ]
then
EVM_VERSIONS+=" constantinople petersburg istanbul berlin london paris shanghai"
EVM_VERSIONS+=" constantinople petersburg istanbul berlin london paris shanghai cancun"
fi

# And then run the Solidity unit-tests in the matrix combination of optimizer / no optimizer
Expand Down
2 changes: 1 addition & 1 deletion solc/CommandLineParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ General Information)").c_str(),
g_strEVMVersion.c_str(),
po::value<std::string>()->value_name("version")->default_value(EVMVersion{}.name()),
"Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, "
"byzantium, constantinople, petersburg, istanbul, berlin, london, paris or shanghai."
"byzantium, constantinople, petersburg, istanbul, berlin, london, paris, shanghai or cancun."
)
;
if (!_forHelp) // Note: We intentionally keep this undocumented for now.
Expand Down
2 changes: 2 additions & 0 deletions test/EVMHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ EVMHost::EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm):
m_evmRevision = EVMC_PARIS;
else if (_evmVersion == langutil::EVMVersion::shanghai())
m_evmRevision = EVMC_SHANGHAI;
else if (_evmVersion == langutil::EVMVersion::cancun())
m_evmRevision = EVMC_CANCUN;
else
assertThrow(false, Exception, "Unsupported EVM version");

Expand Down

0 comments on commit ad9271e

Please sign in to comment.