proto-kit / framework

Apache License 2.0
28 stars 10 forks source link

feat: implemented a universal ModuleContainer with configurability per module #31

Closed maht0rz closed 1 year ago

maht0rz commented 1 year ago

This PR introduces ModuleContainer, a generic way to provide modular components across our stack. Sequencer, Runtime and AppChain have been migrated to adhere to the new modularity concepts.

Furthermore, two new packages have been introduced:

This PR has a lot of file changes since the mixup in modularity between Runtime and Sequencer had far reaching implications. The easiest way to review this PR is by looking at the following files:

Additionally there were notable changes to both @runtimeModule() and @sequencerModule() decorators, they were simplified down to a point where they enforce extension of RuntimeModule and SequencerModule respectively.

rpanic commented 1 year ago

Can you please explain in your mental model, which of these new packages depends on our existing ones and what of these modules will be used where?

maht0rz commented 1 year ago

Can you please explain in your mental model, which of these new packages depends on our existing ones and what of these modules will be used where?

The @yab/sdk package should contain user facing stuff, i envision a scenario where someone uses our 'starter kit' or a plain nodejs project and installs maybe only @yab/sdk and that will let them access AppChain and everything else they need for quick local development experience.

Subsequently i think all actual appchains, should publish their own packages based on @yab/sdk, exposing their configured appChains such as @my-app-chain/sdk which will export a ready to use app chain with all runtime code ready to be used etc.

@yab/common should contain things that are re-used by our other packages, that could be the ModuleContainer or specific helper types, perhaps even the newly planned method decorator or zk program creation logic. We have at least three packages that have somewhat similar dependencies so they should live here.