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

feat: slashing audit fixes #1046

Draft
wants to merge 46 commits into
base: slashing-magnitudes
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
db5f1e8
feat: slashing release
0xClandestine Sep 16, 2024
f96461e
fix(slashing): upgrade script part 4 (#953)
jbrower95 Dec 13, 2024
b6a430e
fix: patch (#956)
gpsanant Dec 14, 2024
cd63e42
feat: bindings (#960)
gpsanant Dec 16, 2024
106f12e
fix: remove numtocomplete interface (#966)
8sunyuan Dec 18, 2024
93aeb7d
feat: add share helpers (#964)
gpsanant Dec 18, 2024
dadd4b0
fix: slashable window boundaries (#965)
8sunyuan Dec 18, 2024
9a198b5
refactor: small cleanup (#959)
0xClandestine Dec 18, 2024
499859d
refactor: remove max strats list (#968)
ypatil12 Dec 18, 2024
15506d5
feat: slashing patch upgrade script (#967)
ypatil12 Dec 18, 2024
59e0790
fix non-present upgrade.json
jbrower95 Dec 18, 2024
63ccb61
chore: bindings (#969)
gpsanant Dec 18, 2024
12c1d1b
fix: try catch out of gas edge case (#971)
8sunyuan Dec 19, 2024
473084e
chore: slashing consolidated script (#972)
jbrower95 Dec 19, 2024
4b45966
test: more slashing integration todos (#961)
0xClandestine Dec 19, 2024
7792c29
docs: wip slashing docs (#925)
wadealexc Jan 1, 2025
7e54c34
refactor: scaled shares accounting (#975)
8sunyuan Jan 2, 2025
337b1b6
refactor: final slashing cleanup (#982)
wadealexc Jan 2, 2025
4477d84
chore: remove unused avsd events (#984)
ypatil12 Jan 3, 2025
21f2f52
fix: integration test initialization params (#978)
ypatil12 Jan 3, 2025
10fb40f
fix: `SignatureUtils` construction (#990)
0xClandestine Jan 3, 2025
1512167
fix: readd manual checks (#996)
0xClandestine Jan 3, 2025
44ece6d
feat: slashing 1.0.3 upgrade script (#995)
ypatil12 Jan 3, 2025
b5f5e6f
fix: update alloc config delay bound (#985)
ypatil12 Jan 6, 2025
8a6a9d4
chore: storage report (#1000)
0xClandestine Jan 6, 2025
ad4f21e
docs: shares accounting (#997)
8sunyuan Jan 6, 2025
c44f725
refactor: async burning (#1001)
8sunyuan Jan 6, 2025
22de809
test: `Snapshots` lib (#1002)
0xClandestine Jan 6, 2025
1a60c3a
docs: finish delegation manager docs (#1004)
wadealexc Jan 8, 2025
46c0cc5
docs: Strategy Manager slashing updates (#999)
nadir-akhtar Jan 8, 2025
7a6f8a6
docs: EigenPod Manager slashing updates (#1005)
nadir-akhtar Jan 9, 2025
5111936
Slashing integration tests (#1003)
eigenmikem Jan 9, 2025
5e626b5
Revert "Slashing integration tests (#1003)" (#1007)
eigenmikem Jan 9, 2025
403e0a1
fix: fixing 0 withdrawal issues (#1019)
eigenmikem Jan 13, 2025
e8db8d3
test: remove unneeded logic from integration test setup (#1023)
wadealexc Jan 14, 2025
3802dec
test: non-beacon-chain slashing integration tests (#1010)
eigenmikem Jan 14, 2025
e49a13b
test: separate upgrade test functionality from main integration tests…
wadealexc Jan 16, 2025
6e2786c
test: enable shared setups for integration tests (#1036)
wadealexc Jan 17, 2025
5cfc840
fix: remove token param from Deposit event and related APIs (#1013)
bowenli86 Jan 17, 2025
4bde5b5
feat: better introspection for encumbered magnitude (#1038)
wadealexc Jan 21, 2025
83614ab
chore: remove unused helper (#1039)
ypatil12 Jan 21, 2025
97b9d82
feat: changing burnableShares to EnumerableMap (#1028)
eigenmikem Jan 21, 2025
bd2453c
feat: add `getAllocatedStake` and update `getMinimumSlashableStake` (…
8sunyuan Jan 22, 2025
d6510cc
test(integration): implement registration and allocation invariants (…
wadealexc Jan 30, 2025
1637a86
fix: overflow bug for pendingDiff input (#1027)
8sunyuan Jan 30, 2025
abcde78
fix: overwriting existing pending modifications (#1052)
8sunyuan Jan 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
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
26 changes: 15 additions & 11 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 All @@ -52,6 +53,9 @@ jobs:
version: nightly
- name: Run coverage
run: forge coverage --report lcov
env:
RPC_MAINNET: ${{ secrets.RPC_MAINNET }}
RPC_HOLESKY: ${{ secrets.RPC_HOLESKY }}
- name: Prune coverage report
run: lcov --remove ./lcov.info -o ./lcov.info.pruned 'src/test/*' 'script/*' '*Storage.sol' --ignore-errors inconsistent
- name: Generate reports
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/testinparallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Run Forge build
run: |
forge --version
forge build --sizes
forge build
id: build

- name: Run unit tests
Expand All @@ -57,9 +57,9 @@ jobs:
CHAIN_ID: ${{ secrets.CHAIN_ID }}

- name: Run integration mainnet fork tests
run: forge test --match-contract Integration
run: forge test --match-contract Integration
env:
FOUNDRY_PROFILE: "forktest"
RPC_MAINNET: ${{ secrets.RPC_MAINNET }}
RPC_HOLESKY: ${{ secrets.RPC_HOLESKY }}
CHAIN_ID: ${{ secrets.CHAIN_ID }}
CHAIN_ID: ${{ secrets.CHAIN_ID }}
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
4 changes: 3 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"compiler-version": "off",
"custom-errors": "off",
"no-global-import": "off",
"immutable-vars-naming": "off"
"immutable-vars-naming": "off",
"no-console": "off"

}
}
1 change: 0 additions & 1 deletion .solhintignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
Slasher.sol
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ surya mdreport surya_report.md ./src/contracts/**/*.sol
make bindings
```

### Generate updated Storage Report

To update the storage reports in `/docs/storage-report` run:

```bash
make storage-report
```

## Deployments

### Current Mainnet Deployment
Expand Down
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/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
14 changes: 2 additions & 12 deletions certora/specs/core/DelegationManager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ in this case, the end state is that:
isOperator(staker) == false,
delegatedTo(staker) != staker && delegatedTo(staker) != 0,
and isDelegated(staker) == true (redundant with above)
-only allowed when calling `delegateTo` or `delegateToBySignature`
-only allowed when calling `delegateTo`

2)
FROM not delegated AND not registered as an operator
Expand Down Expand Up @@ -172,7 +172,7 @@ rule cannotChangeDelegationWithoutUndelegating(address staker) {
}
}

// verifies that an undelegated address can only delegate when calling `delegateTo`, `delegateToBySignature` or `registerAsOperator`
// verifies that an undelegated address can only delegate when calling `delegateTo` or `registerAsOperator`
rule canOnlyDelegateWithSpecificFunctions(address staker) {
requireInvariant operatorsAlwaysDelegatedToSelf(staker);
// assume the staker begins as undelegated
Expand All @@ -192,16 +192,6 @@ rule canOnlyDelegateWithSpecificFunctions(address staker) {
} else {
assert (!isDelegated(staker), "staker delegated to inappropriate address?");
}
} else if (f.selector == sig:delegateToBySignature(address, address, ISignatureUtils.SignatureWithExpiry, ISignatureUtils.SignatureWithExpiry, bytes32).selector) {
address toDelegateFrom;
address operator;
require(operator != 0);
ISignatureUtils.SignatureWithExpiry stakerSignatureAndExpiry;
ISignatureUtils.SignatureWithExpiry approverSignatureAndExpiry;
bytes32 salt;
delegateToBySignature(e, toDelegateFrom, operator, stakerSignatureAndExpiry, approverSignatureAndExpiry, salt);
// TODO: this check could be stricter! need to filter when the block timestamp is appropriate for expiry and signature is valid
assert (!isDelegated(staker) || delegatedTo(staker) == operator, "delegateToBySignature bug?");
} else if (f.selector == sig:registerAsOperator(IDelegationManager.OperatorDetails, string).selector) {
IDelegationManager.OperatorDetails operatorDetails;
string metadataURI;
Expand Down
Loading
Loading