-
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
Move curse logic to a shared location and add new helper. #323
base: main
Are you sure you want to change the base?
Conversation
pkg/reader/curses.go
Outdated
func FilterCursed( | ||
ctx context.Context, | ||
ccipReader CCIPReader, | ||
destChain ccipocr3.ChainSelector, | ||
inputChains []ccipocr3.ChainSelector, | ||
) ([]ccipocr3.ChainSelector, *CurseInfo, 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.
Common code across all the places using GetRmnCurseInfo
, I'll use this in the execute plugin as well.
@@ -29,22 +32,22 @@ type ChainSupport interface { | |||
KnownSourceChainsSlice() ([]cciptypes.ChainSelector, error) | |||
} | |||
|
|||
type CCIPChainSupport struct { | |||
type ccipChainSupport 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.
Reduce visibility.
lggr logger.Logger, | ||
homeChain reader.HomeChain, | ||
oracleIDToP2PID map[commontypes.OracleID]libocrtypes.PeerID, | ||
nodeID commontypes.OracleID, | ||
destChain cciptypes.ChainSelector, | ||
) CCIPChainSupport { | ||
return CCIPChainSupport{ | ||
) ChainSupport { |
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.
Return interface.
type CurseInfo struct { | ||
// CursedSourceChains contains the cursed source chains. | ||
CursedSourceChains map[cciptypes.ChainSelector]bool | ||
// CursedDestination indicates that the destination chain is cursed. | ||
CursedDestination bool | ||
// GlobalCurse indicates that all chains are cursed. | ||
GlobalCurse bool | ||
} | ||
|
||
// LegacyCurseSubject Defined as a const in RMNRemote.sol | ||
// Docs of RMNRemote: | ||
// An active curse on this subject will cause isCursed() to return true. Use this subject if there is an issue | ||
// with a remote chain, for which there exists a legacy lane contract deployed on the same chain as this RMN contract | ||
// is deployed, relying on isCursed(). | ||
var LegacyCurseSubject = [16]byte{ | ||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
} | ||
|
||
// GlobalCurseSubject Defined as a const in RMNRemote.sol | ||
// Docs of RMNRemote: | ||
// An active curse on this subject will cause isCursed() and isCursed(bytes16) to return true. Use this subject | ||
// for issues affecting all of CCIP chains, or pertaining to the chain that this contract is deployed on, instead of | ||
// using the local chain selector as a subject. | ||
var GlobalCurseSubject = [16]byte{ | ||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, | ||
} |
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.
Moved to pkg/reader
010d73b
to
19586ef
Compare
e47e3b5
to
acd94ca
Compare
83409e5
to
90d4476
Compare
90d4476
to
22ed136
Compare
|
Minor refactoring based on my PR feedback to your PR and to make the code easier to share across exec and commit plugins.