Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions framework/.changeset/v0.12.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- TON network local fixes
22 changes: 6 additions & 16 deletions framework/components/blockchain/ton.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/docker/docker/api/types/container"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/network"
"github.com/testcontainers/testcontainers-go/wait"

"github.com/smartcontractkit/chainlink-testing-framework/framework"
Expand All @@ -21,7 +20,6 @@ const (
DefaultTonHlWalletMnemonic = "twenty unfair stay entry during please water april fabric morning length lumber style tomorrow melody similar forum width ride render void rather custom coin"
// internals
defaultTonHTTPServerPort = "8000"
defaultLiteServerPort = "40000"
defaultLiteServerPublicKey = "E7XwFSQzNkcRepUC23J2nRpASXpnsEKmyyHYV4u/FZY="
liteServerPortOffset = 100 // arbitrary offset for lite server port
)
Expand Down Expand Up @@ -53,22 +51,13 @@ func newTon(ctx context.Context, in *Input) (*Output, error) {
LiteServer: strconv.Itoa(base + liteServerPortOffset),
}

network, err := network.New(ctx,
network.WithAttachable(),
network.WithLabels(framework.DefaultTCLabels()),
)
if err != nil {
return nil, err
}
networkName := network.Name

baseEnv := map[string]string{
"GENESIS": "true",
"NAME": "genesis",

"EMBEDDED_FILE_HTTP_SERVER": "true",
"EMBEDDED_FILE_HTTP_SERVER_PORT": defaultTonHTTPServerPort,
"LITE_PORT": defaultLiteServerPort,
"EMBEDDED_FILE_HTTP_SERVER_PORT": ports.HTTPServer,
"LITE_PORT": ports.LiteServer,

"CUSTOM_PARAMETERS": "--state-ttl 315360000 --archive-ttl 315360000",
}
Expand All @@ -80,14 +69,15 @@ func newTon(ctx context.Context, in *Input) (*Output, error) {
finalEnv[key] = value
}
}
networkName := framework.DefaultNetworkName

req := testcontainers.ContainerRequest{
Image: in.Image,
AlwaysPullImage: in.PullImage,
Name: framework.DefaultTCName("ton-genesis"),
ExposedPorts: []string{
fmt.Sprintf("%s:%s/tcp", ports.HTTPServer, defaultTonHTTPServerPort),
fmt.Sprintf("%s:%s/tcp", ports.LiteServer, defaultLiteServerPort),
fmt.Sprintf("%s:%s/tcp", ports.HTTPServer, ports.HTTPServer),
fmt.Sprintf("%s:%s/tcp", ports.LiteServer, ports.LiteServer),
Comment on lines +79 to +80
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.
"40003/udp",
"40002/tcp",
"40001/udp",
Expand All @@ -98,7 +88,7 @@ func newTon(ctx context.Context, in *Input) (*Output, error) {
Env: finalEnv,
WaitingFor: wait.ForExec([]string{
"/usr/local/bin/lite-client",
"-a", fmt.Sprintf("127.0.0.1:%s", defaultLiteServerPort),
"-a", fmt.Sprintf("127.0.0.1:%s", ports.LiteServer),
"-b", defaultLiteServerPublicKey,
"-t", "3", "-c", "last",
}).WithStartupTimeout(2 * time.Minute),
Expand Down
Loading