Skip to content

Commit

Permalink
Merge pull request #16 from makerdao/v2
Browse files Browse the repository at this point in the history
Implement v2 for Lockstake
  • Loading branch information
sunbreak1211 authored Oct 23, 2024
2 parents c2345b7 + c8ab9cb commit 25b63b0
Show file tree
Hide file tree
Showing 29 changed files with 1,114 additions and 746 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 }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/out
/cache

# Certora
.certora_internal
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
[submodule "lib/dss-test"]
path = lib/dss-test
url = https://github.com/makerdao/dss-test
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
all :; DAPP_BUILD_OPTIMIZE=1 DAPP_BUILD_OPTIMIZE_RUNS=200 dapp --use solc:0.6.12 build
clean :; dapp clean
test :; ./test.sh $(match) $(runs)
deploy-mainnet :; make && dapp create VoteDelegateFactory 0x0a3f6849f78076aefaDf113F5BED87720274dDC0 0xD3A9FE267852281a1e6307a1C37CDfD76d39b133
deploy-kovan :; make && dapp create VoteDelegateFactory 0x27E0c9567729Ea6e3241DE74B3dE499b7ddd3fe6 0xD931E7c869618dB6FD30cfE4e89248CAA091Ea5f
flatten :; hevm flatten --source-file src/VoteDelegateFactory.sol > out/VoteDelegateFactory-flattened.sol
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,)
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
VoteDelegate based on https://github.com/makerdao/vote-proxy

Kovan Deploy: [0x1740F3bD55b1900C816A0071F8972C201566e3a3](https://kovan.etherscan.io/address/0x1740F3bD55b1900C816A0071F8972C201566e3a3#code)
Mainnet Deploy: [0xD897F108670903D1d6070fcf818f9db3615AF272](https://etherscan.io/address/0xD897F108670903D1d6070fcf818f9db3615AF272#code)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed audits/ABDK-MakerDAO-Vote Delegate.pdf
Binary file not shown.
31 changes: 31 additions & 0 deletions certora/VoteDelegate.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"files": [
"src/VoteDelegate.sol",
"certora/harness/GovMock.sol",
"certora/harness/IouMock.sol",
"certora/harness/ChiefMock.sol",
"certora/harness/PollingMock.sol"
],
"solc": "solc-0.8.21",
"solc_optimize_map": {
"VoteDelegate": "200",
"GovMock": "0",
"IouMock": "0",
"ChiefMock": "0",
"PollingMock": "0"
},
"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 25b63b0

Please # to comment.