Skip to content

refactor: Remove smart router#2255

Open
avitenzer wants to merge 3 commits intomainfrom
refactor/remove-smart-router
Open

refactor: Remove smart router#2255
avitenzer wants to merge 3 commits intomainfrom
refactor/remove-smart-router

Conversation

@avitenzer
Copy link
Copy Markdown
Collaborator

Title: refactor: remove smart router and switch to direct RPC mode

Body:

Summary

  • Removed the entire protocol/rpcsmartrouter package and all related code (relay state machine, subscription managers, upstream pools, error mapper, etc.)
  • Removed cmd/lavap binary, standalone state tracker, direct RPC connection logic, and associated tests
  • Cleaned up consumer session manager to remove smart router dependencies and simplified session selection
  • Removed legacy provider config files, setup scripts, WRS test framework, and smart router documentation
  • Updated specs to remove protocol-specific comments and adjusted init scripts for direct RPC mode

…nd adjust for direct RPC mode

- Consolidated provider configurations into a single smartrouter config file.
- Removed outdated WebSocket handling and legacy provider-specific YAML generation.
- Transitioned to direct RPC mode, simplifying connection strategy and bypassing intermediate processes.
- Improved path handling with quoted variables to ensure correctness and robustness.
- Updated logs and final output to reflect the new configuration structure and direct RPC endpoints.

Took 1 hour 19 minutes
…nd adjust for direct RPC mode

- Consolidated provider configurations into a single smartrouter config file.
- Removed outdated WebSocket handling and legacy provider-specific YAML generation.
- Transitioned to direct RPC mode, simplifying connection strategy and bypassing intermediate processes.
- Improved path handling with quoted variables to ensure correctness and robustness.
- Updated logs and final output to reflect the new configuration structure and direct RPC endpoints.
@qodo-code-review
Copy link
Copy Markdown

ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan

Review Summary by Qodo

Refactor: Remove smart router and switch to direct RPC mode

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Removed the entire protocol/rpcsmartrouter package including relay state machine, subscription
  managers, upstream pools, and error mapper
• Removed direct RPC connection types and logic from protocol/lavasession, including
  DirectRPCSessionConnection struct and related methods
• Removed selectedProvider parameter from GetSessions() and related methods across consumer
  session manager, RPC consumer, and tests
• Removed direct RPC endpoint probing and health checking functionality
• Cleaned up consumer session manager to simplify provider selection logic
• Removed smart router-specific metrics test implementations and dual test runner patterns
• Added Prometheus collector registration helper function with graceful handling of
  already-registered collectors
• Updated 30+ test cases to use new 10-parameter GetSessions() function signature
• Fixed proposal metadata length issue in spec client CLI by using title instead of full description
• Removed smart router references from documentation across multiple files (flags, interfaces,
  timeout, relay processor, chain parser, etc.)
• Reformatted and updated descriptions in 40+ spec JSON files with consistent 4-space indentation
• Removed smart router-specific testing documentation from mock RPC and REST server README files
• Removed legacy setup scripts, WRS test framework, and standalone state tracker
Diagram
flowchart LR
  A["Smart Router<br/>Components"] -->|Removed| B["rpcsmartrouter<br/>Package"]
  C["Direct RPC<br/>Connection Logic"] -->|Removed| D["lavasession<br/>Types"]
  E["Consumer Session<br/>Manager"] -->|Simplified| F["Provider Selection<br/>Logic"]
  G["Test Code"] -->|Updated| H["10-param<br/>GetSessions"]
  I["Documentation"] -->|Cleaned| J["Smart Router<br/>References"]
  K["Spec Files"] -->|Reformatted| L["JSON Formatting<br/>& Descriptions"]
Loading

Grey Divider

File Changes

1. protocol/lavasession/consumer_session_manager_test.go Refactoring +34/-34

Remove selectedProvider parameter from GetSessions test calls

• Removed selectedProvider parameter from all GetSessions() calls throughout test cases
• Updated 30+ test function calls to use the new function signature with 10 parameters instead of 11
• Simplified test code by eliminating smart router-specific provider selection logic

protocol/lavasession/consumer_session_manager_test.go


2. protocol/lavasession/consumer_session_manager.go Refactoring +10/-161

Remove direct RPC and smart router provider selection logic

• Removed GetAllDirectRPCEndpoints() method that returned endpoints with direct RPC connections
• Removed probeDirectRPCEndpoints() method for health checking direct RPC endpoints
• Removed selectedProvider parameter from GetSessions(), getSessionWithProviderOrError(),
 getValidProviderAddresses(), and getValidConsumerSessionsWithProvider() methods
• Removed provider selection via header logic that validated and returned selected providers

protocol/lavasession/consumer_session_manager.go


3. protocol/lavasession/consumer_types.go Refactoring +13/-111

Remove direct RPC connection types and endpoint tracking

• Removed DirectRPCSessionConnection struct and its methods (GetQoSManager(), IsHealthy(),
 GetEndpointAddress())
• Removed DirectRPCConnection interface references and direct RPC connection handling
• Removed IsDirectRPC() method from Endpoint struct
• Removed per-endpoint sync tracking fields (LatestBlock, LastBlockUpdate) from Endpoint
• Simplified SessionConnection interface documentation to focus on provider-relay only

protocol/lavasession/consumer_types.go


View more (132)
4. protocol/metrics/request_group_metrics_test.go 🧪 Tests +11/-74

Remove smart router metrics test implementations

