The current directory contains Certora's formal verification of AAVE's V3 token. In this directory you will find three subdirectories:
- specs - Contains all the specification files that were written by Certora for the token code. We have created two spec files,
base.spec,delegate.spec,erc20.specandgeneral.spec.
base.speccontains method declarations, CVL functions and definitions used by the main specification filesdelegate.speccontains rules that prove various delegation propertieserc20.speccontains rules that prove ERC20 general rules, e.g. correctness of transfer and othersgeneral.speccontains general delegation invariants, e.g. sum of delegated and undelegated balances equals to total supply
- scripts - Contains all the necessary run scripts to execute the spec files on the Certora Prover. These scripts composed of a run command of Certora Prover, contracts to take into account in the verification context, declaration of the compiler and a set of additional settings.
verifyDelegate.shis a script for runningdelegate.specverifyGeneral.shis a script for runninggeneral.specerc20.shis a script for runningerc20.spec
- harness - Contains all the inheriting contracts that add/simplify functionalities to the original contract. We use two harnesses:
-
AaveTokenV3Harness.solused byerc20.shanddelegate.sh. It inherits from the original AaveV3Token contract and adds a few getter functions. -
AaveTokenV3HarnessStorage.solused bygeneral.sh. It uses a modified a version of AaveV3Token contract where thedelegationStatefield of the_balancesstruct is refactored to be of type uint8 instead ofDelegationStateenum. This is done in order to bypass a current limitation of the tool and write a hook on thedelegationStatefield (hooks don't support enum fields at the moment)
To run a verification job:
-
Open terminal and
cdyour way to the main aave-token-v3 directory -
Run the script you'd like to get results for:
sh certora/scripts/verifyDelegate.sh sh certora/scripts/verifyGeneral.sh sh certora/scripts/erc20.sh