-
Notifications
You must be signed in to change notification settings - Fork 56
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
Make onRamp mutable in OffRamp #1422
Make onRamp mutable in OffRamp #1422
Conversation
LCOV of commit
|
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.
LGTM, couple nits
@@ -26,7 +26,7 @@ single_line_statement_blocks = "preserve" | |||
solc_version = '0.8.24' | |||
src = 'src/v0.8/ccip' | |||
test = 'src/v0.8/ccip/test' | |||
optimizer_runs = 1_925 | |||
optimizer_runs = 1_650 |
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.
😅
bytes memory onRamp = sourceChainConfig.onRamp; | ||
|
||
if (keccak256(root.onRampAddress) != keccak256(onRamp)) { | ||
revert InvalidOnRamp(root.onRampAddress, onRamp); | ||
} |
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.
nit: reading onRamp
into memory seems like an optimization for the error path, yeah? I think we could save on the happy path if we just read from storage again when doing the revert.
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.
Good point, updated.
@@ -64,6 +64,8 @@ contract OffRamp is ITypeAndVersion, MultiOCR3Base { | |||
error InvalidMessageDestChainSelector(uint64 messageDestChainSelector); | |||
error SourceChainSelectorMismatch(uint64 reportSourceChainSelector, uint64 messageSourceChainSelector); | |||
error SignatureVerificationDisabled(); | |||
error InvalidOnRamp(bytes reportOnRamp, bytes configOnRamp); |
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.
nit: naming - should we name this InvalidCommitOnRamp
?
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.
I think here the most likely scenario is that the wrong onRamp would be the configured one, not the one from the commit report.
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.
Main confusion with the current naming is that this is easily confused with InvalidOnRampUpdate
- would help if this error included that it is in the commit
context (maybe CommitRampMismatch
would be more accurate)
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.
Updated to CommitOnRampMismatch
Quality Gate passedIssues Measures |
Motivation
The goal of this PR is to reduce the misconfig risk on the
OffRamp
with theonRamp
address. Currently, if we accidentally configure the wrongonRamp
address on an existingOffRamp
, the fix would involve a full redeployment + reconfig.Solution
onRamp
mutable in theOffRamp
.onRamp
address verification in thecommit()
functiononRamp
address modification whenminSeqNr == 1