Skip to content

Commit

Permalink
fix: certora ci run on main & _getStructReserveConfig fetching all da…
Browse files Browse the repository at this point in the history
…ta (#36)

* fix: make _getStructReserveConfig responsible for fetching all data

* fix: also run ci on merge to master
  • Loading branch information
sakulstra authored Jul 25, 2024
1 parent 12275a9 commit bea0c65
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/certora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ on:
jobs:
verify:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository
if:
github.event.pull_request.head.repo.full_name == github.repository || (github.event_name == 'push' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch))

steps:
- uses: actions/checkout@v4
Expand Down
26 changes: 14 additions & 12 deletions tests/utils/ProtocolV3TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,7 @@ contract ProtocolV3TestBase is DiffUtils {
vars.configs = new ReserveConfig[](vars.reserves.length);

for (uint256 i = 0; i < vars.reserves.length; i++) {
vars.configs[i] = _getStructReserveConfig(pool, vars.reserves[i]);
ReserveTokens memory reserveTokens = _getStructReserveTokens(
poolDataProvider,
vars.configs[i].underlying
);
vars.configs[i].aToken = reserveTokens.aToken;
vars.configs[i].variableDebtToken = reserveTokens.variableDebtToken;
vars.configs[i].stableDebtToken = reserveTokens.stableDebtToken;
vars.configs[i] = _getStructReserveConfig(pool, poolDataProvider, vars.reserves[i]);
}

return vars.configs;
Expand All @@ -427,12 +420,22 @@ contract ProtocolV3TestBase is DiffUtils {

function _getStructReserveConfig(
IPool pool,
IPoolDataProvider poolDataProvider,
IPoolDataProvider.TokenData memory reserve
) internal view virtual returns (ReserveConfig memory) {
ReserveConfig memory localConfig;
DataTypes.ReserveConfigurationMap memory configuration = pool.getConfiguration(
reserve.tokenAddress
);

localConfig.underlying = reserve.tokenAddress;
ReserveTokens memory reserveTokens = _getStructReserveTokens(
poolDataProvider,
reserve.tokenAddress
);
localConfig.aToken = reserveTokens.aToken;
localConfig.variableDebtToken = reserveTokens.variableDebtToken;
localConfig.stableDebtToken = reserveTokens.stableDebtToken;
localConfig.interestRateStrategy = pool
.getReserveData(reserve.tokenAddress)
.interestRateStrategyAddress;
Expand All @@ -452,7 +455,6 @@ contract ProtocolV3TestBase is DiffUtils {
localConfig.isPaused
) = configuration.getFlags();
localConfig.symbol = reserve.symbol;
localConfig.underlying = reserve.tokenAddress;
localConfig.usageAsCollateralEnabled = localConfig.liquidationThreshold != 0;
localConfig.isSiloed = configuration.getSiloedBorrowing();
(localConfig.borrowCap, localConfig.supplyCap) = configuration.getCaps();
Expand All @@ -467,10 +469,10 @@ contract ProtocolV3TestBase is DiffUtils {

if (localConfig.virtualAccActive) {
localConfig.virtualBalance = pool.getVirtualUnderlyingBalance(reserve.tokenAddress);
localConfig.aTokenUnderlyingBalance = IERC20Detailed(reserve.tokenAddress).balanceOf(
localConfig.aToken
);
}
localConfig.aTokenUnderlyingBalance = IERC20Detailed(reserve.tokenAddress).balanceOf(
localConfig.aToken
);

return localConfig;
}
Expand Down

0 comments on commit bea0c65

Please sign in to comment.