Skip to content

Commit

Permalink
Certora Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
remedcu committed Feb 11, 2024
1 parent 7bb6601 commit 09861f3
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/certora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: certora

on:
push:
branches:
- main
pull_request:
branches:
- main

workflow_dispatch:

jobs:
verify:
runs-on: ubuntu-latest
strategy:
matrix:
rule: ['verifySplitter.sh']

steps:
- uses: actions/checkout@v3

- name: Install python
uses: actions/setup-python@v4
with: { python-version: 3.11 }

- name: Install java
uses: actions/setup-java@v3
with: { java-version: '17', java-package: jre, distribution: semeru }

- name: Install certora cli
run: pip install -Iv certora-cli==6.3.1

- name: Install solc
run: |
wget https://github.com/ethereum/solidity/releases/download/v0.8.23/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc8.23
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Verify rule ${{ matrix.rule }}
run: |
cd certora
make munged
cd ..
echo "key length" ${#CERTORAKEY}
chmod +x ./certora/scripts/${{ matrix.rule }}
./certora/scripts/${{ matrix.rule }}
env:
CERTORAKEY: ${{ secrets.CERTORA_KEY }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ script
out
.vscode
lcov.info
.certora_internal
3 changes: 2 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"rules": {
"prettier/prettier": "error",
"max-line-length": ["warn", 140],
"compiler-version": ["error", "^0.8.23"]
"compiler-version": "off",
"no-empty-blocks": "off"
}
}
1 change: 1 addition & 0 deletions certora/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
munged
16 changes: 16 additions & 0 deletions certora/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
default: help

CONTRACTS_DIR = ../src
MUNGED_DIR = munged

help:
@echo "usage:"
@echo " make clean: remove all generated files (those ignored by git)"
@echo " make munged: create $(MUNGED_DIR) directory"

munged: $(wildcard $(CONTRACTS_DIR)/*.sol)
rm -rf $@
cp -r $(CONTRACTS_DIR) $@

clean:
git clean -fdX
17 changes: 17 additions & 0 deletions certora/conf/splitter.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"files": [
"certora/harnesses/SplitterHarness.sol"
],
"hashing_length_bound": "352",
"loop_iter": "3",
"msg": "Splitter General Ruleset",
"optimistic_hashing": true,
"optimistic_loop": true,
"process": "emv",
"prover_args": [
" -optimisticFallback true -s z3 -copyLoopUnroll 5 -mediumTimeout 5 -depth 30"
],
"rule_sanity": "basic",
"solc": "solc8.23",
"verify": "SplitterHarness:certora/specs/Splitter.spec"
}
4 changes: 4 additions & 0 deletions certora/harnesses/SplitterHarness.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: LGPL-3.0-only
import {Splitter} from "../munged/Splitter.sol";

contract SplitterHarness is Splitter {}
12 changes: 12 additions & 0 deletions certora/scripts/verifySplitter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

params=("--send_only")

if [[ -n "$CI" ]]; then
params=()
fi

certoraRun certora/conf/splitter.conf \
"${params[@]}" \
--msg "Splitter $*" \
"$@"
3 changes: 3 additions & 0 deletions certora/specs/Splitter.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rule demo() {
assert true;
}

0 comments on commit 09861f3

Please sign in to comment.