Skip to content
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 8 commits into from
Jan 8, 2025
Merged

Audit fixes - Part 1 #421

merged 8 commits into from
Jan 8, 2025

Conversation

dimkouv
Copy link
Contributor

@dimkouv dimkouv commented Jan 8, 2025

  • Remove unused RMNRemote reader interface, the empty implementation and the mocks.
  • Improve the logic to better handle scenarios where previously one faulty chain breaks the processing of all the chains.

core ref: bf3f4cbba69d17e4fa6502bd69d527509e97a6d5

Core PR: smartcontractkit/chainlink#15860


result := make([]plugintypes.SeqNumChain, len(sourceChains))
for i := range sourceChains {
result[i] = plugintypes.SeqNumChain{ChainSel: sourceChains[i], SeqNum: offRampNextSeqNums[i]}
Copy link
Contributor Author

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{
Copy link
Contributor Author

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.

@@ -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)
Copy link
Contributor Author

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.

Copy link

github-actions bot commented Jan 8, 2025

Metric dk/audit-fixes main
Coverage 76.6% 76.6%

@dimkouv dimkouv merged commit e46f3a7 into main Jan 8, 2025
17 checks passed
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)
Copy link
Collaborator

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)
Copy link
Collaborator

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) {
Copy link
Collaborator

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

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants