-
Notifications
You must be signed in to change notification settings - Fork 31
reenable ton in devenv #1899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reenable ton in devenv #1899
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,9 @@ package ccip | |||||||||||||
|
|
||||||||||||||
| import ( | ||||||||||||||
| "context" | ||||||||||||||
| // "encoding/hex" | ||||||||||||||
| "encoding/hex" | ||||||||||||||
| "fmt" | ||||||||||||||
|
|
||||||||||||||
| "errors" | ||||||||||||||
| "os" | ||||||||||||||
| "path/filepath" | ||||||||||||||
|
|
@@ -18,17 +20,19 @@ import ( | |||||||||||||
| "github.com/smartcontractkit/chainlink-deployments-framework/deployment" | ||||||||||||||
| "github.com/smartcontractkit/chainlink-deployments-framework/operations" | ||||||||||||||
| "github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain" | ||||||||||||||
| // "github.com/xssnick/tonutils-go/address" | ||||||||||||||
| // "github.com/xssnick/tonutils-go/tlb" | ||||||||||||||
| // "github.com/xssnick/tonutils-go/ton/wallet" | ||||||||||||||
|
|
||||||||||||||
| "github.com/xssnick/tonutils-go/address" | ||||||||||||||
| "github.com/xssnick/tonutils-go/tlb" | ||||||||||||||
| "github.com/xssnick/tonutils-go/ton/wallet" | ||||||||||||||
|
|
||||||||||||||
| chainsel "github.com/smartcontractkit/chain-selectors" | ||||||||||||||
|
|
||||||||||||||
| cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain" | ||||||||||||||
| cldf_evm_provider "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm/provider" | ||||||||||||||
| cldf_solana_provider "github.com/smartcontractkit/chainlink-deployments-framework/chain/solana/provider" | ||||||||||||||
| // cldf_ton_provider "github.com/smartcontractkit/chainlink-deployments-framework/chain/ton/provider" | ||||||||||||||
| // testutils "github.com/smartcontractkit/chainlink-ton/deployment/utils" | ||||||||||||||
|
|
||||||||||||||
| cldf_ton_provider "github.com/smartcontractkit/chainlink-deployments-framework/chain/ton/provider" | ||||||||||||||
| testutils "github.com/smartcontractkit/chainlink-ton/deployment/utils" | ||||||||||||||
|
|
||||||||||||||
| ccipEVM "github.com/smartcontractkit/chainlink-ccip/devenv/chainimpl/ccip-evm" | ||||||||||||||
| ccipSolana "github.com/smartcontractkit/chainlink-ccip/devenv/chainimpl/ccip-solana" | ||||||||||||||
|
|
@@ -164,49 +168,48 @@ func NewCLDFOperationsEnvironment(bc []*blockchain.Input, dataStore datastore.Da | |||||||||||||
| } | ||||||||||||||
| providers = append(providers, p) | ||||||||||||||
| } else if b.Type == "ton" { | ||||||||||||||
| panic("TON support temporarily disabled") | ||||||||||||||
| // chainID := b.ChainID | ||||||||||||||
| // rpcHTTPURL := b.Out.Nodes[0].ExternalHTTPUrl | ||||||||||||||
|
|
||||||||||||||
| // d, err := chainsel.GetChainDetailsByChainIDAndFamily(chainID, chainsel.FamilyTon) | ||||||||||||||
| // if err != nil { | ||||||||||||||
| // return nil, nil, err | ||||||||||||||
| // } | ||||||||||||||
| // client, err := testutils.CreateClient(context.Background(), rpcHTTPURL) | ||||||||||||||
| // if err != nil { | ||||||||||||||
| // return nil, nil, fmt.Errorf("failed to create TON client: %w", err) | ||||||||||||||
| // } | ||||||||||||||
|
|
||||||||||||||
| // seed := wallet.NewSeed() | ||||||||||||||
| // w, err := wallet.FromSeed(client, seed, wallet.ConfigV5R1Final{NetworkGlobalID: wallet.MainnetGlobalID, Workchain: 0}) | ||||||||||||||
| // if err != nil { | ||||||||||||||
| // return nil, nil, fmt.Errorf("failed to create TON wallet: %w", err) | ||||||||||||||
| // } | ||||||||||||||
| // privateKey, err := wallet.SeedToPrivateKey(seed /*password=*/, "" /*isBIP39=*/, false) | ||||||||||||||
| // if err != nil { | ||||||||||||||
| // return nil, nil, fmt.Errorf("failed to get private key from seed: %w", err) | ||||||||||||||
| // } | ||||||||||||||
| // walletVersion := "V5R1" | ||||||||||||||
| // deployerSignerGen := cldf_ton_provider.PrivateKeyFromRaw(hex.EncodeToString(privateKey)) | ||||||||||||||
|
|
||||||||||||||
| // selectors = append(selectors, d.ChainSelector) | ||||||||||||||
| // p, err := cldf_ton_provider.NewRPCChainProvider( | ||||||||||||||
| // d.ChainSelector, | ||||||||||||||
| // cldf_ton_provider.RPCChainProviderConfig{ | ||||||||||||||
| // HTTPURL: rpcHTTPURL, | ||||||||||||||
| // WalletVersion: cldf_ton_provider.WalletVersion(walletVersion), | ||||||||||||||
| // DeployerSignerGen: deployerSignerGen, | ||||||||||||||
| // }, | ||||||||||||||
| // ).Initialize(context.Background()) | ||||||||||||||
| // if err != nil { | ||||||||||||||
| // return nil, nil, err | ||||||||||||||
| // } | ||||||||||||||
|
|
||||||||||||||
| // err = testutils.FundWalletsNoT(client, []*address.Address{w.Address()}, []tlb.Coins{tlb.MustFromTON("1000")}) | ||||||||||||||
| // if err != nil { | ||||||||||||||
| // return nil, nil, fmt.Errorf("failed to fund TON wallet: %w", err) | ||||||||||||||
| // } | ||||||||||||||
| // providers = append(providers, p) | ||||||||||||||
| chainID := b.ChainID | ||||||||||||||
| rpcHTTPURL := b.Out.Nodes[0].ExternalHTTPUrl | ||||||||||||||
|
|
||||||||||||||
| d, err := chainsel.GetChainDetailsByChainIDAndFamily(chainID, chainsel.FamilyTon) | ||||||||||||||
| if err != nil { | ||||||||||||||
| return nil, nil, err | ||||||||||||||
| } | ||||||||||||||
| client, err := testutils.CreateClient(context.Background(), rpcHTTPURL) | ||||||||||||||
| if err != nil { | ||||||||||||||
| return nil, nil, fmt.Errorf("failed to create TON client: %w", err) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| seed := wallet.NewSeed() | ||||||||||||||
| w, err := wallet.FromSeed(client, seed, wallet.ConfigV5R1Final{NetworkGlobalID: wallet.MainnetGlobalID, Workchain: 0}) | ||||||||||||||
| if err != nil { | ||||||||||||||
| return nil, nil, fmt.Errorf("failed to create TON wallet: %w", err) | ||||||||||||||
| } | ||||||||||||||
| privateKey, err := wallet.SeedToPrivateKey(seed /*password=*/, "" /*isBIP39=*/, false) | ||||||||||||||
| if err != nil { | ||||||||||||||
| return nil, nil, fmt.Errorf("failed to get private key from seed: %w", err) | ||||||||||||||
| } | ||||||||||||||
| walletVersion := "V5R1" | ||||||||||||||
| deployerSignerGen := cldf_ton_provider.PrivateKeyFromRaw(hex.EncodeToString(privateKey)) | ||||||||||||||
|
Comment on lines
+183
to
+193
|
||||||||||||||
|
|
||||||||||||||
| selectors = append(selectors, d.ChainSelector) | ||||||||||||||
| p, err := cldf_ton_provider.NewRPCChainProvider( | ||||||||||||||
| d.ChainSelector, | ||||||||||||||
| cldf_ton_provider.RPCChainProviderConfig{ | ||||||||||||||
| HTTPURL: rpcHTTPURL, | ||||||||||||||
| WalletVersion: cldf_ton_provider.WalletVersion(walletVersion), | ||||||||||||||
| DeployerSignerGen: deployerSignerGen, | ||||||||||||||
| }, | ||||||||||||||
| ).Initialize(context.Background()) | ||||||||||||||
| if err != nil { | ||||||||||||||
| return nil, nil, err | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| err = testutils.FundWalletsNoT(client, []*address.Address{w.Address()}, []tlb.Coins{tlb.MustFromTON("1000")}) | ||||||||||||||
|
||||||||||||||
| err = testutils.FundWalletsNoT(client, []*address.Address{w.Address()}, []tlb.Coins{tlb.MustFromTON("1000")}) | |
| fundAmountTON := os.Getenv("TON_DEPLOYER_FUNDING_TON") | |
| if fundAmountTON == "" { | |
| fundAmountTON = "1000" | |
| } | |
| err = testutils.FundWalletsNoT(client, []*address.Address{w.Address()}, []tlb.Coins{tlb.MustFromTON(fundAmountTON)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newly re-enabled TON branch in
NewCLDFOperationsEnvironmentdoesn’t appear to be exercised by existing automated tests (current e2e/smoke flows largely assume EVM/Solana). Adding at least one test that runs the TON initialization path (even if it’s a mocked RPC client) would help catch regressions in wallet creation, funding, and provider initialization.