|
|
|
@ -2,24 +2,20 @@
|
|
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
|
|
### L1 eth and L2 Optimism Stacks
|
|
|
|
|
### Eth Stack
|
|
|
|
|
|
|
|
|
|
- Clone the stack repo:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-eth-stacks --pull
|
|
|
|
|
laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-optimism-stack --pull
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Clone required repositories:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# L1 (fixturenet-eth)
|
|
|
|
|
# (fixturenet-eth)
|
|
|
|
|
laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth setup-repositories --pull
|
|
|
|
|
|
|
|
|
|
# L2 (optimism)
|
|
|
|
|
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism setup-repositories --pull
|
|
|
|
|
|
|
|
|
|
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove all repositories from that stack and re-run the command
|
|
|
|
|
# The repositories are located in $HOME/cerc by default
|
|
|
|
|
```
|
|
|
|
@ -30,12 +26,9 @@
|
|
|
|
|
# Remove any older foundry image with `latest` tag
|
|
|
|
|
docker rmi ghcr.io/foundry-rs/foundry:latest
|
|
|
|
|
|
|
|
|
|
# L1 (fixturenet-eth)
|
|
|
|
|
# (fixturenet-eth)
|
|
|
|
|
laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth build-containers --force-rebuild
|
|
|
|
|
|
|
|
|
|
# L2 (optimism)
|
|
|
|
|
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism build-containers --force-rebuild
|
|
|
|
|
|
|
|
|
|
# If errors are thrown during build, old images used by this stack would have to be deleted
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
@ -51,8 +44,6 @@
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth deploy init --output fixturenet-eth-spec.yml
|
|
|
|
|
|
|
|
|
|
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy init --output fixturenet-optimism-spec.yml
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Configure ports:
|
|
|
|
@ -75,28 +66,11 @@
|
|
|
|
|
...
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- `fixturenet-optimism-spec.yml`
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
...
|
|
|
|
|
network:
|
|
|
|
|
ports:
|
|
|
|
|
op-geth:
|
|
|
|
|
- '9545:8545'
|
|
|
|
|
- '9546:8546'
|
|
|
|
|
...
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Create deployments:
|
|
|
|
|
Once you've made any needed changes to the spec files, create deployments from them:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth deploy create --spec-file fixturenet-eth-spec.yml --deployment-dir fixturenet-eth-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-eth-deployment/deployment.yml fixturenet-optimism-deployment/deployment.yml
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Env configuration:
|
|
|
|
@ -205,7 +179,7 @@
|
|
|
|
|
|
|
|
|
|
## Run
|
|
|
|
|
|
|
|
|
|
- Start L1, L2 stacks:
|
|
|
|
|
- Start fixturenet eth stack:
|
|
|
|
|
(run steps in directory where the stack deployments had been created)
|
|
|
|
|
|
|
|
|
|
- Start `fixturenet-eth-deployment` deployment:
|
|
|
|
@ -228,80 +202,12 @@
|
|
|
|
|
laconic-so deployment --dir fixturenet-eth-deployment logs -f fixturenet-eth-geth-1
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Start `fixturenet-optimism-deployment` deployment:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
laconic-so deployment --dir fixturenet-optimism-deployment start
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
NOTE: The `fixturenet-optimism-contracts` service will configure and deploy the Optimism contracts to L1, exiting when complete. This may take several minutes; you can follow the progress by following the container's logs
|
|
|
|
|
|
|
|
|
|
- Follow optimism contracts deployment logs:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
laconic-so deployment --dir fixturenet-optimism-deployment logs -f fixturenet-optimism-contracts
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Check L2 logs:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
laconic-so deployment --dir fixturenet-optimism-deployment logs -f op-geth
|
|
|
|
|
|
|
|
|
|
# Ensure new blocks are getting created
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Send ETH from L1 to L2 (run steps in directory where the stack deployments had been created)
|
|
|
|
|
|
|
|
|
|
- Get information about funded accounts on L1
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
curl 127.0.0.1:9898/accounts.csv
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Send some ETH from the desired account to the `L1StandardBridgeProxy` contract on L1 to bridge it to L2:
|
|
|
|
|
- Set the following variables:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
L1_RPC=http://fixturenet-eth-geth-1:8545
|
|
|
|
|
L2_RPC=http://op-geth:8545
|
|
|
|
|
|
|
|
|
|
DEPLOYMENT_CONTEXT=1212
|
|
|
|
|
ACCOUNT=0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Read the bridge contract address from the L1 deployment records in the `op-node` container:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
BRIDGE=$(laconic-so deployment --dir fixturenet-optimism-deployment exec op-node "cat /l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json" | jq -r .L1StandardBridgeProxy)
|
|
|
|
|
|
|
|
|
|
# Get the funded account's pk
|
|
|
|
|
ACCOUNT_PK=$(laconic-so deployment --dir fixturenet-optimism-deployment exec op-node "jq -r '.AdminKey' /l2-accounts/accounts.json")
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Use cast to send ETH to the bridge contract:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
laconic-so deployment --dir fixturenet-eth-deployment exec foundry "cast send --from $ACCOUNT --value 1ether $BRIDGE --rpc-url $L1_RPC --private-key $ACCOUNT_PK"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
NOTE: This is for sending funds to the contracts deployer account which is also the Bridge node account
|
|
|
|
|
|
|
|
|
|
- Allow a couple minutes for the bridge to complete
|
|
|
|
|
|
|
|
|
|
- Check balance on L2
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
laconic-so deployment --dir fixturenet-eth-deployment exec foundry "cast balance $ACCOUNT --rpc-url $L2_RPC"
|
|
|
|
|
|
|
|
|
|
# 100000000000000000
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Deploy L1 nitro contracts
|
|
|
|
|
|
|
|
|
|
- Create a deployment spec-file for L1 nitro contract:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts deploy init --output nitro-contracts-spec.yml --config "GETH_URL=http://host.docker.internal:8545,GETH_DEPLOYER_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,GETH_CHAIN_ID=1212,TOKEN_NAME=LaconicNetworkToken,TOKEN_SYMBOL=LNT,INITIAL_TOKEN_SUPPLY=129600"
|
|
|
|
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts deploy init --output nitro-contracts-spec.yml --config "GETH_URL=http://host.docker.internal:8545,GETH_DEPLOYER_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,GETH_CHAIN_ID=1212,TOKEN_NAME=TestToken,TOKEN_SYMBOL=TST,INITIAL_TOKEN_SUPPLY=129600"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Create a deployment `nitro-contracts` from the spec file
|
|
|
|
@ -329,13 +235,12 @@
|
|
|
|
|
export NA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json")
|
|
|
|
|
export CA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json")
|
|
|
|
|
export VPA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json")
|
|
|
|
|
export L1_ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Create a spec-file for the deployment, map container ports to host ports and set env variables:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy init --map-ports-to-host any-same --output bridge-nitro-spec.yml --config "NITRO_CHAIN_URL=ws://host.docker.internal:8546,NITRO_CHAIN_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,NITRO_SC_PK=0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4,OPTIMISM_URL=http://host.docker.internal:9545,TOKEN_NAME=LaconicNetworkToken,TOKEN_SYMBOL=LNT,INITIAL_TOKEN_SUPPLY=129600,NA_ADDRESS=$NA_ADDRESS,VPA_ADDRESS=$VPA_ADDRESS,CA_ADDRESS=$CA_ADDRESS,L1_ASSET_ADDRESS=$L1_ASSET_ADDRESS"
|
|
|
|
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy init --map-ports-to-host any-same --output bridge-nitro-spec.yml --config "NITRO_CHAIN_URL=ws://host.docker.internal:8546,NITRO_CHAIN_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,NITRO_SC_PK=0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4,TOKEN_NAME=TestToken,TOKEN_SYMBOL=TST,INITIAL_TOKEN_SUPPLY=129600,NA_ADDRESS=$NA_ADDRESS,VPA_ADDRESS=$VPA_ADDRESS,CA_ADDRESS=$CA_ADDRESS"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Create a deployment from the spec file:
|
|
|
|
@ -349,14 +254,11 @@
|
|
|
|
|
```bash
|
|
|
|
|
laconic-so deployment --dir bridge-deployment start
|
|
|
|
|
|
|
|
|
|
# Check the l2 nitro contract deployments
|
|
|
|
|
laconic-so deployment --dir bridge-deployment logs l2-nitro-contracts -f
|
|
|
|
|
|
|
|
|
|
# Check the logs, ensure that the node is running
|
|
|
|
|
laconic-so deployment --dir bridge-deployment logs nitro-bridge -f
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
- Send custom tokens to Alice and Charlie on L1
|
|
|
|
|
- Send custom tokens to Alice and Charlie
|
|
|
|
|
|
|
|
|
|
- Export variables for L1 token address
|
|
|
|
|
|
|
|
|
@ -386,9 +288,6 @@
|
|
|
|
|
export NA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json")
|
|
|
|
|
export CA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json")
|
|
|
|
|
export VPA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json")
|
|
|
|
|
|
|
|
|
|
# Contract address of bridge
|
|
|
|
|
export OPTIMISM_CHAIN_ID="42069"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|