Skip to content

Commit

Permalink
fix(kurtosis-devnet): avoid re-building proofs (#13571)
Browse files Browse the repository at this point in the history
Now that ethpandaops/optimism-package#116
defines a cannon_prestates_url for each challenger instance, we better
skip rebuilding the same thing multiple times.
  • Loading branch information
sigma authored Jan 4, 2025
1 parent 7e76fc6 commit d784a98
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions kurtosis-devnet/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ func localPrestateOption(cfg *config, server *staticServer) tmpl.TemplateContext
return "", fmt.Errorf("failed to create prestate build directory: %w", err)
}

// Build all prestate files directly in the target directory
if err := prestateBuilder.Build(buildDir); err != nil {
return "", fmt.Errorf("failed to build prestates: %w", err)
}

// Get the relative path from server.dir to buildDir for the URL
relPath, err := filepath.Rel(server.dir, buildDir)
if err != nil {
Expand All @@ -154,6 +149,17 @@ func localPrestateOption(cfg *config, server *staticServer) tmpl.TemplateContext
return url, nil
}

// Check if we already have prestate files. Typical in interop mode,
// where we have a prestate for each chain.
if dir, _ := os.ReadDir(buildDir); len(dir) > 0 {
return url, nil
}

// Build all prestate files directly in the target directory
if err := prestateBuilder.Build(buildDir); err != nil {
return "", fmt.Errorf("failed to build prestates: %w", err)
}

// Find all prestate-proof*.json files
matches, err := filepath.Glob(filepath.Join(buildDir, "prestate-proof*.json"))
if err != nil {
Expand Down

0 comments on commit d784a98

Please sign in to comment.