penumbra-zone / penumbra

Penumbra is a fully private proof-of-stake network and decentralized exchange for the Cosmos ecosystem.
https://penumbra.zone
Apache License 2.0
362 stars 287 forks source link

Incorrect feature flagging broke wasm build #3894

Closed hdevalence closed 4 months ago

hdevalence commented 4 months ago

Describe the bug

Currently, the wasm code in the extension fails to build, with errors like:

image

I believe the problem here is that since we moved all of the wasm code, we are no longer properly checking that our code builds correctly.

Two pieces of context to recall:

Component separation

The structure of the Penumbra application code is roughly as follows. Application logic is divided into distinct crates called "components", akin to Cosmos SDK "modules" (but we don't use the m-word, since it already has a meaning in Rust). In each crate, some parts of the code are used both by clients and by the fullnode, while other logic is only used by the fullnode. For instance, the action definitions are used by the client, while the actual action handler is only used on the fullnode.

Each component crate has a component submodule feature-gated by a component feature. All of the async code must live in the component submodule. This way, the crate can be built without the component feature and without pulling in any Tokio deps, async code, etc.

Wasm Cleanup

Our wasm code was originally supposed to be "just bindings", building our set of crates and exposing functions to JS/TS users. However, as we built the web extension, we also ended up having to implement extension-specific logic. This caused problems because we had extension code living outside of the extension repo, and testing and changing it became painful and difficult.

To fix this, we moved all of the wasm code out of the core protocol repo and into the web repo. (Along the way, there was also discussion of splitting up the wasm code into "extension logic" and "just bindings", but this didn't happen, potentially for good reasons, I don't know).

Unexpected Effects

The effect of this change, however, was that we now aren't checking that the core Penumbra crates will build correctly when the component feature is disabled.

There are two problems to solve here, an instant-term (now) problem and a longer-term problem:

turbocrime commented 4 months ago

fixed by #3895