Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into tt-1936-seth-simulate…
Browse files Browse the repository at this point in the history
…d-backend
  • Loading branch information
Tofel committed Jan 22, 2025
2 parents ae186e7 + 44fcb51 commit e6d9102
Show file tree
Hide file tree
Showing 77 changed files with 5,393 additions and 493 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/framework-golden-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ jobs:
config: smoke.toml
count: 1
timeout: 10m
- name: TestSuiSmoke
config: smoke_sui.toml
count: 1
timeout: 10m
- name: TestAptosSmoke
config: smoke_aptos.toml
count: 1
timeout: 10m
- name: TestTRONSmoke
config: smoke_tron.toml
count: 1
timeout: 10m
- name: TestSolanaSmoke
config: smoke_solana.toml
count: 1
Expand Down
96 changes: 52 additions & 44 deletions book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,54 @@

- [Overview](./overview.md)
- [Framework](./framework/overview.md)
- [Getting Started](./framework/getting_started.md)
- [Your First Test](./framework/first_test.md)
- [Connecting Chainlink Node](./framework/connecting_chainlink_node.md)
- [Connecting Chainlink Node (Multiple networks)]()
- [NodeSet Environment](./framework/nodeset_environment.md)
- [NodeSet with Capabilities](./framework/nodeset_capabilities.md)
- [NodeSet (Local Docker builds)](./framework/nodeset_docker_rebuild.md)
- [NodeSet Compat Environment](./framework/nodeset_compatibility.md)
- [Creating your own components](./developing/developing_components.md)
- [Fork Testing](./framework/fork.md)
- [Quick Contracts Deployment](./framework/quick_deployment.md)
- [Verifying Contracts](./framework/verify.md)
- [NodeSet with External Blockchain]()
- [CLI](./framework/cli.md)
- [Configuration](./framework/configuration.md)
- [Test Configuration](./framework/test_configuration_overrides.md)
- [Exposing Components](framework/components/state.md)
- [Debugging Tests](framework/components/debug.md)
- [Components Cleanup](framework/components/cleanup.md)
- [Components Caching](framework/components/caching.md)
- [Mocking Services](framework/components/mocking.md)
- [Copying Files](framework/copying_files.md)
- [External Environment](framework/components/external.md)
- [Troubleshooting](framework/components/troubleshooting.md)
- [Secrets]()
- [Observability Stack](framework/observability/observability_stack.md)
- [Metrics](framework/observability/metrics.md)
- [Logs](framework/observability/logs.md)
- [Profiling](framework/observability/profiling.md)
- [Traces]()
- [Blockscout](framework/observability/blockscout.md)
- [Components](framework/components/overview.md)
- [Blockchains](framework/components/blockchains/overview.md)
- [EVM](framework/components/blockchains/evm.md)
- [Solana](framework/components/blockchains/solana.md)
- [Optimism Stack]()
- [Arbitrum Stack]()
- [Chainlink](framework/components/chainlink.md)
- [Node](framework/components/chainlink/node.md)
- [NodeSet](framework/components/chainlink/nodeset.md)
- [Clients]()
- [Chainlink]()
- [RPC]()
- [Loki]()
- [Getting Started](./framework/getting_started.md)
- [Your First Test](./framework/first_test.md)
- [Connecting Chainlink Node](./framework/connecting_chainlink_node.md)
- [Connecting Chainlink Node (Multiple networks)]()
- [NodeSet Environment](./framework/nodeset_environment.md)
- [NodeSet with Capabilities](./framework/nodeset_capabilities.md)
- [NodeSet (Local Docker builds)](./framework/nodeset_docker_rebuild.md)
- [NodeSet Compat Environment](./framework/nodeset_compatibility.md)
- [Creating your own components](./developing/developing_components.md)
- [Fork Testing](./framework/fork.md)
- [Quick Contracts Deployment](./framework/quick_deployment.md)
- [Verifying Contracts](./framework/verify.md)
- [NodeSet with External Blockchain]()
- [CLI](./framework/cli.md)
- [Configuration](./framework/configuration.md)
- [Test Configuration](./framework/test_configuration_overrides.md)
- [Exposing Components](framework/components/state.md)
- [Debugging Tests](framework/components/debug.md)
- [Components Cleanup](framework/components/cleanup.md)
- [Components Caching](framework/components/caching.md)
- [Mocking Services](framework/components/mocking.md)
- [Copying Files](framework/copying_files.md)
- [External Environment](framework/components/external.md)
- [Troubleshooting](framework/components/troubleshooting.md)
- [Secrets]()
- [Observability Stack](framework/observability/observability_stack.md)
- [Metrics](framework/observability/metrics.md)
- [Logs](framework/observability/logs.md)
- [Profiling](framework/observability/profiling.md)
- [PostgreSQL](framework/observability/postgresql.md)
- [Traces]()
- [Blockscout](framework/observability/blockscout.md)
- [Components](framework/components/overview.md)
- [Blockchains](framework/components/blockchains/overview.md)
- [EVM](framework/components/blockchains/evm.md)
- [Solana](framework/components/blockchains/solana.md)
- [Aptos](framework/components/blockchains/aptos.md)
- [Sui](framework/components/blockchains/sui.md)
- [TRON](framework/components/blockchains/tron.md)
- [Optimism Stack]()
- [Arbitrum Stack]()
- [Chainlink](framework/components/chainlink.md)
- [Node](framework/components/chainlink/node.md)
- [NodeSet](framework/components/chainlink/nodeset.md)
- [Clients]()
- [Chainlink]()
- [RPC]()
- [Loki]()
- [Testing Maturity Model](framework/testing.md)
- [Smoke]()
- [Performance]()
Expand Down Expand Up @@ -103,7 +107,9 @@
- [Sentinel](./libs/sentinel.md)

---

- [Releasing modules](releasing_modules.md)

---

- [CTFv1 (Discouraged)](lib.md)
Expand Down Expand Up @@ -135,5 +141,7 @@
- [Third party apps]()
- [Test helpers](lib/docker/test_helpers.md)
- [Logging](lib/logging.md)

---

- [Build info](build_info.md)
73 changes: 73 additions & 0 deletions book/src/framework/components/blockchains/aptos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Aptos Blockchain Client

You need to turn `Rosetta` off to use this image! Image doesn't work with `OrbStack` currently.

Docker Desktop

![img.png](rosetta-settings.png)

Default image is `aptoslabs/tools:aptos-node-v1.18.0`

API is available on [localhost:8080](http://localhost:8080/v1)

## Configuration

```toml
[blockchain_a]
type = "aptos"
image = "aptoslabs/tools:aptos-node-v1.18.0" # or aptoslabs/tools:nightly
contracts_dir = "$your_dir"
```

## Usage

```golang
package examples

import (
"github.com/go-resty/resty/v2"
"github.com/smartcontractkit/chainlink-testing-framework/framework"
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
"github.com/stretchr/testify/require"
"testing"
)

type CfgAptos struct {
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"`
}

func TestAptosSmoke(t *testing.T) {
in, err := framework.Load[CfgAptos](t)
require.NoError(t, err)

bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA)
require.NoError(t, err)

// execute any additional commands, to deploy contracts or set up
// network is already funded, here are the keys
_ = blockchain.DefaultAptosAccount
_ = blockchain.DefaultAptosPrivateKey

_, err = framework.ExecContainer(bc.ContainerName, []string{"ls", "-lah"})
require.NoError(t, err)

t.Run("test something", func(t *testing.T) {
// use internal URL to connect Chainlink nodes
_ = bc.Nodes[0].DockerInternalHTTPUrl
// use host URL to interact
_ = bc.Nodes[0].HostHTTPUrl
r := resty.New().SetBaseURL(bc.Nodes[0].HostHTTPUrl).EnableTrace()
_, err := r.R().Get("/v1/transactions")
require.NoError(t, err)
})
}
```

## Test Private Keys

Default account is already funded with `100000000 Octas`

```
Account: 0xa337b42bd0eecf8fb59ee5929ea4541904b3c35a642040223f3d26ab57f59d6e
PrivateKey: 0xd477c65f88ed9e6d4ec6e2014755c3cfa3e0c44e521d0111a02868c5f04c41d4
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions book/src/framework/components/blockchains/sui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Sui Blockchain Client