• Removed newSmartRouterForRequestGroupTest() function that created test SmartRouterMetricsManager
• Removed newSmartRouterRequestGroupRunner() function for smart router test execution
• Simplified test to only run consumer metrics tests, removing dual test runner pattern
• Removed nested test loop that ran tests for both consumer and smart router implementations

protocol/metrics/request_group_metrics_test.go


5. protocol/metrics/cross_validation_metrics_test.go 🧪 Tests +3/-35

Remove smart router cross-validation metrics tests

• Removed newSmartRouterForCVTest() function for creating test SmartRouterMetricsManager
• Removed newSmartRouterCVRunner() function for smart router cross-validation test execution
• Simplified test documentation to reference only ConsumerMetricsManager
• Removed dual test runner pattern that tested both consumer and smart router

protocol/metrics/cross_validation_metrics_test.go


6. protocol/lavasession/single_consumer_session.go 📝 Documentation +1/-20

Update connection type documentation

• Updated comment to remove reference to DirectRPCSessionConnection and rpcsmartrouter
• Clarified that Connection field uses only ProviderRelayConnection

protocol/lavasession/single_consumer_session.go


7. protocol/lavasession/end_to_end_lavasession_test.go Refactoring +3/-3

Remove selectedProvider from end-to-end session tests

• Removed selectedProvider parameter from GetSessions() calls in 3 test functions
• Updated test calls to match new 10-parameter function signature

protocol/lavasession/end_to_end_lavasession_test.go


8. protocol/common/cobra_common.go 📝 Documentation +2/-2

Remove smart router references from flag documentation

• Updated comment for SetRelayRetryLimitFlag to remove smart router reference
• Updated comment for DisableBatchRequestRetryFlag to remove smart router reference

protocol/common/cobra_common.go


9. scripts/mock_rpc_server/init_mock_server.go 📝 Documentation +7/-7

Update mock RPC server documentation

• Updated file header comment to remove "Smart Router Direct RPC testing" reference
• Simplified usage documentation to reference generic "endpoint relay testing"
• Updated control API documentation to remove smart router-specific language
• Changed references from "router" to "proxy" for generic terminology

scripts/mock_rpc_server/init_mock_server.go


10. protocol/metrics/consumer_metrics_manager_inf.go 📝 Documentation +6/-7

Update metrics interface documentation

• Updated ConsumerMetricsManagerInf interface documentation to remove SmartRouterMetricsManager
 references
• Removed mentions of DirectWSSubscriptionManager and rpcsmartrouter
• Simplified interface description to focus on consumer metrics only
• Updated section comments to remove smart router-specific context

protocol/metrics/consumer_metrics_manager_inf.go


11. protocol/rpcconsumer/rpcconsumer_server.go Refactoring +2/-2

Remove selectedProvider from RPC consumer calls

• Removed selectedProvider parameter from two GetSessions() calls
• Updated relay processing to use new 10-parameter function signature

protocol/rpcconsumer/rpcconsumer_server.go


12. protocol/metrics/consumer_metrics_manager.go ✨ Enhancement +15/-0

Add Prometheus collector registration helper

• Added registerOrReuse() generic helper function to handle Prometheus collector registration
• Added errors import for error handling in collector registration
• Implements graceful handling of already-registered collectors

protocol/metrics/consumer_metrics_manager.go


13. protocol/chainlib/grpcproxy/grpcproxy.go 📝 Documentation +1/-1

Update gRPC proxy documentation

• Updated comment for NewGRPCProxyWithReflection() to remove smart router reference
• Changed reference from "smart router" to generic "gRPC proxy"

protocol/chainlib/grpcproxy/grpcproxy.go


14. x/spec/client/cli/tx.go 🐞 Bug fix +4/-1

Fix proposal metadata length issue

• Changed proposal metadata to use title instead of full description
• Added comment explaining metadata length constraint
• Reordered parameters in NewMsgSubmitProposal() call to use title as metadata

x/spec/client/cli/tx.go


15. protocol/chainlib/ws_subscription_manager.go 📝 Documentation +1/-6

Update WebSocket subscription manager documentation

• Updated WSSubscriptionManager interface documentation to remove DirectWSSubscriptionManager
 reference
• Removed mention of smart router and direct RPC subscription models
• Simplified documentation to focus on provider-based subscriptions only

protocol/chainlib/ws_subscription_manager.go


16. protocol/common/timeout.go 📝 Documentation +1/-1

Update timeout documentation

• Updated DefaultTimeout documentation to remove smart router reference
• Changed comment to reference only consumer commands

protocol/common/timeout.go


17. protocol/relaycore/relay_processor.go 📝 Documentation +1/-1

Update relay processor documentation

• Updated comment in HasUnsupportedMethodErrors() to remove smart router reference
• Changed reference from "consumer/smartrouter" to just "consumer"

protocol/relaycore/relay_processor.go


18. protocol/chainlib/chainlib.go 📝 Documentation +1/-1

Update chain message parsing documentation

• Updated ParseAndValidateMessage() documentation to remove smart router reference
• Changed comment to use generic language about flows without policy enforcement

protocol/chainlib/chainlib.go


19. protocol/relaycore/latest_block_estimator.go 📝 Documentation +1/-1

Update latest block estimator documentation

• Updated LatestBlockEstimator documentation to remove smart router reference
• Simplified comment to reference only "Consumers" instead of "Consumers (classic and smart router)"

protocol/relaycore/latest_block_estimator.go


20. protocol/chainlib/base_chain_parser.go 📝 Documentation +1/-1

Update chain parser validation documentation

• Updated ValidateMessage() documentation to remove smart router reference
• Changed comment to use generic language about flows without policy enforcement

