Skip to content

Conversation

@tt-cll
Copy link
Contributor

@tt-cll tt-cll commented Dec 24, 2025

Nodes on a local docker network couldn't connect using the InternalHTTPUrl because the ton chain was on its own network and the server url being exposed was the host port and not the container port


Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.

Why

The changes streamline the TON blockchain component configuration process in the testing framework, removing unused network setup and directly utilizing port mappings. Also, they align environment variable usage with dynamic port assignments, enhancing the flexibility of TON node setups for testing purposes.

What

  • framework/components/blockchain/ton.go
    • Removed import statement for github.com/testcontainers/testcontainers-go/network, simplifying the setup by not explicitly creating a new network.
    • Removed defaultLiteServerPort constant as the lite server port is now dynamically assigned.
    • Removed network setup code block, indicating a simplified approach by leveraging the default network setup provided by the testing framework.
    • Updated baseEnv map to use ports.HTTPServer and ports.LiteServer for setting environment variables, allowing for dynamic port configuration based on input.
    • Set networkName directly to framework.DefaultNetworkName, removing the need for creating and naming a new network.
    • Updated the req struct for container setup:
      • Updated exposed ports configuration to use dynamic ports for HTTP and Lite servers.
      • Removed the network creation and assignment, simplifying the process by using default configurations.
      • Updated the WaitingFor configuration to use the dynamically assigned ports.LiteServer.
    • In the output struct, updated the ExternalHTTPUrl and InternalHTTPUrl to use the dynamically assigned lite server port, ensuring the URLs reflect the actual configuration of the test container.

Copilot AI review requested due to automatic review settings December 24, 2025 12:43
@tt-cll tt-cll requested a review from a team as a code owner December 24, 2025 12:43
@github-actions
Copy link

👋 tt-cll, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Docker networking issues for TON blockchain nodes running in local containers. Previously, nodes couldn't connect using InternalHTTPUrl because the TON chain was on its own isolated network, and the server URL exposed the host port instead of the container port.

Key changes:

  • Removed creation of isolated Docker network for TON containers
  • Changed port mapping to use container ports directly instead of mapping to different host ports
  • Updated environment variables to use dynamic port values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +79 to +80
fmt.Sprintf("%s:%s/tcp", ports.HTTPServer, ports.HTTPServer),
fmt.Sprintf("%s:%s/tcp", ports.LiteServer, ports.LiteServer),
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

Port mapping now uses the same port for both host and container (e.g., 'hostPort:containerPort' becomes 'port:port'). This may cause port conflicts if multiple TON instances run on the same host, as they would attempt to bind to the same host ports. Consider whether this is the intended behavior or if dynamic host port allocation would be more appropriate.

Suggested change
fmt.Sprintf("%s:%s/tcp", ports.HTTPServer, ports.HTTPServer),
fmt.Sprintf("%s:%s/tcp", ports.LiteServer, ports.LiteServer),
fmt.Sprintf("%s/tcp", ports.HTTPServer),
fmt.Sprintf("%s/tcp", ports.LiteServer),

Copilot uses AI. Check for mistakes.
skudasov
skudasov previously approved these changes Dec 29, 2025
@skudasov skudasov dismissed stale reviews from gustavogama-cll and themself via e1a9b5d December 29, 2025 12:45
@skudasov skudasov requested a review from Tofel December 29, 2025 12:46
@skudasov skudasov enabled auto-merge (squash) December 29, 2025 12:46
@skudasov skudasov merged commit 2dd54eb into main Dec 29, 2025
73 of 75 checks passed
@skudasov skudasov deleted the tt/tonlocal branch December 29, 2025 12:50
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.

3 participants