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
```
6. Exit project repo
```
cd ../
```
### Testnet Onboarding App
1. Clone the repository
@ -70,6 +76,12 @@
yarn
```
5. Exit project repo
```
cd ../
```
### Stack Orchestrator
- Follow these steps to install laconic-so: <https://git.vdb.to/cerc-io/stack-orchestrator#install>
@ -214,36 +226,36 @@
```
5. Configure ports:
- `fixturenet-eth-spec.yml`
- `fixturenet-eth-spec.yml`
```yml
...
network:
ports:
fixturenet-eth-bootnode-geth:
- '9898:9898'
- '30303'
fixturenet-eth-geth-1:
- '8545:8545'
- '8546:8546'
- '40000'
- '6060'
fixturenet-eth-lighthouse-1:
- '8001'
...
```
```yml
...
network:
ports:
fixturenet-eth-bootnode-geth:
- '9898:9898'
- '30303'
fixturenet-eth-geth-1:
- '8545:8545'
- '8546:8546'
- '40000'
- '6060'
fixturenet-eth-lighthouse-1:
- '8001'
...
```
- `fixturenet-optimism-spec.yml`
- `fixturenet-optimism-spec.yml`
```yml
...
network:
ports:
op-geth:
- '9545:8545'
- '9546:8546'
...
```
```yml
...
network:
ports:
op-geth:
- '9545:8545'
- '9546:8546'
...
```
6. Create deployments:
Once you've made any needed changes to the spec files, create deployments from them:
@ -300,12 +312,10 @@
cd ~
# '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
- 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>
- Replace `<go-nitro-repo-absolute-path>` with absolute path to the cloned go-nitro repo
## Run
@ -320,12 +330,17 @@
- Check status of L1
```bash
laconic-so deployment --dir fixturenet-eth-deployment exec fixturenet-eth-bootnode-lighthouse /scripts/status-internal.sh
- Run command in intervals of 3 seconds to check new blocks are created
```bash
laconic-so deployment --dir fixturenet-eth-deployment exec foundry "cast block-number"
```
# Check geth logs, ensure that new blocks are getting mined
laconic-so deployment --dir fixturenet-eth-deployment logs -f fixturenet-eth-geth-1
```
- Check geth logs to ensure that new blocks are getting created
```bash
laconic-so deployment --dir fixturenet-eth-deployment logs -f fixturenet-eth-geth-1
```
- Start `fixturenet-optimism-deployment` deployment:
@ -385,6 +400,7 @@
```bash
laconic-so deployment --dir fixturenet-eth-deployment exec foundry "cast balance $ACCOUNT --rpc-url $L2_RPC"
# 100000000000000000
```
@ -408,6 +424,7 @@
# Use same account on both Geth and Optimism
export OPTIMISM_DEPLOYER_PK=$GETH_DEPLOYER_PK
```
- Export variables for token name, token symbol and initial supply
```bash
export TOKEN_NAME="LaconicNetworkToken"
@ -467,21 +484,22 @@
- Export variables for L1 token address
```bash
export L1_ASSET_ADDRESS="<Token Address on L1>"
export A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
```
<!-- TODO: Export token address from contract deployment env in go-nitro -->
```bash
export L1_ASSET_ADDRESS="<Token Address on L1>"
export A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
```
- Send tokens to Alice and Charlie
```bash
# Send tokens to Alice
yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth
```bash
# Send tokens to Alice
yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth
#Send tokens to Charlie
yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth
```
#Send tokens to Charlie
yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth
```
- Go to go-nitro repo root
@ -504,15 +522,19 @@
- Start testnet-onboarding-app (run command in testnet-onboarding-app repo)
```bash
# In testnet-onboarding-app
yarn start
```
```bash
# In testnet-onboarding-app
yarn start
```
NOTE: Ignore source map warnings in the terminal
- Start `laconic-wallet` android app (run steps in laconic-wallet repo)
- 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 virtual device, continue with the steps
- Setup port forwarding for your device using the following command:
```
@ -647,7 +669,7 @@
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
# Export L1 contract addresses
@ -701,11 +723,14 @@
```
- 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
export BRIDGE_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
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
@ -792,7 +817,7 @@
- Send transaction request to the Wallet
- Approve and send transaction to laconicd chain
- 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
laconic-so deployment --dir stage0-deployment exec laconicd "laconicd query onboarding list"
@ -825,7 +850,13 @@
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
# Run where deployments are created
@ -849,6 +880,7 @@
```
- Query the balances of registered participants:
<!-- TODO: Show balances on laconic-wallet -->
```bash
export A_LACONIC_ADDRESS=<Alice Laconic address>
@ -932,21 +964,22 @@
- Note balance change in A' node:
```bash
nitro-rpc-client get-all-ledger-channels -p 4008
```bash
nitro-rpc-client get-all-ledger-channels -p 4008
# Expected output:
# {"ID":"0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179","Status":"Open","Balance":{"AssetAddress":"<Token_address_on_L2>","Me":"0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce","Them":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","MyBalance":999800,"TheirBalance":1000200},"ChannelMode":"Open"}
```
# Expected output:
# {"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:
```bash
nitro-rpc-client get-all-ledger-channels -p 4010
```bash
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
- Stop the bridge, A, A', C and C' terminals