protocol/chainlib/base_chain_parser.go


21. utils/score/score_config.go 📝 Documentation +1/-1

Update score configuration documentation

• Updated DefaultProbeUpdateWeight documentation to remove rpcsmartrouter reference
• Changed reference from "rpcconsumer/rpcsmartrouter" to just "rpcconsumer"

utils/score/score_config.go


22. protocol/chainlib/grpcproxy/grpc_reflection_proxy.go 📝 Documentation +1/-1

Update gRPC reflection proxy documentation

• Updated ReflectionProxyService documentation to remove smart router reference
• Changed comment from "smart router in Direct RPC mode" to generic "gRPC proxy when forwarding"

protocol/chainlib/grpcproxy/grpc_reflection_proxy.go


23. specs/mainnet-1/specs/stargaze.json Formatting +783/-783

Reformat stargaze spec JSON and update description

• Reformatted entire JSON file with consistent 4-space indentation
• Updated proposal description from verbose text to concise "Add stargaze mainnet spec"
• Maintained all spec data and configuration unchanged

specs/mainnet-1/specs/stargaze.json


24. specs/mainnet-1/specs/blast.json Formatting +92/-88

Reformat blast spec JSON and update description

• Reformatted entire JSON file with consistent 4-space indentation
• Updated proposal description to concise "Add blast mainnet spec"
• Maintained all spec data and configuration unchanged

specs/mainnet-1/specs/blast.json


25. specs/mainnet-1/specs/cosmossdkv50.json Formatting +1462/-1462

JSON formatting and description update for Cosmos SDK v50

• Reformatted entire JSON file with consistent 4-space indentation
• Updated proposal description from "Add cosmos sdk v50 spec" to "Add cosmos sdk version fifty spec"
• No functional changes to the specification data, only formatting improvements

specs/mainnet-1/specs/cosmossdkv50.json


26. specs/mainnet-1/specs/avalanche_p.json Formatting +536/-536

JSON formatting and description update for Avalanche P

• Reformatted entire JSON file with consistent 4-space indentation
• Updated proposal description from "Adding new specification support for relaying Avalanche P Chain
 data on Lava" to "Add avalanche p chain mainnet spec"
• No functional changes to the specification data, only formatting improvements

specs/mainnet-1/specs/avalanche_p.json


27. scripts/mock_rest_server/README.md 📝 Documentation +3/-52

Remove smart router references from mock server documentation

• Updated title from "Mock REST Server for Testing Smart Router" to "Mock REST Server"
• Changed description reference from "smart router" to "consumers" for validation endpoints
• Removed entire "Testing with Smart Router" section with configuration examples and testing
 procedures
• Simplified example scenarios by removing smart router-specific testing context

scripts/mock_rest_server/README.md


28. specs/testnet-2/specs/bera.json Formatting +3/-3

Update Berachain spec description and formatting

• Updated proposal description from "Adding new specification support for relaying Berachain data on
 Lava" to "Add berachain artio mainnet spec"
• Added proper formatting with newline and consistent indentation between spec objects

specs/testnet-2/specs/bera.json


29. specs/mainnet-1/specs/cosmoshub.json Formatting +1337/-1337

JSON formatting and description update for cosmoshub spec

• Reformatted entire JSON file with consistent 4-space indentation for improved readability
• Updated proposal description from verbose text to concise "Add cosmos hub mainnet spec"
• Maintained all API collections, specifications, and configuration data without functional changes
• Applied consistent formatting to nested objects and arrays throughout the file

specs/mainnet-1/specs/cosmoshub.json


30. specs/mainnet-1/specs/cosmoswasm.json Formatting +486/-486

JSON formatting and description update for cosmoswasm spec

• Reformatted entire JSON file with consistent 4-space indentation
• Updated proposal description from "Adding default Cosmos Wasm specification" to "Add cosmos wasm
 spec"
• Applied consistent formatting to all nested API collections and specifications
• No functional changes to API definitions or configuration

specs/mainnet-1/specs/cosmoswasm.json


31. scripts/mock_rpc_server/README.md 📝 Documentation +12/-73

Remove smart router references from mock RPC server docs

• Updated title from "Mock RPC Server for Smart Router Testing" to "Mock RPC Server"
• Removed smart router-specific testing instructions and configuration examples
• Simplified documentation to focus on general relay behavior and retry logic testing
• Removed detailed smart router setup steps, block consistency testing, and provider configuration
 examples
• Kept core control API and per-request headers documentation

scripts/mock_rpc_server/README.md


32. specs/testnet-2/specs/kakarot.json Formatting +65/-64

JSON formatting and description update for kakarot spec

• Reformatted entire JSON file with consistent 4-space indentation
• Updated proposal description from "Adding new specification support for relaying data on Kakarot"
 to "Add kakarot sepolia testnet spec"
• Applied consistent formatting to all nested objects and arrays
• No functional changes to specifications or API collections

specs/testnet-2/specs/kakarot.json


33. specs/testnet-2/specs/celestia.json Formatting +26/-29

JSON formatting and description update for celestia spec

• Updated proposal description from "Adding new specification support for relaying Celestia data on
 Lava" to "Add celestia mainnet spec"
• Fixed indentation inconsistencies in minimum-gas-price verification values (4-space alignment)
• Removed extra blank lines between sections for cleaner formatting
• Maintained all API collections and specifications without functional changes

specs/testnet-2/specs/celestia.json


34. specs/mainnet-1/specs/ton.json Formatting +11/-5

JSON formatting and description update for ton spec

• Updated proposal description from "Adding new specification support for relaying Ton data on Lava"
 to "Add ton mainnet spec"
• Fixed indentation in parser_arg arrays for /v3/estimateFee, /v3/message, and
 /v3/runGetMethod endpoints
• Applied consistent 4-space indentation formatting throughout the file
• No functional changes to API definitions or specifications

specs/mainnet-1/specs/ton.json


35. .github/workflows/lava.yml Additional files +0/-2

...

.github/workflows/lava.yml


36. BRANCH_CHANGES_SLIDE.md Additional files +0/-163

...

BRANCH_CHANGES_SLIDE.md


37. PROVIDER_SELECTION_HEADER.md Additional files +0/-142

...

PROVIDER_SELECTION_HEADER.md


38. RPCSMARTROUTER_TESTING_CHECKLIST.md Additional files +0/-98

...

RPCSMARTROUTER_TESTING_CHECKLIST.md


39. cmd/lavap/main.go Additional files +0/-6

...

cmd/lavap/main.go


40. config/consumer_examples/lava_consumer_static_peers.yml Additional files +0/-62

...

config/consumer_examples/lava_consumer_static_peers.yml


41. config/consumer_examples/lava_consumer_static_with_backup.yml Additional files +0/-82

...

config/consumer_examples/lava_consumer_static_with_backup.yml


42. config/consumer_examples/lava_consumer_static_with_backup_base.yml Additional files +0/-53

...

config/consumer_examples/lava_consumer_static_with_backup_base.yml


43. config/consumer_examples/lava_consumer_static_with_backup_bch.yml Additional files +0/-49

...

config/consumer_examples/lava_consumer_static_with_backup_bch.yml


44. config/consumer_examples/lava_consumer_static_with_backup_eth.yml Additional files +0/-53

...

config/consumer_examples/lava_consumer_static_with_backup_eth.yml


45. docs/metrics/rpcendpoint_metrics.md Additional files +0/-108

...

docs/metrics/rpcendpoint_metrics.md


46. docs/metrics/smartrouter_metrics.md Additional files +0/-188

...

docs/metrics/smartrouter_metrics.md


47. protocol/common/conf.go Additional files +0/-4

...

protocol/common/conf.go


48. protocol/common/endpoints.go Additional files +0/-102

...

protocol/common/endpoints.go


49. protocol/lavasession/direct_rpc_connection.go Additional files +0/-865

...

protocol/lavasession/direct_rpc_connection.go


50. protocol/lavasession/direct_rpc_connection_test.go Additional files +0/-326

...

protocol/lavasession/direct_rpc_connection_test.go


51. protocol/lavasession/direct_rpc_session_selection_test.go Additional files +0/-184

...

protocol/lavasession/direct_rpc_session_selection_test.go


52. protocol/lavasession/session_connection_test.go Additional files +0/-315

...

protocol/lavasession/session_connection_test.go


53. protocol/metrics/cache_metrics_test.go Additional files +0/-70

...

protocol/metrics/cache_metrics_test.go


54. protocol/metrics/health_breakdown_metrics_test.go Additional files +0/-103

...

protocol/metrics/health_breakdown_metrics_test.go


55. protocol/metrics/incident_consistency_metrics_test.go Additional files +0/-58

...

protocol/metrics/incident_consistency_metrics_test.go


56. protocol/metrics/incident_error_metrics_test.go Additional files +0/-65

...

protocol/metrics/incident_error_metrics_test.go


57. protocol/metrics/incident_hedge_metrics_test.go Additional files +0/-79

...

protocol/metrics/incident_hedge_metrics_test.go


58. protocol/metrics/incident_retry_metrics_test.go Additional files +0/-79

...

protocol/metrics/incident_retry_metrics_test.go


59. protocol/metrics/latency_metrics_test.go Additional files +0/-17

...

protocol/metrics/latency_metrics_test.go


60. protocol/metrics/optimizer_selection_score_test.go Additional files +0/-122

...

protocol/metrics/optimizer_selection_score_test.go


61. protocol/metrics/smartrouter_metrics_manager.go Additional files +0/-1158

...

protocol/metrics/smartrouter_metrics_manager.go


62. protocol/rpcconsumer/README.md Additional files +0/-15

...

protocol/rpcconsumer/README.md


63. protocol/rpcconsumer/rpcconsumer.go Additional files +0/-1

...

protocol/rpcconsumer/rpcconsumer.go


64. protocol/rpcsmartrouter/README.md Additional files +0/-405

...

protocol/rpcsmartrouter/README.md


65. protocol/rpcsmartrouter/direct_grpc_subscription_manager.go Additional files +0/-956

...

protocol/rpcsmartrouter/direct_grpc_subscription_manager.go


66. protocol/rpcsmartrouter/direct_grpc_subscription_manager_test.go Additional files +0/-405

...

protocol/rpcsmartrouter/direct_grpc_subscription_manager_test.go


67. protocol/rpcsmartrouter/direct_rpc_integration_test.go Additional files +0/-517

...

protocol/rpcsmartrouter/direct_rpc_integration_test.go


68. protocol/rpcsmartrouter/direct_rpc_relay.go Additional files +0/-724

...

protocol/rpcsmartrouter/direct_rpc_relay.go


69. protocol/rpcsmartrouter/direct_ws_subscription_manager.go Additional files +0/-1613

...

protocol/rpcsmartrouter/direct_ws_subscription_manager.go


70. protocol/rpcsmartrouter/direct_ws_subscription_manager_test.go Additional files +0/-1589

...

protocol/rpcsmartrouter/direct_ws_subscription_manager_test.go


