Commit a5f85691 authored by Maurelian's avatar Maurelian

feat(ctb): Add semver

ctb: Address feedback
parent 7b40bd20
// 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.
error ForwardingEarly();
......@@ -56,12 +58,13 @@ contract DelayedVetoable {
}
}
/// @custom:semver 0.0.1
/// @notice Sets the target admin during contract deployment.
/// @param vetoer_ Address of the vetoer.
/// @param initiator_ Address of the initiator.
/// @param target_ Address of the target.
/// @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_;
_initiator = initiator_;
_target = target_;
......@@ -120,10 +123,6 @@ contract DelayedVetoable {
/// This enables transparent initiation and forwarding of calls to the target and avoids
/// the need for additional layers of abi encoding.
function _handleCall() internal {
if (_target == address(0)) {
revert TargetUnitialized();
}
bytes32 callHash = keccak256(msg.data);
if (_queuedAt[callHash] == 0) {
if (msg.sender != _initiator) {
......
......@@ -7,7 +7,6 @@ import { DelayedVetoable } from "../src/L1/DelayedVetoable.sol";
contract DelayedVetoable_Init is CommonTest {
error Unauthorized(address expected, address actual);
error ForwardingEarly();
error TargetUnitialized();
event Initiated(bytes32 indexed callHash, bytes data);
event Forwarded(bytes32 indexed callHash, bytes data);
......@@ -83,14 +82,7 @@ contract DelayedVetoable_HandleCall_Test is DelayedVetoable_Init {
}
contract DelayedVetoable_HandleCall_TestFail is DelayedVetoable_Init {
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 {
function test_handleCall_unauthorizedInitiation_reverts() external {
vm.expectRevert(abi.encodeWithSelector(Unauthorized.selector, initiator, address(this)));
(bool success,) = address(delayedVetoable).call(hex"");
assert(success);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment