Port over optimism stack and update to use latest releases #1

Merged
ashwin merged 13 commits from deep-stack/fixturenet-optimism-stack:pm-updated-stack into main 2024-05-07 04:18:03 +00:00
2 changed files with 39 additions and 29 deletions
Showing only changes of commit eaa23dcf73 - Show all commits

View File

@ -1,6 +1,6 @@
# fixturenet-optimism
Instructions to setup and deploy an end-to-end L1+L2 stack with [fixturenet-plugeth](https://git.vdb.to/cerc-io/stack-orchestrator/src/branch/main/stack_orchestrator/data/stacks/fixturenet-plugeth-tx) (L1) and [Optimism](https://stack.optimism.io) (L2)
Instructions to setup and deploy an end-to-end L1+L2 stack with [fixturenet-plugeth](https://git.vdb.to/cerc-io/stack-orchestrator/src/branch/main/stack_orchestrator/data/stacks/fixturenet-plugeth) (L1) and [Optimism](https://stack.optimism.io) (L2)
## Setup
@ -13,6 +13,10 @@ laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-optimism-stack
Clone required repositories:
```bash
# L1 (fixturenet-plugeth)
laconic-so --stack fixturenet-plugeth setup-repositories
# L2 (optimism)
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism setup-repositories
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove concerned repositories and re-run the command
@ -22,6 +26,10 @@ laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism se
Build the container images:
```bash
# L1 (fixturenet-plugeth)
laconic-so --stack fixturenet-plugeth build-containers
# L2 (optimism)
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism build-containers
# If redeploying with changes in the stack containers
@ -40,7 +48,6 @@ This should create the required docker images in the local image registry:
* cerc/lighthouse
* cerc/lighthouse-cli
* cerc/fixturenet-eth-lighthouse
* cerc/foundry
* cerc/optimism-contracts
* cerc/optimism-op-node
* cerc/optimism-l2geth
@ -52,6 +59,8 @@ This should create the required docker images in the local image registry:
First, create a spec file for the deployment, which will map the stack's ports and volumes to the host:
```bash
laconic-so --stack fixturenet-plugeth deploy init --output fixturenet-plugeth.yml
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy init --map-ports-to-host any-fixed-random --output fixturenet-optimism-spec.yml
```
@ -84,7 +93,21 @@ The default setup (generated by `laconic-so deploy init`) places the volumes in
Once you've made any needed changes to the spec file, create a deployment from it:
```bash
laconic-so --stack fixturenet-plugeth deploy create --spec-file fixturenet-plugeth.yml --deployment-dir fixturenet-plugeth-deployment
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy create --spec-file fixturenet-optimism-spec.yml --deployment-dir fixturenet-optimism-deployment
# Place them both in the same namespace (cluster)
cp fixturenet-plugeth-deployment/deployment.yml fixturenet-optimism-deployment/deployment.yml
```
### Env configuration
Inside the `fixturenet-plugeth-deployment` deployment directory, open `config.env` file and set following env variables:
```bash
# Allow unprotected txs for Optimism contracts deployment
CERC_ALLOW_UNPROTECTED_TXS=true
```
## Start the stack
@ -92,6 +115,7 @@ laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism de
Start the deployment:
```bash
laconic-so deployment --dir fixturenet-plugeth-deployment start
laconic-so deployment --dir fixturenet-optimism-deployment start
```
@ -105,6 +129,7 @@ laconic-so deployment --dir fixturenet-optimism-deployment start
To list and monitor the running containers:
```bash
laconic-so --stack fixturenet-plugeth deploy ps
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy ps
# With status
@ -140,13 +165,13 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
If you need to check the L1 chain-id, you can use:
```bash
docker run --rm --network $NETWORK cerc/foundry:local "cast chain-id --rpc-url $L1_RPC"
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast chain-id --rpc-url $L1_RPC"
```
3. Check the account starting balance on L2 (it should be 0):
```bash
docker run --rm --network $NETWORK cerc/foundry:local "cast balance $ACCOUNT --rpc-url $L2_RPC"
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast balance $ACCOUNT --rpc-url $L2_RPC"
# 0
```
@ -155,13 +180,16 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
```bash
# get the container id for op-node
NODE_CONTAINER=$(docker ps --filter "name=op-node" -q)
BRIDGE=$(docker exec $NODE_CONTAINER cat /l1-deployment/$DEPLOYMENT_CONTEXT/L1StandardBridgeProxy.json | jq -r .address)
BRIDGE=$(docker exec $NODE_CONTAINER cat /l1-deployment/$DEPLOYMENT_CONTEXT/.deploy | jq -r .L1StandardBridgeProxy)
# get the funded account's pk
ACCOUNT_PK=$(docker exec $NODE_CONTAINER jq -r '.AdminKey' /l2-accounts/accounts.json)
```
5. Use cast to send some ETH to the bridge contract:
```bash
docker run --rm --network $NETWORK cerc/foundry:local "cast send --from $ACCOUNT --value 1ether $BRIDGE --rpc-url $L1_RPC"
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast send --from $ACCOUNT --value 1ether $BRIDGE --rpc-url $L1_RPC --private-key $ACCOUNT_PK"
```
6. Allow a couple minutes for the bridge to complete
@ -169,7 +197,7 @@ We can use the testing account `0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F` whic
7. Check the L2 balance again (it should show the bridged funds):
```bash
docker run --rm --network $NETWORK cerc/foundry:local "cast balance $ACCOUNT --rpc-url $L2_RPC"
docker run --rm --network $NETWORK cerc/optimism-contracts:local "cast balance $ACCOUNT --rpc-url $L2_RPC"
# 1000000000000000000
```
@ -179,12 +207,14 @@ To stop all services running in the background, while preserving chain data:
```bash
laconic-so deployment --dir fixturenet-optimism-deployment stop
laconic-so deployment --dir fixturenet-plugeth-deployment stop
```
To stop all services and also delete chain data:
```bash
laconic-so deployment --dir fixturenet-optimism-deployment stop --delete-volumes
laconic-so deployment --dir fixturenet-plugeth-deployment stop --delete-volumes
```
## Troubleshooting
@ -220,8 +250,3 @@ laconic-so deployment --dir fixturenet-optimism-deployment stop --delete-volumes
```
* Re-run the deployment command used in [Deploy](#deploy) to restart the stopped containers
## Known Issues
* Resource requirements (memory + time) for building the `cerc/foundry` image are on the higher side
* `cerc/optimism-contracts` image is currently based on `cerc/foundry` (Optimism requires foundry installation)

View File

@ -1,31 +1,16 @@
version: "1.0"
version: "1.1"
name: fixturenet-optimism
description: "Optimism Fixturenet"
repos:
# L1 (fixturenet-plugeth)
- git.vdb.to/cerc-io/plugeth@statediff
- git.vdb.to/cerc-io/plugeth-statediff
- git.vdb.to/cerc-io/lighthouse
# L2 (optimism)
- github.com/dboreham/foundry
- github.com/ethereum-optimism/optimism@v1.7.3
- github.com/ethereum-optimism/optimism@v1.7.4
- github.com/ethereum-optimism/op-geth@v1.101311.0
containers:
# L1 (fixturenet-plugeth)
- cerc/plugeth-statediff
- cerc/plugeth
- cerc/fixturenet-eth-genesis
- cerc/fixturenet-plugeth-plugeth
- cerc/lighthouse
- cerc/lighthouse-cli
- cerc/fixturenet-eth-lighthouse
# L2 (optimism)
- cerc/foundry
- cerc/optimism-contracts
- cerc/optimism-op-node
- cerc/optimism-l2geth
- cerc/optimism-op-batcher
- cerc/optimism-op-proposer
pods:
- fixturenet-plugeth
- fixturenet-optimism