Skip to content

Conversation

@m0ar
Copy link
Collaborator

@m0ar m0ar commented Jan 8, 2026

WIP

Re-implement RPC proof discovery

#755 prematurely removed some fallback logic required for nodes to self-heal after failing to persist self-anchoring inclusion proofs. The relevant changes in discover_chain_proof are reverted here.

Fallback validation to account for incorrect codec slice in anchor root

Single event anchor batch roots didn't initially get a dag-pb tree node wrapper, instead the dag-jose hash was written to the chain. However, it assumed it should slice off the first 4 bytes from the cid to strip it down to a hash, but dag-jose has a longer codec sequence. This resulted in the root hash keeping the 0x20 (digest length 32) in the front, causing the last digest byte to be dropped.

The fix is falling back to a partial 31-byte comparison for gnosis (clay) anchors, for anchors in a specific time window, and only if the prefix is 0x20.

Self-anchoring proof persistence

The self-anchoring process didn't store the inclusion proofs in the DB, causing pipeline errors for self-anchored events. This is now implemented so the node immediately can validate the events that it created and anchored.

Approach:

  1. anchor-service/src/transaction_manager.rs: Added ChainInclusionData struct and chain_inclusion field to RootTimeEvent
  2. anchor-service/src/lib.rs: Exported ChainInclusionData
  3. anchor-service/src/anchor.rs: Added chain_inclusion field to TimeEventBatch and TimeEventInsertable, updated conversion methods
  4. anchor-service/src/anchor_batch.rs: Flows chain_inclusion from RootTimeEvent to TimeEventBatch
  5. anchor-evm/src/evm_transaction_manager.rs:
  6. Added AnchorResult struct (moved outside impl block)
  7. Modified submit_and_wait to return block hash, timestamp, and tx_input
  8. Creates ChainInclusionData in anchor_root with all needed fields
  9. Fixed get_block_by_number API call (changed BlockTransactionsKind::Hashes to false)
  10. anchor-service/src/cas_mock.rs and anchor-remote/src/cas_remote.rs: Added chain_inclusion: None to RootTimeEvent
  11. event-svc/src/store/sql/entities/chain_proof.rs: Added From impl for ChainProof
  12. event-svc/src/event/store.rs: Updated ceramic_anchor_service::Store::insert_many to extract and persist chain inclusion proofs
  13. Test files: Updated all expectation files to include chain_inclusion: None

@m0ar m0ar requested a review from a team as a code owner January 8, 2026 15:47
@m0ar m0ar requested review from stephhuynh18 and removed request for a team January 8, 2026 15:47
@m0ar m0ar requested review from dav1do and stbrody and removed request for stephhuynh18 January 8, 2026 16:17
@m0ar m0ar temporarily deployed to tnet-prod-2024 January 8, 2026 16:26 — with GitHub Actions Inactive
@m0ar m0ar temporarily deployed to tnet-prod-2024 January 8, 2026 17:02 — with GitHub Actions Inactive
@m0ar m0ar temporarily deployed to tnet-prod-2024 January 8, 2026 18:26 — with GitHub Actions Inactive
@m0ar m0ar temporarily deployed to tnet-prod-2024 January 9, 2026 18:31 — with GitHub Actions Inactive
@m0ar m0ar force-pushed the fix/store-self-anchored-inclusion-proofs branch from 979e75f to e881c0a Compare January 9, 2026 18:51
@m0ar m0ar changed the title fix: self-anchoring never stored inclusion proofs, causing concluder failures fix: self-anchoring proof storage and validation fixes Jan 9, 2026
@m0ar m0ar deployed to tnet-prod-2024 January 9, 2026 19:12 — with GitHub Actions Active
@m0ar m0ar force-pushed the fix/store-self-anchored-inclusion-proofs branch from 6a70a12 to 9e31257 Compare January 9, 2026 20:20
@m0ar m0ar force-pushed the fix/store-self-anchored-inclusion-proofs branch from 9e31257 to 35d68a7 Compare January 9, 2026 21:25
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.

2 participants