Skip to content

feat: migrate-publish-datamaps via antd 0.7.0 external-signer chunks#20

Merged
Nic-dorman merged 2 commits into
masterfrom
feat/migrate-publish-datamaps
May 14, 2026
Merged

feat: migrate-publish-datamaps via antd 0.7.0 external-signer chunks#20
Nic-dorman merged 2 commits into
masterfrom
feat/migrate-publish-datamaps

Conversation

@Nic-dorman

Copy link
Copy Markdown
Contributor

Summary

Adds cmd/migrate-publish-datamaps, an operator binary that walks completed private uploads carrying a locally-stored DataMap and back-publishes each one as a single on-network chunk via antd's new external-signer chunk surface (POST /v1/chunks/prepare + POST /v1/chunks/finalize, shipped in ant-sdk v0.7.0). After it runs, downstream consumers can fetch each file directly via autonomi://<addr> instead of proxying through indelible.

Payment flows through indelible's existing wallet (WalletService.GetDefaultDecryptKeyevm.Signer.PayForQuotes) — the same path the upload worker uses for normal file uploads. No daemon-wallet provisioning, no env wrangling, no special key handling.

Concrete trigger: PROD-01 has ~78 completed-private uploads (the foundations corpus from 2026-05-06) that pre-date public visibility. Migrating them lets pub-library drop the indelible proxy for those papers.

Surface

  • internal/migrate/publish_datamaps.go — testable migrator with two decoupled interfaces (ChunkPublisher for antd-go, EvmPayer for evm.Signer), JSONLines progress, --dry-run / --limit / --uuid / --verify flags, idempotent "already on network" exit that doesn't re-pay.
  • cmd/migrate-publish-datamaps/main.go — thin wrapper: loads indelible.toml, opens the existing SQLite, resolves the default wallet, wires antd-go + evm.Signer, handles graceful SIGINT.
  • services.UploadService.MarkPublished / ListPrivatePublishCandidates — small additions. data_map is preserved on the migrated row; the download handler (internal/handlers/uploads.go) prefers data_map over datamap_address when both are populated, so the row stays downloadable through indelible's existing API either way.

ant-sdk dep bump

  • github.com/WithAutonomi/ant-sdk/antd-go: v0.6.1 → v0.7.0 (adds PrepareChunkUpload / FinalizeChunkUpload).

Operational note

The migration binary calls /v1/chunks/prepare and /v1/chunks/finalize on the antd daemon indelible manages. PROD-01's antd must be upgraded from v0.6.1 → v0.7.0 before this binary will work — the new endpoints don't exist on older daemons. Drop the v0.7.0 binary at /usr/local/bin/antd (from the ant-sdk release page, antd-linux-amd64) and restart indelible.service; ~30s outage.

