Commit d784a98b authored by Yann Hodique's avatar Yann Hodique Committed by GitHub

fix(kurtosis-devnet): avoid re-building proofs (#13571)

Now that https://github.com/ethpandaops/optimism-package/pull/116
defines a cannon_prestates_url for each challenger instance, we better
skip rebuilding the same thing multiple times.
parent 7e76fc67
...@@ -137,11 +137,6 @@ func localPrestateOption(cfg *config, server *staticServer) tmpl.TemplateContext ...@@ -137,11 +137,6 @@ func localPrestateOption(cfg *config, server *staticServer) tmpl.TemplateContext
return "", fmt.Errorf("failed to create prestate build directory: %w", err) 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 // Get the relative path from server.dir to buildDir for the URL
relPath, err := filepath.Rel(server.dir, buildDir) relPath, err := filepath.Rel(server.dir, buildDir)
if err != nil { if err != nil {
...@@ -154,6 +149,17 @@ func localPrestateOption(cfg *config, server *staticServer) tmpl.TemplateContext ...@@ -154,6 +149,17 @@ func localPrestateOption(cfg *config, server *staticServer) tmpl.TemplateContext
return url, nil 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 // Find all prestate-proof*.json files
matches, err := filepath.Glob(filepath.Join(buildDir, "prestate-proof*.json")) matches, err := filepath.Glob(filepath.Join(buildDir, "prestate-proof*.json"))
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment