diff --git a/Justfile b/Justfile index 89be1097..db167d26 100644 --- a/Justfile +++ b/Justfile @@ -8,7 +8,7 @@ METHODS_PATH := "program_methods" TEST_METHODS_PATH := "test_program_methods" ARTIFACTS := "artifacts" -# ---- Artifacts build ---- +# Build risc0 program artifacts build-artifacts: @echo "๐Ÿ”จ Building artifacts" @for methods_path in {{METHODS_PATH}} {{TEST_METHODS_PATH}}; do \ @@ -17,3 +17,45 @@ build-artifacts: mkdir -p {{ARTIFACTS}}/$methods_path; \ cp target/$methods_path/riscv32im-risc0-zkvm-elf/docker/*.bin {{ARTIFACTS}}/$methods_path; \ done + +# Run tests +test: + @echo "๐Ÿงช Running tests" + RISC0_DEV_MODE=1 cargo nextest run --no-fail-fast + +# Run Bedrock node in docker +[working-directory: 'bedrock'] +run-bedrock: + @echo "โ›“๏ธ Running bedrock" + docker compose up + +# Run Sequencer +[working-directory: 'sequencer_runner'] +run-sequencer: + @echo "๐Ÿง  Running sequencer" + RUST_LOG=info RISC0_DEV_MODE=1 cargo run --release -p sequencer_runner configs/debug + +# Run Indexer +[working-directory: 'indexer/service'] +run-indexer: + @echo "๐Ÿ” Running indexer" + RUST_LOG=info RISC0_DEV_MODE=1 cargo run --release -p indexer_service configs/indexer_config.json + +# Run Explorer +[working-directory: 'explorer_service'] +run-explorer: + @echo "๐ŸŒ Running explorer" + RUST_LOG=info cargo leptos serve + +# Run Wallet +[working-directory: 'wallet'] +run-wallet +args: + @echo "๐Ÿ”‘ Running wallet" + NSSA_WALLET_HOME_DIR=$(pwd)/configs/debug cargo run --release -p wallet -- {{args}} + +# Clean runtime data +clean: + @echo "๐Ÿงน Cleaning run artifacts" + rm -rf sequencer_runner/bedrock_signing_key + rm -rf sequencer_runner/rocksdb + rm -rf wallet/configs/debug/storage.json diff --git a/bedrock/docker-compose.yml b/bedrock/docker-compose.yml index cb93a624..4f85bf25 100644 --- a/bedrock/docker-compose.yml +++ b/bedrock/docker-compose.yml @@ -10,8 +10,7 @@ services: logos-blockchain-node-0: image: ghcr.io/logos-blockchain/logos-blockchain@sha256:000982e751dfd346ca5346b8025c685fc3abc585079c59cde3bde7fd63100657 ports: - # Map 0 port so that multiple instances can run on the same host - - "0:18080/tcp" + - "${PORT:-8080}:18080/tcp" volumes: - ./scripts:/etc/logos-blockchain/scripts - ./kzgrs_test_params:/kzgrs_test_params:z diff --git a/integration_tests/src/lib.rs b/integration_tests/src/lib.rs index 6497698d..cb940c85 100644 --- a/integration_tests/src/lib.rs +++ b/integration_tests/src/lib.rs @@ -105,7 +105,9 @@ impl TestContext { let mut compose = DockerCompose::with_auto_client(&[bedrock_compose_path]) .await - .context("Failed to setup docker compose for Bedrock")?; + .context("Failed to setup docker compose for Bedrock")? + // Setting port to 0 to avoid conflicts between parallel tests, actual port will be retrieved after container is up + .with_env("PORT", "0"); async fn up_and_retrieve_port(compose: &mut DockerCompose) -> Result { compose