Skip to content
Merged
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
42 changes: 10 additions & 32 deletions .github/workflows/bench-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,15 @@ on:
required: false
default: ""
baseline-hardfork:
description: Latest active hardfork for the baseline run.
type: choice
required: true
default: T6
options:
- T0
- T1
- T1A
- T1B
- T1C
- T2
- T3
- T4
- T5
- T6
description: Latest active hardfork for the baseline run. Empty = latest Tempo hardfork.
type: string
required: false
default: ""
feature-hardfork:
description: Latest active hardfork for the feature run.
type: choice
required: true
default: T6
options:
- T0
- T1
- T1A
- T1B
- T1C
- T2
- T3
- T4
- T5
- T6
description: Latest active hardfork for the feature run. Empty = latest Tempo hardfork.
type: string
required: false
default: ""
preset:
description: Benchmark preset.
type: choice
Expand Down Expand Up @@ -210,11 +188,11 @@ on:
baseline-hardfork:
type: string
required: false
default: T6
default: ""
feature-hardfork:
type: string
required: false
default: T6
default: ""
baseline-features:
type: string
required: false
Expand Down
8 changes: 4 additions & 4 deletions bench-e2e.nu
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ def e2e-snapshots-ready [a_db: string, b_db: string] {
def e2e-snapshot-state-hardfork [datadir: string] {
let marker = (read-bench-marker $datadir)
if $marker == null {
return (latest-tempo-hardfork)
return ""
}
let state_hardfork = ($marker | get -o state_hardfork | default "")
if $state_hardfork == "" {
return (latest-tempo-hardfork)
return ""
}
normalize-hardfork $state_hardfork
}
Expand Down Expand Up @@ -398,11 +398,11 @@ def e2e-regenesis [
hardfork: string,
gas_limit: string,
] {
let target_hardfork = if $hardfork != "" { normalize-hardfork $hardfork } else { "" }
let target_hardfork = if $hardfork != "" { normalize-hardfork $hardfork } else { latest-tempo-hardfork }
let target_gas_limit = if $gas_limit != "" { normalize-gas-limit $gas_limit } else { "" }
let current_hardfork = (e2e-snapshot-state-hardfork $datadir)
let current_gas_limit = (e2e-snapshot-state-gas-limit $datadir)
let hardfork_matches = $target_hardfork == "" or $current_hardfork == $target_hardfork
let hardfork_matches = $current_hardfork == $target_hardfork
let gas_limit_matches = $target_gas_limit == "" or $current_gas_limit == $target_gas_limit
if $hardfork_matches and $gas_limit_matches {
mut matches = []
Expand Down
37 changes: 26 additions & 11 deletions tempo.nu
Original file line number Diff line number Diff line change
Expand Up @@ -318,27 +318,41 @@ def read-bench-marker [datadir: string] {
# Comparison mode helpers
# ============================================================================

# Ordered list of all Tempo hardforks (must match TempoHardfork enum in crates/chainspec)
const TEMPO_HARDFORKS = ["T0" "T1" "T1A" "T1B" "T1C" "T2" "T3" "T4" "T5" "T6" "T7"]
const TEMPO_DISABLED_HARDFORK_TIME = 9223372036854775807

def tempo-hardforks [] {
let forks = (
open crates/node/tests/assets/test-genesis.json
| get config
| columns
| where { |key| $key =~ '^t[0-9]+[a-z]?Time$' }
| each { |key| $key | str replace "Time" "" | str upcase }
)
if ($forks | is-empty) {
print "Error: failed to read Tempo hardforks from crates/node/tests/assets/test-genesis.json"
exit 1
}
$forks
}

def normalize-hardfork [fork: string] {
let hardforks = (tempo-hardforks)
let fork_upper = ($fork | str upcase)
let idx = ($TEMPO_HARDFORKS | enumerate | where item == $fork_upper)
let idx = ($hardforks | enumerate | where item == $fork_upper)
if ($idx | length) == 0 {
print $"Error: unknown hardfork '($fork)'. Valid: ($TEMPO_HARDFORKS | str join ', ')"
print $"Error: unknown hardfork '($fork)'. Valid: ($hardforks | str join ', ')"
exit 1
}
$fork_upper
}

def hardfork-index [fork: string] {
let fork_upper = (normalize-hardfork $fork)
($TEMPO_HARDFORKS | enumerate | where item == $fork_upper | get 0.index)
(tempo-hardforks | enumerate | where item == $fork_upper | get 0.index)
}

def latest-tempo-hardfork [] {
$TEMPO_HARDFORKS | last
tempo-hardforks | last
}

def highest-hardfork [forks: list<string>] {
Expand All @@ -357,7 +371,7 @@ def highest-hardfork [forks: list<string>] {

def hardfork-genesis-config-fields [fork: string] {
let cutoff = (hardfork-index $fork)
$TEMPO_HARDFORKS | enumerate | each { |it|
tempo-hardforks | enumerate | each { |it|
{
fork: $it.item
name: $"($it.item | str downcase)Time"
Expand Down Expand Up @@ -2428,17 +2442,18 @@ def "main bench" [
exit 1
}
# Validate hardfork names
let tempo_hardforks = (tempo-hardforks)
if $baseline_hardfork != "" {
let valid = ($TEMPO_HARDFORKS | any { |f| $f == ($baseline_hardfork | str upcase) })
let valid = ($tempo_hardforks | any { |f| $f == ($baseline_hardfork | str upcase) })
if not $valid {
print $"Error: unknown baseline hardfork '($baseline_hardfork)'. Valid: ($TEMPO_HARDFORKS | str join ', ')"
print $"Error: unknown baseline hardfork '($baseline_hardfork)'. Valid: ($tempo_hardforks | str join ', ')"
exit 1
}
}
if $feature_hardfork != "" {
let valid = ($TEMPO_HARDFORKS | any { |f| $f == ($feature_hardfork | str upcase) })
let valid = ($tempo_hardforks | any { |f| $f == ($feature_hardfork | str upcase) })
if not $valid {
print $"Error: unknown feature hardfork '($feature_hardfork)'. Valid: ($TEMPO_HARDFORKS | str join ', ')"
print $"Error: unknown feature hardfork '($feature_hardfork)'. Valid: ($tempo_hardforks | str join ', ')"
exit 1
}
}
Expand Down
Loading