Skip to content

enhancement: checkpoint logic doesn't account for chain finality #157

@user1303836

Description

@user1303836

Summary

In `adapters/src/repo.rs:42-78`, `build_checkpoint()` stores the latest slot/block/timestamp without applying chain-specific finality delays. Different chains have different finality semantics:

  • Solana: Probabilistic finality (can reorg within ~32 slots)
  • EVM: Probabilistic block finality (~15 blocks on mainnet)
  • Hyperliquid: Instant finality

Impact

  • On chain reorg, the checkpoint may point past the reorg depth
  • Transactions could be skipped or duplicated on restart after a reorg
  • Different chains have silently different reliability guarantees

Recommended Fix

Apply a finality buffer per network before storing checkpoints:

let safe_slot = match finality_model {
    ProbabilisticSlot => latest_slot.saturating_sub(32),
    ProbabilisticBlock => latest_block.saturating_sub(15),
    DeterministicBlock => latest_block.saturating_sub(1),
    Instant => latest_value,
};

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlowLow severity

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions