Skip to content

Commit

Permalink
feat[tool]!: make cancun the default evm version (#4029)
Browse files Browse the repository at this point in the history
update tests and change defaults so that cancun is the default evm version
  • Loading branch information
charles-cooper authored May 16, 2024
1 parent 626cdf9 commit 98370f5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
-opt-${{ matrix.opt-mode || 'gas' }}\
${{ matrix.debug && '-debug' || '' }}\
${{ matrix.experimental-codegen && '-experimental' || '' }}\
-${{ matrix.evm-version || 'shanghai' }}\
-${{ matrix.evm-version || 'cancun' }}\
-${{ matrix.evm-backend || 'revm' }}"
strategy:
matrix:
Expand All @@ -80,7 +80,7 @@ jobs:
python-version: [["3.11", "311"]] # note: do not forget to replace 311 in the job names when upgrading!
opt-mode: [gas, none, codesize]
debug: [true, false]
evm-version: [shanghai] # note: when upgrading, check the "include" section below for conflicting jobs
evm-version: [cancun] # note: when upgrading, check the "include" section below for conflicting jobs
experimental-codegen: [false]
evm-backend: [revm]

Expand All @@ -89,15 +89,18 @@ jobs:
# test default settings with 3.11 across all supported evm versions
- evm-version: london
- evm-version: paris
- evm-version: cancun
- evm-version: shanghai

# py-evm rules
# test py-evm
- evm-backend: py-evm
evm-version: shanghai

- evm-backend: py-evm
evm-version: cancun

# test experimental pipeline
- experimental-codegen: true
opt-mode: gas
- experimental-codegen: true
opt-mode: none
- experimental-codegen: true
Expand Down Expand Up @@ -135,7 +138,7 @@ jobs:
pytest
-m "not fuzzing"
--optimize ${{ matrix.opt-mode || 'gas' }}
--evm-version ${{ matrix.evm-version || 'shanghai' }}
--evm-version ${{ matrix.evm-version || 'cancun' }}
--evm-backend ${{ matrix.evm-backend || 'revm' }}
${{ matrix.debug && '--enable-compiler-debug-mode' || '' }}
${{ matrix.experimental-codegen && '--experimental-codegen' || '' }}
Expand Down
10 changes: 5 additions & 5 deletions docs/compiling-a-contract.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ When you compile your contract code, you can specify the target Ethereum Virtual
.. note::
If the evm version specified by the compiler options conflicts with the source code pragma, an exception will be raised and compilation will not continue.

For instance, the adding the following pragma to a contract indicates that it should be compiled for the "shanghai" fork of the EVM.
For instance, the adding the following pragma to a contract indicates that it should be compiled for the "cancun" fork of the EVM.

.. code-block:: vyper
#pragma evm-version shanghai
#pragma evm-version cancun
.. warning::

Expand Down Expand Up @@ -182,11 +182,11 @@ The following is a list of supported EVM versions, and changes in the compiler i
- ``block.difficulty`` is deprecated in favor of its new alias, ``block.prevrandao``.

.. py:attribute:: shanghai (default)
.. py:attribute:: shanghai
- The ``PUSH0`` opcode is automatically generated by the compiler instead of ``PUSH1 0``

.. py:attribute:: cancun (experimental)
.. py:attribute:: cancun (default)
- The ``transient`` keyword allows declaration of variables which live in transient storage
- Functions marked with ``@nonreentrant`` are protected with TLOAD/TSTORE instead of SLOAD/SSTORE
Expand Down Expand Up @@ -237,7 +237,7 @@ The following example describes the expected input format of ``vyper-json``. Com
},
// Optional
"settings": {
"evmVersion": "shanghai", // EVM version to compile for. Can be london, paris, shanghai (default) or cancun (experimental!).
"evmVersion": "cancun", // EVM version to compile for. Can be london, paris, shanghai or cancun (default).
// optional, optimization mode
// defaults to "gas". can be one of "gas", "codesize", "none",
// false and true (the last two are for backwards compatibility).
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def pytest_addoption(parser):
parser.addoption(
"--evm-version",
choices=list(evm_opcodes.EVM_VERSIONS.keys()),
default="shanghai",
default="cancun",
help="set evm version",
)

Expand Down
2 changes: 1 addition & 1 deletion vyper/evm/opcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
_evm_versions = ("london", "paris", "shanghai", "cancun")
EVM_VERSIONS: dict[str, int] = dict((v, i) for i, v in enumerate(_evm_versions))

DEFAULT_EVM_VERSION = "shanghai"
DEFAULT_EVM_VERSION = "cancun"


# opcode as hex value
Expand Down
1 change: 1 addition & 0 deletions vyper/venom/basicblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"sstore",
"dstore",
"istore",
"tstore",
"dloadbytes",
"calldatacopy",
"mcopy",
Expand Down

0 comments on commit 98370f5

Please sign in to comment.