From 807fda0f1f69f7e85bf4efa3939a7f4178998e70 Mon Sep 17 00:00:00 2001 From: popcnt <142196625+popcnt1@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:52:53 +0800 Subject: [PATCH] fix(ci): fix deploy devnet arguments (#2903) fixed: ``` root@rooch-testnet:~# docker logs -f deceeca06fe1 error: invalid value '{"da-backend": {"backends": [{"open-da": {"scheme": "fs"}}]}}' for '--da ': missing field config at line 1 column 57 ``` --- .github/workflows/docker_build.yml | 2 +- crates/rooch-config/src/da_config.rs | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index 21ac373bca..3b75acef0f 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -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 6767:6767 -p 9184:9184 '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 '{\"da-backend\": {\"backends\": [{\"open-da\": {\"scheme\": \"fs\"}}]}}' --traffic-burst-size 100000 --traffic-per-second 1" + 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 -p 9184:9184 '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 '{\"da-backend\": {\"backends\": [{\"open-da\": {\"scheme\": \"fs\", \"config\": {}}}]}}' --traffic-burst-size 100000 --traffic-per-second 1" 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.TESTNET_MNEMONIC_PHRASE }}'" diff --git a/crates/rooch-config/src/da_config.rs b/crates/rooch-config/src/da_config.rs index 340e6e2ff3..5eaabde008 100644 --- a/crates/rooch-config/src/da_config.rs +++ b/crates/rooch-config/src/da_config.rs @@ -305,7 +305,8 @@ mod tests { fn da_config_from_str() { let da_config_str = r#"{"da-backend": {"submit-strategy": "all", "backends": [{"celestia": {"namespace": "//////////////////////////////////////8=", "conn": "test-conn", "auth-token": "test-token", "max-segment-size": 2048}}, - {"open-da": {"scheme": "gcs", "config": {"bucket": "test-bucket", "credential": "test-credential"}}}]}}"#; + {"open-da": {"scheme": "gcs", "config": {"bucket": "test-bucket", "credential": "test-credential"}}}, + {"open-da": {"scheme": "fs", "config": {}}}]}}"#; let exp_celestia_config = DABackendCelestiaConfig { namespace: Namespace::PARITY_SHARE, conn: "test-conn".to_string(), @@ -323,12 +324,19 @@ mod tests { namespace: None, max_segment_size: None, }; + let exp_fs_config = DABackendOpenDAConfig { + scheme: OpenDAScheme::Fs, + config: HashMap::new(), + namespace: None, + max_segment_size: None, + }; let exp_da_config = DAConfig { da_backend: Some(DABackendConfig { submit_strategy: Some(DAServerSubmitStrategy::All), backends: vec![ DABackendConfigType::Celestia(exp_celestia_config.clone()), DABackendConfigType::OpenDa(exp_openda_config.clone()), + DABackendConfigType::OpenDa(exp_fs_config.clone()), ], background_submit_interval: None, }), @@ -342,5 +350,23 @@ mod tests { panic!("Error parsing DA Config: {}", e) } } + + let da_config_str = "{\"da-backend\": {\"backends\": [{\"open-da\": {\"scheme\": \"fs\", \"config\": {}}}]}}"; + let exp_da_config = DAConfig { + da_backend: Some(DABackendConfig { + submit_strategy: None, + backends: vec![DABackendConfigType::OpenDa(exp_fs_config.clone())], + background_submit_interval: None, + }), + base: None, + }; + match DAConfig::from_str(da_config_str) { + Ok(da_config) => { + assert_eq!(da_config, exp_da_config); + } + Err(e) => { + panic!("Error parsing DA Config: {}", e) + } + } } }