Skip to content

Remove Unnecessary Retry from Network testutil#122

Merged
TxCorpi0x merged 2 commits into
masterfrom
mehid/remove-unnecessary-retry-network
Apr 10, 2026
Merged

Remove Unnecessary Retry from Network testutil#122
TxCorpi0x merged 2 commits into
masterfrom
mehid/remove-unnecessary-retry-network

Conversation

@TxCorpi0x

@TxCorpi0x TxCorpi0x commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request simplifies the testutil/network/network.go file by removing retry logic and related dependencies when creating a new test network. The code now directly creates the network without attempting to handle "address already in use" errors, reflecting a move toward simpler and more deterministic test setup.

What cosmos SDK v0.52+ actually did (and v0.53.x has):
In init(), the SDK now pre-allocates a portPool of 200 free TCP ports by calling FreeTCPAddr() for each (bind → get port → release), then uses those ports when creating test validators. This eliminates the race condition entirely — the workaround is no longer needed.

Dependency cleanup:

  • Removed unused imports: context, strings, and github.com/tokenize-x/tx-tools/pkg/retry. [1] [2]

Test setup simplification:

  • Replaced the retry-based network creation logic in New with a direct call to network.New, eliminating the workaround for port conflicts.

Reviewers checklist:

  • Try to write more meaningful comments with clear actions to be taken.
  • Nit-picking should be unblocking. Focus on core issues.

Authors checklist

  • Provide a concise and meaningful description
  • Review the code yourself first, before making the PR.
  • Annotate your PR in places that require explanation.
  • Think and try to split the PR to smaller PR if it is big.

This change is Reviewable

@TxCorpi0x TxCorpi0x requested a review from a team as a code owner April 9, 2026 08:20
@TxCorpi0x TxCorpi0x requested review from masihyeganeh, metalarm10, miladz68 and ysv and removed request for a team April 9, 2026 08:20
@TxCorpi0x TxCorpi0x merged commit 123bd68 into master Apr 10, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants