wormhole-foundation/wormhole

Wormchain vue / ts build is non-deterministic

Opened this issue · 1 comments

Description and context

The .proto TypeScript generation used for wormchain results in non-deterministic results, particularly the order of imports can change with multiple subsequent runs of make vue. This prevents the generated output from being committed and checked in CI, like the other .proto generation in this repo, like this:

- name: Ensure generated proto matches
run: |
rm -rf node/pkg/proto
docker build --target go-export -f Dockerfile.proto -o type=local,dest=node .
git diff --name-only --exit-code && echo "✅ Generated proto matches committed proto" || (echo "❌ Generated proto differs from committed proto, run \`rm -rf node/pkg/proto && docker build --target go-export -f Dockerfile.proto -o type=local,dest=node .\` and commit the result" >&2 && exit 1)

The ignite generate vuex command has since been deprecated and allegedly its replacement, ts-client fixes this issue.

However, attempting to use a newer version of ignite that contains the command results in the following error:

✘ Your chain has been scaffolded with an older version of Cosmos SDK: v0.45.9-wormhole-2

Please, follow the migration guide to upgrade your chain to the latest version at https://docs.ignite.com/migration

Steps to reproduce

Current state

Run make vue and stage the results, then run make clean && make vue again (this may have to be repeated multiple times). Eventually the resulting output will differ. You can also run locally, commit the changes, and compare in multiple CI runs.

Recent ignite CLI

Change wormchain/Dockerfile.proto's base image to FROM ignitehq/cli:v28.5.0@sha256:2d4d1ab3af5c8a3ec004315de9f8235bc39edab44e4146efd90bebc9cc9016fa AS base and the generate vuex line to generate ts-client. Run make vue and watch it fail with the aforementioned error.

Experienced behavior

Sadness.

Expected behavior

Deterministic build output.

Solution recommendation

Perhaps if / when Wormchain is updated to a newer version of the Cosmos SDK, a newer version of ignite with the ts-client command could be used (though ignite is only used for codegen). Or, does ignite really need to be used for this at all?

Oh, and bonus... the tilt CI step occasionally fails on RUN NODE_OPTIONS="" ignite generate vuex --proto-all-modules with the following:

error while running command /tmp/sta3578825123 sta --module-name-index -1 -p /tmp/gen-js-openapi-module-spec2462645117/apidocs.swagger.json -o /apps/wormchain/vue/src/store/generated/cosmos/cosmos-sdk/cosmos.slashing.v1beta1/module -n rest.ts: : fork/exec /tmp/sta3578825123: text file busy