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

feat: add a CLI flag for secondary nodes #4029

Merged
merged 5 commits into from
Aug 31, 2023

Conversation

alessandromazza98
Copy link
Contributor

@alessandromazza98 alessandromazza98 commented Aug 2, 2023

Closes #3924

This PR is an attempt to solve that issue.

It solves it in a fixed way by:

  • adding a secondary flag in the Cli.
  • adding a secondary flag also in the node command.
  • when it is enabled, discovery_port, listener_port, auth_rpc, auth_port, http_port, ws_port are changed to a different and fixed number.

Let me know what do you think.

The other option I have is to make it dynamic so that the software makes a scan on the already used ports and chooses different ones.

I am not sure how to do it in that dynamic way right now but I can try if it's something you want to have.

@alessandromazza98 alessandromazza98 marked this pull request as ready for review August 2, 2023 08:23
@codecov
Copy link

codecov bot commented Aug 2, 2023

Codecov Report

Merging #4029 (168082f) into main (3d9e968) will increase coverage by 0.00%.
The diff coverage is 75.51%.

Impacted file tree graph

Files Changed Coverage Δ
bin/reth/src/cli/mod.rs 71.42% <50.00%> (-0.37%) ⬇️
bin/reth/src/node/mod.rs 26.09% <76.59%> (+3.81%) ⬆️

... and 8 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.71% <0.00%> (-0.01%) ⬇️
unit-tests 63.73% <75.51%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 29.63% <75.51%> (+0.42%) ⬆️
blockchain tree 83.52% <ø> (ø)
pipeline 90.25% <ø> (ø)
storage (db) 74.81% <ø> (ø)
trie 94.88% <ø> (ø)
txpool 48.11% <ø> (ø)
networking 77.46% <ø> (-0.05%) ⬇️
rpc 57.58% <ø> (+0.02%) ⬆️
consensus 63.42% <ø> (ø)
revm 31.74% <ø> (ø)
payload builder 6.37% <ø> (ø)
primitives 86.17% <ø> (-0.02%) ⬇️

@alessandromazza98
Copy link
Contributor Author

Don't know why those checks did not pass. I didn't change the parts of code where the clippy gives errors.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

some nits,

needs rebase to get rid of clippy errors.

pending @onbjerg for approval/directions

bin/reth/src/node/mod.rs Outdated Show resolved Hide resolved
bin/reth/src/node/mod.rs Outdated Show resolved Hide resolved
@mattsse mattsse added M-changelog This change should be included in the changelog A-cli Related to the reth CLI labels Aug 3, 2023
@alessandromazza98
Copy link
Contributor Author

alessandromazza98 commented Aug 4, 2023

In the meanwhile I rebased, fixed a little error, add test and a better doc comment.

bin/reth/src/cli/mod.rs Outdated Show resolved Hide resolved
@onbjerg onbjerg changed the title add a CLI flag for secondary nodes feat: add a CLI flag for secondary nodes Aug 9, 2023
@alessandromazza98
Copy link
Contributor Author

alessandromazza98 commented Aug 10, 2023

I changed the --secondary flag to a --instance flag.

This way you can start a flexible number of nodes on the same computer and port numbers do not conflict with each other.

I choose a personal approach on selecting port numbers based on instance number. Let me know WDYT.

Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

this looks good, some small nits left, thank you for the patience so far!

bin/reth/src/node/mod.rs Outdated Show resolved Hide resolved
bin/reth/src/node/mod.rs Outdated Show resolved Hide resolved
bin/reth/src/cli/mod.rs Show resolved Hide resolved
@alessandromazza98
Copy link
Contributor Author

this looks good, some small nits left, thank you for the patience so far!

No problems, I'm happy to help. I fixed them.

For the max value of instances I choose 200 just to have a "good" whole number. Actual max value is 218 (following my adjustments of port numbers) but I thought 200 was a better number to have.

Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

lgtm

@mattsse mattsse enabled auto-merge August 31, 2023 01:46
@mattsse mattsse added this pull request to the merge queue Aug 31, 2023
Merged via the queue into paradigmxyz:main with commit cd71f68 Aug 31, 2023
23 checks passed
shekhirin pushed a commit that referenced this pull request Aug 31, 2023
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
@alessandromazza98 alessandromazza98 deleted the issue3924 branch September 11, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Related to the reth CLI M-changelog This change should be included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI flag for secondary nodes
3 participants