diff --git a/book/src/framework/components/blockchains/ton.md b/book/src/framework/components/blockchains/ton.md index b8f1205b7..a861b1146 100644 --- a/book/src/framework/components/blockchains/ton.md +++ b/book/src/framework/components/blockchains/ton.md @@ -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 . + ## Default Ports The TON implementation exposes essential services: @@ -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 diff --git a/framework/.changeset/v0.10.4.md b/framework/.changeset/v0.10.4.md new file mode 100644 index 000000000..807106b4a --- /dev/null +++ b/framework/.changeset/v0.10.4.md @@ -0,0 +1 @@ +- TON blockchain support to enable TVM version configuration and adds custom environment variable support \ No newline at end of file diff --git a/framework/components/blockchain/blockchain.go b/framework/components/blockchain/blockchain.go index acfd8694b..0b18cde09 100644 --- a/framework/components/blockchain/blockchain.go +++ b/framework/components/blockchain/blockchain.go @@ -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 diff --git a/framework/components/blockchain/ton.go b/framework/components/blockchain/ton.go index e1db1b5db..59c30d632 100644 --- a/framework/components/blockchain/ton.go +++ b/framework/components/blockchain/ton.go @@ -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, @@ -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), diff --git a/framework/examples/myproject/smoke_ton.toml b/framework/examples/myproject/smoke_ton.toml index 5e6e990a5..88a108d8d 100644 --- a/framework/examples/myproject/smoke_ton.toml +++ b/framework/examples/myproject/smoke_ton.toml @@ -2,4 +2,6 @@ type = "ton" image = "ghcr.io/neodix42/mylocalton-docker:latest" port = "8000" - \ No newline at end of file + + [blockchain_a.custom_env] + VERSION_CAPABILITIES = "11"