Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/_build-binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:

- name: Cache reth binary
uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3.4.3
id: cache-optimism
id: cache-reth
with:
path: ~/bin/reth
key: ${{ runner.os }}-reth-${{ inputs.optimism_version }}
Expand Down
16 changes: 8 additions & 8 deletions benchmark/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ var (
}

RootDirFlag = &cli.StringFlag{
Name: RootDirFlagName,
Usage: "Root Directory",
EnvVars: prefixEnvVars("ROOT_DIR"),
Required: true,
Name: RootDirFlagName,
Usage: "Root Directory",
EnvVars: prefixEnvVars("ROOT_DIR"),
Value: "./data-dir",
}

OutputDirFlag = &cli.StringFlag{
Name: OutputDirFlagName,
Usage: "Output Directory",
EnvVars: prefixEnvVars("OUTPUT_DIR"),
Required: true,
Name: OutputDirFlagName,
Usage: "Output Directory",
Value: "./output",
EnvVars: prefixEnvVars("OUTPUT_DIR"),
}

TxFuzzBinFlag = &cli.StringFlag{
Expand Down
21 changes: 18 additions & 3 deletions report/src/components/ChartGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,31 @@ interface ProvidedProps {
role: "sequencer" | "validator" | null;
}

function resolveMetricKey(
data: DataSeries[],
primaryKey: string,
aliases: string[] = [],
): string {
const keys = [primaryKey, ...aliases];
const chartData = data.flatMap((s) => s.data);
for (const key of keys) {
if (chartData.some((d) => d.ExecutionMetrics[key] !== undefined)) {
return key;
}
}
return primaryKey;
}

const ChartGrid: React.FC<ProvidedProps> = ({ data, role }: ProvidedProps) => {
return (
<div className="charts-container">
{SORTED_CHART_CONFIG.map(([metricKey, config]) => {
// sequencer and validator have different thresholds
const resolvedKey = resolveMetricKey(data, metricKey, config.aliases);
const thresholdKey = role ? `${role}/${metricKey}` : null;
const chartData = data.flatMap((s) => s.data);
const thresholds = data[0]?.thresholds;
const executionMetrics = chartData
.map((d) => d.ExecutionMetrics[metricKey])
.map((d) => d.ExecutionMetrics[resolvedKey])
.filter((v) => v !== undefined);

if (executionMetrics.length === 0) {
Expand All @@ -26,7 +41,7 @@ const ChartGrid: React.FC<ProvidedProps> = ({ data, role }: ProvidedProps) => {

const chartProps = {
series: data,
metricKey,
metricKey: resolvedKey,
title: config.title,
description: config.description,
unit: config.unit,
Expand Down
120 changes: 61 additions & 59 deletions report/src/metricDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,112 +136,114 @@ export const CHART_CONFIG = {
description: "Shows the median gas per block",
unit: "gas",
},
reth_sync_execution_execution_duration: {
reth_sync_execution_execution_duration_avg: {
type: "line",
title: "Reth Sync Execution Duration",
description: "Shows the time taken for execution during reth sync",
description: "Shows the average time taken for execution during reth sync",
unit: "s",
aliases: ["reth_sync_execution_execution_duration"],
},
reth_sync_block_validation_state_root_duration: {
reth_sync_block_validation_state_root_duration_avg: {
type: "line",
title: "Reth Sync Block Validation State Root Duration",
description:
"Shows the time taken for state root validation during reth sync",
"Shows the average time taken for state root validation during reth sync",
unit: "s",
aliases: ["reth_sync_block_validation_state_root_duration"],
},
reth_op_rbuilder_block_built_success: {
reth_base_builder_block_built_success: {
type: "line",
title: "Reth OP Builder Block Built Success",
description: "Indicates whether the Builder successfully built a block",
title: "Builder Block Built Success",
description: "Number of blocks successfully built per block interval",
unit: "count",
aliases: ["reth_op_rbuilder_block_built_success"],
},
reth_op_rbuilder_flashblock_count: {
reth_base_builder_flashblock_count: {
type: "line",
title: "Reth OP Builder Flashblock Count",
description: "Shows the number of flashblocks built by Builder",
title: "Builder Flashblock Count",
description: "Number of flashblock bundles sent per block",
unit: "count",
aliases: ["reth_op_rbuilder_flashblock_count"],
},
reth_op_rbuilder_total_block_built_duration: {
reth_base_builder_flashblock_count_avg: {
type: "line",
title: "Reth OP Builder Total Block Built Duration",
description: "Shows the total time taken to build a block by Builder",
unit: "s",
},
reth_op_rbuilder_flashblock_build_duration: {
type: "line",
title: "Reth OP Builder Flashblock Build Duration",
description: "Shows the time taken to build a flashblock by Builder",
unit: "s",
title: "Builder Flashblocks per Block (avg)",
description: "Average number of flashblocks included per block",
unit: "count",
},
reth_op_rbuilder_state_root_calculation_duration: {
reth_base_builder_total_block_built_duration_avg: {
type: "line",
title: "Reth OP Builder State Root Calculation Duration",
description: "Shows the time taken to calculate the state root by Builder",
title: "Builder Total Block Built Duration",
description: "Average total time taken to build a block",
unit: "s",
aliases: ["reth_op_rbuilder_total_block_built_duration"],
},
reth_op_rbuilder_sequencer_tx_duration: {
reth_base_builder_flashblock_build_duration_avg: {
type: "line",
title: "Reth OP Builder Sequencer Tx Duration",
description: "Shows the time taken for sequencer transactions in Builder",
title: "Builder Flashblock Build Duration",
description: "Average time taken to build a single flashblock",
unit: "s",
aliases: ["reth_op_rbuilder_flashblock_build_duration"],
},
reth_op_rbuilder_payload_tx_simulation_duration: {
reth_base_builder_state_root_calculation_duration_avg: {
type: "line",
title: "Reth OP Builder Payload Tx Simulation Duration",
description:
"Shows the time taken for payload transaction simulation in Builder",
title: "Builder State Root Calculation Duration",
description: "Average time taken to calculate the state root",
unit: "s",
aliases: ["reth_op_rbuilder_state_root_calculation_duration"],
},
reth_sync_state_provider_total_storage_fetch_latency: {
reth_base_builder_sequencer_tx_duration_avg: {
type: "line",
title: "Validator Storage Load Latency",
description: "Shows the 90th percentile latency for storage slot loads",
title: "Builder Sequencer Tx Duration",
description: "Average time taken to process sequencer transactions",
unit: "s",
aliases: ["reth_op_rbuilder_sequencer_tx_duration"],
},
reth_sync_state_provider_total_code_fetch_latency: {
reth_base_builder_payload_transaction_simulation_duration_avg: {
type: "line",
title: "Validator Code Load Latency",
description: "Shows the 90th percentile latency for code loads",
title: "Builder Payload Tx Simulation Duration",
description: "Average time taken for payload transaction simulation",
unit: "s",
aliases: ["reth_op_rbuilder_payload_tx_simulation_duration"],
},
reth_sync_state_provider_total_account_fetch_latency: {
reth_base_builder_tx_simulation_duration_avg: {
type: "line",
title: "Validator Account Load Latency",
description: "Shows the 90th percentile latency for account loads",
title: "Builder Tx Simulation Duration",
description: "Average per-transaction simulation duration",
unit: "s",
},
reth_reth_flashblocks_block_processing_duration: {
reth_base_builder_payload_num_tx_gauge: {
type: "line",
title: "Flashblock Processing Duration",
description: "Shows the time taken to process flashblocks on the validator",
unit: "s",
title: "Builder Payload Tx Count",
description: "Number of transactions included in the most recent payload",
unit: "count",
},
reth_reth_flashblocks_flashblocks_in_block: {
reth_base_builder_flashblock_gas_headroom_pct_avg: {
type: "line",
title: "Flashblocks per Block",
description: "Shows the number of flashblocks received per block",
title: "Builder Flashblock Gas Headroom %",
description: "Average gas headroom percentage across flashblocks",
unit: "count",
},
reth_reth_flashblocks_sender_recovery_duration: {
reth_sync_state_provider_total_storage_fetch_latency_avg: {
type: "line",
title: "Flashblock Sender Recovery Duration",
description:
"Shows the time taken to recover senders from flashblock transactions",
title: "Validator Storage Load Latency",
description: "Average latency for storage slot loads during validation",
unit: "s",
aliases: ["reth_sync_state_provider_total_storage_fetch_latency"],
},
reth_reth_flashblocks_upstream_messages: {
reth_sync_state_provider_total_code_fetch_latency_avg: {
type: "line",
title: "Flashblock Upstream Messages",
description:
"Shows the number of upstream messages received from the flashblock stream",
unit: "count",
title: "Validator Code Load Latency",
description: "Average latency for bytecode loads during validation",
unit: "s",
aliases: ["reth_sync_state_provider_total_code_fetch_latency"],
},
reth_reth_flashblocks_bundle_state_clone_duration: {
reth_sync_state_provider_total_account_fetch_latency_avg: {
type: "line",
title: "Flashblock Bundle State Clone Duration",
description:
"Shows the time taken to clone the bundle state for flashblock processing",
title: "Validator Account Load Latency",
description: "Average latency for account loads during validation",
unit: "s",
aliases: ["reth_sync_state_provider_total_account_fetch_latency"],
},
} satisfies Record<string, ChartConfig>;

Expand Down
3 changes: 2 additions & 1 deletion report/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export interface ChartConfig {
| "gas"
| "count"
| "gas/s"
| "blocks"; // Add 'gas/s', ensure 's' is present
| "blocks";
aliases?: string[];
}

export interface MachineInfo {
Expand Down
6 changes: 2 additions & 4 deletions runner/benchmark/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os"
"strings"
"sync/atomic"
"time"

"github.com/base/base-bench/runner/network/types"
"github.com/ethereum/go-ethereum/core"
Expand All @@ -29,9 +28,8 @@ const (
)

var DefaultParams = &types.RunParams{
NodeType: "geth",
GasLimit: 50e9,
BlockTime: 1 * time.Second,
NodeType: "geth",
GasLimit: 50e9,
}

// NewParamsFromValues constructs a new benchmark params given a config and a set of transaction payloads to run.
Expand Down
28 changes: 28 additions & 0 deletions runner/benchmark/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"path"
"path/filepath"
"strings"
"time"

"github.com/base/base-bench/runner/payload"
)
Expand Down Expand Up @@ -87,13 +88,40 @@ func (s SnapshotDefinition) CreateSnapshot(nodeType string, outputDir string) er
return cmd.Run()
}

// FlashblocksConfig holds top-level flashblocks configuration.
type FlashblocksConfig struct {
BlockTime string `yaml:"block_time"`
}

const DefaultFlashblocksBlockTime = "250"
const DefaultBlockTime = "1s"

type BenchmarkConfig struct {
Name string `yaml:"name"`
Description *string `yaml:"description"`
BlockTime *string `yaml:"block_time"`
Flashblocks *FlashblocksConfig `yaml:"flashblocks"`
Benchmarks []TestDefinition `yaml:"benchmarks"`
TransactionPayloads []payload.Definition `yaml:"payloads"`
}

// GetBlockTime returns the configured block time as a duration, or the default (1s).
func (bc *BenchmarkConfig) GetBlockTime() (time.Duration, error) {
raw := DefaultBlockTime
if bc.BlockTime != nil && *bc.BlockTime != "" {
raw = *bc.BlockTime
}
return time.ParseDuration(raw)
}

// FlashblocksBlockTime returns the configured flashblocks block time, or the default.
func (bc *BenchmarkConfig) FlashblocksBlockTime() string {
if bc.Flashblocks != nil && bc.Flashblocks.BlockTime != "" {
return bc.Flashblocks.BlockTime
}
return DefaultFlashblocksBlockTime
}

type DatadirConfig struct {
Sequencer *string `yaml:"sequencer"`
Validator *string `yaml:"validator"`
Expand Down
6 changes: 6 additions & 0 deletions runner/benchmark/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func NewTestPlanFromConfig(c TestDefinition, testFileName string, config *Benchm

// ResolveTestRunsFromMatrix constructs a new ParamsMatrix from a config.
func ResolveTestRunsFromMatrix(c TestDefinition, testFileName string, config *BenchmarkConfig) ([]TestRun, error) {
blockTime, err := config.GetBlockTime()
if err != nil {
return nil, fmt.Errorf("invalid block_time: %w", err)
}

seenParams := make(map[string]bool)

// Multiple payloads can run in a single benchmark.
Expand Down Expand Up @@ -107,6 +112,7 @@ func ResolveTestRunsFromMatrix(c TestDefinition, testFileName string, config *Be
return nil, err
}

params.BlockTime = blockTime
params.Name = config.Name
if config.Description != nil {
params.Description = *config.Description
Expand Down
Loading
Loading