-
Notifications
You must be signed in to change notification settings - Fork 5
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
Audit fixes - Part 1 #421
Merged
Merged
Audit fixes - Part 1 #421
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7610f80
P2 - delete unused RMNRemote reader
dimkouv 28e3f17
H3 - rmn query logic, issue on one chain affects all chains
dimkouv 1f783da
H3 - disabled chain issue, affects all chains processing
dimkouv 5ff50c5
H3 - onRamp rpc call issue, affects all chains processing
dimkouv bf54d10
fix typo
dimkouv 7c93b2c
switch log level
dimkouv b5e312f
merge main
dimkouv a9a1bb6
gofmt
dimkouv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -380,17 +380,12 @@ func (o observerImpl) ObserveOffRampNextSeqNums(ctx context.Context) []plugintyp | |
return nil | ||
} | ||
|
||
if len(offRampNextSeqNums) != len(sourceChains) { | ||
o.lggr.Errorf("call to NextSeqNum returned unexpected number of seq nums, got %d, expected %d", | ||
len(offRampNextSeqNums), len(sourceChains)) | ||
return nil | ||
} | ||
|
||
result := make([]plugintypes.SeqNumChain, len(sourceChains)) | ||
for i := range sourceChains { | ||
result[i] = plugintypes.SeqNumChain{ChainSel: sourceChains[i], SeqNum: offRampNextSeqNums[i]} | ||
result := make([]plugintypes.SeqNumChain, 0, len(sourceChains)) | ||
for chainSelector, seqNum := range offRampNextSeqNums { | ||
result = append(result, plugintypes.NewSeqNumChain(chainSelector, seqNum)) | ||
} | ||
|
||
sort.Slice(result, func(i, j int) bool { return result[i].ChainSel < result[j].ChainSel }) | ||
return result | ||
} | ||
|
||
|
@@ -413,23 +408,30 @@ func (o observerImpl) ObserveLatestOnRampSeqNums( | |
sourceChains := mapset.NewSet(allSourceChains...).Intersect(supportedChains).ToSlice() | ||
sort.Slice(sourceChains, func(i, j int) bool { return sourceChains[i] < sourceChains[j] }) | ||
|
||
latestOnRampSeqNums := make([]plugintypes.SeqNumChain, len(sourceChains)) | ||
mu := &sync.Mutex{} | ||
latestOnRampSeqNums := make([]plugintypes.SeqNumChain, 0, len(sourceChains)) | ||
eg := &errgroup.Group{} | ||
|
||
for i, sourceChain := range sourceChains { | ||
for _, sourceChain := range sourceChains { | ||
eg.Go(func() error { | ||
nextOnRampSeqNum, err := o.ccipReader.GetExpectedNextSequenceNumber(ctx, sourceChain, destChain) | ||
if err != nil { | ||
return fmt.Errorf("failed to get expected next sequence number for source chain %d: %w", sourceChain, err) | ||
o.lggr.Errorf("failed to get expected next seq num for source chain %d: %s", sourceChain, err) | ||
return nil | ||
} | ||
|
||
if nextOnRampSeqNum == 0 { | ||
return fmt.Errorf("expected next sequence number for source chain %d is 0", sourceChain) | ||
o.lggr.Errorf("unexpected next seq num for source chain %d, it is 0", sourceChain) | ||
return nil | ||
} | ||
|
||
latestOnRampSeqNums[i] = plugintypes.SeqNumChain{ | ||
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. If onRamp seq num was not found for some chain we simply log the error for that chain and we keep the results for the other chains. |
||
ChainSel: sourceChain, | ||
SeqNum: nextOnRampSeqNum - 1, // Latest is the next one minus one. | ||
} | ||
mu.Lock() | ||
latestOnRampSeqNums = append( | ||
latestOnRampSeqNums, | ||
plugintypes.NewSeqNumChain(sourceChain, nextOnRampSeqNum-1), // Latest is the next one minus one. | ||
) | ||
mu.Unlock() | ||
|
||
return nil | ||
}) | ||
} | ||
|
@@ -439,6 +441,9 @@ func (o observerImpl) ObserveLatestOnRampSeqNums( | |
return nil | ||
} | ||
|
||
sort.Slice(latestOnRampSeqNums, func(i, j int) bool { | ||
return latestOnRampSeqNums[i].ChainSel < latestOnRampSeqNums[j].ChainSel | ||
}) | ||
return latestOnRampSeqNums | ||
} | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
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.
We remove the validation and only return the seqNums from chains that we were able to get.