Skip to content

Commit 6fb8a73

Browse files
committed
Set up github actions
1 parent f0e83c3 commit 6fb8a73

104 files changed

Lines changed: 2717 additions & 4125 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/evm-tests.yml

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
name: EVM Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
blockchain-test-0-12000:
11+
name: BlockchainTest [0-12000]
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: oven-sh/setup-bun@v2
17+
18+
- name: Cache bun dependencies
19+
uses: actions/cache@v4
20+
with:
21+
path: ~/.bun/install/cache
22+
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
23+
restore-keys: |
24+
bun-${{ runner.os }}-
25+
26+
- run: bun install
27+
28+
- name: Setup uv
29+
uses: astral-sh/setup-uv@v4
30+
31+
- name: Download test fixtures
32+
working-directory: packages/evm
33+
run: uvx --from "git+https://github.com/ethereum/execution-specs#subdirectory=packages/testing" consume cache --input=stable@latest --extract-to ./test-fixtures
34+
35+
- run: bun run build
36+
- run: LIMIT=12000 SKIP=0 bun test packages/evm/test/fixtures.test.ts --test-name-pattern=BlockchainTest
37+
38+
blockchain-test-12000-24000:
39+
name: BlockchainTest [12000-24000]
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- uses: oven-sh/setup-bun@v2
45+
46+
- name: Cache bun dependencies
47+
uses: actions/cache@v4
48+
with:
49+
path: ~/.bun/install/cache
50+
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
51+
restore-keys: |
52+
bun-${{ runner.os }}-
53+
54+
- run: bun install
55+
56+
- name: Setup uv
57+
uses: astral-sh/setup-uv@v4
58+
59+
- name: Download test fixtures
60+
working-directory: packages/evm
61+
run: uvx --from "git+https://github.com/ethereum/execution-specs#subdirectory=packages/testing" consume cache --input=stable@latest --extract-to ./test-fixtures
62+
63+
- run: bun run build
64+
- run: LIMIT=12000 SKIP=12000 bun test packages/evm/test/fixtures.test.ts --test-name-pattern=BlockchainTest
65+
66+
blockchain-test-24000-36000:
67+
name: BlockchainTest [24000-36000]
68+
runs-on: ubuntu-latest
69+
steps:
70+
- uses: actions/checkout@v4
71+
72+
- uses: oven-sh/setup-bun@v2
73+
74+
- name: Cache bun dependencies
75+
uses: actions/cache@v4
76+
with:
77+
path: ~/.bun/install/cache
78+
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
79+
restore-keys: |
80+
bun-${{ runner.os }}-
81+
82+
- run: bun install
83+
84+
- name: Setup uv
85+
uses: astral-sh/setup-uv@v4
86+
87+
- name: Download test fixtures
88+
working-directory: packages/evm
89+
run: uvx --from "git+https://github.com/ethereum/execution-specs#subdirectory=packages/testing" consume cache --input=stable@latest --extract-to ./test-fixtures
90+
91+
- run: bun run build
92+
- run: LIMIT=12000 SKIP=24000 bun test packages/evm/test/fixtures.test.ts --test-name-pattern=BlockchainTest
93+
94+
blockchain-test-36000-48000:
95+
name: BlockchainTest [36000-48000]
96+
runs-on: ubuntu-latest
97+
steps:
98+
- uses: actions/checkout@v4
99+
100+
- uses: oven-sh/setup-bun@v2
101+
102+
- name: Cache bun dependencies
103+
uses: actions/cache@v4
104+
with:
105+
path: ~/.bun/install/cache
106+
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
107+
restore-keys: |
108+
bun-${{ runner.os }}-
109+
110+
- run: bun install
111+
112+
- name: Setup uv
113+
uses: astral-sh/setup-uv@v4
114+
115+
- name: Download test fixtures
116+
working-directory: packages/evm
117+
run: uvx --from "git+https://github.com/ethereum/execution-specs#subdirectory=packages/testing" consume cache --input=stable@latest --extract-to ./test-fixtures
118+
119+
- run: bun run build
120+
- run: LIMIT=12000 SKIP=36000 bun test packages/evm/test/fixtures.test.ts --test-name-pattern=BlockchainTest
121+
122+
state-test-0-12000:
123+
name: StateTest [0-12000]
124+
runs-on: ubuntu-latest
125+
steps:
126+
- uses: actions/checkout@v4
127+
128+
- uses: oven-sh/setup-bun@v2
129+
130+
- name: Cache bun dependencies
131+
uses: actions/cache@v4
132+
with:
133+
path: ~/.bun/install/cache
134+
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
135+
restore-keys: |
136+
bun-${{ runner.os }}-
137+
138+
- run: bun install
139+
140+
- name: Setup uv
141+
uses: astral-sh/setup-uv@v4
142+
143+
- name: Download test fixtures
144+
working-directory: packages/evm
145+
run: uvx --from "git+https://github.com/ethereum/execution-specs#subdirectory=packages/testing" consume cache --input=stable@latest --extract-to ./test-fixtures
146+
147+
- run: bun run build
148+
- run: LIMIT=12000 SKIP=0 bun test packages/evm/test/fixtures.test.ts --test-name-pattern=StateTest
149+
150+
state-test-12000-24000:
151+
name: StateTest [12000-24000]
152+
runs-on: ubuntu-latest
153+
steps:
154+
- uses: actions/checkout@v4
155+
156+
- uses: oven-sh/setup-bun@v2
157+
158+
- name: Cache bun dependencies
159+
uses: actions/cache@v4
160+
with:
161+
path: ~/.bun/install/cache
162+
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
163+
restore-keys: |
164+
bun-${{ runner.os }}-
165+
166+
- run: bun install
167+
168+
- name: Setup uv
169+
uses: astral-sh/setup-uv@v4
170+
171+
- name: Download test fixtures
172+
working-directory: packages/evm
173+
run: uvx --from "git+https://github.com/ethereum/execution-specs#subdirectory=packages/testing" consume cache --input=stable@latest --extract-to ./test-fixtures
174+
175+
- run: bun run build
176+
- run: LIMIT=12000 SKIP=12000 bun test packages/evm/test/fixtures.test.ts --test-name-pattern=StateTest
177+
178+
state-test-24000-36000:
179+
name: StateTest [24000-36000]
180+
runs-on: ubuntu-latest
181+
steps:
182+
- uses: actions/checkout@v4
183+
184+
- uses: oven-sh/setup-bun@v2
185+
186+
- name: Cache bun dependencies
187+
uses: actions/cache@v4
188+
with:
189+
path: ~/.bun/install/cache
190+
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
191+
restore-keys: |
192+
bun-${{ runner.os }}-
193+
194+
- run: bun install
195+
196+
- name: Setup uv
197+
uses: astral-sh/setup-uv@v4
198+
199+
- name: Download test fixtures
200+
working-directory: packages/evm
201+
run: uvx --from "git+https://github.com/ethereum/execution-specs#subdirectory=packages/testing" consume cache --input=stable@latest --extract-to ./test-fixtures
202+
203+
- run: bun run build
204+
- run: LIMIT=12000 SKIP=24000 bun test packages/evm/test/fixtures.test.ts --test-name-pattern=StateTest
205+
206+
state-test-36000-48000:
207+
name: StateTest [36000-48000]
208+
runs-on: ubuntu-latest
209+
steps:
210+
- uses: actions/checkout@v4
211+
212+
- uses: oven-sh/setup-bun@v2
213+
214+
- name: Cache bun dependencies
215+
uses: actions/cache@v4
216+
with:
217+
path: ~/.bun/install/cache
218+
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
219+
restore-keys: |
220+
bun-${{ runner.os }}-
221+
222+
- run: bun install
223+
224+
- name: Setup uv
225+
uses: astral-sh/setup-uv@v4
226+
227+
- name: Download test fixtures
228+
working-directory: packages/evm
229+
run: uvx --from "git+https://github.com/ethereum/execution-specs#subdirectory=packages/testing" consume cache --input=stable@latest --extract-to ./test-fixtures
230+
231+
- run: bun run build
232+
- run: LIMIT=12000 SKIP=36000 bun test packages/evm/test/fixtures.test.ts --test-name-pattern=StateTest

