Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for PR #42

Open
wants to merge 1 commit into
base: v3.3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/certora-basic.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: certora
name: certora-basic

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
with: { distribution: "zulu", java-version: "11", java-package: jre }

- name: Install certora cli
run: pip install certora-cli==7.17.2
run: pip install certora-cli==7.20.3

- name: Install solc
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/certora-stata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with: { distribution: "zulu", java-version: "11", java-package: jre }

- name: Install certora cli
run: pip install certora-cli==7.17.2
run: pip install certora-cli==7.20.3
- name: Install solc
run: |
wget https://github.com/ethereum/solidity/releases/download/v0.8.20/solc-static-linux
Expand Down
14 changes: 7 additions & 7 deletions certora/basic/conf/NEW-pool-no-summarizations.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"certora/basic/harness/ATokenHarness.sol",
"certora/basic/harness/PoolHarness.sol",
"certora/basic/harness/SimpleERC20.sol",
"src/contracts/instances/VariableDebtTokenInstance.sol",
"src/contracts/helpers/AaveProtocolDataProvider.sol",
"src/contracts/misc/DefaultReserveInterestRateStrategyV2.sol",
"src/contracts/protocol/configuration/ACLManager.sol",
"src/contracts/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol",
"src/contracts/misc/PriceOracleSentinel.sol",
"src/contracts/protocol/configuration/PoolAddressesProvider.sol",
"certora/basic/munged/contracts/instances/VariableDebtTokenInstance.sol",
"certora/basic/munged/contracts/helpers/AaveProtocolDataProvider.sol",
"certora/basic/munged/contracts/misc/DefaultReserveInterestRateStrategyV2.sol",
"certora/basic/munged/contracts/protocol/configuration/ACLManager.sol",
"certora/basic/munged/contracts/misc/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol",
"certora/basic/munged/contracts/misc/PriceOracleSentinel.sol",
"certora/basic/munged/contracts/protocol/configuration/PoolAddressesProvider.sol",
],
"link": [
"ATokenHarness:POOL=PoolHarness",
Expand Down
10 changes: 5 additions & 5 deletions certora/basic/conf/NEW-pool-simple-properties.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"certora/basic/harness/ATokenHarness.sol",
"certora/basic/harness/PoolHarness.sol",
"certora/basic/harness/SimpleERC20.sol",
"src/contracts/instances/VariableDebtTokenInstance.sol",
"src/contracts/helpers/AaveProtocolDataProvider.sol",
"src/contracts/misc/DefaultReserveInterestRateStrategyV2.sol",
"src/contracts/protocol/libraries/types/DataTypes.sol",
"src/contracts/protocol/configuration/PoolAddressesProvider.sol",
"certora/basic/munged/contracts/instances/VariableDebtTokenInstance.sol",
"certora/basic/munged/contracts/helpers/AaveProtocolDataProvider.sol",
"certora/basic/munged/contracts/misc/DefaultReserveInterestRateStrategyV2.sol",
"certora/basic/munged/contracts/protocol/libraries/types/DataTypes.sol",
"certora/basic/munged/contracts/protocol/configuration/PoolAddressesProvider.sol",
],
"link": [
"ATokenHarness:POOL=PoolHarness",
Expand Down
4 changes: 2 additions & 2 deletions certora/basic/scripts/run-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ certoraRun $CMN certora/basic/conf/stableRemoved.conf \
--msg "6: Stable fields are un-touched"

echo
echo "******** Running: 6 EModeConfiguration ***************"
echo "******** Running: 7 EModeConfiguration ***************"
certoraRun $CMN certora/basic/conf/EModeConfiguration.conf \
--msg "6: EModeConfiguration"
--msg "7: EModeConfiguration"


echo
Expand Down
2 changes: 0 additions & 2 deletions certora/basic/specs/EModeConfiguration.spec
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,3 @@ rule independencyOfBorrowableSetters(uint256 reserveIndex, bool borrowable) {
assert (reserveIndex != reserveIndex_other => before == after);
}



10 changes: 5 additions & 5 deletions certora/basic/specs/NEW-pool-base.spec
Original file line number Diff line number Diff line change
Expand Up @@ -99,36 +99,36 @@ function calculateCompoundedInterestSummary(uint256 rate, uint40 t0, uint256 t1)
}

