-
Notifications
You must be signed in to change notification settings - Fork 59
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
feat: prevent on revert spoofing backport #362
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## node/v20.0.2 #362 +/- ##
================================================
+ Coverage 97.37% 97.42% +0.05%
================================================
Files 7 7
Lines 305 311 +6
Branches 98 100 +2
================================================
+ Hits 297 303 +6
Misses 8 8 ☔ View full report in Codecov by Sentry. |
@@ -8,7 +8,7 @@ on: | |||
- "v2/**" | |||
pull_request: | |||
branches: | |||
- "*" | |||
- "**" |
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.
workflows were not triggering, maybe because of branch naming, but with **
seems to work, will include this on main branch as well
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
@@ -182,6 +182,14 @@ contract GatewayEVMTest is Test, IGatewayEVMErrors, IGatewayEVMEvents, IReceiver | |||
gateway.execute(address(receiver), data); | |||
} | |||
|
|||
function testForwardCallToReceiveOnRevertFails() public { | |||
bytes memory data = abi.encodeWithSignature("onRevert((address,uint64,bytes))"); |
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.
How is this data build when we don't provide value for address,uint64,bytes
? Is it using the 0 value?
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 its using default values for the type
if (functionSelector == Revertable.onRevert.selector) { | ||
revert NotAllowedToCallOnRevert(); | ||
} |
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: is it possible to update this to Solidity 0.8.27? In that version require can now exit with a custom error, rendering this expression to:
if (functionSelector == Revertable.onRevert.selector) { | |
revert NotAllowedToCallOnRevert(); | |
} | |
require(functionSelector != Revertable.onRevert.selector, NotAllowedToCallOnRevert()) |
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 probably can, but in separate effort, this PR is for backporting a fix, please open issue for that update
No description provided.