From 37fbe3163cccf492d72f04753e7ea6c6dc55a493 Mon Sep 17 00:00:00 2001 From: bagelface Date: Sat, 22 Nov 2025 11:33:14 -0500 Subject: [PATCH] feat: make reinitializers permissioned so theres no funny business --- src/VotingMultipliers.sol | 4 +++- src/YieldDistributor.sol | 13 ++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/VotingMultipliers.sol b/src/VotingMultipliers.sol index 3005471..9d587c1 100644 --- a/src/VotingMultipliers.sol +++ b/src/VotingMultipliers.sol @@ -23,7 +23,9 @@ contract VotingMultipliers is Ownable2StepUpgradeable, IVotingMultipliers { /// @notice Initializes the contract /// @param _initialOwner The address of the initial owner function __VotingMultipliers_init(address _initialOwner) internal onlyInitializing { - __Ownable_init(_initialOwner); + if (owner() == address(0)) { + __Ownable_init(_initialOwner); + } } /// @notice Returns the multiplier at the given index diff --git a/src/YieldDistributor.sol b/src/YieldDistributor.sol index 5682522..d644837 100644 --- a/src/YieldDistributor.sol +++ b/src/YieldDistributor.sol @@ -120,7 +120,7 @@ contract YieldDistributor is IYieldDistributor, Ownable2StepUpgradeable, VotingM * @param _blsSignatureChecker The address of the BLS signature checker * @custom:oz-upgrades-validate-as-initializer */ - function initializeGasKiller(address _avsAddress, address _blsSignatureChecker) public reinitializer(2) { + function initializeGasKiller(address _avsAddress, address _blsSignatureChecker) public reinitializer(2) onlyOwner { _setAvsAddress(_avsAddress); _setBlsSignatureChecker(_blsSignatureChecker); } @@ -160,12 +160,11 @@ contract YieldDistributor is IYieldDistributor, Ownable2StepUpgradeable, VotingM * @param _account Address of user to return the voting power for * @return uint256 Voting power of the specified user at the specified period of time */ - function getVotingPowerForPeriod( - IERC20Votes _sourceContract, - uint256 _start, - uint256 _end, - address _account - ) public view returns (uint256) { + function getVotingPowerForPeriod(IERC20Votes _sourceContract, uint256 _start, uint256 _end, address _account) + public + view + returns (uint256) + { if (_start >= _end) revert StartMustBeBeforeEnd(); if (_end > block.number) revert EndAfterCurrentBlock();