-
Notifications
You must be signed in to change notification settings - Fork 4
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
Audit fixes - Part 1 #421
Conversation
|
||
result := make([]plugintypes.SeqNumChain, len(sourceChains)) | ||
for i := range sourceChains { | ||
result[i] = plugintypes.SeqNumChain{ChainSel: sourceChains[i], SeqNum: offRampNextSeqNums[i]} |
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.
} | ||
|
||
latestOnRampSeqNums[i] = plugintypes.SeqNumChain{ |
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.
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.
commit/merkleroot/query.go
Outdated
@@ -41,7 +41,8 @@ func (p *Processor) Query(ctx context.Context, prevOutcome Outcome) (Query, erro | |||
for _, sourceChainRange := range prevOutcome.RangesSelectedForReport { | |||
onRampAddress, err := p.ccipReader.GetContractAddress(consts.ContractNameOnRamp, sourceChainRange.ChainSel) | |||
if err != nil { | |||
return Query{}, fmt.Errorf("get onRamp address for chain %v: %w", sourceChainRange.ChainSel, err) |
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.
if onRamp address cannot be found for some specific chain we simply log the error and continue with the remaining chains.
|
for _, chain := range chains { | ||
cfg, exists := cfgs[chain] | ||
if !exists { | ||
return nil, fmt.Errorf("source chain config not found for chain %d", chain) | ||
r.lggr.Warnw("source chain config not found for chain %d, chain is skipped.", chain) |
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.
This log is malformed, if you want formatted logs should use Warnf
, Warnw
is a structure log so should look like
r.lggr.Warnw("source chain config not found for chain %d, chain is skipped.", chain)
if cfg.MinSeqNr == 0 { | ||
return nil, fmt.Errorf("minSeqNr not found for chain %d", chain) | ||
r.lggr.Errorw("minSeqNr not found for chain %d or is set to 0, chain is skipped.", chain) |
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.
Ditto here, re: Errorf vs. Errorw
@@ -399,22 +399,26 @@ func (r *ccipChainReader) GetExpectedNextSequenceNumber( | |||
|
|||
func (r *ccipChainReader) NextSeqNum( | |||
ctx context.Context, chains []cciptypes.ChainSelector, | |||
) ([]cciptypes.SeqNum, error) { | |||
) (map[cciptypes.ChainSelector]cciptypes.SeqNum, error) { |
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.
Does this method have tests in chainlink? If so needs to be updated there
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.
yeap, i have a pr open, it's in the description
core ref: bf3f4cbba69d17e4fa6502bd69d527509e97a6d5
Core PR: smartcontractkit/chainlink#15860