Skip to content

Commit b896266

Browse files
authored
fix: missing constructor for validator-gater & validator-rewarder (#78)
Fixes recallnet/ipc#484
1 parent 7daab54 commit b896266

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

src/token/ValidatorGater.sol

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ contract ValidatorGater is IValidatorGater, UUPSUpgradeable, OwnableUpgradeable
3333
error InvalidRouteAddress(address invalidAddress);
3434
error ContractNotActive();
3535

36+
/// @custom:oz-upgrades-unsafe-allow constructor
37+
constructor() {
38+
_disableInitializers();
39+
}
40+
3641
function initialize() public initializer {
3742
__Ownable_init(msg.sender);
3843
__UUPSUpgradeable_init();

src/token/ValidatorRewarder.sol

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ contract ValidatorRewarder is IValidatorRewarder, UUPSUpgradeable, OwnableUpgrad
5757
error InvalidValidatorAddress(address validator);
5858
error ContractNotActive();
5959

60+
/// @custom:oz-upgrades-unsafe-allow constructor
61+
constructor() {
62+
_disableInitializers();
63+
}
64+
6065
// ========== INITIALIZER ==========
6166

6267
/// @notice Initializes the rewarder

test/ValidatorRewarder.t.sol

+5-4
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,16 @@ contract ValidatorRewarderSubnetTest is ValidatorRewarderTestBase {
120120

121121
function testInitializeWithInvalidPeriod() public {
122122
// Deploy a new instance without initialization
123-
ValidatorRewarder newRewarder = new ValidatorRewarder();
123+
ValidatorRewarderDeployScript rewarderDeployer = new ValidatorRewarderDeployScript();
124+
ValidatorRewarder newRewarder = rewarderDeployer.run(address(token));
124125
SubnetID memory subnet = createSubnet();
125126

126-
// Initialize with token
127-
newRewarder.initialize(address(token));
128-
129127
// Try to set subnet with invalid period
128+
address newRewarderOwner = newRewarder.owner();
129+
vm.startPrank(newRewarderOwner);
130130
vm.expectRevert(abi.encodeWithSelector(ValidatorRewarder.InvalidCheckpointPeriod.selector, 0));
131131
newRewarder.setSubnet(subnet, 0);
132+
vm.stopPrank();
132133
}
133134

134135
function testSetSubnetNotOwner() public {

0 commit comments

Comments
 (0)