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.spec
andgeneral.spec
.
base.spec
contains method declarations, CVL functions and definitions used by the main specification filesdelegate.spec
contains rules that prove various delegation propertieserc20.spec
contains rules that prove ERC20 general rules, e.g. correctness of transfer and othersgeneral.spec
contains 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.sh
is a script for runningdelegate.spec
verifyGeneral.sh
is a script for runninggeneral.spec
erc20.sh
is a script for runningerc20.spec
- harness - Contains all the inheriting contracts that add/simplify functionalities to the original contract. We use two harnesses:
-
AaveTokenV3Harness.sol
used byerc20.sh
anddelegate.sh
. It inherits from the original AaveV3Token contract and adds a few getter functions. -
AaveTokenV3HarnessStorage.sol
used bygeneral.sh
. It uses a modified a version of AaveV3Token contract where thedelegationState
field of the_balances
struct is refactored to be of type uint8 instead ofDelegationState
enum. This is done in order to bypass a current limitation of the tool and write a hook on thedelegationState
field (hooks don't support enum fields at the moment)
To run a verification job:
-
Open terminal and
cd
your 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