71. protocol/rpcsmartrouter/endpoint_chain_fetcher.go Additional files +0/-275

...

protocol/rpcsmartrouter/endpoint_chain_fetcher.go


72. protocol/rpcsmartrouter/endpoint_chain_tracker_manager.go Additional files +0/-360

...

protocol/rpcsmartrouter/endpoint_chain_tracker_manager.go


73. protocol/rpcsmartrouter/endpoint_chain_tracker_test.go Additional files +0/-341

...

protocol/rpcsmartrouter/endpoint_chain_tracker_test.go


74. protocol/rpcsmartrouter/error_mapper.go Additional files +0/-85

...

protocol/rpcsmartrouter/error_mapper.go


75. protocol/rpcsmartrouter/error_mapper_test.go Additional files +0/-199

...

protocol/rpcsmartrouter/error_mapper_test.go


76. protocol/rpcsmartrouter/grpc_streaming_config.go Additional files +0/-144

...

protocol/rpcsmartrouter/grpc_streaming_config.go


77. protocol/rpcsmartrouter/grpc_streaming_config_test.go Additional files +0/-220

...

protocol/rpcsmartrouter/grpc_streaming_config_test.go


78. protocol/rpcsmartrouter/noop_ws_subscription_manager.go Additional files +0/-82

...

protocol/rpcsmartrouter/noop_ws_subscription_manager.go


79. protocol/rpcsmartrouter/noop_ws_subscription_manager_test.go Additional files +0/-132

...

protocol/rpcsmartrouter/noop_ws_subscription_manager_test.go


80. protocol/rpcsmartrouter/relayer_client_mock.go Additional files +0/-412

...

protocol/rpcsmartrouter/relayer_client_mock.go


81. protocol/rpcsmartrouter/rest_integration_test.go Additional files +0/-354

...

protocol/rpcsmartrouter/rest_integration_test.go


82. protocol/rpcsmartrouter/rpcsmartrouter.go Additional files +0/-1600

...

protocol/rpcsmartrouter/rpcsmartrouter.go


83. protocol/rpcsmartrouter/rpcsmartrouter_server.go Additional files +0/-2390

...

protocol/rpcsmartrouter/rpcsmartrouter_server.go


84. protocol/rpcsmartrouter/rpcsmartrouter_server_test.go Additional files +0/-1979

...

protocol/rpcsmartrouter/rpcsmartrouter_server_test.go


85. protocol/rpcsmartrouter/rpcsmartrouter_test.go Additional files +0/-78

...

protocol/rpcsmartrouter/rpcsmartrouter_test.go


86. protocol/rpcsmartrouter/smartrouter_relay_state_machine.go Additional files +0/-457

...

protocol/rpcsmartrouter/smartrouter_relay_state_machine.go


87. protocol/rpcsmartrouter/smartrouter_relay_state_machine_test.go Additional files +0/-1098

...

protocol/rpcsmartrouter/smartrouter_relay_state_machine_test.go


88. protocol/rpcsmartrouter/subscription_id_mapper.go Additional files +0/-189

...

protocol/rpcsmartrouter/subscription_id_mapper.go


89. protocol/rpcsmartrouter/subscription_id_mapper_test.go Additional files +0/-270

...

protocol/rpcsmartrouter/subscription_id_mapper_test.go


90. protocol/rpcsmartrouter/testing.go Additional files +0/-177

...

protocol/rpcsmartrouter/testing.go


91. protocol/rpcsmartrouter/upstream_grpc_pool.go Additional files +0/-532

...

protocol/rpcsmartrouter/upstream_grpc_pool.go


92. protocol/rpcsmartrouter/upstream_grpc_pool_test.go Additional files +0/-408

...

protocol/rpcsmartrouter/upstream_grpc_pool_test.go


93. protocol/rpcsmartrouter/upstream_ws_pool.go Additional files +0/-543

...

protocol/rpcsmartrouter/upstream_ws_pool.go


94. protocol/rpcsmartrouter/websocket_backoff.go Additional files +0/-126

...

protocol/rpcsmartrouter/websocket_backoff.go


95. protocol/rpcsmartrouter/websocket_backoff_test.go Additional files +0/-228

...

protocol/rpcsmartrouter/websocket_backoff_test.go


96. protocol/rpcsmartrouter/websocket_config.go Additional files +0/-148

...

protocol/rpcsmartrouter/websocket_config.go


97. protocol/rpcsmartrouter/websocket_config_test.go Additional files +0/-204

...

protocol/rpcsmartrouter/websocket_config_test.go


98. protocol/statetracker/standalone_state_tracker.go Additional files +0/-176

...

protocol/statetracker/standalone_state_tracker.go


99. scripts/e2e/run_optimizer_wrs_health_load.sh Additional files +0/-35

...

scripts/e2e/run_optimizer_wrs_health_load.sh


100. scripts/pre_setups/PPROF_GUIDE.md Additional files +0/-1

...

scripts/pre_setups/PPROF_GUIDE.md


101. scripts/pre_setups/init_lava_smartrouter_eth.sh Additional files +0/-407

...

scripts/pre_setups/init_lava_smartrouter_eth.sh


102. scripts/pre_setups/init_lava_smartrouter_lava.sh Additional files +0/-307

...

scripts/pre_setups/init_lava_smartrouter_lava.sh


103. scripts/pre_setups/init_lava_static_and_backup_provider.sh Additional files +0/-68

...

scripts/pre_setups/init_lava_static_and_backup_provider.sh


