Skip to content

Commit

Permalink
make vetoing deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
1kresh committed Jul 26, 2024
1 parent a4113dd commit 35761cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/contracts/slasher/VetoSlasher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ contract VetoSlasher is BaseSlasher, AccessControlUpgradeable, IVetoSlasher {

SlashRequest storage request = slashRequests[slashIndex];

uint256 resolverShares_ = resolverShares(request.network, msg.sender, vetoSlashHints.resolverSharesHint);
uint256 resolverShares_ =
resolverSharesAt(request.network, msg.sender, request.captureTimestamp, vetoSlashHints.resolverSharesHint);

if (resolverShares_ == 0) {
revert NotResolver();
Expand Down
7 changes: 5 additions & 2 deletions test/slasher/VetoSlasher.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,8 @@ contract VetoSlasherTest is Test {

(vault, delegator, slasher) = _getVaultAndDelegatorAndSlasher(epochDuration, vetoDuration);

resolverShares1 = bound(resolverShares1, 1, slasher.SHARES_BASE());
resolverShares2 = bound(resolverShares2, 1, slasher.SHARES_BASE());
resolverShares1 = bound(resolverShares1, 1, slasher.SHARES_BASE() - 1);
resolverShares2 = bound(resolverShares2, 1, slasher.SHARES_BASE() - 1);

// address network = alice;
_registerNetwork(alice, alice);
Expand All @@ -1089,6 +1089,9 @@ contract VetoSlasherTest is Test {
blockTimestamp = blockTimestamp + 1;
vm.warp(blockTimestamp);

_setResolverShares(alice, alice, resolverShares1 + 1, "");
_setResolverShares(alice, bob, resolverShares2 + 1, "");

slashAmount1 = Math.min(slashAmount1, Math.min(depositAmount, Math.min(networkLimit, operatorNetworkLimit1)));

_requestSlash(alice, alice, alice, slashAmount1, uint48(blockTimestamp - 1), "");
Expand Down

0 comments on commit 35761cf

Please sign in to comment.