Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/assets/hive/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#
# We'll use cargo-chef to speed up the build
#
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
# MSRV 1.95 (reth v2.4.0); pinned so stale cached latest-rust-1 digests cannot silently drop below it
FROM lukemathwalker/cargo-chef:latest-rust-1.97 AS chef
WORKDIR /app

# Install system dependencies
Expand Down
25 changes: 22 additions & 3 deletions .github/assets/hive/build_simulators.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
#!/usr/bin/env bash
# Synced with reth v1.11.4
# Synced with reth v2.4.0
set -eo pipefail

fixture_variant="${1:-osaka}"

case "${fixture_variant}" in
osaka)
eels_fixtures="https://github.com/ethereum/execution-spec-tests/releases/download/v5.3.0/fixtures_develop.tar.gz"
eels_branch="mainnet"
;;
*)
echo "unknown hive fixture variant: ${fixture_variant}"
exit 1
;;
esac

# Create the hive_assets directory
mkdir hive_assets/

Expand All @@ -12,8 +25,14 @@ go build .

# Run each hive command in the background for each simulator and wait
echo "Building images"
# TODO: test code has been moved from https://github.com/ethereum/execution-spec-tests to https://github.com/ethereum/execution-specs we need to pin eels branch with `--sim.buildarg branch=<release-branch-name>` once we have the fusaka release tagged on the new repo
./hive -client bera-reth --sim "ethereum/eels" --sim.buildarg fixtures=https://github.com/ethereum/execution-spec-tests/releases/download/v5.3.0/fixtures_develop.tar.gz -sim.timelimit 1s || true &
./hive -client bera-reth --sim "ethereum/eels/consume-engine" \
--sim.buildarg fixtures="${eels_fixtures}" \
--sim.buildarg branch="${eels_branch}" \
--sim.timelimit 1s || true &
./hive -client bera-reth --sim "ethereum/eels/consume-rlp" \
--sim.buildarg fixtures="${eels_fixtures}" \
--sim.buildarg branch="${eels_branch}" \
--sim.timelimit 1s || true &
./hive -client bera-reth --sim "ethereum/engine" -sim.timelimit 1s || true &
./hive -client bera-reth --sim "devp2p" -sim.timelimit 1s || true &
./hive -client bera-reth --sim "ethereum/rpc-compat" -sim.timelimit 1s || true &
Expand Down
2 changes: 1 addition & 1 deletion .github/assets/hive/expected_failures.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Synced with reth v1.11.4
# Last tuned against reth v1.11.4; re-validate via a hive run on the reth v2.4.0 nightly image
# tracked by https://github.com/paradigmxyz/reth/issues/13879
rpc-compat:
- debug_getRawBlock/get-invalid-number (bera-reth)
Expand Down
2 changes: 1 addition & 1 deletion .github/assets/hive/ignored_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Synced with reth v1.11.4
# Last tuned against reth v1.11.4; re-validate via a hive run on the reth v2.4.0 nightly image
# Ignored Tests Configuration
#
# This file contains tests that should be ignored for various reasons (flaky, known issues, etc).
Expand Down
2 changes: 1 addition & 1 deletion .github/assets/hive/parse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copied from reth v1.8.1
# Synced with reth v2.4.0
import json
import yaml
import sys
Expand Down
22 changes: 20 additions & 2 deletions .github/assets/hive/run_simulator.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
#!/usr/bin/env bash
# Copied from reth v1.8.1
# Synced with reth v2.4.0
# set -x

cd hivetests/
Comment thread
calbera marked this conversation as resolved.

sim="${1}"
limit="${2}"
fixture_variant="${3:-}"

if [[ "${fixture_variant}" == "osaka" && "${sim}" == *"eels"* && "${limit}" == *"tests/amsterdam"* ]]; then
echo "osaka fixtures do not support amsterdam tests"
exit 1
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.

# Use lower parallelism for eels tests to avoid OOM-killing the runner
parallelism=16
if [[ "${sim}" == *"eels"* ]]; then
parallelism=4
fi

run_hive() {
hive --sim "${sim}" --sim.limit "${limit}" --sim.parallelism 8 --client bera-reth 2>&1 | tee /tmp/log || true
hive \
--sim "${sim}" \
--sim.limit "${limit}" \
--sim.limit.exact=false \
--sim.parallelism "${parallelism}" \
--client bera-reth \
2>&1 | tee /tmp/log || true
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
}

