Skip to content

Commit

Permalink
Merge pull request #3 from lidofinance/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
krogla authored Jan 21, 2025
2 parents f76f32f + 6c78f08 commit b67dcd2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/CredibleCommitmentCurationProvider.sol
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ contract CredibleCommitmentCurationProvider is
// - if it's s opted in
// - if module not disabled
// - if operator is active in Lido module
isEnabled = flags.isOptedIn && !moduleState.isDisabled && _c.isActive;
// - if the contract is not paused
isEnabled = flags.isOptedIn && !moduleState.isDisabled && _c.isActive && !paused();

return (
_c.moduleId,
Expand Down
33 changes: 33 additions & 0 deletions test/CCCP.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ contract CCCPOptIn is CCCPCommon {
function test_OptIn() public {
// opt in on behalf of noCsm1
vm.broadcast(noCsm1);
vm.expectEmit(true, true, true, false, address(cccp));
emit CCCP.OptInSucceeded(csmId, noCsm1Id, noCsm1Manager);
vm.expectEmit(true, true, true, false, address(cccp));
emit CCCP.KeyRangeUpdated(csmId, noCsm1Id, 2, 4);

cccp.optIn({
moduleId: csmId,
operatorId: noCsm1Id,
Expand Down Expand Up @@ -310,4 +315,32 @@ contract CCCPOptIn is CCCPCommon {
rpcURL: ""
});
}

function test_OptIn_RevertWhen_KeyIndexWrongOrder() public {
// optin
vm.broadcast(noCsm1);
vm.expectRevert(CCCP.KeyIndexMismatch.selector);
cccp.optIn({
moduleId: csmId,
operatorId: noCsm1Id,
manager: noCsm1Manager,
newKeyIndexRangeStart: 4,
newKeyIndexRangeEnd: 2,
rpcURL: ""
});
}

function test_OptIn_RevertWhen_KeyIndexOutOfRange() public {
// optin
vm.broadcast(noCsm1);
vm.expectRevert(CCCP.KeyIndexOutOfRange.selector);
cccp.optIn({
moduleId: csmId,
operatorId: noCsm1Id,
manager: noCsm1Manager,
newKeyIndexRangeStart: 2,
newKeyIndexRangeEnd: 100,
rpcURL: ""
});
}
}

0 comments on commit b67dcd2

Please sign in to comment.