function isActiveReserve(env e, address asset) returns bool {
DataTypes.ReserveData data = getReserveDataExtended(e, asset);
DataTypes.ReserveDataLegacy data = getReserveData(e, asset);
DataTypes.ReserveConfigurationMap configuration = data.configuration;
bool isActive = getActive(e, configuration);

return isActive;
}

function isFrozenReserve(env e, address asset) returns bool {
DataTypes.ReserveData data = getReserveDataExtended(e, asset);
DataTypes.ReserveDataLegacy data = getReserveData(e, asset);
DataTypes.ReserveConfigurationMap configuration = data.configuration;
bool isFrozen = getFrozen(e, configuration);

return isFrozen;
}

function isEnabledForBorrow(env e, address asset) returns bool {
DataTypes.ReserveData data = getReserveDataExtended(e, asset);
DataTypes.ReserveDataLegacy data = getReserveData(e, asset);
DataTypes.ReserveConfigurationMap configuration = data.configuration;
bool isBorrowEnabled = getBorrowingEnabled(e, configuration);

return isBorrowEnabled;
}

function getCurrentLiquidityRate(env e, address asset) returns mathint {
DataTypes.ReserveData data = getReserveDataExtended(e, asset);
DataTypes.ReserveDataLegacy data = getReserveData(e, asset);
return data.currentLiquidityRate;
}

function getLiquidityIndex(env e, address asset) returns mathint {
DataTypes.ReserveData data = getReserveDataExtended(e, asset);
DataTypes.ReserveDataLegacy data = getReserveData(e, asset);
return data.liquidityIndex;
}

