Skip to content

Conversation

@j-rafique
Copy link
Contributor

@j-rafique j-rafique commented Dec 8, 2025

PR Description

Summary

  • Add ListActionsByCreator query (gRPC/REST/autocli) to fetch actions by creator with tests and generated proto artifacts.
  • Fix pagination and supernode lookup edge cases across action queries; improve autocli wiring

@roomote
Copy link

roomote bot commented Dec 8, 2025

Rooviewer Clock   See task on Roo Cloud

I've reviewed the latest changes (commit 53c0880), which added a test case for invalid creator addresses. The critical performance issues flagged in previous reviews (full table scans in ListActionsByBlockHeight, ListActionsBySuperNode, GetSuperNodeByAccount, and ListExpiredActions) remain unaddressed. These queries are currently O(N) and pose a stability risk.

  • Optimize ListExpiredActions to use state index instead of full scan
  • Add index maintenance for ListActionsByBlockHeight in SetAction
  • Add index maintenance for ListActionsBySuperNode in SetAction
  • Add index maintenance for GetSuperNodeByAccount in SetSuperNode
  • Avoid redundant memory allocation in ListActionsByCreator
  • Implement index-based lookup for ListActionsByBlockHeight
  • Implement index-based lookup for GetSuperNodeByAccount
  • Implement index-based lookup for ListActionsBySuperNode
  • Fix DoS vector in ListActionsByBlockHeight (remove fallback scan)
  • Fix DoS vector in ListActionsBySuperNode (remove fallback scan)
  • Fix DoS vector in GetSuperNodeByAccount (remove fallback scan)
  • Add migration for ListActionsByBlockHeight index backfill
  • Add migration for ListActionsBySuperNode index backfill
  • Add migration for GetSuperNodeByAccount index backfill
  • Avoid redundant memory allocation in ListExpiredActions
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@j-rafique j-rafique force-pushed the feature/action-list-by-creator branch from e716e62 to 040fe02 Compare December 8, 2025 14:16
@j-rafique j-rafique requested a review from a-ok123 December 8, 2025 14:48
@j-rafique j-rafique force-pushed the feature/action-list-by-creator branch from afba78d to 9d68129 Compare December 8, 2025 15:37
mateeullahmalik
mateeullahmalik previously approved these changes Dec 8, 2025
@j-rafique j-rafique force-pushed the feature/action-list-by-creator branch from 8dc78a1 to 144fd0f Compare December 8, 2025 19:14
@a-ok123 a-ok123 requested a review from Copilot December 9, 2025 21:03
a-ok123
a-ok123 previously approved these changes Dec 9, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new ListActionsByCreator query endpoint to fetch actions by creator address, along with improvements to pagination logic and supernode lookup across several existing query implementations.

Key Changes

  • Added new ListActionsByCreator gRPC/REST query with pagination support and corresponding test coverage
  • Refactored pagination logic in action queries to use FilteredPaginate consistently and properly handle filtering
  • Added GetSuperNodeByAccount method to improve supernode lookups by account address
  • Enhanced autocli configuration with comprehensive query command descriptors
  • Added Total field to query responses for better pagination information

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
proto/lumera/action/v1/query.proto Added ListActionsByCreator RPC definition with request/response messages
x/action/v1/types/query.pb.go Generated protobuf code for new query types and updated descriptor indices
x/action/v1/types/query.pb.gw.go Generated gRPC-gateway handlers for new REST endpoint
x/action/v1/types/action.pb.go Reformatted imports (cosmetic change)
x/action/v1/keeper/query_list_actions_by_creator.go Implemented new query handler using creator index for efficient lookups
x/action/v1/keeper/query_list_actions_by_creator_test.go Added comprehensive test coverage for the new query including edge cases
x/action/v1/keeper/query_list_actions.go Refactored to use state index when filtering by state for better performance
x/action/v1/keeper/query_list_actions_by_sn.go Improved pagination logic and added Total field to response
x/action/v1/keeper/query_list_actions_by_block_height.go Improved pagination logic and added Total field to response
x/action/v1/keeper/query_list_expired_actions.go Improved pagination logic and added Total field to response
x/action/v1/keeper/action.go Minor refactoring of index management code (inline error checks)
x/action/v1/module/autocli.go Added comprehensive autocli command descriptors for all query endpoints
x/supernode/v1/types/expected_keepers.go Added GetSuperNodeByAccount to interface definition and reordered imports
x/supernode/v1/mocks/expected_keepers_mock.go Generated mock implementation for new interface method
x/supernode/v1/keeper/supernode.go Implemented GetSuperNodeByAccount, improved pagination filtering, added default case handling in SetSuperNodeActive
x/supernode/v1/keeper/query_get_super_node_by_super_node_address.go Refactored to use new GetSuperNodeByAccount method instead of full scan
x/supernode/v1/keeper/msg_server_stop_supernode.go Fixed indentation (cosmetic change)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@roomote
Copy link

roomote bot commented Dec 15, 2025

Rooviewer Clock   Follow along on Roo Cloud

I've reviewed the latest changes (commit 53c0880). While the test coverage has improved, the critical performance issues (full table scans) in several queries remain unaddressed. The fallback logic was removed, but without implementing the necessary secondary indexes and migrations, these queries are inefficient and pose a DoS risk.

  • Optimize ListExpiredActions to use state index instead of full scan
  • Add index maintenance for ListActionsByBlockHeight in SetAction and migration
  • Add index maintenance for ListActionsBySuperNode in SetAction and migration
  • Add index maintenance for GetSuperNodeByAccount in SetSuperNode and migration
  • Avoid redundant memory allocation in ListActionsByCreator
  • Implement index-based lookup for ListActionsByBlockHeight
  • Implement index-based lookup for GetSuperNodeByAccount
  • Implement index-based lookup for ListActionsBySuperNode
  • Fix DoS vector in ListActionsByBlockHeight (remove fallback scan)
  • Fix DoS vector in ListActionsBySuperNode (remove fallback scan)
  • Fix DoS vector in GetSuperNodeByAccount (remove fallback scan)
  • Add migration for ListActionsByBlockHeight index backfill
  • Add migration for ListActionsBySuperNode index backfill
  • Add migration for GetSuperNodeByAccount index backfill
  • Avoid redundant memory allocation in ListExpiredActions
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@a-ok123 a-ok123 self-requested a review December 15, 2025 17:01
@j-rafique j-rafique merged commit c0ed437 into master Dec 16, 2025
8 checks passed
@mateeullahmalik mateeullahmalik deleted the feature/action-list-by-creator branch December 16, 2025 14:00
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.

4 participants