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
372 stars 293 forks source link

Tracking issue: Modularize the Penumbra application code into coherent crates #2288

Closed hdevalence closed 10 months ago

hdevalence commented 1 year ago

Is your feature request related to a problem? Please describe.

Since there isn't already a Rust application framework for building Tendermint chains, we've had to build one at the same time as we've built out our application. This has been a messy and iterative process, and along the way, we've passed from having separate crates for separate components of the application (which turned out not to be entirely separate) to having effectively all of our application logic in a single crate, formerly called penumbra_component and now called penumbra_app (after #2282).

However, while looking at the current structure of our code, we realized there may be a path to re-modularizing it, not in a single stop-the-world refactor, but gradually peeling out chunks of functionality.

Describe the solution you'd like

The following plan is a sketch; the first steps are concrete and definitely a good idea, while the later steps are more speculative. As we do this, let's think step by step, and notice any unexpected frictions.

hdevalence commented 1 year ago

One potential problem: currently, most of the Action messages are defined outside of the penumbra_app crate where the impls are defined. So if we extract the ActionHandler trait into a penumbra_component crate, we won't be able to leave the impls where they are -- we'd either have to skip all the way to the end (doing a giant, stop-the-world refactor), or introduce a shim newtype in the penumbra_app crate, like struct SpendWrapper<'a>(&'a Spend). The latter might not be so terrible as a temporary measure?

conorsch commented 11 months ago

Align protobuf package organization with new Rust code organization

Achieved in https://github.com/penumbra-zone/penumbra/pull/3077 There's a bit of follow up tracked in https://github.com/penumbra-zone/penumbra/issues/3078

conorsch commented 11 months ago

Closing as complete!

hdevalence commented 11 months ago

Reopening, we also need to split into per component RPC implementations. I'll do that today.

conorsch commented 11 months ago

Added the follow-up issue https://github.com/penumbra-zone/penumbra/issues/2914 to the checklist at the top. Once 2914 is done, we can close out this tracking issue.

hdevalence commented 10 months ago

I don't think #2914 is related to this issue, it's definitely good to do but it's not part of modularizing our own code.