Skip to content

Refactor/modules implementation#469

Open
stanlou wants to merge 5 commits intodevelopfrom
refactor/modules-implementation
Open

Refactor/modules implementation#469
stanlou wants to merge 5 commits intodevelopfrom
refactor/modules-implementation

Conversation

@stanlou
Copy link
Collaborator

@stanlou stanlou commented Mar 23, 2026

closes #458

@stanlou stanlou requested a review from rpanic March 23, 2026 05:20
@stanlou stanlou marked this pull request as ready for review March 23, 2026 10:53
@sequencerModule()
@closeable()
@dependencyFactory()
export class InMemorySequencerCoreModule extends SequencerModule<InMemorySequencerCoreConfig> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change this naming, bcs this has nothing to do with InMemory itself.

/**
* Returns an object containing the keys listed in ownConfigKeys.
*/
public get ownConfig(): OwnConfig {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I think this is good, a few notes:
Let's replace the ownConfigKeys mechanism by maing the OwnConfig type transform to { ownConfig: OwnConfig } when passing it to ConfigurableModule (in the intersection type CombinedModuleContainerConfig) and then just accessing this.config.ownConfig

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also let's rename ownConfig to containerConfig maybe? Or is that too misleading?

await this.startServer();
}

// Server logic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought - instead of flattening the Graphql implementation into here. Could we not just make this class a dependencyfactory creating the GraphqlServer? This way users could override it by passing a GraphqlServer module if they don't want to use Koa for some reason


public async start(): Promise<void> {
this.sequencerStartupModule.config = this.config.SequencerStartupModule;
this.blockProducerModule.config = this.config.BlockProducerModule;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works? I would've assumed that we should do this in create()...


public static dependencies(): InMemorySequencerCoreDependencies {
return {
sequencerStartupModule: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with the lowercase here? We normally do Uppercase for these in the codebase

}

public async close(): Promise<void> {
await this.sequencerStartupModule.close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doubt that you need to do that - modulecontainer should pick up that sequencerStartupModule is Closeable and automatically call close() on it

@@ -14,7 +13,7 @@ export type DatabasePruneConfig = {

@sequencerModule()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this annotation + Sequencermodule Superclass

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.

Simplify a bunch of user-facing modules

2 participants