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
a5f85691
Unverified
Commit
a5f85691
authored
Sep 08, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(ctb): Add semver
ctb: Address feedback
parent
7b40bd20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
16 deletions
+7
-16
DelayedVetoable.sol
packages/contracts-bedrock/src/L1/DelayedVetoable.sol
+6
-7
DelayedVetoable.t.sol
packages/contracts-bedrock/test/DelayedVetoable.t.sol
+1
-9
No files found.
packages/contracts-bedrock/src/L1/DelayedVetoable.sol
View file @
a5f85691
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
pragma solidity
^
0.8.15;
pragma solidity 0.8.15;
contract DelayedVetoable {
import { Semver } from "../universal/Semver.sol";
contract DelayedVetoable is Semver {
/// @notice Error for when attempting to forward too early.
/// @notice Error for when attempting to forward too early.
error ForwardingEarly();
error ForwardingEarly();
...
@@ -56,12 +58,13 @@ contract DelayedVetoable {
...
@@ -56,12 +58,13 @@ contract DelayedVetoable {
}
}
}
}
/// @custom:semver 0.0.1
/// @notice Sets the target admin during contract deployment.
/// @notice Sets the target admin during contract deployment.
/// @param vetoer_ Address of the vetoer.
/// @param vetoer_ Address of the vetoer.
/// @param initiator_ Address of the initiator.
/// @param initiator_ Address of the initiator.
/// @param target_ Address of the target.
/// @param target_ Address of the target.
/// @param delay_ Address of the delay.
/// @param delay_ Address of the delay.
constructor(address vetoer_, address initiator_, address target_, uint256 delay_) {
constructor(address vetoer_, address initiator_, address target_, uint256 delay_)
Semver(0, 0, 1)
{
_vetoer = vetoer_;
_vetoer = vetoer_;
_initiator = initiator_;
_initiator = initiator_;
_target = target_;
_target = target_;
...
@@ -120,10 +123,6 @@ contract DelayedVetoable {
...
@@ -120,10 +123,6 @@ contract DelayedVetoable {
/// This enables transparent initiation and forwarding of calls to the target and avoids
/// This enables transparent initiation and forwarding of calls to the target and avoids
/// the need for additional layers of abi encoding.
/// the need for additional layers of abi encoding.
function _handleCall() internal {
function _handleCall() internal {
if (_target == address(0)) {
revert TargetUnitialized();
}
bytes32 callHash = keccak256(msg.data);
bytes32 callHash = keccak256(msg.data);
if (_queuedAt[callHash] == 0) {
if (_queuedAt[callHash] == 0) {
if (msg.sender != _initiator) {
if (msg.sender != _initiator) {
...
...
packages/contracts-bedrock/test/DelayedVetoable.t.sol
View file @
a5f85691
...
@@ -7,7 +7,6 @@ import { DelayedVetoable } from "../src/L1/DelayedVetoable.sol";
...
@@ -7,7 +7,6 @@ import { DelayedVetoable } from "../src/L1/DelayedVetoable.sol";
contract DelayedVetoable_Init is CommonTest {
contract DelayedVetoable_Init is CommonTest {
error Unauthorized(address expected, address actual);
error Unauthorized(address expected, address actual);
error ForwardingEarly();
error ForwardingEarly();
error TargetUnitialized();
event Initiated(bytes32 indexed callHash, bytes data);
event Initiated(bytes32 indexed callHash, bytes data);
event Forwarded(bytes32 indexed callHash, bytes data);
event Forwarded(bytes32 indexed callHash, bytes data);
...
@@ -83,14 +82,7 @@ contract DelayedVetoable_HandleCall_Test is DelayedVetoable_Init {
...
@@ -83,14 +82,7 @@ contract DelayedVetoable_HandleCall_Test is DelayedVetoable_Init {
}
}
contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
function test_handleCall_unAuthorizedInitiation_reverts() external {
function test_handleCall_unauthorizedInitiation_reverts() external {
vm.store(address(delayedVetoable), bytes32(0), bytes32(0));
vm.expectRevert(abi.encodeWithSelector(TargetUnitialized.selector));
(bool success,) = address(delayedVetoable).call(hex"");
assert(success);
}
function test_handleCall_targetIsZero_reverts() external {
vm.expectRevert(abi.encodeWithSelector(Unauthorized.selector, initiator, address(this)));
vm.expectRevert(abi.encodeWithSelector(Unauthorized.selector, initiator, address(this)));
(bool success,) = address(delayedVetoable).call(hex"");
(bool success,) = address(delayedVetoable).call(hex"");
assert(success);
assert(success);
...
...
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