-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
this requires the changes in Layr-Labs/eigenlayer-contracts#495 to be merged first make generate-bindings exit on error update eigenlayer-middleware to head of dev branch make bindings
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"addresses": { | ||
"avsDirectory": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707", | ||
"avsDirectoryImplementation": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", | ||
"baseStrategyImplementation": "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44", | ||
"delayedWithdrawalRouter": "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6", | ||
"delayedWithdrawalRouterImplementation": "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1", | ||
"delegation": "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9", | ||
"delegationImplementation": "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e", | ||
"eigenLayerPauserReg": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512", | ||
"eigenLayerProxyAdmin": "0x5FbDB2315678afecb367f032d93F642f64180aa3", | ||
"eigenPodBeacon": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788", | ||
"eigenPodImplementation": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318", | ||
"eigenPodManager": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853", | ||
"eigenPodManagerImplementation": "0x0B306BF915C4d645ff596e518fAf3F9669b97016", | ||
"emptyContract": "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0", | ||
"slasher": "0x0165878A594ca255338adfa4d48449f69242Eb8F", | ||
"slasherImplementation": "0x9A676e781A523b5d0C0e43731313A708CB607508", | ||
"strategies": "", | ||
"strategyManager": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9", | ||
"strategyManagerImplementation": "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0" | ||
}, | ||
"chainInfo": { | ||
"chainId": 31337, | ||
"deploymentBlock": 0 | ||
}, | ||
"parameters": { | ||
"executorMultisig": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", | ||
"operationsMultisig": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Integration Tests | ||
|
||
We store an anvil state files in this directory, so that we can start an anvil chain with the correct state for integration tests. | ||
``` | ||
anvil --load-state STATE_FILE.json | ||
``` | ||
|
||
## Eigenlayer deployment state file | ||
`eigenlayer-deployed-anvil-state.json` contains the eigenlayer deployment. | ||
|
||
It was created by running this [deploy script](https://github.com/Layr-Labs/eigenlayer-contracts/blob/2cb9ed107c6c918b9dfbac94cd71b4ab7c94e8c2/script/testing/M2_Deploy_From_Scratch.s.sol). If you ever need to redeploy a new version of eigenlayer contracts, first start an anvil chain that dumps its state after exiting | ||
``` | ||
anvil --dump-state eigenlayer-deployed-anvil-state.json | ||
``` | ||
Then run the deploy script | ||
``` | ||
forge script script/testing/M2_Deploy_From_Scratch.s.sol --rpc-url http://localhost:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast --sig "run(string memory configFile)" -- M2_deploy_from_scratch.anvil.config.json | ||
``` | ||
and finally kill the anvil chain with `Ctrl-C`. Make sure to copy the deployment [output file](https://github.com/Layr-Labs/eigenlayer-contracts/blob/master/script/output/M2_from_scratch_deployment_data.json) to [eigenlayer_deployment_output.json](../../contracts/script/output/31337/eigenlayer_deployment_output.json) so that the tests can find the deployed contracts. | ||
|
||
See the main [README](../../README.md#dependencies) to understand why we deploy from the `experimental-reduce-strategy-manager-bytecode-size` branch of eigenlayer-contracts. |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
# Enable the script to exit immediately if a command exits with a non-zero status | ||
set -o errexit -o nounset -o pipefail | ||
|
||
# Define your cleanup function | ||
clean_up() { | ||
echo "Executing cleanup function..." | ||
set +e | ||
pkill -f anvil | ||
|
||
# Check if the exit status is non-zero | ||
exit_status=$? | ||
if [ $exit_status -ne 0 ]; then | ||
echo "Script exited due to set -e on line $1 with command '$2'. Exit status: $exit_status" | ||
fi | ||
} | ||
# Use trap to call the clean_up function when the script exits | ||
trap 'clean_up $LINENO "$BASH_COMMAND"' EXIT | ||
|
||
# cd to the directory of this script so that this can be run from anywhere | ||
parent_path=$( | ||
cd "$(dirname "${BASH_SOURCE[0]}")" | ||
pwd -P | ||
) | ||
root_dir=$parent_path/../../.. | ||
|
||
set -a | ||
source $parent_path/utils.sh | ||
# we overwrite some variables here because should always deploy to anvil (localhost) | ||
ETH_HTTP_URL=http://localhost:8545 | ||
set +a | ||
|
||
# start an empty anvil chain in the background and dump its state to a json file upon exit | ||
start_anvil_docker "" $parent_path/contracts-deployed-anvil-state.json | ||
sleep 1 | ||
|
||
CHAIN_ID=$(cast chain-id) | ||
|
||
# DEPLOY CONTRACT REGISTRY | ||
# cd $parent_path/../../contracts | ||
# forge create src/ContractsRegistry.sol:ContractsRegistry --rpc-url ${ETH_HTTP_URL:?} --private-key ${DEPLOYER_PRIVATE_KEY:?} | ||
|
||
# DEPLOY EIGENLAYER | ||
EIGEN_CONTRACTS_DIR=$parent_path/../../lib/eigenlayer-middleware/lib/eigenlayer-contracts | ||
DEVNET_OUTPUT_DIR=$EIGEN_CONTRACTS_DIR/script/output/devnet | ||
# deployment overwrites this file, so we save it as backup, because we want that output in our local files, and not in the eigenlayer-contracts submodule files | ||
mv $DEVNET_OUTPUT_DIR/M2_from_scratch_deployment_data.json $DEVNET_OUTPUT_DIR/M2_from_scratch_deployment_data.json.bak | ||
cd $EIGEN_CONTRACTS_DIR | ||
forge script script/deploy/devnet/M2_Deploy_From_Scratch.s.sol --rpc-url http://localhost:8545 \ | ||
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast \ | ||
--sig "run(string memory configFileName)" -- M2_deploy_from_scratch.anvil.config.json | ||
mv $DEVNET_OUTPUT_DIR/M2_from_scratch_deployment_data.json $root_dir/contracts/script/output/${CHAIN_ID:?}/eigenlayer_deployment_output.json | ||
mv $DEVNET_OUTPUT_DIR/M2_from_scratch_deployment_data.json.bak $DEVNET_OUTPUT_DIR/M2_from_scratch_deployment_data.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# cd to the directory of this script so that this can be run from anywhere | ||
parent_path=$( | ||
cd "$(dirname "${BASH_SOURCE[0]}")" | ||
pwd -P | ||
) | ||
root_dir=$parent_path/../.. | ||
|
||
set -a | ||
source $parent_path/utils.sh | ||
source $root_dir/.env | ||
# we overwrite some variables here because should always deploy to anvil (localhost) | ||
ETH_HTTP_URL=http://localhost:8545 | ||
set +a | ||
|
||
# start an anvil instance in the background that has eigenlayer contracts deployed | ||
# we start anvil in the background so that we can run the below script | ||
start_anvil_docker $parent_path/eigenlayer-eigencert-eigenda-strategies-deployed-operators-registered-with-eigenlayer-anvil-state.json "" | ||
docker | ||
|
||
cd $root_dir/contracts | ||
# we need to restart the anvil chain at the correct block, otherwise the indexRegistry has a quorumUpdate at the block number | ||
# at which it was deployed (aka quorum was created/updated), but when we start anvil by loading state file it starts at block number 0 | ||
# so calling getOperatorListAtBlockNumber reverts because it thinks there are no quorums registered at block 0 | ||
# advancing chain manually like this is a current hack until https://github.com/foundry-rs/foundry/issues/6679 is merged | ||
# also not that it doesn't really advance by the correct number of blocks.. not sure why, so we just forward by a bunch of blocks that should be enough | ||
forge script script/utils/Utils.sol --sig "advanceChainByNBlocks(uint256)" 500 --rpc-url ${ETH_HTTP_URL:?} --private-key ${DEPLOYER_PRIVATE_KEY:?} --broadcast | ||
echo "current block-number:" $(cast block-number) | ||
|
||
docker attach anvil |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
set -e -o nounset | ||
|
||
parent_path=$( | ||
cd "$(dirname "${BASH_SOURCE[0]}")" | ||
pwd -P | ||
) | ||
|
||
FOUNDRY_IMAGE=ghcr.io/foundry-rs/foundry:nightly-3fa02706ca732c994715ba42d923605692062375 | ||
|
||
clean_up() { | ||
# Check if the exit status is non-zero | ||
exit_status=$? | ||
if [ $exit_status -ne 0 ]; then | ||
echo "Script exited due to set -e on line $1 with command '$2'. Exit status: $exit_status" | ||
fi | ||
} | ||
# Use trap to call the clean_up function when the script exits | ||
trap 'clean_up $LINENO "$BASH_COMMAND"' ERR | ||
|
||
# start_anvil_docker $LOAD_STATE_FILE $DUMP_STATE_FILE | ||
start_anvil_docker() { | ||
LOAD_STATE_FILE=$1 | ||
DUMP_STATE_FILE=$2 | ||
LOAD_STATE_VOLUME_DOCKER_ARG=$([[ -z $LOAD_STATE_FILE ]] && echo "" || echo "-v $LOAD_STATE_FILE:/load-state.json") | ||
DUMP_STATE_VOLUME_DOCKER_ARG=$([[ -z $DUMP_STATE_FILE ]] && echo "" || echo "-v $DUMP_STATE_FILE:/dump-state.json") | ||
LOAD_STATE_ANVIL_ARG=$([[ -z $LOAD_STATE_FILE ]] && echo "" || echo "--load-state /load-state.json") | ||
DUMP_STATE_ANVIL_ARG=$([[ -z $DUMP_STATE_FILE ]] && echo "" || echo "--dump-state /dump-state.json") | ||
|
||
echo $LOAD_STATE_VOLUME_DOCKER_ARG $DUMP_STATE_VOLUME_DOCKER_ARG | ||
echo $LOAD_STATE_ANVIL_ARG $DUMP_STATE_ANVIL_ARG | ||
trap 'docker stop anvil' EXIT | ||
set -o xtrace | ||
docker run --rm -d --name anvil -p 8545:8545 $LOAD_STATE_VOLUME_DOCKER_ARG $DUMP_STATE_VOLUME_DOCKER_ARG \ | ||
--entrypoint anvil \ | ||
$FOUNDRY_IMAGE \ | ||
$LOAD_STATE_ANVIL_ARG $DUMP_STATE_ANVIL_ARG --host 0.0.0.0 | ||
set +o xtrace | ||
sleep 2 | ||
} |