check_log() {
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ jobs:
network:
- name: berachain
chain_id: 80094
genesis_url: https://raw.githubusercontent.com/berachain/beacon-kit/main/testing/networks/80094/eth-genesis.json
peers_url: https://raw.githubusercontent.com/berachain/beacon-kit/main/testing/networks/80094/el-peers.txt
genesis_url: https://raw.githubusercontent.com/berachain/beacon-kit/v1.4.2-rc.0/testing/networks/80094/eth-genesis.json
peers_url: https://raw.githubusercontent.com/berachain/beacon-kit/v1.4.2-rc.0/testing/networks/80094/el-peers.txt
Comment thread
calbera marked this conversation as resolved.
Outdated
etherscan_url: https://api.etherscan.io/v2/api?chainid=80094
max_block: 1500000
- name: berachain-bepolia
chain_id: 80069
genesis_url: https://raw.githubusercontent.com/berachain/beacon-kit/main/testing/networks/80069/eth-genesis.json
peers_url: https://raw.githubusercontent.com/berachain/beacon-kit/main/testing/networks/80069/el-peers.txt
genesis_url: https://raw.githubusercontent.com/berachain/beacon-kit/v1.4.2-rc.0/testing/networks/80069/eth-genesis.json
peers_url: https://raw.githubusercontent.com/berachain/beacon-kit/v1.4.2-rc.0/testing/networks/80069/el-peers.txt
etherscan_url: https://api.etherscan.io/v2/api?chainid=80069
max_block: 8600000
steps:
Expand Down Expand Up @@ -84,6 +84,8 @@ jobs:
--debug.terminate \
--trusted-peers "$TRUSTED_PEERS" \
-vvv
- name: Show storage settings
run: ./target/maxperf/bera-reth db --datadir ./tmp --chain ./eth-genesis.json settings || true
- name: Verify sync progress
run: |
# Start node with HTTP API enabled
Expand Down
18 changes: 9 additions & 9 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ Bera-Reth is a high-performance Rust execution client for Berachain, built on th

## Project Overview

**What**: Rust execution client for Berachain using Reth SDK
**Status**: In development, not production ready
**What**: Rust execution client for Berachain using Reth SDK (git tag `v2.4.0` across all reth-* deps; reth node crates are not on crates.io)
**Status**: Production (runs Berachain mainnet)
**Toolchain**: MSRV 1.95, edition 2024; `make pr` uses nightly for fmt/clippy
**Architecture**: Standard Ethereum execution with Berachain-specific chain configuration
**Key Difference**: Prague1 hardfork activated at genesis (time: 0) for 1 gwei minimum base fee
**Key Differences**: Berachain fork ladder (Prague1–4, Osaka1), PoL system transaction (type 0x7E), custom header with `prevProposerPubkey`, 1 gwei minimum base fee from genesis

## Core Architecture

Expand All @@ -16,22 +17,20 @@ Bera-Reth is a high-performance Rust execution client for Berachain, built on th
- **Genesis Configuration**: `src/genesis/mod.rs:53` - Prague1 fork timing
- **Hardforks**: `src/hardforks/mod.rs` - Prague1 activation logic
- **Node Builder**: `src/node/mod.rs` - Reth SDK integration
- **CLI**: `src/node/cli.rs` - Command-line interface
- **CLI / Entry Point**: `src/main.rs` - Command-line interface wiring

### Reference Implementations
Users should clone these repositories alongside bera-reth for development reference:

- **Prime Reference**: [Reth](https://github.com/paradigmxyz/reth) - Study `src/main.rs` and node builder patterns
- **Inspiration**: [Reth-BSC](https://github.com/paradigmxyz/reth/tree/main/examples/bsc) - Chain-specific adaptations
- **Integration**: [BeaconKit](https://github.com/berachain/beacon-kit) - Required for local testing
- **Integration**: [BeaconKit](https://github.com/berachain/beacon-kit) (v1.4.2) - Required for local testing

Recommended directory structure:
```
Comment thread
calbera marked this conversation as resolved.
Code/
├── bera-reth/ # This repository
├── reth/ # git clone https://github.com/paradigmxyz/reth.git
├── reth-bsc/ # git clone https://github.com/paradigmxyz/reth.git reth-bsc && cd reth-bsc && git checkout examples/bsc
└── beacon-kit/ # git clone https://github.com/berachain/beacon-kit.git
├── reth/ # git clone https://github.com/paradigmxyz/reth.git && cd reth && git checkout v2.4.0
└── beacon-kit/ # git clone --branch v1.4.2-rc.0 https://github.com/berachain/beacon-kit.git
```

## Development Workflow
Expand Down Expand Up @@ -115,6 +114,7 @@ make pr-fix
- Monitor both BeaconKit and Reth logs with prefixes
- Check genesis file generation: `.tmp/beacond/eth-genesis.json`
- Verify port availability: 8545, 8551, 30303, 3500
- Fresh datadirs use reth Storage V2 (RocksDB + static files alongside MDBX); see docs/storage-v2.md

### Performance Optimization
- Focus on Reth SDK optimization patterns
Expand Down
Loading