Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement v2 for Lockstake #16

Merged
merged 36 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
df6f710
Remove ds-test
sunbreak1211 Oct 25, 2023
0224caf
forge install: dss-test
sunbreak1211 Oct 25, 2023
0bf1da5
Changes for V2
sunbreak1211 Oct 26, 2023
782e613
Remove comments
sunbreak1211 Jan 8, 2024
a51f390
Minor changes
sunbreak1211 Feb 27, 2024
197106f
Fix copyright year
sunbreak1211 Feb 27, 2024
ba3c300
Add testConstructor
sunbreak1211 Feb 27, 2024
5f8c76f
Test Lock and Free events
sunbreak1211 Feb 27, 2024
3129ccb
Change comment
sunbreak1211 Feb 27, 2024
c98ed1c
Minor changes to lock and free
sunbreak1211 Feb 27, 2024
8fa3418
Minor changes to tests
sunbreak1211 Feb 27, 2024
39d9af1
More minor changes for tests
sunbreak1211 Feb 27, 2024
2aafc61
Add CreateVoteDelegate event back
sunbreak1211 Feb 28, 2024
2f53049
Remove return value of interface
sunbreak1211 Feb 28, 2024
4bd338a
Remove unused functions from interface
sunbreak1211 Feb 28, 2024
fdc2cbf
Put salt inline
sunbreak1211 Feb 28, 2024
b644f59
Set event right exactly as was before
sunbreak1211 Feb 28, 2024
ca3cb3b
Rename variable with a proper name
sunbreak1211 Feb 28, 2024
9cc80ec
Fix renaming
sunbreak1211 Feb 28, 2024
350f279
Minor changes to tests
sunbreak1211 Feb 28, 2024
bcef5e6
Add checks back to test
sunbreak1211 Feb 29, 2024
b59e5be
Add delegates getter to the factory to keep compatibility with prev v…
sunbreak1211 Feb 29, 2024
edf24ce
Change comment position
sunbreak1211 Feb 29, 2024
c01dda0
Reserve free window (aka hatch), then enforce cool-down (#18)
oldchili Apr 12, 2024
d2db093
Add uncommited change to VoteDelegate.t.sol
oldchili Apr 17, 2024
9519c82
Use solc 0.8.21 + upgrade dss-tests and fix warnings due to it (#19)
sunbreak1211 Apr 26, 2024
d6e563f
Add CS audit
sunbreak1211 May 20, 2024
63700ad
Post Cantina Audit Minor Changes (#20)
oldchili Jun 24, 2024
4484057
Add Cantina Report (#21)
oldchili Jul 3, 2024
67a7d64
Update CS Report (#22)
oldchili Aug 5, 2024
01e7b57
Use regular create in VoteDelegateFactory (#23)
oldchili Aug 15, 2024
64dfa96
Update CS audit report (#24)
sunbreak1211 Sep 9, 2024
3fba35c
Add Cantina updates audit report (#25)
sunbreak1211 Sep 9, 2024
efc415c
Add Sherlock Report (#26)
oldchili Sep 19, 2024
2a585d7
Add Certora specs + configure CI for tests and Certora (#27)
sunbreak1211 Oct 21, 2024
c8ab9cb
Certora: Minor change
sunbreak1211 Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading