refactor: centralize ink! issues-mapping selector as ISSUES_MAPPING_ROOT_KEY - #952
Closed
ebios-star wants to merge 1 commit into
Closed
Conversation
…OOT_KEY The ink! storage selector '52789899' for the issues mapping is duplicated at the two active call sites that compute lazy keys for child storage reads: - validator/issue_competitions/contract_client.py (read_issue_from_child_storage) - cli/issue_commands/helpers.py (_read_issues_from_child_storage) Both already import from validator/issue_competitions/storage_utils, so this hoists the literal into a single named constant in storage_utils and updates both call sites to use it. If the contract storage layout ever changes, the selector now lives in one place beside the other storage-decoding helpers.
Contributor
Author
|
@anderdc whenever you have a moment, this hoists a duplicated ink! storage selector literal into a named constant alongside the related storage helpers. Happy to revise scope if you'd prefer. Thanks! |
8 tasks
Collaborator
|
Closing — please consolidate into #917. |
8 tasks
Contributor
Author
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
The ink! storage selector
'52789899'for the issues mapping is duplicated at the two active call sites that compute lazy keys for child storage reads:read_issue_from_child_storage_read_issues_from_child_storageBoth files already import from
gittensor/validator/issue_competitions/storage_utils, so this PR hoists the literal into a single named constantISSUES_MAPPING_ROOT_KEYinstorage_utils.pyand updates both call sites to use it. If the contract storage layout ever changes, the selector lives in one place alongside the other storage-decoding helpers.The existing test fixture in
tests/utils/test_issue_competitions_storage_utils.pykeeps the literal'52789899'(it asserts a specific lazy-key output for that exact selector input — fixture intent preserved).Net: +7 / -2 lines across 3 files.
Type of Change
Testing
pytest tests/— all 726 tests pass.Checklist