Fujicracy / fuji-v2

Cross-chain money market aggregator
https://fuji-v2-frontend.vercel.app
15 stars 10 forks source link

Precision of max payback withdraw #677

Closed 0xdcota closed 1 year ago

0xdcota commented 1 year ago

This pr addresses issues caused on the router because of conversion error in _paybackChecks.

Same logic was also applied to _withdrawChecks.

A test to analyze the reasoning behind the changes was included. PrecisionMath.t.sol. Fuzzing was used to verify.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **fuji-v2-frontend** | ⬜️ Ignored ([Inspect](https://vercel.com/fuji-finance/fuji-v2-frontend/GL5fETfwu6NH5xNjGpCdyjbRzh6x)) | | | Jul 18, 2023 11:25pm |
0xdcota commented 1 year ago

@brozorec instructions on how to replicate the reported error in here.

You can test the updates in this branch by:

forge test --mp test/forking/goerli/ConnextRouterVaultIntegration.t.sol -vv

Then you can switch the BorrowingVaultUpgradeable.sol to a the commit where these changes were not implemented by running:

git checkout bc97041f src/vaults/borrowing/BorrowingVaultUpgradeable.sol

This corresponds to the implementation used in the reported error. Then finally run the tests again:

forge test --mp test/forking/goerli/ConnextRouterVaultIntegration.t.sol -vv