Add expected outputs in nitro-bridge demo #6

Merged
nabarun merged 2 commits from sk-bridge-demo-improvements into main 2024-08-27 10:54:04 +00:00

View File

@ -305,16 +305,16 @@
```
- Create a deployment `nitro-contracts` from the spec file
```bash
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts deploy create --spec-file nitro-contracts-spec.yml --deployment-dir nitro-contracts-deployment
```
- Start `nitro-contracts` deployment:
```
```bash
laconic-so deployment --dir nitro-contracts-deployment start
# Check the l1 nitro contract deployments
laconic-so deployment --dir nitro-contracts-deployment logs nitro-contracts -f
```
@ -322,15 +322,15 @@
- Run the bridge:
- Get the deployed nitro contract addresses (run in the directory where the deployments were created):
```bash
# Nitro contract addresses
export NA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json")
export CA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json")
export VPA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[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 '.\"1212\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")"
export VPA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[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 '.\"1212\"[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
@ -543,13 +543,17 @@
```bash
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:
# Objective started DirectFunding-0x161d289a50222caa781db215bb82a3ede4f557217742245525b8e8cbff04ec21
# Channel Open 0x161d289a50222caa781db215bb82a3ede4f557217742245525b8e8cbff04ec21
```
- Once direct-fund objective is complete, bridge will create mirrored channel on L2
- Check node A' logs to see bridged-fund objective completed
- Check the [Troubleshooting](#troubleshooting) section if command to create a ledger channel fails or gets stuck
- Check status of L1 ledger channel between A and Bridge
- Check status of L1 ledger channel between A and Bridge using channel ID in output above
```bash
laconic-so deployment --dir l1alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-ledger-channel <ledger channel ID> -p 4005 -h nitro-node"
@ -573,13 +577,17 @@
```bash
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:
# Objective started DirectFunding-0x69a3f09b6f4f94f033cf084e6e4a9453438c45b43606e9a95f5434f4c6527543
# Channel Open 0x69a3f09b6f4f94f033cf084e6e4a9453438c45b43606e9a95f5434f4c6527543
```
- Once direct fund objective is complete, bridge will create mirrored channel on L2
- Check node C' logs to see bridged-fund objective completed
- Check the [Troubleshooting](#troubleshooting) section if command to create a ledger channel fails or gets stuck
- Check status of L1 ledger channel between C and Bridge
- Check status of L1 ledger channel between C and Bridge using channel ID in output above
```bash
laconic-so deployment --dir l1charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-ledger-channel <ledger channel ID> -p 4005 -h nitro-node"
@ -605,8 +613,8 @@
laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge"
# Expected output:
# {"ID":"0x15dbe6b996e4e46fdd6ea3e2074cbca58014dbb07368e3e7ba286df5c7b9da0d","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","Them":"0xa8d2d06ace9c7ffc24ee785c2695678aecdfd7a0","MyBalance":1000000,"TheirBalance":1000000},"ChannelMode":"Open"}
# {"ID":"0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","Them":"0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce","MyBalance":1000000,"TheirBalance":1000000},"ChannelMode":"Open"}
# {"ID":"0x5648967ca443ea02cd50c1f5e3d58a43a96fdbf1c1d225ce436188ca33ea1753","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","Them":"0x4b64e26da8279ab12bcd4ca9974ec2b4741e175e","MyBalance":1000000,"TheirBalance":1000000},"ChannelMode":"Open"}
#{"ID":"0x7469ab77ee580b2da6135fbf58a21ea47869651fafed5f777e520efb0d36f417","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","Them":"0x03eb7a84e286c671836b9897aae24b31d36f9ca8","MyBalance":1000000,"TheirBalance":1000000},"ChannelMode":"Open"}
```
In above expected output the following are observed
@ -674,6 +682,23 @@
- Check payment channel status again to view updated channel state
```bash
laconic-so deployment --dir l2alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-payment-channel $PAYMENT_CHANNEL_ID -p 4005 -h nitro-node"
# Expected output:
# {
# ID: '0xb29aeb32c9495a793ebf7bd116232075d1e7bfe89fc82281c7d498e3ffd3e3bf',
# Status: 'Open',
# Balance: {
# AssetAddress: '0x0000000000000000000000000000000000000000',
# Payee: '0xa8d2d06ace9c7ffc24ee785c2695678aecdfd7a0',
# Payer: '0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce',
# PaidSoFar: 200n,
# RemainingFunds: 800n
# }
# }
```
- Close payment channel after payments
```bash
@ -733,9 +758,9 @@
```bash
laconic-so deployment --dir l1alice-nitro-deployment start
laconic-so deployment --dir l1charlie-nitro-deployment start
laconic-so deployment --dir l2alice-nitro-deployment start
laconic-so deployment --dir l2charlie-nitro-deployment start
laconic-so deployment --dir bridge-deployment start
laconic-so deployment --dir l2alice-nitro-deployment start
laconic-so deployment --dir l2charlie-nitro-deployment start
laconic-so deployment --dir bridge-deployment start
```
- Follow the steps from [Demo](#demo) to re-run the demo
@ -827,4 +852,4 @@
laconic-so deployment --dir l1charlie-nitro-deployment start
```
- Retry the ledger channel creation command
- Retry the ledger channel creation command