Skip to content

Commit

Permalink
feat(ci,evm_transition_tool): Add EthereumJS (#752)
Browse files Browse the repository at this point in the history
* Add EthereumJS wrapper

* Change binary name for EthereumJS

* add ethereumjs action

* Correctly setup EthJS EVM action

* config/feature: update to not run slow and 2537 tests

* docs: add ethereumjs support to readme/index

* Update .github/actions/build-evm-client/ethjs/action.yml

Co-authored-by: Mario Vega <marioevz@gmail.com>

* Update .github/actions/build-evm-client/ethjs/action.yml

Co-authored-by: Mario Vega <marioevz@gmail.com>

---------

Co-authored-by: danceratopz <danceratopz@gmail.com>
Co-authored-by: Mario Vega <marioevz@gmail.com>
  • Loading branch information
3 people committed Sep 13, 2024
1 parent 061e41c commit 589ab4e
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/actions/build-evm-base/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,9 @@ runs:
with:
repo: ${{ steps.config-evm-reader.outputs.repo }}
ref: ${{ steps.config-evm-reader.outputs.ref }}
- name: Build the EVM using EthJS action
if: steps.config-evm-reader.outputs.impl == 'ethjs'
uses: ./.github/actions/build-evm-client/ethjs
with:
repo: ${{ steps.config-evm-reader.outputs.repo }}
ref: ${{ steps.config-evm-reader.outputs.ref }}
37 changes: 37 additions & 0 deletions .github/actions/build-evm-client/ethjs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 'Build EthereumJS monorepo'
description: 'Builds the EthereumJS monorepo'
inputs:
repo:
description: 'Source repository to use to build EthereumJS'
required: true
default: 'ethereumjs/ethereumjs-monorepo'
ref:
description: 'Reference to branch, commit, or tag to use to build EthereumJS'
required: true
default: 'master'
runs:
using: "composite"
steps:
- name: Checkout EthereumJS monorepo
uses: actions/checkout@v4
with:
repository: ${{ inputs.repo }}
ref: ${{ inputs.ref }}
path: ethereumjs

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Build monorepo
shell: bash
run: |
cd $GITHUB_WORKSPACE/ethereumjs
npm ci
- name: Add t8ntool to $PATH
shell: bash
run: |
echo $GITHUB_WORKSPACE/ethereumjs/packages/vm/test/t8n/ >> $GITHUB_PATH
echo $GITHUB_WORKSPACE/ethereumjs/node_modules/.bin >> $GITHUB_PATH
5 changes: 4 additions & 1 deletion .github/configs/evm-impl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ evmone:
x-dist: auto
besu:
evm-bin: evmtool
x-dist: 0
x-dist: 0
ethjs:
evm-bin: ethereumjs-t8ntool.sh
x-dist: auto
6 changes: 5 additions & 1 deletion .github/configs/evm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ eip7692:
eip7692-prague:
impl: besu
repo: hyperledger/besu
ref: main
ref: main
pectra-devnet-3:
impl: ethjs
repo: ethereumjs/ethereumjs-monorepo
ref: t8ntool
4 changes: 4 additions & 0 deletions .github/configs/feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ eip7692:
eip7692-prague:
evm-type: eip7692-prague
fill-params: --fork=PragueEIP7692 ./tests/prague -k "not slow"
solc: 0.8.21
pectra-devnet-3:
evm-type: pectra-devnet-3
fill-params: --fork=Prague -m "not slow and not 2537" ./tests/prague/
solc: 0.8.21
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ The following transition tools are supported by the framework:
| [ethereum/evmone](https://github.com/ethereum/evmone) | `evmone-t8n` | Yes |
| [ethereum/execution-specs](https://github.com/ethereum/execution-specs) | `ethereum-spec-evm` | Yes |
| [ethereum/go-ethereum](https://github.com/ethereum/go-ethereum) | [`evm t8n`](https://github.com/ethereum/go-ethereum/tree/master/cmd/evm) | Yes |
| [ethereumjs](https://github.com/ethereumjs/ethereumjs-monorepo) | [`ethereumjs-t8ntool.sh`](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/vm/test/t8n) | No |
| [hyperledger/besu](https://github.com/hyperledger/besu/tree/main/ethereum/evmtool) | [`evm t8n-server`](https://github.com/hyperledger/besu/tree/main/ethereum/evmtool) | Yes |
| [status-im/nimbus-eth1](https://github.com/status-im/nimbus-eth1) | [`t8n`](https://github.com/status-im/nimbus-eth1/blob/master/tools/t8n/readme.md) | Yes |

Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The following transition tools are supported by the framework:
| -------| ---------- | --------------- |
| [ethereum/evmone](https://github.com/ethereum/evmone) | `evmone-t8n` | Yes |
| [ethereum/execution-specs](https://github.com/ethereum/execution-specs) | `ethereum-spec-evm` | Yes |
| [ethereumjs](https://github.com/ethereumjs/ethereumjs-monorepo) | [`ethereumjs-t8ntool.sh`](https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/vm/test/t8n) | No |
| [ethereum/go-ethereum](https://github.com/ethereum/go-ethereum) | [`evm t8n`](https://github.com/ethereum/go-ethereum/tree/master/cmd/evm) | Yes |
| [hyperledger/besu](https://github.com/hyperledger/besu/tree/main/ethereum/evmtool) | [`evmtool t8n-server`](https://github.com/hyperledger/besu/tree/main/ethereum/evmtool) | Yes |
| [status-im/nimbus-eth1](https://github.com/status-im/nimbus-eth1) | [`t8n`](https://github.com/status-im/nimbus-eth1/blob/master/tools/t8n/readme.md) | Yes |
Expand Down
2 changes: 2 additions & 0 deletions src/evm_transition_tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

from .besu import BesuTransitionTool
from .ethereumjs import EthereumJSTransitionTool
from .evmone import EvmOneTransitionTool
from .execution_specs import ExecutionSpecsTransitionTool
from .geth import GethTransitionTool
Expand All @@ -14,6 +15,7 @@

__all__ = (
"BesuTransitionTool",
"EthereumJSTransitionTool",
"EvmOneTransitionTool",
"ExecutionSpecsTransitionTool",
"GethTransitionTool",
Expand Down
40 changes: 40 additions & 0 deletions src/evm_transition_tool/ethereumjs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""
EthereumJS Transition tool interface.
"""
from pathlib import Path
from re import compile
from typing import Optional

from ethereum_test_forks import Fork

from .transition_tool import TransitionTool


class EthereumJSTransitionTool(TransitionTool):
"""
EthereumJS Transition tool interface wrapper class.
"""

default_binary = Path("ethereumjs-t8ntool.sh")
detect_binary_pattern = compile(r"^ethereumjs t8n\b")
version_flag: str = "--version"
t8n_use_stream = False

binary: Path
cached_version: Optional[str] = None
trace: bool

def __init__(
self,
*,
binary: Optional[Path] = None,
trace: bool = False,
):
super().__init__(binary=binary, trace=trace)

def is_fork_supported(self, fork: Fork) -> bool:
"""
Returns True if the fork is supported by the tool.
Currently, EthereumJS-t8n provides no way to determine supported forks.
"""
return True
1 change: 1 addition & 0 deletions whitelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ NOP
NOPs
nPython
nSHA
t8ntool
num
number
ommer
Expand Down

0 comments on commit 589ab4e

Please sign in to comment.