104. scripts/pre_setups/init_lava_static_and_backup_provider_base.sh Additional files +0/-184

...

scripts/pre_setups/init_lava_static_and_backup_provider_base.sh


105. scripts/pre_setups/init_lava_static_and_backup_provider_bch.sh Additional files +0/-232

...

scripts/pre_setups/init_lava_static_and_backup_provider_bch.sh


106. scripts/pre_setups/init_lava_static_and_backup_provider_eth.sh Additional files +0/-285

...

scripts/pre_setups/init_lava_static_and_backup_provider_eth.sh


107. scripts/pre_setups/init_lava_static_test_three_provider_with_archive.sh Additional files +0/-116

...

scripts/pre_setups/init_lava_static_test_three_provider_with_archive.sh


108. scripts/pre_setups/init_lava_static_three_provider_with_archive.sh Additional files +0/-104

...

scripts/pre_setups/init_lava_static_three_provider_with_archive.sh


109. scripts/pre_setups/init_test3_simple.sh Additional files +0/-115

...

scripts/pre_setups/init_test3_simple.sh


110. scripts/pre_setups/init_test3_sync_impact.sh Additional files +0/-204

...

scripts/pre_setups/init_test3_sync_impact.sh


111. smartrouter_eth.yml Additional files +0/-49

...

smartrouter_eth.yml


112. smartrouter_lava.yml Additional files +0/-30

...

smartrouter_lava.yml


113. specs/mainnet-1/specs/aptos.json Additional files +2/-2

...

specs/mainnet-1/specs/aptos.json


114. specs/mainnet-1/specs/arbitrum.json Additional files +2/-2

...

specs/mainnet-1/specs/arbitrum.json


115. specs/mainnet-1/specs/avalanche.json Additional files +2/-2

...

specs/mainnet-1/specs/avalanche.json


116. specs/mainnet-1/specs/avalanche_c.json Additional files +301/-301

...

specs/mainnet-1/specs/avalanche_c.json


117. specs/mainnet-1/specs/axelar.json Additional files +2/-2

...

specs/mainnet-1/specs/axelar.json


118. specs/mainnet-1/specs/base.json Additional files +2/-2

...

specs/mainnet-1/specs/base.json


119. specs/mainnet-1/specs/bch.json Additional files +2/-2

...

specs/mainnet-1/specs/bch.json


120. specs/mainnet-1/specs/bsc.json Additional files +2/-2

...

specs/mainnet-1/specs/bsc.json


121. specs/mainnet-1/specs/btc.json Additional files +2/-2

...

specs/mainnet-1/specs/btc.json


122. specs/mainnet-1/specs/celo.json Additional files +2/-2

...

specs/mainnet-1/specs/celo.json


123. specs/mainnet-1/specs/cosmossdk.json Additional files +2/-2

...

specs/mainnet-1/specs/cosmossdk.json


124. specs/mainnet-1/specs/doge.json Additional files +2/-2

...

specs/mainnet-1/specs/doge.json


125. specs/mainnet-1/specs/ethereum.json Additional files +2/-2

...

specs/mainnet-1/specs/ethereum.json


126. specs/mainnet-1/specs/ethermint.json Additional files +2/-2

...

specs/mainnet-1/specs/ethermint.json


127. specs/mainnet-1/specs/evmos.json Additional files +2/-2

...

specs/mainnet-1/specs/evmos.json


128. specs/mainnet-1/specs/fantom.json Additional files +2/-2

...

specs/mainnet-1/specs/fantom.json


129. specs/mainnet-1/specs/filecoin.json Additional files +20/-18

...

specs/mainnet-1/specs/filecoin.json


130. specs/mainnet-1/specs/fuse.json Additional files +4/-4

...

specs/mainnet-1/specs/fuse.json


131. specs/mainnet-1/specs/hedera.json Additional files +2/-2

...

specs/mainnet-1/specs/hedera.json


132. specs/mainnet-1/specs/hyperliquid.json Additional files +2/-2

...

specs/mainnet-1/specs/hyperliquid.json


133. specs/mainnet-1/specs/ibc.json Additional files +2/-2

...

specs/mainnet-1/specs/ibc.json


134. specs/mainnet-1/specs/lava-mainnet.json Additional files +2/-2

...

specs/mainnet-1/specs/lava-mainnet.json


135. Additional files not shown Additional files +0/-0

...

Additional files not shown


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Mar 29, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Extra spaces before comment 📘 Rule violation ⚙ Maintainability
Description
consumer_session_manager_test.go contains excessive spaces before an inline comment on a modified
line, which is not gofmt-clean. This can cause formatting churn and indicates the file was not
properly formatted after edits.
Code

protocol/lavasession/consumer_session_manager_test.go[485]

+	csm.validAddresses = []string{}                                                                                                     // set valid addresses to zero
Evidence
PR Compliance ID 2 requires all Go files to be gofmt/goimports clean. The modified line uses large
runs of spaces for alignment before //, which gofmt would normalize (typically via tabs/standard
spacing).

AGENTS.md
protocol/lavasession/consumer_session_manager_test.go[485-485]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A modified Go test line uses excessive spaces before an inline comment, which is not `gofmt`-clean.

## Issue Context
This line was changed in the PR and should be normalized to standard Go formatting.

## Fix Focus Areas
- protocol/lavasession/consumer_session_manager_test.go[485-485]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Oversized proposal summary 🐞 Bug ✓ Correctness
Description
x/spec/client/cli/tx.go now passes proposal.Proposal.Description as the MsgSubmitProposal summary,
but ParseSpecAddProposalJSON concatenates Description across multiple input files, making this field
grow without bound and potentially causing spec-add proposal submissions to fail validation or
become too large.
Code

