From cd8d91b4dc701e86ec2643b0ec384ba1afa5c0dc Mon Sep 17 00:00:00 2001 From: Alan Marko Date: Wed, 1 May 2024 15:01:50 +0100 Subject: [PATCH] feat(octez): whitelist added feat(rollup): white list + log outputs fix(env): default env values changed --- .env.example | 4 ++-- crates/jstz_rollup/entrypoint.sh | 21 ++++++++++++++++++++- crates/octez/src/client.rs | 2 ++ scripts/run-operator.sh | 21 ++++++++++++++++----- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 238cf60a5..5dd48fa57 100644 --- a/.env.example +++ b/.env.example @@ -6,9 +6,9 @@ OPERATOR_SK=unencrypted:... OPERATOR_ADDRESS=tz1... # Teztnet network used (see https://teztnets.com/) -NETWORK=weeklynet-... +NETWORK=ghostnet JSTZ_TAG=v0.1.0-... # jstz-rollup environment variables JSTZ_ROLLUP_ADDRESS=sr1... -JSTZ_ROLLUP_BRIDGE_ADDRESS=KT1... \ No newline at end of file +JSTZ_ROLLUP_BRIDGE_ADDRESS=KT1... diff --git a/crates/jstz_rollup/entrypoint.sh b/crates/jstz_rollup/entrypoint.sh index 5abb1a0fa..60fe355d0 100644 --- a/crates/jstz_rollup/entrypoint.sh +++ b/crates/jstz_rollup/entrypoint.sh @@ -29,6 +29,14 @@ make-installer() { --kernel "$kernel_path" \ --bridge "$JSTZ_ROLLUP_BRIDGE_ADDRESS" \ --output "$installer_dir" + + # Check the exit status of the last command + if [ $? -eq 0 ]; then + echo "Installer created successfully in $installer_dir." + else + echo "Failed to create installer. Please check the parameters and try again." + exit 1 + fi } deploy-bridge() { @@ -48,11 +56,21 @@ run() { fi mkdir -p "$logs_dir" + jstz-rollup run \ --preimages "$installer_dir/preimages" \ --rollup "$JSTZ_ROLLUP_ADDRESS" \ --logs "$logs_dir" \ --addr "0.0.0.0" + + exit_status=$? + + if [ $exit_status -eq 0 ]; then + echo "jstz-rollup node started successfully." + else + echo "Failed to start jstz-rollup node. Exit status: $exit_status" + exit $exit_status + fi } deploy() { @@ -62,7 +80,8 @@ deploy() { jstz-rollup deploy \ --kernel "$kernel_path" \ --bridge "$JSTZ_ROLLUP_BRIDGE_ADDRESS" \ - --output "$installer_dir" + --output "$installer_dir" \ + --operator "$OPERATOR_ADDRESS" } main() { diff --git a/crates/octez/src/client.rs b/crates/octez/src/client.rs index ce7b11ee6..62eb6117a 100644 --- a/crates/octez/src/client.rs +++ b/crates/octez/src/client.rs @@ -279,6 +279,8 @@ impl OctezClient { "--burn-cap", "999", "--force", + "--whitelist", + format!("[\"{}\"]", account).as_str(), ]))?; let operation = regex_extract(r"Operation hash is '(o[^\s]+)'", &output)?; diff --git a/scripts/run-operator.sh b/scripts/run-operator.sh index 3e55b19d0..9c16fc5af 100755 --- a/scripts/run-operator.sh +++ b/scripts/run-operator.sh @@ -82,8 +82,14 @@ jstz_deploy() { jstz_configure_env - echo "Pulling latest images from GHCR" - docker-compose --context "$1" pull + + if [ "$1" = "remote" ] + then + echo "Pulling latest images from GHCR" + docker-compose --context "$1" pull + else + echo "Context is not remote. Skipping pull." + fi echo "Deploying rollup..." @@ -94,7 +100,7 @@ jstz_deploy() { operator_sk=${OPERATOR_SK:?Unset OPERATOR_SK in .env} operator_address=${OPERATOR_ADDRESS:?Unset OPERATOR_ADDRESS in .env} jstz_tag=${JSTZ_TAG:?Unset JSTZ_TAG in .env} - docker_registry=${DOCKER_REGISTRY:?Unset DOCKER_REGISTRY in .env} + docker_registry=${DOCKER_REGISTRY} output=$(docker --context "$1" run -v /var/run/docker.sock:/var/run/docker.sock \ -e NETWORK="$network" -e OPERATOR_SK="$operator_sk" -e OPERATOR_ADDRESS="$operator_address" \ @@ -128,8 +134,13 @@ jstz_start() { echo "Stopping current containers (if running)" docker-compose --context "$1" down - echo "Pulling latest images from GHCR" - docker-compose --context "$1" pull + if [ "$1" = "remote" ] + then + echo "Pulling latest images from GHCR" + docker-compose --context "$1" pull + else + echo "Context is not remote. Skipping pull." + fi echo "Spinning up containers" docker-compose --context "$1" up -d