ChainSafe / ChainSafe/canton-extending-mainnet
[P2-E7.5] Per-synchronizer purchase aggregation
- Dominant language
- Shell
- Stars
- 0
- Forks
- 0
- Avg merge
- 22h 58m
- Merged PRs (30d)
- 1
Description
Split out of #42, which is rescoped to the disclosure endpoint only. This is the totals half: purchased and burned per registered synchronizer.
Deliberately off the rung that gates the buy path, because it needs a Flyway migration and the buy path does not. The V028 index leads with `member_traffic_member`, so a per-synchronizer aggregate needs its own index. `amuletSpent` and `usdSpent` are not index columns, so a burn figure needs a migration too.
Its one known consumer is Phase 3: `purchasedTotal` in `AmuletRules_StartProcessingExtensionRewardsV2`, documented as "total traffic ever purchased for the synchronizer (bytes), computed off-ledger by DSO automation and attested by the confirming vote". Note bytes and cumulative, not a CC figure.
Out of scope, carried over from #42: totals "over time windows" (Scan has no CC txlog history since upstream `91bdc7af4`) and the effective rate / discount breakdown (depends on #86).
**Key files:** `apps/scan/src/main/scala/.../store/db/DbScanStore.scala`, `apps/common/src/main/resources/db/migration/canton-network/postgres/stable/`
**Acceptance criteria:**
- [ ] Purchased total per registered synchronizer, in bytes
- [ ] Backed by an index that leads with the synchronizer, not the member
- [ ] Decide and record whether a burned total is in scope; it requires new index columns
**Depends on:** #41
**Epic:** ChainSafe/canton-extending-mainnet#70
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with apps/scan/src/main/scala/.../store/db/DbScanStore.scala and the stable Canton Network PostgreSQL migrations, then inspect the V028 index and dependency #41. Define the per-registered-synchronizer purchased aggregate in bytes and decide whether burned totals are included, recording any required index columns and migration. Done means the acceptance criteria are met and the Phase 3 purchasedTotal consumer can use the cumulative total.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, scala
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100