-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix start-anvil-chain command and add to makefile
- Loading branch information
Showing
3 changed files
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 7 additions & 9 deletions
16
contracts/tests/anvil/start-anvil-chain-with-el-and-avs-deployed.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit -o nounset -o pipefail | ||
|
||
# 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/../.. | ||
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 | ||
start_anvil_docker $parent_path/contracts-deployed-anvil-state.json "" | ||
|
||
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) | ||
cast rpc anvil_mine 200 --rpc-url http://localhost:8545 > /dev/null | ||
echo "Anvil is ready. Advanced chain to block-number:" $(cast block-number) | ||
|
||
|
||
docker attach anvil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters