Skip to content

Commit

Permalink
feat(octez): whitelist added
Browse files Browse the repository at this point in the history
feat(rollup): white list + log outputs

fix(env): default env values changed
  • Loading branch information
alanmarkoTrilitech authored and johnyob committed May 20, 2024
1 parent 746f11d commit cd8d91b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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...
JSTZ_ROLLUP_BRIDGE_ADDRESS=KT1...
21 changes: 20 additions & 1 deletion crates/jstz_rollup/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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() {
Expand All @@ -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() {
Expand Down
2 changes: 2 additions & 0 deletions crates/octez/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
21 changes: 16 additions & 5 deletions scripts/run-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."

Expand All @@ -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" \
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cd8d91b

Please sign in to comment.