Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
76e632cd
Unverified
Commit
76e632cd
authored
Sep 18, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ctb): Update tests and add comments for queuedAt selector clash
parent
7cd55c4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
DelayedVetoable.sol
packages/contracts-bedrock/src/L1/DelayedVetoable.sol
+3
-0
DelayedVetoable.t.sol
packages/contracts-bedrock/test/DelayedVetoable.t.sol
+19
-2
No files found.
packages/contracts-bedrock/src/L1/DelayedVetoable.sol
View file @
76e632cd
...
@@ -7,6 +7,9 @@ import { ISemver } from "src/universal/ISemver.sol";
...
@@ -7,6 +7,9 @@ import { ISemver } from "src/universal/ISemver.sol";
/// @notice This contract enables a delay before a call is forwarded to a target contract, and during the delay period
/// @notice This contract enables a delay before a call is forwarded to a target contract, and during the delay period
/// the call can be vetoed by the authorized vetoer.
/// the call can be vetoed by the authorized vetoer.
/// This contract does not support value transfers, only data is forwarded.
/// This contract does not support value transfers, only data is forwarded.
/// Additionally, this contract cannot be used to forward calls with data beginning with the function selector
/// of the queuedAt(bytes32) function. This is because of input validation checks which solidity performs at
/// runtime on functions which take an argument.
contract DelayedVetoable is ISemver {
contract DelayedVetoable is ISemver {
/// @notice Error for when the delay has already been set.
/// @notice Error for when the delay has already been set.
error AlreadyDelayed();
error AlreadyDelayed();
...
...
packages/contracts-bedrock/test/DelayedVetoable.t.sol
View file @
76e632cd
...
@@ -81,12 +81,15 @@ contract DelayedVetoable_HandleCall_Test is DelayedVetoable_Init {
...
@@ -81,12 +81,15 @@ contract DelayedVetoable_HandleCall_Test is DelayedVetoable_Init {
/// @dev The delay is inititially set to zero and the call is immediately forwarded.
/// @dev The delay is inititially set to zero and the call is immediately forwarded.
function testFuzz_handleCall_initialForwardingImmediately_succeeds(
function testFuzz_handleCall_initialForwardingImmediately_succeeds(
bytes
memory
inData,
bytes
calldata
inData,
bytes
memory
outData
bytes
calldata
outData
)
)
external
external
{
{
assumeNonzeroData(inData);
assumeNonzeroData(inData);
if (inData.length >= 4) {
vm.assume(bytes4(inData[0:4]) != bytes4(keccak256("queuedAt(bytes32)")));
}
// Reset the delay to zero
// Reset the delay to zero
vm.store(address(delayedVetoable), bytes32(uint256(0)), bytes32(uint256(0)));
vm.store(address(delayedVetoable), bytes32(uint256(0)), bytes32(uint256(0)));
...
@@ -181,4 +184,18 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
...
@@ -181,4 +184,18 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
vm.expectRevert(outData);
vm.expectRevert(outData);
(bool success2,) = address(delayedVetoable).call(inData);
(bool success2,) = address(delayedVetoable).call(inData);
}
}
/// @dev A test documenting the single instance in which the contract is not 'transparent' to the initiator.
function testFuzz_handleCall_queuedAtClash_reverts(bytes memory outData) external {
// This will get us calldata with the same function selector as the queuedAt function, but
// with the incorrect input data length.
bytes memory inData = abi.encodePacked(keccak256("queuedAt(bytes32)"));
// Reset the delay to zero
vm.store(address(delayedVetoable), bytes32(uint256(0)), bytes32(uint256(0)));
vm.prank(initiator);
vm.expectRevert(outData);
(bool success,) = address(delayedVetoable).call(inData);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment