From 7a6f026847fd2edee5f6ffddbecbfeb296320a1b Mon Sep 17 00:00:00 2001 From: wildmolasses Date: Fri, 26 Jan 2024 09:41:48 -0500 Subject: [PATCH] disallow surrogates as actors --- test/helpers/UniStaker.handler.sol | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/helpers/UniStaker.handler.sol b/test/helpers/UniStaker.handler.sol index 1079b7e..221c6bd 100644 --- a/test/helpers/UniStaker.handler.sol +++ b/test/helpers/UniStaker.handler.sol @@ -24,11 +24,13 @@ contract UniStakerHandler is CommonBase, StdCheats, StdUtils { AddressSet internal _delegates; AddressSet internal _beneficiaries; + AddressSet internal _surrogates; - modifier createActor() { + function _createActor() internal { currentActor = msg.sender; + // Surrogates can't stake. We won't include them as potential actors. + vm.assume(!_surrogates.contains(currentActor)); _actors.add(msg.sender); - _; } modifier useActor(uint256 actorIndexSeed) { @@ -48,14 +50,15 @@ contract UniStakerHandler is CommonBase, StdCheats, StdUtils { function _mintStakeToken(address _to, uint256 _amount) internal { vm.assume(_to != address(0)); - deal(address(stakeToken), _to, _amount); + deal(address(stakeToken), _to, _amount, true); } function stake(uint256 _amount, address _delegatee, address _beneficiary) public - createActor countCall("stake") { + _createActor(); + // TODO: decide if we want reverts in stake //_beneficiary = address(uint160(bound(uint160(_beneficiary), 1, type(uint160).max))); //_delegatee = address(uint160(bound(uint160(_delegatee), 1, type(uint160).max))); @@ -72,7 +75,7 @@ contract UniStakerHandler is CommonBase, StdCheats, StdUtils { stakeToken.approve(address(uniStaker), _amount); uniStaker.stake(_amount, _delegatee, _beneficiary); vm.stopPrank(); - + _surrogates.add(address(uniStaker.surrogates(_delegatee))); ghost_stakeSum += _amount; }