Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nix): improve flake.nix, adding checks and formatter #542

Merged
merged 4 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
# FIXME: Once rustup adds a command to install a toolchain from rust-toolchain.toml, we can remove this.
run: rustup toolchain add 1.73.0 --profile minimal --component llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest

- name: Lint
run: make lint
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test: test-unit test-int
test-unit:
# --lib only runs unit tests in library crates
# --bins only runs unit tests in binary crates
@cargo test --lib --bins
@cargo nextest run --lib --bins

.PHONY: test-int
test-int:
Expand All @@ -70,7 +70,7 @@ test-int:
# FIXME(https://linear.app/tezos/issue/JSTZ-46):
# Currently this runs the test for `test_nested_transactions`. This test should
# be moved to an inline-test in the `jstz_core` crate to avoid this.
@cargo test --test "*"
@cargo nextest run --test "*"

.PHONY: cov
cov:
Expand Down
154 changes: 77 additions & 77 deletions crates/jstz_rollup/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mkdir -p "$JSTZ_ROLLUP_OCTEZ_CLIENT_DIR"
export JSTZ_ROLLUP_OCTEZ_ROLLUP_NODE_DIR="/root/.octez-smart-rollup-node"
mkdir -p "$JSTZ_ROLLUP_OCTEZ_ROLLUP_NODE_DIR"

# shellcheck disable=SC2034
# shellcheck disable=SC2034
# JSTZ_ROLLUP_OCTEZ_NODE_ENDPOINT is used in the jstz-rollup command
export JSTZ_ROLLUP_OCTEZ_NODE_ENDPOINT="https://rpc.$NETWORK.teztnets.com/"

Expand All @@ -16,96 +16,96 @@ installer_dir="root/installer"
logs_dir="root/logs"

if [ ! -f "$JSTZ_ROLLUP_OCTEZ_CLIENT_DIR/secret_keys" ]; then
echo "Importing operator secret key..."
if [ -z "$OPERATOR_SK" ]; then
echo "OPERATOR_SK is not set"
exit 1
fi
jstz-rollup operator import-keys --secret-key "$OPERATOR_SK"
echo "Importing operator secret key..."
if [ -z "$OPERATOR_SK" ]; then
echo "OPERATOR_SK is not set"
exit 1
fi
jstz-rollup operator import-keys --secret-key "$OPERATOR_SK"
fi

make-installer() {
jstz-rollup 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
jstz-rollup 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() {
jstz-rollup deploy-bridge \
--operator "$OPERATOR_ADDRESS"
jstz-rollup deploy-bridge \
--operator "$OPERATOR_ADDRESS"
}

deploy-installer() {
jstz-rollup deploy-installer \
--installer "$installer_dir/installer.wasm" \
--bridge "$JSTZ_ROLLUP_BRIDGE_ADDRESS"
jstz-rollup deploy-installer \
--installer "$installer_dir/installer.wasm" \
--bridge "$JSTZ_ROLLUP_BRIDGE_ADDRESS"
}

run() {
if [ -z "$(ls -A $installer_dir)" ]; then
make-installer
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
if [ -z "$(ls -A $installer_dir)" ]; then
make-installer
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() {
JSTZ_ROLLUP_BRIDGE_ADDRESS=$(deploy-bridge | grep -oE 'KT1[a-zA-Z0-9]{33}' | uniq | tr -d '\n')
echo "Bridge address: $JSTZ_ROLLUP_BRIDGE_ADDRESS"

jstz-rollup deploy \
--kernel "$kernel_path" \
--bridge "$JSTZ_ROLLUP_BRIDGE_ADDRESS" \
--output "$installer_dir" \
--operator "$OPERATOR_ADDRESS"
JSTZ_ROLLUP_BRIDGE_ADDRESS=$(deploy-bridge | grep -oE 'KT1[a-zA-Z0-9]{33}' | uniq | tr -d '\n')
echo "Bridge address: $JSTZ_ROLLUP_BRIDGE_ADDRESS"

jstz-rollup deploy \
--kernel "$kernel_path" \
--bridge "$JSTZ_ROLLUP_BRIDGE_ADDRESS" \
--output "$installer_dir" \
--operator "$OPERATOR_ADDRESS"
}

main() {
command="$1"
shift 1

case $command in
"run")
run
;;
"deploy")
deploy
;;
"deploy-bridge")
deploy-bridge
;;
"deploy-installer")
deploy-installer
;;
"make-installer")
make-installer
;;
*)
cat <<EOF
command="$1"
shift 1

case $command in
"run")
run
;;
"deploy")
deploy
;;
"deploy-bridge")
deploy-bridge
;;
"deploy-installer")
deploy-installer
;;
"make-installer")
make-installer
;;
*)
cat <<EOF
Usage: $0 <COMMAND>

Commands:
Expand All @@ -115,11 +115,11 @@ Commands:
deploy-installer
make-installer
EOF
exit 1
;;
esac
exit 1
;;
esac
}

if [ "$0" == "${BASH_SOURCE[0]}" ]; then
main "$@"
main "$@"
fi
65 changes: 64 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading