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

node: consider usage of new FX feature #923

Closed
Tracked by #944
Wondertan opened this issue Jul 20, 2022 · 2 comments
Closed
Tracked by #944

node: consider usage of new FX feature #923

Wondertan opened this issue Jul 20, 2022 · 2 comments
Labels

Comments

@Wondertan
Copy link
Member

FX has almost delivered a new feature uber-go/fx#895, that I think would improve our DI-related code. Essentially, it would allow us to provide dependencies with lifecycles in one line. Currently, we have to create a so-called DI constructor, which is an intermediate constructor with the only purpose of adding lifecycle hooks. With that feature, we will be able to obsolete this intermediate constructor pattern and set lifecycle hooks together with the actual Provide.

@Wondertan Wondertan added the area:node Node label Jul 20, 2022
@Wondertan
Copy link
Member Author

@renaynay, this can be done together with planned refactorings on the node

@renaynay renaynay mentioned this issue Jul 26, 2022
30 tasks
@Bidon15 Bidon15 moved this to TODO in Celestia Node Jul 26, 2022
renaynay added a commit to renaynay/celestia-node that referenced this issue Aug 21, 2022
renaynay added a commit to renaynay/celestia-node that referenced this issue Aug 21, 2022
@renaynay renaynay moved this from TODO to In Review in Celestia Node Sep 6, 2022
renaynay added a commit to renaynay/celestia-node that referenced this issue Sep 14, 2022
distractedm1nd pushed a commit to renaynay/celestia-node that referenced this issue Sep 19, 2022
distractedm1nd pushed a commit to renaynay/celestia-node that referenced this issue Sep 19, 2022
distractedm1nd pushed a commit to renaynay/celestia-node that referenced this issue Sep 19, 2022
distractedm1nd pushed a commit to renaynay/celestia-node that referenced this issue Sep 19, 2022
renaynay added a commit that referenced this issue Sep 23, 2022
…modules (#997)

* refactor: implement better node pkg structuring for node/state pkg

* refactor: rename node/config pkg to node/node

* refactor(node/state): Use fx annotation from #923

* refactor(node/state): use constructor from state pkg directly

* fix: review suggestions

* refactor(node): state module improvements and PR review in the form of a PR (#90)

* refactor(node): state module improvements

* Move settings, opts and config out of `node/node` back to `node`
* `state` pkg module improvements
	* Absorb Config and options from `node/key` pkg
	* Don't use core.Config on Module constructor and take from the DI instead
	* Use node Type and Config  on Module constructor
* first steps towarads `core` pkg modulazation

* chore(swamp): fix linter by shortening import alias

* refactor: moving header to subpackage

* refactor: moving share components to share subpackage

* chore: basic linting

* refactor/chore: renaming services and methods to satisfy linter

* refactor: moving node construction to node/module.go

* refactor: rpc and core subpackages

* refactor: building node in /node/module.go, rpc and core fixes for tests

* refactor: modularized daser and simplified node/module.go

* refactor: passing configs by ref to actually modify node.Config, moving p2p opts, removing config_opts, renaming files to match new scheme

* refactor(node): move some global node options to their respective node modules

* refactor: unexporting moduleOpts and fields

* refactor: variadic options for modules

* refactor: removing lifecycle hooks

* refactor: renaming node to nodebuilder

* refactor: implementing review comments

* fix: renaming test directories to nodebuilder

* refactor: config setters separated from options, writing config to env for persisting options during initialization

* refactor: minor review comments (cleaning clutter to get to the juicy stuff)

* refactor: exporting share.Discovery, providing it directly, removing Full and Light availability constructors in nodebuilder/share

* refactor: providing header service directly in module

* refactor: making InitStore invoke directly without returning a function, removing dead code

* fix: fixing issue where flags do not persist when init is called twice

Co-authored-by: renaynay <renaynay@users.noreply.github.com>

* chore: removing dead code

* refactor: deferring setting node config during flag parsing

* refactor: collapsing switch in DefaultConfig

* refactor: removing nodebuilder/daser/daser.go

* refactor: fx lifecycle in for core/remote

* chore: imports

* refactor: removing all setters, moving checks to construction

* refactor: adding cfg.ValidateBasic to each nodebuilder module

* refactor: moving core sanity checks to cfg.ValidateBasic and populating default conf

* fix: replacing IP on sanity check

* renaming to sanitizeIP

Co-authored-by @Wondertan
Co-authored-by: Ryan <ryanford@poluglottos.com>
Co-authored-by: renaynay <renaynay@users.noreply.github.com>

* Fix issues with config persistence / invoking validation on config (#95)

* fix config

* make sure to save config before starting node, otherwise all overrides are lost

* chore: lint

* refactor|test(nodebuilder/tests): update fraud tests to use new nodebuilder configuration functionality

* refactor(nodebuilder/header): adapt Fraud (with syncer) to refactoring changes

* refactor(nodebuilder/header): restore logic that syncer fails with Warn if no chain head

* fix(tests): fixing TestFraudProofSyncing

* fix(cmd): not persisting config with flags on start

* refactor(nodebuilder): consistent baseComponents, adding back daser proxy constructor, renaming Loader to ConfigLoader

* lint: fixing goimports after rebase

* refactor: implement better node pkg structuring for node/state pkg

* refactor: rename node/config pkg to node/node

* refactor(node/state): Use fx annotation from #923

* refactor(node/state): use constructor from state pkg directly

* fix: review suggestions

* refactor(node): state module improvements and PR review in the form of a PR (#90)

* refactor(node): state module improvements

* Move settings, opts and config out of `node/node` back to `node`
* `state` pkg module improvements
	* Absorb Config and options from `node/key` pkg
	* Don't use core.Config on Module constructor and take from the DI instead
	* Use node Type and Config  on Module constructor
* first steps towarads `core` pkg modulazation

* chore(swamp): fix linter by shortening import alias

* refactor: moving header to subpackage

* refactor: moving share components to share subpackage

* chore: basic linting

* refactor/chore: renaming services and methods to satisfy linter

* refactor: moving node construction to node/module.go

* refactor: rpc and core subpackages

* refactor: building node in /node/module.go, rpc and core fixes for tests

* refactor: modularized daser and simplified node/module.go

* refactor: passing configs by ref to actually modify node.Config, moving p2p opts, removing config_opts, renaming files to match new scheme

* refactor(node): move some global node options to their respective node modules

* refactor: unexporting moduleOpts and fields

* refactor: variadic options for modules

* refactor: removing lifecycle hooks

* refactor: renaming node to nodebuilder

* refactor: implementing review comments

* fix: renaming test directories to nodebuilder

* refactor: config setters separated from options, writing config to env for persisting options during initialization

* refactor: minor review comments (cleaning clutter to get to the juicy stuff)

* refactor: exporting share.Discovery, providing it directly, removing Full and Light availability constructors in nodebuilder/share

* refactor: providing header service directly in module

* refactor: making InitStore invoke directly without returning a function, removing dead code

* fix: fixing issue where flags do not persist when init is called twice

Co-authored-by: renaynay <renaynay@users.noreply.github.com>

* chore: removing dead code

* refactor: deferring setting node config during flag parsing

* refactor: collapsing switch in DefaultConfig

* refactor: removing nodebuilder/daser/daser.go

* refactor: fx lifecycle in for core/remote

* chore: imports

* refactor: removing all setters, moving checks to construction

* refactor: adding cfg.ValidateBasic to each nodebuilder module

* refactor: moving core sanity checks to cfg.ValidateBasic and populating default conf

* fix: replacing IP on sanity check

* renaming to sanitizeIP

Co-authored-by @Wondertan
Co-authored-by: Ryan <ryanford@poluglottos.com>
Co-authored-by: renaynay <renaynay@users.noreply.github.com>

* Fix issues with config persistence / invoking validation on config (#95)

* fix config

* make sure to save config before starting node, otherwise all overrides are lost

* chore: lint

* refactor|test(nodebuilder/tests): update fraud tests to use new nodebuilder configuration functionality

* refactor(nodebuilder/header): adapt Fraud (with syncer) to refactoring changes

* refactor(nodebuilder/header): restore logic that syncer fails with Warn if no chain head

* fix(tests): fixing TestFraudProofSyncing

* fix(cmd): not persisting config with flags on start

* refactor(nodebuilder): consistent baseComponents, adding back daser proxy constructor, renaming Loader to ConfigLoader

* lint: fixing goimports after rebase

* chore(docs): removing multiline todo from godoc comment for new gofmt compliance

* fix(test): Fixing rpc test from rebase

* refactor(nodebuilder/fraud): Move fraud-related constructors into separate module

* refactor(service/rpc): Wrap port parsing error

* refactor(nodebuilder|service): Wrap config error messages with pkg name

* refactor(nodebuilder): cfg.ValidateBasic -> cfg.Validate

* refactor(nodebuilder): Move refresh routing period check into config validation and fix err check in rpc/config

* refactor(das | nodebuilder/p2p): apply suggestions from @Wondertan approval review

* fix(cmd): replace logger in cmd after rebase/merge conflict issues

* refactor(cmd): set context with config at end of parsing, not in every individual flag parsing func

* refactor(cmd): simplify returns in flags_p2p

Co-authored-by: Ryan <ryanford@poluglottos.com>
Co-authored-by: Hlib Kanunnikov <hlibwondertan@gmail.com>
Co-authored-by: renaynay <renaynay@users.noreply.github.com>
@renaynay
Copy link
Member

Implemented along with #997

Repository owner moved this from In Review to Done in Celestia Node Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Archived in project
Development

No branches or pull requests

2 participants