ethereum-optimism / ethereum-optimism/optimism

"ExtractFromFile expects 'out/' but should expect 'forge-artifacts/' - breaks self-hosted .tzst artifacts"

Open
#18,663 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.5k
Forks
4k
Avg merge
2d 15h
Merged PRs (30d)
145

Description

**Bug Description**

`ExtractFromFile()` in `op-deployer/pkg/deployer/artifacts/embedded.go` expects `out/` directory inside the tarball, but:
1. The `mktar` tool packages artifacts with `forge-artifacts/` prefix
2. The `downloadHTTP()` function returns `path.Join(tmpDir, "forge-artifacts")` expecting that directory name
3. The `file://` scheme also expects `forge-artifacts/`
4. The error message incorrectly states "forge-artifacts directory not found" when it's actually looking for `out/`

This inconsistency causes HTTP-downloaded `.tzst` artifacts to fail extraction with a misleading error.

**Steps to Reproduce**

1. Build contract artifacts using the standard `just copy-contract-artifacts` command in `op-deployer/justfile`
2. Upload the resulting `artifacts.tzst` to an HTTP server
3. Configure op-deployer to use `https://your-server.com/artifacts.tzst` as L1ContractsLocator
4. Run any deployment pipeline

**Expected behavior**

The artifact extraction should succeed, or at minimum the error message should accurately describe what directory it's looking for.

**Environment Information:**
- Operating System: macOS 14 (darwin 25.2.0)
- Package Version: op-deployer commit `425adb12a1` (post v0.5.2)

**Configurations:**

Using custom HTTP locator for L1 artifacts:
```yaml
l1ContractsLocator: https://example.com/artifacts-op-deployer-v0.5.2.tzst
```

**Logs:**

```
op-deployer pipeline failed: download L1 artifacts: failed to download artifacts: failed to extract embedded artifacts: forge-artifacts directory not found within embedded artifacts: stat /tmp/op-deployer-artifacts-4006286600/bundle-527794892/out: no such file or directory
```

Note the contradiction: error says "forge-artifacts directory not found" but the path it's checking ends in `/out`.

**Additional context**

The bug is in `op-deployer/pkg/deployer/artifacts/embedded.go` line 92:

```go
forgeArtifactsDir := filepath.Join(untarPath, "out") // Expects "out/"
if _, err := os.Stat(forgeArtifactsDir); err != nil {
return nil, fmt.Errorf("forge-artifacts directory not found...") // But error says "forge-artifacts"
}
```

Meanwhile in `download.go` line 100:
```go
return os.DirFS(path.Join(tmpDir, "forge-artifacts")), nil // Expects "forge-artifacts/"
```

And `mktar` (used by `just copy-contract-artifacts`) packages with `forge-artifacts/` prefix.

**Suggested Fix:**

Change line 92 in `embedded.go` from:
```go
forgeArtifactsDir := filepath.Join(untarPath, "out")
```
to:
```go
forgeArtifactsDir := filepath.Join(untarPath, "forge-artifacts")
```

This aligns with `downloadHTTP()`'s return statement, the `file://` scheme handling, and the `mktar` tool's output.

Ref: TODO comment on line 99 #18346 suggests this area is under active consideration for restructuring.

Contributor guide

Open the contributing guide

Research direction

Start in op-deployer/pkg/deployer/artifacts/embedded.go at the directory lookup described in the issue, then compare it with download.go and the mktar packaging invoked by op-deployer/justfile. Verify the expected archive prefix and ensure extraction and its error message agree with it; the deployment pipeline should successfully process the resulting .tzst artifact. Consider the TODO associated with #18346 before changing this area.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.