-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RMN - minor code improvements #289
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,10 +160,7 @@ func (r *peerClient) getOrCreateRageP2PStream(rmnNode rmntypes.HomeNodeInfo) (St | |
} | ||
|
||
rmnPeerID := rmnNode.PeerID.String() | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Each rmn node has a field called |
||
// todo: versioning for stream names e.g. for 'v1_7' | ||
streamName := fmt.Sprintf("ccip-rmn/v1_6/%s", | ||
strings.TrimPrefix(r.genericEndpointConfigDigest.String(), "0x")) | ||
streamName := rmnNode.StreamNamePrefix + strings.TrimPrefix(r.genericEndpointConfigDigest.String(), "0x") | ||
|
||
r.lggr.Infow("creating new stream", | ||
"streamName", streamName, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,5 @@ | ||
package slicelib | ||
|
||
// GroupBy groups a slice based on a specific item property. The returned groups slice is deterministic. | ||
func GroupBy[T any, K comparable](items []T, prop func(T) K) ([]K, map[K][]T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused function. |
||
groups := make([]K, 0) | ||
grouped := make(map[K][]T) | ||
for _, item := range items { | ||
k := prop(item) | ||
if _, exists := grouped[k]; !exists { | ||
groups = append(groups, k) | ||
} | ||
grouped[k] = append(grouped[k], item) | ||
} | ||
return groups, grouped | ||
} | ||
|
||
// CountUnique counts the unique items of the provided slice. | ||
func CountUnique[T comparable](items []T) int { | ||
m := make(map[T]struct{}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactoring of the logic that processes lane update requests. Extracted and unit tested a standalone function.