Skip to content

Commit 88888c2

Browse files
authored
Merge branch 'main' into aptos-e2e-tests
2 parents 680ae83 + eb9364d commit 88888c2

File tree

42 files changed

+1208
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1208
-333
lines changed

.github/workflows/framework-golden-tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ jobs:
4343
config: smoke_solana.toml
4444
count: 1
4545
timeout: 10m
46+
- name: TestTonSmoke
47+
config: smoke_ton.toml
48+
count: 1
49+
timeout: 10m
4650
- name: TestUpgrade
4751
config: upgrade.toml
4852
count: 1

book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
- [Sui](framework/components/blockchains/sui.md)
4747
- [TRON](framework/components/blockchains/tron.md)
4848
- [ZKSync](framework/components/blockchains/zksync.md)
49+
- [Ton](framework/components/blockchains/ton.md)
4950
- [Optimism Stack]()
5051
- [Arbitrum Stack]()
5152
- [Chainlink](framework/components/chainlink.md)

book/src/framework/components/blockchains/evm.md

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ We support 3 EVM clients at the moment: [Geth](https://geth.ethereum.org/docs/fu
1212
# Anvil command line params, ex.: docker_cmd_params = ['--block-time=1', '...']
1313
docker_cmd_params = []
1414
# Docker image and tag
15-
image = "f4hrenh9it/foundry:latest"
15+
image = "ghcr.io/foundry-rs/foundry:stable"
1616
# External port to expose (HTTP API)
1717
port = "8545"
1818
# External port to expose (WS API)
@@ -66,22 +66,36 @@ func TestDON(t *testing.T) {
6666

6767
## Test Private Keys
6868

69-
For `Geth` and `Anvil` we use the same key
69+
For `Geth` we use
7070
```
71-
Public: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
72-
Private: ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
71+
DefaultGethPrivateKey = `ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80`
72+
DefaultGethPublicKey = `0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266`
7373
```
7474

75-
For `Besu` keys are
75+
For `Anvil` we use
76+
```
77+
DefaultAnvilPrivateKey = `ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80`
78+
AnvilPrivateKey1 = `0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d`
79+
AnvilPrivateKey2 = `0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a`
80+
AnvilPrivateKey3 = `0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6`
81+
AnvilPrivateKey4 = `0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a`
82+
83+
DefaultAnvilPublicKey = `0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266`
84+
AnvilPublicKey1 = `0x70997970C51812dc3A010C7d01b50e0d17dc79C8`
85+
AnvilPublicKey2 = `0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC`
86+
AnvilPublicKey3 = `0x90F79bf6EB2c4f870365E785982E1f101E93b906`
87+
AnvilPublicKey4 = `0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65`
7688
```
77-
Public: 0xfe3b557e8fb62b89f4916b721be55ceb828dbd73
78-
Private: 0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63
79-
80-
Public: 0x627306090abaB3A6e1400e9345bC60c78a8BEf57
81-
Private: 0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3
8289

83-
Public: 0xf17f52151EbEF6C7334FAD080c5704D77216b732
84-
Private: 0xae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f
90+
For `Besu` keys are
91+
```
92+
DefaultBesuPrivateKey1 = "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63"
93+
DefaultBesuPrivateKey2 = "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3"
94+
DefaultBesuPrivateKey3 = "ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f"
95+
96+
DefaultBesuPublicKey1 = "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73"
97+
DefaultBesuPublicKey2 = "0x627306090abaB3A6e1400e9345bC60c78a8BEf57"
98+
DefaultBesuPublicKey3 = "0xf17f52151EbEF6C7334FAD080c5704D77216b732"
8599
```
86100

87101
More docs for `Besu` can be found [here](https://besu.hyperledger.org/private-networks/reference/accounts-for-testing)
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# TON Blockchain Client
2+
3+
TON (The Open Network) support in the framework utilizes MyLocalTon Docker Compose environment to provide a local TON blockchain for testing purposes.
4+
5+
## Configuration
6+
7+
```toml
8+
[blockchain_a]
9+
type = "ton"
10+
image = "ghcr.io/neodix42/mylocalton-docker:latest"
11+
```
12+
13+
## Default Ports
14+
15+
The TON implementation exposes several services:
16+
17+
- TON Lite Server: Port 40004
18+
- TON HTTP API: Port 8081
19+
- TON Simple HTTP Server: Port 8000
20+
- TON Explorer: Port 8080
21+
22+
> **Note**: By default, only the lite client service is exposed externally. Other services may need additional configuration to be accessible outside the Docker network.
23+
24+
## Validator Configuration
25+
26+
By default, the MyLocalTon environment starts with only one validator enabled. If multiple validators are needed (up to 6 are supported), the Docker Compose file must be provided with modified version with corresponding service definition in toml file before starting the environment.
27+
28+
## Usage
29+
30+
```go
31+
package examples
32+
33+
import (
34+
"strings"
35+
"testing"
36+
37+
"github.com/stretchr/testify/require"
38+
"github.com/xssnick/tonutils-go/liteclient"
39+
"github.com/xssnick/tonutils-go/ton"
40+
"github.com/xssnick/tonutils-go/ton/wallet"
41+
42+
"github.com/smartcontractkit/chainlink-testing-framework/framework"
43+
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
44+
)
45+
46+
type CfgTon struct {
47+
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"`
48+
}
49+
50+
func TestTonSmoke(t *testing.T) {
51+
in, err := framework.Load[CfgTon](t)
52+
require.NoError(t, err)
53+
54+
bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA)
55+
require.NoError(t, err)
56+
57+
var client ton.APIClientWrapped
58+
59+
t.Run("setup:connect", func(t *testing.T) {
60+
// Create a connection pool
61+
connectionPool := liteclient.NewConnectionPool()
62+
63+
// Get the network configuration from the global config URL
64+
cfg, cferr := liteclient.GetConfigFromUrl(t.Context(), fmt.Sprintf("http://%s/localhost.global.config.json", bc.Nodes[0].ExternalHTTPUrl))
65+
require.NoError(t, cferr, "Failed to get config from URL")
66+
67+
// Add connections from the config
68+
caerr := connectionPool.AddConnectionsFromConfig(t.Context(), cfg)
69+
require.NoError(t, caerr, "Failed to add connections from config")
70+
71+
// Create an API client with retry functionality
72+
client = ton.NewAPIClient(connectionPool).WithRetry()
73+
74+
t.Run("setup:faucet", func(t *testing.T) {
75+
// Create a wallet from the pre-funded high-load wallet seed
76+
rawHlWallet, err := wallet.FromSeed(client, strings.Fields(blockchain.DefaultTonHlWalletMnemonic), wallet.HighloadV2Verified)
77+
require.NoError(t, err, "failed to create highload wallet")
78+
79+
// Create a workchain -1 (masterchain) wallet
80+
mcFunderWallet, err := wallet.FromPrivateKeyWithOptions(client, rawHlWallet.PrivateKey(), wallet.HighloadV2Verified, wallet.WithWorkchain(-1))
81+
require.NoError(t, err, "failed to create highload wallet")
82+
83+
// Get subwallet with ID 42
84+
funder, err := mcFunderWallet.GetSubwallet(uint32(42))
85+
require.NoError(t, err, "failed to get highload subwallet")
86+
87+
// Verify the funder address matches the expected default
88+
require.Equal(t, funder.Address().StringRaw(), blockchain.DefaultTonHlWalletAddress, "funder address mismatch")
89+
90+
// Check the funder balance
91+
master, err := client.GetMasterchainInfo(t.Context())
92+
require.NoError(t, err, "failed to get masterchain info for funder balance check")
93+
funderBalance, err := funder.GetBalance(t.Context(), master)
94+
require.NoError(t, err, "failed to get funder balance")
95+
require.Equal(t, funderBalance.Nano().String(), "1000000000000000", "funder balance mismatch")
96+
})
97+
})
98+
}
99+
```
100+
101+
## Test Private Keys
102+
103+
The framework includes a pre-funded high-load wallet for testing purposes. This wallet type can send up to 254 messages per 1 external message, making it efficient for test scenarios.
104+
105+
Default High-Load Wallet:
106+
```
107+
Address: -1:5ee77ced0b7ae6ef88ab3f4350d8872c64667ffbe76073455215d3cdfab3294b
108+
Mnemonic: twenty unfair stay entry during please water april fabric morning length lumber style tomorrow melody similar forum width ride render void rather custom coin
109+
```
110+
111+
## Available Pre-funded Wallets
112+
113+
MyLocalTon Docker environment comes with several pre-funded wallets that can be used for testing:
114+
115+
1. Genesis Wallet (V3R2, WalletId: 42)
116+
2. Validator Wallets (1-5) (V3R2, WalletId: 42)
117+
3. Faucet Wallet (V3R2, WalletId: 42, Balance: 1 million TON)
118+
4. Faucet Highload Wallet (Highload V2, QueryId: 0, Balance: 1 million TON)
119+
5. Basechain Faucet Wallet (V3R2, WalletId: 42, Balance: 1 million TON)
120+
6. Basechain Faucet Highload Wallet (Highload V2, QueryId: 0, Balance: 1 million TON)
121+
122+
For the complete list of addresses and mnemonics, refer to the [MyLocalTon Docker documentation](https://github.com/neodix42/mylocalton-docker).

book/src/framework/components/chainlink/node.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Here we provide full configuration reference, if you want to copy and run it, pl
2323
# A list of paths to capability binaries
2424
capabilities = ["./capability_1", "./capability_2"]
2525
# Default capabilities directory inside container
26-
capabilities_container_dir = "/home/capabilities"
26+
capabilities_container_dir = "/usr/local/bin"
2727
# Image to use, you can either provide "image" or "docker_file" + "docker_ctx" fields
2828
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
2929
# Path to your Chainlink Dockerfile

book/src/framework/components/chainlink/nodeset.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This component requires some Blockchain to be deployed, add this to config
1818
# Anvil command line params, ex.: docker_cmd_params = ['--block-time=1', '...']
1919
docker_cmd_params = []
2020
# Docker image and tag
21-
image = "f4hrenh9it/foundry:latest"
21+
image = "ghcr.io/foundry-rs/foundry:stable"
2222
# External port to expose
2323
port = "8545"
2424
# Pulls the image every time if set to 'true', used like that in CI. Can be set to 'false' to speed up local runs
@@ -54,7 +54,7 @@ Then configure NodeSet
5454
http_port_range_start = 10000
5555
# P2P API port range start, each new node get port incremented (host machine)
5656
p2p_port_range_start = 12000
57-
57+
5858
[nodesets.db]
5959
# PostgreSQL image version and tag
6060
image = "postgres:12.0"
@@ -71,7 +71,7 @@ Then configure NodeSet
7171
# A list of paths to capability binaries
7272
capabilities = ["./capability_1", "./capability_2"]
7373
# Default capabilities directory inside container
74-
capabilities_container_dir = "/home/capabilities"
74+
capabilities_container_dir = "/usr/local/bin"
7575
# Image to use, you can either provide "image" or "docker_file" + "docker_ctx" fields
7676
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
7777
# Path to your Chainlink Dockerfile
@@ -99,7 +99,7 @@ Then configure NodeSet
9999
[nodesets.out]
100100
# If 'use_cache' equals 'true' we skip component setup when we run the test and return the outputs
101101
use_cache = true
102-
102+
103103
# Describes deployed or external Chainlink nodes
104104
[[nodesets.out.cl_nodes]]
105105
use_cache = true
@@ -119,7 +119,7 @@ Then configure NodeSet
119119
# PostgreSQL connection string
120120
# in case of using external database can be overriden
121121
url = "postgresql://chainlink:[email protected]:33094/chainlink?sslmode=disable"
122-
122+
123123
# Can have more than one node, fields are the same, see above ^^
124124
[[nodesets.out.cl_nodes]]
125125
[nodesets.out.cl_nodes.node]

book/src/framework/components/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ In `TOML`:
3535
```
3636
[blockchain_a]
3737
chain_id = "1337"
38-
image = "f4hrenh9it/foundry:latest"
38+
image = "ghcr.io/foundry-rs/foundry:stable"
3939
port = "8500"
4040
type = "anvil"
4141
docker_cmd_params = ["-b", "1"]

book/src/framework/components/troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Docker Desktop -> Settings -> Resources -> File Sharing
1515

1616
## Can't run `anvil`, issue with `Rosetta`
1717
```
18-
2024/11/27 15:20:27 ⏳ Waiting for container id 79f8a68c07cc image: f4hrenh9it/foundry:latest. Waiting for: &{Port:8546 timeout:0x14000901278 PollInterval:100ms skipInternalCheck:false}
18+
2024/11/27 15:20:27 ⏳ Waiting for container id 79f8a68c07cc image: ghcr.io/foundry-rs/foundry:stable. Waiting for: &{Port:8546 timeout:0x14000901278 PollInterval:100ms skipInternalCheck:false}
1919
2024/11/27 15:20:27 container logs (all exposed ports, [8546/tcp], were not mapped in 5s: port 8546/tcp is not mapped yet
2020
wait until ready: check target: retries: 1, port: "", last err: container exited with code 133):
2121
rosetta error: Rosetta is only intended to run on Apple Silicon with a macOS host using Virtualization.framework with Rosetta mode enabled

book/src/framework/nodeset_capabilities.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ gh auth setup-git
1111
Download an example capability binary
1212
```
1313
export export GOPRIVATE=github.com/smartcontractkit/capabilities
14-
go get github.com/smartcontractkit/capabilities/kvstore && go install github.com/smartcontractkit/capabilities/kvstore
14+
go get github.com/smartcontractkit/capabilities/kvstore && go install github.com/smartcontractkit/capabilities/kvstore
1515
```
1616

1717
Create a configuration file `smoke.toml`
@@ -24,7 +24,7 @@ Create a configuration file `smoke.toml`
2424
name = "don"
2525
nodes = 5
2626
override_mode = "all"
27-
27+
2828
[nodesets.db]
2929
image = "postgres:12.0"
3030

@@ -34,7 +34,7 @@ Create a configuration file `smoke.toml`
3434
# path to your capability binaries
3535
capabilities = ["./kvstore"]
3636
# default capabilities directory
37-
# capabilities_container_dir = "/home/capabilities"
37+
# capabilities_container_dir = "/usr/local/bin"
3838
image = "public.ecr.aws/chainlink/chainlink:v2.17.0"
3939
```
4040

@@ -45,7 +45,7 @@ CTF_CONFIGS=smoke.toml go test -v -run TestNodeSet
4545

4646
Now you can configure your capability using `clclient.CreateJobRaw($raw_toml)`.
4747

48-
Capabilities are uploaded to `/home/capabilities` by default.
48+
Capabilities are uploaded to `/usr/local/bins` by default.
4949

5050
Summary:
5151
- We deployed a node set with some capabilities

framework/.changeset/v0.8.2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- TON Network support with testcontainers

0 commit comments

Comments
 (0)