Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
3672d88d77 | |||
d660887f35 | |||
f2fa7b5304 |
@ -2,20 +2,24 @@
|
|||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
### eth-stack
|
### L1 eth and L2 Optimism Stacks
|
||||||
|
|
||||||
- Clone the stack repo:
|
- Clone the stack repo:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-eth-stacks --pull
|
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:
|
- Clone required repositories:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# fixturenet-eth
|
# L1 (fixturenet-eth)
|
||||||
laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth setup-repositories --pull
|
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
|
# 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
|
# The repositories are located in $HOME/cerc by default
|
||||||
```
|
```
|
||||||
@ -26,9 +30,12 @@
|
|||||||
# Remove any older foundry image with `latest` tag
|
# Remove any older foundry image with `latest` tag
|
||||||
docker rmi ghcr.io/foundry-rs/foundry:latest
|
docker rmi ghcr.io/foundry-rs/foundry:latest
|
||||||
|
|
||||||
# fixturenet-eth
|
# L1 (fixturenet-eth)
|
||||||
laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth build-containers --force-rebuild
|
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
|
# If errors are thrown during build, old images used by this stack would have to be deleted
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -44,6 +51,8 @@
|
|||||||
|
|
||||||
```bash
|
```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-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:
|
- Configure ports:
|
||||||
@ -66,11 +75,28 @@
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- `fixturenet-optimism-spec.yml`
|
||||||
|
|
||||||
|
```yml
|
||||||
|
...
|
||||||
|
network:
|
||||||
|
ports:
|
||||||
|
op-geth:
|
||||||
|
- '9545:8545'
|
||||||
|
- '9546:8546'
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
- Create deployments:
|
- Create deployments:
|
||||||
Once you've made any needed changes to the spec files, create deployments from them:
|
Once you've made any needed changes to the spec files, create deployments from them:
|
||||||
|
|
||||||
```bash
|
```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-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:
|
- Env configuration:
|
||||||
@ -81,7 +107,7 @@
|
|||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
### go-nitro
|
### Go-nitro
|
||||||
|
|
||||||
- Clone the stack repo:
|
- Clone the stack repo:
|
||||||
|
|
||||||
@ -99,9 +125,6 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild
|
||||||
|
|
||||||
# Build nitro-contracts container image
|
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts build-containers --force-rebuild
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- Create a deployment spec-file for Alice's L1 nitro-node:
|
- Create a deployment spec-file for Alice's L1 nitro-node:
|
||||||
@ -182,7 +205,7 @@
|
|||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
- Start fixturenet eth stack:
|
- Start L1, L2 stacks:
|
||||||
(run steps in directory where the stack deployments had been created)
|
(run steps in directory where the stack deployments had been created)
|
||||||
|
|
||||||
- Start `fixturenet-eth-deployment` deployment:
|
- Start `fixturenet-eth-deployment` deployment:
|
||||||
@ -205,12 +228,86 @@
|
|||||||
laconic-so deployment --dir fixturenet-eth-deployment logs -f fixturenet-eth-geth-1
|
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
|
- Deploy L1 nitro contracts
|
||||||
|
|
||||||
- Create a deployment spec-file for L1 nitro contract:
|
- Create a deployment spec-file for L1 nitro contract:
|
||||||
|
|
||||||
```bash
|
```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=TestToken,TOKEN_SYMBOL=TST,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=LaconicNetworkToken,\
|
||||||
|
TOKEN_SYMBOL=LNT,\
|
||||||
|
INITIAL_TOKEN_SUPPLY=129600"
|
||||||
```
|
```
|
||||||
|
|
||||||
- Create a deployment `nitro-contracts` from the spec file
|
- Create a deployment `nitro-contracts` from the spec file
|
||||||
@ -224,7 +321,7 @@
|
|||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir nitro-contracts-deployment start
|
laconic-so deployment --dir nitro-contracts-deployment start
|
||||||
|
|
||||||
# Check the l1 nitro contract deployments
|
# Check the L1 nitro contract deployments
|
||||||
laconic-so deployment --dir nitro-contracts-deployment logs nitro-contracts -f
|
laconic-so deployment --dir nitro-contracts-deployment logs nitro-contracts -f
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -238,12 +335,26 @@
|
|||||||
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 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 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 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:
|
- Create a spec-file for the deployment, map container ports to host ports and set env variables:
|
||||||
|
|
||||||
```bash
|
```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,TOKEN_NAME=TestToken,TOKEN_SYMBOL=TST,INITIAL_TOKEN_SUPPLY=129600,NA_ADDRESS=$NA_ADDRESS,VPA_ADDRESS=$VPA_ADDRESS,CA_ADDRESS=$CA_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_L1_CHAIN_URL=ws://host.docker.internal:8546,\
|
||||||
|
NITRO_L2_CHAIN_URL=ws://host.docker.internal:9546,\
|
||||||
|
NITRO_CHAIN_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,\
|
||||||
|
NITRO_SC_PK=0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4,\
|
||||||
|
OPTIMISM_URL=http://host.docker.internal:9545,\
|
||||||
|
OPTIMISM_DEPLOYER_PK=$ACCOUNT_PK,\
|
||||||
|
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"
|
||||||
```
|
```
|
||||||
|
|
||||||
- Create a deployment from the spec file:
|
- Create a deployment from the spec file:
|
||||||
@ -257,17 +368,20 @@
|
|||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir bridge-deployment start
|
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
|
# Check the logs, ensure that the node is running
|
||||||
laconic-so deployment --dir bridge-deployment logs nitro-bridge -f
|
laconic-so deployment --dir bridge-deployment logs nitro-bridge -f
|
||||||
```
|
```
|
||||||
|
|
||||||
- Send custom tokens to Alice and Charlie
|
- Send custom tokens to Alice and Charlie on L1
|
||||||
|
|
||||||
- Export variables for L1 token address
|
- Export variables for L1 token address
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export GETH_CHAIN_ID="1212"
|
export GETH_CHAIN_ID="1212"
|
||||||
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.TestToken.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")
|
||||||
|
|
||||||
export A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
|
export A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
|
||||||
export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
|
export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
|
||||||
@ -277,10 +391,10 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Send tokens to Alice
|
# Send tokens to Alice
|
||||||
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth"
|
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth"
|
||||||
|
|
||||||
# Send tokens to Charlie
|
#Send tokens to Charlie
|
||||||
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth"
|
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth"
|
||||||
```
|
```
|
||||||
|
|
||||||
- Get the deployed nitro contract addresses (run in the directory where the deployments were created):
|
- Get the deployed nitro contract addresses (run in the directory where the deployments were created):
|
||||||
@ -291,6 +405,10 @@
|
|||||||
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 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 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 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"
|
||||||
|
export BRIDGE_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"$OPTIMISM_CHAIN_ID\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json")
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -358,6 +476,7 @@
|
|||||||
NA_ADDRESS=$NA_ADDRESS
|
NA_ADDRESS=$NA_ADDRESS
|
||||||
VPA_ADDRESS=$VPA_ADDRESS
|
VPA_ADDRESS=$VPA_ADDRESS
|
||||||
CA_ADDRESS=$CA_ADDRESS
|
CA_ADDRESS=$CA_ADDRESS
|
||||||
|
BRIDGE_ADDRESS=$BRIDGE_ADDRESS
|
||||||
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
|
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
|
||||||
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3009
|
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3009
|
||||||
NITRO_L2=true
|
NITRO_L2=true
|
||||||
@ -380,6 +499,7 @@
|
|||||||
NA_ADDRESS=$NA_ADDRESS
|
NA_ADDRESS=$NA_ADDRESS
|
||||||
VPA_ADDRESS=$VPA_ADDRESS
|
VPA_ADDRESS=$VPA_ADDRESS
|
||||||
CA_ADDRESS=$CA_ADDRESS
|
CA_ADDRESS=$CA_ADDRESS
|
||||||
|
BRIDGE_ADDRESS=$BRIDGE_ADDRESS
|
||||||
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
|
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
|
||||||
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3010
|
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3010
|
||||||
NITRO_L2=true
|
NITRO_L2=true
|
||||||
@ -430,7 +550,7 @@
|
|||||||
- Open new terminal, check that no channels exist on L2
|
- Open new terminal, check that no channels exist on L2
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4005 -h nitro-bridge"
|
laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge"
|
||||||
|
|
||||||
# Expected output:
|
# Expected output:
|
||||||
# []
|
# []
|
||||||
@ -441,13 +561,13 @@
|
|||||||
```bash
|
```bash
|
||||||
export BRIDGE_NITRO_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
|
export BRIDGE_NITRO_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
|
||||||
export GETH_CHAIN_ID="1212"
|
export GETH_CHAIN_ID="1212"
|
||||||
export ASSET_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"$GETH_CHAIN_ID\"[0].contracts.TestToken.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 ledger channel between A and Bridge with custom token
|
- Create ledger channel between A and Bridge with custom token
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir l1alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-fund $BRIDGE_NITRO_ADDRESS --assetAddress $ASSET_ADDRESS --alphaAmount 1000000 --betaAmount 1000000 -p 4005 -h nitro-node"
|
laconic-so deployment --dir l1alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-fund $BRIDGE_NITRO_ADDRESS --assetAddress $L1_ASSET_ADDRESS --alphaAmount 1000000 --betaAmount 1000000 -p 4005 -h nitro-node"
|
||||||
|
|
||||||
# Expected Output:
|
# Expected Output:
|
||||||
# Objective started DirectFunding-0x161d289a50222caa781db215bb82a3ede4f557217742245525b8e8cbff04ec21
|
# Objective started DirectFunding-0x161d289a50222caa781db215bb82a3ede4f557217742245525b8e8cbff04ec21
|
||||||
@ -491,7 +611,7 @@
|
|||||||
- Create ledger channel between C and Bridge with custom token
|
- Create ledger channel between C and Bridge with custom token
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir l1charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-fund $BRIDGE_NITRO_ADDRESS --assetAddress $ASSET_ADDRESS --alphaAmount 1000000 --betaAmount 1000000 -p 4005 -h nitro-node"
|
laconic-so deployment --dir l1charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-fund $BRIDGE_NITRO_ADDRESS --assetAddress $L1_ASSET_ADDRESS --alphaAmount 1000000 --betaAmount 1000000 -p 4005 -h nitro-node"
|
||||||
|
|
||||||
# Expected Output:
|
# Expected Output:
|
||||||
# Objective started DirectFunding-0x69a3f09b6f4f94f033cf084e6e4a9453438c45b43606e9a95f5434f4c6527543
|
# Objective started DirectFunding-0x69a3f09b6f4f94f033cf084e6e4a9453438c45b43606e9a95f5434f4c6527543
|
||||||
@ -535,7 +655,7 @@
|
|||||||
- Check status of all L2 mirrored ledger channels
|
- Check status of all L2 mirrored ledger channels
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4005 -h nitro-bridge"
|
laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge"
|
||||||
|
|
||||||
# Expected output:
|
# Expected output:
|
||||||
# [
|
# [
|
||||||
@ -781,18 +901,20 @@
|
|||||||
sudo rm -rf nitro-contracts-deployment
|
sudo rm -rf nitro-contracts-deployment
|
||||||
```
|
```
|
||||||
|
|
||||||
- Clean up eth-stack deployment:
|
- Clean up L1 and L2 deployments:
|
||||||
- Stop deployment and remove volume:
|
- Stop deployment and remove volumes:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run where deployments are created
|
# Run where deployments are created
|
||||||
|
laconic-so deployment --dir fixturenet-optimism-deployment stop --delete-volumes
|
||||||
laconic-so deployment --dir fixturenet-eth-deployment stop --delete-volumes
|
laconic-so deployment --dir fixturenet-eth-deployment stop --delete-volumes
|
||||||
```
|
```
|
||||||
|
|
||||||
- Clear deployment:
|
- Clear deployments:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run where deployments are created
|
# Run where deployments are created
|
||||||
|
sudo rm -rf fixturenet-optimism-deployment
|
||||||
sudo rm -rf fixturenet-eth-deployment
|
sudo rm -rf fixturenet-eth-deployment
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -96,9 +96,6 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild
|
||||||
|
|
||||||
# Build nitro-contracts container image
|
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts build-containers --force-rebuild
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
@ -131,7 +128,7 @@
|
|||||||
- Create a deployment spec-file for nitro contract:
|
- Create a deployment spec-file for nitro contract:
|
||||||
|
|
||||||
```bash
|
```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=TestToken,TOKEN_SYMBOL=TST,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=LaconicNetworkToken,TOKEN_SYMBOL=LNT,INITIAL_TOKEN_SUPPLY=129600"
|
||||||
```
|
```
|
||||||
|
|
||||||
- Create a deployment `nitro-contracts` from the spec file
|
- Create a deployment `nitro-contracts` from the spec file
|
||||||
@ -322,7 +319,7 @@
|
|||||||
- Create virtual channel from Alice to Charlie
|
- Create virtual channel from Alice to Charlie
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client virtual-fund $COUNTERPARTY --amount 1000 -p 4005 -h nitro-node"
|
laconic-so deployment --dir alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client virtual-fund $COUNTERPARTY --amount 1000 -p 4005 -h nitro-node"
|
||||||
```
|
```
|
||||||
|
|
||||||
- Set the payment channel id in a variable
|
- Set the payment channel id in a variable
|
||||||
|
@ -1,18 +1,43 @@
|
|||||||
name: nitro-bridge
|
name: nitro-bridge
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
l2-nitro-contracts:
|
||||||
|
image: cerc/nitro-client:local
|
||||||
|
restart: on-failure
|
||||||
|
environment:
|
||||||
|
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||||
|
OPTIMISM_DEPLOYER_PK: ${OPTIMISM_DEPLOYER_PK}
|
||||||
|
OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID:-42069}
|
||||||
|
OPTIMISM_URL: ${OPTIMISM_URL}
|
||||||
|
TOKEN_NAME: ${TOKEN_NAME}
|
||||||
|
TOKEN_SYMBOL: ${TOKEN_SYMBOL}
|
||||||
|
INITIAL_TOKEN_SUPPLY: ${INITIAL_TOKEN_SUPPLY}
|
||||||
|
DISABLE_DETERMINISTIC_DEPLOYMENT: ${DISABLE_DETERMINISTIC_DEPLOYMENT:-true}
|
||||||
|
L1_ASSET_ADDRESS: ${L1_ASSET_ADDRESS}
|
||||||
|
volumes:
|
||||||
|
- nitro_deployment:/app/deployment
|
||||||
|
- ../config/nitro-contracts/deploy-l2-contracts.sh:/app/deploy-l2-contracts.sh
|
||||||
|
command: ["bash", "-c", "/app/deploy-l2-contracts.sh"]
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
nitro-bridge:
|
nitro-bridge:
|
||||||
image: cerc/go-nitro:local
|
image: cerc/go-nitro:local
|
||||||
hostname: nitro-bridge
|
hostname: nitro-bridge
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
l2-nitro-contracts:
|
||||||
|
condition: service_started
|
||||||
environment:
|
environment:
|
||||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||||
NITRO_CHAIN_URL: ${NITRO_CHAIN_URL}
|
OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID:-42069}
|
||||||
|
NITRO_L1_CHAIN_URL: ${NITRO_L1_CHAIN_URL}
|
||||||
|
NITRO_L2_CHAIN_URL: ${NITRO_L2_CHAIN_URL}
|
||||||
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}
|
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}
|
||||||
NITRO_SC_PK: ${NITRO_SC_PK}
|
NITRO_SC_PK: ${NITRO_SC_PK}
|
||||||
NITRO_L1_MSG_PORT: ${NITRO_L1_MSG_PORT:-3005}
|
NITRO_L1_MSG_PORT: ${NITRO_L1_MSG_PORT:-3005}
|
||||||
NITRO_L2_MSG_PORT: ${NITRO_L2_MSG_PORT:-3006}
|
NITRO_L2_MSG_PORT: ${NITRO_L2_MSG_PORT:-3006}
|
||||||
NITRO_RPC_PORT: ${NITRO_RPC_PORT:-4005}
|
NITRO_RPC_PORT: ${NITRO_RPC_PORT:-4006}
|
||||||
NITRO_PUBLIC_P2P_HOST: ${NITRO_PUBLIC_P2P_HOST:-127.0.0.1}
|
NITRO_PUBLIC_P2P_HOST: ${NITRO_PUBLIC_P2P_HOST:-127.0.0.1}
|
||||||
NITRO_L1_EXT_MULTIADDR: ${NITRO_L1_EXT_MULTIADDR}
|
NITRO_L1_EXT_MULTIADDR: ${NITRO_L1_EXT_MULTIADDR}
|
||||||
NITRO_L2_EXT_MULTIADDR: ${NITRO_L2_EXT_MULTIADDR}
|
NITRO_L2_EXT_MULTIADDR: ${NITRO_L2_EXT_MULTIADDR}
|
||||||
@ -31,7 +56,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 3005
|
- 3005
|
||||||
- 3006
|
- 3006
|
||||||
- 4005
|
- 4006
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "nc", "-vz", "localhost", "3006"]
|
test: ["CMD", "nc", "-vz", "localhost", "3006"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
|
@ -3,8 +3,7 @@ name: nitro-contracts
|
|||||||
services:
|
services:
|
||||||
# Optionally deploys the Nitro contracts
|
# Optionally deploys the Nitro contracts
|
||||||
nitro-contracts:
|
nitro-contracts:
|
||||||
image: cerc/nitro-contracts:local
|
image: cerc/nitro-client:local
|
||||||
working_dir: /app
|
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
environment:
|
environment:
|
||||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||||
@ -18,7 +17,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- nitro_deployment:/app/deployment
|
- nitro_deployment:/app/deployment
|
||||||
- ../config/nitro-contracts/deploy-l1-contracts.sh:/app/deploy-l1-contracts.sh
|
- ../config/nitro-contracts/deploy-l1-contracts.sh:/app/deploy-l1-contracts.sh
|
||||||
- ../config/nitro-contracts/deploy-l1-tokens.sh:/app/deploy-l1-tokens.sh
|
|
||||||
command: ["bash", "-c", "/app/deploy-l1-contracts.sh"]
|
command: ["bash", "-c", "/app/deploy-l1-contracts.sh"]
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
@ -19,6 +19,7 @@ services:
|
|||||||
NA_ADDRESS: ${NA_ADDRESS}
|
NA_ADDRESS: ${NA_ADDRESS}
|
||||||
CA_ADDRESS: ${CA_ADDRESS}
|
CA_ADDRESS: ${CA_ADDRESS}
|
||||||
VPA_ADDRESS: ${VPA_ADDRESS}
|
VPA_ADDRESS: ${VPA_ADDRESS}
|
||||||
|
BRIDGE_ADDRESS: ${BRIDGE_ADDRESS}
|
||||||
NITRO_PUBLIC_RPC_HOST: nitro-node
|
NITRO_PUBLIC_RPC_HOST: nitro-node
|
||||||
entrypoint: ["bash", "-c", "/app/run-nitro-node.sh"]
|
entrypoint: ["bash", "-c", "/app/run-nitro-node.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -8,12 +8,6 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
NODE_EXTRA_CA_CERTS: "/app/mkcert-caroot/rootCA.pem"
|
NODE_EXTRA_CA_CERTS: "/app/mkcert-caroot/rootCA.pem"
|
||||||
command: ["bash", "-c", "tail -f /dev/null"]
|
command: ["bash", "-c", "tail -f /dev/null"]
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "nitro-rpc-client --version -p 4005"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 10
|
|
||||||
start_period: 10s
|
|
||||||
volumes:
|
volumes:
|
||||||
- nitro_node_caroot:/app/mkcert-caroot
|
- nitro_node_caroot:/app/mkcert-caroot
|
||||||
|
|
||||||
|
@ -6,10 +6,12 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
nitro_addresses_file="/app/deployment/nitro-addresses.json"
|
nitro_addresses_file="/app/deployment/nitro-addresses.json"
|
||||||
|
bridge_assets_map_file="/app/deployment/bridge-assets-map.toml"
|
||||||
bridge_config_file="/app/bridge.toml"
|
bridge_config_file="/app/bridge.toml"
|
||||||
|
|
||||||
echo "Using the following environment variables:"
|
echo "Using the following environment variables:"
|
||||||
echo "NITRO_CHAIN_URL: ${NITRO_CHAIN_URL}"
|
echo "NITRO_L1_CHAIN_URL: ${NITRO_L1_CHAIN_URL}"
|
||||||
|
echo "NITRO_L2_CHAIN_URL: ${NITRO_L2_CHAIN_URL}"
|
||||||
echo "NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}"
|
echo "NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}"
|
||||||
echo "NITRO_SC_PK: ${NITRO_SC_PK}"
|
echo "NITRO_SC_PK: ${NITRO_SC_PK}"
|
||||||
echo "NITRO_L1_MSG_PORT: ${NITRO_L1_MSG_PORT}"
|
echo "NITRO_L1_MSG_PORT: ${NITRO_L1_MSG_PORT}"
|
||||||
@ -21,6 +23,15 @@ echo "NITRO_L2_EXT_MULTIADDR: ${NITRO_L2_EXT_MULTIADDR}"
|
|||||||
echo "NA_ADDRESS: ${NA_ADDRESS}"
|
echo "NA_ADDRESS: ${NA_ADDRESS}"
|
||||||
echo "CA_ADDRESS: ${CA_ADDRESS}"
|
echo "CA_ADDRESS: ${CA_ADDRESS}"
|
||||||
echo "VPA_ADDRESS: ${VPA_ADDRESS}"
|
echo "VPA_ADDRESS: ${VPA_ADDRESS}"
|
||||||
|
echo "OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID}"
|
||||||
|
|
||||||
|
echo "Waiting for $bridge_assets_map_file to be ready"
|
||||||
|
|
||||||
|
while [ ! -e "$bridge_assets_map_file" ]; do
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "File $bridge_assets_map_file found"
|
||||||
|
|
||||||
# Create required certs
|
# Create required certs
|
||||||
./create-certs.sh
|
./create-certs.sh
|
||||||
@ -29,18 +40,23 @@ echo "VPA_ADDRESS: ${VPA_ADDRESS}"
|
|||||||
cat <<EOF > "$bridge_config_file"
|
cat <<EOF > "$bridge_config_file"
|
||||||
chainpk = "$NITRO_CHAIN_PK"
|
chainpk = "$NITRO_CHAIN_PK"
|
||||||
statechannelpk = "$NITRO_SC_PK"
|
statechannelpk = "$NITRO_SC_PK"
|
||||||
l1chainurl = "$NITRO_CHAIN_URL"
|
l1chainurl = "$NITRO_L1_CHAIN_URL"
|
||||||
|
l2chainurl = "$NITRO_L2_CHAIN_URL"
|
||||||
nodel1msgport = $NITRO_L1_MSG_PORT
|
nodel1msgport = $NITRO_L1_MSG_PORT
|
||||||
nodel2msgport = $NITRO_L2_MSG_PORT
|
nodel2msgport = $NITRO_L2_MSG_PORT
|
||||||
rpcport = $NITRO_RPC_PORT
|
rpcport = $NITRO_RPC_PORT
|
||||||
bridgepublicip = "$NITRO_PUBLIC_P2P_HOST"
|
bridgepublicip = "$NITRO_PUBLIC_P2P_HOST"
|
||||||
nodel1ExtMultiAddr = "$NITRO_L1_EXT_MULTIADDR"
|
nodel1ExtMultiAddr = "$NITRO_L1_EXT_MULTIADDR"
|
||||||
nodel2ExtMultiAddr = "$NITRO_L2_EXT_MULTIADDR"
|
nodel2ExtMultiAddr = "$NITRO_L2_EXT_MULTIADDR"
|
||||||
|
assetmapfilepath = "$bridge_assets_map_file"
|
||||||
naaddress = "${NA_ADDRESS}"
|
naaddress = "${NA_ADDRESS}"
|
||||||
vpaaddress = "${VPA_ADDRESS}"
|
vpaaddress = "${VPA_ADDRESS}"
|
||||||
caaddress = "${CA_ADDRESS}"
|
caaddress = "${CA_ADDRESS}"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Export bridge address
|
||||||
|
export BRIDGE_ADDRESS=$(jq -r ".\"$OPTIMISM_CHAIN_ID\"[0].contracts.Bridge.address" ${nitro_addresses_file})
|
||||||
|
|
||||||
# Start bridge
|
# Start bridge
|
||||||
echo "Starting nitro-bridge"
|
echo "Starting nitro-bridge"
|
||||||
./bridge -config $bridge_config_file
|
./nitro-bridge -config $bridge_config_file
|
||||||
|
@ -22,6 +22,7 @@ echo "Using Nitro contract addresses:"
|
|||||||
echo "NA_ADDRESS: ${NA_ADDRESS}"
|
echo "NA_ADDRESS: ${NA_ADDRESS}"
|
||||||
echo "CA_ADDRESS: ${CA_ADDRESS}"
|
echo "CA_ADDRESS: ${CA_ADDRESS}"
|
||||||
echo "VPA_ADDRESS: ${VPA_ADDRESS}"
|
echo "VPA_ADDRESS: ${VPA_ADDRESS}"
|
||||||
|
echo "BRIDGE_ADDRESS: ${BRIDGE_ADDRESS}"
|
||||||
|
|
||||||
# Create required certs
|
# Create required certs
|
||||||
./create-certs.sh
|
./create-certs.sh
|
||||||
@ -42,6 +43,7 @@ l2 = ${NITRO_L2}
|
|||||||
naaddress = "${NA_ADDRESS}"
|
naaddress = "${NA_ADDRESS}"
|
||||||
vpaaddress = "${VPA_ADDRESS}"
|
vpaaddress = "${VPA_ADDRESS}"
|
||||||
caaddress = "${CA_ADDRESS}"
|
caaddress = "${CA_ADDRESS}"
|
||||||
|
bridgeaddress = "${BRIDGE_ADDRESS}"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Start the node
|
# Start the node
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
|
|
||||||
addresses_deployment_file="packages/nitro-protocol/addresses.json"
|
|
||||||
nitro_addresses_file="/app/deployment/nitro-addresses.json"
|
|
||||||
|
|
||||||
echo "Using the following environment variables:"
|
|
||||||
echo "GETH_URL: ${GETH_URL}"
|
|
||||||
echo "GETH_CHAIN_ID: ${GETH_CHAIN_ID}"
|
|
||||||
echo "GETH_DEPLOYER_PK: ${GETH_DEPLOYER_PK}"
|
|
||||||
echo "TOKEN_NAME: ${TOKEN_NAME}"
|
|
||||||
echo "TOKEN_SYMBOL: ${TOKEN_SYMBOL}"
|
|
||||||
echo "INITIAL_TOKEN_SUPPLY: ${INITIAL_TOKEN_SUPPLY}"
|
|
||||||
echo "DISABLE_DETERMINISTIC_DEPLOYMENT: ${DISABLE_DETERMINISTIC_DEPLOYMENT}"
|
|
||||||
|
|
||||||
cp ${nitro_addresses_file} ${addresses_deployment_file}
|
|
||||||
|
|
||||||
# Deploy custom token
|
|
||||||
yarn contracts:deploy-token-geth
|
|
||||||
|
|
||||||
cp ${addresses_deployment_file} ${nitro_addresses_file}
|
|
||||||
|
|
||||||
echo "Done"
|
|
44
stack-orchestrator/config/nitro-contracts/deploy-l2-contracts.sh
Executable file
44
stack-orchestrator/config/nitro-contracts/deploy-l2-contracts.sh
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
addresses_deployment_file="packages/nitro-protocol/addresses.json"
|
||||||
|
nitro_addresses_file="/app/deployment/nitro-addresses.json"
|
||||||
|
bridge_assets_map_file="/app/deployment/bridge-assets-map.toml"
|
||||||
|
|
||||||
|
echo "Using the following environment variables:"
|
||||||
|
echo "OPTIMISM_URL: ${OPTIMISM_URL}"
|
||||||
|
echo "OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID}"
|
||||||
|
echo "OPTIMISM_DEPLOYER_PK: ${OPTIMISM_DEPLOYER_PK}"
|
||||||
|
echo "TOKEN_NAME: ${TOKEN_NAME}"
|
||||||
|
echo "TOKEN_SYMBOL: ${TOKEN_SYMBOL}"
|
||||||
|
echo "INITIAL_TOKEN_SUPPLY: ${INITIAL_TOKEN_SUPPLY}"
|
||||||
|
echo "DISABLE_DETERMINISTIC_DEPLOYMENT: ${DISABLE_DETERMINISTIC_DEPLOYMENT}"
|
||||||
|
echo "L1_ASSET_ADDRESS: ${L1_ASSET_ADDRESS}"
|
||||||
|
|
||||||
|
# Check if L2 chain id key is present for L2 deployment
|
||||||
|
if [ -f "$nitro_addresses_file" ] && jq -e "has(\"$OPTIMISM_CHAIN_ID\")" ${nitro_addresses_file} > /dev/null; then
|
||||||
|
echo "L2 addresses found in ${nitro_addresses_file}, skipping deployment"
|
||||||
|
else
|
||||||
|
# Deploy Nitro contracts
|
||||||
|
yarn contracts:deploy-optimism
|
||||||
|
|
||||||
|
# Deploy custom token
|
||||||
|
yarn contracts:deploy-token-optimism
|
||||||
|
|
||||||
|
cp ${addresses_deployment_file} ${nitro_addresses_file}
|
||||||
|
fi
|
||||||
|
|
||||||
|
L2_ASSET_ADDRESS=$(jq -r ".\"$OPTIMISM_CHAIN_ID\"[0].contracts.Token.address" ${nitro_addresses_file})
|
||||||
|
|
||||||
|
# Deploy custom tokens and create bridge-assets-map.toml
|
||||||
|
cat <<EOF > "$bridge_assets_map_file"
|
||||||
|
[[assets]]
|
||||||
|
l1AssetAddress = "$L1_ASSET_ADDRESS"
|
||||||
|
l2AssetAddress = "$L2_ASSET_ADDRESS"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "Done"
|
@ -1,25 +1,30 @@
|
|||||||
FROM ubuntu:latest
|
FROM golang:1.21-bullseye AS builder
|
||||||
|
|
||||||
RUN apt-get update
|
ARG TARGETPLATFORM
|
||||||
RUN apt-get install -y jq netcat-traditional ca-certificates curl
|
|
||||||
RUN rm -rf /var/lib/apt/lists/*
|
# Install mkcert
|
||||||
|
RUN curl -JL "https://dl.filippo.io/mkcert/latest?for=$TARGETPLATFORM" -o /usr/local/bin/mkcert && \
|
||||||
|
chmod +x /usr/local/bin/mkcert
|
||||||
|
|
||||||
# Copy files into image
|
# Copy files into image
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
|
||||||
# Install mkcert
|
RUN go mod download
|
||||||
RUN curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
|
|
||||||
RUN chmod +x mkcert-v*-linux-amd64
|
|
||||||
RUN cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert
|
|
||||||
|
|
||||||
# Download binaries
|
# Build the binary
|
||||||
RUN curl -LO https://git.vdb.to/cerc-io/nitro/releases/download/v0.1.7/nitro
|
RUN go build -v -o nitro .
|
||||||
RUN curl -LO https://git.vdb.to/cerc-io/nitro/releases/download/v0.1.7/bridge
|
RUN go build -o nitro-bridge cmd/start-bridge/main.go
|
||||||
|
|
||||||
# Make binaries executable
|
|
||||||
RUN chmod +x ./nitro
|
|
||||||
RUN chmod +x ./bridge
|
|
||||||
|
|
||||||
# Verify that binaries are correctly setup
|
# Reduce image size
|
||||||
RUN ./nitro help
|
FROM debian:bullseye-slim
|
||||||
RUN ./bridge help
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y jq netcat ca-certificates
|
||||||
|
RUN rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/nitro .
|
||||||
|
COPY --from=builder /app/nitro-bridge .
|
||||||
|
COPY --from=builder /usr/local/bin/mkcert /usr/local/bin/mkcert
|
||||||
|
@ -5,4 +5,4 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
|||||||
|
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
docker build -t cerc/go-nitro:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR
|
docker build -t cerc/go-nitro:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/go-nitro
|
||||||
|
@ -4,7 +4,12 @@ RUN apk --update --no-cache add python3 alpine-sdk bash curl jq
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/
|
COPY ./packages packages
|
||||||
|
COPY ./package.json package.json
|
||||||
|
COPY ./yarn.lock yarn.lock
|
||||||
|
|
||||||
|
RUN echo "Installing dependencies" && \
|
||||||
|
yarn && yarn build
|
||||||
|
|
||||||
RUN echo "Installing nitro-rpc-client" && \
|
RUN echo "Installing nitro-rpc-client" && \
|
||||||
npm install -g @cerc-io/nitro-rpc-client@0.1.6
|
npm install -g ./packages/nitro-rpc-client
|
||||||
|
@ -6,4 +6,4 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
|||||||
# See: https://stackoverflow.com/a/246128/1701505
|
# See: https://stackoverflow.com/a/246128/1701505
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
|
||||||
docker build -t cerc/nitro-client:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} $SCRIPT_DIR
|
docker build -t cerc/nitro-client:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/go-nitro
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
FROM node:18.17.1-alpine3.18
|
|
||||||
|
|
||||||
RUN apk --update --no-cache add python3 alpine-sdk bash curl jq
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN echo "Installing dependencies" && \
|
|
||||||
yarn
|
|
@ -1,9 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Build cerc/nitro-contracts
|
|
||||||
|
|
||||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
|
||||||
|
|
||||||
# See: https://stackoverflow.com/a/246128/1701505
|
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
||||||
|
|
||||||
docker build -t cerc/nitro-contracts:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/go-nitro
|
|
@ -8,6 +8,12 @@
|
|||||||
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack
|
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Clone required repositories:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge setup-repositories
|
||||||
|
```
|
||||||
|
|
||||||
- Build container images:
|
- Build container images:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -30,7 +36,7 @@
|
|||||||
go-nitro:
|
go-nitro:
|
||||||
- 3005:3005
|
- 3005:3005
|
||||||
- 3006:3006
|
- 3006:3006
|
||||||
- 4005:4005
|
- 4006:4006
|
||||||
```
|
```
|
||||||
|
|
||||||
- Create deployment
|
- Create deployment
|
||||||
@ -46,8 +52,13 @@
|
|||||||
```bash
|
```bash
|
||||||
GETH_CHAIN_ID=1212
|
GETH_CHAIN_ID=1212
|
||||||
|
|
||||||
# URL endpoint of the chain (Example: ws://host.docker.internal:8545)
|
OPTIMISM_CHAIN_ID=42069
|
||||||
NITRO_CHAIN_URL=
|
|
||||||
|
# URL endpoint of the L1 chain (Example: ws://host.docker.internal:8545)
|
||||||
|
NITRO_L1_CHAIN_URL=
|
||||||
|
|
||||||
|
# URL endpoint of the L2 chain (Example: ws://host.docker.internal:8546)
|
||||||
|
NITRO_L2_CHAIN_URL=
|
||||||
|
|
||||||
# Private key of the account on chain that is used for funding channels
|
# Private key of the account on chain that is used for funding channels
|
||||||
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}
|
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}
|
||||||
@ -61,7 +72,7 @@
|
|||||||
NITRO_L2_MSG_PORT=3006
|
NITRO_L2_MSG_PORT=3006
|
||||||
|
|
||||||
# Port to be used by RPC server
|
# Port to be used by RPC server
|
||||||
NITRO_RPC_PORT=4005
|
NITRO_RPC_PORT=4006
|
||||||
|
|
||||||
NITRO_PUBLIC_P2P_HOST=127.0.0.1
|
NITRO_PUBLIC_P2P_HOST=127.0.0.1
|
||||||
|
|
||||||
|
@ -2,9 +2,10 @@ version: "1.0"
|
|||||||
name: bridge
|
name: bridge
|
||||||
description: "Nitro bridge with contracts deployment and nitro-rpc-client"
|
description: "Nitro bridge with contracts deployment and nitro-rpc-client"
|
||||||
repos:
|
repos:
|
||||||
|
- github.com/cerc-io/go-nitro
|
||||||
containers:
|
containers:
|
||||||
- cerc/go-nitro
|
|
||||||
- cerc/nitro-client
|
- cerc/nitro-client
|
||||||
|
- cerc/go-nitro
|
||||||
pods:
|
pods:
|
||||||
- nitro-bridge
|
- nitro-bridge
|
||||||
- nitro-rpc-client
|
- nitro-rpc-client
|
||||||
|
@ -11,9 +11,8 @@
|
|||||||
- Clone required repositories:
|
- Clone required repositories:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts setup-repositories --git-ssh --pull
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts setup-repositories
|
||||||
```
|
```
|
||||||
Make sure you have access to the `go-nitro` repository
|
|
||||||
|
|
||||||
- Build container images:
|
- Build container images:
|
||||||
|
|
||||||
@ -46,9 +45,9 @@
|
|||||||
# Private key of the account on chain that is used for deploying L1 contracts
|
# Private key of the account on chain that is used for deploying L1 contracts
|
||||||
GETH_DEPLOYER_PK=
|
GETH_DEPLOYER_PK=
|
||||||
|
|
||||||
TOKEN_NAME=TestToken
|
TOKEN_NAME=LaconicNetworkToken
|
||||||
|
|
||||||
TOKEN_SYMBOL=TST
|
TOKEN_SYMBOL=LNT
|
||||||
|
|
||||||
INITIAL_TOKEN_SUPPLY=129600
|
INITIAL_TOKEN_SUPPLY=129600
|
||||||
```
|
```
|
||||||
|
@ -2,8 +2,8 @@ version: "1.0"
|
|||||||
name: nitro-contracts
|
name: nitro-contracts
|
||||||
description: "Deploy nitro contracts"
|
description: "Deploy nitro contracts"
|
||||||
repos:
|
repos:
|
||||||
- github.com/cerc-io/go-nitro@v0.1.7
|
- github.com/cerc-io/go-nitro
|
||||||
containers:
|
containers:
|
||||||
- cerc/nitro-contracts
|
- cerc/nitro-client
|
||||||
pods:
|
pods:
|
||||||
- nitro-contracts
|
- nitro-contracts
|
||||||
|
@ -8,6 +8,14 @@
|
|||||||
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack
|
laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Clone required repositories
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node setup-repositories
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: Replace path to nitro stack with actual path
|
||||||
|
|
||||||
- Build the container image
|
- Build the container image
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -2,6 +2,7 @@ version: "1.0"
|
|||||||
name: nitro-node
|
name: nitro-node
|
||||||
description: "Nitro node with nitro-rpc-client"
|
description: "Nitro node with nitro-rpc-client"
|
||||||
repos:
|
repos:
|
||||||
|
- github.com/cerc-io/go-nitro
|
||||||
containers:
|
containers:
|
||||||
- cerc/go-nitro
|
- cerc/go-nitro
|
||||||
- cerc/nitro-client
|
- cerc/nitro-client
|
||||||
|
Loading…
Reference in New Issue
Block a user