generated from rollkit/template-da-repo
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: initial EVM Execution Client Implementation (#10)
* feat: evm client implementation * chore: add docker setup for reth * chore: gitignore jwt token * feat: support json-rpc proxy client * refactor: separate proxy client from engine api client * chore: naming changes * chore: address initial PR review comments * chore: address initial PR review comments batch II * refactor: remove redundant abstraction in the proxy layer * chore: rm rollkit as a dependency * chore: refine client implementation and tests * chore: update execution api interface name * chore: renaming go-execution types import path * refactor: move mocks to its own pkg * test: SetFinal unit test passing * chore: add ctx in executor methods * feat: upgrade to engine api cancun * spin up local network for tests * init reth db for the local test network * add integration tests * merge changes - upgrade to cancun api * merge base: upgrade to cancun api * programatically setup docker dependencies for integration tests * fix integration test cleanup * add integration test for GetTxs * fix getTxs integration test to assert the tx in mempool * Add integration tests for evm api's * fix mandatory field validation for payload creation * send signed transaction to execution layer client * feat: add proper jwt auth in engine api calls * refactor: use more concrete types for building engine api payloads * fix blockhash for block proposal * upgrade reth version for integration tests * merge jay/execution-api * fix initChain unit tests * fix executeTxs api unit tests * fix initChain api integration tests * fix reth setup for integration tests * fix genproto module dependency * downgrade go-ethereum * fix: block hash mismatch when executing txs * test: fix ExecuteTxs * chore: remove redundant debug prints --------- Co-authored-by: Janani Anbarasan <[email protected]>
- Loading branch information
1 parent
86bb3fb
commit 1403e27
Showing
11 changed files
with
1,710 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
docker/jwttoken/* | ||
!docker/jwttoken/.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Package", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "auto", | ||
"program": "${fileDirname}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
## Architecture | ||
|
||
```mermaid | ||
graph LR | ||
subgraph Test Environment | ||
TestClient[Test Client] | ||
MockExecutor[Mock Executor] | ||
end | ||
subgraph Execution Client | ||
EngineAPIExecutionClient | ||
subgraph Client Components | ||
EthClient[Eth Client] | ||
JsonRpcClient[JSON-RPC Client] | ||
end | ||
end | ||
subgraph Execution Layer | ||
Reth[Reth Node] | ||
subgraph Reth APIs | ||
EngineAPI[Engine API] | ||
JsonRPC[JSON-RPC API] | ||
end | ||
end | ||
%% Test Environment Connections | ||
TestClient -->|uses| EngineAPIExecutionClient | ||
JsonRpcClient -->|test mode| MockExecutor | ||
%% Execution Client Connections | ||
EngineAPIExecutionClient -->|eth calls| EthClient | ||
EngineAPIExecutionClient -->|engine calls| JsonRpcClient | ||
EthClient -->|eth/net/web3| JsonRPC | ||
JsonRpcClient -->|engine api| EngineAPI | ||
%% Reth Internal Connections | ||
JsonRPC -->|internal| Reth | ||
EngineAPI -->|internal| Reth | ||
%% Styling | ||
classDef primary fill:#f9f,stroke:#333,stroke-width:2px | ||
classDef secondary fill:#bbf,stroke:#333,stroke-width:1px | ||
class EngineAPIExecutionClient primary | ||
class EthClient,JsonRpcClient,MockExecutor,EngineAPI,JsonRPC secondary | ||
``` | ||
|
||
The architecture consists of several key components: | ||
|
||
1. **Execution Client** | ||
|
||
- `EngineAPIExecutionClient`: Main client interface that implements the Execute interface | ||
- `EthClient`: Handles standard Ethereum JSON-RPC calls | ||
- `JsonRpcClient`: Handles Engine API calls | ||
|
||
2. **Execution Layer** | ||
|
||
- `Reth Node`: Ethereum execution client | ||
- Exposes Engine API and standard JSON-RPC endpoints | ||
|
||
3. **Test Environment** | ||
- `Test Client`: Integration tests | ||
- `Mock Executor`: Simulates execution behavior for unit tests | ||
|
||
## Development | ||
|
||
```bash | ||
$ cd docker | ||
$ docker compose up -d | ||
$ docker compose down | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"config": { | ||
"chainId": 1234, | ||
"homesteadBlock": 0, | ||
"eip150Block": 0, | ||
"eip155Block": 0, | ||
"eip158Block": 0, | ||
"byzantiumBlock": 0, | ||
"constantinopleBlock": 0, | ||
"petersburgBlock": 0, | ||
"istanbulBlock": 0, | ||
"berlinBlock": 0, | ||
"londonBlock": 0, | ||
"shanghaiTime": 1677557088, | ||
"cancunTime": 1710338100 | ||
}, | ||
"alloc": { | ||
"0xd143C405751162d0F96bEE2eB5eb9C61882a736E": { | ||
"balance": "0x4a47e3c12448f4ad000000" | ||
}, | ||
"0x944fDcD1c868E3cC566C78023CcB38A32cDA836E": { | ||
"balance": "0x4a47e3c12448f4ad000000" | ||
} | ||
}, | ||
"coinbase": "0x0000000000000000000000000000000000000000", | ||
"difficulty": "0x20000", | ||
"extraData": "", | ||
"gasLimit": "0xf4240", | ||
"nonce": "0x0000000000000042", | ||
"mixhash": "0x2c85bcbce56429100b2108254bb56906257582aeafcbd682bc9af67a9f5aee46", | ||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"timestamp": "0x00" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: "reth" | ||
|
||
services: | ||
jwt-init: | ||
container_name: jwt-init | ||
image: alpine:3.19 | ||
volumes: | ||
- ./jwttoken:/jwt | ||
healthcheck: | ||
test: ["CMD", "test", "-f", "/jwt/jwt.hex"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 3 | ||
command: > | ||
/bin/sh -c "mkdir -p /jwt && | ||
if [ ! -f /jwt/jwt.hex ]; then | ||
apk add --no-cache openssl && | ||
openssl rand -hex 32 | tr -d '\n' > /jwt/jwt.hex; | ||
fi" | ||
reth: | ||
container_name: reth | ||
restart: unless-stopped | ||
image: ghcr.io/paradigmxyz/reth:v1.1.1 | ||
depends_on: | ||
jwt-init: | ||
condition: service_completed_successfully | ||
ports: | ||
- "9001:9001" # metrics | ||
- "30303:30303" # eth/66 peering | ||
- "8545:8545" # rpc | ||
- "8551:8551" # engine | ||
volumes: | ||
- mainnet_data:/root/.local/share/reth/mainnet | ||
- sepolia_data:/root/.local/share/reth/sepolia | ||
- holesky_data:/root/.local/share/reth/holesky | ||
- logs:/root/logs | ||
- ./jwttoken:/root/jwt:ro | ||
- ./chain:/root/chain:ro | ||
pid: host | ||
entrypoint: /bin/sh -c | ||
command: | ||
- | | ||
reth init --chain /root/chain/genesis.json | ||
reth node \ | ||
--chain /root/chain/genesis.json \ | ||
--metrics 0.0.0.0:9001 \ | ||
--log.file.directory /root/logs \ | ||
--authrpc.addr 0.0.0.0 \ | ||
--authrpc.port 8551 \ | ||
--authrpc.jwtsecret /root/jwt/jwt.hex \ | ||
--http --http.addr 0.0.0.0 --http.port 8545 \ | ||
--http.api "eth,net,web3,txpool" \ | ||
--disable-discovery \ | ||
--debug.tip 0x8bf225d50da44f60dee1c4ee6f810fe5b44723c76ac765654b6692d50459f216 \ | ||
-vvvvv | ||
volumes: | ||
mainnet_data: | ||
driver: local | ||
sepolia_data: | ||
driver: local | ||
holesky_data: | ||
driver: local | ||
logs: | ||
driver: local |
Oops, something went wrong.