Skip to content

Commit

Permalink
fix: statemind-Possible DoS in the VaultManager._slashVault() function
Browse files Browse the repository at this point in the history
  • Loading branch information
alrxy committed Dec 13, 2024
1 parent 0e35d3a commit 6c31a64
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/managers/VaultManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ abstract contract VaultManager is NetworkStorage, SlashingWindowStorage, Capture
enum SlasherType {
INSTANT, // Instant slasher type
VETO // Veto slasher type

}

enum DelegatorType {
Expand Down Expand Up @@ -716,8 +715,13 @@ abstract contract VaultManager is NetworkStorage, SlashingWindowStorage, Capture
uint48 vaultEpoch = IVault(vault).epochDuration();

address slasher = IVault(vault).slasher();
if (slasher != address(0) && IEntity(slasher).TYPE() == uint64(SlasherType.VETO)) {
vaultEpoch -= IVetoSlasher(slasher).vetoDuration();
if (slasher != address(0)) {
uint64 slasherType = IEntity(slasher).TYPE();
if (slasherType == uint64(SlasherType.VETO)) {
vaultEpoch -= IVetoSlasher(slasher).vetoDuration();
} else if (slasherType > uint64(SlasherType.VETO)) {
revert UnknownSlasherType();
}
}

if (vaultEpoch < _SLASHING_WINDOW()) {
Expand Down

0 comments on commit 6c31a64

Please sign in to comment.