Skip to content

Commit cf7a8b6

Browse files
authored
chore(ci): add certora CI integration (#40)
1 parent d9a6455 commit cf7a8b6

File tree

6 files changed

+70
-1
lines changed

6 files changed

+70
-1
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ Ensure you completed **all of the steps** below before submitting your pull requ
1010
- [ ] Ran `forge snapshot`?
1111
- [ ] Ran `pnpm lint`?
1212
- [ ] Ran `forge test`?
13+
- [ ] Ran `pnpm verify`?

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
push:
1111
branches:
1212
- "main"
13+
- "develop"
1314

1415
jobs:
1516
lint:
@@ -117,3 +118,51 @@ jobs:
117118
run: |
118119
echo "## Coverage result" >> $GITHUB_STEP_SUMMARY
119120
echo "✅ Uploaded to Codecov" >> $GITHUB_STEP_SUMMARY
121+
verify:
122+
needs: ["lint", "build"]
123+
runs-on: ubuntu-latest
124+
125+
steps:
126+
- uses: actions/checkout@v3
127+
with:
128+
submodules: recursive
129+
130+
- name: Install Python
131+
uses: actions/setup-python@v2
132+
with: { python-version: 3.9 }
133+
134+
- name: Install Java
135+
uses: actions/setup-java@v1
136+
with: { java-version: "11", java-package: jre }
137+
138+
- name: Install Certora CLI
139+
run: pip3 install certora-cli==5.0.5
140+
141+
- name: Install Solidity
142+
run: |
143+
wget https://github.com/ethereum/solidity/releases/download/v0.8.19/solc-static-linux
144+
chmod +x solc-static-linux
145+
sudo mv solc-static-linux /usr/local/bin/solc
146+
147+
- name: "Install Pnpm"
148+
uses: "pnpm/action-setup@v2"
149+
with:
150+
version: "8"
151+
152+
- name: "Install Node.js"
153+
uses: "actions/setup-node@v3"
154+
with:
155+
cache: "pnpm"
156+
node-version: "lts/*"
157+
158+
- name: "Install the Node.js dependencies"
159+
run: "pnpm install"
160+
161+
- name: Verify rules
162+
run: "pnpm verify"
163+
env:
164+
CERTORAKEY: ${{ secrets.CERTORAKEY }}
165+
166+
strategy:
167+
fail-fast: false
168+
max-parallel: 16

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ artifacts
2222
typechain
2323
typechain-types
2424
gmx-contracts
25+
26+
.certora_internal

certora/certora.conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"files": ["contracts/StakeManager.sol"],
3+
"msg": "Verifying StakeManager.sol",
4+
"rule_sanity": "basic",
5+
"verify": "StakeManager:certora/specs/StakeManager.spec",
6+
"wait_for_results": "all",
7+
"packages": [
8+
"@openzeppelin=lib/openzeppelin-contracts"
9+
]
10+
}
11+
12+

certora/specs/StakeManager.spec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
rule shouldPass {
3+
assert true;
4+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"scripts": {
2121
"clean": "rm -rf cache out",
2222
"lint": "pnpm lint:sol && pnpm prettier:check",
23-
"lint:sol": "forge fmt --check && pnpm solhint {script,src,test}/**/*.sol",
23+
"verify": "certoraRun certora/certora.conf",
24+
"lint:sol": "forge fmt --check && pnpm solhint {script,src,test,certora}/**/*.sol",
2425
"prettier:check": "prettier --check **/*.{json,md,yml} --ignore-path=.prettierignore",
2526
"prettier:write": "prettier --write **/*.{json,md,yml} --ignore-path=.prettierignore"
2627
}

0 commit comments

Comments
 (0)