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 {
}
/// @notice Gets the initiator
/// @return Initiator address.
function initiator() external virtual readOrHandle returns (address) {
return
_initiator;
/// @return
initiator_
Initiator address.
function initiator() external virtual readOrHandle returns (address
initiator_
) {
initiator_ =
_initiator;
}
//// @notice Queries the vetoer address.
/// @return Vetoer address.
function vetoer() external virtual readOrHandle returns (address) {
return
_vetoer;
/// @return
vetoer_
Vetoer address.
function vetoer() external virtual readOrHandle returns (address
vetoer_
) {
vetoer_ =
_vetoer;
}
//// @notice Queries the target address.
/// @return Target address.
function target() external readOrHandle returns (address) {
return
_target;
/// @return
target_
Target address.
function target() external readOrHandle returns (address
target_
) {
target_ =
_target;
}
/// @notice Gets the delay
/// @return Delay address.
function delay() external readOrHandle returns (uint256) {
return
_delay;
/// @return
delay_
Delay address.
function delay() external readOrHandle returns (uint256
delay_
) {
delay_ =
_delay;
}
/// @notice Gets entries in the _queuedAt mapping.
/// @param callHash The hash of the call data.
/// @return The time the callHash was recorded.
function queuedAt(bytes32 callHash) external readOrHandle returns (uint256) {
return
_queuedAt[callHash];
/// @return
queuedAt_
The time the callHash was recorded.
function queuedAt(bytes32 callHash) external readOrHandle returns (uint256
queuedAt_
) {
queuedAt_ =
_queuedAt[callHash];
}
/// @notice Used for all calls that pass data to the contract.
...
...
@@ -139,7 +139,7 @@ contract DelayedVetoable is ISemver {
if (msg.sender == _initiator && _queuedAt[callHash] == 0) {
if (_delay == 0) {
// This forward function will halt the call frame on completion.
_forwardAndHalt(callHash
, msg.data
);
_forwardAndHalt(callHash);
}
_queuedAt[callHash] = block.timestamp;
emit Initiated(callHash, msg.data);
...
...
@@ -169,11 +169,11 @@ contract DelayedVetoable is ISemver {
// Delete the call to prevent replays
delete _queuedAt[callHash];
_forwardAndHalt(callHash
, msg.data
);
_forwardAndHalt(callHash);
}
/// @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
emit Forwarded(callHash, 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 {
}
contract DelayedVetoable_Getters_TestFail is DelayedVetoable_Init {
function test_getters_notVetoer() external {
// getter calls from addresses other than the zero address will revert in the
// initiation branch of the proxy.
vm.assume(msg.sender != address(0) && msg.sender != initiator && msg.sender != vetoer);
/// @dev Check that getter calls from unauthorized entities will revert.
function test_getters_notZeroAddress_reverts() external {
vm.expectRevert(abi.encodeWithSelector(Unauthorized.selector, initiator, address(this)));
delayedVetoable.initiator();
vm.expectRevert(abi.encodeWithSelector(Unauthorized.selector, initiator, address(this)));
...
...
@@ -126,7 +124,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
}
/// @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);
(bool success,) = address(delayedVetoable).call(data);
...
...
@@ -136,7 +134,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
}
/// @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);
// Initiate the call
...
...
@@ -159,7 +157,7 @@ contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
}
/// @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);
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