Feat/recycle burn chain exts#2560
Conversation
Strip development log::info!/log::error! calls from dispatch entry and AddStakeRecycleV1 handler. Normalize AddStakeRecycleV1 to use the same concise ? pattern as all other handlers.
|
Thanks for the contribution. Can you add the ticket for the requirement? I am wondering the extension like AddStakeRecycleV1, who really want to do it. just confirm all is from the real requirements. |
Just got it ticketed up here - #2564 Particular snippet from the issue to elaborate on the AddStakeBurn + AddStakeRecycle funcs and why those 2 are included:
|
Description
Add 4 new chain extension functions (IDs 16-19) enabling WASM smart contracts to recycle and burn alpha stake.
RecycleAlphaV1(16): Recycle alpha stakeBurnAlphaV1(17): Burn alpha stakeAddStakeRecycleV1(18): Atomically add TAO stake then recycleAddStakeBurnV1(19): Atomically add TAO stake then burnAll functions return the actual alpha amount via the output buffer.
Related Issue(s)
Closes #2564
Type of Change
Breaking Change
No breaking changes. Existing chain extension functions (IDs 0-15) are unaffected. New function IDs 16-19 are additive.
Checklist
./scripts/fix_rust.shto ensure my code is formatted and linted correctlyAdditional Notes
7 unit tests cover: success paths for all 4 functions, root subnet rejection, nonexistent subnet, and insufficient balance. E2E validated on localnet with an ink! contract calling
add_stake_recyclevia chain extension.I also ran some local E2E testing with a local running subtensor chain (with the new extensions), deployed contract, etc.
Screenshot 1 shows:
Screenshot 2 shows:
Unit tests successfully passing:
