Browse Source

added ghost and counter implementation for castWithReason and castBySig

Michael M 3 years ago
parent
commit
8ed7f965bb
1 changed files with 14 additions and 4 deletions
  1. 14 4
      certora/harnesses/GovernorHarness.sol

+ 14 - 4
certora/harnesses/GovernorHarness.sol

@@ -120,8 +120,13 @@ contract GovernorHarness is Governor {
         string calldata reason
     ) public virtual override returns (uint256) {
         address voter = _msgSender();
-        counter_vote_power_by_id[proposalId] += _castVote(proposalId, voter, support, reason);
-        return _castVote(proposalId, voter, support, reason);
+        // 2)
+        ghost_vote_power_by_id[proposalId] = _castVote(proposalId, voter, support, reason);
+        
+        // 1)
+        counter_vote_power_by_id[proposalId] += ghost_vote_power_by_id[proposalId];
+
+        return ghost_vote_power_by_id[proposalId];
     }
 
     function castVoteBySig(
@@ -137,7 +142,12 @@ contract GovernorHarness is Governor {
             r,
             s
         );
-        counter_vote_power_by_id[proposalId] += _castVote(proposalId, voter, support, "");
-        return _castVote(proposalId, voter, support, "");
+        // 2)
+        ghost_vote_power_by_id[proposalId] = _castVote(proposalId, voter, support, "");
+
+        // 1)
+        counter_vote_power_by_id[proposalId] += ghost_vote_power_by_id[proposalId];
+
+        return ghost_vote_power_by_id[proposalId];
     }
 }