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
8 changes: 8 additions & 0 deletions op-devstack/sysgo/l2_el.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type L2ELConfig struct {
P2PNodeKeyHex string
StaticPeers []string
TrustedPeers []string
ProofHistory bool
}

func L2ELWithSupervisor(supervisorID stack.SupervisorID) L2ELOption {
Expand All @@ -30,6 +31,12 @@ func L2ELWithSupervisor(supervisorID stack.SupervisorID) L2ELOption {
})
}

func L2ELWithProofHistory(enable bool) L2ELOption {
return L2ELOptionFn(func(p devtest.P, id stack.L2ELNodeID, cfg *L2ELConfig) {
cfg.ProofHistory = enable
})
}

// L2ELWithP2PConfig sets deterministic P2P identity and static peers for the L2 EL.
func L2ELWithP2PConfig(addr string, port int, nodeKeyHex string, staticPeers, trustedPeers []string) L2ELOption {
return L2ELOptionFn(func(p devtest.P, id stack.L2ELNodeID, cfg *L2ELConfig) {
Expand All @@ -49,6 +56,7 @@ func DefaultL2ELConfig() *L2ELConfig {
P2PNodeKeyHex: "",
StaticPeers: nil,
TrustedPeers: nil,
ProofHistory: false,
}
}

Expand Down
38 changes: 36 additions & 2 deletions op-devstack/sysgo/l2_el_opreth.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/url"
"os"
"os/exec"
"path/filepath"
"strings"
"sync"
Expand Down Expand Up @@ -99,8 +100,8 @@ func (n *OpReth) Start() {
})
n.userRPC = "ws://" + n.userProxy.Addr()
}
logOut := logpipe.ToLogger(n.p.Logger().New("component", "op-reth", "src", "stdout"))
logErr := logpipe.ToLogger(n.p.Logger().New("component", "op-reth", "src", "stderr"))
logOut := logpipe.ToLogger(n.p.Logger().New("component", "op-reth", "src", "stdout", "id", n.id.String()))
logErr := logpipe.ToLogger(n.p.Logger().New("component", "op-reth", "src", "stderr", "id", n.id.String()))

authRPCChan := make(chan string, 1)
defer close(authRPCChan)
Expand Down Expand Up @@ -273,6 +274,39 @@ func WithOpReth(id stack.L2ELNodeID, opts ...L2ELOption) stack.Option[*Orchestra
args = append(args, "--rollup.supervisor-http="+supervisorRPC)
}

// initialise op-reth
initArgs := []string{
"init",
"--datadir=" + dataDirPath,
"--chain=" + chainConfigPath,
}
err = exec.Command(execPath, initArgs...).Run()
p.Require().NoError(err, "must init op-reth node")

if cfg.ProofHistory {
proofHistoryDir := filepath.Join(tempDir, "proof-history")

// initialise proof history
initProofsArgs := []string{
"proofs",
"init",
"--datadir=" + dataDirPath,
"--chain=" + chainConfigPath,
"--proofs-history.storage-path=" + proofHistoryDir,
}
err = exec.Command(execPath, initProofsArgs...).Run()
p.Require().NoError(err, "must init op-reth proof history")

args = append(
args,
"--proofs-history",
// todo: make these configurable via env-vars (ethereum-optimism/optimism#18908)
"--proofs-history.window=200",
"--proofs-history.prune-interval=1m",
"--proofs-history.storage-path="+proofHistoryDir,
)
}

l2EL := &OpReth{
id: id,
jwtPath: jwtPath,
Expand Down