Refactor#14
Merged
Merged
Conversation
…it more efficient and flat
…TXs, queries and user module
…modules to prevent code redundancies
…ies, modified pairing.go in pairing module
NadavLevi
added a commit
that referenced
this pull request
Mar 16, 2026
…ssue #14) The field was written in SetProcessingTimestampAfterRelay but never read by any production code path. Remove the field, strip the write from the setter, and update the test to only assert ProcessingTimestamp behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
NadavLevi
added a commit
that referenced
this pull request
Mar 16, 2026
Addresses all issues raised in code review (issues #1–9, #11–19): Correctness: - Add apiInterface label to endpointSelectionScore gauge and propagate it through SetProviderSelected interface and all call sites (#4) - Align SetRelayNodeErrorMetric parameter order to (chainId, apiInterface, providerAddress, method) — was (providerAddress, chainId, apiInterface) (#7) - Scope metric setters outside the lock in RegisterEndpoint to avoid re-entrant RWMutex deadlock (#11) - Record cache latency histogram only on cache hits, not misses (#12) - Remove dead field MeasureAfterProviderProcessingTime from RelayMetrics and its sole write site (#14) Dead code: - Remove dead stubs SetRelaySentToProviderMetric and SetRequestPerProvider from SmartRouterMetricsManager (#5) - Delete empty consumer_metrics_manager_test.go (#18) Simplification: - Replace bespoke registerMetric closure with generic registerOrReuse helper throughout ConsumerMetricsManager (#6) - Unify latency histogram buckets via shared LatencyBuckets variable in buckets.go — removes per-file duplicates (#8) - Drop unnecessary goroutine spawns from RPCConsumerLogs metric forwarders; callers already run in goroutines where needed (#9) - Replace RequestProperties struct with *RelayMetrics in RecordDirectRelayEnd, eliminating a duplicate of the same fields (#15) Documentation: - Document the request-group counting invariants in SetRelayMetrics (#13) - Add comment explaining why UpdateHealthcheckStatusBreakdown is a no-op in SmartRouterMetricsManager (#16) - Fix struct comment to list all four labels including apiInterface (#17) Tests: - Scope gomock.Controller to each subtest in TestIsArchiveRequest, TestIsDebugOrTraceRequest, and TestIsBatchRequest (#19) - Add TestConsumerSetRelayMetrics_PartitionInvariant asserting batch+read+write==total and success+failed==total (#13) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
created common epoch based module for stake storage
combined the code for handling the pairing and staking to one module to avoid code duplications
flattened data structures and removed unnecessary types
improved code performance
improved storage utilization
improved pairing algorithm and average run time
prevents user time of use time of stake attacks