fix: remove unused storage maps NextStakeJobId, UsedWork, LargestLocked#2464
Open
Nicknamess96 wants to merge 1 commit intoopentensor:mainfrom
Open
fix: remove unused storage maps NextStakeJobId, UsedWork, LargestLocked#2464Nicknamess96 wants to merge 1 commit intoopentensor:mainfrom
Nicknamess96 wants to merge 1 commit intoopentensor:mainfrom
Conversation
…Locked These three storage maps are either completely unused or write-only, contributing to silent chain state bloat with no functional benefit: - NextStakeJobId: declared but never read or written; its companion StakeJobs map does not exist. - UsedWork: written to during PoW registration but never read, so the intended work-replay protection was never enforced. - LargestLocked: written during genesis and removed during network dissolution, but never read in production code. Closes opentensor#2397
cda8dac to
0375938
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
Removes three storage maps that are either completely unused or write-only, reducing chain state bloat:
NextStakeJobId— declared but never read or written anywhere; its companionStakeJobsmap does not existUsedWork— written during PoW registration (do_burned_registration,do_registration) but never read, so the intended work-replay protection was never enforcedLargestLocked— written during genesis and removed during network dissolution, but never read in production codeAudit methodology
Full
ripgrepsearch across the repository for each identifier (type name, snake_case variants) confirmed:.get(),.try_get(),.contains_key(),::iter()) in production codeLargestLockedhas test-only reads intests/networks.rs(removed alongside the map)Files changed
pallets/subtensor/src/lib.rspallets/subtensor/src/subnets/registration.rsUsedWork::insertcallspallets/subtensor/src/macros/genesis.rsLargestLocked::insertin genesispallets/subtensor/src/coinbase/root.rsLargestLocked::removein dissolutionpallets/subtensor/src/tests/networks.rsLargestLockedCloses #2397
Test plan
cargo clippyclean