Use npm install to avoid yarn version issue in go-nitro

This commit is contained in:
Nabarun 2024-07-17 01:23:12 +05:30
parent d3af85ec85
commit f50c981e78

View File

@ -37,6 +37,12 @@
yarn yarn
``` ```
6. Exit project repo
```
cd ../
```
### Testnet Onboarding App ### Testnet Onboarding App
1. Clone the repository 1. Clone the repository
@ -70,6 +76,12 @@
yarn yarn
``` ```
5. Exit project repo
```
cd ../
```
### Stack Orchestrator ### Stack Orchestrator
- Follow these steps to install laconic-so: <https://git.vdb.to/cerc-io/stack-orchestrator#install> - Follow these steps to install laconic-so: <https://git.vdb.to/cerc-io/stack-orchestrator#install>
@ -214,36 +226,36 @@
``` ```
5. Configure ports: 5. Configure ports:
- `fixturenet-eth-spec.yml` - `fixturenet-eth-spec.yml`
```yml ```yml
... ...
network: network:
ports: ports:
fixturenet-eth-bootnode-geth: fixturenet-eth-bootnode-geth:
- '9898:9898' - '9898:9898'
- '30303' - '30303'
fixturenet-eth-geth-1: fixturenet-eth-geth-1:
- '8545:8545' - '8545:8545'
- '8546:8546' - '8546:8546'
- '40000' - '40000'
- '6060' - '6060'
fixturenet-eth-lighthouse-1: fixturenet-eth-lighthouse-1:
- '8001' - '8001'
... ...
``` ```
- `fixturenet-optimism-spec.yml` - `fixturenet-optimism-spec.yml`
```yml ```yml
... ...
network: network:
ports: ports:
op-geth: op-geth:
- '9545:8545' - '9545:8545'
- '9546:8546' - '9546:8546'
... ...
``` ```
6. Create deployments: 6. 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:
@ -300,12 +312,10 @@
cd ~ cd ~
# 'yarn global' commands only work with Yarn versions below 2.x. # 'yarn global' commands only work with Yarn versions below 2.x.
yarn global add file:<go-nitro-repo-absolute-path>/packages/nitro-rpc-client npm install -g <go-nitro-repo-absolute-path>/packages/nitro-rpc-client
``` ```
- Replace `<go-nitro-path>` with absolute path to the cloned go-nitro repo - Replace `<go-nitro-repo-absolute-path>` with absolute path to the cloned go-nitro repo
- Make sure the yarn global bin directory is included in your PATH. If it is not, add `export PATH="$(yarn global bin):$PATH"` to your ~/.bashrc or ~/.zshrc file
- <https://classic.yarnpkg.com/en/docs/cli/global#toc-yarn-global>
## Run ## Run
@ -320,12 +330,17 @@
- Check status of L1 - Check status of L1
```bash - Run command in intervals of 3 seconds to check new blocks are created
laconic-so deployment --dir fixturenet-eth-deployment exec fixturenet-eth-bootnode-lighthouse /scripts/status-internal.sh
```bash
laconic-so deployment --dir fixturenet-eth-deployment exec foundry "cast block-number"
```
# Check geth logs, ensure that new blocks are getting mined - Check geth logs to ensure that new blocks are getting created
laconic-so deployment --dir fixturenet-eth-deployment logs -f fixturenet-eth-geth-1
``` ```bash
laconic-so deployment --dir fixturenet-eth-deployment logs -f fixturenet-eth-geth-1
```
- Start `fixturenet-optimism-deployment` deployment: - Start `fixturenet-optimism-deployment` deployment:
@ -385,6 +400,7 @@
```bash ```bash
laconic-so deployment --dir fixturenet-eth-deployment exec foundry "cast balance $ACCOUNT --rpc-url $L2_RPC" laconic-so deployment --dir fixturenet-eth-deployment exec foundry "cast balance $ACCOUNT --rpc-url $L2_RPC"
# 100000000000000000 # 100000000000000000
``` ```
@ -408,6 +424,7 @@
# Use same account on both Geth and Optimism # Use same account on both Geth and Optimism
export OPTIMISM_DEPLOYER_PK=$GETH_DEPLOYER_PK export OPTIMISM_DEPLOYER_PK=$GETH_DEPLOYER_PK
``` ```
- Export variables for token name, token symbol and initial supply - Export variables for token name, token symbol and initial supply
```bash ```bash
export TOKEN_NAME="LaconicNetworkToken" export TOKEN_NAME="LaconicNetworkToken"
@ -467,21 +484,22 @@
- Export variables for L1 token address - Export variables for L1 token address
```bash <!-- TODO: Export token address from contract deployment env in go-nitro -->
export L1_ASSET_ADDRESS="<Token Address on L1>" ```bash
export A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a" export L1_ASSET_ADDRESS="<Token Address on L1>"
export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293" export A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
``` export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
```
- Send tokens to Alice and Charlie - Send tokens to Alice and Charlie
```bash ```bash
# Send tokens to Alice # Send tokens to Alice
yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth
#Send tokens to Charlie #Send tokens to Charlie
yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth
``` ```
- Go to go-nitro repo root - Go to go-nitro repo root
@ -504,15 +522,19 @@
- Start testnet-onboarding-app (run command in testnet-onboarding-app repo) - Start testnet-onboarding-app (run command in testnet-onboarding-app repo)
```bash ```bash
# In testnet-onboarding-app # In testnet-onboarding-app
yarn start yarn start
``` ```
NOTE: Ignore source map warnings in the terminal
- Start `laconic-wallet` android app (run steps in laconic-wallet repo) - Start `laconic-wallet` android app (run steps in laconic-wallet repo)
- Set up the Android device - Set up the Android device
- For a physical device, refer to the [React Native documentation for running on a physical device](https://reactnative.dev/docs/running-on-device) - For a physical device, refer to the [React Native documentation for running on a physical device](https://reactnative.dev/docs/running-on-device)
- For a virtual device, continue with the steps - For a virtual device, continue with the steps
- Setup port forwarding for your device using the following command: - Setup port forwarding for your device using the following command:
``` ```
@ -647,7 +669,7 @@
l2 = true l2 = true
``` ```
- In a new terminal, initialize node A on L1 - In a new terminal, go to go-nitro repo root and initialize node A on L1
```bash ```bash
# Export L1 contract addresses # Export L1 contract addresses
@ -701,11 +723,14 @@
``` ```
- Set address of bridge and address of custom token on L1 in the current terminal - Set address of bridge and address of custom token on L1 in the current terminal
<!-- TODO: Get token address from go-nitro deployments env -->
```bash ```bash
export BRIDGE_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94 export BRIDGE_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
export L1_ASSET_ADDRESS="<Token Address on L1>" export L1_ASSET_ADDRESS="<Token Address on L1>"
``` ```
NOTE: Replace `<Token Address on L1>` with LNT token address deployed previously on L1 in [Run](#run) section
- Create ledger channel between A and Bridge with custom token - Create ledger channel between A and Bridge with custom token
@ -792,7 +817,7 @@
- Send transaction request to the Wallet - Send transaction request to the Wallet
- Approve and send transaction to laconicd chain - Approve and send transaction to laconicd chain
- Repeat onboarding for other (Charlies's) account - Repeat onboarding for other (Charlies's) account
- List the participants on stage 1: - List the participants on stage 1 (run in the directory where laconicd deployment was created):
```bash ```bash
laconic-so deployment --dir stage0-deployment exec laconicd "laconicd query onboarding list" laconic-so deployment --dir stage0-deployment exec laconicd "laconicd query onboarding list"
@ -825,7 +850,13 @@
sudo rm -rf stage1-genesis sudo rm -rf stage1-genesis
``` ```
- Copy over the generated genesis file (`.json`) containing the onboarding module state with funded participants to data directory in deployment (`stage1-deployment/data/genesis-config`): - Change directory to stage1 deployment directory
```bash
cd <stage1-deployment-directory-absolute-path>
```
- Copy over the generated genesis file (`.json`) containing the onboarding module state with funded participants to data directory in stage1 deployment (`stage1-deployment/data/genesis-config`):
```bash ```bash
# Run where deployments are created # Run where deployments are created
@ -849,6 +880,7 @@
``` ```
- Query the balances of registered participants: - Query the balances of registered participants:
<!-- TODO: Show balances on laconic-wallet -->
```bash ```bash
export A_LACONIC_ADDRESS=<Alice Laconic address> export A_LACONIC_ADDRESS=<Alice Laconic address>
@ -932,21 +964,22 @@
- Note balance change in A' node: - Note balance change in A' node:
```bash ```bash
nitro-rpc-client get-all-ledger-channels -p 4008 nitro-rpc-client get-all-ledger-channels -p 4008
# Expected output: # Expected output:
# {"ID":"0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce","Them":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","MyBalance":999800,"TheirBalance":1000200},"ChannelMode":"Open"} # {"ID":"0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce","Them":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","MyBalance":999800,"TheirBalance":1000200},"ChannelMode":"Open"}
``` ```
- Note balance change in C' node: - Note balance change in C' node:
```bash ```bash
nitro-rpc-client get-all-ledger-channels -p 4010 nitro-rpc-client get-all-ledger-channels -p 4010
# Expected output:
# {"ID":"0x15dbe6b996e4e46fdd6ea3e2074cbca58014dbb07368e3e7ba286df5c7b9da0d","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xa8d2d06ace9c7ffc24ee785c2695678aecdfd7a0","Them":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","MyBalance":1000200,"TheirBalance":999800},"ChannelMode":"Open"}
```
# Expected output:
# {"ID":"0x15dbe6b996e4e46fdd6ea3e2074cbca58014dbb07368e3e7ba286df5c7b9da0d","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xa8d2d06ace9c7ffc24ee785c2695678aecdfd7a0","Them":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","MyBalance":1000200,"TheirBalance":999800},"ChannelMode":"Open"}
```
## Demo cleanup ## Demo cleanup
- Stop the bridge, A, A', C and C' terminals - Stop the bridge, A, A', C and C' terminals