1a6a4ebfbb
Signed-off-by: AlienTornadosaurusHex <>
232 lines
20 KiB
HTML
232 lines
20 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<title>LCOV - lcov.info - /home/user/Desktop/extracted/relayer-registry/test/TornadoProposalTest.sol</title>
|
|
<link rel="stylesheet" type="text/css" href="../../../../../../gcov.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<table width="100%" border=0 cellspacing=0 cellpadding=0>
|
|
<tr><td class="title">LCOV - code coverage report</td></tr>
|
|
<tr><td class="ruler"><img src="../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
|
|
|
|
<tr>
|
|
<td width="100%">
|
|
<table cellpadding=1 border=0 width="100%">
|
|
<tr>
|
|
<td width="10%" class="headerItem">Current view:</td>
|
|
<td width="35%" class="headerValue"><a href="../../../../../../index.html">top level</a> - <a href="index.html">home/user/Desktop/extracted/relayer-registry/test</a> - TornadoProposalTest.sol<span style="font-size: 80%;"> (source / <a href="TornadoProposalTest.sol.func-sort-c.html">functions</a>)</span></td>
|
|
<td width="5%"></td>
|
|
<td width="15%"></td>
|
|
<td width="10%" class="headerCovTableHead">Hit</td>
|
|
<td width="10%" class="headerCovTableHead">Total</td>
|
|
<td width="15%" class="headerCovTableHead">Coverage</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="headerItem">Test:</td>
|
|
<td class="headerValue">lcov.info</td>
|
|
<td></td>
|
|
<td class="headerItem">Lines:</td>
|
|
<td class="headerCovTableEntry">0</td>
|
|
<td class="headerCovTableEntry">36</td>
|
|
<td class="headerCovTableEntryLo">0.0 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="headerItem">Date:</td>
|
|
<td class="headerValue">2023-06-20 21:04:08</td>
|
|
<td></td>
|
|
<td class="headerItem">Functions:</td>
|
|
<td class="headerCovTableEntry">0</td>
|
|
<td class="headerCovTableEntry">7</td>
|
|
<td class="headerCovTableEntryLo">0.0 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="headerItem">Legend:</td>
|
|
<td class="headerValueLeg"> Lines:
|
|
<span class="coverLegendCov">hit</span>
|
|
<span class="coverLegendNoCov">not hit</span>
|
|
</td>
|
|
<td></td>
|
|
</tr>
|
|
<tr><td><img src="../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr><td class="ruler"><img src="../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
|
|
</table>
|
|
|
|
<table cellpadding=0 cellspacing=0 border=0>
|
|
<tr>
|
|
<td><br></td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<pre class="sourceHeading"> Line data Source code</pre>
|
|
<pre class="source">
|
|
<a name="1"><span class="lineNum"> 1 </span> : // SPDX-License-Identifier: MIT</a>
|
|
<a name="2"><span class="lineNum"> 2 </span> : </a>
|
|
<a name="3"><span class="lineNum"> 3 </span> : pragma solidity ^0.6.12;</a>
|
|
<a name="4"><span class="lineNum"> 4 </span> : pragma experimental ABIEncoderV2;</a>
|
|
<a name="5"><span class="lineNum"> 5 </span> : </a>
|
|
<a name="6"><span class="lineNum"> 6 </span> : import { IGovernance, Proposal, ProposalState } from "common/interfaces/IGovernance.sol";</a>
|
|
<a name="7"><span class="lineNum"> 7 </span> : </a>
|
|
<a name="8"><span class="lineNum"> 8 </span> : import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";</a>
|
|
<a name="9"><span class="lineNum"> 9 </span> : </a>
|
|
<a name="10"><span class="lineNum"> 10 </span> : import { Test } from "forge-std/Test.sol";</a>
|
|
<a name="11"><span class="lineNum"> 11 </span> : </a>
|
|
<a name="12"><span class="lineNum"> 12 </span> : import { TornadoAddresses } from "common/TornadoAddresses.sol";</a>
|
|
<a name="13"><span class="lineNum"> 13 </span> : </a>
|
|
<a name="14"><span class="lineNum"> 14 </span> : contract TornadoProposalTest is Test, TornadoAddresses {</a>
|
|
<a name="15"><span class="lineNum"> 15 </span> : // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PERMIT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</a>
|
|
<a name="16"><span class="lineNum"> 16 </span> : </a>
|
|
<a name="17"><span class="lineNum"> 17 </span> : bytes32 public constant PERMIT_TYPEHASH =</a>
|
|
<a name="18"><span class="lineNum"> 18 </span> : keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");</a>
|
|
<a name="19"><span class="lineNum"> 19 </span> : </a>
|
|
<a name="20"><span class="lineNum"> 20 </span> : bytes32 public constant EIP712_DOMAIN = keccak256(</a>
|
|
<a name="21"><span class="lineNum"> 21 </span> : abi.encode(</a>
|
|
<a name="22"><span class="lineNum"> 22 </span> : keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),</a>
|
|
<a name="23"><span class="lineNum"> 23 </span> : keccak256(bytes("TornadoCash")),</a>
|
|
<a name="24"><span class="lineNum"> 24 </span> : keccak256(bytes("1")),</a>
|
|
<a name="25"><span class="lineNum"> 25 </span> : 1,</a>
|
|
<a name="26"><span class="lineNum"> 26 </span> : VERIFIER_ADDRESS</a>
|
|
<a name="27"><span class="lineNum"> 27 </span> : )</a>
|
|
<a name="28"><span class="lineNum"> 28 </span> : );</a>
|
|
<a name="29"><span class="lineNum"> 29 </span> : </a>
|
|
<a name="30"><span class="lineNum"> 30 </span> : uint16 public constant PERMIT_FUNC_SELECTOR = uint16(0x1901);</a>
|
|
<a name="31"><span class="lineNum"> 31 </span> : </a>
|
|
<a name="32"><span class="lineNum"> 32 </span> : // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TEST DUMMIES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</a>
|
|
<a name="33"><span class="lineNum"> 33 </span> : </a>
|
|
<a name="34"><span class="lineNum"> 34 </span> : address public constant TEST_REAL_ADDRESS_WITH_BALANCE = 0x9Ff3C1Bea9ffB56a78824FE29f457F066257DD58;</a>
|
|
<a name="35"><span class="lineNum"> 35 </span> : </a>
|
|
<a name="36"><span class="lineNum"> 36 </span> : address public constant TEST_RELAYER_ADDRESS = 0x30F96AEF199B399B722F8819c9b0723016CEAe6C; // moon-relayer.eth</a>
|
|
<a name="37"><span class="lineNum"> 37 </span> : // (just for testing)</a>
|
|
<a name="38"><span class="lineNum"> 38 </span> : </a>
|
|
<a name="39"><span class="lineNum"> 39 </span> : uint256 public constant TEST_PRIVATE_KEY_ONE =</a>
|
|
<a name="40"><span class="lineNum"> 40 </span> : 0x66ddbd7cbe4a566df405f6ded0b908c669f88cdb1656380c050e3a457bd21df0;</a>
|
|
<a name="41"><span class="lineNum"> 41 </span> : uint256 public constant TEST_PRIVATE_KEY_TWO =</a>
|
|
<a name="42"><span class="lineNum"> 42 </span> : 0xa4c8c98120e77741a87a116074a2df4ddb20d1149069290fd4a3d7ee65c55064;</a>
|
|
<a name="43"><span class="lineNum"> 43 </span> : </a>
|
|
<a name="44"><span class="lineNum"> 44 </span> : address public constant TEST_ADDRESS_ONE = 0x118251976c65AFAf291f5255450ddb5b6A4d8B88;</a>
|
|
<a name="45"><span class="lineNum"> 45 </span> : address public constant TEST_ADDRESS_TWO = 0x63aE7d90Eb37ca39FC62dD9991DbEfeE70673a20;</a>
|
|
<a name="46"><span class="lineNum"> 46 </span> : </a>
|
|
<a name="47"><span class="lineNum"> 47 </span> : // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ADDRESSES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</a>
|
|
<a name="48"><span class="lineNum"> 48 </span> : </a>
|
|
<a name="49"><span class="lineNum"> 49 </span> : address public constant VERIFIER_ADDRESS = 0x77777FeDdddFfC19Ff86DB637967013e6C6A116C;</a>
|
|
<a name="50"><span class="lineNum"> 50 </span> : </a>
|
|
<a name="51"><span class="lineNum"> 51 </span> : // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GOVERNANCE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</a>
|
|
<a name="52"><span class="lineNum"> 52 </span> : </a>
|
|
<a name="53"><span class="lineNum"> 53 </span> : string public constant PROPOSAL_DESCRIPTION = "{title:'Some proposal',description:''}";</a>
|
|
<a name="54"><span class="lineNum"> 54 </span> : </a>
|
|
<a name="55"><span class="lineNum"> 55 </span> : uint256 public EXECUTION_DELAY;</a>
|
|
<a name="56"><span class="lineNum"> 56 </span> : uint256 public EXECUTION_EXPIRATION;</a>
|
|
<a name="57"><span class="lineNum"> 57 </span> : uint256 public QUORUM_VOTES;</a>
|
|
<a name="58"><span class="lineNum"> 58 </span> : uint256 public PROPOSAL_THRESHOLD;</a>
|
|
<a name="59"><span class="lineNum"> 59 </span> : uint256 public VOTING_DELAY;</a>
|
|
<a name="60"><span class="lineNum"> 60 </span> : uint256 public VOTING_PERIOD;</a>
|
|
<a name="61"><span class="lineNum"> 61 </span> : uint256 public CLOSING_PERIOD;</a>
|
|
<a name="62"><span class="lineNum"> 62 </span> : uint256 public VOTE_EXTEND_TIME;</a>
|
|
<a name="63"><span class="lineNum"> 63 </span> : </a>
|
|
<a name="64"><span class="lineNum"> 64 </span> : IGovernance public immutable governance = IGovernance(getGovernanceProxyAddress());</a>
|
|
<a name="65"><span class="lineNum"> 65 </span> : </a>
|
|
<a name="66"><span class="lineNum"> 66 </span> : // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TEST UTILS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</a>
|
|
<a name="67"><span class="lineNum"> 67 </span> : </a>
|
|
<a name="68"><span class="lineNum"> 68 </span> : function setUp() public virtual {</a>
|
|
<a name="69"><span class="lineNum"> 69 </span><span class="lineNoCov"> 0 : vm.createSelectFork(vm.envString("MAINNET_RPC_URL"));</span></a>
|
|
<a name="70"><span class="lineNum"> 70 </span><span class="lineNoCov"> 0 : _fetchConfiguration();</span></a>
|
|
<a name="71"><span class="lineNum"> 71 </span> : }</a>
|
|
<a name="72"><span class="lineNum"> 72 </span> : </a>
|
|
<a name="73"><span class="lineNum"> 73 </span> : // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HELPERS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</a>
|
|
<a name="74"><span class="lineNum"> 74 </span> : </a>
|
|
<a name="75"><span class="lineNum"> 75 </span> : function waitUntilExecutable(uint256 proposalId) internal {</a>
|
|
<a name="76"><span class="lineNum"> 76 </span><span class="lineNoCov"> 0 : uint256 proposalExecutableTime = getProposalExecutableTime(proposalId);</span></a>
|
|
<a name="77"><span class="lineNum"> 77 </span><span class="lineNoCov"> 0 : require(block.timestamp < proposalExecutableTime, "Too late to execute proposal");</span></a>
|
|
<a name="78"><span class="lineNum"> 78 </span><span class="lineNoCov"> 0 : vm.warp(proposalExecutableTime);</span></a>
|
|
<a name="79"><span class="lineNum"> 79 </span> : }</a>
|
|
<a name="80"><span class="lineNum"> 80 </span> : </a>
|
|
<a name="81"><span class="lineNum"> 81 </span> : function easyPropose(address proposalAddress) public returns (uint256) {</a>
|
|
<a name="82"><span class="lineNum"> 82 </span><span class="lineNoCov"> 0 : retrieveAndLockBalance(TEST_PRIVATE_KEY_ONE, TEST_ADDRESS_ONE, QUORUM_VOTES);</span></a>
|
|
<a name="83"><span class="lineNum"> 83 </span><span class="lineNoCov"> 0 : retrieveAndLockBalance(TEST_PRIVATE_KEY_TWO, TEST_ADDRESS_TWO, 1 ether);</span></a>
|
|
<a name="84"><span class="lineNum"> 84 </span> : </a>
|
|
<a name="85"><span class="lineNum"> 85 </span> : /* ----------PROPOSER------------ */</a>
|
|
<a name="86"><span class="lineNum"> 86 </span><span class="lineNoCov"> 0 : vm.startPrank(TEST_ADDRESS_ONE);</span></a>
|
|
<a name="87"><span class="lineNum"> 87 </span> : </a>
|
|
<a name="88"><span class="lineNum"> 88 </span><span class="lineNoCov"> 0 : uint256 proposalId = governance.propose(proposalAddress, PROPOSAL_DESCRIPTION);</span></a>
|
|
<a name="89"><span class="lineNum"> 89 </span> : </a>
|
|
<a name="90"><span class="lineNum"> 90 </span> : // TIME-TRAVEL</a>
|
|
<a name="91"><span class="lineNum"> 91 </span><span class="lineNoCov"> 0 : vm.warp(block.timestamp + 6 hours);</span></a>
|
|
<a name="92"><span class="lineNum"> 92 </span> : </a>
|
|
<a name="93"><span class="lineNum"> 93 </span><span class="lineNoCov"> 0 : governance.castVote(proposalId, true);</span></a>
|
|
<a name="94"><span class="lineNum"> 94 </span> : </a>
|
|
<a name="95"><span class="lineNum"> 95 </span><span class="lineNoCov"> 0 : vm.stopPrank();</span></a>
|
|
<a name="96"><span class="lineNum"> 96 </span> : /* ------------------------------ */</a>
|
|
<a name="97"><span class="lineNum"> 97 </span> : </a>
|
|
<a name="98"><span class="lineNum"> 98 </span> : /* -------------VOTER-------------*/</a>
|
|
<a name="99"><span class="lineNum"> 99 </span><span class="lineNoCov"> 0 : vm.startPrank(TEST_ADDRESS_TWO);</span></a>
|
|
<a name="100"><span class="lineNum"> 100 </span><span class="lineNoCov"> 0 : governance.castVote(proposalId, true);</span></a>
|
|
<a name="101"><span class="lineNum"> 101 </span><span class="lineNoCov"> 0 : vm.stopPrank();</span></a>
|
|
<a name="102"><span class="lineNum"> 102 </span> : /* ------------------------------ */</a>
|
|
<a name="103"><span class="lineNum"> 103 </span> : </a>
|
|
<a name="104"><span class="lineNum"> 104 </span><span class="lineNoCov"> 0 : return proposalId;</span></a>
|
|
<a name="105"><span class="lineNum"> 105 </span> : }</a>
|
|
<a name="106"><span class="lineNum"> 106 </span> : </a>
|
|
<a name="107"><span class="lineNum"> 107 </span> : function retrieveAndLockBalance(uint256, address voter, uint256 amount) internal {</a>
|
|
<a name="108"><span class="lineNum"> 108 </span> : /* ----------GOVERNANCE------- */</a>
|
|
<a name="109"><span class="lineNum"> 109 </span><span class="lineNoCov"> 0 : vm.startPrank(getGovernanceProxyAddress());</span></a>
|
|
<a name="110"><span class="lineNum"> 110 </span><span class="lineNoCov"> 0 : IERC20(getTornTokenAddress()).transfer(voter, amount);</span></a>
|
|
<a name="111"><span class="lineNum"> 111 </span><span class="lineNoCov"> 0 : vm.stopPrank();</span></a>
|
|
<a name="112"><span class="lineNum"> 112 </span> : /* ----------------------------*/</a>
|
|
<a name="113"><span class="lineNum"> 113 </span> : </a>
|
|
<a name="114"><span class="lineNum"> 114 </span> : /* ----------VOTER------------ */</a>
|
|
<a name="115"><span class="lineNum"> 115 </span><span class="lineNoCov"> 0 : vm.startPrank(voter);</span></a>
|
|
<a name="116"><span class="lineNum"> 116 </span><span class="lineNoCov"> 0 : IERC20(getTornTokenAddress()).approve(address(governance), amount);</span></a>
|
|
<a name="117"><span class="lineNum"> 117 </span><span class="lineNoCov"> 0 : governance.lockWithApproval(amount);</span></a>
|
|
<a name="118"><span class="lineNum"> 118 </span><span class="lineNoCov"> 0 : vm.stopPrank();</span></a>
|
|
<a name="119"><span class="lineNum"> 119 </span> : /* ----------------------------*/</a>
|
|
<a name="120"><span class="lineNum"> 120 </span> : }</a>
|
|
<a name="121"><span class="lineNum"> 121 </span> : </a>
|
|
<a name="122"><span class="lineNum"> 122 </span> : function giveTorn(address voter, uint256 amount) internal {</a>
|
|
<a name="123"><span class="lineNum"> 123 </span> : /* ----------GOVERNANCE------- */</a>
|
|
<a name="124"><span class="lineNum"> 124 </span><span class="lineNoCov"> 0 : vm.startPrank(getGovernanceProxyAddress());</span></a>
|
|
<a name="125"><span class="lineNum"> 125 </span><span class="lineNoCov"> 0 : IERC20(getTornTokenAddress()).transfer(voter, amount);</span></a>
|
|
<a name="126"><span class="lineNum"> 126 </span><span class="lineNoCov"> 0 : vm.stopPrank();</span></a>
|
|
<a name="127"><span class="lineNum"> 127 </span> : /* ----------------------------*/</a>
|
|
<a name="128"><span class="lineNum"> 128 </span> : }</a>
|
|
<a name="129"><span class="lineNum"> 129 </span> : </a>
|
|
<a name="130"><span class="lineNum"> 130 </span> : // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GETTERS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</a>
|
|
<a name="131"><span class="lineNum"> 131 </span> : </a>
|
|
<a name="132"><span class="lineNum"> 132 </span> : function getProposalExecutableTime(uint256 proposalId) internal view returns (uint256) {</a>
|
|
<a name="133"><span class="lineNum"> 133 </span><span class="lineNoCov"> 0 : Proposal memory proposal = IGovernance(getGovernanceProxyAddress()).proposals(proposalId);</span></a>
|
|
<a name="134"><span class="lineNum"> 134 </span><span class="lineNoCov"> 0 : return proposal.endTime + EXECUTION_DELAY + 1 hours;</span></a>
|
|
<a name="135"><span class="lineNum"> 135 </span> : }</a>
|
|
<a name="136"><span class="lineNum"> 136 </span> : </a>
|
|
<a name="137"><span class="lineNum"> 137 </span> : function _fetchConfiguration() internal {</a>
|
|
<a name="138"><span class="lineNum"> 138 </span><span class="lineNoCov"> 0 : EXECUTION_DELAY = governance.EXECUTION_DELAY();</span></a>
|
|
<a name="139"><span class="lineNum"> 139 </span><span class="lineNoCov"> 0 : EXECUTION_EXPIRATION = governance.EXECUTION_EXPIRATION();</span></a>
|
|
<a name="140"><span class="lineNum"> 140 </span><span class="lineNoCov"> 0 : QUORUM_VOTES = governance.QUORUM_VOTES();</span></a>
|
|
<a name="141"><span class="lineNum"> 141 </span><span class="lineNoCov"> 0 : PROPOSAL_THRESHOLD = governance.PROPOSAL_THRESHOLD();</span></a>
|
|
<a name="142"><span class="lineNum"> 142 </span><span class="lineNoCov"> 0 : VOTING_DELAY = governance.VOTING_DELAY();</span></a>
|
|
<a name="143"><span class="lineNum"> 143 </span><span class="lineNoCov"> 0 : VOTING_PERIOD = governance.VOTING_PERIOD();</span></a>
|
|
<a name="144"><span class="lineNum"> 144 </span><span class="lineNoCov"> 0 : CLOSING_PERIOD = governance.CLOSING_PERIOD();</span></a>
|
|
<a name="145"><span class="lineNum"> 145 </span><span class="lineNoCov"> 0 : VOTE_EXTEND_TIME = governance.VOTE_EXTEND_TIME();</span></a>
|
|
<a name="146"><span class="lineNum"> 146 </span> : }</a>
|
|
<a name="147"><span class="lineNum"> 147 </span> : }</a>
|
|
</pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
|
|
<table width="100%" border=0 cellspacing=0 cellpadding=0>
|
|
<tr><td class="ruler"><img src="../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
|
|
<tr><td class="versionInfo">Generated by: <a href="https://github.com/linux-test-project/lcov" target="_parent">LCOV version 1.16</a></td></tr>
|
|
</table>
|
|
<br>
|
|
|
|
</body>
|
|
</html>
|