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 release #311

Draft
wants to merge 49 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7d49b51
Update LICENSE (#285)
gpsanant Jul 17, 2024
163f4c3
chore: upgrade core to target operator set release
stevennevins Jul 25, 2024
ad64a45
Merge branch 'dev' into feat/operate-set-release-branch
stevennevins Aug 2, 2024
b7f4903
chore: update mock contracts with latest interfaces (#293)
shrimalmadhur Aug 5, 2024
d991827
chore: bump to latest operator set release commits
stevennevins Aug 8, 2024
4966813
chore: fixes for depedency bump
stevennevins Aug 8, 2024
4fabf80
feat: operator set migration-1-migration (#286)
stevennevins Aug 12, 2024
fe93ac6
feat: operator set migration-2-create quorum (#287)
stevennevins Aug 12, 2024
e5b2688
chore: bump operator set release dependency in core
stevennevins Aug 15, 2024
ec2fdf3
chore: updates from dependency bump
stevennevins Aug 15, 2024
12eda5d
feat: add natspec
stevennevins Aug 15, 2024
788cd09
docs: add natspec
stevennevins Aug 15, 2024
d64f4af
feat: add checks operator was registered for quorums when migrating
stevennevins Aug 15, 2024
a92d51a
fix: resolve code size issue in RegistryCoordinator
stevennevins Aug 15, 2024
32148de
chore: update to latest core (#299)
shrimalmadhur Aug 15, 2024
86f0928
feat(op sets): update stakes when forceUnregister (#300)
stevennevins Aug 21, 2024
3e4cb2b
merge dev
stevennevins Aug 21, 2024
f6ad20e
feat(op sets): register and deregister (#301)
stevennevins Aug 22, 2024
e0a79f1
feat(op sets): upgrade and migrate script (#303)
stevennevins Aug 22, 2024
eb0d6ad
chore: bump slashing core dependency (#312)
stevennevins Oct 17, 2024
cb4df12
feat: slasher templates / examples (#310)
stevennevins Nov 1, 2024
145bdaf
chore: remove unused test util contracts (#319)
stevennevins Nov 18, 2024
9a975df
feat: remove both option
stevennevins Nov 8, 2024
fa04f06
fix: storage gap remove one slot (#320)
stevennevins Nov 20, 2024
388e9f9
feat: track total slashable stake and total delegated stake per quoru…
stevennevins Nov 20, 2024
158a890
fix: use libraries with only internal vis (#324)
stevennevins Dec 4, 2024
817ad42
feat: avs registrar registration flow changes (#318)
stevennevins Dec 5, 2024
dbd59dd
feat: registration changes part 2
stevennevins Dec 9, 2024
6fd466e
chore: bump dependency for slashing mags updates (#329)
stevennevins Dec 10, 2024
f9ce2fc
Merge branch 'mainnet' into feat/slashing-release-branch
nadir-akhtar Dec 11, 2024
19751c9
fix: internal slashing security review (#332)
nadir-akhtar Dec 13, 2024
cb298ea
fix: revert cases
stevennevins Dec 13, 2024
7307b08
chore: bump core dependency to pull in latest updates
stevennevins Dec 13, 2024
a395a0e
fix: slashing review fixes (#333)
stevennevins Dec 16, 2024
1cc4983
chore: bump core dependency
stevennevins Dec 16, 2024
44e1a40
chore: bump forge-std
stevennevins Dec 18, 2024
865b490
docs: update readme with note on slashing (#341)
stevennevins Dec 19, 2024
d54835c
chore: bump core fix iface changes (#352)
stevennevins Jan 8, 2025
cbcc0a4
feat: ci storage reports (#347)
0xClandestine Jan 8, 2025
42fa63e
fix: prevent calling enable operator sets twice and use internal func…
stevennevins Jan 9, 2025
45eb220
chore: address review comments
stevennevins Jan 9, 2025
8778517
refactor: custom errors in middleware (#355)
8sunyuan Jan 10, 2025
34456b3
chore: review remove setStakeType
stevennevins Jan 10, 2025
2246b7d
fix: wire up stake registry to call add and rm strategies for op set
stevennevins Jan 10, 2025
3b8d801
refactor: slashing UAM (#357)
8sunyuan Jan 17, 2025
3654478
feat: ci forge coverage (#349)
0xClandestine Jan 22, 2025
d2bfd57
feat: add forge fmt to ci (#363)
0xClandestine Jan 22, 2025
7e8aeff
feat: add register with churn type (#360)
stevennevins Jan 22, 2025
57f70ba
refactor: slashing registry coordinator (#361)
8sunyuan Jan 24, 2025
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/bin/storage-report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh

# Default output directory
OUTPUT_DIR=${1:-docs/storage-report}

# Function to print messages
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') [INFO] $1"
}

# Function to print error messages
error() {
echo "$(date '+%Y-%m-%d %H:%M:%S') [ERROR] $1" >&2
}

log "Starting the storage report generation."

# Create the output directory if it doesn't exist
if ! mkdir -p "$OUTPUT_DIR"; then
error "Failed to create output directory: $OUTPUT_DIR"
exit 1
fi

log "Output directory is set to: $OUTPUT_DIR"

# Loop through Solidity files and generate storage report
# NOTE: Ignores `src/interfaces` & `src/libraries` since they "should" not contain storage logic.
for file in $(find src/ -name "*.sol" ! -path "*/interfaces/*" ! -path "*/libraries/*"); do
contract_name=$(basename "$file" .sol)

# Check if the file exists and is readable
if [ ! -r "$file" ]; then
error "Cannot read file: $file"
continue
fi

log "Processing contract: $contract_name"

# Run forge inspect and capture errors
if ! forge inspect "$contract_name" storage --pretty > "$OUTPUT_DIR/$contract_name.md"; then
error "Failed to generate storage report for contract: $contract_name"
else
log "Storage report generated for contract: $contract_name"
fi
done
48 changes: 48 additions & 0 deletions .github/workflows/storage-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Storage Layout

on:
push:
branches:
- master
- mainnet
- testnet-goerli
- dev
pull_request:

jobs:
check_storage:
name: CI
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: "Generate and prepare the storage reports for current branch"
run: |
bash .github/bin/storage-report.sh pr

- name: Checkout dev
env:
TARGET: ${{ github.event.pull_request.base.sha }}
run: |
git fetch origin $TARGET
git checkout $TARGET

- name: "Generate and prepare the storage reports for target branch"
run: |
bash .github/bin/storage-report.sh target

- name: Compare outputs
run: |
if diff --unified pr target; then
echo "No differences found"
else
echo "::error::Differences found between PR and target branch storage layouts"
exit 1
fi
3 changes: 0 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ on:
- dev
pull_request:

env:
FOUNDRY_PROFILE: ci

jobs:
check:
strategy:
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
storage-report:
bash ".github/bin/storage-report.sh" "docs/storage-report/"
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ EigenLayer is a set of smart contracts deployed on Ethereum that enable restakin
## Branching

The main branches we use are:

* [`dev (default)`](https://github.com/Layr-Labs/eigenlayer-middleware/tree/dev): The most up-to-date branch, containing the work-in-progress code for upcoming releases
* [`testnet-holesky`](https://github.com/Layr-Labs/eigenlayer-middleware/tree/testnet-holesky): Our current testnet deployment
* [`mainnet`](https://github.com/Layr-Labs/eigenlayer-middleware/tree/mainnet): Our current mainnet deployment
Expand All @@ -24,6 +25,7 @@ The main branches we use are:
### Basics

To get a basic understanding of EigenLayer, check out [You Could've Invented EigenLayer](https://www.blog.eigenlayer.xyz/ycie/). Note that some of the document's content describes features that do not exist yet (like the Slasher). To understand more about how restakers and operators interact with EigenLayer, check out these guides:

* [Restaking User Guide](https://docs.eigenlayer.xyz/restaking-guides/restaking-user-guide)
* [Operator Guide](https://docs.eigenlayer.xyz/operator-guides/operator-introduction)

Expand All @@ -32,10 +34,25 @@ Most of this content is intro-level and describes user interactions with the Eig
### Deep Dive

For shadowy super-coders:

* The most up-to-date technical documentation can be found in [/docs](/docs).
* To get an idea of how users interact with these contracts, check out the integration tests: [/test/integration](./test/integration)
* To explore the EigenLayer core contracts, check out the core repo technical docs [here][core-docs-dev].

### Note On Slashing

The middleware contracts are available for testnet integration and experimentation. As with the rest of the testnet code, these contracts have not yet been fully audited. Internal security reviews are in progress, and we're preparing to engage external auditors. We're providing these now so AVSs can begin testing slashing conditions, Operator Sets, and related functionality, and so Operators can simulate slashing and test allocations. For more details, see [ELIP-002](https://github.com/eigenfoundation/ELIPs/blob/main/ELIPs/ELIP-002.md).

For Operators:

We provide scripts to deploy a mock service manager and allocate some stake to a mock Operator Set in [these scripts](https://github.com/Layr-Labs/eigenlayer-middleware/pull/335).
We've reduced various safety delays on testnet to better simulate operational flows. Additional information on these delays is in [ELIP-002](https://github.com/eigenfoundation/ELIPs/blob/main/ELIPs/ELIP-002.md).
For AVSs:

We provide a migration path for existing M2 environments (LINK). While this requires understanding the provided script, the Developer Experience will improve before Mainnet launch. Note that this is a gradual migration process to new Operator Sets, not a direct upgrade of existing Operator Sets.
We also provide scripts to spin up new service managers from scratch.
In all cases, you’ll need to register existing Operators or spin up new Operators and allocate funds to them. These testing flows will improve as we refine the scripts and contracts. Stay tuned for updates, and feel free to reach out with any questions.

## Building and Running Tests

This repository uses Foundry. See the [Foundry docs](https://book.getfoundry.sh/) for more info on installation and usage. If you already have foundry, you can build this project and run tests with these commands:
Expand Down Expand Up @@ -80,4 +97,3 @@ The current testnet deployment is on holesky, is from our M2 beta release. You c
[`ServiceManagerRouter`](https://github.com/Layr-Labs/eigenlayer-middleware/blob/testnet-holesky/src/ServiceManagerRouter.sol) | - | [`0x4463...5a37`](https://holesky.etherscan.io/address/0x44632dfBdCb6D3E21EF613B0ca8A6A0c618F5a37#code) | |
[`ProxyAdmin`](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.7.1/contracts/proxy/transparent/ProxyAdmin.sol) | - | [`0xB043...5c15`](https://holesky.etherscan.io/address/0xB043055dd967A382577c2f5261fA6428f2905c15) | |
[`eigenda/EigenDAServiceManager`](https://github.com/Layr-Labs/eigenda/blob/a33b41561cc3fb4cd6d50a8738e4c5dca43ec0a5/contracts/src/core/EigenDAServiceManager.sol) | [`0xD4A7E1Bd8015057293f0D0A557088c286942e84b`](https://holesky.etherscan.io/address/0xD4A7E1Bd8015057293f0D0A557088c286942e84b) | [`0xa722...67f3`](https://holesky.etherscan.io/address/0xa7227485e6C693AC4566fe168C5E3647c5c267f3) | Proxy: [`[email protected]`](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.7.1/contracts/proxy/transparent/TransparentUpgradeableProxy.sol) |

45 changes: 45 additions & 0 deletions bin/storage-report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh

# Default output directory
OUTPUT_DIR=${1:-docs/storage-report}

# Function to print messages
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') [INFO] $1"
}

# Function to print error messages
error() {
echo "$(date '+%Y-%m-%d %H:%M:%S') [ERROR] $1" >&2
}

log "Starting the storage report generation."

# Create the output directory if it doesn't exist
if ! mkdir -p "$OUTPUT_DIR"; then
error "Failed to create output directory: $OUTPUT_DIR"
exit 1
fi

log "Output directory is set to: $OUTPUT_DIR"

# Loop through Solidity files and generate storage report
# NOTE: Ignores `src/interfaces` & `src/libraries` since they "should" not contain storage logic.
for file in $(find src/ -name "*.sol" ! -path "*/interfaces/*" ! -path "*/libraries/*"); do
contract_name=$(basename "$file" .sol)

# Check if the file exists and is readable
if [ ! -r "$file" ]; then
error "Cannot read file: $file"
continue
fi

log "Processing contract: $contract_name"

# Run forge inspect and capture errors
if ! forge inspect "$contract_name" storage --pretty > "$OUTPUT_DIR/$contract_name.md"; then
error "Failed to generate storage report for contract: $contract_name"
else
log "Storage report generated for contract: $contract_name"
fi
done
6 changes: 6 additions & 0 deletions docs/storage-report/AVSRegistrar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

╭------+------+------+--------+-------+----------╮
| Name | Type | Slot | Offset | Bytes | Contract |
+================================================+
╰------+------+------+--------+-------+----------╯

21 changes: 21 additions & 0 deletions docs/storage-report/BLSApkRegistry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

╭----------------------+------------------------------------------------------+------+--------+-------+---------------------------------------╮
| Name | Type | Slot | Offset | Bytes | Contract |
+=============================================================================================================================================+
| _initialized | uint8 | 0 | 0 | 1 | src/BLSApkRegistry.sol:BLSApkRegistry |
|----------------------+------------------------------------------------------+------+--------+-------+---------------------------------------|
| _initializing | bool | 0 | 1 | 1 | src/BLSApkRegistry.sol:BLSApkRegistry |
|----------------------+------------------------------------------------------+------+--------+-------+---------------------------------------|
| operatorToPubkeyHash | mapping(address => bytes32) | 1 | 0 | 32 | src/BLSApkRegistry.sol:BLSApkRegistry |
|----------------------+------------------------------------------------------+------+--------+-------+---------------------------------------|
| pubkeyHashToOperator | mapping(bytes32 => address) | 2 | 0 | 32 | src/BLSApkRegistry.sol:BLSApkRegistry |
|----------------------+------------------------------------------------------+------+--------+-------+---------------------------------------|
| operatorToPubkey | mapping(address => struct BN254.G1Point) | 3 | 0 | 32 | src/BLSApkRegistry.sol:BLSApkRegistry |
|----------------------+------------------------------------------------------+------+--------+-------+---------------------------------------|
| apkHistory | mapping(uint8 => struct IBLSApkRegistry.ApkUpdate[]) | 4 | 0 | 32 | src/BLSApkRegistry.sol:BLSApkRegistry |
|----------------------+------------------------------------------------------+------+--------+-------+---------------------------------------|
| currentApk | mapping(uint8 => struct BN254.G1Point) | 5 | 0 | 32 | src/BLSApkRegistry.sol:BLSApkRegistry |
|----------------------+------------------------------------------------------+------+--------+-------+---------------------------------------|
| __GAP | uint256[45] | 6 | 0 | 1440 | src/BLSApkRegistry.sol:BLSApkRegistry |
╰----------------------+------------------------------------------------------+------+--------+-------+---------------------------------------╯

21 changes: 21 additions & 0 deletions docs/storage-report/BLSApkRegistryStorage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

╭----------------------+------------------------------------------------------+------+--------+-------+-----------------------------------------------------╮
| Name | Type | Slot | Offset | Bytes | Contract |
+===========================================================================================================================================================+
| _initialized | uint8 | 0 | 0 | 1 | src/BLSApkRegistryStorage.sol:BLSApkRegistryStorage |
|----------------------+------------------------------------------------------+------+--------+-------+-----------------------------------------------------|
| _initializing | bool | 0 | 1 | 1 | src/BLSApkRegistryStorage.sol:BLSApkRegistryStorage |
|----------------------+------------------------------------------------------+------+--------+-------+-----------------------------------------------------|
| operatorToPubkeyHash | mapping(address => bytes32) | 1 | 0 | 32 | src/BLSApkRegistryStorage.sol:BLSApkRegistryStorage |
|----------------------+------------------------------------------------------+------+--------+-------+-----------------------------------------------------|
| pubkeyHashToOperator | mapping(bytes32 => address) | 2 | 0 | 32 | src/BLSApkRegistryStorage.sol:BLSApkRegistryStorage |
|----------------------+------------------------------------------------------+------+--------+-------+-----------------------------------------------------|
| operatorToPubkey | mapping(address => struct BN254.G1Point) | 3 | 0 | 32 | src/BLSApkRegistryStorage.sol:BLSApkRegistryStorage |
|----------------------+------------------------------------------------------+------+--------+-------+-----------------------------------------------------|
| apkHistory | mapping(uint8 => struct IBLSApkRegistry.ApkUpdate[]) | 4 | 0 | 32 | src/BLSApkRegistryStorage.sol:BLSApkRegistryStorage |
|----------------------+------------------------------------------------------+------+--------+-------+-----------------------------------------------------|
| currentApk | mapping(uint8 => struct BN254.G1Point) | 5 | 0 | 32 | src/BLSApkRegistryStorage.sol:BLSApkRegistryStorage |
|----------------------+------------------------------------------------------+------+--------+-------+-----------------------------------------------------|
| __GAP | uint256[45] | 6 | 0 | 1440 | src/BLSApkRegistryStorage.sol:BLSApkRegistryStorage |
╰----------------------+------------------------------------------------------+------+--------+-------+-----------------------------------------------------╯

9 changes: 9 additions & 0 deletions docs/storage-report/BLSSignatureChecker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

╭----------------------+-------------+------+--------+-------+-------------------------------------------------╮
| Name | Type | Slot | Offset | Bytes | Contract |
+==============================================================================================================+
| staleStakesForbidden | bool | 0 | 0 | 1 | src/BLSSignatureChecker.sol:BLSSignatureChecker |
|----------------------+-------------+------+--------+-------+-------------------------------------------------|
| __GAP | uint256[49] | 1 | 0 | 1568 | src/BLSSignatureChecker.sol:BLSSignatureChecker |
╰----------------------+-------------+------+--------+-------+-------------------------------------------------╯

19 changes: 19 additions & 0 deletions docs/storage-report/ECDSAServiceManagerBase.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

╭------------------+-------------+------+--------+-------+-------------------------------------------------------------------╮
| Name | Type | Slot | Offset | Bytes | Contract |
+============================================================================================================================+
| _initialized | uint8 | 0 | 0 | 1 | src/unaudited/ECDSAServiceManagerBase.sol:ECDSAServiceManagerBase |
|------------------+-------------+------+--------+-------+-------------------------------------------------------------------|
| _initializing | bool | 0 | 1 | 1 | src/unaudited/ECDSAServiceManagerBase.sol:ECDSAServiceManagerBase |
|------------------+-------------+------+--------+-------+-------------------------------------------------------------------|
| __gap | uint256[50] | 1 | 0 | 1600 | src/unaudited/ECDSAServiceManagerBase.sol:ECDSAServiceManagerBase |
|------------------+-------------+------+--------+-------+-------------------------------------------------------------------|
| _owner | address | 51 | 0 | 20 | src/unaudited/ECDSAServiceManagerBase.sol:ECDSAServiceManagerBase |
|------------------+-------------+------+--------+-------+-------------------------------------------------------------------|
| __gap | uint256[49] | 52 | 0 | 1568 | src/unaudited/ECDSAServiceManagerBase.sol:ECDSAServiceManagerBase |
|------------------+-------------+------+--------+-------+-------------------------------------------------------------------|
| rewardsInitiator | address | 101 | 0 | 20 | src/unaudited/ECDSAServiceManagerBase.sol:ECDSAServiceManagerBase |
|------------------+-------------+------+--------+-------+-------------------------------------------------------------------|
| __GAP | uint256[49] | 102 | 0 | 1568 | src/unaudited/ECDSAServiceManagerBase.sol:ECDSAServiceManagerBase |
╰------------------+-------------+------+--------+-------+-------------------------------------------------------------------╯

Loading
Loading