Expand Down
2 changes: 1 addition & 1 deletion certora/basic/specs/NEW-pool-no-summarizations.spec
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ rule liquidityIndexNonDecresingFor_cumulateToLiquidityIndex() {


function get_AToken_of_asset(env e, address asset) returns address {
DataTypes.ReserveData data = getReserveDataExtended(e, asset);
DataTypes.ReserveDataLegacy data = getReserveData(e, asset);
return data.aTokenAddress;
}

Expand Down
1 change: 1 addition & 0 deletions certora/basic/specs/aux/aToken.spec
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function indexForToken(address token, env e) returns uint256 {

// todo: adjust for stable debt token
function aTokenBalanceOfCVL(address token, address user, env e) returns uint256 {
require token != 0;
uint storedBalance = balanceOfCVL(token, user);
if (aTokenToUnderlying[token] == 0) {
// not a properly initialized aToken, return the regular ERC20 balance
Expand Down
63 changes: 37 additions & 26 deletions certora/basic/specs/stableRemoved.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "aux/aToken.spec";
//import "AddressProvider.spec";

methods {
function getReserveDataExtended(address) external returns (DataTypes.ReserveData memory) envfree;
// function getReserveDataExtended(address) external returns (DataTypes.ReserveData memory) envfree;
function getReserveData(address) external returns (DataTypes.ReserveDataLegacy memory) envfree;

function ValidationLogic.validateLiquidationCall(
Expand All @@ -21,22 +21,43 @@ methods {
DataTypes.CalculateUserAccountDataParams memory params
) internal returns (uint256, uint256, uint256, uint256, uint256, bool) => NONDET;

function LiquidationLogic._calculateDebt(
/* function LiquidationLogic._calculateDebt(
DataTypes.ReserveCache memory debtReserveCache,
DataTypes.ExecuteLiquidationCallParams memory params,
uint256 healthFactor
) internal returns (uint256, uint256) => NONDET;
) internal returns (uint256, uint256) => NONDET;*/

function LiquidationLogic._calculateAvailableCollateralToLiquidate(
DataTypes.ReserveData storage collateralReserve,
DataTypes.ReserveCache memory debtReserveCache,
address collateralAsset,
address debtAsset,
uint256 debtToCover,
uint256 userCollateralBalance,
uint256 liquidationBonus,
address // IPriceOracleGetter
) internal returns (uint256,uint256,uint256) => NONDET;
DataTypes.ReserveConfigurationMap memory collateralReserveConfiguration,
uint256 collateralAssetPrice,
uint256 collateralAssetUnit,
uint256 debtAssetPrice,
uint256 debtAssetUnit,
uint256 debtToCover,
uint256 userCollateralBalance,
uint256 liquidationBonus
) internal returns (uint256, uint256, uint256, uint256) => NONDET;
}


// For flashloan
methods {
function _.executeOperation(
address[] assets,
uint256[] amounts,
uint256[] premiums,
address initiator,
bytes params
) external => NONDET; // expect bool;

// simple receiver
function _.executeOperation(
address asset,
uint256 amount,
uint256 premium,
address initiator,
bytes params
) external => NONDET; // expect bool;
}


Expand All @@ -55,9 +76,9 @@ function init_state() {
}


hook Sstore _reserves[KEY address a].__deprecatedStableBorrowRate uint128 rate (uint128 old_rate) {
assert false, "writing the field __deprecatedStableBorrowRate";
}
//hook Sstore _reserves[KEY address a].__deprecatedStableBorrowRate uint128 rate (uint128 old_rate) {
// assert false, "writing the field __deprecatedStableBorrowRate";
//}

hook Sstore _reserves[KEY address a].__deprecatedStableDebtTokenAddress address stable (address old_stable) {
assert false, "writing the field __deprecatedStableDebtTokenAddress";
Expand All @@ -82,29 +103,19 @@ rule stableFieldsUntouched(method f, env e, address _asset)
aTokenToUnderlying[currentContract._reserves[asset].aTokenAddress]==asset
&&
aTokenToUnderlying[currentContract._reserves[asset].variableDebtTokenAddress]==asset;


DataTypes.ReserveData reserve = getReserveDataExtended(_asset);
DataTypes.ReserveDataLegacy reserveLegasy = getReserveData(_asset);

uint128 __deprecatedStableBorrowRate_BEFORE = reserve.__deprecatedStableBorrowRate;
address __deprecatedStableDebtTokenAddress_BEFORE = reserve.__deprecatedStableDebtTokenAddress;
uint128 currentStableBorrowRate_BEFORE = reserveLegasy.currentStableBorrowRate;
// address stableDebtTokenAddress_BEFORE = reserveLegasy.stableDebtTokenAddress;

calldataarg args;
f(e,args);

DataTypes.ReserveData reserve2 = getReserveDataExtended(_asset);
DataTypes.ReserveDataLegacy reserveLegasy2 = getReserveData(_asset);

uint128 __deprecatedStableBorrowRate_AFTER = reserve2.__deprecatedStableBorrowRate;
address __deprecatedStableDebtTokenAddress_AFTER = reserve2.__deprecatedStableDebtTokenAddress;
uint128 currentStableBorrowRate_AFTER = reserveLegasy2.currentStableBorrowRate;
address stableDebtTokenAddress_AFTER = reserveLegasy2.stableDebtTokenAddress;

assert __deprecatedStableBorrowRate_BEFORE == __deprecatedStableBorrowRate_AFTER;
assert __deprecatedStableDebtTokenAddress_BEFORE == __deprecatedStableDebtTokenAddress_AFTER;
assert currentStableBorrowRate_BEFORE == currentStableBorrowRate_AFTER;
// assert stableDebtTokenAddress_BEFORE == stableDebtTokenAddress_AFTER;

}
24 changes: 0 additions & 24 deletions certora/deprecated/Makefile

This file was deleted.

56 changes: 0 additions & 56 deletions certora/deprecated/README.md

This file was deleted.

47 changes: 0 additions & 47 deletions certora/deprecated/applyHarness.patch

This file was deleted.

16 changes: 0 additions & 16 deletions certora/deprecated/conf/AToken.conf

This file was deleted.

Loading