Skip to content

refactor: storage query segregation for coretime, paras and blocks endpoints#261

Open
decrypto21 wants to merge 7 commits intomainfrom
refactor/storage-query-segregation-p2
Open

refactor: storage query segregation for coretime, paras and blocks endpoints#261
decrypto21 wants to merge 7 commits intomainfrom
refactor/storage-query-segregation-p2

Conversation

@decrypto21
Copy link
Contributor

This PR refactors storage query logic across coretime, blocks, and paras handlers to reduce code duplication by extracting common query functions into the dedicated runtime_queries/ module.

Changes Made

  • Extended runtime_queries/ module with 4 new specialized query submodules:
    • coretime_assignment_provider - Relay chain CoretimeAssignmentProvider pallet queries
    • parachain_info - ParachainInfo pallet queries
    • paras - Paras pallet lifecycle queries
    • session - Session pallet queries (validators, current index)
  • Extended broker module with additional functions for regions, renewals, and workload queries
  • Eliminates duplicate storage query patterns across coretime, blocks, and paras handlers
  • Provides reusable functions for Broker, Session, Paras, ParachainInfo, and CoretimeAssignmentProvider pallets

Implementation Details

  • Extracted shared storage query logic that was duplicated across 10+ handler files
  • Pattern simplification: complex inline queries → single function calls
  • All coretime, blocks, and paras handlers now use runtime_queries::* for storage access
  • Scope: This PR focuses on coretime/, blocks/, and paras/ endpoints only
  • Follows convention established in, and closes Improve codebase segregation and reusability for storage queries #207

Code Stats
Net: cleaner, more maintainable code with centralized storage queries

@decrypto21 decrypto21 changed the title Refactor: storage query segregation for coretime, paras and blocks endpoints refactor: storage query segregation for coretime, paras and blocks endpoints Mar 3, 2026
Copy link
Collaborator

@filvecchiato filvecchiato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall pretty good, some comments to doublecheck some changes

@decrypto21 decrypto21 force-pushed the refactor/storage-query-segregation-p2 branch from 1ff3f7c to 2d0bf9b Compare March 4, 2026 12:52
@decrypto21 decrypto21 requested a review from filvecchiato March 4, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve codebase segregation and reusability for storage queries

2 participants