Skip to content

Commit d494f2c

Browse files
committed
test: add test for max key limit
1 parent acacb35 commit d494f2c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/foundry_tests/PermissionlessNodeRegistry.t.sol

+15
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,21 @@ contract PermissionlessNodeRegistryTest is Test {
256256
assertEq(nodeRegistry.isExistingPubkey(pubkeys[0]), true);
257257
}
258258

259+
function test_addValidatorKeysWithLLimitExceed() public {
260+
(
261+
bytes[] memory pubkeys,
262+
bytes[] memory preDepositSignature,
263+
bytes[] memory depositSignature
264+
) = getValidatorKeys();
265+
vm.prank(staderManager);
266+
nodeRegistry.updateMaxKeyPerOperator(2); // Limit is 2 and trying to add 3 keys
267+
startHoax(address(this));
268+
nodeRegistry.onboardNodeOperator(true, "testOP", payable(address(this)));
269+
vm.expectRevert(IPermissionlessNodeRegistry.MaxKeyLimitExceed.selector);
270+
nodeRegistry.addValidatorKeys{ value: 12 ether }(pubkeys, preDepositSignature, depositSignature);
271+
vm.stopPrank();
272+
}
273+
259274
function testAddValidatorKeysNotEnoughSDCollateral() public {
260275
(
261276
bytes[] memory pubkeys,

0 commit comments

Comments
 (0)