Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
calvwang9 committed Aug 2, 2023
1 parent 13bfac8 commit 813c77b
Show file tree
Hide file tree
Showing 8 changed files with 441 additions and 79 deletions.
16 changes: 10 additions & 6 deletions integration-tests/common/client.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package common

import (
"fmt"

"github.com/smartcontractkit/chainlink-env/environment"
"github.com/smartcontractkit/chainlink/integration-tests/client"
)
Expand All @@ -18,10 +20,12 @@ func NewChainlinkClient(env *environment.Environment, chainName string, chainId
if err != nil {
return nil, err
}
fmt.Println(nodes)
nodeKeys, _, err := client.CreateNodeKeysBundle(nodes, chainName, chainId)
if err != nil {
return nil, err
}
fmt.Println(nodeKeys)
for _, n := range nodes {
_, _, err = n.CreateCosmosChain(&client.CosmosChainAttributes{
ChainID: chainId,
Expand All @@ -47,23 +51,23 @@ func NewChainlinkClient(env *environment.Environment, chainName string, chainId
}

func (cc *ChainlinkClient) LoadOCR2Config(accountAddresses []string) (*OCR2Config, error) {
var offChaiNKeys []string
var onChaiNKeys []string
var offChainKeys []string
var onChainKeys []string
var peerIds []string
var txKeys []string
var cfgKeys []string
for i, key := range cc.NodeKeys {
offChaiNKeys = append(offChaiNKeys, key.OCR2Key.Data.Attributes.OffChainPublicKey)
offChainKeys = append(offChainKeys, key.OCR2Key.Data.Attributes.OffChainPublicKey)
peerIds = append(peerIds, key.PeerID)
txKeys = append(txKeys, accountAddresses[i])
onChaiNKeys = append(onChaiNKeys, key.OCR2Key.Data.Attributes.OnChainPublicKey)
onChainKeys = append(onChainKeys, key.OCR2Key.Data.Attributes.OnChainPublicKey)
cfgKeys = append(cfgKeys, key.OCR2Key.Data.Attributes.ConfigPublicKey)
}

var payload = TestOCR2Config
payload.Signers = onChaiNKeys
payload.Signers = onChainKeys
payload.Transmitters = txKeys
payload.OffchainConfig.OffchainPublicKeys = offChaiNKeys
payload.OffchainConfig.OffchainPublicKeys = offChainKeys
payload.OffchainConfig.PeerIds = peerIds
payload.OffchainConfig.ConfigPublicKeys = cfgKeys
return &payload, nil
Expand Down
61 changes: 24 additions & 37 deletions integration-tests/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,19 @@ const (
ChainBlockTimeSoak = "2s"
)

var (
observationSource = `
val [type="bridge" name="bridge-coinmetrics" requestData=<{"data": {"from":"LINK","to":"USD"}}>]
parse [type="jsonparse" path="result"]
val -> parse
`
juelsPerFeeCoinSource = `"""
sum [type="sum" values=<[451000]> ]
sum
"""
`
)

type Common struct {
IsSoak bool
P2PPort string
ChainName string
ChainId string
NodeCount int
TTL time.Duration
NodeUrl string
Mnemonic string
Account string
ObservationSource string
JuelsPerFeeCoinSource string
ClConfig map[string]any
K8Config *environment.Config
Env *environment.Environment
IsSoak bool
P2PPort string
ChainName string
ChainId string
NodeCount int
TTL time.Duration
NodeUrl string
Mnemonic string
Account string
ClConfig map[string]any
K8Config *environment.Config
Env *environment.Environment
}

// getEnv gets the environment variable if it exists and sets it for the remote runner
Expand Down Expand Up @@ -96,16 +81,14 @@ func getTTL() time.Duration {

func NewCommon() *Common {
c := &Common{
IsSoak: getEnv("SOAK") != "",
ChainName: chainName,
ChainId: chainID,
NodeCount: getNodeCount(),
TTL: getTTL(),
NodeUrl: getEnv("NODE_URL"),
Mnemonic: getEnv("MNEMONIC"),
Account: getEnv("ACCOUNT"),
ObservationSource: observationSource,
JuelsPerFeeCoinSource: juelsPerFeeCoinSource,
IsSoak: getEnv("SOAK") != "",
ChainName: chainName,
ChainId: chainID,
NodeCount: getNodeCount(),
TTL: getTTL(),
NodeUrl: getEnv("NODE_URL"),
Mnemonic: getEnv("MNEMONIC"),
Account: getEnv("ACCOUNT"),
}
return c
}
Expand Down Expand Up @@ -146,9 +129,13 @@ ListenAddresses = ['0.0.0.0:6690']
"replicas": c.NodeCount,
"toml": baseTOML,
}
fmt.Println(c.ClConfig)
// replace this env with local docker
c.Env = environment.New(c.K8Config).
AddHelm(wasmd.New(nil)).
AddHelm(mockservercfg.New(nil)).
AddHelm(mockserver.New(nil)).
AddHelm(chainlink.New(0, c.ClConfig))

fmt.Println(c.Env)
}
Loading

0 comments on commit 813c77b

Please sign in to comment.