-
Notifications
You must be signed in to change notification settings - Fork 285
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(core-interfaces): initial implementation #1924
feat(core-interfaces): initial implementation #1924
Conversation
feature: add the shared utility class 'Config'
…er' of core-interfaces
…ockchain interface. refactor: Use core-interface's Blockchain.Blockchain to provide type safety
refactor: Use P2P types around the modules.
… the way we instantiate objects when exporting them, it can cause issues when we import that module before starting up the container. So the constructor may try to resolve from a container which hasn't been setup yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All *Impl
should keep their original names and extend interfaces that are prefixed with I
instead.
packages/core-interfaces/src/core-transaction-pool/transaction-pool.ts
Outdated
Show resolved
Hide resolved
fix: shared.Config class having buggy 'init' method
…d the concrete implementation.
@faustbrian I would like to move the
And after consolidation out of blockchain.ts and into IContainer & Container respectively, also add a |
A future refactor of the Right now the container is basically the application object and knows about things it shouldn't be concerned with like what config/network we are going to use, our application version and if the application is shutting down or not. Those kinda information should be stored in a |
Agreed, that's a better design |
@paroxysm can you retrigger a build on CircleCI, it failed because of some node-gyp build error. |
That node-gyp brittleness is annoying. I wonder if there's a permanent solution for it, I've never seen it locally(probably because I'm not starting with a clean-slate everytime), it seems to be a compilation issue with that library.... |
Proposed changes
Resolves #1783
The gist of this PR is captured in the discussion I had with @faustbrian in the issue above.
The core modules innately have deps on each other, so packaging and exporting the types for each module cannot work because we'll introduce circular deps. The same issue arises if you create separate types packages for each module, those types packages will end up referencing each other, creating yet another circular dependency.
So I've created an interfaces package, you can define interfaces that can ref other interfaces and vice-versa, but since they live in one package, you don't run into a circular dependency issue.
So far, I've created/implemented interfaces for core-container, core-blockchain, core-logger, core-event-emitter, core-p2p, core-transaction-pool.
I've avoid core-database because there's some consolidation that needs to happen between core-database and core-database-postgres.
The stipulation with this new package is that, only interfaces of core modules and only interfaces/classes that are referenced across modules are added. If an interface/class doesn't have to be visible outside its module to be used, then it doesn't get added. This prevents bloating up of the core-interfaces module
Types of changes
Checklist