forked from OffchainLabs/nitro-testnode
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add smoke test for altlayer config #59
Open
Sneh1999
wants to merge
5
commits into
integration
Choose a base branch
from
e2e-altlayer
base: integration
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+27
−0
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,193 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.1.0-7d1d84c-dev | ||
DEFAULT_NITRO_CONTRACTS_REPO=https://github.com/EspressoSystems/nitro-contracts.git | ||
NITRO_CONTRACTS_BRANCH=develop | ||
|
||
ESPRESSO_VERSION=ghcr.io/espressosystems/nitro-espresso-integration/nitro-node-dev:latest | ||
|
||
# Set default versions if not overriden by provided env vars | ||
: ${NITRO_CONTRACTS_REPO:=$DEFAULT_NITRO_CONTRACTS_REPO} | ||
: ${NITRO_CONTRACTS_BRANCH:=$DEFAULT_NITRO_CONTRACTS_VERSION} | ||
export NITRO_CONTRACTS_REPO | ||
export NITRO_CONTRACTS_BRANCH | ||
|
||
echo "Running espresso mode" | ||
echo "Using NITRO_CONTRACTS_REPO: $NITRO_CONTRACTS_REPO" | ||
echo "Using NITRO_CONTRACTS_BRANCH: $NITRO_CONTRACTS_BRANCH" | ||
|
||
|
||
mydir=`dirname $0` | ||
cd "$mydir" | ||
|
||
if [[ $# -gt 0 ]] && [[ $1 == "script" ]]; then | ||
shift | ||
docker compose run scripts "$@" | ||
exit $? | ||
fi | ||
|
||
num_volumes=`docker volume ls --filter label=com.docker.compose.project=nitro-testnode -q | wc -l` | ||
|
||
if [[ $num_volumes -eq 0 ]]; then | ||
force_init=true | ||
else | ||
force_init=false | ||
fi | ||
|
||
|
||
detach=false | ||
init=false | ||
force_build=false | ||
latest_espresso_image=false | ||
lightClientAddr=0xb6eb235fa509e3206f959761d11e3777e16d0e98 | ||
l1chainid=1337 | ||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
--detach) | ||
detach=true | ||
shift | ||
;; | ||
--init) | ||
force_init=true | ||
shift | ||
;; | ||
--build) | ||
force_build=true | ||
shift | ||
;; | ||
--latest-espresso-image) | ||
latest_espresso_image=true | ||
shift | ||
;; | ||
--detach) | ||
detach=true | ||
shift | ||
;; | ||
*) | ||
echo Usage: $0 \[OPTIONS..] | ||
echo $0 script [SCRIPT-ARGS] | ||
echo | ||
echo OPTIONS: | ||
echo --detach detach from nodes after running them | ||
echo --init remove all data, rebuild, deploy new rollup | ||
echo --build rebuild docker images | ||
echo --latest-espresso-image use latest espresso image | ||
echo | ||
echo script runs inside a separate docker. For SCRIPT-ARGS, run $0 script --help | ||
exit 0 | ||
esac | ||
done | ||
|
||
|
||
|
||
if $force_init; then | ||
force_build=true | ||
fi | ||
|
||
|
||
NODES="sequencer redis poster validator" | ||
INITIAL_SEQ_NODES="sequencer validation_node" | ||
|
||
if $force_build; then | ||
echo == Building.. | ||
LOCAL_BUILD_NODES="scripts rollupcreator" | ||
docker compose build --no-rm $LOCAL_BUILD_NODES | ||
fi | ||
|
||
if $force_build; then | ||
INITIAL_SEQ_NODES="$INITIAL_SEQ_NODES espresso-dev-node" | ||
else | ||
NODES="$NODES espresso-dev-node" | ||
fi | ||
|
||
|
||
if $latest_espresso_image; then | ||
docker pull $ESPRESSO_VERSION | ||
docker tag $ESPRESSO_VERSION nitro-node-dev-testnode | ||
else | ||
docker pull $NITRO_NODE_VERSION | ||
docker tag $NITRO_NODE_VERSION nitro-node-dev-testnode | ||
fi | ||
|
||
if $force_build; then | ||
docker compose build --no-rm $NODES scripts | ||
fi | ||
|
||
if $force_init; then | ||
echo == Removing old data... | ||
docker compose down | ||
leftoverContainers=`docker container ls -a --filter label=com.docker.compose.project=nitro-testnode -q | xargs echo` | ||
if [ `echo $leftoverContainers | wc -w` -gt 0 ]; then | ||
docker rm $leftoverContainers | ||
fi | ||
docker volume prune -f --filter label=com.docker.compose.project=nitro-testnode | ||
leftoverVolumes=`docker volume ls --filter label=com.docker.compose.project=nitro-testnode -q | xargs echo` | ||
if [ `echo $leftoverVolumes | wc -w` -gt 0 ]; then | ||
docker volume rm $leftoverVolumes | ||
fi | ||
|
||
echo == Generating l1 keys | ||
docker compose run scripts write-accounts | ||
docker compose run --entrypoint sh geth -c "echo passphrase > /datadir/passphrase" | ||
docker compose run --entrypoint sh geth -c "chown -R 1000:1000 /keystore" | ||
docker compose run --entrypoint sh geth -c "chown -R 1000:1000 /config" | ||
|
||
echo == Writing geth configs | ||
docker compose up --wait geth | ||
docker compose run scripts write-geth-genesis-config | ||
|
||
echo == Funding validator, sequencer and l2owner | ||
docker compose run scripts send-l1 --ethamount 1000 --to validator --wait | ||
docker compose run scripts send-l1 --ethamount 1000 --to sequencer --wait | ||
docker compose run scripts send-l1 --ethamount 1000 --to l2owner --wait | ||
docker compose run scripts send-l1 --ethamount 10000 --to espresso-sequencer --wait | ||
|
||
echo == create l1 traffic | ||
docker compose run scripts send-l1 --ethamount 1000 --to user_l1user --wait | ||
docker compose run scripts send-l1 --ethamount 0.0001 --from user_l1user --to user_l1user_b --wait --delay 500 --times 1000000 > /dev/null & | ||
|
||
l2ownerAddress=`docker compose run scripts print-address --account l2owner | tail -n 1 | tr -d '\r\n'` | ||
echo $l2ownerAddress | ||
|
||
echo == Writing l2 chain config | ||
docker compose run scripts --l2owner $l2ownerAddress write-l2-chain-config --espresso | ||
|
||
sequenceraddress=`docker compose run scripts print-address --account sequencer | tail -n 1 | tr -d '\r\n'` | ||
l2ownerKey=`docker compose run scripts print-private-key --account l2owner | tail -n 1 | tr -d '\r\n'` | ||
wasmroot=`docker compose run --entrypoint sh sequencer -c "cat /home/user/target/machines/latest/module-root.txt"` | ||
|
||
echo == Deploying L2 chain | ||
docker compose run -e PARENT_CHAIN_RPC="http://geth:8545" -e DEPLOYER_PRIVKEY=$l2ownerKey -e PARENT_CHAIN_ID=$l1chainid -e CHILD_CHAIN_NAME="arb-dev-test" -e MAX_DATA_SIZE=117964 -e OWNER_ADDRESS=$l2ownerAddress -e WASM_MODULE_ROOT=$wasmroot -e SEQUENCER_ADDRESS=$sequenceraddress -e AUTHORIZE_VALIDATORS=10 -e CHILD_CHAIN_CONFIG_PATH="/config/l2_chain_config.json" -e CHAIN_DEPLOYMENT_INFO="/config/deployment.json" -e CHILD_CHAIN_INFO="/config/deployed_chain_info.json" -e LIGHT_CLIENT_ADDR=$lightClientAddr rollupcreator create-rollup-testnode | ||
docker compose run --entrypoint sh rollupcreator -c "jq [.[]] /config/deployed_chain_info.json > /config/l2_chain_info.json" | ||
docker compose run --entrypoint sh rollupcreator -c "cat /config/l2_chain_info.json" | ||
|
||
echo == Writing config | ||
docker compose run scripts write-config --espresso --lightClientAddress $lightClientAddr | ||
echo == Initializing redis | ||
docker compose up --wait redis | ||
docker compose run scripts redis-init | ||
|
||
echo == Funding l2 funnel and dev key | ||
docker compose up --wait $INITIAL_SEQ_NODES | ||
docker compose run scripts bridge-funds --ethamount 100000 --wait | ||
docker compose run scripts send-l2 --ethamount 10000 --to espresso-sequencer --wait | ||
docker compose run scripts send-l2 --ethamount 100 --to l2owner --wait | ||
|
||
|
||
echo == Deploy CacheManager on L2 | ||
docker compose run -e CHILD_CHAIN_RPC="http://sequencer:8547" -e CHAIN_OWNER_PRIVKEY=$l2ownerKey rollupcreator deploy-cachemanager-testnode | ||
fi | ||
|
||
|
||
UP_FLAG="" | ||
if $detach; then | ||
UP_FLAG="--wait" | ||
fi | ||
|
||
echo == Launching Sequencer | ||
echo if things go wrong - use --init to create a new chain | ||
echo $NODES | ||
|
||
docker compose up $UP_FLAG $NODES |
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 |
---|---|---|
@@ -0,0 +1,195 @@ | ||
services: | ||
postgres: | ||
image: postgres:13.6 | ||
restart: always | ||
container_name: "postgres" | ||
environment: | ||
POSTGRES_PASSWORD: "" | ||
POSTGRES_USER: "postgres" | ||
POSTGRES_HOST_AUTH_METHOD: "trust" | ||
volumes: | ||
- "postgres-data:/var/lib/postgresql/data" | ||
ports: | ||
- "127.0.0.1:7432:5432" | ||
|
||
redis: | ||
image: redis:6.2.6 | ||
ports: | ||
- "127.0.0.1:6379:6379" | ||
|
||
geth: | ||
image: ethereum/client-go:v1.10.23 | ||
ports: | ||
- "127.0.0.1:8545:8545" | ||
- "127.0.0.1:8551:8551" | ||
- "127.0.0.1:8546:8546" | ||
- "127.0.0.1:30303:30303" | ||
volumes: | ||
- "l1data:/datadir" | ||
- "l1keystore:/keystore" | ||
- "config:/config" | ||
command: | ||
- --keystore=/keystore | ||
- --http | ||
- --datadir=/datadir | ||
- --http.addr=0.0.0.0 | ||
- --authrpc.vhosts=* | ||
- --authrpc.port=8551 | ||
- --authrpc.addr=0.0.0.0 | ||
- --http.vhosts=* | ||
- --http.api=engine,personal,eth,net,web3 | ||
- --http.corsdomain=* | ||
- --ws | ||
- --ws.addr=0.0.0.0 | ||
- --ws.api=personal,eth,net,web3,debug,txpool | ||
- --allow-insecure-unlock | ||
- --unlock=0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E | ||
- --password=/datadir/passphrase | ||
- --authrpc.jwtsecret=/config/jwt.hex | ||
- --nodiscover | ||
- --syncmode=full | ||
- --dev | ||
- --dev.period=1 | ||
- --mine | ||
- --miner.etherbase=0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E | ||
- --gcmode=archive | ||
|
||
sequencer: | ||
pid: host # allow debugging | ||
image: nitro-node-dev-testnode | ||
entrypoint: /usr/local/bin/nitro | ||
ports: | ||
- "127.0.0.1:8547:8547" | ||
- "127.0.0.1:8548:8548" | ||
- "127.0.0.1:9642:9642" | ||
volumes: | ||
- "seqdata:/home/user/.arbitrum/local/nitro" | ||
- "l1keystore:/home/user/l1keystore" | ||
- "config:/config" | ||
command: --conf.file /config/sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain * | ||
depends_on: | ||
- geth | ||
|
||
# Reads from sequencer feed, forwards transactions to sequencer | ||
full-node: | ||
pid: host # allow debugging | ||
image: nitro-node-dev-testnode | ||
ports: | ||
- "127.0.0.1:8947:8547" | ||
- "127.0.0.1:8948:8548" | ||
entrypoint: /usr/local/bin/nitro | ||
volumes: | ||
- "config:/config" | ||
- "l1keystore:/home/user/l1keystore" | ||
# use the sequencer_config.json but override the sequencer settings and the forwarding settings. | ||
command: --conf.file /config/sequencer_config.json --node.sequencer=false --node.batch-poster.enable=false --execution.sequencer.enable=false --execution.forwarding-target http://sequencer:8547 --node.delayed-sequencer.enable=false --node.feed.input.url ws://sequencer:9642 --http.port 8547 --http.api net,web3,arb,debug,net,eth --ws.port 8548 | ||
depends_on: | ||
- geth | ||
- sequencer | ||
|
||
poster: | ||
pid: host # allow debugging | ||
image: nitro-node-dev-testnode | ||
entrypoint: /usr/local/bin/nitro | ||
ports: | ||
- "127.0.0.1:8147:8547" | ||
- "127.0.0.1:8148:8548" | ||
volumes: | ||
- "poster-data:/home/user/.arbitrum/local/nitro" | ||
- "l1keystore:/home/user/l1keystore" | ||
- "config:/config" | ||
command: --conf.file /config/poster_config.json | ||
depends_on: | ||
- geth | ||
- redis | ||
|
||
validator: | ||
pid: host # allow debugging | ||
image: nitro-node-dev-testnode | ||
entrypoint: /usr/local/bin/nitro | ||
ports: | ||
- "127.0.0.1:8247:8547" | ||
- "127.0.0.1:8248:8548" | ||
volumes: | ||
- "validator-data:/home/user/.arbitrum/local/nitro" | ||
- "l1keystore:/home/user/l1keystore" | ||
- "config:/config" | ||
command: --conf.file /config/validator_config.json --http.port 8547 --http.api net,web3,arb,debug,net,eth --ws.port 8548 | ||
depends_on: | ||
- sequencer | ||
- validation_node | ||
|
||
validation_node: | ||
pid: host # allow debugging | ||
image: nitro-node-dev-testnode | ||
entrypoint: /usr/local/bin/nitro-val | ||
ports: | ||
- "127.0.0.1:8949:8549" | ||
volumes: | ||
- "config:/config" | ||
command: --conf.file /config/validation_node_config.json | ||
|
||
scripts: | ||
build: scripts/ | ||
volumes: | ||
- "l1keystore:/home/user/l1keystore" | ||
- "config:/config" | ||
|
||
rollupcreator: | ||
depends_on: | ||
- geth | ||
- sequencer | ||
pid: host | ||
build: | ||
context: rollupcreator/ | ||
args: | ||
NITRO_CONTRACTS_REPO: ${NITRO_CONTRACTS_REPO:-} | ||
NITRO_CONTRACTS_BRANCH: ${NITRO_CONTRACTS_BRANCH:-} | ||
volumes: | ||
- "config:/config" | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
|
||
espresso-dev-node: | ||
# TODO: revert to `:main` tag once we are compatible with the marketplace builder | ||
image: ghcr.io/espressosystems/espresso-sequencer/espresso-dev-node:20240919-dev-node-legacy-builder | ||
ports: | ||
- "$ESPRESSO_SEQUENCER_API_PORT:$ESPRESSO_SEQUENCER_API_PORT" | ||
- "$ESPRESSO_BUILDER_PORT:$ESPRESSO_BUILDER_PORT" | ||
- "$ESPRESSO_DEV_NODE_PORT:$ESPRESSO_DEV_NODE_PORT" | ||
environment: | ||
- ESPRESSO_SEQUENCER_L1_PROVIDER | ||
- ESPRESSO_SEQUENCER_ETH_MNEMONIC | ||
- ESPRESSO_DEPLOYER_ACCOUNT_INDEX | ||
- ESPRESSO_SEQUENCER_API_PORT | ||
- ESPRESSO_BUILDER_PORT | ||
- ESPRESSO_DEV_NODE_PORT | ||
- RUST_LOG=info | ||
- RUST_LOG_FORMAT | ||
- ESPRESSO_DEPLOYER_ALT_CHAIN_PROVIDERS | ||
- ESPRESSO_DEPLOYER_ALT_MNEMONICS | ||
- ESPRESSO_SEQUENCER_DEPLOYER_ALT_INDICES | ||
depends_on: | ||
- geth | ||
- sequencer | ||
healthcheck: | ||
test: | ||
[ | ||
"CMD-SHELL", | ||
"curl -fL http://localhost:$ESPRESSO_DEV_NODE_PORT || exit 1", | ||
] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 5 | ||
start_period: 40s | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
|
||
volumes: | ||
l1data: | ||
consensus: | ||
l1keystore: | ||
seqdata: | ||
validator-data: | ||
poster-data: | ||
config: | ||
postgres-data: |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How hard would it be to not duplicate this bash script and the docker compose file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldnt be hard, I can do that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b41364d