Skip to content

feat(api): slots.da_block_height + BlockResponse.da_block_height (consumes chain v0.2.3's receipt.da_block_height)#63

Merged
proofmancer merged 1 commit into
mainfrom
feat/slots-da-block-height
May 18, 2026
Merged

feat(api): slots.da_block_height + BlockResponse.da_block_height (consumes chain v0.2.3's receipt.da_block_height)#63
proofmancer merged 1 commit into
mainfrom
feat/slots-da-block-height

Conversation

@proofmancer
Copy link
Copy Markdown
Member

Indexer-side companion to chain v0.2.3 (ligate-io/ligate-chain#355). Extracts the new receipt.da_block_height field from each slot's first batch and surfaces it as a top-level field on BlockResponse, powering the explorer's "View on Celenium" deep-link.

What

  • New migration migrations/20260518000002_slots_da_block_height.sql: ALTER TABLE slots ADD COLUMN da_block_height BIGINT. Nullable.
  • Indexer extraction: renamed extract_slot_proposerextract_slot_first_batch_facts. Same single first-batch fetch now pulls both receipt.da_address (the existing proposer) and receipt.da_block_height (the new field). Returns a tiny SlotFirstBatchFacts struct.
  • Slot upsert: db::upsert_slot gains a da_block_height: Option<i64> parameter. Same COALESCE-preserve semantics as proposer — a re-poll that can't reach batches won't blank a known height.
  • BlockResponse.da_block_height: Option<u64> — surfaces the column to API consumers. #[serde(skip_serializing_if = "Option::is_none")] so legacy null rows omit the field rather than emit "da_block_height": null.
  • Query plumbing: SlotRow + SlotTuple extended with the new column; all 3 SELECT … FROM slots sites updated to include it.

Backward compatibility

  • Old slot rows (ingested before this migration) stay da_block_height = NULL until an optional one-shot backfill walks them. The explorer treats null as "no Celenium link to render" — graceful degrade.
  • New slot rows ingested after this PR deploys will have the value populated automatically (assuming the chain is on v0.2.3+, which prod is as of 17:53 UTC today).

Verification

  • cargo check --workspace clean Rust-side (the local build fails on the risc0-sys Metal kernel script — macOS-only issue, same as every other api PR this week; Linux CI validates).
  • Migration applied cleanly to my local dev Postgres.
  • Prod chain emits the field: curl https://rpc.ligate.io/v1/ledger/batches/44857 | jq .receipt.da_block_height11403025 (verified live during the v0.2.3 swap).

After merge

  1. Railway redeploys ligate-api → runs the migration → indexer starts populating the column on new slots.
  2. Backfill is optional and skippable; new blocks have the field, old ones stay null.
  3. Follow-up ligate-explorer PR renders a "View on Celenium" pill per block when da_block_height is present.

…sumes chain v0.2.3's receipt.da_block_height)
@proofmancer proofmancer merged commit c5342e3 into main May 18, 2026
7 checks passed
@proofmancer proofmancer deleted the feat/slots-da-block-height branch May 18, 2026 19:11
@github-actions github-actions Bot locked and limited conversation to collaborators May 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant