Skip to content

Commit b3082cd

Browse files
authored
Merge pull request #1005 from ryzhak/ci/formal-verification
2 parents 336ad4e + 3f4bd49 commit b3082cd

File tree

5 files changed

+942
-0
lines changed

5 files changed

+942
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Formal Verification
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- development
9+
paths:
10+
- '**.sol'
11+
12+
jobs:
13+
verify:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v5
18+
with:
19+
submodules: recursive
20+
21+
# ====================
22+
# Project Dependencies
23+
# ====================
24+
25+
- name: Install Foundry
26+
uses: foundry-rs/foundry-toolchain@v1
27+
28+
- name: Install Project Dependencies
29+
run: |
30+
yarn install
31+
yarn workspace @ubiquity/contracts forge:install
32+
33+
# ====================
34+
# Certora Dependencies
35+
# ====================
36+
37+
- name: Install python
38+
uses: actions/setup-python@v6
39+
with: {
40+
python-version: 3.13
41+
}
42+
43+
- name: Install java
44+
uses: actions/setup-java@v5
45+
with: {
46+
java-version: "11",
47+
java-package: jre,
48+
distribution: temurin
49+
}
50+
51+
# It's recommended to pin the latest certora-cli version available in https://pypi.org/project/certora-cli/
52+
- name: Install certora cli
53+
run: pip install certora-cli==8.1.1
54+
55+
- name: Install solc
56+
run: |
57+
pip install solc-select
58+
solc-select install 0.8.19
59+
solc-select use 0.8.19
60+
- name: Verify
61+
env:
62+
CERTORAKEY: ${{ secrets.CERTORAKEY }}
63+
working-directory: ./packages/contracts
64+
run: certoraRun test/certora/staking.conf

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ _.log
22
_.pid
33
_.seed
44
.cache
5+
.certora_internal
56
.DS_Store
67
.dynamodb
78
.env
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.19;
3+
4+
import {StakingFacet} from "../../src/dollar/facets/StakingFacet.sol";
5+
import {AppStorage, LibAppStorage} from "../../src/dollar/libraries/LibAppStorage.sol";
6+
7+
/**
8+
* @notice Ubiquity staking facet harness
9+
*/
10+
contract StakingFacetHarness is StakingFacet {
11+
/**
12+
* @notice Returns reentrancy status, 1 - entered, 2 - not entered
13+
* @return Reentrancy status
14+
*/
15+
function exposed_getReentrancyStatus() external view returns (uint256) {
16+
AppStorage storage store = LibAppStorage.appStorage();
17+
return store.reentrancyStatus;
18+
}
19+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"files": [
3+
"src/dollar/Diamond.sol",
4+
"src/dollar/facets/AccessControlFacet.sol",
5+
"src/dollar/facets/ManagerFacet.sol",
6+
"src/dollar/facets/UbiquityPoolFacet.sol",
7+
"src/dollar/libraries/LibStaking.sol",
8+
"src/deprecated/UbiquityGovernance.sol",
9+
"src/deprecated/UbiquityAlgorithmicDollarManager.sol",
10+
"test/certora/StakingFacetHarness.sol",
11+
],
12+
"verify": "Diamond:test/certora/staking.spec",
13+
"contract_extensions": {
14+
"Diamond": [
15+
{
16+
"extension": "AccessControlFacet",
17+
"exclude": [],
18+
},
19+
{
20+
"extension": "ManagerFacet",
21+
"exclude": [],
22+
},
23+
{
24+
"extension": "StakingFacetHarness",
25+
"exclude": [],
26+
},
27+
{
28+
"extension": "UbiquityPoolFacet",
29+
"exclude": [],
30+
}
31+
]
32+
},
33+
"link": [
34+
"UbiquityGovernance:manager=UbiquityAlgorithmicDollarManager",
35+
],
36+
"parametric_contracts": [
37+
"Diamond",
38+
],
39+
"optimistic_loop": true,
40+
"rule_sanity": "basic",
41+
"msg": "staking.conf",
42+
}

0 commit comments

Comments
 (0)