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 with_unused_ports method to rpc and network args #6109

Merged
merged 5 commits into from
Jan 18, 2024

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Jan 17, 2024

ref #6107 (comment)

Adds methods on network, discovery, and rpc args for setting ports to zero. This means they will be set to an unused port when bound. This is useful in tests, when many nodes are being spun up at the same time.

@Rjected Rjected added C-enhancement New feature or request C-test A change that impacts how or what we test A-cli Related to the reth CLI labels Jan 17, 2024
@Rjected Rjected requested a review from onbjerg as a code owner January 17, 2024 21:49
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.

pedantic style nit

Comment on lines 128 to 134
pub fn with_unused_p2p_port(&mut self) {
self.port = 0;
}

/// Sets the p2p and discovery ports to zero, allowing the OD to assign a random unused port
/// when network components bind to sockets.
pub fn with_unused_ports(&mut self) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want &mut here or self?

we can have two functions if convenient, though the &mut self should also return &mut Self

Copy link
Member Author

Choose a reason for hiding this comment

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

changed to mut self -> Self

@Rjected Rjected added this pull request to the merge queue Jan 18, 2024
Merged via the queue into main with commit 9300e53 Jan 18, 2024
27 checks passed
@Rjected Rjected deleted the dan/zero-ports branch January 18, 2024 20:36
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 C-enhancement New feature or request C-test A change that impacts how or what we test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants