Beta basket: delegated weight-vector management for root yield vaults#2772
Open
cisterciansis wants to merge 1 commit into
Open
Beta basket: delegated weight-vector management for root yield vaults#2772cisterciansis wants to merge 1 commit into
cisterciansis wants to merge 1 commit into
Conversation
Let a root validator hand the *setting* of its beta-basket weight vector to another root validator (a "manager") and pay a take for the service, so a skilled curator can run an independent strategy per delegator -- a managed account, not one shared vector everyone copies. - RootWeightManager (delegator uid -> manager uid): authorization only. A delegator names its manager via set_root_weight_manager (self = clear). - set_root_weights_for(delegator, ...): the manager writes a bespoke vector into the *delegator's own* Weights[ROOT] slot. One manager can therefore run a different vector for each delegator; distribution reads each delegator's own slot exactly as base Root Reborn does (no read-time indirection). Shares apply_root_weights with the self path. - RootWeightTake (manager uid -> bps): the curation fee, bounded by the childkey-take ceiling and rate-limited on increases (reusing the childkey-take window) so a manager cannot spike its take on already-committed delegators between their per-block distributions. - The take is skimmed from the delegator's dividend in TAO after the origin sell and credited to the manager's own root stake. Round trip stays TotalStake-neutral: sell - buys - fee == 0. Guarded by Keys::try_get so a stale/vacant manager uid is never paid. Extracts credit_root_stake, now shared with the root-claim payout. - All uid-keyed, so authorization, vector, and take follow either validator through hotkey swaps with no migration. Tests: an end-to-end test (authorize -> manager sets the delegator's own slot, rejected before authorization -> distribution follows it, take paid), and an independence test proving one manager runs A->X and B->Y as separate baskets, earning a take on each. Follow-ups (not blocking review): - Self-deal/slippage guards on w matter more here than in base Root Reborn: a manager now deploys other validators' stakers' capital, so a vector pointed at a manager-held subnet pumps its own bag with delegated funds. Resolve with the existing "slippage/self-deal guards on w" follow-up. - Real benchmarked weights (the setters currently reuse set_childkey_take's). - Clear RootWeightManager/RootWeightTake on root uid reassignment, alongside the existing Weights[ROOT] uid-reuse follow-up.
0f42d7e to
07969f1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root Reborn turns each root validator into an on-chain yield vault curator: validators set a basket weight vector and their stakers' root dividends compound into it. This PR adds delegated weight-vector management so a root validator can hand the curation of its vector to another root validator (a "manager") and pay a take for the service.
The value here is that a skilled curator can actively set a bespoke strategy for each delegator that trusts them.
Mechanism
RootWeightManager(delegator uid → manager uid) — authorization only. A delegator names its manager viaset_root_weight_manager(self = clear).set_root_weights_for(delegator, …)— the manager writes a bespoke vector into the delegator's ownWeights[ROOT]slot. One manager can therefore run a different vector for each delegator. Distribution reads each delegator's own slot exactly as base Root Reborn does — no read-time indirection. Sharesapply_root_weightswith the self path (set_root_weights).RootWeightTake(manager uid → bps) — the curation fee. Bounded by the childkey-take ceiling and rate-limited on increases (reusing the childkey-take window) so a manager can't spike its take on already-committed delegators between their per-block distributions. Lowering is always allowed.sell − buys − fee == 0. Guarded byKeys::try_getso the fee never lands on a vacant uid. Extractscredit_root_stake, now shared with the root-claim payout.Tests
test_root_weight_manager_sets_delegator_vector_and_earns_take— end-to-end via the extrinsics: authorization is required (rejected before, accepted after), the manager writes the delegator's own slot (not its own), distribution follows that vector, and the take is credited to the manager's root stake.test_root_weight_manager_runs_independent_vectors— the core requirement: one manager runsA → XandB → Yas independent baskets, each delegator's dividend deploys into its own manager-set subnet, and the manager earns a take on each.The existing basket distribution/claim tests still pass, covering the shared
apply_root_weightsandcredit_root_stakerefactors (29/29 in theclaim_rootmodule).Follow-ups (not blocking review)
wmatter more here than in base Root Reborn. A manager now deploys other validators' stakers' capital, so a vector pointed at a manager-held subnet pumps its own bag with delegated funds. Best resolved together with the existing "slippage/self-deal guards on w" follow-up.set_childkey_take's /set_weights' weight.RootWeightManager/RootWeightTakeon root uid reassignment, alongside the existingWeights[ROOT]uid-reuse follow-up.