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

Yash/slashing full history pre devnet squash #839

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
3644661
chore: move custom errors to sep branch
8sunyuan Sep 12, 2024
8372390
chore: forge fmt src/contracts
8sunyuan Sep 12, 2024
47f3fd8
fix: ci and bindings
8sunyuan Sep 12, 2024
d120e1c
chore: dmgr error tweaks
wadealexc Sep 12, 2024
8e37cb0
chore: error tweaks for consistency and clarity
wadealexc Sep 12, 2024
13f06b9
feat: bump oz version (#755)
0xClandestine Sep 17, 2024
8c8df19
test: custom errors passing (#783)
0xClandestine Sep 27, 2024
177ad8b
refactor: review reconciliation
0xClandestine Sep 27, 2024
17331fe
refactor: review reconciliation
0xClandestine Sep 27, 2024
acd1831
refactor: review reconciliation
0xClandestine Sep 27, 2024
cc96e9f
chore: forge fmt src/contracts
0xClandestine Sep 27, 2024
069c669
feat: slashing
gpsanant Sep 25, 2024
c27004e
feat: dm cleanup (#788)
ypatil12 Oct 4, 2024
bafea9d
Revert "feat: dm cleanup (#788)" (#799)
gpsanant Oct 4, 2024
365a776
fix: compiles (#800)
gpsanant Oct 4, 2024
e6c3193
fix: refactor (#801)
gpsanant Oct 7, 2024
e40c660
rename
gpsanant Oct 7, 2024
3c25b07
test: generally compiling + AVSM unit tests compiling
0xClandestine Oct 7, 2024
f666d45
chore: forge fmt src/contracts
0xClandestine Oct 7, 2024
6f60bb7
add events, fix bugs, abstract better (#806)
gpsanant Oct 8, 2024
b785873
test(wip): generally compiling
0xClandestine Oct 8, 2024
7cbf106
update docs (#804)
gpsanant Oct 8, 2024
54a1a3b
fix: revert change to event
wadealexc Oct 8, 2024
71e6d41
feat: am refactor
wadealexc Oct 8, 2024
7e167f7
add to wads to slash
gpsanant Oct 8, 2024
5212e5e
cleanup
gpsanant Oct 8, 2024
0174de5
refactor: change totalMagnitude to maxMagnitude
wadealexc Oct 8, 2024
2011e0c
remove unused eigenpod storage
gpsanant Oct 8, 2024
0d22a4f
chore: storage report (#809)
0xClandestine Oct 8, 2024
4247734
feat: eip712 fixes (#808)
0xClandestine Oct 8, 2024
369775f
test: slashing tests passing (#812)
0xClandestine Oct 9, 2024
a5f07a4
fix: merge issues
0xClandestine Oct 9, 2024
21168eb
update events
gpsanant Oct 9, 2024
be94cd6
refactor: rename total magnitudes to max magnitudes
wadealexc Oct 10, 2024
04b52ef
refactor: reorder functions to match interface
wadealexc Oct 10, 2024
ae1f20a
fix: remove memory overwrite bug in delegation manager
wadealexc Oct 10, 2024
fb41258
chore: forge fmt
wadealexc Oct 10, 2024
a9429b1
refactor: clean up getDepositedShare logic
wadealexc Oct 10, 2024
1f6c66e
chore: remove old oz + forge update foundry-rs/forge-std
0xClandestine Oct 10, 2024
8f090f4
feat: replace getSlashableMagnitudes with general purpose allocation …
wadealexc Oct 10, 2024
cfdf90e
Feat: SM/StrategyBase Unit Tests + Formatting (#813)
ypatil12 Oct 10, 2024
5c6ca60
refactor: delegation manager refactors
wadealexc Oct 10, 2024
b88286e
test: AllocationManager progress
0xClandestine Oct 11, 2024
890b933
feat: change event names
gpsanant Oct 11, 2024
64f3914
feat: update doc
gpsanant Oct 11, 2024
dec2ac0
fix: compile
0xClandestine Oct 11, 2024
cbb79a9
test: AllocationManager progress
0xClandestine Oct 11, 2024
47a4ff5
fix: tests progress
0xClandestine Oct 11, 2024
5b4d415
add Strategy <> OperatorSet mapping in storage, and APIs and events (…
bowenli86 Oct 12, 2024
4e6b659
Slashing: DM Happy Path Test Cases (#815)
ypatil12 Oct 13, 2024
3f27481
Add view funcs (#816)
gpsanant Oct 14, 2024
c2ea4a8
test: fix avsD tests (#817)
ypatil12 Oct 14, 2024
6e3405f
chore: format
ypatil12 Oct 14, 2024
f8bfa8c
fix: from scratch deploy
ypatil12 Oct 14, 2024
c3ab52f
feat: add shares to slashing event
gpsanant Oct 15, 2024
e45a6ad
Slashing: Modify Allocations Happy Path Tests (#821)
ypatil12 Oct 15, 2024
06e852f
slashing: allocation delay happy path tests (#822)
ypatil12 Oct 15, 2024
157b84a
feat: wadSlashed (#820)
gpsanant Oct 15, 2024
d33b1ac
Slashing: Clear Modification Queue Happy Path Tests (#823)
ypatil12 Oct 15, 2024
1ac0c6d
test: basic allocation tests (#824)
ypatil12 Oct 15, 2024
e914b6c
feat: inheritdoc
0xClandestine Oct 15, 2024
ebb8d97
refactor: alm test cleanup
0xClandestine Oct 15, 2024
c3c2a74
test: multiple allocations, only one slashed
ypatil12 Oct 15, 2024
75e3bb1
test: one pending alloc, slash
ypatil12 Oct 15, 2024
08cf29d
test: revert bound refactor so tests pass
ypatil12 Oct 15, 2024
3f6adfb
Slashing: Add additional happy path AM test cases (#828)
ypatil12 Oct 16, 2024
709a191
Slashing: Get all tests passing (#829)
ypatil12 Oct 16, 2024
5c8476e
Fix misset storage gaps (#831)
nadir-akhtar Oct 16, 2024
dc7e929
fix: update coverage yml name (#833)
ypatil12 Oct 16, 2024
c54fd93
Fix: Single Deallocation Queue (#827)
ypatil12 Oct 16, 2024
80809db
Feat: Update legacy withdrawal timestamp param to legacy withdrawal c…
ypatil12 Oct 16, 2024
8ff97ee
Feat: Public Devnet Deploy (#838)
ypatil12 Oct 17, 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
2 changes: 1 addition & 1 deletion .github/workflows/certora-prover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Install solc
run: |
pip install solc-select
solc-select use 0.8.12 --always-install
solc-select use 0.8.27 --always-install
- name: Verify rule ${{ matrix.params }}
run: |
bash ${{ matrix.params }}
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

run-tests:
run-coverage:
needs: prepare
runs-on: ubuntu-latest
strategy:
Expand All @@ -26,19 +26,20 @@ jobs:
id: get_issue_number
with:
script: |
if (context.issue && context.issue.number) {
// Return issue number if present
return context.issue.number;
let issue_number;
// Attempt to find a pull request associated with the commit
const pullRequests = await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
});
if (pullRequests.data.length > 0) {
issue_number = pullRequests.data[0].number;
} else {
// Otherwise return issue number from commit
return (
await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
})
).data[0].number;
throw new Error('No associated issue or pull request found.');
}
return issue_number;
result-encoding: string
- name: Checkout code
uses: actions/checkout@v2
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ InheritanceGraph.png
surya_report.md

.idea

*state.json
deployed_strategies.json
populate_src*
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/ds-test"]
path = lib/ds-test
url = https://github.com/dapphub/ds-test
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts-v4.9.0"]
path = lib/openzeppelin-contracts-v4.9.0
url = https://github.com/OpenZeppelin/openzeppelin-contracts
Expand Down
1 change: 0 additions & 1 deletion .solhintignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
Slasher.sol
2 changes: 1 addition & 1 deletion certora/harnesses/DelegationManagerHarness.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;
pragma solidity ^0.8.27;

import "../../src/contracts/core/DelegationManager.sol";

Expand Down
2 changes: 1 addition & 1 deletion certora/harnesses/EigenPodHarness.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;
pragma solidity ^0.8.27;

import "../../src/contracts/pods/EigenPod.sol";

Expand Down
2 changes: 1 addition & 1 deletion certora/harnesses/EigenPodManagerHarness.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;
pragma solidity ^0.8.27;

import "../../src/contracts/pods/EigenPodManager.sol";

Expand Down
2 changes: 1 addition & 1 deletion certora/harnesses/PausableHarness.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;
pragma solidity ^0.8.27;

import "../../src/contracts/permissions/Pausable.sol";

Expand Down
85 changes: 0 additions & 85 deletions certora/harnesses/SlasherHarness.sol

This file was deleted.

2 changes: 1 addition & 1 deletion certora/harnesses/StrategyManagerHarness.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;
pragma solidity ^0.8.27;

import "../../src/contracts/core/StrategyManager.sol";

Expand Down
4 changes: 2 additions & 2 deletions certora/scripts/core/verifyDelegationManager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ then
RULE="--rule $2"
fi

solc-select use 0.8.12
solc-select use 0.8.27

certoraRun certora/harnesses/DelegationManagerHarness.sol \
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol lib/openzeppelin-contracts/contracts/mocks/ERC1271WalletMock.sol \
src/contracts/pods/EigenPodManager.sol src/contracts/pods/EigenPod.sol src/contracts/strategies/StrategyBase.sol src/contracts/core/StrategyManager.sol \
src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
src/contracts/permissions/PauserRegistry.sol \
--verify DelegationManagerHarness:certora/specs/core/DelegationManager.spec \
--solc_via_ir \
--solc_optimize 1 \
Expand Down
4 changes: 2 additions & 2 deletions certora/scripts/core/verifyStrategyManager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ then
RULE="--rule $2"
fi

solc-select use 0.8.12
solc-select use 0.8.27

certoraRun certora/harnesses/StrategyManagerHarness.sol \
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol lib/openzeppelin-contracts/contracts/mocks/ERC1271WalletMock.sol \
src/contracts/pods/EigenPodManager.sol src/contracts/pods/EigenPod.sol \
src/contracts/strategies/StrategyBase.sol src/contracts/core/DelegationManager.sol \
src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
src/contracts/permissions/PauserRegistry.sol \
--verify StrategyManagerHarness:certora/specs/core/StrategyManager.spec \
--solc_via_ir \
--solc_optimize 1 \
Expand Down
2 changes: 1 addition & 1 deletion certora/scripts/libraries/verifyStructuredLinkedList.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ then
RULE="--rule $2"
fi

solc-select use 0.8.12
solc-select use 0.8.27

certoraRun certora/harnesses/StructuredLinkedListHarness.sol \
--verify StructuredLinkedListHarness:certora/specs/libraries/StructuredLinkedList.spec \
Expand Down
2 changes: 1 addition & 1 deletion certora/scripts/permissions/verifyPausable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ then
RULE="--rule $2"
fi

solc-select use 0.8.12
solc-select use 0.8.27

certoraRun certora/harnesses/PausableHarness.sol \
src/contracts/permissions/PauserRegistry.sol \
Expand Down
4 changes: 2 additions & 2 deletions certora/scripts/pods/verifyEigenPod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ then
RULE="--rule $2"
fi

# solc-select use 0.8.12
# solc-select use 0.8.27

# certoraRun certora/harnesses/EigenPodHarness.sol \
# src/contracts/core/DelegationManager.sol src/contracts/pods/EigenPodManager.sol \
# src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
# src/contracts/permissions/PauserRegistry.sol \
# src/contracts/core/StrategyManager.sol \
# src/contracts/strategies/StrategyBase.sol \
# lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol \
Expand Down
4 changes: 2 additions & 2 deletions certora/scripts/pods/verifyEigenPodManager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ then
RULE="--rule $2"
fi

# solc-select use 0.8.12
# solc-select use 0.8.27

# certoraRun certora/harnesses/EigenPodManagerHarness.sol \
# src/contracts/core/DelegationManager.sol src/contracts/pods/EigenPod.sol src/contracts/strategies/StrategyBase.sol src/contracts/core/StrategyManager.sol \
# src/contracts/core/Slasher.sol src/contracts/permissions/PauserRegistry.sol \
# src/contracts/permissions/PauserRegistry.sol \
# --verify EigenPodManagerHarness:certora/specs/pods/EigenPodManager.spec \
# --optimistic_loop \
# --optimistic_fallback \
Expand Down
3 changes: 1 addition & 2 deletions certora/scripts/strategies/verifyStrategyBase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ then
RULE="--rule $2"
fi

solc-select use 0.8.12
solc-select use 0.8.27

certoraRun src/contracts/strategies/StrategyBase.sol \
lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol \
src/contracts/core/StrategyManager.sol \
src/contracts/permissions/PauserRegistry.sol \
src/contracts/core/Slasher.sol \
--verify StrategyBase:certora/specs/strategies/StrategyBase.spec \
--solc_via_ir \
--solc_optimize 1 \
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This document provides an overview of system components, contracts, and user rol
* [Depositing Into EigenLayer](#depositing-into-eigenlayer)
* [Delegating to an Operator](#delegating-to-an-operator)
* [Undelegating or Queueing a Withdrawal](#undelegating-or-queueing-a-withdrawal)
* [Completing a Withdrawal as Shares](#completing-a-withdrawal-as-shares)
* [Completing a Withdrawal as OwnedShares](#completing-a-withdrawal-as-shares)
* [Completing a Withdrawal as Tokens](#completing-a-withdrawal-as-tokens)
* [Withdrawal Processing: Validator Exits](#withdrawal-processing-validator-exits)
* [Withdrawal Processing: Partial Beacon Chain Withdrawals](#withdrawal-processing-partial-beacon-chain-withdrawals)
Expand Down Expand Up @@ -156,7 +156,7 @@ Undelegating from an Operator automatically queues a withdrawal that needs to go

![.](./images/Staker%20Flow%20Diagrams/Queue%20Withdrawal.png)

##### Completing a Withdrawal as Shares
##### Completing a Withdrawal as OwnedShares

This flow is mostly useful if a Staker wants to change which Operator they are delegated to. The Staker first needs to undelegate (see above). At this point, they can delegate to a different Operator. However, the new Operator will only be awarded shares once the Staker completes their queued withdrawal "as shares":

Expand Down
10 changes: 5 additions & 5 deletions docs/core/DelegationManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ For each strategy/share pair in the `Withdrawal`:

`Withdrawals` concerning `EigenPodManager` shares have some additional nuance depending on whether a withdrawal is specified to be received as tokens vs shares (read more about "why" in [`EigenPodManager.md`](./EigenPodManager.md)):
* `EigenPodManager` withdrawals received as shares:
* Shares ALWAYS go back to the originator of the withdrawal (rather than the `withdrawer` address).
* Shares are also delegated to the originator's Operator, rather than the `withdrawer's` Operator.
* Shares received by the originator may be lower than the shares originally withdrawn if the originator has debt.
* OwnedShares ALWAYS go back to the originator of the withdrawal (rather than the `withdrawer` address).
* OwnedShares are also delegated to the originator's Operator, rather than the `withdrawer's` Operator.
* OwnedShares received by the originator may be lower than the shares originally withdrawn if the originator has debt.
* `EigenPodManager` withdrawals received as tokens:
* Before the withdrawal can be completed, the originator needs to prove that a withdrawal occurred on the beacon chain (see [`EigenPod.verifyAndProcessWithdrawals`](./EigenPodManager.md#eigenpodverifyandprocesswithdrawals)).

Expand All @@ -288,10 +288,10 @@ For each strategy/share pair in the `Withdrawal`:
* See [`EigenPodManager.withdrawSharesAsTokens`](./EigenPodManager.md#eigenpodmanagerwithdrawsharesastokens)
* If `!receiveAsTokens`:
* For `StrategyManager` strategies:
* Shares are awarded to the `withdrawer` and delegated to the `withdrawer's` Operator
* OwnedShares are awarded to the `withdrawer` and delegated to the `withdrawer's` Operator
* See [`StrategyManager.addShares`](./StrategyManager.md#addshares)
* For the native beacon chain ETH strategy (`EigenPodManager`):
* Shares are awarded to `withdrawal.staker`, and delegated to the Staker's Operator
* OwnedShares are awarded to `withdrawal.staker`, and delegated to the Staker's Operator
* See [`EigenPodManager.addShares`](./EigenPodManager.md#eigenpodmanageraddshares)

*Requirements*:
Expand Down
2 changes: 1 addition & 1 deletion docs/core/EigenPod.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Checkpoint proofs comprise the bulk of proofs submitted to an `EigenPod`. Comple
* when the pod has accumulated fees / partial withdrawals from validators
* whether any validators on the beacon chain have increased/decreased in balance

When a checkpoint is completed, shares are updated accordingly for each of these events. Shares can be withdrawn via the `DelegationManager` withdrawal queue (see [DelegationManager: Undelegating and Withdrawing](./DelegationManager.md#undelegating-and-withdrawing)), which means an `EigenPod's` checkpoint proofs also play an important role in allowing Pod Owners to exit funds from the system.
When a checkpoint is completed, shares are updated accordingly for each of these events. OwnedShares can be withdrawn via the `DelegationManager` withdrawal queue (see [DelegationManager: Undelegating and Withdrawing](./DelegationManager.md#undelegating-and-withdrawing)), which means an `EigenPod's` checkpoint proofs also play an important role in allowing Pod Owners to exit funds from the system.

_Important Notes:_
* `EigenPods` can only have **one active checkpoint** at a given time, and once started, checkpoints **cannot be cancelled** (only completed)
Expand Down
Loading
Loading