Skip to content

Commit

Permalink
[server] Change the default port to 6767 (#1973)
Browse files Browse the repository at this point in the history
  • Loading branch information
jolestar authored Jun 23, 2024
1 parent e050336 commit 3f4a12c
Show file tree
Hide file tree
Showing 27 changed files with 61 additions and 96 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ jobs:
chmod 600 private_key.pem
sudo apt update
sudo apt install -y --no-install-recommends openssh-server
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST bash -c "'sleep 30' && && docker image prune -a -f && docker ps | grep rooch | awk '{print \$1}' | xargs -r docker stop && docker ps -a | grep rooch | awk '{print \$1}' | xargs -r docker rm -f && docker pull 'ghcr.io/rooch-network/rooch:${{ github.event.inputs.tagName }}' && docker run -d -v /data:/root -p 50051:50051 'ghcr.io/rooch-network/rooch:${{ github.event.inputs.tagName }}' server start -n main --btc-rpc-url '${{secrets.BTC_MAIN_RPC_URL}}' --btc-rpc-username rooch-main --btc-rpc-password '${{secrets.BTC_MAIN_RPC_PWD}}' --btc-start-block-height 0 --btc-end-block-height 767420 --data-import-mode 1"
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST bash -c "'sleep 30' && && docker image prune -a -f && docker ps | grep rooch | awk '{print \$1}' | xargs -r docker stop && docker ps -a | grep rooch | awk '{print \$1}' | xargs -r docker rm -f && docker pull 'ghcr.io/rooch-network/rooch:${{ github.event.inputs.tagName }}' && docker run -d -v /data:/root -p 6767:6767 'ghcr.io/rooch-network/rooch:${{ github.event.inputs.tagName }}' server start -n main --btc-rpc-url '${{secrets.BTC_MAIN_RPC_URL}}' --btc-rpc-username rooch-main --btc-rpc-password '${{secrets.BTC_MAIN_RPC_PWD}}' --btc-start-block-height 0 --btc-end-block-height 767420 --data-import-mode 1"
2 changes: 1 addition & 1 deletion .github/workflows/deploy_testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ jobs:
chmod 600 private_key.pem
sudo apt update
sudo apt install -y --no-install-recommends openssh-server
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST bash -c "'sleep 30' && docker image prune -a -f && docker ps | grep rooch | grep -v faucet | awk '{print \$1}' | xargs -r docker stop && docker ps -a | grep rooch | grep -v faucet | awk '{print \$1}' | xargs -r docker rm -f && docker pull 'ghcr.io/rooch-network/rooch:${{ env.REF }}' && docker run -d --name rooch --restart unless-stopped -v /data:/root -p 50051:50051 'ghcr.io/rooch-network/rooch:${{ env.REF }}' server start -n test --btc-rpc-url '${{secrets.BTC_TEST_RPC_URL}}' --btc-rpc-username rooch-test --btc-rpc-password '${{secrets.BTC_TEST_RPC_PWD}}' --da '{\"internal-da-server\": {\"servers\": [{\"open-da\": {\"scheme\": \"gcs\", \"config\": {\"bucket\": \"${{secrets.OPENDA_GCP_TESTNET_BUCKET}}\", \"credential\": \"${{secrets.OPENDA_GCP_TESTNET_CREDENTIAL}}\"}}}]}}'"
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST bash -c "'sleep 30' && docker image prune -a -f && docker ps | grep rooch | grep -v faucet | awk '{print \$1}' | xargs -r docker stop && docker ps -a | grep rooch | grep -v faucet | awk '{print \$1}' | xargs -r docker rm -f && docker pull 'ghcr.io/rooch-network/rooch:${{ env.REF }}' && docker run -d --name rooch --restart unless-stopped -v /data:/root -p 6767:6767 'ghcr.io/rooch-network/rooch:${{ env.REF }}' server start -n test --btc-rpc-url '${{secrets.BTC_TEST_RPC_URL}}' --btc-rpc-username rooch-test --btc-rpc-password '${{secrets.BTC_TEST_RPC_PWD}}' --da '{\"internal-da-server\": {\"servers\": [{\"open-da\": {\"scheme\": \"gcs\", \"config\": {\"bucket\": \"${{secrets.OPENDA_GCP_TESTNET_BUCKET}}\", \"credential\": \"${{secrets.OPENDA_GCP_TESTNET_CREDENTIAL}}\"}}}]}}'"
2 changes: 1 addition & 1 deletion .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ jobs:
chmod 600 private_key.pem
sudo apt update
sudo apt install -y --no-install-recommends openssh-server
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST bash -c "'sleep 30' && docker image prune -a -f && docker ps | grep main_debug | awk '{print \$1}' | xargs -r docker stop && docker ps -a | grep main_debug | awk '{print \$1}' | xargs -r docker rm -f && docker pull 'ghcr.io/rooch-network/rooch:main_debug' && docker run --rm -v /root:/root ghcr.io/rooch-network/rooch:main_debug server clean -n dev -f && docker run -d -v /root:/root -p 50051:50051 'ghcr.io/rooch-network/rooch:main_debug' server start -n dev --btc-rpc-url '${{secrets.BTC_REGTEST_RPC_URL}}' --btc-rpc-username rooch-regtest --btc-rpc-password '${{secrets.BTC_REGTEST_RPC_PWD}}' --da '{\"internal-da-server\": {\"servers\": [{\"open-da\": {\"scheme\": \"fs\"}}]}}'"
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST bash -c "'sleep 30' && docker image prune -a -f && docker ps | grep main_debug | awk '{print \$1}' | xargs -r docker stop && docker ps -a | grep main_debug | awk '{print \$1}' | xargs -r docker rm -f && docker pull 'ghcr.io/rooch-network/rooch:main_debug' && docker run --rm -v /root:/root ghcr.io/rooch-network/rooch:main_debug server clean -n dev -f && docker run -d -v /root:/root -p 6767:6767 'ghcr.io/rooch-network/rooch:main_debug' server start -n dev --btc-rpc-url '${{secrets.BTC_REGTEST_RPC_URL}}' --btc-rpc-username rooch-regtest --btc-rpc-password '${{secrets.BTC_REGTEST_RPC_PWD}}' --da '{\"internal-da-server\": {\"servers\": [{\"open-da\": {\"scheme\": \"fs\"}}]}}'"
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST "cd /root/rooch && git pull origin main && bash scripts/check_dev_deploy_status.sh main_debug '${{ secrets.DEV_MNEMONIC_PHRASE }}'"
5 changes: 2 additions & 3 deletions crates/rooch-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub mod store_config;
pub const ROOCH_DIR: &str = ".rooch";
pub const ROOCH_CONFIR_DIR: &str = "rooch_config";
pub const ROOCH_CLIENT_CONFIG: &str = "rooch.yaml";
pub const ROOCH_SERVER_CONFIG: &str = "server.yaml";
pub const ROOCH_KEYSTORE_FILENAME: &str = "rooch.keystore";

pub static R_DEFAULT_BASE_DATA_DIR: Lazy<PathBuf> = Lazy::new(|| {
Expand Down Expand Up @@ -82,7 +81,7 @@ pub struct RoochOpt {
pub store: StoreConfig,

/// Optional custom port, which the rooch server should listen on.
/// The port on which the server should listen defaults to `50051`
/// The port on which the server should listen defaults to `6767`
#[serde(skip_serializing_if = "Option::is_none")]
#[clap(long, short = 'p')]
pub port: Option<u16>,
Expand Down Expand Up @@ -221,7 +220,7 @@ impl RoochOpt {
}

pub fn port(&self) -> u16 {
self.port.unwrap_or(50051)
self.port.unwrap_or(6767)
}

pub fn chain_id(&self) -> RoochChainID {
Expand Down
2 changes: 1 addition & 1 deletion crates/rooch-config/src/server_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Default for ServerConfig {
fn default() -> Self {
Self {
host: "0.0.0.0".to_string(),
port: 50051,
port: 6767,
block_propose_duration_in_seconds: 5,
}
}
Expand Down
13 changes: 1 addition & 12 deletions crates/rooch-rpc-client/src/wallet_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ use move_core_types::account_address::AccountAddress;
use moveos_types::moveos_std::gas_schedule::GasScheduleConfig;
use moveos_types::transaction::MoveAction;
use rooch_config::config::{Config, PersistedConfig};
use rooch_config::server_config::ServerConfig;
use rooch_config::{rooch_config_dir, ROOCH_CLIENT_CONFIG, ROOCH_SERVER_CONFIG};
use rooch_config::{rooch_config_dir, ROOCH_CLIENT_CONFIG};
use rooch_key::keystore::account_keystore::AccountKeystore;
use rooch_key::keystore::file_keystore::FileBasedKeystore;
use rooch_key::keystore::Keystore;
Expand All @@ -28,7 +27,6 @@ use tokio::sync::RwLock;
pub struct WalletContext {
client: Arc<RwLock<Option<Client>>>,
pub client_config: PersistedConfig<ClientConfig>,
pub server_config: PersistedConfig<ServerConfig>,
pub keystore: Keystore,
pub address_mapping: BTreeMap<String, AccountAddress>,
password: Option<String>,
Expand All @@ -40,22 +38,14 @@ impl WalletContext {
pub fn new(config_path: Option<PathBuf>) -> Result<Self, anyhow::Error> {
let config_dir = config_path.unwrap_or(rooch_config_dir()?);
let client_config_path = config_dir.join(ROOCH_CLIENT_CONFIG);
let server_config_path = config_dir.join(ROOCH_SERVER_CONFIG);
let client_config: ClientConfig = PersistedConfig::read(&client_config_path).map_err(|err| {
anyhow!(
"Cannot open wallet config file at {:?}. Err: {err}, Use `rooch init` to configuration",
client_config_path
)
})?;
let server_config: ServerConfig = PersistedConfig::read(&server_config_path).map_err(|err| {
anyhow!(
"Cannot open server config file at {:?}. Err: {err}, Use `rooch init` to configuration",
server_config_path
)
})?;

let client_config = client_config.persisted(&client_config_path);
let server_config = server_config.persisted(&server_config_path);

let keystore_result = FileBasedKeystore::load(&client_config.keystore_path);
let keystore = match keystore_result {
Expand All @@ -74,7 +64,6 @@ impl WalletContext {
Ok(Self {
client: Default::default(),
client_config,
server_config,
keystore,
address_mapping,
password: None,
Expand Down
27 changes: 2 additions & 25 deletions crates/rooch/src/commands/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use clap::Parser;
use fastcrypto::encoding::{Base64, Encoding};
use regex::Regex;
use rooch_config::config::Config;
use rooch_config::server_config::ServerConfig;
use rooch_config::{
rooch_config_dir, ROOCH_CLIENT_CONFIG, ROOCH_KEYSTORE_FILENAME, ROOCH_SERVER_CONFIG,
};
use rooch_config::{rooch_config_dir, ROOCH_CLIENT_CONFIG, ROOCH_KEYSTORE_FILENAME};
use rooch_key::key_derive::hash_password;
use rooch_key::keystore::account_keystore::AccountKeystore;
use rooch_key::keystore::file_keystore::FileBasedKeystore;
Expand Down Expand Up @@ -66,26 +63,6 @@ impl CommandAction<()> for Init {
Err(error) => return Err(RoochError::GenerateKeyError(error.to_string())),
};

// Rooch server config init
let server_config_path = config_path.join(ROOCH_SERVER_CONFIG);
if !server_config_path.exists() {
let server_config = ServerConfig::default();

server_config
.persisted(server_config_path.as_path())
.save()?;

println!(
"Rooch server config file generated at {}",
server_config_path.display()
);
} else {
println!(
"Rooch server config file already exists at {}",
server_config_path.display()
);
}

// Prompt user for connect to devnet fullnode if config does not exist.
if !client_config_path.exists() {
let env = match std::env::var_os("ROOCH_CONFIG_WITH_RPC_URL") {
Expand Down Expand Up @@ -117,7 +94,7 @@ impl CommandAction<()> for Init {
if address_and_port_regex.is_match(&url) {
url
} else {
return Err(RoochError::CommandArgumentError("Invalid input format. Please provide a valid URL (e.g., http://0.0.0.0:50051).".to_owned()));
return Err(RoochError::CommandArgumentError("Invalid input format. Please provide a valid URL (e.g., http://0.0.0.0:6767).".to_owned()));
}
};
Some(if url.trim().is_empty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rooch env list
```text
Env Alias | RPC URL | Websocket URL | Active Env
---------------------------------------------------------------------------------------------------------------------------------------------------------
local | http://0.0.0.0:50051 | Null |
local | http://0.0.0.0:6767 | Null |
dev | https://dev-seed.rooch.network:443/ | Null | True
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rooch env list
```text
Env Alias | RPC URL | Websocket URL | Active Env
---------------------------------------------------------------------------------------------------------------------------------------------------------
local | http://0.0.0.0:50051 | Null |
local | http://0.0.0.0:6767 | Null |
dev | https://dev-seed.rooch.network:443/ | Null | True
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rooch env list
```bash
Env Alias | RPC URL | Websocket URL | Active Env
---------------------------------------------------------------------------------------------------------------------------------------------------------
local | http://0.0.0.0:50051 | Null |
local | http://0.0.0.0:6767 | Null |
dev | https://dev-seed.rooch.network:443/ | Null | True
```

Expand All @@ -36,7 +36,7 @@ rooch env list
```bash
Env Alias | RPC URL | Websocket URL | Active Env
---------------------------------------------------------------------------------------------------------------------------------------------------------
local | http://0.0.0.0:50051 | Null |
local | http://0.0.0.0:6767 | Null |
dev | https://dev-seed.rooch.network:443/ | Null |
test | https://test-seed.rooch.network:443 | Null | True
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rooch env list
```bash
Env Alias | RPC URL | Websocket URL | Active Env
---------------------------------------------------------------------------------------------------------------------------------------------------------
local | http://0.0.0.0:50051 | Null |
local | http://0.0.0.0:6767 | Null |
dev | https://dev-seed.rooch.network:443/ | Null | True
```

Expand All @@ -36,7 +36,7 @@ rooch env list
```bash
Env Alias | RPC URL | Websocket URL | Active Env
---------------------------------------------------------------------------------------------------------------------------------------------------------
local | http://0.0.0.0:50051 | Null |
local | http://0.0.0.0:6767 | Null |
dev | https://dev-seed.rooch.network:443/ | Null |
test | https://test-seed.rooch.network:443 | Null | True
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ StoreConfig init store dir "/Users/username/.rooch/local/roochdb/rooch_store" "/
2023-10-19T16:20:30.235233Z INFO rooch_sequencer::actor::sequencer: Load latest sequencer order 0
2023-10-19T16:20:30.235487Z INFO rooch_rpc_server: RPC Server proposer address: 0x5078ae74bac281e65fc446b467a843b186904a1b2d435f367030fc755eef1081
2023-10-19T16:20:30.235882Z INFO rooch_rpc_server: acl=Const("*")
2023-10-19T16:20:30.236662Z INFO rooch_rpc_server: JSON-RPC HTTP Server start listening 0.0.0.0:50051
2023-10-19T16:20:30.236662Z INFO rooch_rpc_server: JSON-RPC HTTP Server start listening 0.0.0.0:6767
2023-10-19T16:20:30.236674Z INFO rooch_rpc_server: Available JSON-RPC methods : ["eth_blockNumber", "eth_getBalance", "eth_gasPrice", "net_version", "rooch_getBalance", "eth_sendTransaction", "rooch_sendRawTransaction", "rooch_getTransactionsByHash", "eth_getTransactionCount", "rooch_executeRawTransaction", "rooch_getEventsByEventHandle", "eth_sendRawTransaction", "eth_getTransactionByHash", "rooch_executeViewFunction", "rooch_getBalances", "eth_getBlockByNumber", "eth_feeHistory", "rooch_listStates", "rooch_getTransactionsByOrder", "eth_getBlockByHash", "rooch_getChainID", "eth_getTransactionReceipt", "eth_estimateGas", "eth_chainId", "rooch_getStates"]
The active env was successfully switched to `local`
```
Expand All @@ -28,7 +28,7 @@ The active env was successfully switched to `local`

1. Name: local
2. ChainID: 4
3. RPC: http://localhost:50051
3. RPC: http://localhost:6767

## Solve data compatibility issues

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ $ rooch server start
StoreConfig init store dir "/tmp/.tmpHkNH5Q/dev/roochdb/rooch_store" "/tmp/.tmpHkNH5Q/dev/roochdb/moveos_store"
2023-09-14T08:21:33.234354Z INFO moveos_common::utils: set max open fds 45056
2023-09-14T08:21:34.013627Z INFO rooch_rpc_server: acl=Const("*")
2023-09-14T08:21:34.013899Z INFO rooch_rpc_server: JSON-RPC HTTP Server start listening 0.0.0.0:50051
2023-09-14T08:21:34.013899Z INFO rooch_rpc_server: JSON-RPC HTTP Server start listening 0.0.0.0:6767
2023-09-14T08:21:34.013910Z INFO rooch_rpc_server: Available JSON-RPC methods : ["eth_blockNumber", "eth_sendTransaction", "eth_sendRawTransaction", "net_version", "rooch_listAnnotatedStates", "rooch_sendRawTransaction", "rooch_getAnnotatedStates", "rooch_executeRawTransaction", "eth_estimateGas", "rooch_executeViewFunction", "rooch_getBalances", "rooch_getEvents", "rooch_getStates", "eth_getBalance", "eth_gasPrice", "eth_getTransactionByHash", "eth_getTransactionCount", "rooch_getTransactionByIndex", "rooch_getEventsByEventHandle", "eth_getTransactionReceipt", "rooch_getTransactionByHash", "eth_getBlockByNumber", "eth_feeHistory", "eth_getBlockByHash", "rooch_listStates", "rooch_getTransactionInfosByTxOrder", "eth_chainId", "rooch_getTransactionInfosByTxHash", "wallet_sign", "wallet_accounts"]
```

## 本地测试网信息

1. 名称: local
2. ChainID: 4
3. RPC: http://localhost:50051
3. RPC: http://localhost:6767


## 解决数据兼容问题
Expand Down
Loading

0 comments on commit 3f4a12c

Please sign in to comment.