Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Machinery to fix total issuance accounting and keep it fixed #595

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

orriin
Copy link
Contributor

@orriin orriin commented Jun 28, 2024

Machinery for #563

  • Adds documentation for pallet_subtensor::TotalIssuance
  • Introduces new storage item TotalSubnetLocked to track the total amount of tokens locked for subnet registration
  • Introduces new admin-util extrinsic to initialise the new TotalSubnetLocked value
  • Introduces new extrinsic rejig_total_issuance that sets the pallet_subtensor::TotalIssuance to the sum of issued tokens, staked tokens, and tokens locked for subnet registration
    • This is an O(1) operation, enabled by us adding TotalSubnetLocked
  • Adjusts set_subnet_locked_balance to update TotalSubnetLocked to reflect changes in SubnetLocked
  • Creates custom on_nonzero_unbalanced handler for transaction fees, which will remove the burnt transaction fee amount from pallet_subtensor::TotalIssuance before finally dropping it
    • Tested on localnet
  • Adds try-state checks for
    • TotalStake
    • TotalSubnetLock
    • TotalIssuance
    • Note: We will not test these in CI until we initialise the total subnet lock and rejig the total issuance, otherwise they fail.

@orriin orriin added the blue team defensive programming, CI, etc label Jun 28, 2024
@orriin orriin requested a review from open-junius June 28, 2024 11:51
comment

tx fee handler

Update pallets/subtensor/src/lib.rs

Co-authored-by: Cameron Fairchild <cameron@opentensor.ai>
Co-authored-by: Cameron Fairchild <cameron@opentensor.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blue team defensive programming, CI, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants