-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
check msg.data length #13352
check msg.data length #13352
Conversation
Quality Gate passedIssues Measures |
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.
one nitpick, not a blocker :)
@@ -103,5 +103,6 @@ compileContract automation/dev/v2_3/AutomationRegistrar2_3.sol | |||
compileContract automation/dev/v2_3/AutomationRegistry2_3.sol | |||
compileContract automation/dev/v2_3/AutomationRegistryLogicA2_3.sol | |||
compileContract automation/dev/v2_3/AutomationRegistryLogicB2_3.sol | |||
compileContract automation/dev/v2_3/AutomationRegistryLogicC2_3.sol |
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.
👍 crazy we've made it this far without having to add this lol
bytes32(0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef), | ||
bytes32(0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890), | ||
bytes32(0x7890abcdef1234567890abcdef1234567890abcdef1234567890abcdef123456) |
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.
total nitpick, but it might be a little cleaner if we just use the _random()
function to generate these bytes ex...
bytes32[3] memory exampleReportContext = [_random(), _random(), _random()];
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 call! I will take a note for this. will leave it as is for now since dont want tobother to get approvals again.
(bool success, bytes memory returnData) = address(registry).call(badTransmitData); // send the bogus transmit | ||
assertFalse(success, "Call did not revert as expected"); | ||
assertEq(returnData, abi.encodePacked(Registry.InvalidDataLength.selector)); |
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 didn't realize we wouldn't be able to use the expectRevert
prank, but this seems like a very reasonable alternative! Nicely done 😎
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.
indeed, i also prefer the shorter expectRevert, but expectRevert doesnt work for low level calls, which we are doing here.
// use this msg.data length check to ensure no extra data is included in the call | ||
// 4 is first 4 bytes of the keccak-256 hash of the function signature. ss.length == rs.length so use one of them | ||
// 4 + (32 * 3) + (rawReport.length + 32 + 32) + (32 * rs.length + 32 + 32) + (32 * ss.length + 32 + 32) + 32 | ||
uint256 requiredLength = 324 + rawReport.length + 64 * rs.length; |
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.
amazing 🎉 I'm so glad there was a minimally complex solution to this problem
No description provided.