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

refactor!(params): Moving params to nodebuilder and adding config #1168

Merged
merged 3 commits into from
Oct 24, 2022

Conversation

distractedm1nd
Copy link
Member

Closes #1076

Reviewers: Please test for yourself to verify it still works.

@Wondertan what do you think of this approach?

In the style of #1161

Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

Generally, I like the idea of making params as a module or a part of a module What if we go one step further and make it part of the node module? node.Network, node.Bootstrapper, etc. I don't think network deserves its own module, just for 3 types there, but could be a coherent addition to the node module.

nodebuilder/network/config.go Outdated Show resolved Hide resolved
Copy link
Member

@renaynay renaynay left a comment

Choose a reason for hiding this comment

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

I'm not sure that i like params living inside nodebuilder/node

I think of node as administrative -- would you be opposed to a nodebuilder/netparams package instead?

@renaynay
Copy link
Member

These params could honestly even live inside of p2p module bc they are related to p2p.

@distractedm1nd
Copy link
Member Author

I wouldnt be opposed to that, I originally had them in their own package - @Wondertan what do you think?

nodebuilder/node/flags.go Outdated Show resolved Hide resolved
@Wondertan
Copy link
Member

Wondertan commented Sep 30, 2022

I agree that p2p is fine also, so let's do this. This might also require changes in the flag names

@distractedm1nd
Copy link
Member Author

Some issues came up during rebasing, fixing

Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

Requesting changes because the solution for #1189 in this PR does not fix the core problem of #1189: our libs/pkgs should not import node and its modules, as it is a logical cyclic dependency(node depends on header and wise-versa) and prevents usage of header pkg without importing the node.

The alternative is passing the network name as a protocol prefix string which is better be optional. Our protocols will be used in other projects. Specifically, the header pkg and there is already ongoing work in https://github.com/celestiaorg/go-header

Let's revert the change and solve the #1189 issue in the subsequent PR, as it is out of scope. It's fine that the main will be broken for some time for Mamaki.

Wondertan
Wondertan previously approved these changes Oct 7, 2022
Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

Awesome

@Wondertan
Copy link
Member

@distractedm1nd, conflicts

@distractedm1nd
Copy link
Member Author

i literally rebased this morning 🥲

Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

Just a note that this PR breaks support connection to the non-default networks. Perhaps, we should not merge it for the soonish upcoming release, so we have enough time to fix the issue correctly right after merging it

@renaynay
Copy link
Member

Requesting changes because the solution for #1189 in this PR does not fix the core problem of #1189: our libs/pkgs should not import node and its modules, as it is a logical cyclic dependency(node depends on header and wise-versa) and prevents usage of header pkg without importing the node.

The alternative is passing the network name as a protocol prefix string which is better be optional. Our protocols will be used in other projects. Specifically, the header pkg and there is already ongoing work in https://github.com/celestiaorg/go-header

Let's revert the change and solve the #1189 issue in the subsequent PR, as it is out of scope. It's fine that the main will be broken for some time for Mamaki.

@Wondertan as long as celestia-node requires header-ex and fraud-ex to contain appended chainIDs, I'm fine with this approach.

Copy link
Member

@renaynay renaynay left a comment

Choose a reason for hiding this comment

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

Two things to note for clarity (which have already been noted but good to repeat for doc reasons):

  1. This PR is breaking for all networks besides arabica -- if you try to run with --p2p.network mamaki, it will not run against mamaki unless mamaki bootstrappers are upgraded, in which case, they can run but they'll be running on the same header-ex protocol ID as arabica which is potentially wonky (in the case that a mamaki node accidentally sets an arabica bootstrapper or something, it could try to sync blocks from arabica node).

We need to get a follow-up PR addressing #1189 preferably soon after this is merged (or at least get a PR based on this one out already so we can merge one after the other).

  1. This PR will break CLI as well: node.network --> p2p.network.

nodebuilder/p2p/flags.go Outdated Show resolved Hide resolved
nodebuilder/p2p/flags.go Outdated Show resolved Hide resolved
cmd/flags_node.go Outdated Show resolved Hide resolved
nodebuilder/p2p/flags.go Outdated Show resolved Hide resolved
nodebuilder/p2p/flags.go Outdated Show resolved Hide resolved
nodebuilder/p2p/flags.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #1168 (046c992) into main (d239616) will increase coverage by 0.27%.
The diff coverage is 49.01%.

@@            Coverage Diff             @@
##             main    #1168      +/-   ##
==========================================
+ Coverage   55.86%   56.14%   +0.27%     
==========================================
  Files         160      160              
  Lines        9725     9932     +207     
==========================================
+ Hits         5433     5576     +143     
- Misses       3756     3802      +46     
- Partials      536      554      +18     
Impacted Files Coverage Δ
cmd/celestia/full.go 36.76% <0.00%> (-3.56%) ⬇️
cmd/celestia/light.go 36.23% <0.00%> (-3.46%) ⬇️
cmd/start.go 29.26% <0.00%> (ø)
fraud/service.go 75.00% <ø> (ø)
header/p2p/exchange.go 68.38% <ø> (ø)
nodebuilder/init.go 63.51% <0.00%> (ø)
nodebuilder/p2p/bitswap.go 87.50% <ø> (ø)
nodebuilder/p2p/bootstrap.go 30.76% <ø> (ø)
nodebuilder/p2p/genesis.go 33.33% <ø> (ø)
nodebuilder/p2p/host.go 80.64% <ø> (ø)
... and 24 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Wondertan
Wondertan previously approved these changes Oct 21, 2022
Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

Looking through this again. I love the idea so far. Making Bootstrappers/Network/... a module- and application-specific types(independent from our pkgs/libs) fits very well with the modularity vision. Thanks, @distractedm1nd!

Q: Should we keep the main broken for network switching, or should we implement a fix on top of this PR first and then merge everything together? The second approach seems better in case some other bug appears or so.

nodebuilder/p2p/flags.go Outdated Show resolved Hide resolved
nodebuilder/header/config.go Show resolved Hide resolved
nodebuilder/p2p/flags.go Outdated Show resolved Hide resolved
@distractedm1nd distractedm1nd merged commit 4667f42 into celestiaorg:main Oct 24, 2022
@renaynay renaynay changed the title refactor(params): Moving params to nodebuilder and adding config refactor!(params): Moving params to nodebuilder and adding config Oct 31, 2022
@renaynay renaynay added kind:break! Attached to breaking PRs and removed kind:improvement labels Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:node Node kind:break! Attached to breaking PRs
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

fix(cmd/params): Repair encapsulation for network params
5 participants