rooch-network / rooch

VApp Container with Move Language
https://rooch.network
Apache License 2.0
128 stars 54 forks source link

Add and make local network as default chainid #853

Closed baichuan3 closed 7 months ago

baichuan3 commented 7 months ago

Summary

  1. Add local network, the chain id is 20230104
  2. Make the local network as default chain id, and use temporary directory for store
  3. Make local chain id as default env
  4. Change all dev to test chain id for integration test and other tests
  5. Fix testnet url link by the way @feliciss, relative your pr https://github.com/rooch-network/rooch/pull/852

Before to use new local network, suggest clean store dir and keystore file.

default use local network

rooch server start

use dev network

rooch server start -n dev

use local dev chainid env

rooch env add --chain-id 20230103 --alias devnet --rpc http://0.0.0.0:50051/
rooch env switch --alias devnet
vercel[bot] commented 7 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **rooch** | ⬜️ Ignored ([Inspect](https://vercel.com/rooch/rooch/6giaMyEmAu8XrNwVyQWfRor4xq6Z)) | [Visit Preview](https://rooch-git-defaultlocal-rooch.vercel.app) | | Sep 25, 2023 5:24am |
baichuan3 commented 7 months ago

I have also encountered problems related to env. There are some problems with the current experience. There have been discussions in diccord. I started a separate PR (https://github.com/rooch-network/rooch/issues/857) to handle it. The current PR only handles the local network and related modifications.

baichuan3 commented 7 months ago
  1. Command rooch server start -dev will be init a store in:

StoreConfig init store dir "ev/local/roochdb/rooch_store" "ev/local/roochdb/moveos_store"

This is a bug.

  1. Command rooch server start -n dev and rooch server start -n test shouldn't start with local RPC, as it would violate the rules MetaMask defines if user already added local RPC network on MetaMask:

This URL is currently used by the Rooch Local Network network.

  1. When adding a new environment, verify the rpc, alias and chain_id don't collapse with existing ones.
  2. Once a new env is added, the chain id is still shown as the last element and it's not updated. For example:

Chain ID 20230103 The RPC URL you have entered returned a different chain ID (20230102). Please update the Chain ID to match the RPC URL of the network you are trying to add.

Config:

envs:
- chain_id: 20230104
  alias: default
  rpc: http://0.0.0.0:50051
  ws: null
- chain_id: 20230103
  alias: dev
  rpc: https://devnet-seed.rooch.network/
  ws: null
- chain_id: 20230102
  alias: test
  rpc: https://testnet-seed.rooch.network/
  ws: null
- chain_id: 20230103
  alias: devnet
  rpc: http://0.0.0.0:50051/
  ws: null
active_env: devnet
  1. After switching to devnet, command rooch server start -n test and rooch server start -n dev result in a panic error:

thread 'main' panicked at 'Invalid sequencer order', crates/rooch- sequencer/src/actor/sequencer.rs:45:24

  1. After a new env is added, starting rooch server will not be added a custom chain id:

rooch server start -n devnet error: Invalid value "devnet" for '--chain-id ': Invalid Custom chain id devnet, custom chain id format is: chain_name:chain_id

  1. rooch server start -dev is not a bug. When the -d parameter is specified when starting the server, the data-dri specified by the -d parameter will be used as the storage path. When the -d parameter is -dev, it indicates the ev/ path in the current directory. If you want to start the dev network, use the command line rooch server start -n dev
  2. Other issues related to env will be discussed and resolved in a separate pr https://github.com/rooch-network/rooch/issues/857.
feliciss commented 7 months ago
  1. rooch server start -dev is not a bug. When the -d parameter is specified when starting the server, the data-dri specified by the -d parameter will be used as the storage path. When the -d parameter is -dev, it indicates the ev/

Regarding this, the -d flag should leave a whitespace to accept params for the --data-dir such as -d dev and I think mistyping could result in a different store dir. So this is like a bug.

baichuan3 commented 7 months ago
  1. rooch server start -dev is not a bug. When the -d parameter is specified when starting the server, the data-dri specified by the -d parameter will be used as the storage path. When the -d parameter is -dev, it indicates the ev/

Regarding this, the -d flag should leave a whitespace to accept params for the --data-dir such as -d dev and I think mistyping could result in a different store dir. So this is like a bug.

This is the syntax of clap, like rooch server start -ndev is equals to rooch server start -n dev, Unless we change the implementation of clap, I don't think it's necessary.

feliciss commented 7 months ago
  1. rooch server start -dev is not a bug. When the -d parameter is specified when starting the server, the data-dri specified by the -d parameter will be used as the storage path. When the -d parameter is -dev, it indicates the ev/

Regarding this, the -d flag should leave a whitespace to accept params for the --data-dir such as -d dev and I think mistyping could result in a different store dir. So this is like a bug.

This is the syntax of clap, like rooch server start -ndev is equals to rooch server start -n dev, Unless we change the implementation of clap, I don't think it's necessary.

Is it possible to define an enum argument? That way, the input contents are limited.

baichuan3 commented 7 months ago
  1. rooch server start -dev is not a bug. When the -d parameter is specified when starting the server, the data-dri specified by the -d parameter will be used as the storage path. When the -d parameter is -dev, it indicates the ev/

Regarding this, the -d flag should leave a whitespace to accept params for the --data-dir such as -d dev and I think mistyping could result in a different store dir. So this is like a bug.

This is the syntax of clap, like rooch server start -ndev is equals to rooch server start -n dev, Unless we change the implementation of clap, I don't think it's necessary.

Is it possible to define an enum argument? That way, the input contents are limited.

Maybe it's an approach.

If we want to strongly verify -d, disabling the short = 'd' mode and forcing the use of long = "data-dir" may be a solution, which will increase the user cost to a certain extent.

jolestar commented 7 months ago

I merged this PR first.