Skip to content

Commit

Permalink
partial: a few changes
Browse files Browse the repository at this point in the history
Back in [0] we removed the wasm crate from the monorepo, so that the web

team could own it and iterate more quickly. We also purged associated
testing, however, so we missed some breakage around the release of
v0.70.0. This check attempts to restore some visibility into the
potential of breaking APIs relevant to web work.

[0] #3819
  • Loading branch information
conorsch committed Mar 28, 2024
1 parent 4c3e05b commit c9bf6fd
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 34 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Install nextest
uses: taiki-e/install-action@nextest
Expand All @@ -25,6 +27,7 @@ jobs:
# The `-D warnings` option causes an error on warnings;
# we must duplicate the rustflags from `.cargo/config.toml`.
RUSTFLAGS: "-D warnings --cfg tokio_unstable"

- name: Check wasm compatibility
run: ./deployments/scripts/check-wasm-compat.sh

Expand Down
73 changes: 39 additions & 34 deletions deployments/scripts/check-wasm-compat.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
#!/usr/bin/env bash
# CI script for checking that the Penumbra monorepo does not accidentally
# break compatibility with downstream web APIs, via the WASM crate.
# Historically, this breakage has taken the form of inadvertently introducing
# dependencies on std, e.g. via `mio`.
set -euo pipefail

set -e

# List of packages taken from web repo's wasm Cargo.toml:
#
# ❯ rg ^penumbra packages/wasm/crate/Cargo.toml --no-line-number | cut -f1 -d' ' | sort
#
# should be periodically updated in order to keep parity.

packages=(
"penumbra-asset"
"penumbra-tct"
"penumbra-community-pool"
"penumbra-compact-block"
"penumbra-dex"
"penumbra-distributions"
"penumbra-fee"
"penumbra-funding"
"penumbra-governance"
"penumbra-ibc"
"penumbra-sct"
"penumbra-shielded-pool"
"penumbra-stake"
"penumbra-keys"
"penumbra-transaction"
"penumbra-txhash"
# Note: we can't include those ones because they rely on `getrandom`
# but there's a `js` feature...
# "penumbra-num"
# "penumbra-proto"
# "decaf377-fmd"
# "decaf377-frost"
# "decaf377-ka"
# "penumbra-proof-params"
penumbra-asset
penumbra-compact-block
penumbra-dex
penumbra-fee
penumbra-governance
penumbra-ibc
penumbra-keys
penumbra-sct
penumbra-shielded-pool
penumbra-stake
penumbra-tct
penumbra-transaction

# Some aren't ready with no default features, due to js/getrandom:
# penumbra-num
# penumbra-proof-params
# penumbra-proto
# decaf377-fmd
# decaf377-frost
# decaf377-ka
)

for package in "${packages[@]}"; do
echo "Building package: $package"
cargo check --release --target wasm32-unknown-unknown --package "$package" --no-default-features
if [ $? -ne 0 ]; then
echo "Compile error encountered while building package $package"
exit 1
fi
echo "Package $package built successfully"
echo "------------------------"
# We intentionally loop over the packages one by one to make error-reporting clearer.
# Ostensibly this would be slow, but in CI with a warm cache it's quick.
for p in ${packages[@]} ; do
echo "Checking package for wasm compat: $p ..."
if ! cargo check --quiet --release --target wasm32-unknown-unknown --no-default-features --package "$p" ; then
>&2 echo "ERROR: package appears not to be wasm-compatible: '$p'"
exit 1
fi
done

0 comments on commit c9bf6fd

Please sign in to comment.