diff --git a/book/src/framework/components/blockchains/tron.md b/book/src/framework/components/blockchains/tron.md index 4c20b9736..86e808380 100644 --- a/book/src/framework/components/blockchains/tron.md +++ b/book/src/framework/components/blockchains/tron.md @@ -4,7 +4,7 @@ ```toml [blockchain_a] type = "tron" - # image = "tronbox/tre" is default image + # image = "tronbox/tre:1.0.3" is default image ``` Default port is `9090` diff --git a/framework/.changeset/v0.7.5.md b/framework/.changeset/v0.7.5.md new file mode 100644 index 000000000..d74d8b31a --- /dev/null +++ b/framework/.changeset/v0.7.5.md @@ -0,0 +1,3 @@ +- Add chain type to output +- Expose constants for types and families +- Pin tronbox/tre image, recent changes do not work on amd64 \ No newline at end of file diff --git a/framework/components/blockchain/aptos.go b/framework/components/blockchain/aptos.go index 39e236b4c..58f172ca3 100644 --- a/framework/components/blockchain/aptos.go +++ b/framework/components/blockchain/aptos.go @@ -127,7 +127,8 @@ func newAptos(in *Input) (*Output, error) { } return &Output{ UseCache: true, - Family: "aptos", + Type: in.Type, + Family: FamilyAptos, ContainerName: containerName, Nodes: []*Node{ { diff --git a/framework/components/blockchain/blockchain.go b/framework/components/blockchain/blockchain.go index fed2fe50e..7e8fc324f 100644 --- a/framework/components/blockchain/blockchain.go +++ b/framework/components/blockchain/blockchain.go @@ -8,6 +8,27 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/framework" ) +// Blockchain node type +const ( + TypeAnvil = "anvil" + TypeAnvilZKSync = "anvil-zksync" + TypeGeth = "geth" + TypeBesu = "besu" + TypeSolana = "solana" + TypeAptos = "aptos" + TypeSui = "sui" + TypeTron = "tron" +) + +// Blockchain node family +const ( + FamilyEVM = "evm" + FamilySolana = "solana" + FamilyAptos = "aptos" + FamilySui = "sui" + FamilyTron = "tron" +) + // Input is a blockchain network configuration params type Input struct { // Common EVM fields @@ -36,6 +57,7 @@ type Input struct { // Output is a blockchain network output, ChainID and one or more nodes that forms the network type Output struct { UseCache bool `toml:"use_cache"` + Type string `toml:"type"` Family string `toml:"family"` ContainerName string `toml:"container_name"` NetworkSpecificData *NetworkSpecificData `toml:"network_specific_data"` @@ -61,21 +83,21 @@ func NewBlockchainNetwork(in *Input) (*Output, error) { var out *Output var err error switch in.Type { - case "anvil": + case TypeAnvil: out, err = newAnvil(in) - case "geth": + case TypeGeth: out, err = newGeth(in) - case "besu": + case TypeBesu: out, err = newBesu(in) - case "solana": + case TypeSolana: out, err = newSolana(in) - case "aptos": + case TypeAptos: out, err = newAptos(in) - case "sui": + case TypeSui: out, err = newSui(in) - case "tron": + case TypeTron: out, err = newTron(in) - case "anvil-zksync": + case TypeAnvilZKSync: out, err = newAnvilZksync(in) default: return nil, fmt.Errorf("blockchain type is not supported or empty, must be 'anvil' or 'geth'") diff --git a/framework/components/blockchain/containers.go b/framework/components/blockchain/containers.go index e3ef58de1..d85c58ea2 100644 --- a/framework/components/blockchain/containers.go +++ b/framework/components/blockchain/containers.go @@ -69,7 +69,8 @@ func createGenericEvmContainer(in *Input, req testcontainers.ContainerRequest, u output := Output{ UseCache: true, - Family: "evm", + Type: in.Type, + Family: FamilyEVM, ChainID: in.ChainID, ContainerName: containerName, Container: c, diff --git a/framework/components/blockchain/solana.go b/framework/components/blockchain/solana.go index cf66e3649..efb9ca912 100644 --- a/framework/components/blockchain/solana.go +++ b/framework/components/blockchain/solana.go @@ -144,7 +144,8 @@ func newSolana(in *Input) (*Output, error) { return &Output{ UseCache: true, - Family: "solana", + Type: in.Type, + Family: FamilySolana, ContainerName: containerName, Container: c, Nodes: []*Node{ diff --git a/framework/components/blockchain/sui.go b/framework/components/blockchain/sui.go index 9d9db83c9..83666159e 100644 --- a/framework/components/blockchain/sui.go +++ b/framework/components/blockchain/sui.go @@ -152,7 +152,8 @@ func newSui(in *Input) (*Output, error) { } return &Output{ UseCache: true, - Family: "sui", + Type: in.Type, + Family: FamilySui, ContainerName: containerName, NetworkSpecificData: &NetworkSpecificData{SuiAccount: suiAccount}, Nodes: []*Node{ diff --git a/framework/components/blockchain/tron.go b/framework/components/blockchain/tron.go index c60e230a0..79e3a55ce 100644 --- a/framework/components/blockchain/tron.go +++ b/framework/components/blockchain/tron.go @@ -115,7 +115,8 @@ func newTron(in *Input) (*Output, error) { return &Output{ UseCache: true, ChainID: in.ChainID, - Family: "tron", + Type: in.Type, + Family: FamilyTron, ContainerName: containerName, Nodes: []*Node{ { diff --git a/framework/examples/myproject/smoke_tron.toml b/framework/examples/myproject/smoke_tron.toml index 38443df69..4938aced9 100644 --- a/framework/examples/myproject/smoke_tron.toml +++ b/framework/examples/myproject/smoke_tron.toml @@ -1,3 +1,3 @@ [blockchain_a] type = "tron" - image = "tronbox/tre" + image = "tronbox/tre:1.0.3"