Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci,evm_transition_tool): Add EthereumJS #752

Merged
merged 10 commits into from
Sep 13, 2024
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 }}
36 changes: 36 additions & 0 deletions .github/actions/build-evm-client/ethjs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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: 't8ntool'
jochem-brouwer marked this conversation as resolved.
Show resolved Hide resolved
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
run: |
jochem-brouwer marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -13,4 +13,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 -k "not slow"
jochem-brouwer marked this conversation as resolved.
Show resolved Hide resolved
solc: 0.8.21
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