Skip to content

Derive the backing family from the chain id (subnet alpha, PR1) - #707

Open
LandynDev wants to merge 2 commits into
testfrom
feat/alpha-backing-family
Open

Derive the backing family from the chain id (subnet alpha, PR1)#707
LandynDev wants to merge 2 commits into
testfrom
feat/alpha-backing-family

Conversation

@LandynDev

Copy link
Copy Markdown
Collaborator

Derive a leg's backing family from its chain id so subnet alpha tokens (sn<N>) settle in the TAO purse with no new accounts, instructions or config.

  • backing::family(chain): sn<digits> -> tao, else the chain itself. An alpha shares subtensor's account space, so the existing vote_slash(.., user: AccountId, ..) already pays its holder.
  • collateral_leg_bind replaces collateral_leg_amount: a leg that IS the backing asset binds Exact(amount) (today's equality check, byte-identical for every sol/tao pair, pinned by a differential test); a leg that only settles in the family binds Declared — bounded by swap_bounds, understatement policed off-chain (spec §2, §5).
  • Exact legs are matched before family legs, so sn7<->tao keeps the free on-chain check in both directions. This is an amendment to the spec's §3 snippet, which checked the family first.
  • collateral_leg_user_addr and declarable_bit use the same lookup.
  • fulfillment_grace_secs: every TAO-family chain takes TAO's 180s window. CANCEL_REASON_ALPHA_TRANSFER_DISABLED = 6 for a subnet that disables transfers mid-swap.

Tests: cargo test -p allways_swap_manager --lib (54).

Deploy: one program redeploy + testnet era bump. Adding another subnet later is a Python registry row, no contract change.

Spec: SPEC_SUBNET_TOKENS.md §2–§3. Stack: PR1 (this) -> PR2 alpha assets -> das registry -> PR3 gate.

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.

1 participant