diff --git a/Makefile b/Makefile index 7465d9e..47f2f62 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ build :; forge clean && forge build --optimize --optimizer-runs 1000000 # Tests tests :; forge clean && forge test --mt test --optimize --optimizer-runs 1000000 -v # --ffi # enable if you need the `ffi` cheat code on HEVM test-with-gas-report :; forge clean && forge build && forge test --mt test --optimize --optimizer-runs 1000000 -v --gas-report # --ffi # enable if you need the `ffi` cheat code on HEVM +test-unit :; forge clean && forge test --no-match-test invariant --optimize --optimizer-runs 1000000 -v # --ffi # enable if you need the `ffi` cheat code on HEVM test-invariant :; ./test/invariants/test-invariant.sh ${SCENARIO} ${NUM_ACTORS} ${NUM_PROPOSALS} ${PER_ADDRESS_TOKEN_REQ_CAP} test-invariant-all :; forge clean && forge t --mt invariant test-invariant-multiple-distribution :; forge clean && ./test/invariants/test-invariant.sh MultipleDistribution 2 25 200 diff --git a/src/grants/GrantFund.sol b/src/grants/GrantFund.sol index 6f9a9a2..03154eb 100644 --- a/src/grants/GrantFund.sol +++ b/src/grants/GrantFund.sol @@ -1099,6 +1099,8 @@ contract GrantFund is IGrantFund, Storage, ReentrancyGuard { DistributionPeriod storage currentDistribution = _distributions[distributionId_]; VoterInfo storage voter = _voterInfo[distributionId_][voter_]; + if (voter.screeningVotesCast == 0) return 0; + rewards_ = _getDelegateReward(currentDistribution, voter); } diff --git a/test/unit/StandardFunding.t.sol b/test/unit/StandardFunding.t.sol index afbc1e1..aff519c 100644 --- a/test/unit/StandardFunding.t.sol +++ b/test/unit/StandardFunding.t.sol @@ -1273,6 +1273,10 @@ contract StandardFundingGrantFundTest is GrantFundTestHelper { /******************************/ // Claim delegate reward for all delegatees + // delegates who didn't vote in the screening stage have zero rewards + delegateRewards = _grantFund.getDelegateReward(distributionId, _tokenHolder11); + assertEq(delegateRewards, 0); + // delegates who didn't vote with their full power receive fewer rewards delegateRewards = _grantFund.getDelegateReward(distributionId, _tokenHolder1); assertEq(delegateRewards, 327_029.344384908148174595 * 1e18);