# Benchmark Reproduction Guide

Altius provides the necessary tooling for partners to reproduce these benchmarks on their own infrastructure. We utilize a Dual-Node Architecture to ensure that performance metrics reflect pure execution capability rather than data-serving overhead.

#### System Architecture

The benchmark environment separates the Data Source from the Execution Target:

* **Source Node (Terminal 1):** A static reference node holding pre-computed chain data. It serves block data via RPC.
* **Target Node (Terminal 2):** The **System Under Test**. A fresh, ephemeral node that receives blocks and executes them using the Altius engine (Serial or Parallel).
* **Bench Tool (Terminal 3):** The conductor. It fetches payloads from the Source and submits them to the Target via the Engine API (`newPayload`, `forkchoiceUpdated`).

#### Technical Access

The specialized node binaries, including `op-altius-reth` and `reth-bench`, are available within our private repository.

* **Workload Reproduction**: Partners can use the `generate` command to create custom datasets, such as Uniswap simulations with varying conflict rates.
* **Environment Configuration**: The system supports toggling between serial and parallel modes via environment variables, allowing for clear A/B testing on the same hardware.

#### Requesting Repository Access

To verify these results or to run benchmarks against your specific production workloads, please reach out to our team for access to the Altius private repository. We provide full documentation on build requirements, security setup, and data preparation to assist with your internal audit.

***

### Step 1: Build & Preparation

Before launching the cluster, we must compile the specialized node binaries and generate secure authentication keys.

#### a) Update and Compile

Clone the repository and build the `op-altius-reth` node and `reth-bench` tool in release mode for maximum performance.

```
# Clone and navigate 
git clone https://github.com/Altius-Labs/altius-reth 
cd altius-reth

# Update specific dependencies
cargo update -p op-altius-revm -p alloy-evm -p alloy-op-evm -p alloy-op-altius-evm

# Build artifacts (Node + Benchmark Tool)
cargo build -p op-altius-reth -p reth-bench --release
```

#### b) Security Setup (JWT)

The nodes communicate via the Engine API, which requires a shared JWT secret.

```
# Generate a fresh 32-byte hex secret 
openssl rand -hex 32 > /tmp/jwt.hex
```

{% hint style="warning" %}
**Note**: If you are running an external Consensus Client (like aleth), ensure you update its `[eth_server]` config to use this same secret.
{% endhint %}

#### c) Data Preparation

Unpack the benchmark dataset. This contains the pre-computed chain state required by the Source Node.

```
# Extract source data to the project's data directory
 tar -xzvf examples/op-altius-reth/data/datadir-reth-bench.tar.gz -C examples/op-altius-reth/data/
```

***

### Step 2: Source Node Setup (Data Server)

**Terminal 1** This node acts as the "Feeder." It runs on custom ports to prevent conflicts with the target node.

```
# --- Terminal 1 ---
export DATA_DIR=examples/op-altius-reth/data/datadir-reth-bench
export JWT_SECRET=/tmp/jwt.hex
export GENESIS_FILE=examples/op-altius-reth/data/op.genesis.json

# Start Source Node (Ports: HTTP 18545, Auth 18551)
./target/release/op-altius-reth node \
    --datadir $DATA_DIR \
    --chain $GENESIS_FILE \
    --http --http.api all \
    --http.port 18545 \
    --ws.port 18546 \
    --authrpc.port 18551 \
    --port 30305 \
    --metrics 0.0.0.0:19001 \
    --disable-discovery --trusted-only \
    --authrpc.jwtsecret=$JWT_SECRET \
    --engine.persistence-threshold 0 \
    --engine.memory-block-buffer-target 0 \
    --block-interval 5
```

{% hint style="warning" %}
**Note:** Ensure you see `RPC HTTP server started url=127.0.0.1:18545`.
{% endhint %}

***

### Step 3: Target Node Setup (System Under Test)

**Terminal 2**  This is where the magic happens. We configure this node to use the Altius Parallel Engine.

{% hint style="info" %}
Crucial Configuration: The `ENABLE_PARALLEL` environment variable controls whether the node uses standard serial execution or Altius parallel execution.
{% endhint %}

```
# --- Terminal 2 ---
export DATA_DIR=/tmp/datadir
export JWT_SECRET=/tmp/jwt.hex
export GENESIS_FILE=examples/op-altius-reth/data/op.genesis.json

# --- PERFORMANCE FLAGS ---
export ENABLE_PARALLEL=true        # Set to 'false' for baseline testing
export PARALLEL_EXECUTOR_THREADS=8 # Optimizes for modern 8-core CPUs

# Clean previous state for a fresh run
rm -rf $DATA_DIR

# Start Target Node (Ports: HTTP 8545, Auth 8551)
./target/release/op-altius-reth node \
    --datadir $DATA_DIR \
    --chain $GENESIS_FILE \
    --http --http.api all \
    --disable-discovery --trusted-only \
    --authrpc.jwtsecret=$JWT_SECRET \
    --prune.senderrecovery.full \
    --prune.transactionlookup.full \
    --engine.persistence-threshold 0 \
    --engine.memory-block-buffer-target 0 \
    --block-interval 5
```

{% hint style="warning" %}
**Note:** Ensure you see `RPC HTTP server started url=127.0.0.1:8545`.
{% endhint %}

***

### Step 4: Execution & Verification

**Terminal 3** With both nodes active, use the `reth-bench` tool to drive the workload.

```
# --- Terminal 3 ---
export JWT_SECRET=/tmp/jwt.hex

# Execute Benchmark
# --rpc-url points to Source Node (18545)
# Tool implicitly connects to Target Node (8551)
./target/release/reth-bench new-payload-fcu \
    --rpc-url http://127.0.0.1:18545 \
    --jwt-secret $JWT_SECRET \
    --advance 11 \
    --is-optimism=true
```

#### Analyzing the Output

The tool will output processing stats for each payload. **Payload 11** is the critical data point containing 1,000 Uniswap transactions.

**Key Metrics:**

1. **`newPayload latency`**: The pure execution time. In parallel mode, this should be significantly lower (e.g., \~1.1s vs \~4s).
2. **`Total Ggas/s`**: The aggregated throughput. Look for numbers exceeding 0.38 Ggas/s in this specific mixed workload.

#### Switching Modes (A/B Testing)

To compare Serial vs. Parallel performance, you do not need to restart the Source Node.

1. **Stop** Terminal 2 (Ctrl+C).
2. **Set** `export ENABLE_PARALLEL=false`.
3. **Clean** the data directory (`rm -rf /tmp/datadir`).
4. **Restart** Terminal 2 and re-run the benchmark in Terminal 3.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.altiuslabs.xyz/technical-overview/benchmark/benchmark-reproduction-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