x/spec/client/cli/tx.go[R125-128]

+			// Use the title as metadata instead of the full description, which can
+			// exceed MaxMetadataLen when many spec files are combined.
+			metadata := proposal.Proposal.Title
+			submitPropMsg, err := govv1.NewMsgSubmitProposal([]sdk.Msg{msgExecLegacy}, deposit, from.String(), metadata, proposal.Proposal.Title, proposal.Proposal.Description, isExpedited)
Evidence
ParseSpecAddProposalJSON explicitly concatenates proposal.Proposal.Description across multiple
proposal files, so the resulting Description can become very large. tx.go then forwards that
Description into govv1.NewMsgSubmitProposal as the summary argument (the same argument position that
other CLI commands use for their human-entered description/summary), making the on-chain proposal
message size and any length validations depend on an unbounded concatenation.

x/spec/client/utils/utils.go[25-56]
x/spec/client/cli/tx.go[118-133]
x/rewards/client/cli/tx.go[140-153]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`spec-add` proposal submission uses `proposal.Proposal.Description` as the `summary` argument to `govv1.NewMsgSubmitProposal`. When multiple proposal files are passed, `ParseSpecAddProposalJSON` concatenates all descriptions, so the `summary` becomes unbounded and can cause proposal submission failures or overly large transactions.

### Issue Context
- Multi-file parsing concatenates descriptions.
- `NewMsgSubmitProposal(..., metadata, title, summary, ...)` expects `summary` to be a short human-readable summary.

### Fix Focus Areas
- x/spec/client/cli/tx.go[123-133]
- x/spec/client/utils/utils.go[25-56]

### Suggested fix
- Keep `metadata := proposal.Proposal.Title` (or `""`) if needed.
- Change the `summary` argument to a bounded string (e.g., a constant like `"Add spec(s)"`, or a truncated version of the description to a safe max length), and keep the full long-form text inside the actual `SpecAddProposal` content where it belongs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: test-protocol

Failed stage: Run Lava Protocol Tests-timeout 15m [❌]

Failed test name: ""

Failure summary:

The action failed during go test because the protocol/lavasession test package did not compile.
-
Compile error in protocol/lavasession/consumer_session_manager_test.go:1595:134: call to
csm.GetSessions has too many arguments and does not match the current function signature.
- The test
passes 11 arguments (context.Context, number, uint64, *UsedProviders, int64, string, nil, number,
number, string, string) but GetSessions now expects 10 arguments (context.Context, int, uint64,
UsedProvidersInf, int64, string, []*spec_types.Extension, uint32, uint64, string).
- Because
compilation failed, go test exited with code 1, causing the GitHub Action step to fail.

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