Test plan

  • go test ./... clean — handlers, worker, services, migrate, etc.
  • Migration unit tests cover:
    • Happy path: rows flip to visibility='public' with correct datamap_address, with correct prepare/pay/finalize call sequencing
    • Already-on-network skip: no payment, no finalize, but row still flips to public
    • Dry-run: no network calls, no row mutations
    • Generic prepare error: one row fails, the rest proceed
    • Verify mismatch: row stays private when ChunkGet returns different bytes than were sent
    • --limit + --uuid filters
    • Bad-hex data_map skip (per-row failure, no network call)
  • End-to-end smoke verified against Arbitrum One mainnet at the SDK layer (ant-sdk#61 discussion): 256-byte payload round-tripped via prepare → payForQuotes (external wallet) → finalize → ChunkGet with full byte equality.
  • Operator (post-merge):
    1. Drop antd v0.7.0 binary on PROD-01, restart indelible (~30s outage).
    2. make migrate-publish-datamaps-linux, scp to PROD-01.
    3. ./migrate-publish-datamaps-linux-amd64 --config /opt/indelible/indelible.toml --dry-run → confirm candidate count.
    4. Run for real; verify a few /api/v2/uploads/{uuid} responses now report datamap_address.

🤖 Generated with Claude Code

Nic-dorman and others added 2 commits May 13, 2026 14:11
Adds `cmd/migrate-publish-datamaps`, an operator binary that walks completed
private uploads carrying a locally-stored DataMap and back-publishes each one
as a single on-network chunk via the new antd `/v1/chunks/prepare` +
`/v1/chunks/finalize` endpoints (antd-go v0.7.0). After it runs, downstream
consumers can fetch each file directly via `autonomi://<addr>` instead of
proxying through indelible.

Payment flows through indelible's existing wallet via the same
`evm.Signer.PayForQuotes` path the upload worker already uses — no daemon
wallet, no env wrangling, no special key handling. The migration uses the
SDK surface as a normal SDK consumer would.

## Surface

- `internal/migrate/publish_datamaps.go` — testable migrator with two
  decoupled interfaces (`ChunkPublisher`, `EvmPayer`), JSONLines progress,
  `--dry-run` / `--limit` / `--uuid` / `--verify` flags, and an idempotent
  "already on network" exit that doesn't re-pay.
- `cmd/migrate-publish-datamaps/main.go` — thin wrapper: loads
  `indelible.toml`, opens the existing SQLite, resolves the default wallet
  via `WalletService.GetDefault` + `DecryptKey`, wires antd-go and
  `evm.Signer`, handles graceful SIGINT.
- `services.UploadService.MarkPublished` / `ListPrivatePublishCandidates` —
  minimal additions. `data_map` is preserved on the migrated row; the
  download handler prefers it when both columns are populated, so the row
  stays downloadable through indelible's API in either form.

## ant-sdk dep bump

- antd-go: v0.6.1 -> v0.7.0 (adds PrepareChunkUpload / FinalizeChunkUpload).

## Test plan

- [x] `go test ./...` clean (handlers, worker, services, migrate, ...)
- [x] Migration unit tests cover: happy path (rows flip to public + correct
      call sequencing), already-on-network skip (no payment, row still
      flips), `--dry-run` (no calls, no row mutations), generic prepare
      error continues, `--verify` mismatch leaves row private,
      `--limit` + `--uuid` filters, bad-hex `data_map` skip.
- [x] End-to-end smoke verified against Arbitrum One mainnet at the SDK
      layer (ant-sdk#61): 256-byte payload round-tripped via prepare →
      payForQuotes (external wallet) → finalize → ChunkGet with full byte
      equality.
- [ ] Operator (post-merge): `make migrate-publish-datamaps-linux`,
      scp to PROD-01 after the antd v0.7.0 binary is deployed there,
      `--dry-run --config /opt/indelible/indelible.toml` -> confirm
      candidate count, then run for real.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two fixes in one commit because they're both CI blockers on this PR but
neither is load-bearing for the migration logic.

1. `internal/migrate/publish_datamaps_test.go`: remove the unused
   `failPrepareOnUUID` field on `fakePublisher`. golangci-lint's `unused`
   check flagged it; it was leftover scaffolding from an earlier draft.

2. `go.mod`: bump Go directive 1.25.9 → 1.25.10 and `golang.org/x/net`
   v0.51.0 → v0.53.0. Resolves four govulncheck findings (all pre-existing
   on master — disclosed since the last CI run):
   - GO-2026-XXXX html/template (stdlib, fixed in go1.25.10)
   - GO-2026-4971 net Dial/LookupPort NUL byte panic (stdlib, go1.25.10)
   - GO-2026-XXXX HTTP/2 (net/http, go1.25.10)
   - GO-2026-4918 HTTP/2 infinite loop (golang.org/x/net v0.53.0)
   `go mod tidy` also pulled forward x/crypto, x/sys, x/text, x/tools,
   x/mod, x/sync, x/exp transitively. No code changes required.
@Nic-dorman
Nic-dorman merged commit b913432 into master May 14, 2026
6 checks passed
@Nic-dorman
Nic-dorman deleted the feat/migrate-publish-datamaps branch May 14, 2026 10:54
Nic-dorman added a commit that referenced this pull request May 14, 2026
ant-sdk released v0.7.1 today, adding the antd-linux-arm64 release
artifact that V2-275 was blocked on.

- `.antd-version`: v0.6.1 → v0.7.1. Bundles the daemon that
  implements /v1/chunks/prepare and /v1/chunks/finalize — the
  endpoints `cmd/migrate-publish-datamaps` (shipped in #20) was
  written against. Removes the "drop antd v0.7.0 binary on PROD-01
  before running the migrator" step from #20's checklist on the next
  release deploy.

- `.github/workflows/release.yml`: wire `antd-linux-arm64` into the
  linux/arm64 build leg. Previously empty because no upstream binary
  existed; now resolved.

No go.mod change: antd-go/v0.7.0 is unchanged in this upstream
release; v0.7.1 is daemon-side only (ant-core bump + arm64 publish +
various non-Go-SDK fixes).

Unblocks V2-271 (Docker linux/arm64 images).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant