From 98370f505dcbd3d6c18f80f48e5468354bf5c655 Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Thu, 16 May 2024 10:23:27 -0400 Subject: [PATCH] feat[tool]!: make cancun the default evm version (#4029) update tests and change defaults so that cancun is the default evm version --- .github/workflows/test.yml | 13 ++++++++----- docs/compiling-a-contract.rst | 10 +++++----- tests/conftest.py | 2 +- vyper/evm/opcodes.py | 2 +- vyper/venom/basicblock.py | 1 + 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d6f50524d..8edb0c096a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: @@ -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] @@ -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 @@ -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' || '' }} diff --git a/docs/compiling-a-contract.rst b/docs/compiling-a-contract.rst index fdcb8b7271..3e0e48213f 100644 --- a/docs/compiling-a-contract.rst +++ b/docs/compiling-a-contract.rst @@ -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:: @@ -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 @@ -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). diff --git a/tests/conftest.py b/tests/conftest.py index 59bb76c493..4b3d90f65a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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", ) diff --git a/vyper/evm/opcodes.py b/vyper/evm/opcodes.py index 1861882d6f..3049d7f911 100644 --- a/vyper/evm/opcodes.py +++ b/vyper/evm/opcodes.py @@ -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 diff --git a/vyper/venom/basicblock.py b/vyper/venom/basicblock.py index 7c54145018..91faca03be 100644 --- a/vyper/venom/basicblock.py +++ b/vyper/venom/basicblock.py @@ -43,6 +43,7 @@ "sstore", "dstore", "istore", + "tstore", "dloadbytes", "calldatacopy", "mcopy",