195:  shell: /usr/bin/bash -e {0}
196:  ##[endgroup]
197:  go: downloading github.com/jstemmer/go-junit-report v1.0.0
198:  go: downloading github.com/jstemmer/go-junit-report/v2 v2.1.0
199:  ##[group]Run set -o pipefail
200:  �[36;1mset -o pipefail�[0m
201:  �[36;1mgo test -json -timeout 15m -coverprofile=protocol-coverage.out ./protocol/... \�[0m
202:  �[36;1m  | tee protocol-test.json \�[0m
203:  �[36;1m  | grep -v '"Action":"output"' \�[0m
204:  �[36;1m  | go-junit-report -parser gojson -set-exit-code -out protocol-report.xml�[0m
205:  �[36;1mjq -r 'select(.Action=="output") | .Output' protocol-test.json > protocol-test.log || true�[0m
206:  shell: /usr/bin/bash -e {0}
207:  ##[endgroup]
208:  go: downloading google.golang.org/grpc v1.62.1
209:  go: downloading github.com/goccy/go-json v0.10.5
210:  go: downloading cosmossdk.io/errors v1.0.1
211:  go: downloading github.com/cometbft/cometbft v0.37.5
...

242:  go: downloading github.com/prometheus/client_golang v1.16.0
243:  go: downloading github.com/segmentio/kafka-go v0.4.47
244:  go: downloading github.com/itchyny/gojq v0.12.16
245:  go: downloading github.com/grafana/pyroscope-go v1.2.7
246:  go: downloading golang.org/x/sync v0.13.0
247:  go: downloading cosmossdk.io/math v1.3.0
248:  go: downloading github.com/tidwall/gjson v1.16.0
249:  go: downloading go.uber.org/mock v0.3.0
250:  go: downloading gonum.org/v1/gonum v0.13.0
251:  go: downloading github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0
252:  go: downloading github.com/dgraph-io/badger/v4 v4.1.0
253:  go: downloading github.com/rs/zerolog v1.32.0
254:  go: downloading gopkg.in/natefinch/lumberjack.v2 v2.2.1
255:  go: downloading cosmossdk.io/collections v0.4.0
256:  go: downloading gopkg.in/yaml.v2 v2.4.0
257:  go: downloading github.com/pkg/errors v0.9.1
258:  go: downloading github.com/gogo/googleapis v1.4.1
...

318:  go: downloading golang.org/x/text v0.24.0
319:  go: downloading go.opencensus.io v0.24.0
320:  go: downloading github.com/rivo/uniseg v0.4.7
321:  go: downloading github.com/andybalholm/brotli v1.1.0
322:  go: downloading github.com/valyala/tcplisten v1.0.0
323:  go: downloading github.com/subosito/gotenv v1.6.0
324:  go: downloading github.com/hashicorp/hcl v1.0.0
325:  go: downloading gopkg.in/ini.v1 v1.67.0
326:  go: downloading github.com/magiconair/properties v1.8.7
327:  go: downloading github.com/pelletier/go-toml/v2 v2.1.0
328:  go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.4
329:  go: downloading github.com/xdg-go/pbkdf2 v1.0.0
330:  go: downloading github.com/xdg-go/stringprep v1.0.4
331:  go: downloading github.com/99designs/keyring v1.2.1
332:  go: downloading github.com/cosmos/iavl v0.20.1
333:  go: downloading github.com/cockroachdb/errors v1.11.3
334:  go: downloading github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
...

403:  go: downloading cloud.google.com/go/compute v1.23.3
404:  go: downloading cloud.google.com/go/iam v1.1.5
405:  go: downloading github.com/googleapis/gax-go/v2 v2.12.0
406:  go: downloading go.opentelemetry.io/otel v1.21.0
407:  go: downloading go.opentelemetry.io/otel/trace v1.21.0
408:  go: downloading go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1
409:  go: downloading github.com/jmespath/go-jmespath v0.4.0
410:  go: downloading github.com/go-logr/logr v1.4.1
411:  go: downloading go.opentelemetry.io/otel/metric v1.21.0
412:  go: downloading go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1
413:  go: downloading golang.org/x/time v0.5.0
414:  go: downloading github.com/google/s2a-go v0.1.7
415:  go: downloading github.com/googleapis/enterprise-certificate-proxy v0.3.2
416:  go: downloading github.com/go-logr/stdr v1.2.2
417:  # github.com/lavanet/lava/v5/protocol/lavasession [github.com/lavanet/lava/v5/protocol/lavasession.test]
418:  ##[error]protocol/lavasession/consumer_session_manager_test.go:1595:134: too many arguments in call to csm.GetSessions
419:  have ("context".Context, number, uint64, *UsedProviders, int64, string, nil, number, number, string, string)
420:  want ("context".Context, int, uint64, UsedProvidersInf, int64, string, []*"github.com/lavanet/lava/v5/x/spec/types".Extension, uint32, uint64, string)
421:  ##[error]Process completed with exit code 1.
422:  ##[group]Run actions/upload-artifact@v4

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
consensus 8.71% <ø> (+<0.01%) ⬆️
protocol ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
protocol/common/cobra_common.go 0.00% <ø> (ø)
protocol/common/conf.go 0.00% <ø> (ø)
protocol/common/endpoints.go 0.00% <ø> (ø)
protocol/common/timeout.go 0.00% <ø> (ø)
utils/score/score_config.go 56.66% <ø> (ø)
x/spec/client/cli/tx.go 0.00% <ø> (ø)

... and 186 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

require.NoError(t, err)
csm.validAddresses = []string{} // set valid addresses to zero
css, err := csm.GetSessions(ctx, 1, cuForFirstRequest, NewUsedProviders(nil), servicedBlockNumber, "", nil, common.NO_STATE, 0, "", "") // get a session
csm.validAddresses = []string{} // set valid addresses to zero
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Extra spaces before comment 📘 Rule violation ⚙ Maintainability

consumer_session_manager_test.go contains excessive spaces before an inline comment on a modified
line, which is not gofmt-clean. This can cause formatting churn and indicates the file was not
properly formatted after edits.
Agent Prompt
## Issue description
A modified Go test line uses excessive spaces before an inline comment, which is not `gofmt`-clean.

## Issue Context
This line was changed in the PR and should be normalized to standard Go formatting.

## Fix Focus Areas
- protocol/lavasession/consumer_session_manager_test.go[485-485]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread x/spec/client/cli/tx.go
Comment on lines +125 to +128
// Use the title as metadata instead of the full description, which can
// exceed MaxMetadataLen when many spec files are combined.
metadata := proposal.Proposal.Title
submitPropMsg, err := govv1.NewMsgSubmitProposal([]sdk.Msg{msgExecLegacy}, deposit, from.String(), metadata, proposal.Proposal.Title, proposal.Proposal.Description, isExpedited)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Oversized proposal summary 🐞 Bug ✓ Correctness

x/spec/client/cli/tx.go now passes proposal.Proposal.Description as the MsgSubmitProposal summary,
but ParseSpecAddProposalJSON concatenates Description across multiple input files, making this field
grow without bound and potentially causing spec-add proposal submissions to fail validation or
become too large.
Agent Prompt
### Issue description
`spec-add` proposal submission uses `proposal.Proposal.Description` as the `summary` argument to `govv1.NewMsgSubmitProposal`. When multiple proposal files are passed, `ParseSpecAddProposalJSON` concatenates all descriptions, so the `summary` becomes unbounded and can cause proposal submission failures or overly large transactions.

### Issue Context
- Multi-file parsing concatenates descriptions.
- `NewMsgSubmitProposal(..., metadata, title, summary, ...)` expects `summary` to be a short human-readable summary.

### Fix Focus Areas
- x/spec/client/cli/tx.go[123-133]
- x/spec/client/utils/utils.go[25-56]

### Suggested fix
- Keep `metadata := proposal.Proposal.Title` (or `""`) if needed.
- Change the `summary` argument to a bounded string (e.g., a constant like `"Add spec(s)"`, or a truncated version of the description to a safe max length), and keep the full long-form text inside the actual `SpecAddProposal` content where it belongs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@github-actions
Copy link
Copy Markdown

Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
6 files    - 1   0 ❌ ±0 

Results for commit 1f17d45. ± Comparison against base commit bd37dbf.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant