wormhole-foundation / wormhole

A reference implementation for the Wormhole blockchain interoperability protocol.
https://wormhole.com
Other
1.69k stars 694 forks source link

Wormchain vue / ts build is non-deterministic #4058

Open evan-gray opened 4 months ago

evan-gray commented 4 months ago

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: https://github.com/wormhole-foundation/wormhole/blob/c2496cd2afd8867ad2df08fd4dc7f3d0d681f4af/.github/workflows/build.yml#L300-L304

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?

evan-gray commented 4 months ago

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