Skip to content

Commit 25119e1

Browse files
committed
fix: more reentrancy checks
1 parent 02f120f commit 25119e1

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/contracts/core/SlashEscrowFactory.sol

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
55
import "@openzeppelin-upgrades/contracts/proxy/ClonesUpgradeable.sol";
66
import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
77
import "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";
8+
import "@openzeppelin-upgrades/contracts/security/ReentrancyGuardUpgradeable.sol";
89
import "../permissions/Pausable.sol";
910
import "../mixins/SemVerMixin.sol";
1011
import "./SlashEscrowFactoryStorage.sol";
1112

12-
contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, OwnableUpgradeable, Pausable, SemVerMixin {
13+
contract SlashEscrowFactory is
14+
Initializable,
15+
SlashEscrowFactoryStorage,
16+
OwnableUpgradeable,
17+
ReentrancyGuardUpgradeable,
18+
Pausable,
19+
SemVerMixin
20+
{
1321
using SafeERC20 for IERC20;
1422
using OperatorSetLib for *;
1523
using EnumerableSet for *;
@@ -101,7 +109,7 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
101109
function releaseSlashEscrow(
102110
OperatorSet calldata operatorSet,
103111
uint256 slashId
104-
) external onlyWhenNotPaused(PAUSED_RELEASE_ESCROW) {
112+
) external onlyWhenNotPaused(PAUSED_RELEASE_ESCROW) nonReentrant {
105113
address redistributionRecipient = allocationManager.getRedistributionRecipient(operatorSet);
106114

107115
_checkReleaseSlashEscrow(operatorSet, slashId, redistributionRecipient);
@@ -133,7 +141,7 @@ contract SlashEscrowFactory is Initializable, SlashEscrowFactoryStorage, Ownable
133141
OperatorSet calldata operatorSet,
134142
uint256 slashId,
135143
IStrategy strategy
136-
) external virtual onlyWhenNotPaused(PAUSED_RELEASE_ESCROW) {
144+
) external virtual onlyWhenNotPaused(PAUSED_RELEASE_ESCROW) nonReentrant {
137145
address redistributionRecipient = allocationManager.getRedistributionRecipient(operatorSet);
138146

139147
_checkReleaseSlashEscrow(operatorSet, slashId, redistributionRecipient);

src/contracts/core/StrategyManager.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ contract StrategyManager is
171171
function clearBurnOrRedistributableShares(
172172
OperatorSet calldata operatorSet,
173173
uint256 slashId
174-
) external nonReentrant returns (uint256[] memory) {
174+
) external returns (uint256[] memory) {
175175
// Get the strategies to clear.
176176
address[] memory strategies = _burnOrRedistributableShares[operatorSet.key()][slashId].keys();
177177
uint256 length = strategies.length;
@@ -190,7 +190,7 @@ contract StrategyManager is
190190
OperatorSet calldata operatorSet,
191191
uint256 slashId,
192192
IStrategy strategy
193-
) public returns (uint256) {
193+
) public nonReentrant returns (uint256) {
194194
EnumerableMap.AddressToUintMap storage burnOrRedistributableShares =
195195
_burnOrRedistributableShares[operatorSet.key()][slashId];
196196

src/contracts/interfaces/IStrategyManager.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ interface IStrategyManager is IStrategyManagerErrors, IStrategyManagerEvents, IS
137137

138138
/**
139139
* @notice Removes burned shares from storage and transfers the underlying tokens for the slashId to the slash escrow.
140+
* @dev Reentrancy is checked in the `clearBurnOrRedistributableSharesByStrategy` function.
140141
* @param operatorSet The operator set to burn shares in.
141142
* @param slashId The slash ID to burn shares in.
142143
* @return The amounts of tokens transferred to the slash escrow for each strategy

0 commit comments

Comments
 (0)