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

Add initial LockstakeEngine/Urn/Clipper logic + tests #1

Merged
merged 111 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
38a06e2
Add initial LockstakeEngine/Urn/Clipper logic + tests
sunbreak1211 Sep 22, 2023
c2d9b4f
Rename ngt to more general gov wording
sunbreak1211 Nov 22, 2023
b305879
Fix error message
sunbreak1211 Nov 23, 2023
a0f93ed
Fix typo
sunbreak1211 Nov 24, 2023
642445b
Create urn and allow to operate without defined delegate (#3)
sunbreak1211 Nov 27, 2023
b69c955
Add some variable renaming + test some error messages
sunbreak1211 Nov 28, 2023
5cda4c3
Minors
sunbreak1211 Dec 8, 2023
d3e4a6b
Use solidity to crete urn
sunbreak1211 Dec 8, 2023
fae2bea
Add receiver parameter to free
sunbreak1211 Dec 8, 2023
35ccc9d
Modify event for extra parameter of free
sunbreak1211 Dec 8, 2023
7bfb412
Add receiver parameter to getReward
sunbreak1211 Dec 8, 2023
2527ae7
Don't allow to keep staking when farm is removed by admin
sunbreak1211 Dec 8, 2023
4464593
Change order in free to match reversed one from lock
sunbreak1211 Dec 8, 2023
6ab1d9e
Change comment
sunbreak1211 Dec 10, 2023
c2bff63
selectedFarm => urnFarms
sunbreak1211 Dec 12, 2023
c7fa375
Remove unnecessary require
sunbreak1211 Dec 12, 2023
fae51fb
Allow other address to do urn management (#5)
sunbreak1211 Dec 13, 2023
87b9a68
Test name fixes
sunbreak1211 Dec 20, 2023
bc63780
Add multicall and converter in LockstakeEngine (#7)
oldchili Dec 20, 2023
27766ef
Stake everything or nothing (#25)
sunbreak1211 Jan 9, 2024
917420f
Missign stkGov => stkMkr renaming
sunbreak1211 Jan 9, 2024
5f6051b
Use EIP1167 for urn (#8)
telome Jan 9, 2024
e5359c8
Add engine to the excluded contracts for clipper callback
sunbreak1211 Jan 9, 2024
9ee2177
Remove unused events
sunbreak1211 Jan 9, 2024
1507751
Add index value to Open event
sunbreak1211 Jan 9, 2024
f825162
Remove unnecessary casting
sunbreak1211 Jan 9, 2024
a1e9bb2
Add to param to draw
sunbreak1211 Jan 9, 2024
098c159
Fix in test
sunbreak1211 Jan 10, 2024
876c2cc
Add require fee <= WAD and use unchecked for substracting burn amount…
sunbreak1211 Jan 10, 2024
3b9455e
Minor comment change
sunbreak1211 Jan 10, 2024
c02ea6d
Add test for clipper
sunbreak1211 Jan 10, 2024
f71497d
Add overflow checks
sunbreak1211 Jan 11, 2024
e3b3079
Comment changes
sunbreak1211 Jan 15, 2024
6286d59
Add return value to getReward
sunbreak1211 Jan 15, 2024
5db99ec
Move comment
sunbreak1211 Jan 15, 2024
15eb08f
Some changes to onTakeLeftovers
sunbreak1211 Jan 15, 2024
81613e9
Improve testing structure
sunbreak1211 Jan 15, 2024
32309af
Check missing events in tests
sunbreak1211 Jan 16, 2024
977123e
Improve testConstructor
sunbreak1211 Jan 16, 2024
28143e9
Check urnImplementation in testConstructor
sunbreak1211 Jan 17, 2024
60a54e0
Improve tests
sunbreak1211 Jan 17, 2024
b60cf82
Remove comment
sunbreak1211 Jan 18, 2024
64a14dc
More minor test changes + new one
sunbreak1211 Jan 19, 2024
4113d3b
Minor changes in tests
sunbreak1211 Jan 22, 2024
e807ca2
Blocking farm/delegate re-selection during auctions (#27)
oldchili Jan 24, 2024
bbe569d
Migrate through user function (#26)
oldchili Jan 26, 2024
0ae0af0
Implement a more standard yank (#28)
sunbreak1211 Jan 30, 2024
e1c68db
Upgrade dss-test
sunbreak1211 Feb 1, 2024
ed8192d
Add deploy scripts + improvements on tests (#29)
sunbreak1211 Feb 1, 2024
153289c
Verify farm for reward with enum (#33)
oldchili Feb 6, 2024
9ef08e3
Fix burn calculation in onRemove
sunbreak1211 Feb 12, 2024
7e8b1f9
Make wipe permissionless and not calling drip anymore
sunbreak1211 Feb 12, 2024
b64a032
Add wipeAll
sunbreak1211 Feb 19, 2024
b59f967
Check urn safety to allow change delegate
sunbreak1211 Feb 21, 2024
6fbdca9
Force fee to be less than WAD
sunbreak1211 Feb 21, 2024
e2814c9
Minor changes to wipeAll + improving test
sunbreak1211 Feb 23, 2024
55921bc
Minor changes to test
sunbreak1211 Feb 23, 2024
290e108
Allow selectDelegate when urn is unsafe but new address is address(0)
sunbreak1211 Mar 4, 2024
0c7aebf
Fix: query mkr address from a correct contract
sunbreak1211 Mar 13, 2024
48dd100
Change visibility for better consistency
sunbreak1211 Mar 13, 2024
9c33a83
Fix VoteDelegateFactory mock and do a full renaming (#35)
sunbreak1211 Mar 13, 2024
86ea4a8
Add LockstakeMkr (#36)
sunbreak1211 Mar 19, 2024
675c750
Minor text changes
sunbreak1211 Apr 4, 2024
4e5945c
Return address cast in interface
sunbreak1211 Apr 4, 2024
8de47d8
LSMKR => lsMKR
sunbreak1211 Apr 4, 2024
9ce2160
Change error message
sunbreak1211 Apr 4, 2024
91dddc5
Minor change
sunbreak1211 Apr 4, 2024
cd64098
Add comment to _divup
sunbreak1211 Apr 4, 2024
5cc4fa3
Comment changes
sunbreak1211 Apr 5, 2024
e5a44bf
Minor changes to free and freeNgt
sunbreak1211 Apr 8, 2024
136b435
Change error message
sunbreak1211 Apr 8, 2024
a21be78
Lockstake Engine Readme (#6)
oldchili Apr 9, 2024
cda77bb
Update token-tests (#40)
telome Apr 9, 2024
437258c
selectDelegate => selectVoteDelegate in README
oldchili Apr 10, 2024
6ce726e
Fix spacings
sunbreak1211 Apr 10, 2024
e44f62b
Add unchecked in clipper.kick
sunbreak1211 Apr 10, 2024
65d53d6
Improve LockstakeClipper test coverage (#41)
telome Apr 11, 2024
8716226
Make lock/lockNgt permissionless (#43)
sunbreak1211 Apr 15, 2024
f07f45c
README fixes for CS audit (#44)
oldchili Apr 16, 2024
2c71bf9
Remove comments
sunbreak1211 Apr 16, 2024
7fdfd5c
Deployment scripts: Add OsmMom (#46)
sunbreak1211 Apr 23, 2024
e967ab2
Invariant Testing (#11)
oldchili Apr 26, 2024
ca0c577
Use solc 0.8.21 + upgrade token-tests and fix warnings due to it + re…
sunbreak1211 Apr 26, 2024
2d9163c
Use real MKR in tests
sunbreak1211 May 3, 2024
05ee579
Check staking token for added farms in scripts (#49)
sunbreak1211 May 13, 2024
d8b2aeb
Add CS audit
sunbreak1211 May 20, 2024
735e1e8
Readme comment that converter is assumed to work as expected (#50)
oldchili May 20, 2024
d93b7f7
Use named params for LockstakeEngine mappings
sunbreak1211 Jun 3, 2024
5132023
Add comment in README about Chief's IOU tokens
sunbreak1211 Jun 3, 2024
d2e3c59
Add comment in README about redelegation and restaking
sunbreak1211 Jun 3, 2024
f240c59
Add comment in getUrn
sunbreak1211 Jun 3, 2024
98fd542
Add check to deploy scripts
sunbreak1211 Jun 3, 2024
d3878d4
Extend Multicall revert handling
sunbreak1211 Jun 3, 2024
739c497
Minor change to a mock
sunbreak1211 Jun 3, 2024
f83e7fb
Minor changes
sunbreak1211 Jun 4, 2024
de66d6f
Check in init script for tip
sunbreak1211 Jun 5, 2024
f11051e
Add Cantina report (#52)
oldchili Jun 27, 2024
84d5b98
Add a few Readme comments (#53)
oldchili Jun 27, 2024
39dbea9
Remove up to date implementation links (#54)
oldchili Jul 5, 2024
cbb2671
Update CS Report (#56)
oldchili Aug 5, 2024
5d3eea5
Configurable exit fee (#55)
oldchili Aug 20, 2024
8b16eac
Post contest updates (#57)
sunbreak1211 Aug 22, 2024
7c71318
Renaming (#59)
sunbreak1211 Aug 27, 2024
7a93cb4
Update CS audit report (#60)
sunbreak1211 Sep 9, 2024
304c885
Add new Cantina audit report (#61)
oldchili Sep 10, 2024
445cd30
Add Sherlock Report (#62)
oldchili Sep 19, 2024
9eb3e26
Add Certora specs (#48)
sunbreak1211 Oct 21, 2024
445b08a
Fix tests after spell cast + minor update on README
sunbreak1211 Oct 21, 2024
444e723
Certora: minor changes
sunbreak1211 Oct 22, 2024
2e6e3e8
Certora: Improve PATH compatibility
sunbreak1211 Oct 25, 2024
745ffd7
Adjust Certora flags
sunbreak1211 Nov 12, 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
54 changes: 54 additions & 0 deletions .github/workflows/certora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Certora

on: [push, pull_request]

jobs:
certora:
name: Certora
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
lockstake:
- urn
- lsmkr
- engine
- engine-multicall
- clipper

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: Solc Select 0.6.12
run: solc-select install 0.6.12

- name: Solc Select 0.5.12
run: solc-select install 0.5.12

- name: Install Certora
run: pip3 install certora-cli-beta

- name: Verify ${{ matrix.lockstake }}
run: make certora-${{ matrix.lockstake }} results=1
env:
CERTORAKEY: ${{ secrets.CERTORAKEY }}
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: test

on: workflow_dispatch
on: [push, pull_request]

env:
FOUNDRY_PROFILE: ci
Expand Down Expand Up @@ -32,3 +32,5 @@ jobs:
run: |
forge test -vvv
id: test
env:
ETH_RPC_URL: ${{ secrets.ETH_RPC_URL }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ docs/

# Dotenv file
.env

# Certora
.certora_internal

# Vim
.*.swp
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "lib/dss-test"]
path = lib/dss-test
url = https://github.com/makerdao/dss-test
[submodule "lib/token-tests"]
path = lib/token-tests
url = https://github.com/makerdao/token-tests/
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PATH := ~/.solc-select/artifacts/:~/.solc-select/artifacts/solc-0.5.12:~/.solc-select/artifacts/solc-0.6.12:~/.solc-select/artifacts/solc-0.8.21:$(PATH)
certora-urn :; PATH=${PATH} certoraRun certora/LockstakeUrn.conf$(if $(rule), --rule $(rule),)$(if $(results), --wait_for_results all,)
certora-lsmkr :; PATH=${PATH} certoraRun certora/LockstakeMkr.conf$(if $(rule), --rule $(rule),)$(if $(results), --wait_for_results all,)
certora-engine :; PATH=${PATH} certoraRun certora/LockstakeEngine.conf$(if $(rule), --rule $(rule),)$(if $(results), --wait_for_results all,)
certora-engine-multicall :; PATH=${PATH} certoraRun certora/LockstakeEngineMulticall.conf$(if $(rule), --rule $(rule),)$(if $(results), --wait_for_results all,)
certora-clipper :; PATH=${PATH} certoraRun certora/LockstakeClipper.conf$(if $(rule), --rule $(rule),)$(if $(results), --wait_for_results all,)
225 changes: 225 additions & 0 deletions README.md

Large diffs are not rendered by default.

Binary file added audit/20240626-cantina-report-maker-LSE.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
88 changes: 88 additions & 0 deletions certora/LockstakeClipper.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"files": [
"src/LockstakeClipper.sol",
"src/LockstakeEngine.sol",
"src/LockstakeUrn.sol",
"src/LockstakeMkr.sol",
"certora/harness/dss/Vat.sol",
"certora/harness/dss/Spotter.sol",
"certora/harness/dss/Dog.sol",
"certora/harness/dss/ClipperCallee.sol:BadGuy",
"certora/harness/dss/ClipperCallee.sol:RedoGuy",
"certora/harness/dss/ClipperCallee.sol:KickGuy",
"certora/harness/dss/ClipperCallee.sol:FileUintGuy",
"certora/harness/dss/ClipperCallee.sol:FileAddrGuy",
"certora/harness/dss/ClipperCallee.sol:YankGuy",
"test/mocks/VoteDelegateMock.sol",
"certora/harness/tokens/MkrMock.sol",
"test/mocks/StakingRewardsMock.sol"
],
"solc_map": {
"LockstakeClipper": "solc-0.8.21",
"LockstakeEngine": "solc-0.8.21",
"LockstakeUrn": "solc-0.8.21",
"LockstakeMkr": "solc-0.8.21",
"Vat": "solc-0.5.12",
"Spotter": "solc-0.5.12",
"Dog": "solc-0.6.12",
"BadGuy": "solc-0.8.21",
"RedoGuy": "solc-0.8.21",
"KickGuy": "solc-0.8.21",
"FileUintGuy": "solc-0.8.21",
"FileAddrGuy": "solc-0.8.21",
"YankGuy": "solc-0.8.21",
"VoteDelegateMock": "solc-0.8.21",
"MkrMock": "solc-0.8.21",
"StakingRewardsMock": "solc-0.8.21"
},
"solc_optimize_map": {
"LockstakeClipper": "200",
"LockstakeEngine": "200",
"LockstakeUrn": "200",
"LockstakeMkr": "200",
"Vat": "0",
"Spotter": "0",
"Dog": "0",
"BadGuy": "0",
"RedoGuy": "0",
"KickGuy": "0",
"FileUintGuy": "0",
"FileAddrGuy": "0",
"YankGuy": "0",
"VoteDelegateMock": "0",
"MkrMock": "0",
"StakingRewardsMock": "0",
},
"link": [
"LockstakeClipper:vat=Vat",
"LockstakeClipper:engine=LockstakeEngine",
"LockstakeClipper:dog=Dog",
"LockstakeClipper:spotter=Spotter",
"LockstakeEngine:vat=Vat",
"LockstakeEngine:mkr=MkrMock",
"LockstakeEngine:lsmkr=LockstakeMkr",
"LockstakeUrn:engine=LockstakeEngine",
"VoteDelegateMock:gov=MkrMock",
"StakingRewardsMock:stakingToken=LockstakeMkr",
"Dog:vat=Vat",
"BadGuy:clip=LockstakeClipper",
"RedoGuy:clip=LockstakeClipper",
"KickGuy:clip=LockstakeClipper",
"FileUintGuy:clip=LockstakeClipper",
"FileAddrGuy:clip=LockstakeClipper",
"YankGuy:clip=LockstakeClipper"
],
"verify": "LockstakeClipper:certora/LockstakeClipper.spec",
"prover_args": [
"-rewriteMSizeAllocations true"
],
"smt_timeout": "7000",
"rule_sanity": "basic",
"optimistic_loop": true,
"optimistic_contract_recursion": true,
"contract_recursion_limit": "2",
"multi_assert_check": true,
"parametric_contracts": ["LockstakeClipper"],
"build_cache": true,
"msg": "LockstakeClipper"
}
Loading
Loading