-
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
Breaking Changes moving towards 3.0 #2441
Comments
Kernel
All of those packages at the moment are split up even though they are required to be always available and used by pretty much every plugin. Combining all of those will remove the need to maintain different packages, reduce complexity and architectural issues that currently exist during the application start up. This also means that interfaces are always available to every package without having to require an additional package which is pretty much always required together with
|
ContainerWhen Core 2.0 was initially developed there was no container because it was started as a simple rewrite without any plans on expanding or altering how the system itself worked and interfaced with developers. A few months into development I decided that Core was becoming too big and had to be split up into smaller parts that can be easier maintained, tested and replaced. Without much of a surprise this resulted in some structural and implementation issues when a larger application receives such a big changed over half-way into development as it has to be done fast. The result of the pace at which it had to be completed is an implementation that has few services that have a lot of responsibilities they shouldn't have and knowledge about things outside of their responsibility they also shouldn't know about. For example the container knows how to load configuration, setup the environment and load plugins while a container should only be concerned with setting and getting values based on keys and values it is provided. In 3.0 there will be 2 different classes that take on those tasks. ApplicationThe application class will be what all plugins interact with and extends the It's purpose is to provide easy access to all relevant application information like configuration, paths, environment and state without leaking any of the underlying functions like the current "container" class does.
ContainerThe new container is only responsible for setting and getting based on keys and values. Those bindings can be either singletons which means they only get created once and we receive the same instance or value every time we request it by its key or just a simple binding of which we get a fresh instance every time. The container no longer has any special treatment for plugins, instead there now are
|
ContractsContracts will be what
|
ServicesAs previously mentioned the container and with it the plugin system were late additions to core and not something that was included from the beginning which resulted in some issues with how plugins were implemented. Plugins right now are a simple object that exports some information and has a register and deregister method for when the application starts or stops. The issue with this is that plugins have to perform all their registrations in a specific order to get full access to everything that other plugins expose. This can't be avoided 100% as plugins have dependencies on each other but more information can be made accessible earlier in the application life cycle and this is where the new service providers come in. Service providers will be what is used for application bootstrapping. Your own plugins as well as all core services are bootstrapped via service providers which provide The The The
|
ConfigurationWith the new container it will become a lot easier to load and alter configuration at runtime which also means we will finally provide configuration hot-reloading which means every time you edit one of your configuration files they will be read and rebound to the container which will trigger certain plugins to reload without having to restart the whole process. BootstrapWhen the application is starting and running all bootstrappers it will load the configuration either via the local or remote adapter, depending on if the user specified a remote host for configuration retrieval.
Local AdapterThe local adapter will load configuration from a local configuration file like it has been done like the release of Core 2.0.
Remote AdapterThe remote adapter will load configuration via a remote host the user specified and create a local configuration based on that to allow next starts to work without having to specify a remote host. This will provide an easy way of setting up a new node with the same configuration as your other nodes without the need of manually copying files.
Hot ReloadingHot Reloading will watch all relevant configuration files for changes and any occur it will trigger either a full reboot or fire an event so plugins can reload.
|
ValidationTBD |
Error HandlingTBD |
LoggingA logger is always required to be available but at the moment The majority of users will never replace the default logger and if it needs to be replaced it can be replaced by doing
|
CacheIn Core 2.0 various packages have their own implementation of a cache which means implementations might vary between packages instead of being able to rely on a single common interface to know how every cache works. To resolve this issue a new class is introduced which is called
|
EventsWhen an event emitter was initially added to Core 2.0 it was late in development like the container which resulted in similar issues. At first it used https://github.com/primus/eventemitter3 for its performance but those gains weren't as big with node.js anymore and thus it moved to using the native event emitter that comes with node.js. The issue with both of them is that they don't have proper support for The advantage of this emitter is that we can Naming ConventionsAt the moment there is a lack of internal events which would solve a few architectural issues and events don't have any naming conventions other than being prefixed with the resource type like block, transaction or wallet. To solve both of those issues there will be internal, state and action events.
All of those changes will allow plugins to listen for more granular events and get access to more data without having to hook into specific plugins, simply listen and process the incoming data.
|
Package DevelopmentThe development of packages and plugins for Core will mostly remain the same with a few breaking changes that require minimal changes unless you rely on deep burrowed internals. The biggest change is the way your plugin is registered and exposed within the application through service providers that are run when the application is bootstrapped. Old New As you can see in the above example the service provider extends an abstract service provider that is imported from The main change here is the structure, moving from a simple object to a class that allows a cleaner implementation and gets access to additional functionality through the abstract it extends. A new feature that was implemented is to allow the definition of dependencies. For example you could specify that you require the |
TestingAs previously mentioned the container and event emitter were late additions to Core which resulted in several architectural and implementation issues. The result of those issues is that testing can be quite cumbersome unless you have a good understanding of the container and it's internals. Over time several helpers like transactions factories, custom jest matchers, server mocks, etc. have been created but they are too far spread out between directories to be immediately visible to a developer and often aren't self-explanatory. Ideally at some point there will be a small framework that is build around core internals to allow easy modification of the application state and internals to produce testing scenarios with as little instructions needed as possible and removing the need of having to run a full node during tests.
|
HelpersCore has various packages that contain utilities and helpers which are required by the majority of packages but are spread out too much. All of them will be combined into a A few helpers might be removed or replaced with alternatives from https://github.com/ArkEcosystem/utils. Another goal of moving them into |
Closing as more detailed information is coming. |
This issue will be updated as more breaking changes reveal on the way to 3.0.
Core 2.0 has been a rewrite of ark-node which meant we had to support a lot of legacy functionality which will be gradually removed.
As we move towards 3.0 more breaking changes will occur as we remove those legacy parts and 2.4, 2.5 and 2.6 will contain the majority of those breaking changes with 3.0 introducing breaking changes to the container and plugin system.
2.3
wallets
table from the database as core only relies on in-memory datasqlite3
withlowdb
as storage incore-webhooks
core-logger-winston
withcore-logger-pino
due to performanceeventemitter3
has been replaced with the native node.js event emitter2.4
@arkecosystem/crypto
package in preparation of AIP11/18/29. This means certain imports change and possibly method signatures.2.5
core-api
. This includes the removal of certain methods from repositories incore-database
andcore-database-postgres
.2.6
@arkecosystem/crypto
package when the implementation of AIP11/18/29 is finalised.3.0
core-container
and the plugin system as those have quite a few flaws because they weren't part of core from the start which resulted in a wonky implementation for certain things.The text was updated successfully, but these errors were encountered: