Skip to content

refactor: centralize ink! issues-mapping selector as ISSUES_MAPPING_ROOT_KEY - #952

Closed
ebios-star wants to merge 1 commit into
entrius:testfrom
ebios-star:refactor/centralize-issues-mapping-storage-key
Closed

refactor: centralize ink! issues-mapping selector as ISSUES_MAPPING_ROOT_KEY#952
ebios-star wants to merge 1 commit into
entrius:testfrom
ebios-star:refactor/centralize-issues-mapping-storage-key

Conversation

@ebios-star

Copy link
Copy Markdown
Contributor

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:

Both files already import from gittensor/validator/issue_competitions/storage_utils, so this PR hoists the literal into a single named constant ISSUES_MAPPING_ROOT_KEY in storage_utils.py and 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.py keeps 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

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other

Testing

  • pytest tests/ — all 726 tests pass.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

…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.
@xiao-xiao-mao xiao-xiao-mao Bot added the refactor Code restructuring without behavior change label May 3, 2026
@ebios-star

Copy link
Copy Markdown
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!

@anderdc anderdc mentioned this pull request May 5, 2026
8 tasks
@anderdc

anderdc commented May 5, 2026

Copy link
Copy Markdown
Collaborator

Closing — please consolidate into #917.

@anderdc anderdc closed this May 5, 2026
@ebios-star

Copy link
Copy Markdown
Contributor Author

Consolidated into #955 per @anderdc's request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants