Skip to content

Commit

Permalink
keystone: [KS-246] Only allow owner to call setConfig (#13378)
Browse files Browse the repository at this point in the history
* keystone: [KS-246] Only allow owner to call setConfig

* Update gethwrappers

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 76dbe19 commit 46a1b9d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion contracts/src/v0.8/keystone/KeystoneForwarder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ contract KeystoneForwarder is IForwarder, ConfirmedOwner, TypeAndVersionInterfac
uint256 internal constant REPORT_METADATA_LENGTH = 88;
uint256 internal constant SIGNATURE_LENGTH = 65;

function setConfig(uint32 donId, uint8 f, address[] calldata signers) external nonReentrant {
function setConfig(uint32 donId, uint8 f, address[] calldata signers) external onlyOwner {
if (f == 0) revert FaultToleranceMustBePositive();
if (signers.length > MAX_ORACLES) revert ExcessSigners(signers.length, MAX_ORACLES);
if (signers.length <= 3 * f) revert InsufficientSigners(signers.length, 3 * f + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ import {BaseTest} from "./KeystoneForwarderBaseTest.t.sol";
import {KeystoneForwarder} from "../KeystoneForwarder.sol";

contract KeystoneForwarder_SetConfigTest is BaseTest {
address internal constant STRANGER = address(2);

function test_RevertWhen_NotOwner() public {
vm.stopPrank(); // BaseTest sets ADMIN
vm.prank(STRANGER);
vm.expectRevert();
s_forwarder.setConfig(DON_ID, F, _getSignerAddresses());
}

function test_RevertWhen_FaultToleranceIsZero() public {
vm.expectRevert(KeystoneForwarder.FaultToleranceMustBePositive.selector);
s_forwarder.setConfig(DON_ID, 0, _getSignerAddresses());
Expand Down
Loading

0 comments on commit 46a1b9d

Please sign in to comment.