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

Update testnet generation logic for actual deployment scenarios #2882

Closed
conorsch opened this issue Jul 28, 2023 · 1 comment
Closed

Update testnet generation logic for actual deployment scenarios #2882

conorsch opened this issue Jul 28, 2023 · 1 comment
Assignees
Labels
A-CI/CD Relates to continuous integration & deployment of Penumbra

Comments

@conorsch
Copy link
Contributor

We've long had support for setting ip information during creation of a new testnet, via pd testnet generate --starting-ip <ip>. We don't use that logic when deploying testnets, however, because it hardcodes adjacent IPs that don't map to our (or any) cloud environment. Instead, we clobber the generated testnet info via bash:

for i in $(seq "$NVALS"); do
I="$((i-1))"
NODEDIR="node${I}"
mkdir -p "${WORKDIR}/${NODEDIR}"
# This will be overwritten by pd testnet generate.
echo '{"identity_key": "penumbravalid1lr73zgd726gpk7rl45hvpg9f7r9wchgg8gpjhx2gqntx4md6gg9sser05u","consensus_key": "9OQ8HOy4YsryEPLbTtPKoKdmmjSqEJhzvS+x0WC8YoM=","name": "","website": "","description": "","enabled": false,"funding_streams": [{"address": "penumbrav2t1wz70yfqlgzfgwml5ne04vhnhahg8axmaupuv7x0gpuzesfhhz63y52cqffv93k7qvuuq6yqtgcj0z267v59qxpjuvc0hvfaynaaemgmqzyj38xhj8yjx7vcftnyq9q28exjrdj","rate_bps": 100}],"sequence_number": 0,"governance_key": "penumbragovern1lr73zgd726gpk7rl45hvpg9f7r9wchgg8gpjhx2gqntx4md6gg9sthagp6"}' > "${WORKDIR}/${NODEDIR}/val.json"
done
find "$WORKDIR" -name "val.json" -exec cat {} + | jq -s > "${WORKDIR}/vals.json"
# For the weekly testnets, we pass `--preserve-chain-id` when generating
# the config. For testnet-preview, we don't want that option: we want
# a unique chain id for every deploy.
if [[ "$HELM_RELEASE" =~ ^penumbra-testnet$ ]] ; then
preserve_chain_opt="--preserve-chain-id"
else
preserve_chain_opt=""
fi
echo "Generating new testnet files..."
container_cli="$(get_container_cli)"
# Silence shellcheck warning on 'preserve_chain_opt' being an empty string.
# shellcheck disable=SC2086
"$container_cli" run --user 0:0 \
--pull always \
-v "${WORKDIR}:${CONTAINERHOME}" --rm \
--entrypoint pd \
"${IMAGE}:${PENUMBRA_VERSION}" \
testnet generate \
$preserve_chain_opt \
--validators-input-file "${CONTAINERHOME}/vals.json" > /dev/null

We should permit runtime overrides for at least one of the following:

  • --peer-address-template, with e.g. penumbra-testnet-p2p-val passed in during deploys, so that -0 and -1 are appended automatically, one per validator. Doing so would support private access to genesis validators via their service endpoints, but not require us to expose the genesis validators to external ingress.
  • --external-address-template, a similar option, permitting external ingress access directly to genesis validators, suitable for devnets (where we might not want to set up a load-balanced service layer of fullnodes to handle external client requests).

Making these changes would allow us to be more flexible in the type and number of networks that we deploy, supporting e.g. custom networks to evaluate upgrade-via-governance behavior as described in #1804.

While we're at it, there's a fair amount of refactoring of the tall functions in the pd::testnet::* modules that would benefit from more types with to/from impls. #679 is within reach during such a refactor, as is #1727, but that's more of a nice-to-have. #1832 would be resolved automatically by these changes, and in combination with #2858, we could finally address #1783 meaningfully.

That's a lot of cross-linking, but the core ask here is that running pd testnet generate actually emits usable information for our test deployments. Otherwise, we're needless rewriting testnet generation in bash, rather than rust.

@conorsch conorsch added the A-CI/CD Relates to continuous integration & deployment of Penumbra label Jul 28, 2023
@conorsch conorsch self-assigned this Jul 28, 2023
@cronokirby cronokirby moved this to Future in Testnets Jul 28, 2023
@conorsch conorsch moved this from Future to Next (Steal from here) in Testnets Jul 31, 2023
@conorsch conorsch moved this from Next (Steal from here) to In Progress (Already claimed) in Testnets Aug 11, 2023
@conorsch
Copy link
Contributor Author

Added in #2916. The CI logic still clobbers the emitted info, but I'll work on updating the CI logic opportunistically. That work is now unblocked, thanks to the changes in 2916, which was the goal of this ticket.

@github-project-automation github-project-automation bot moved this from In Progress (Already claimed) to Testnet 59: Enceladus in Testnets Aug 16, 2023
conorsch added a commit that referenced this issue Aug 23, 2023
Follow-up to #2882. We want the external addresses to win out when
writing peering info for genesis validators, and that wasn't happening.
Fixed. This logic isn't currently used in CI, but will be in the near
future.
conorsch added a commit that referenced this issue Aug 23, 2023
Follow-up to #2882. We want the external addresses to win out when
writing peering info for genesis validators, and that wasn't happening.
Fixed. This logic isn't currently used in CI, but will be in the near
future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI/CD Relates to continuous integration & deployment of Penumbra
Projects
No open projects
Status: Testnet 59: Enceladus
Development

No branches or pull requests

1 participant