Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const config: HardhatUserConfig = {

networks: {
"geth-dev": firehoseNetwork([]),
"reth-dev": firehoseNetwork([]),
"arbitrum-geth-dev": firehoseNetwork([]),
"arbitrum-nitro-dev": { ...firehoseNetwork([]), url: "http://127.0.0.1:8547" },
"optimism-geth-dev": firehoseNetwork([]),
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"test:fh2.3:arbitrum-geth-dev": "cross-env SNAPSHOTS_TAG=fh2.3 hardhat test --network arbitrum-geth-dev",
"test:fh2.3:arbitrum-nitro-dev": "cross-env SNAPSHOTS_TAG=fh2.3 hardhat test --network arbitrum-nitro-dev",
"test:fh3.0:geth-dev": "cross-env SNAPSHOTS_TAG=fh3.0 hardhat test --network geth-dev",
"test:fh3.0:reth-dev": "cross-env SNAPSHOTS_TAG=fh3.0 FIREHOSE_GRPC_URL=https://localhost:10001 NODE_TLS_REJECT_UNAUTHORIZED=0 SKIP_FRESH_CHAIN_ONLY_TESTS=1 hardhat test --network reth-dev",
"test:fh3.0:optimism-geth-dev": "cross-env SNAPSHOTS_TAG=fh3.0 hardhat test --network optimism-geth-dev",
"test:fh3.0:sei-dev": "cross-env SNAPSHOTS_TAG=fh3.0/sei-dev hardhat test --network sei-dev",
"test:fh3.0:bnb-dev": "cross-env SNAPSHOTS_TAG=fh3.0 hardhat test --network bnb-dev",
Expand Down
91 changes: 91 additions & 0 deletions scripts/.logs/firehose.out.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Running Reth dev node with Firehose tracer via 'fireeth'
2025-10-10T15:56:35.180-0400 INFO (dtracing) registering development exporters from environment variables
2025-10-10T15:56:35.180-0400 INFO (fireeth) starting Firehose on Ethereum with config file ''
2025-10-10T15:56:35.338-0400 INFO (fireeth) launching applications: firehose,merger,reader-node,relayer,substreams-tier1,substreams-tier2
2025-10-10T15:56:35.338-0400 INFO (firehose) auth plugin instantiation {"plugin_kind": "null"}
2025-10-10T15:56:35.338-0400 INFO (firehose) local session pool initialized {"max_sessions": 30, "max_sessions_per_user": 3, "max_workers": 100, "max_workers_per_session": 100, "max_workers_per_user": 100}
2025-10-10T15:56:35.338-0400 INFO (reader-node) parsing backup configs {"configs": [], "factory_count": 1}
2025-10-10T15:56:35.338-0400 INFO (reader-node) parsing backup known factory {"name": "gke-pvc-snapshot"}
2025-10-10T15:56:35.338-0400 INFO (reader-node) adding superviser shutdown to plugins {"plugin_name": "ToConsoleLogPlugin"}
2025-10-10T15:56:35.338-0400 INFO (reader-node) registered log plugin {"plugin count": 1}
2025-10-10T15:56:35.339-0400 INFO (reader-node) creating operator {"options": {"Bootstrapper":null,"EnableSupervisorMonitoring":true,"ShutdownDelay":0}}
2025-10-10T15:56:35.339-0400 INFO (reader-node) creating mindreader plugin {"one_blocks_store_url": "file:///Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/storage/one-blocks", "one_block_suffix": "default", "working_directory": "/Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/reader/work", "start_block_num": 0, "stop_block_num": 0, "channel_capacity": 100, "with_head_block_updater": true, "with_shutdown_func": true}
2025-10-10T15:56:35.339-0400 INFO (reader-node) creating new mindreader plugin
2025-10-10T15:56:35.339-0400 INFO (reader-node) adding superviser shutdown to plugins {"plugin_name": "MindReaderPlugin"}
2025-10-10T15:56:35.339-0400 INFO (reader-node) registered log plugin {"plugin count": 2}
2025-10-10T15:56:35.339-0400 INFO (substreams-tier1) auth plugin instantiation {"plugin_kind": "null"}
2025-10-10T15:56:35.339-0400 INFO (substreams-tier1) local session pool initialized {"max_sessions": 30, "max_sessions_per_user": 3, "max_workers": 100, "max_workers_per_session": 100, "max_workers_per_user": 100}
2025-10-10T15:56:35.339-0400 INFO (relayer) starting relayer {"sources_addr": [":10010"], "grpc_listen_addr": ":10014", "source_request_burst": 0, "max_source_latency": "999999h0m0s", "one_blocks_url": "file:///Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/storage/one-blocks"}
2025-10-10T15:56:35.339-0400 INFO (dgrpc) standard server created
2025-10-10T15:56:35.339-0400 INFO (firehose) running firehose {"config": {"MergedBlocksStoreURL":"file:///Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/storage/merged-blocks","OneBlocksStoreURL":"file:///Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/storage/one-blocks","ForkedBlocksStoreURL":"file:///Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/storage/forked-blocks","BlockStreamAddr":":10014","GRPCListenAddr":":10001","GRPCShutdownGracePeriod":1000000000,"ServiceDiscoveryURL":null}}
2025-10-10T15:56:35.339-0400 INFO (merger) running merger {"config": {"StorageOneBlockFilesPath":"file:///Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/storage/one-blocks","StorageMergedBlocksFilesPath":"file:///Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/storage/merged-blocks","StorageForkedBlocksFilesPath":"file:///Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/storage/forked-blocks","FilesDeleteThreads":8,"GRPCListenAddr":":10012","PruneForkedBlocksAfter":50000,"TimeBetweenPruning":60000000000,"TimeBetweenPolling":1000000000,"StopBlock":0}}
2025-10-10T15:56:35.339-0400 INFO (reader-node) running node manager app {"config": {"StartupDelay":0,"HTTPAddr":":10011","ConnectionWatchdog":false,"GRPCAddr":":10010"}, "mindreader": true}
2025-10-10T15:56:35.339-0400 INFO (substreams-tier2) running substreams-tier2 {"config": {"GRPCListenAddr":":10017","ServiceDiscoveryURL":null,"PipelineOptions":null,"MaximumConcurrentRequests":0,"WASMExtensions":{},"BlockExecutionTimeout":180000000000,"SegmentExecutionTimeout":3600000000000,"TmpDir":"/Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/tmp","Tracing":false}}
2025-10-10T15:56:35.339-0400 INFO (reader-node) retrieved hostname from os {"hostname": "Ulysses-MacBook-Pro.local"}
2025-10-10T15:56:35.339-0400 INFO (reader-node) starting mindreader gRPC server
2025-10-10T15:56:35.339-0400 INFO (substreams-tier1) running substreams-tier1 {"config": {"MeteringConfig":"null://","FoundationalStoresConfigPath":"","MergedBlocksStoreURL":"file:///Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/storage/merged-blocks","OneBlocksStoreURL":"file:///Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/storage/one-blocks","ForkedBlocksStoreURL":"file:///Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/storage/forked-blocks","BlockStreamAddr":":10014","GRPCListenAddr":":10016","GRPCShutdownGracePeriod":1000000000,"ServiceDiscoveryURL":null,"BlockExecutionTimeout":180000000000,"TmpDir":"/Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/tmp","StateStoreURL":"/Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/.firehose-data/localdata","QuickSaveStoreURL":"","StateStoreDefaultTag":"","BlockType":"","StateBundleSize":1000,"EnforceCompression":true,"ActiveRequestsSoftLimit":0,"ActiveRequestsHardLimit":0,"MaxSubrequests":4,"SubrequestsEndpoint":":10017","SubrequestsInsecure":false,"SubrequestsPlaintext":true,"SharedCacheSize":15,"WASMExtensions":{},"Tracing":false}}
2025-10-10T15:56:35.339-0400 INFO (reader-node) standard server created
2025-10-10T15:56:35.339-0400 INFO (bstream) New forkable hub initialized {"source_chan_size": 100, "keep_final_blocks": 10}
2025-10-10T15:56:35.339-0400 INFO (substreams-tier2) registering substreams metrics
2025-10-10T15:56:35.339-0400 INFO (substreams-tier2) setting up trust authenticator
2025-10-10T15:56:35.339-0400 INFO (bstream) New forkable hub initialized {"source_chan_size": 100, "keep_final_blocks": 500}
2025-10-10T15:56:35.339-0400 INFO (substreams-tier2) launching gRPC server
2025-10-10T15:56:35.339-0400 INFO (substreams-tier2) standard server created
2025-10-10T15:56:35.339-0400 INFO (bstream) New forkable hub initialized {"source_chan_size": 100, "keep_final_blocks": 200}
2025-10-10T15:56:35.339-0400 INFO (substreams-tier2) launching gRPC server {"listen_addr": ":10017"}
2025-10-10T15:56:35.339-0400 INFO (substreams-clients) setting up basic grpc client factory (no XDS bootstrap)
2025-10-10T15:56:35.339-0400 INFO (relayer) waiting for hub to be ready...
2025-10-10T15:56:35.339-0400 INFO (merger) merger initiated
2025-10-10T15:56:35.339-0400 WARN (bstream) bootstrapping from one-block-files incomplete. Will bootstrap from incoming live blocks {"error": "no one blocks found"}
2025-10-10T15:56:35.340-0400 WARN (bstream) bootstrapping from one-block-files incomplete. Will bootstrap from incoming live blocks {"error": "no one blocks found"}
2025-10-10T15:56:35.339-0400 INFO (reader-node) launching operator
2025-10-10T15:56:35.340-0400 INFO (reader-node) launching operator HTTP server {"http_listen_addr": ":10011"}
2025-10-10T15:56:35.340-0400 WARN (bstream) bootstrapping from one-block-files incomplete. Will bootstrap from incoming live blocks {"error": "no one blocks found"}
2025-10-10T15:56:35.340-0400 INFO (merger) merger running
2025-10-10T15:56:35.340-0400 INFO (firehose) waiting until hub is real-time synced
2025-10-10T15:56:35.340-0400 INFO (reader-node) launching gRPC server {"listen_addr": ":10010"}
2025-10-10T15:56:35.340-0400 ERRO (fireeth)
################################################################
Fatal error in app substreams-tier2:

tcp listening to ":10017": listen tcp :10017: bind: address already in use
################################################################
2025-10-10T15:56:35.340-0400 INFO (relayer) new source factory created
2025-10-10T15:56:35.340-0400 INFO (reader-node) operator is terminating {"error": "tcp listening to \":10010\": listen tcp :10010: bind: address already in use"}
2025-10-10T15:56:35.340-0400 INFO (reader-node) superviser is terminating
2025-10-10T15:56:35.340-0400 INFO (reader-node) supervisor received a stop request, terminating supervised node process
2025-10-10T15:56:35.340-0400 INFO (reader-node) underlying process is not running, nothing to do
2025-10-10T15:56:35.340-0400 INFO (reader-node) shutting down plugins {"last_exit_code": 0}
2025-10-10T15:56:35.340-0400 INFO (fireeth) application substreams-tier2 shutdown unexpectedly, quitting
2025-10-10T15:56:35.340-0400 INFO (fireeth) waiting for all apps termination...
2025-10-10T15:56:35.340-0400 INFO (merger) starting merger
2025-10-10T15:56:35.340-0400 INFO (reader-node) stopping plugin {"plugin_name": "ToConsoleLogPlugin"}
2025-10-10T15:56:35.340-0400 INFO (dgrpc) standard server created
2025-10-10T15:56:35.340-0400 INFO (reader-node) stopping plugin {"plugin_name": "MindReaderPlugin"}
2025-10-10T15:56:35.340-0400 INFO (reader-node) mindreader is stopping
2025-10-10T15:56:35.340-0400 INFO (reader-node) all plugins closed
2025-10-10T15:56:35.340-0400 INFO (reader-node) operator is waiting for superviser to shutdown {"error": "tcp listening to \":10010\": listen tcp :10010: bind: address already in use"}
2025-10-10T15:56:35.340-0400 INFO (merger) grpc server created
2025-10-10T15:56:35.340-0400 INFO (reader-node) operator done waiting for superviser to shutdown {"error": "tcp listening to \":10010\": listen tcp :10010: bind: address already in use"}
2025-10-10T15:56:35.340-0400 INFO (merger) server registered
2025-10-10T15:56:35.340-0400 INFO (reader-node) chain operator terminated shutting down mindreader app
2025-10-10T15:56:35.340-0400 INFO (merger) starting pruning of unused (old) one-block-files {"pruning_distance_to_lib": 100, "time_between_pruning": "1m0s"}
2025-10-10T15:56:35.340-0400 INFO (merger) starting pruning of forked files {"pruning_distance_to_lib": 50000, "time_between_pruning": "1m0s"}
2025-10-10T15:56:35.340-0400 INFO (reader-node) starting webserver {"http_addr": ":10011"}
2025-10-10T15:56:35.340-0400 INFO (reader-node) operator ready to receive commands
2025-10-10T15:56:35.340-0400 INFO (fireeth) all apps terminated gracefully
Error: unable to launch: tcp listening to ":10017": listen tcp :10017: bind: address already in use
2025-10-10T15:56:35.340-0400 ERRO (fireeth) failed to run {"error": "unable to launch: tcp listening to \":10017\": listen tcp :10017: bind: address already in use"}
2025-10-10T15:56:35.340-0400 INFO (reader-node) received operator command {"command": "start", "params": null}
2025-10-10T15:56:35.340-0400 INFO (dgrpc) launching gRPC server {"listen_addr": ":10012"}
2025-10-10T15:56:35.340-0400 INFO (reader-node) http server did not close correctly
2025-10-10T15:56:35.345-0400 INFO (reader-node) preparing for start
2025-10-10T15:56:35.346-0400 INFO (reader-node) preparing to start chain
2025-10-10T15:56:35.346-0400 INFO (reader-node) starting mindreader
2025-10-10T15:56:35.346-0400 INFO (reader-node) launching blocks reading loop {"capacity": 100}
2025-10-10T15:56:35.346-0400 INFO (reader-node) creating new command instance and launch read loop {"binary": "bash", "arguments": ["/Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/wrapped_reth_dev.sh"], "env": ""}
2025-10-10T15:56:35.346-0400 INFO (dgrpc) serving gRPC {"listen_addr": ":10012"}
2025-10-10T15:56:35.346-0400 INFO (reader-node) creating new command instance and launch read loop {"binary": "bash", "arguments": ["/Users/ulyssecorbeil/Documents/SF/battlefield-ethereum/scripts/wrapped_reth_dev.sh"], "env": {"<inherited from process>":"{61 vars}"}}
2025-10-10T15:56:35.346-0400 INFO (reader-node) successfully start service
2025-10-10T15:56:35.346-0400 INFO (reader-node) operator ready to receive commands
2025-10-10T15:56:35.346-0400 INFO (reader-node) starting consume flow
34 changes: 34 additions & 0 deletions scripts/reth_dev/genesis.cancun.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"config": {
"chainId": 1337,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"arrowGlacierBlock": 0,
"grayGlacierBlock": 0,
"shanghaiTime": 0,
"cancunTime": 0,
"terminalTotalDifficulty": 0,
"terminalTotalDifficultyPassed": true
},
"nonce": "0x0",
"timestamp": "0x0",
"extraData": "0x",
"gasLimit": "0xaf79e0",
"difficulty": "0x0",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"821b55d8abe79bc98f05eb675fdc50dfe796b7ab": {
"balance": "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7"
}
}
}
35 changes: 35 additions & 0 deletions scripts/reth_dev/genesis.prague.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"config": {
"chainId": 1337,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"arrowGlacierBlock": 0,
"grayGlacierBlock": 0,
"shanghaiTime": 0,
"cancunTime": 0,
"pragueTime": 0,
"terminalTotalDifficulty": 0,
"terminalTotalDifficultyPassed": true
},
"nonce": "0x0",
"timestamp": "0x0",
"extraData": "0x",
"gasLimit": "0xaf79e0",
"difficulty": "0x0",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"821b55d8abe79bc98f05eb675fdc50dfe796b7ab": {
"balance": "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7"
}
}
}
47 changes: 47 additions & 0 deletions scripts/run_firehose_reth_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -e

ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$ROOT/lib.sh"

main() {
check_fireeth

if [[ "$#" -ne 1 && "$#" -ne 2 ]]; then
usage_error "Invalid number of arguments, expected 1 or 2, got $#"
fi

tracer_version="$1"
fork_version="prague"
if [[ "$#" -eq 2 ]]; then
fork_version="$2"
fi

if [[ "$tracer_version" != "2.3" && "$tracer_version" != "3.0" ]]; then
usage_error "Invalid tracer version '$tracer_version', must be '2.3' or '3.0'"
fi

if [[ "$fork_version" != "cancun" && "$fork_version" != "prague" ]]; then
usage_error "Invalid fork version '$fork_version', only 'cancun' and 'prague' are supported right now"
fi

echo "Running Reth dev node with Firehose tracer via 'fireeth'"
FIREHOSE_VERSION="$tracer_version" FORK_VERSION="$fork_version" \
run_fireeth 0 "bash" "$ROOT/wrapped_reth_dev.sh" \
--firehose-grpc-listen-addr=":10001*"
}

usage() {
echo "Usage: $0 <tracer-version> [<fork-version>]"
echo ""
echo "Runs a Reth dev node with the Firehose tracer activated using version <tracer-version>"
echo "which can be either '2.3' or '3.0'."
echo ""
echo "You can also optionally specify against which fork you want to test by specifying"
echo "the <fork-version> which can be one of: 'cancun', 'prague'."
echo ""
echo "Note that the fork version might or might not be supported based on the 'reth' binary"
echo "you are using."
}

main "$@"
68 changes: 68 additions & 0 deletions scripts/wrapped_reth_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env bash

set -e

PARENT_PID=$$
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

source "$ROOT/lib.sh"

main() {
data_dir="$(mktemp -d)"
firehose_version=${FIREHOSE_VERSION:-"2.3"}
fork_version=${FORK_VERSION:-"prague"}

# Reth binary location - assumes it's in the reth-firehose-tracer project
reth_binary="${RETH_BINARY:-$ROOT/../../reth-firehose-tracer/target/debug/reth-firehose-tracer}"

if [[ ! -f "$reth_binary" ]]; then
echo "Error: Reth binary not found at: $reth_binary"
echo "Please build it first with: cd ~/Documents/SF/reth-firehose-tracer && cargo build"
echo "Or set RETH_BINARY environment variable to the correct path"
exit 1
fi

# Genesis file location
genesis_file="$ROOT/reth_dev/genesis.$fork_version.json"

if [[ ! -f "$genesis_file" ]]; then
echo "Error: Genesis file not found at: $genesis_file"
exit 1
fi

echo "Running local Reth --dev chain"
echo "Address to fund: $address_to_fund"
echo "Reth Binary: $reth_binary"
echo "Reth Fork Version: $fork_version"
echo "Reth Version: $($reth_binary --version)"
echo "Data Directory: $data_dir"
echo "Genesis File: $genesis_file"
echo "Firehose version: $firehose_version"
echo ""

# Initialize Reth with the genesis file
echo "Initializing Reth with genesis..."
"$reth_binary" init --datadir="$data_dir" --chain="$genesis_file" 2>&1 | grep -v "^$"
echo ""

# Reth ExEx arguments for dev mode
# The ExEx outputs FIRE blocks to stdout which fireeth captures
reth_args=(
"node"
"--dev"
"--dev.block-time=1s"
"--datadir=$data_dir"
"--chain=$genesis_file"
"--http"
"--http.api=debug,eth,web3,net"
"--http.addr=0.0.0.0"
"--http.port=8545"
)

echo "Command: $reth_binary ${reth_args[@]}"
echo ""

exec "$reth_binary" "${reth_args[@]}"
}

main "$@"
8 changes: 8 additions & 0 deletions test/block.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ describe("Blocks", function () {
// bnb-dev in dev mode does not seem to update any parentBeaconRoot. being set to 00000000000 makes it skip that, so I skipped the test
if (!isNetwork("bnb-dev")) {
it("System call ProcessBeaconRoot recorded correctly", async function () {
if (process.env.BATTLEFIELD_SKIP_VALIDATION === "true") {
this.skip()
}

const rpcBlock = await mustGetRpcBlock("latest")
if (!rpcBlock.parentBeaconBlockRoot) {
// Test do not apply to this network
Expand Down Expand Up @@ -109,6 +113,10 @@ describe("Blocks", function () {
}

it("System call ProcessParentBlockHash recorded correctly", async function () {
if (process.env.BATTLEFIELD_SKIP_VALIDATION === "true") {
this.skip()
}

const rpcBlock = await mustGetRpcBlock("latest")
if (!rpcBlock.requestsHash) {
// Test do not apply to this network
Expand Down
Loading