Skip to content

Commit

Permalink
feat: guards on external functions
Browse files Browse the repository at this point in the history
  • Loading branch information
8sunyuan committed Feb 14, 2025
1 parent 7b78901 commit 06bc804
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/contracts/core/DelegationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ contract DelegationManager is
address initDelegationApprover,
uint32 allocationDelay,
string calldata metadataURI
) external {
) external nonReentrant {
require(!isDelegated(msg.sender), ActivelyDelegated());

allocationManager.setAllocationDelay(msg.sender, allocationDelay);
Expand All @@ -108,7 +108,7 @@ contract DelegationManager is
}

/// @inheritdoc IDelegationManager
function modifyOperatorDetails(address operator, address newDelegationApprover) external checkCanCall(operator) {
function modifyOperatorDetails(address operator, address newDelegationApprover) external checkCanCall(operator) nonReentrant {
require(isOperator(operator), OperatorNotRegistered());
_setDelegationApprover(operator, newDelegationApprover);
}
Expand All @@ -124,7 +124,7 @@ contract DelegationManager is
address operator,
SignatureWithExpiry memory approverSignatureAndExpiry,
bytes32 approverSalt
) public {
) public nonReentrant {
require(!isDelegated(msg.sender), ActivelyDelegated());
require(isOperator(operator), OperatorNotRegistered());

Expand All @@ -143,7 +143,7 @@ contract DelegationManager is
/// @inheritdoc IDelegationManager
function undelegate(
address staker
) public returns (bytes32[] memory withdrawalRoots) {
) public nonReentrant returns (bytes32[] memory withdrawalRoots) {
// Check that the `staker` can undelegate
require(isDelegated(staker), NotActivelyDelegated());
require(!isOperator(staker), OperatorsCannotUndelegate());
Expand All @@ -165,7 +165,7 @@ contract DelegationManager is
address newOperator,
SignatureWithExpiry memory newOperatorApproverSig,
bytes32 approverSalt
) external returns (bytes32[] memory withdrawalRoots) {
) external nonReentrant returns (bytes32[] memory withdrawalRoots) {
withdrawalRoots = undelegate(msg.sender);
// delegateTo uses msg.sender as staker
delegateTo(newOperator, newOperatorApproverSig, approverSalt);
Expand All @@ -174,7 +174,7 @@ contract DelegationManager is
/// @inheritdoc IDelegationManager
function queueWithdrawals(
QueuedWithdrawalParams[] calldata params
) external onlyWhenNotPaused(PAUSED_ENTER_WITHDRAWAL_QUEUE) returns (bytes32[] memory) {
) external onlyWhenNotPaused(PAUSED_ENTER_WITHDRAWAL_QUEUE) nonReentrant returns (bytes32[] memory) {
bytes32[] memory withdrawalRoots = new bytes32[](params.length);
address operator = delegatedTo[msg.sender];

Expand Down Expand Up @@ -226,7 +226,7 @@ contract DelegationManager is
IStrategy strategy,
uint256 prevDepositShares,
uint256 addedShares
) external onlyStrategyManagerOrEigenPodManager {
) external onlyStrategyManagerOrEigenPodManager nonReentrant {
/// Note: Unlike `decreaseDelegatedShares`, we don't return early if the staker has no operator.
/// This is because `_increaseDelegation` updates the staker's deposit scaling factor, which we
/// need to do even if not delegated.
Expand All @@ -250,7 +250,7 @@ contract DelegationManager is
address staker,
uint256 curDepositShares,
uint64 beaconChainSlashingFactorDecrease
) external onlyEigenPodManager {
) external onlyEigenPodManager nonReentrant {
if (!isDelegated(staker)) {
return;
}
Expand Down Expand Up @@ -280,7 +280,7 @@ contract DelegationManager is
IStrategy strategy,
uint64 prevMaxMagnitude,
uint64 newMaxMagnitude
) external onlyAllocationManager {
) external onlyAllocationManager nonReentrant {
/// forgefmt: disable-next-item
uint256 operatorSharesSlashed = SlashingLib.calcSlashedAmount({
operatorShares: operatorShares[operator][strategy],
Expand Down

0 comments on commit 06bc804

Please sign in to comment.