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

Exemplary ERC4626 specs #3

Open
wants to merge 127 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
720e5e0
Exemplary ERC4626 specs
johspaeth Sep 12, 2023
2370cc3
Adding missing library
johspaeth Sep 12, 2023
de8b419
Adding minimal OpenZeppelin code
johspaeth Sep 12, 2023
60763f7
Adding config and rules adopted for Open Zeppelin
johspaeth Sep 12, 2023
fcc611b
Modular verification
johspaeth Sep 12, 2023
cb0d39b
Adding spec for singleUserBalanceSmallerThanTotalSupply for ERC4626, …
johspaeth Sep 12, 2023
016054b
Merge branch 'johannes/erc4626-specs' into johannes/openzeppelin
johspaeth Sep 13, 2023
8f3118c
Fixes spec after merge
johspaeth Sep 13, 2023
641f676
Introducing inflation bug
johspaeth Sep 13, 2023
4189a10
Add info to bash script
johspaeth Sep 13, 2023
c811e4c
Reverting introduction of bug and removing invariant that doesn't hold.
johspaeth Sep 13, 2023
896ee63
Adding mirrorBalance and adding assumptions
johspaeth Sep 13, 2023
12b2a2f
Manually assuming totalSupply == sumOfBalances as invariant isn't wor…
johspaeth Sep 13, 2023
9e2836b
Merge branch 'johannes/erc4626-specs' into johannes/openzeppelin
johspaeth Sep 13, 2023
9fe3e87
Results for run: https://prover.certora.com/output/53900/231f5ee9474d…
johspaeth Sep 15, 2023
4aa2c9a
Results for run: https://prover.certora.com/output/53900/9939b71a19ac…
johspaeth Sep 15, 2023
3600d56
Results for run: https://prover.certora.com/output/53900/2d8c976e5a93…
johspaeth Sep 15, 2023
8d411f6
Results for run: https://prover.certora.com/output/53900/0f88a3b2e5cf…
johspaeth Sep 15, 2023
3406ee0
Results for run: https://prover.certora.com/output/53900/920ebe0fb822…
johspaeth Sep 15, 2023
92f2e59
Results for run: https://prover.certora.com/output/53900/bbf1d8a87d60…
johspaeth Sep 15, 2023
76d3fc4
Results for run: https://prover.certora.com/output/53900/c1ddb3e23c32…
johspaeth Sep 15, 2023
31efeb7
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
bef89b0
Results for run: https://prover.certora.com/output/53900/75f5f4f3d28a…
johspaeth Sep 15, 2023
0e9acfd
Results for run: https://prover.certora.com/output/53900/6a1e1b49aaf2…
johspaeth Sep 15, 2023
31c815b
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
7c13af2
Results for run: https://prover.certora.com/output/53900/4cfa7a4bf038…
johspaeth Sep 15, 2023
668670c
Results for run: https://prover.certora.com/output/53900/41a4bc5b38ad…
johspaeth Sep 15, 2023
74b75d3
Results for run: https://prover.certora.com/output/53900/552f67065c1c…
johspaeth Sep 15, 2023
0502a59
Results for run: https://prover.certora.com/output/53900/e8f2165008cc…
johspaeth Sep 15, 2023
502e74a
Results for run: https://prover.certora.com/output/53900/396218296fa1…
johspaeth Sep 15, 2023
83dc77d
Reverting change
johspaeth Sep 15, 2023
51b813b
Results for run: https://prover.certora.com/output/53900/541dadad753d…
johspaeth Sep 15, 2023
115d3d0
Results for run: https://prover.certora.com/output/53900/0409ffb487b0…
johspaeth Sep 15, 2023
c9ce91b
Results for run: https://prover.certora.com/output/53900/9a7597d885a9…
johspaeth Sep 15, 2023
4001e9e
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
75f68e4
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
ec2caa3
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
cd98f1f
Results for run: https://prover.certora.com/output/53900/ac1117d3a90b…
johspaeth Sep 15, 2023
86cdc1b
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
09980cb
Results for run: https://prover.certora.com/output/53900/83a6d2f84c95…
johspaeth Sep 15, 2023
beea1b6
Results for run: https://prover.certora.com/output/53900/2750eaf66915…
johspaeth Sep 15, 2023
e2fd043
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
4ad1233
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
3dbdfa3
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
3d5f64c
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
7adb5b8
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
a6ea314
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
6c30086
Results for run: with arguments src/certora/conf-openzeppelin/certor…
johspaeth Sep 15, 2023
f83a08c
Results for run: https://prover.certora.com/output/53900/8ca2b34b271c…
johspaeth Sep 15, 2023
96651e9
Results for run: https://prover.certora.com/output/53900/268822332c9d…
johspaeth Sep 15, 2023
c9accd4
Results for run: https://prover.certora.com/output/53900/4ca47d9992fc…
johspaeth Sep 15, 2023
82891ad
Results for run: https://prover.certora.com/output/53900/a6cafe531a05…
johspaeth Sep 15, 2023
8717260
Results for run: https://prover.certora.com/output/53900/da251e594eed…
johspaeth Sep 15, 2023
6646cf8
Results for run: https://prover.certora.com/output/53900/9aa41c62aaba…
johspaeth Sep 15, 2023
d4460ba
Results for run: https://prover.certora.com/output/53900/5b88926b9904…
johspaeth Sep 15, 2023
8d03d84
Results for run: https://prover.certora.com/output/53900/e38d93333f67…
johspaeth Sep 15, 2023
505d39d
Results for run: https://prover.certora.com/output/53900/3cca5db414ec…
johspaeth Sep 15, 2023
579c135
Results for run: https://prover.certora.com/output/53900/00fd75155c45…
johspaeth Sep 15, 2023
623a5e9
Results for run: https://prover.certora.com/output/53900/105b62c4c03d…
johspaeth Sep 15, 2023
81d00c2
Results for run: https://prover.certora.com/output/53900/493b65f0aa0f…
johspaeth Sep 15, 2023
ef1d14b
Results for run: https://prover.certora.com/output/53900/5abad2f62039…
johspaeth Sep 15, 2023
ddb04c2
Results for run: https://prover.certora.com/output/53900/60dc77e24f7c…
johspaeth Sep 15, 2023
1e24777
Results for run: https://prover.certora.com/output/53900/c83bbaf949b6…
johspaeth Sep 15, 2023
e8d5587
Results for run: https://prover.certora.com/output/53900/2f76750d0fe5…
johspaeth Sep 15, 2023
6b316cb
Results for run: https://prover.certora.com/output/53900/cd89f6f14ec6…
johspaeth Sep 15, 2023
6aa21b8
Results for run: https://prover.certora.com/output/53900/46bebf5030a6…
johspaeth Sep 15, 2023
c49cae6
Results for run: https://prover.certora.com/output/53900/1699f9e968b9…
johspaeth Sep 15, 2023
4139295
Results for run: https://prover.certora.com/output/53900/553bffcb4d09…
johspaeth Sep 15, 2023
d06bfd0
Results for run: https://prover.certora.com/output/53900/5d8ec456a778…
johspaeth Sep 15, 2023
c4e0002
Results for run: https://prover.certora.com/output/53900/c8d62c563012…
johspaeth Sep 15, 2023
8d8659d
Results for run: https://prover.certora.com/output/53900/c07026327711…
johspaeth Sep 15, 2023
69da824
Results for run: https://prover.certora.com/output/53900/878ce98bfb70…
johspaeth Sep 18, 2023
87350c9
Adding github action
johspaeth Sep 18, 2023
cf15714
Results for run: https://prover.certora.com/output/53900/dc0a906fad22…
johspaeth Sep 18, 2023
0679447
Fixing github action
johspaeth Sep 18, 2023
3f3e57a
Concretizing values
johspaeth Sep 18, 2023
4458df5
Fixing github action
johspaeth Sep 18, 2023
f56040f
Fixing github action
johspaeth Sep 18, 2023
6aeb035
Fix receivers
johspaeth Sep 18, 2023
9c37d73
Simplifying withdraw logic (munging)
johspaeth Sep 18, 2023
6c6b949
Using non beta version of certora
johspaeth Sep 18, 2023
4898296
Removing non-linear math in function summary
johspaeth Sep 18, 2023
5d63179
Removing non-linear math in function summary
johspaeth Sep 18, 2023
bc417c3
Making mulDiv summary more precise
johspaeth Sep 18, 2023
a76fb56
Adding upper bound on mulDiv summary
johspaeth Sep 18, 2023
d84b2f9
Relaxing lower bound
johspaeth Sep 18, 2023
023634f
concretizing input share values
johspaeth Sep 18, 2023
4c35407
Shares in range of 1 to 10.000
johspaeth Sep 18, 2023
d1e5dd9
Select 3 values for shares, allow allowance case
johspaeth Sep 18, 2023
64ce5d8
Parrallel proving OpenZeppelin and base implementation // require sha…
johspaeth Sep 18, 2023
6f67c56
Fixing spec for non open zeppelin
johspaeth Sep 18, 2023
dd25af7
Loading values to displaying them in Certora variable view.
johspaeth Sep 18, 2023
95ff65b
Loading variables for certora to display
johspaeth Sep 18, 2023
f44ea66
Refining rule to get better counter example
johspaeth Sep 18, 2023
23a24cc
Limiting search space to get plausible counter example
johspaeth Sep 18, 2023
eda4c65
Limiting search space
johspaeth Sep 18, 2023
da34f00
Adding missing requires
johspaeth Sep 18, 2023
21d0676
Duplicate rules for OpenZeppelin and base implementation
johspaeth Sep 19, 2023
b68fa0f
Starting point of rule writing of Rounding Props
johspaeth Sep 19, 2023
711d927
First summary of mulDiv
johspaeth Sep 19, 2023
e715153
Removing mulDivSummary from parent spec file
johspaeth Sep 19, 2023
ce6ebc6
Fix rule
johspaeth Sep 19, 2023
feee058
Use lower and upper bounds to express summary of mulDiv // remove unu…
johspaeth Sep 19, 2023
fcf1aec
Relaxation of mulDivSummary
johspaeth Sep 19, 2023
8bb3b6c
Adding requirements to rule to find interesting CEXs // removing unne…
johspaeth Sep 19, 2023
358eff9
Use lower and upper bounds to express summary of mulDiv
johspaeth Sep 19, 2023
33c3f0d
Full relaxation of mulDivSummary
johspaeth Sep 19, 2023
51741e8
Removing safeAssumption to see if we run into a timeout
johspaeth Sep 19, 2023
b196cc2
No safeAssumptions & requireuint summary
johspaeth Sep 19, 2023
2f6b66d
Using relaxed summary for update function
johspaeth Sep 19, 2023
5339cbb
Using fully relaxed summary in combination with ghost to bound result…
johspaeth Sep 19, 2023
a7ca05e
Fixing shares to 10000
johspaeth Sep 19, 2023
e807845
Fixing addresses
johspaeth Sep 19, 2023
f62f9ad
Using yices
johspaeth Sep 19, 2023
76f3c8c
Basic version of inflation attack working for OpenZeppelin and base i…
johspaeth Sep 21, 2023
abcc64b
Duplicating code to separate buggy and non buggy version
johspaeth Sep 21, 2023
aec6d79
Adding buggy version
johspaeth Sep 21, 2023
a793750
Applying fix patch
johspaeth Sep 21, 2023
089de79
Prooving fixed version of inflation attack
johspaeth Sep 21, 2023
ca54ce1
current state
johspaeth Sep 22, 2023
169add5
Removing zeppelin specs
johspaeth Sep 22, 2023
8f49b1d
Removing unnecessary files
johspaeth Sep 22, 2023
6625384
Adding remaining TODOs
johspaeth Sep 22, 2023
a5ce305
Enabling all specs rules in GitHub Action
johspaeth Sep 22, 2023
909ec7a
Delete lesson4_reading/erc4626/src/certora/specs/ERC20-OZ-Modular.spec
johspaeth Sep 28, 2023
58daf52
Adding rule relating increase in underlying vault to redeem of assets
johspaeth Oct 6, 2023
2e4c5cb
Adding missing requireInvariant
johspaeth Oct 6, 2023
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
107 changes: 107 additions & 0 deletions .github/workflows/certora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# A workflow file for running Certora verification through github actions.
# Find results for each push in the "Actions" tab on the github website.
name: Certora verification

on:
push: {}
pull_request: {}
workflow_dispatch: {}

jobs:
verify:
runs-on: ubuntu-latest
steps:
# check out the current version
- uses: actions/checkout@v2

# install Certora dependencies and CLI
- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.10'
# cache: 'pip'
- name: Install certora
run: pip3 install certora-cli

# the following is only necessary if your project depends on contracts
# installed using yarn
# - name: Install yarn
# uses: actions/setup-node@v3
# with:
# node-version: 16
# cache: 'yarn'
# - name: Install dependencies
# run: yarn

# Install the appropriate version of solc
- name: Install solc
run: |
wget https://github.com/ethereum/solidity/releases/download/v0.8.0/solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc8.0
chmod +x /usr/local/bin/solc8.0

wget https://github.com/ethereum/solidity/releases/download/v0.8.20/solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc8.20
chmod +x /usr/local/bin/solc8.20

# Do the actual verification. The `run` field could be simply
#
# certoraRun certora/conf/${{ matrix.params }}
#
# but we do a little extra work to get the commit messages into the
# `--msg` argument to `certoraRun`
#
# Here ${{ matrix.params }} gets replaced with each of the parameters
# listed in the `params` section below.
- name: Verify rule ${{ matrix.params.name }}
run: >
message="$(git log -n 1 --pretty=format:'CI ${{matrix.params.name}} %h .... %s')";
cd lesson4_reading/erc4626/ && certoraRun \
${{ matrix.params.command }} \
--msg "$(echo $message | sed 's/[^a-zA-Z0-9., _-]/ /g')"
env:
# For this to work, you must set your CERTORAKEY secret on the github
# website (settings > secrets > actions > new repository secret)
CERTORAKEY: ${{ secrets.CERTORAKEY }}

# The following two steps save the output json as a github artifact.
# This can be useful for automation that collects the output.
- name: Download output json
if: always()
run: >
outputLink=$(sed 's/zipOutput/output/g' .zip-output-url.txt | sed 's/?/\/output.json?/g');
curl -L -b "certoraKey=$CERTORAKEY;" ${outputLink} --output output.json || true;
touch output.json;

- name: Archive output json
if: always()
uses: actions/upload-artifact@v3
with:
name: output for ${{ matrix.params.name }}
path: output.json

strategy:
fail-fast: false
max-parallel: 4
matrix:
params:
# each of these commands is passed to the "Verify rule" step above,
# which runs certoraRun on certora/conf/<contents of the command>
#
# Note that each of these lines will appear as a separate run on
# prover.certora.com
#
# It is often helpful to split up by rule or even by method for a
# parametric rule, although it is certainly possible to run everything
# at once by not passing the `--rule` or `--method` options
#- {name: transferSpec, command: 'ERC20.conf --rule transferSpec'}
#- {name: generalRulesOnERC20, command: 'generalRules_ERC20.conf --debug'}
#- {name: generalRulesOnVAULT, command: 'generalRules_VAULT.conf --debug'}
- {name: RulesForERC4626, command: 'src/certora/conf/certoraRun-FunctionalAccountingProps.conf'}
- {name: RulesForERC4626, command: 'src/certora/conf/certoraRun-MonotonicityInvariant.conf'}
- {name: RulesForERC4626, command: 'src/certora/conf/certoraRun-MustNotRevertProps.conf'}
- {name: RulesForERC4626, command: 'src/certora/conf/certoraRun-RedeemUsingApprovalProps.conf'}
- {name: RulesForERC4626, command: 'src/certora/conf/certoraRun-RoundingProps.conf'}
- {name: RulesForERC4626, command: 'src/certora/conf/certoraRun-SecurityProps.conf'}


2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
# vim
.*.swp
.*.swo

emv-*
10 changes: 10 additions & 0 deletions lesson4_reading/erc4626/doIt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
echo -e "\n\n\n########### New execution ##########\n\n\n" >> results.out
echo -e "\n\n\n########### Started on $(date) ##########\n\n\n" >> results.out
git rev-parse HEAD >> results.out
git status --short >> results.out
for file in ./src/certora/conf-openzeppelin/*.conf
do
echo -e "\n\n\n" >> results.out
echo -e "Results for $file can be found at:" >> results.out
certoraRun "$file" >> results.out
done
13 changes: 13 additions & 0 deletions lesson4_reading/erc4626/gitCertoraRun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
certoraOutput=$(certoraRun "$@")

echo "$certoraOutput"

if [[ ${certoraOutput} != *"ERROR"* ]];then

certoraURL=$(echo $certoraOutput | sed -n 's/.*\(https:\/\/prover.certora.com\/output\/\)/\1/p')

git add -A

git commit -m "Results for run: $certoraURL with arguments $@"
echo $certoraURL
fi
Loading