In LendingPool
the functions that rely on the indexes (liquidity index, usage index) update them before executing state changes, in order to ensure they are working with accurate data.
On the other hand LendingPool::getNormalizedDebt()
method does not refresh the usage index, returning a stale value.
The usage index returned by LendingPool::getNormalizedDebt()
is stale. All of the contracts that rely on this method will use stale data for performing calculations.
Calculations in DebtToken
relying on the liquidity index will be performed with stale data, leading to incorrect results.
set up:
run npm install
and add .env
file if you haven't already
npm i --save-dev @nomicfoundation/hardhat-foundry
- Install the hardhat-foundry plugin.
Add require("@nomicfoundation/hardhat-foundry");
to the top of your hardhat.config.js
file.
Run npx hardhat init-foundry
in your terminal. This will generate a foundry.toml
file based on your Hardhat project’s existing configuration, and will install the forge-std
library.
mkdir test/foundry
Create *.t.sol
file inside /test/foundry
and paste the POC inside.
In foundry.toml
update test = 'test/foundry'
running test:
forge test --match-test testGetNormalizedDebtReturnsStaleData -vv
Manual review
Either call ReserveLibrary::updateReserveState()
to refresh the indexes before returning the usage index, or call ReserveLibrary::getNormalizedDebt()
.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.