Skip to content

Commit

Permalink
Merge pull request #2 from bgd-labs/feat/coverage
Browse files Browse the repository at this point in the history
feat: code coverage
  • Loading branch information
eboadom authored May 7, 2024
2 parents 19ddb51 + 9aefb95 commit 7e07f2e
Show file tree
Hide file tree
Showing 25 changed files with 3,139 additions and 31 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ on:
jobs:
test:
uses: bgd-labs/github-workflows/.github/workflows/foundry-test.yml@main
secrets: inherit
43 changes: 43 additions & 0 deletions .github/workflows/report-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload only report folder
path: "./report"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
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://bgd-labs.github.io/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
217 changes: 217 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,217 @@
<!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">94</td>
<td class="headerCovTableEntry">94</td>
</tr>
<tr>
<td class="headerItem">Test Date:</td>
<td class="headerValue">2024-05-07 20:11:46</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntryHi">100.0&nbsp;%</td>
<td class="headerCovTableEntry">19</td>
<td class="headerCovTableEntry">19</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#L94">RiskSteward.getRiskConfig</a></td>

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

<td class="coverFnHi">266</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 7e07f2e

Please sign in to comment.