|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Purpose |
| 4 | + |
| 5 | +This repository implements a Celestia-backed Alt-DA server for the OP Stack. |
| 6 | +When working in this repo, agents must treat the Optimism Alt-DA specification |
| 7 | +as the source of truth and compare the implementation against that spec. |
| 8 | + |
| 9 | +Canonical spec: |
| 10 | + |
| 11 | +- https://specs.optimism.io/experimental/alt-da.html |
| 12 | + |
| 13 | +Companion local guide for setup and end-to-end testing: |
| 14 | + |
| 15 | +- `SETUP_TESTING.md` |
| 16 | + |
| 17 | +## Mandatory Workflow |
| 18 | + |
| 19 | +1. Read the Alt-DA spec before reviewing or changing behavior. |
| 20 | +2. Identify which parts of the spec are in scope for this repo. |
| 21 | +3. Compare code behavior to the spec, not just to README text. |
| 22 | +4. Call out any spec mismatches explicitly in code reviews and change summaries. |
| 23 | +5. Run repo-local tests for code changes. |
| 24 | +6. Use the `op-celestia-devnet` flow from `SETUP_TESTING.md` for any change that |
| 25 | + affects DA server behavior, commitments, startup/config, or OP Stack |
| 26 | + integration. |
| 27 | + |
| 28 | +If the spec, code, and docs disagree, use this priority order: |
| 29 | + |
| 30 | +1. Alt-DA spec |
| 31 | +2. Current implementation |
| 32 | +3. Local documentation |
| 33 | + |
| 34 | +## Repo Scope |
| 35 | + |
| 36 | +This repo is primarily responsible for the DA server side of Alt-DA, not the |
| 37 | +full upstream derivation/challenge pipeline. |
| 38 | + |
| 39 | +Main local areas of responsibility: |
| 40 | + |
| 41 | +- `celestia_server.go`: HTTP endpoints and request/response behavior |
| 42 | +- `celestia_storage.go`: Celestia commitment encoding, submit/get logic, blob ID handling |
| 43 | +- `cmd/daserver/config.go`: config model and validation |
| 44 | +- `cmd/daserver/config_builder.go`: CLI and TOML merging |
| 45 | +- `cmd/daserver/entrypoint.go`: wiring, startup, fallback provider initialization |
| 46 | +- `signer/`: signer backends and validation |
| 47 | +- `fallback/`: fallback storage behavior |
| 48 | + |
| 49 | +Usually out of scope for this repo and owned upstream by Optimism or deployment |
| 50 | +infrastructure: |
| 51 | + |
| 52 | +- derivation pipeline behavior inside `op-node` |
| 53 | +- challenge contract implementation |
| 54 | +- fault proof preimage oracle integration |
| 55 | +- OP Stack L1 contract deployment logic |
| 56 | + |
| 57 | +## Spec Checklist |
| 58 | + |
| 59 | +Agents should explicitly verify the DA server behavior against the spec section |
| 60 | +"DA Server" and the surrounding commitment rules: |
| 61 | + |
| 62 | +- `POST /put/<hex_encoded_commitment>` exists if precomputed commitments are |
| 63 | + supported by the implementation. |
| 64 | +- `POST /put` stores bytes and returns a commitment. |
| 65 | +- `GET /get/<hex_encoded_commitment>` returns the original preimage bytes. |
| 66 | +- Failed storage returns an error so the batcher can retry. |
| 67 | +- Returned commitments are sufficient for later retrieval. |
| 68 | +- The server can parse the commitment payload it emits. |
| 69 | +- The data returned from the DA layer matches what was committed. |
| 70 | +- Not-found and internal-error behavior are stable and documented. |
| 71 | +- Any extension beyond the spec is documented as an extension, not mistaken for |
| 72 | + normative behavior. |
| 73 | + |
| 74 | +For this repo specifically, also verify: |
| 75 | + |
| 76 | +- Celestia DA layer byte handling and generic commitment encoding |
| 77 | +- compact vs full blob ID behavior |
| 78 | +- config defaults and required flags |
| 79 | +- signer mode behavior and secret handling |
| 80 | +- fallback storage behavior does not silently violate DA server expectations |
| 81 | + |
| 82 | +## Testing Expectations |
| 83 | + |
| 84 | +Minimum for code changes: |
| 85 | + |
| 86 | +- `go test ./...` |
| 87 | + |
| 88 | +Required for behavior changes to the DA server or OP Stack integration: |
| 89 | + |
| 90 | +- follow `SETUP_TESTING.md` |
| 91 | +- run the `op-celestia-devnet` end-to-end flow |
| 92 | +- include the exact scripts and checks run in the final report |
| 93 | + |
| 94 | +Useful local test entrypoints: |
| 95 | + |
| 96 | +- `celestia_server_test.go` |
| 97 | +- `celestia_storage_test.go` |
| 98 | +- `tests/integration/` |
| 99 | +- `tests/manual/throughput/` |
| 100 | + |
| 101 | +## Deliverables |
| 102 | + |
| 103 | +When an agent reviews or changes this repo, the output should include: |
| 104 | + |
| 105 | +- which spec clauses were checked |
| 106 | +- which files implement those clauses |
| 107 | +- any mismatches or ambiguities found |
| 108 | +- tests run |
| 109 | +- any remaining gaps that still require upstream Optimism validation |
0 commit comments