Hi all,
I’ve opened a Dev Fund proposal under RFP 20 (Indexers) and would value feedback before review.
The problem. A Canton app keeps its value across many contracts: reserves, positions, collateral, escrowed orders, fee pools. When these stop agreeing, nothing on the participant reports it. A reserve may stop covering positions, or fee shares may stop adding up to the fee pool. Teams write ad hoc SQL against PQS, which often:
- uses floating-point sums;
- treats missing rows as zero;
- ignores which parties’ data the query could actually see.
On Canton, that last point means a check can say “all clear” while hidden contracts disagree.
What I’m proposing. CantonGrid Invariants adds versioned reconciliation policies to CantonGrid. CantonGrid is my Apache-2.0, read-only indexer over PQS. A policy looks like this:
For each market, the reserve’s complete sets = positions held + positions escrowed in open sell orders.
For each asset, collateral × 100 ≥ debt × 150.
How the checks work:
- Policies are evaluated exactly, one asset at a time, over one snapshot of the participant’s own data, after checking the caller’s current permissions.
- Amounts in different assets are never added together.
- Any rounding tolerance must be declared in the policy, and the report shows it.
- If the check can’t see all the data, the result is “unavailable”, never “satisfied”.
- Reports can be reproduced and checked against a digest.
- There are SDKs for Rust and for JavaScript/TypeScript (one npm package), so the checks can run in CI or a backend without treating money as floats.
What I’m looking for:
- A Champion. If this fits your area, I’d be glad to talk.
- Teams with invariants they care about, such as exchanges, lending, custody, token supply or fee splits. I’d like to cover your cases in the policy library, and you could be one of the two external adopters.
- Feedback on the semantics, especially:
- whether declared tolerances are the right approach for pro-rata fee splits;
- whether operators should see which groups failed and by how much, or only counts.
- Validator support for DevNet/TestNet testing. So far CantonGrid has only been tested on LocalNet. I’m looking for a validator operator willing to host testing for CantonGrid and for Outcomia, a prediction-market app I’ve built on Canton, which is CantonGrid’s first real workload.
- CantonGrid needs only read access: a read-only Ledger API user and a restricted, SELECT-only PQS role. It never writes to the ledger or to PQS.
- Outcomia needs a DAR upload and a few parties on the participant, so it can create real markets, positions and orders for the checks to run against.
- I’ll publish the results with dated evidence, kept separate from the LocalNet results, and credit the operator if they’d like.
Links:
- Proposal: https://github.com/canton-foundation/canton-dev-fund/pull/1118
- Repository: https://github.com/kunal171/cantongrid
- Docs: https://shady-3.gitbook.io/cantongrid
- Crates (0.4.0 stable, 0.5.0-alpha.2 prerelease): https://crates.io/crates/cantongrid-cli and https://crates.io/crates/cantongrid-models. All ten workspace crates: https://crates.io/search?q=cantongrid
Thanks for reading. I’m happy to answer questions here or on the PR.