Skip to content

docs: architecture diagrams of stream accrual and cascade routing - #30

Open
NePreby wants to merge 1 commit into
Flow-Pulse:mainfrom
NePreby:docs/architecture-stream-accrual-cascade-routing
Open

NePreby wants to merge 1 commit into
Flow-Pulse:mainfrom
NePreby:docs/architecture-stream-accrual-cascade-routing

Conversation

@NePreby

@NePreby NePreby commented Nov 9, 2026

Copy link
Copy Markdown

Summary

Fixes #15.

Overview

Added docs/architecture.md providing comprehensive architecture specifications, mathematical accrual formulas, and GitHub-rendered Mermaid diagrams for FlowPulse smart contracts:

  1. System Topology:

    • Architecture overview connecting sponsors, maintainers, dependency trees, Soroban contracts (StreamRouter, CascadeSplitter), and client-side RFC-8785 receipt verifiers.
  2. StreamRouter Accrual & Checkpointing:

    • Formal mathematical specification of linear continuous per-second accrual:
      $$\text{streamed}(t) = \min(\text{checkpoint_amount} + \Delta t \times \text{rate_per_sec}, \text{deposit})$$
    • Sequence diagram detailing stream lifecycle: creation, continuous accrual, withdrawal, dry-gap checkpointing on top_up, and prorated settlement on cancel.
  3. CascadeSplitter Recursive Routing:

    • Flowchart of the recursive route() algorithm.
    • Formal invariants and proofs:
      • Conservation of funds: all unallocated basis points and rounding truncation dust settle with the owner at each level (sum of payouts == amount).
      • Bounded depth and cycle termination: strict cutoff at MAX_DEPTH = 3, guaranteeing deterministic termination even on mutual dependency cycles (A <-> B) or multi-node loops (A -> B -> C -> A).
  4. Cryptographic Audit Receipts:

    • Sequence diagram illustrating RFC-8785 canonical serialization, SHA-256 digest computation, and Ed25519 signature validation.
  5. README Integration:

    • Linked docs/architecture.md under # How it works and updated the repository layout tree.

Payout Details

  • Network: TRX Tron (TRC20)
  • Address: TMqmJjRgVS21NL2eFtfyHciTxvE4BqGmEv

This branch has not been deployed

No deployments
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.

Docs: architecture diagram of stream accrual and cascade routing

1 participant