README.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# evm-effect
2+
3+
An Ethereum Virtual Machine (EVM) implementation in TypeScript using the [Effect](https://effect.website/) library, with a focus on debuggability.
4+
5+
This implementation is designed for building developer tooling that requires deep introspection into EVM execution — such as debuggers, tracers, profilers, and testing frameworks. The Effect-TS foundation provides structured concurrency, typed errors, and built-in tracing capabilities that make it straightforward to observe and analyze every step of execution.
6+
7+
> **Note:** This project is not yet published to npm. The API is still in flux and will likely go through significant changes before the first stable release.
8+
9+
## Test Coverage
10+
11+
This implementation is extensively tested against the official [Ethereum Execution Specs](https://github.com/ethereum/execution-specs) state tests and blockchain tests:
12+
13+
```shell
14+
➜ evm-effect git:(main) ✗ bun test packages/evm/test/fixtures.test.ts
15+
...
16+
17+
91392 pass
18+
0 fail
19+
2851964 expect() calls
20+
Ran 91392 tests across 1 file. [11202.85s]
21+
```
22+
23+
## Supported Forks
24+
25+
All released Ethereum forks are supported:
26+
27+
| Fork | Status |
28+
|------|--------|
29+
| Frontier ||
30+
| Homestead ||
31+
| Tangerine Whistle ||
32+
| Spurious Dragon ||
33+
| Byzantium ||
34+
| Constantinople ||
35+
| Petersburg ||
36+
| Istanbul ||
37+
| Muir Glacier ||
38+
| Berlin ||
39+
| London ||
40+
| Paris (The Merge) ||
41+
| Shanghai ||
42+
| Cancun ||
43+
| Prague ||
44+
| Osaka (Unreleased) | 🚧 In Progress |
45+
46+
## Packages
47+
48+
This monorepo contains the following packages:
49+
50+
| Package | Description |
51+
|---------|-------------|
52+
| `@evm-effect/evm` | Core EVM implementation with interpreter, block/transaction processing, state management, precompiles, and EIP-3155 tracing |
53+
| `@evm-effect/ethereum-types` | Core Ethereum types (Address, Bytes, U256, etc.) |
54+
| `@evm-effect/rlp` | RLP encoding and decoding |
55+
| `@evm-effect/crypto` | Cryptographic primitives (keccak256, sha256, transaction signing) |
56+
| `@evm-effect/solc` | Solidity compiler wrapper with typed schemas |
57+
| `@evm-effect/shared` | Shared utilities (HashMap, HashSet) |
58+
| `@evm-effect/examples` | Usage examples (contract deployment, transactions) |
59+
60+
## Usage
61+
62+
### Simple ETH Transfer
63+
64+
```typescript
65+
import { Effect } from "effect";
66+
import {
67+
Account, applyBody, BlockChain, BlockEnvironment,
68+
Fork, LegacyTransaction, State
69+
} from "@evm-effect/evm";
70+
import { Address, Bytes, U64, U256, Uint } from "@evm-effect/ethereum-types";
71+
72+
const program = Effect.gen(function* () {
73+
// Create empty blockchain
74+
const chainId = U64.constant(1n);
75+
const blockchain = BlockChain.empty(chainId);
76+
77+
// Fund Alice with 10 ETH
78+
const alice = new Address("0xaaaa...");
79+
yield* State.setAccount(blockchain.state, alice, Account.make({
80+
nonce: Uint.constant(0n),
81+
balance: U256.constant(10n * 10n ** 18n),
82+
code: Bytes.empty(),
83+
}));
84+
85+
// Create and execute transaction...
86+
const blockOutput = yield* applyBody(blockEnv, [signedTx], [], []);
87+
});
88+
89+
// Run with London fork
90+
Effect.runPromise(program.pipe(Effect.provide(Fork.london())));
91+
```
92+
93+
## Installation
94+
95+
This project is **not yet published to npm**. The API is still being refined and will likely undergo changes.
96+
97+
To use from source:
98+
99+
```bash
100+
git clone https://github.com/your-username/evm-effect.git
101+
cd evm-effect
102+
bun install
103+
bun run build
104+
```
105+
106+
## License
107+
108+
MIT

0 commit comments

Comments
 (0)