Skip to content

Commit eb8af2c

Browse files
axiccameel
authored andcommitted
Add basic support for the EVM version Paris
This mostly means testing with evmone, but instruction renaming of difficulty->prevrandao is omitted.
1 parent 0b4b104 commit eb8af2c

File tree

13 files changed

+37
-9
lines changed

13 files changed

+37
-9
lines changed

.circleci/soltest_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ REPODIR="$(realpath "$(dirname "$0")"/..)"
3131
# shellcheck source=scripts/common.sh
3232
source "${REPODIR}/scripts/common.sh"
3333

34-
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london)
34+
EVM_VALUES=(homestead byzantium constantinople petersburg istanbul berlin london paris)
3535
DEFAULT_EVM=london
3636
[[ " ${EVM_VALUES[*]} " =~ $DEFAULT_EVM ]]
3737
OPTIMIZE_VALUES=(0 1)

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Language Features:
66
Compiler Features:
77
* Commandline Interface: Return exit code ``2`` on uncaught exceptions.
88
* Commandline Interface: Add `--no-cbor-metadata` that skips CBOR metadata from getting appended at the end of the bytecode.
9+
* EVM: Basic support for the EVM version "Paris".
910
* Natspec: Add event Natspec inheritance for devdoc.
1011
* Standard JSON: Add a boolean field `settings.metadata.appendCBOR` that skips CBOR metadata from getting appended at the end of the bytecode.
1112
* Yul Optimizer: Allow replacing the previously hard-coded cleanup sequence by specifying custom steps after a colon delimiter (``:``) in the sequence string.

docs/using-the-compiler.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ at each version. Backward compatibility is not guaranteed between each version.
172172
the optimizer.
173173
- ``london`` (**default**)
174174
- The block's base fee (`EIP-3198 <https://eips.ethereum.org/EIPS/eip-3198>`_ and `EIP-1559 <https://eips.ethereum.org/EIPS/eip-1559>`_) can be accessed via the global ``block.basefee`` or ``basefee()`` in inline assembly.
175-
175+
- ``paris``
176+
- No changes.
176177

177178
.. index:: ! standard JSON, ! --standard-json
178179
.. _compiler-api:
@@ -305,7 +306,7 @@ Input Description
305306
},
306307
// Version of the EVM to compile for.
307308
// Affects type checking and code generation. Can be homestead,
308-
// tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul or berlin
309+
// tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul, berlin, london or paris
309310
"evmVersion": "byzantium",
310311
// Optional: Change compilation pipeline to go through the Yul intermediate representation.
311312
// This is false by default.

liblangutil/EVMVersion.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ class EVMVersion:
5656
static EVMVersion istanbul() { return {Version::Istanbul}; }
5757
static EVMVersion berlin() { return {Version::Berlin}; }
5858
static EVMVersion london() { return {Version::London}; }
59+
static EVMVersion paris() { return {Version::Paris}; }
5960

6061
static std::optional<EVMVersion> fromString(std::string const& _version)
6162
{
62-
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin(), london()})
63+
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin(), london(), paris()})
6364
if (_version == v.name())
6465
return v;
6566
return std::nullopt;
@@ -81,6 +82,7 @@ class EVMVersion:
8182
case Version::Istanbul: return "istanbul";
8283
case Version::Berlin: return "berlin";
8384
case Version::London: return "london";
85+
case Version::Paris: return "paris";
8486
}
8587
return "INVALID";
8688
}
@@ -102,7 +104,7 @@ class EVMVersion:
102104
bool canOverchargeGasForCall() const { return *this >= tangerineWhistle(); }
103105

104106
private:
105-
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London };
107+
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London, Paris };
106108

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

scripts/tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ EVM_VERSIONS="homestead byzantium"
105105

106106
if [ -z "$CI" ]
107107
then
108-
EVM_VERSIONS+=" constantinople petersburg istanbul berlin london"
108+
EVM_VERSIONS+=" constantinople petersburg istanbul berlin london paris"
109109
fi
110110

111111
# And then run the Solidity unit-tests in the matrix combination of optimizer / no optimizer

solc/CommandLineParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ General Information)").c_str(),
586586
g_strEVMVersion.c_str(),
587587
po::value<string>()->value_name("version")->default_value(EVMVersion{}.name()),
588588
"Select desired EVM version. Either homestead, tangerineWhistle, spuriousDragon, "
589-
"byzantium, constantinople, petersburg, istanbul, berlin or london."
589+
"byzantium, constantinople, petersburg, istanbul, berlin, london or paris."
590590
)
591591
(
592592
g_strExperimentalViaIR.c_str(),

test/EVMHost.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ EVMHost::EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm):
122122
m_evmRevision = EVMC_BERLIN;
123123
else if (_evmVersion == langutil::EVMVersion::london())
124124
m_evmRevision = EVMC_LONDON;
125-
// TODO: support EVMVersion::paris()
125+
else if (_evmVersion == langutil::EVMVersion::paris())
126+
m_evmRevision = EVMC_PARIS;
126127
else
127128
assertThrow(false, Exception, "Unsupported EVM version");
128129

test/libsolidity/StandardCompiler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,8 @@ BOOST_AUTO_TEST_CASE(evm_version)
10821082
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"berlin\"") != string::npos);
10831083
result = compile(inputForVersion("\"evmVersion\": \"london\","));
10841084
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"london\"") != string::npos);
1085+
result = compile(inputForVersion("\"evmVersion\": \"paris\","));
1086+
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"paris\"") != string::npos);
10851087
// test default
10861088
result = compile(inputForVersion(""));
10871089
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"london\"") != string::npos);

test/libsolidity/semanticTests/state/block_difficulty.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ contract C {
55
}
66
// ====
77
// compileToEwasm: also
8+
// EVMVersion: <paris
89
// ----
910
// f() -> 200000000
1011
// f() -> 200000000
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
contract C {
2+
function f() public returns (uint) {
3+
return block.difficulty;
4+
}
5+
}
6+
// ====
7+
// compileToEwasm: also
8+
// EVMVersion: >=paris
9+
// ----
10+
// f() -> 0xa86c2e601b6c44eb4848f7d23d9df3113fbcac42041c49cbed5000cb4f118777
11+
// f() -> 0xa86c2e601b6c44eb4848f7d23d9df3113fbcac42041c49cbed5000cb4f118777
12+
// f() -> 0xa86c2e601b6c44eb4848f7d23d9df3113fbcac42041c49cbed5000cb4f118777

0 commit comments

Comments
 (0)