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
1d099302
Unverified
Commit
1d099302
authored
Sep 14, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ctb): Address compiler warnings
fix(ctb): Fix names on fuzz tests
parent
af490bbf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
25 deletions
+23
-25
DelayedVetoable.sol
packages/contracts-bedrock/src/L1/DelayedVetoable.sol
+18
-18
DelayedVetoable.t.sol
packages/contracts-bedrock/test/DelayedVetoable.t.sol
+5
-7
No files found.
packages/contracts-bedrock/src/L1/DelayedVetoable.sol
View file @
1d099302
...
@@ -84,34 +84,34 @@ contract DelayedVetoable is ISemver {
...
@@ -84,34 +84,34 @@ contract DelayedVetoable is ISemver {
}
}
/// @notice Gets the initiator
/// @notice Gets the initiator
/// @return Initiator address.
/// @return
initiator_
Initiator address.
function initiator() external virtual readOrHandle returns (address) {
function initiator() external virtual readOrHandle returns (address
initiator_
) {
return
_initiator;
initiator_ =
_initiator;
}
}
//// @notice Queries the vetoer address.
//// @notice Queries the vetoer address.
/// @return Vetoer address.
/// @return
vetoer_
Vetoer address.
function vetoer() external virtual readOrHandle returns (address) {
function vetoer() external virtual readOrHandle returns (address
vetoer_
) {
return
_vetoer;
vetoer_ =
_vetoer;
}
}
//// @notice Queries the target address.
//// @notice Queries the target address.
/// @return Target address.
/// @return
target_
Target address.
function target() external readOrHandle returns (address) {
function target() external readOrHandle returns (address
target_
) {
return
_target;
target_ =
_target;
}
}
/// @notice Gets the delay
/// @notice Gets the delay
/// @return Delay address.
/// @return
delay_
Delay address.
function delay() external readOrHandle returns (uint256) {
function delay() external readOrHandle returns (uint256
delay_
) {
return
_delay;
delay_ =
_delay;
}
}
/// @notice Gets entries in the _queuedAt mapping.
/// @notice Gets entries in the _queuedAt mapping.
/// @param callHash The hash of the call data.
/// @param callHash The hash of the call data.
/// @return The time the callHash was recorded.
/// @return
queuedAt_
The time the callHash was recorded.
function queuedAt(bytes32 callHash) external readOrHandle returns (uint256) {
function queuedAt(bytes32 callHash) external readOrHandle returns (uint256
queuedAt_
) {
return
_queuedAt[callHash];
queuedAt_ =
_queuedAt[callHash];
}
}
/// @notice Used for all calls that pass data to the contract.
/// @notice Used for all calls that pass data to the contract.
...
@@ -139,7 +139,7 @@ contract DelayedVetoable is ISemver {
...
@@ -139,7 +139,7 @@ contract DelayedVetoable is ISemver {
if (msg.sender == _initiator && _queuedAt[callHash] == 0) {
if (msg.sender == _initiator && _queuedAt[callHash] == 0) {
if (_delay == 0) {
if (_delay == 0) {
// This forward function will halt the call frame on completion.
// This forward function will halt the call frame on completion.
_forwardAndHalt(callHash
, msg.data
);
_forwardAndHalt(callHash);
}
}
_queuedAt[callHash] = block.timestamp;
_queuedAt[callHash] = block.timestamp;
emit Initiated(callHash, msg.data);
emit Initiated(callHash, msg.data);
...
@@ -169,11 +169,11 @@ contract DelayedVetoable is ISemver {
...
@@ -169,11 +169,11 @@ contract DelayedVetoable is ISemver {
// Delete the call to prevent replays
// Delete the call to prevent replays
delete _queuedAt[callHash];
delete _queuedAt[callHash];
_forwardAndHalt(callHash
, msg.data
);
_forwardAndHalt(callHash);
}
}
/// @notice Forwards the call to the target and halts the call frame.
/// @notice Forwards the call to the target and halts the call frame.
function _forwardAndHalt(bytes32 callHash
, bytes memory data
) internal {
function _forwardAndHalt(bytes32 callHash) internal {
// Forward the call
// Forward the call
emit Forwarded(callHash, msg.data);
emit Forwarded(callHash, msg.data);
(bool success,) = _target.call(msg.data);
(bool success,) = _target.call(msg.data);
...
...
packages/contracts-bedrock/test/DelayedVetoable.t.sol
View file @
1d099302
...
@@ -55,10 +55,8 @@ contract DelayedVetoable_Getters_Test is DelayedVetoable_Init {
...
@@ -55,10 +55,8 @@ contract DelayedVetoable_Getters_Test is DelayedVetoable_Init {
}
}
contract DelayedVetoable_Getters_TestFail is DelayedVetoable_Init {
contract DelayedVetoable_Getters_TestFail is DelayedVetoable_Init {
function test_getters_notVetoer() external {
/// @dev Check that getter calls from unauthorized entities will revert.
// getter calls from addresses other than the zero address will revert in the
function test_getters_notZeroAddress_reverts() external {
// initiation branch of the proxy.
vm.assume(msg.sender != address(0) && msg.sender != initiator && msg.sender != vetoer);
vm.expectRevert(abi.encodeWithSelector(Unauthorized.selector, initiator, address(this)));
vm.expectRevert(abi.encodeWithSelector(Unauthorized.selector, initiator, address(this)));
delayedVetoable.initiator();
delayedVetoable.initiator();
vm.expectRevert(abi.encodeWithSelector(Unauthorized.selector, initiator, address(this)));
vm.expectRevert(abi.encodeWithSelector(Unauthorized.selector, initiator, address(this)));
...
@@ -126,7 +124,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
...
@@ -126,7 +124,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
}
}
/// @dev The call cannot be forewarded until the delay has passed.
/// @dev The call cannot be forewarded until the delay has passed.
function test_handleCall_forwardingTooSoon_reverts(bytes memory data) external {
function test
Fuzz
_handleCall_forwardingTooSoon_reverts(bytes memory data) external {
vm.prank(initiator);
vm.prank(initiator);
(bool success,) = address(delayedVetoable).call(data);
(bool success,) = address(delayedVetoable).call(data);
...
@@ -136,7 +134,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
...
@@ -136,7 +134,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
}
}
/// @dev The call cannot be forwarded a second time.
/// @dev The call cannot be forwarded a second time.
function test_handleCall_forwardingTwice_reverts(bytes memory data) external {
function test
Fuzz
_handleCall_forwardingTwice_reverts(bytes memory data) external {
assumeNonzeroData(data);
assumeNonzeroData(data);
// Initiate the call
// Initiate the call
...
@@ -159,7 +157,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
...
@@ -159,7 +157,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
}
}
/// @dev If the target reverts, it is bubbled up.
/// @dev If the target reverts, it is bubbled up.
function test_handleCall_forwardingTargetReverts_reverts(bytes memory data) external {
function test
Fuzz
_handleCall_forwardingTargetReverts_reverts(bytes memory data) external {
assumeNonzeroData(data);
assumeNonzeroData(data);
vm.etch(target, address(reverter).code);
vm.etch(target, address(reverter).code);
...
...
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