Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 16 commits into from
Jun 20, 2023

Conversation

maht0rz
Copy link
Member

@maht0rz maht0rz commented Jun 15, 2023

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:

  • @yab/common, holds code shared among other packages such as ModuleContainer
  • @yab/sdk, composes other packages into a user facing package, exposes AppChain.

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:

  • common/test/config/ModuleContainer.test.ts, tests how the module container behaves
  • sdk/test/appChain/AppChain.test.ts, tests how Runtime and Sequencer are composed into an AppChain, including configurability
  • sequencer/test/sequencer/executor/Sequencer.test.ts showcases how the newly migrated Sequencer inherits the new ModuleContainer

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
Copy link
Member

rpanic commented Jun 19, 2023

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
Copy link
Member Author

maht0rz commented Jun 19, 2023

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.

@maht0rz maht0rz changed the title [WIP] feat: implemented a universal ModuleContainer with configurability per module feat: implemented a universal ModuleContainer with configurability per module Jun 19, 2023
packages/common/package.json Show resolved Hide resolved
packages/common/src/config/ConfigurableModule.ts Outdated Show resolved Hide resolved
packages/common/src/config/ModuleContainer.ts Outdated Show resolved Hide resolved
packages/common/src/config/ModuleContainer.ts Outdated Show resolved Hide resolved
packages/common/src/config/ModuleContainer.ts Outdated Show resolved Hide resolved
packages/common/src/types.ts Outdated Show resolved Hide resolved
packages/common/test/config/ModuleContainer.test.ts Outdated Show resolved Hide resolved
packages/module/src/runtime/Runtime.ts Outdated Show resolved Hide resolved
packages/module/src/runtime/Runtime.ts Outdated Show resolved Hide resolved
packages/common/src/types.ts Outdated Show resolved Hide resolved
packages/module/src/runtime/Runtime.ts Outdated Show resolved Hide resolved
@rpanic rpanic merged commit 2524c62 into develop Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants