Skip to content

Commit

Permalink
Add Certora specs + configure CI for tests and Certora
Browse files Browse the repository at this point in the history
  • Loading branch information
sunbreak1211 committed Oct 4, 2024
1 parent efc415c commit d60a326
Show file tree
Hide file tree
Showing 12 changed files with 648 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/certora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Certora

on: [push, pull_request]

jobs:
certora:
name: Certora
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
vote-delegate:
- vote-delegate
- vote-delegate-factory

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
java-package: jre

- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.8

- name: Install solc-select
run: pip3 install solc-select

- name: Solc Select 0.8.21
run: solc-select install 0.8.21

- name: Install Certora
run: pip3 install certora-cli-beta

- name: Verify ${{ matrix.vote-delegate }}
run: make certora-${{ matrix.vote-delegate }} results=1
env:
CERTORAKEY: ${{ secrets.CERTORAKEY }}
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: test

on: [push, pull_request]

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test
env:
ETH_RPC_URL: ${{ secrets.ETH_RPC_URL }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/out
/cache

# Certora
.certora_internal
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PATH := ~/.solc-select/artifacts/solc-0.8.21:$(PATH)
certora-vote-delegate :; PATH=${PATH} certoraRun certora/VoteDelegate.conf$(if $(rule), --rule $(rule),)$(if $(results), --wait_for_results all,)
certora-vote-delegate-factory :; PATH=${PATH} certoraRun certora/VoteDelegateFactory.conf$(if $(rule), --rule $(rule),)$(if $(results), --wait_for_results all,)
37 changes: 37 additions & 0 deletions certora/VoteDelegate.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"files": [
"src/VoteDelegate.sol",
"certora/harness/GovMock.sol",
"certora/harness/IouMock.sol",
"certora/harness/ChiefMock.sol",
"certora/harness/PollingMock.sol"
],
"solc_map": {
"VoteDelegate": "solc-0.8.21",
"GovMock": "solc-0.8.21",
"IouMock": "solc-0.8.21",
"ChiefMock": "solc-0.8.21",
"PollingMock": "solc-0.8.21"
},
"solc_optimize_map": {
"VoteDelegate": "200",
"GovMock": "200",
"IouMock": "200",
"ChiefMock": "200",
"PollingMock": "200"
},
"link": [
"VoteDelegate:gov=GovMock",
"VoteDelegate:chief=ChiefMock",
"VoteDelegate:polling=PollingMock",
"ChiefMock:GOV=GovMock",
"ChiefMock:IOU=IouMock"
],
"verify": "VoteDelegate:certora/VoteDelegate.spec",
"rule_sanity": "basic",
"optimistic_loop": true,
"multi_assert_check": true,
"parametric_contracts": ["VoteDelegate"],
"build_cache": true,
"msg": "VoteDelegate"
}
Loading

0 comments on commit d60a326

Please sign in to comment.