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
36 changes: 20 additions & 16 deletions .github/workflows/e2e-op-historical-proof.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ on:

jobs:
op-reth-as-verifier:
name: op-reth as verifier e2e tests
name: op-reth-as-verifier-${{ matrix.go_pkg_name }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- go_pkg_name: proofs/core
- go_pkg_name: proofs/reorg
- go_pkg_name: proofs/prune

steps:
- name: Checkout
Expand Down Expand Up @@ -59,15 +66,10 @@ jobs:
run: |
make all DEVNET=opgeth-seq-opreth-val

- name: Run core e2e tests
- name: Run ${{ matrix.go_pkg_name }} e2e tests
working-directory: crates/optimism/tests
run: |
make test-e2e-kurtosis GO_PKG_NAME=proofs/core DEVNET=opgeth-seq-opreth-val

- name: Run reorg e2e tests
working-directory: crates/optimism/tests
run: |
make test-e2e-kurtosis GO_PKG_NAME=proofs/reorg DEVNET=opgeth-seq-opreth-val
make test-e2e-kurtosis GO_PKG_NAME=${{ matrix.go_pkg_name }} DEVNET=opgeth-seq-opreth-val

# disable coverage for now
# - name: Flush coverage data
Expand Down Expand Up @@ -112,9 +114,16 @@ jobs:
# verbose: true

op-reth-as-sequencer:
name: op-reth as sequencer e2e tests
name: op-reth-as-sequencer-${{ matrix.go_pkg_name }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- go_pkg_name: proofs/core
- go_pkg_name: proofs/reorg
- go_pkg_name: proofs/prune

steps:
- name: Checkout
Expand Down Expand Up @@ -157,15 +166,10 @@ jobs:
run: |
make all DEVNET=opreth-seq-opgeth-val

- name: Run core e2e tests
working-directory: crates/optimism/tests
run: |
make test-e2e-kurtosis GO_PKG_NAME=proofs/core DEVNET=opreth-seq-opgeth-val

- name: Run reorg e2e tests
- name: Run ${{ matrix.go_pkg_name }} e2e tests
working-directory: crates/optimism/tests
run: |
make test-e2e-kurtosis GO_PKG_NAME=proofs/reorg DEVNET=opreth-seq-opgeth-val
make test-e2e-kurtosis GO_PKG_NAME=${{ matrix.go_pkg_name }} DEVNET=opreth-seq-opgeth-val

e2e-op-historical-proof-success:
name: e2e-op-historical-proof-success
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/tests/devnets/opgeth-seq-opreth-val.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ optimism_package:
image: op-reth:local
extra_params: [
--proofs-history,
--proofs-history.window=10000,
--proofs-history.window=200,
--proofs-history.prune-interval=1m,
--proofs-history.storage-path=/data/proofs-history
]
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/tests/devnets/opreth-seq-opgeth-val.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ optimism_package:
image: op-reth:local
extra_params: [
--proofs-history,
--proofs-history.window=10000,
--proofs-history.window=200,
--proofs-history.prune-interval=1m,
--proofs-history.storage-path=/data/proofs-history
]
Expand Down
13 changes: 13 additions & 0 deletions crates/optimism/tests/proofs/prune/init_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package prune

import (
"testing"

"github.com/ethereum-optimism/optimism/op-devstack/presets"
)

// TestMain creates the test-setups against the shared backend
func TestMain(m *testing.M) {
// Other setups may be added here, hydrated from the same orchestrator
presets.DoMain(m, presets.WithSingleChainMultiNode())
}
66 changes: 66 additions & 0 deletions crates/optimism/tests/proofs/prune/prune_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package prune

import (
"testing"
"time"

"github.com/ethereum-optimism/optimism/op-devstack/devtest"
"github.com/ethereum-optimism/optimism/op-devstack/presets"
"github.com/ethereum-optimism/optimism/op-service/apis"
"github.com/op-rs/op-geth/proofs/utils"
"github.com/stretchr/testify/require"
)

func TestPruneProofStorage(gt *testing.T) {
t := devtest.SerialT(gt)
sys := presets.NewSingleChainMultiNode(t)

var proofWindow = uint64(200) // Defined in the devnet yaml
var pruneDetectTimeout = time.Minute * 5 // An expected time within the prune should be detected.
opRethELNode, _ := utils.IdentifyELNodes(sys.L2EL, sys.L2ELB)

syncStatus := getProofSyncStatus(t, opRethELNode.Escape().EthClient())
t.Log("Initial sync status:", syncStatus)
distance := syncStatus.Latest - syncStatus.Earliest

if distance < proofWindow {
// Wait till we reach proof window
t.Logf("Waiting for block %d", syncStatus.Earliest+proofWindow)
opRethELNode.WaitForBlockNumber(syncStatus.Earliest + proofWindow)
}
// Now we need to wait for pruner to execute pruning, which can be done anytime within 1 minute (pruner prune interval = 1 min)
startTime := time.Now()
var newSyncStatus proofSyncStatus
for {
// Get sync status each Second
if time.Since(startTime) > pruneDetectTimeout {
t.Error("Pruner did not prune proof storage within the interval")
return
}
newSyncStatus = getProofSyncStatus(t, opRethELNode.Escape().EthClient())
if syncStatus.Earliest != newSyncStatus.Earliest {
break
}
t.Log("Waiting on earliest state to be changed: ", syncStatus.Earliest)
time.Sleep(time.Second * 5)
}
// Check how many has been pruned - we should have current proof window intake
currentProofWindow := newSyncStatus.Latest - newSyncStatus.Earliest
t.Log("Sync status:", syncStatus)
require.GreaterOrEqual(t, currentProofWindow, proofWindow, "Pruner has changed the proof window")
t.Logf("Successfully pruned proof storage. sync status: %v", syncStatus)
}

type proofSyncStatus struct {
Earliest uint64 `json:"earliest"`
Latest uint64 `json:"latest"`
}

func getProofSyncStatus(t devtest.T, client apis.EthClient) proofSyncStatus {
var result proofSyncStatus
err := client.RPC().CallContext(t.Ctx(), &result, "debug_proofsSyncStatus")
if err != nil {
t.Error(err)
}
return result
}
Loading