API is available on [localhost:9000](http://localhost:9000)

## Configuration

```toml
[blockchain_a]
type = "sui"
image = "mysten/sui-tools:mainnet" # if omitted default is mysten/sui-tools:devnet
contracts_dir = "$your_dir"
```

## Usage

```golang
package examples

import (
"context"
"fmt"
"github.com/block-vision/sui-go-sdk/models"
"github.com/block-vision/sui-go-sdk/signer"
"github.com/block-vision/sui-go-sdk/sui"
"github.com/smartcontractkit/chainlink-testing-framework/framework"
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
"github.com/stretchr/testify/require"
"testing"
)

type CfgSui struct {
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"`
}

func TestSuiSmoke(t *testing.T) {
in, err := framework.Load[CfgSui](t)
require.NoError(t, err)

bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA)
require.NoError(t, err)

// network is already funded, here are the keys
_ = bc.NetworkSpecificData.SuiAccount.Mnemonic
_ = bc.NetworkSpecificData.SuiAccount.PublicBase64Key
_ = bc.NetworkSpecificData.SuiAccount.SuiAddress

// execute any additional commands, to deploy contracts or set up
_, err = framework.ExecContainer(bc.ContainerName, []string{"ls", "-lah"})
require.NoError(t, err)

t.Run("test something", func(t *testing.T) {
// use internal URL to connect Chainlink nodes
_ = bc.Nodes[0].DockerInternalHTTPUrl
// use host URL to interact
_ = bc.Nodes[0].HostHTTPUrl

cli := sui.NewSuiClient(bc.Nodes[0].HostHTTPUrl)

signerAccount, err := signer.NewSignertWithMnemonic(bc.NetworkSpecificData.SuiAccount.Mnemonic)
require.NoError(t, err)
rsp, err := cli.SuiXGetAllBalance(context.Background(), models.SuiXGetAllBalanceRequest{
Owner: signerAccount.Address,
})
require.NoError(t, err)
fmt.Printf("My funds: %v\n", rsp)
})
}
```

## Test Private Keys

Since Sui doesn't have official local development chain we are using real node and generating mnemonic at start then funding that account through internal faucet, see
```
// network is already funded, here are the keys
_ = bc.NetworkSpecificData.SuiAccount.Mnemonic
_ = bc.NetworkSpecificData.SuiAccount.PublicBase64Key
_ = bc.NetworkSpecificData.SuiAccount.SuiAddress
```
71 changes: 71 additions & 0 deletions book/src/framework/components/blockchains/tron.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# TRON Blockchain Client

## Configuration
```toml
[blockchain_a]
type = "tron"
# image = "tronbox/tre" is default image
```
Default port is `9090`

## Usage
```golang
package examples

import (
"github.com/smartcontractkit/chainlink-testing-framework/framework"
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
"github.com/stretchr/testify/require"
"testing"
)

type CfgTron struct {
BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"`
}

func TestTRONSmoke(t *testing.T) {
in, err := framework.Load[CfgTron](t)
require.NoError(t, err)

bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA)
require.NoError(t, err)

// all private keys are funded
_ = blockchain.TRONAccounts.PrivateKeys[0]

t.Run("test something", func(t *testing.T) {
// use internal URL to connect Chainlink nodes
_ = bc.Nodes[0].DockerInternalHTTPUrl
// use host URL to interact
_ = bc.Nodes[0].HostHTTPUrl

// use bc.Nodes[0].HostHTTPUrl + "/wallet" to access full node
// use bc.Nodes[0].HostHTTPUrl + "/walletsolidity" to access Solidity node
})
}
```

## More info

Follow the [guide](https://developers.tron.network/reference/tronbox-quickstart) if you want to work with `TRONBox` environment via JS

## Golang HTTP Client

TRON doesn't have any library to interact with it in `Golang` but we maintain our internal fork [here](https://github.com/smartcontractkit/chainlink-internal-integrations/tree/69e35041cdea0bc38ddf642aa93fd3cc3fb5d0d9/tron/relayer/gotron-sdk)

Check TRON [HTTP API](https://tronprotocol.github.io/documentation-en/api/http/)

Full node is on `:9090/wallet`
```
curl -X POST http://127.0.0.1:9090/wallet/createtransaction -d '{
"owner_address": "TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ",
"to_address": "TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW",
"amount": 1000000,
"visible": true
}'
```

Solidity node is on `:9090/walletsolidity`
```
curl -X POST http://127.0.0.1:9090/walletsolidity/getaccount -d '{"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}'
```
Loading

0 comments on commit e6d9102

Please sign in to comment.