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
18 changes: 18 additions & 0 deletions book/src/framework/components/blockchains/ton.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ TON (The Open Network) support in the framework utilizes MyLocalTon Docker envir
port = "8000"
```

## Genesis Container Parameters

The genesis container supports additional environment variables that can be configured through the `custom_env` field. These parameters allow you to customize the blockchain behavior:

```toml
[blockchain_a]
type = "ton"
image = "ghcr.io/neodix42/mylocalton-docker:latest"
port = "8000"

[blockchain_a.custom_env]
VERSION_CAPABILITIES = "11"
```

The custom_env parameters will override the default genesis container environment variables, allowing you to customize blockchain configuration as needed.
More info on parameters can be found here <https://github.com/neodix42/mylocalton-docker/wiki/Genesis-setup-parameters>.

## Default Ports

The TON implementation exposes essential services:
Expand All @@ -20,6 +37,7 @@ The TON implementation exposes essential services:

> Note: `tonutils-go` library is used for TON blockchain interactions, which requires a TON Lite Server connection. `tonutils-go` queries config file to determine the Lite Server connection details, which are provided by the MyLocalTon Docker environment.


## Usage

```go
Expand Down
1 change: 1 addition & 0 deletions framework/.changeset/v0.10.4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- TON blockchain support to enable TVM version configuration and adds custom environment variable support
2 changes: 2 additions & 0 deletions framework/components/blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ type Input struct {

// Optional params
ImagePlatform *string `toml:"image_platform"`
// Custom environment variables for the container
CustomEnv map[string]string `toml:"custom_env"`
}

// Output is a blockchain network output, ChainID and one or more nodes that forms the network
Expand Down
24 changes: 18 additions & 6 deletions framework/components/blockchain/ton.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ func newTon(in *Input) (*Output, error) {
return nil, err
}
networkName := network.Name

baseEnv := map[string]string{
"GENESIS": "true",
"NAME": "genesis",
"LITE_PORT": ports.LiteServer,
"CUSTOM_PARAMETERS": "--state-ttl 315360000 --archive-ttl 315360000",
"VERSION_CAPABILITIES": "11",
}

// merge with additional environment variables from input
finalEnv := baseEnv
if in.CustomEnv != nil {
for key, value := range in.CustomEnv {
finalEnv[key] = value
}
}

req := testcontainers.ContainerRequest{
Image: in.Image,
AlwaysPullImage: in.PullImage,
Expand All @@ -77,12 +94,7 @@ func newTon(in *Input) (*Output, error) {
Networks: []string{networkName},
NetworkAliases: map[string][]string{networkName: {"genesis"}},
Labels: framework.DefaultTCLabels(),
Env: map[string]string{
"GENESIS": "true",
"NAME": "genesis",
"LITE_PORT": ports.LiteServer, // Note: exposed config file follows this env
"CUSTOM_PARAMETERS": "--state-ttl 315360000 --archive-ttl 315360000",
},
Env: finalEnv,
WaitingFor: wait.ForExec([]string{
"/usr/local/bin/lite-client",
"-a", fmt.Sprintf("127.0.0.1:%s", ports.LiteServer),
Expand Down
4 changes: 3 additions & 1 deletion framework/examples/myproject/smoke_ton.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
type = "ton"
image = "ghcr.io/neodix42/mylocalton-docker:latest"
port = "8000"


[blockchain_a.custom_env]
VERSION_CAPABILITIES = "11"
Loading