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: pectra compatability #893

Open
wants to merge 27 commits into
base: slashing-magnitudes
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
153d625
feat: storage report (#753)
0xClandestine Sep 16, 2024
861b7c8
fix: compile
ypatil12 Oct 17, 2024
d98c5a7
feat: squashed slashing for devnet
8sunyuan Sep 12, 2024
89bbc30
feat: add shares to queue event (#847)
gpsanant Oct 21, 2024
c1c8c6b
feat: named mapping params (#848)
0xClandestine Oct 22, 2024
f0b746d
chore: new storage (#851)
gpsanant Oct 23, 2024
5ca71fc
Gpsanant/current stakes (#846)
gpsanant Oct 23, 2024
12848bb
slashing: cleanup (#842)
8sunyuan Oct 23, 2024
b30e1c7
slashing: fully slashed strategies (#850)
8sunyuan Oct 28, 2024
9975936
EigenPod/EPM Happy Path Test Cases (#857)
ypatil12 Oct 28, 2024
385dc53
slashing: revert timestamps delegation (#861)
8sunyuan Oct 30, 2024
4b4298d
refactor: optimize pausable (#854)
0xClandestine Oct 30, 2024
0b6b009
feat: small delegation refactors (#866)
wadealexc Nov 1, 2024
26c1697
slashing: change queue withdrawal input to deposit shares (#869)
8sunyuan Nov 4, 2024
2639e35
feat: remove delegate to by signature (#871)
wadealexc Nov 4, 2024
88b5f17
feat: track staker withdrawals (#864)
0xClandestine Nov 4, 2024
b850371
Fix: Flaky DM Test (#875)
ypatil12 Nov 5, 2024
9ee60c8
feat: move operator set functionality to alm (#860)
wadealexc Nov 6, 2024
b18ec68
fix: change to sharesToWithdraw (#878)
gpsanant Nov 6, 2024
deff1ba
feat: add tasks to prepare chain state ready for slashing (#868)
grezle Nov 7, 2024
bf0e200
test: slashing todos (#880)
0xClandestine Nov 8, 2024
d59be03
feat: add getMinimumSlashableStake (#889)
wadealexc Nov 13, 2024
d14790a
refactor: pull beacon chain slashing out of slashing lib (#876)
wadealexc Nov 14, 2024
725d3df
test: slashing test todos (#885)
0xClandestine Nov 14, 2024
2992704
feat: basic pectra fork timestamp functionality
ypatil12 Nov 13, 2024
e88b185
feat: pectra compatibility
ypatil12 Nov 15, 2024
d5ee26d
chore: remove accidentally added submodules
ypatil12 Nov 15, 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
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
17 changes: 9 additions & 8 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 @@ -56,10 +56,11 @@ jobs:
RPC_HOLESKY: ${{ secrets.RPC_HOLESKY }}
CHAIN_ID: ${{ secrets.CHAIN_ID }}

- name: Run integration mainnet fork tests
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 }}
# TODO: uncomment this item once we've added the proper upgrade tests
# - name: Run integration mainnet fork tests
# 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 }}
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
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