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

ci: 🚭 fix summonerd smoke tests #4358

Merged
merged 6 commits into from
May 10, 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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ deployments/relayer/configs/penumbra-local.json
# Logs, and other files from smoke tests
deployments/logs/
crates/bin/pcli/proposal.toml
phase1.bin

# Memory profiler, via bytehound or otherwise
*.dat
Expand Down
1 change: 1 addition & 0 deletions crates/bin/pcli/src/command/ceremony.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ async fn handle_bid(app: &mut App, to: Address, from: AddressIndex, bid: &str) -
planner.output(value, to);
let plan = planner
.memo("E PLURIBUS UNUM".into())
.memo_return_address(app.config.full_viewing_key.payment_address(from).0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the fix 🩹

everything else in this branch is tweaks to facilitate debugging, and confirming this does in fact fix the issue.

.plan(
app.view
.as_mut()
Expand Down
8 changes: 3 additions & 5 deletions crates/bin/pd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use penumbra_app::SUBSTORE_PREFIXES;
use rand::Rng;
use rand_core::OsRng;
use tendermint_config::net::Address as TendermintAddress;
use tokio::runtime;
use tower_http::cors::CorsLayer;
use tracing::Instrument as _;
use tracing_subscriber::{prelude::*, EnvFilter};
Expand Down Expand Up @@ -183,10 +182,9 @@ async fn main() -> anyhow::Result<()> {
.install()
.expect("global recorder already installed");

// This spawns the HTTP service that lets Prometheus pull metrics from `pd`
let handle = runtime::Handle::try_current().expect("unable to get runtime handle");
handle.spawn(exporter);

// Spawn the HTTP service that lets Prometheus pull metrics from `pd`, and then
// register pd's metrics with the exporter.
tokio::spawn(exporter);
pd::register_metrics();

// We error out if a service errors, rather than keep running.
Expand Down
36 changes: 31 additions & 5 deletions deployments/scripts/smoke-summoner.sh
cratelyn marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
#!/bin/bash
# Run e2e summoner ceremony in CI
#!/usr/bin/env bash

# This script runs an end-to-end test of the summoner ceremony in CI.

set -euo pipefail

# This script also runs the devnet. The reason for this is that if testnet
# preview is redeployed during the run of this script, the script will fail
# as the chain ID will be different.

# If `SUMMONER_SMOKE_RESET=1` is set, automatically reset the testnet data
# directory, and clear the summonerd directory. This is helpful if running this
# test in a loop with e.g. `entr` or `cargo watch`.
if [[ "${SUMMONER_SMOKE_RESET:-0}" -eq '1' ]] ; then
cargo run --release --bin pd -- testnet unsafe-reset-all
rm -rf /tmp/summonerd
rm -rf /tmp/account1
fi

cratelyn marked this conversation as resolved.
Show resolved Hide resolved
# Fail fast if testnet dir exists, otherwise `cargo run ...` will block
# for a while, masking the error.
if [[ -d ~/.penumbra/testnet_data ]] ; then
Expand All @@ -14,6 +25,21 @@ if [[ -d ~/.penumbra/testnet_data ]] ; then
exit 1
fi

# Fail fast if `/tmp/` directories created by this test already exist.
# Otherwise, this test may be inheriting stale state from a previous run.
if [[ -d /tmp/summonerd ]] ; then
>&2 echo "ERROR: summonerd directory exists at /tmp/summonerd"
>&2 echo "Not removing this directory automatically; to remove, run: rm -rf /tmp/summonerd/"
exit 1
fi
if [[ -d /tmp/account1 ]] ; then
>&2 echo "ERROR: account1 directory exists at /tmp/account1"
>&2 echo "Not removing this directory automatically; to remove, run: rm -rf /tmp/account1/"
exit 1
fi

# Fail fast if `cometbft` is not in the $PATH, we are missing software to
# run this smoke test.
if ! hash cometbft > /dev/null 2>&1 ; then
>&2 echo "ERROR: cometbft not found in PATH"
>&2 echo "See install guide: https://guide.penumbra.zone/main/pd/build.html"
Expand Down Expand Up @@ -41,7 +67,7 @@ cargo run --quiet --release --bin pd -- start --home "${HOME}/.penumbra/testnet_
pd_pid="$!"

# Ensure processes are cleaned up after script exits, regardless of status.
trap 'kill -9 "$cometbft_pid" "$pd_pid"' EXIT
trap 'kill -9 "$cometbft_pid" "$pd_pid"' EXIT INT

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the super detailed commit messages. 🙏

echo "Waiting $TESTNET_BOOTTIME seconds for network to boot..."
sleep "$TESTNET_BOOTTIME"
Expand All @@ -67,7 +93,7 @@ echo "Starting phase 1 run..."
cargo run --quiet --release --bin summonerd -- start --phase 1 --storage-dir /tmp/summonerd --fvk $SUMMONER_FVK --node http://127.0.0.1:8080 --bind-addr 127.0.0.1:8082 &
phase1_pid="$!"
# If script ends early, ensure phase 1 is halted.
trap 'kill -9 "$phase1_pid"' EXIT
trap 'kill -9 "$cometbft_pid" "$pd_pid" "$phase1_pid"' EXIT INT

echo "Setting up test accounts..."
# We are returning 0 always here because the backup wallet file does not respect the location of
Expand Down Expand Up @@ -97,7 +123,7 @@ echo "Starting phase 2 run..."
cargo run --quiet --release --bin summonerd -- start --phase 2 --storage-dir /tmp/summonerd --fvk $SUMMONER_FVK --node http://127.0.0.1:8080 --bind-addr 127.0.0.1:8082 &
phase2_pid="$!"
# If script ends early, ensure phase 2 is halted.
trap 'kill -9 "$phase2_pid"' EXIT
trap 'kill -9 "$cometbft_pid" "$pd_pid" "$phase1_pid" "$phase2_pid' EXIT INT

echo "Phase 2 contributions..."
cargo run --quiet --release --bin pcli -- --home /tmp/account1 ceremony contribute --coordinator-url http://127.0.0.1:8082 --coordinator-address $SUMMONER_ADDRESS --phase 2 --bid 10penumbra
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
devShells.default = craneLib.devShell {
inherit LIBCLANG_PATH;
inputsFrom = [ penumbra ];
packages = [ cargo-watch cargo-nextest protobuf ];
packages = [ cargo-watch cargo-nextest protobuf cometbft ];
cratelyn marked this conversation as resolved.
Show resolved Hide resolved
shellHook = ''
export LIBCLANG_PATH=${LIBCLANG_PATH}
export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc} # Required for rust-analyzer
Expand Down
Loading