Eliminate per-holding balance events from root claims - #3039
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🛡️ AI Review — Skeptic (security review)VERDICT: SAFE VERY HIGH account-age/activity scrutiny; mitigated by repository write access and substantive merged contributions. No listed Gittensor association; valid branch to main. The paired exact balance debit and aggregate credit remain inside existing storage transactions, preserving atomicity and issuance while removing only intermediate balance events. Both callers roll back all settlement state if either mutation fails. No AI-review trust-boundary, dependency, origin, panic, or execution-integrity changes were introduced. FindingsNo findings. ConclusionNo malicious behavior or security vulnerability was found in the static diff review. 🔍 AI Review — Auditor (domain review)VERDICT: 👍 UNKNOWN gittensor association; newer contributor with repository write access and several merged subtensor PRs, so the implementation and stated invariants received independent scrutiny. The root-claim settlement correctly replaces per-holding transfers with transactional raw debits and one aggregate credit. The paired No spec-version auto-fix is needed: local Findings
ConclusionThe primary root-claim optimization is correct and adequately tested. The only concern is a non-blocking, undocumented event change in the shared dissolution path. |
| } | ||
| }; | ||
|
|
||
| if let Err(err) = Self::credit_root_account_without_event(tao) { |
There was a problem hiding this comment.
[LOW] Document and test the dissolution event change
This shared conversion path now also suppresses the Balances::Transfer event during subnet dissolution, although the PR description and new regression coverage discuss root claims only. Because runtime events are externally observable, either preserve the prior transfer behavior here or explicitly document this additional behavior change and add dissolution-path coverage for the intended event set.
|
🔄 AI review updated — Skeptic: SAFE Auditor: 👍 |
Summary
Root claims currently perform one pallet-account transfer per redeemed basket holding—approximately 38 transfers per claim at current basket sizes. This PR replaces that fan-out with silent source debits and one aggregate root-account credit.
Improvement
Nholdings)N = 38N0Balances.TransfereventsN0N1NN2NN + 1BasketClaimedevents11At the measured chain rate, root claims generate approximately 1.26 million
Balances.Transferevents per day. Removing them is expected to eliminate roughly 30–35 GB/year of event payload.Correctness
The source debits and aggregate root credit execute transactionally. Claim economics, total issuance, subnet reserve backing, protocol-flow accounting, and rollback behavior remain unchanged.
Testing
Balancesevents, and one aggregateBasketClaimedevent.