Skip to content

Add sequence diagrams for core protocol flows#180

Open
mudigal wants to merge 11 commits into
devfrom
docs/sequence-diagrams
Open

Add sequence diagrams for core protocol flows#180
mudigal wants to merge 11 commits into
devfrom
docs/sequence-diagrams

Conversation

@mudigal

@mudigal mudigal commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add 11 Mermaid sequence diagrams documenting the core protocol flows under docs/sequence_diagrams/
  • Covers the full lifecycle: provider registration/deregistration, S3 bucket creation, object read/write with replica sync, checkpoint flows (client and provider initiated), and challenge/response/slashing flows
  • Documents trade-offs between challenge_checkpoint (recommended) and challenge_offchain (limited by client-side state loss and multi-device fragmentation)
  • Clarifies that provider-initiated checkpoints require client funding via fund_checkpoint_pool with cost breakdown

Diagrams added

File Description
provider-registration.md On-chain registration, settings update, node startup
provider-deregistration.md Two-step exit with cooldown, cancellation
s3-bucket-creation.md Discovery, negotiation, atomic on-chain extrinsic
s3-write-flow.md Upload: auth, chunking, Merkle tree, MMR commit, replica sync
s3-read-flow.md Download: resolution, DFS traversal, multi-provider topology
checkpoint-client-initiated.md Signature collection, consensus, on-chain submit
checkpoint-provider-initiated.md Leader election, grace period, rewards/penalties, client funding
challenge-creation.md Both challenge modes with trade-off analysis
challenge-response.md Two-layer proof, time-based cost split
challenge-timeout-slashing.md Automatic slashing via on_finalize

Test plan

  • Verify all Mermaid diagrams render correctly on GitHub
  • Review technical accuracy against pallet, provider-node, and client code
  • Confirm cost/funding documentation for provider-initiated checkpoints is clear

🤖 Generated with Claude Code

mudigal and others added 11 commits June 15, 2026 21:16
Mermaid sequence diagrams documenting the core protocol flows:
- Client-initiated checkpoint (signature collection + consensus)
- Provider-initiated checkpoint (leader election + grace period)
- Challenge creation (both on-chain and off-chain modes)
- Challenge response (two-layer MMR + Merkle proof)
- Challenge timeout and automatic slashing
Four-phase diagram covering provider discovery, off-chain term
negotiation with provider signature, single atomic on-chain extrinsic
(Layer 0 bucket + storage agreement + S3 registry entry), and UI
completion. Includes events, storage items, payment calculation,
and replay protection details.
Registration: on-chain registration with stake locking, settings
update (two transactions), provider node startup sequence (keyfile
loading, chain sync, multiaddr sync, HTTP server), and adding stake.

Deregistration: two-step exit flow (announce cooldown >= ChallengeTimeout,
then complete to return stake), cancellation flow, and security rationale
for why instant exit is not allowed.
Write flow: client auth (sr25519), provider URL resolution from chain,
256 KiB chunking, content-addressed storage, balanced Merkle tree
construction, MMR commit, S3 index update. Includes replica sync
background flow (peak fetching, recursive subtree pull, on-chain
confirm_replica_sync with payment).

Read flow: provider resolution, auth, S3 index lookup, DFS Merkle tree
traversal to collect chunks, truncation, response. Includes Rust SDK
verified download path and multi-provider topology diagram showing
how primaries, replicas, and clients interact.
Add prerequisite section: client must configure_checkpoint_window and
fund_checkpoint_pool before provider checkpoints work sustainably.
Add setup sequence diagram, cost breakdown table, budget estimation
example, and note on disabling. Makes clear this is a client cost.
Expand the Two Challenge Modes section with detailed analysis:
- challenge_checkpoint recommended as the robust production path
- challenge_offchain limitations: requires client to retain commit
  response, defeated by client-side data loss, fragmented across
  multi-device/multi-user-agent scenarios where each device gets
  different MMR roots and signatures, point-in-time snapshots
  that don't track subsequent writes from other devices
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.

3 participants