Skip to content

Commit

Permalink
feat: add code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
brotherlymite committed Apr 15, 2024
1 parent 11594ca commit a9a713a
Show file tree
Hide file tree
Showing 22 changed files with 3,045 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
# deps
update:; forge update

coverage :; forge coverage --report lcov && \
lcov --remove ./lcov.info -o ./lcov.info.p \
'tests/*' \
&& genhtml ./lcov.info.p -o report --branch-coverage \
&& coverage=$$(awk -F '[<>]' '/headerCovTableEntryHi/{print $3}' ./report/index.html | sed 's/[^0-9.]//g' | head -n 1); \
wget -O ./report/coverage.svg "https://img.shields.io/badge/coverage-$${coverage}%25-brightgreen"

# Build & test
build :; forge build --sizes
test :; forge test -vvv
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Expanding from the scope of from CapsPlusRiskSteward, we now introduce the new RiskSteward, allowing hardly constrained risk parameter updates by risk service providers and reducing governance overhead.

[![Coverage badge](./report/coverage.svg)](https://github.com/bgd-labs/aave-risk-stewards-2)

## Specification

The new RiskSteward we propose follows the same design as the CapsPlusRiskSteward: a smart contract to which the Aave Governance gives `POOL_ADMIN` the role over all v3 instances, controlled by a 2-of-2 multi-sig of the risk providers, and heavily constrained on what can do and how by its own logic.
Expand Down
Binary file added report/amber.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions report/cmd_line
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
genhtml ./lcov.info.p -o report --branch-coverage
203 changes: 203 additions & 0 deletions report/contracts/src/contracts/RiskSteward.sol.func-c.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
<!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.p - contracts/src/contracts/RiskSteward.sol - functions</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="10%" class="headerValue"><a href="../../../index.html">top level</a> - <a href="index.html">contracts/src/contracts</a> - RiskSteward.sol<span style="font-size: 80%;"> (<a href="RiskSteward.sol.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="5%"></td>
<td width="5%" class="headerCovTableHead">Coverage</td>
<td width="5%" class="headerCovTableHead" title="Covered + Uncovered code">Total</td>
<td width="5%" class="headerCovTableHead" title="Exercised code only">Hit</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">lcov.info.p</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">100</td>
<td class="headerCovTableEntry">100</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-04-15 16:35:51</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">17</td>
<td class="headerCovTableEntry">17</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntryHi">-</td>
<td class="headerCovTableEntry">0</td>
<td class="headerCovTableEntry">0</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>

<center>
<table cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td class="tableHead">Function Name <span title="Click to sort table by function name" class="tableHeadSort"><a href="RiskSteward.sol.func.html"><img src="../../../updown.png" width=10 height=14 alt="Sort by function name" title="Click to sort table by function name" border=0></a></span></td>

<td class="tableHead">Hit count <span title="Click to sort table by function hit count" class="tableHeadSort"><img src="../../../glass.png" width=10 height=14 alt="Sort by function hit count" title="Click to sort table by function hit count" border=0></span></td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L95">RiskSteward.getRiskConfig</a></td>

<td class="coverFnHi">1</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L100">RiskSteward.isAssetRestricted</a></td>

<td class="coverFnHi">2</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L372">RiskSteward._updateCollateralSide</a></td>

<td class="coverFnHi">3</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L322">RiskSteward._updateRates</a></td>

<td class="coverFnHi">3</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L290">RiskSteward._updateCaps</a></td>

<td class="coverFnHi">4</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L426">RiskSteward._getInterestRatesForAsset</a></td>

<td class="coverFnHi">6</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L84">RiskSteward.getTimelock</a></td>

<td class="coverFnHi">6</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L148">RiskSteward._validateRatesUpdate</a></td>

<td class="coverFnHi">7</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L114">RiskSteward._validateCapsUpdate</a></td>

<td class="coverFnHi">10</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L197">RiskSteward._validateCollateralsUpdate</a></td>

<td class="coverFnHi">10</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L459">RiskSteward._updateWithinAllowedRange</a></td>

<td class="coverFnHi">34</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L266">RiskSteward._validateParamUpdate</a></td>

<td class="coverFnHi">45</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L89">RiskSteward.setRiskConfig</a></td>

<td class="coverFnHi">260</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L105">RiskSteward.setAssetRestricted</a></td>

<td class="coverFnHi">262</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L70">RiskSteward.updateRates</a></td>

<td class="coverFnHi">264</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L64">RiskSteward.updateCaps</a></td>

<td class="coverFnHi">267</td>


</tr>
<tr>
<td class="coverFn"><a href="RiskSteward.sol.gcov.html#L76">RiskSteward.updateCollateralSide</a></td>

<td class="coverFnHi">267</td>


</tr>
</table>
<br>
</center>
<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 2.0-1</a></td></tr>
</table>
<br>

</body>
</html>
Loading

0 comments on commit a9a713a

Please sign in to comment.