feat: gate vault flows on isSubnetDissolving and drop the storage-query precompile#29
Draft
pawel-gebal-reef wants to merge 2 commits into
Draft
feat: gate vault flows on isSubnetDissolving and drop the storage-query precompile#29pawel-gebal-reef wants to merge 2 commits into
pawel-gebal-reef wants to merge 2 commits into
Conversation
…ry precompile Subtensor now dissolves subnets asynchronously: the dissolve extrinsic only queues the netuid while NetworkRegisteredAt persists until mid-cleanup, and the old DissolvedNetworks storage item is gone, so the raw-storage blackout check read an empty key and always passed. - read registration blocks and the dissolve queue via the subnet precompile (ISubnet at 0x803) and delete StorageQueryReader - freeze wrap, unwrap, unwrapForTao, rebalance, sharePrice, previewWrap and previewUnwrap while the netuid sits in the dissolve cleanup queue - migrate unit tests to a staged MockSubnetPrecompile and cover the early and late blackout windows per entry point - wait for cleanup to finish in the dissolution e2e before asserting refunds Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
forge coverage disables the optimizer and its run of the gas tests overwrote the snapshot with inflated numbers; the optimized profile shows every measured op ~1.7k gas cheaper than main. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Subtensor's dissolution flow changed:
do_dissolve_networknow only queues the netuid inDissolveCleanupQueueand cleanup runs asynchronously viaon_idle—NetworkRegisteredAtpersists until mid-cleanup, and the oldDissolvedNetworksstorage item no longer exists. The vault's raw-storage blackout check therefore read an empty key and always passed, and during the cleanup window the regBlock-based dispatch saw a live-looking subnet whose alpha was about to be destroyed.ISubnetat0x…0803:getNetworkRegistrationBlock,isSubnetDissolving); deleteStorageQueryReaderand the 0x0807 dependency entirely_requireNotDissolvinggate freezeswrap,unwrap,unwrapForTao,rebalance,sharePrice,previewWrap,previewUnwrapwhile the netuid sits in the cleanup queue (blackout check formerly inside_redeemDissolvedPositionnow covers both the early window — regBlock unchanged — and the late window — regBlock removed, refunds still landing)currentTokenId,createSubnetProxyand thereclaim*Mailboxrecovery rails stay deliberately ungatedMockSubnetPrecompilemirroring the real lifecycle (dissolve keeps regBlock; completion zeroes it); new per-entry-point blackout tests incl. late-blackout pinningisSubnetDissolvinguntil cleanup completes before asserting TAO refundsVerification
forge fmt --checkclean;forge buildzero solc warnings (7 pre-known test-file lint notes, 6 on main already)forge test: 258/258forge coverage: AlphaVault.sol 99.41% lines / 95.77% branches / 100% funcs — every new gate branch exercised both directionsOutstanding
e2e/localnet-e2e-subnet-dissolved.shagainst a localnet built from the new subtensorforge lintunsafe-typecast notes (annotate vs lint config vs accept)🤖 Generated with Claude Code