Skip to content

Instantly share code, notes, and snippets.

@p-offtermatt
Created August 16, 2023 16:32
Show Gist options
  • Save p-offtermatt/54cc90e539f02781e188c96f9bbb4c57 to your computer and use it in GitHub Desktop.
Save p-offtermatt/54cc90e539f02781e188c96f9bbb4c57 to your computer and use it in GitHub Desktop.
Manual test for penumbra and CometMock

Install penumbra and CometMock. Make sure cometmock is compiled from branch v0.34.x. My penumbra version is from branch 2771-cometmock-smoketest.

Run cometmock-test.sh This will print out two commands, one for penumbra and one for CometMock. Just copy-paste the commands and run them (in separate terminals). Run pd first, give it a second until it's started, then run the one for CometMock.

They look like this for me: cargo run --quiet --release --bin pd -- start --home /Users/offtermatt/.penumbra/testnet_data/node0/pd for pd cometmock 127.0.0.1:26658 /Users/offtermatt/.penumbra/testnet_data/node0/tendermint/config/genesis.json tcp://127.0.0.1:26657 /Users/offtermatt/.penumbra/testnet_data/node0/tendermint socket for CometMock

If everything went well so far,

Run export PENUMBRA_NODE_PD_URL="http://127.0.0.1:8080"

Run export PCLI_UNLEASH_DANGER="yes"

Run cargo run --release --bin pcli q validator list - if this gives output like this, ABCI queries work:

Voting Power  Share    Commission  State   Bonding State  Validator Info                                                                    
 24998.425     100.00%  300bps      Active  Bonded         penumbravalid12q38kyk59dv9aly9wqgvl3kypw2vskevnymgl4rqq5lm89r5gvrsx9lspn

Now, run a delegation like this, where the validator address is replaced by your validator info as received as an output from above - I am not sure this is the same in each run or nondeterministic.

cargo run --bin pcli tx delegate 500penumbra --to penumbravalid12q38kyk59dv9aly9wqgvl3kypw2vskevnymgl4rqq5lm89r5gvrsx9lspn

This should give an output like this:

Scanning blocks from last sync height 891 to latest height 1035
[0s] ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░       0/144 
[0s] ████████████████████████████████████████████░░░░░░     129/144 
[0s] ██████████████████████████████████████████████████     144/144     1862/s ETA: 0s
building transaction...
finished proving in 21.517 seconds [4 actions, 3 proofs, 2458 bytes]
broadcasting transaction and awaiting confirmation...
transaction confirmed and detected: 5ca01946975c5f6622a8c738544f6564fee06bcae617307a957edc3b92dcf3b6 @ height 1057

I am not sure how to confirm that the delegation actually went through, but this looks good to me.

#!/bin/bash
# Wrapper script to bottle up logic for running "smoke tests" in CI,
# supporting backgrounding tasks and checking on their status later.
# The execution plan is:
#
# 1. Start the network
# 2. Wait ~10s
# 3. Run integration tests (fail here if non-zero)
# 4. Continue running network ~5m
#
# The goal is to fail fast if an integration test exits, but permit
# a slightly longer runtime for the suite to find more errors.
set -euo pipefail
# Fail fast if testnet dir exists, otherwise `cargo run ...` will block
# for a while, masking the error.
if [[ -d ~/.penumbra/testnet_data ]] ; then
>&2 echo "ERROR: testnet data directory exists at ~/.penumbra/testnet_data"
>&2 echo "Not removing this directory automatically; to remove, run: pd testnet unsafe-reset-all"
exit 1
fi
export RUST_LOG="pclientd=info,pcli=info,pd=info,penumbra=info,tower_abci=debug"
# Duration that the network will be left running before script exits.
TESTNET_RUNTIME="${TESTNET_RUNTIME:-120}"
# Duration that the network will run before integration tests are run.
TESTNET_BOOTTIME="${TESTNET_BOOTTIME:-20}"
echo "Building pd from latest source..."
cargo -q build --release --bin pd
echo "Generating testnet config..."
EPOCH_DURATION="${EPOCH_DURATION:-100}"
cargo run --quiet --release --bin pd -- testnet generate --epoch-duration "$EPOCH_DURATION" --timeout-commit 500ms
echo "Starting pd..."
echo "Run this command for pd"
echo '========'
echo cargo run --quiet --release --bin pd -- start --home "${HOME}/.penumbra/testnet_data/node0/pd"
echo '========'
sleep 2
echo "Starting CometMock (stand-in for Tendermint/CometBFT)..."
# ❯ cometmock -h
# Usage: <app-addresses> <genesis-file> <cometmock-listen-address> <node-homes> <abci-connection-mode>
echo "Run this command for cometmock"
echo '========'
echo cometmock 127.0.0.1:26658 "${HOME}/.penumbra/testnet_data/node0/tendermint/config/genesis.json" tcp://127.0.0.1:26657 "${HOME}/.penumbra/testnet_data/node0/tendermint" socket
echo '========'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment