Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

CCIP-1704 Checking for curse on Source Chain#580

Merged
mateusz-sekara merged 9 commits intoccip-developfrom
checking-source-curse
Mar 6, 2024
Merged

CCIP-1704 Checking for curse on Source Chain#580
mateusz-sekara merged 9 commits intoccip-developfrom
checking-source-curse

Conversation

@mateusz-sekara
Copy link
Contributor

@mateusz-sekara mateusz-sekara commented Mar 5, 2024

Motivation

CCIP doesn't verify if the source is cursed during OCR2 phases. We want to add these check to make the system more robust.

Solution

Additional check to verify if the source chain is cursed when checking if CommitStore is down.
The first call to a specific OnRampReader requires an additional RPC call to get staticConfig from the chain. StaticConfig is cached forever. Next calls only get ArmProxy address from the cached config and ask ARM on the source chain whether it's cursed or not.

This additional check is applied to both Commit and Exec, during Observation phase

@mateusz-sekara mateusz-sekara changed the title Exposing IsSourceCursed method in OnRamp reader Checking for curse on Source Chain Mar 5, 2024
@mateusz-sekara mateusz-sekara force-pushed the checking-source-curse branch from 008bcfe to 027450c Compare March 5, 2024 10:20
@mateusz-sekara mateusz-sekara force-pushed the checking-source-curse branch from 276490c to cefb174 Compare March 5, 2024 11:04
}
if down {
return nil, ccip.ErrCommitStoreIsDown
if err := ccipcommon.VerifyNotDown(ctx, r.lggr, r.commitStoreReader, r.onRampReader); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified. One check, instead of two (bool + error)

@mateusz-sekara mateusz-sekara marked this pull request as ready for review March 5, 2024 11:22
@mateusz-sekara mateusz-sekara requested a review from a team as a code owner March 5, 2024 11:22
@mateusz-sekara mateusz-sekara requested a review from gtklocker March 5, 2024 11:22
@mateusz-sekara mateusz-sekara force-pushed the checking-source-curse branch 3 times, most recently from c96c31e to 6da16f4 Compare March 5, 2024 11:29
@mateusz-sekara mateusz-sekara force-pushed the checking-source-curse branch from 6da16f4 to ef56ac6 Compare March 5, 2024 11:31
@mateusz-sekara mateusz-sekara changed the title Checking for curse on Source Chain CCIP-1704 Checking for curse on Source Chain Mar 5, 2024
@mateusz-sekara mateusz-sekara requested a review from makramkd March 5, 2024 12:27

if isDown || isCursed {
lggr.Errorf("Source chain is cursed or CommitStore is down", "isDown", isDown, "isCursed", isCursed)
return ccip.ErrChainPausedOrCursed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care to be more specific here in this error or is the above log enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, good question, maybe having distinction between source and dest curse could be useful. Do you think that separate errors per source/dest would be enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the other hand, to be very clear it would require three different errors

  • CommitStoreDown
  • SourceCursed
  • Both
    Maybe let's keep it simple and rely on an error log for now

@mateusz-sekara mateusz-sekara merged commit 6d5796b into ccip-develop Mar 6, 2024
@mateusz-sekara mateusz-sekara deleted the checking-source-curse branch March 6, 2024 12:39
asoliman92 pushed a commit that referenced this pull request Jul 31, 2024
## Motivation

CCIP doesn't verify if the source is cursed during OCR2 phases. We want
to add these check to make the system more robust.

## Solution

Additional check to verify if the source chain is cursed when checking
if CommitStore is down.
The first call to a specific OnRampReader requires an additional RPC
call to get staticConfig from the chain. StaticConfig is cached forever.
Next calls only get `ArmProxy` address from the cached config and ask
ARM on the source chain whether it's cursed or not.

This additional check is applied to both Commit and Exec, during
Observation phase
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants