Skip to content

Commit

Permalink
integration-tests: update env vars, upload access controller contract
Browse files Browse the repository at this point in the history
  • Loading branch information
cfal committed Jul 24, 2023
1 parent ae00ebe commit e544405
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
12 changes: 6 additions & 6 deletions integration-tests/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ type Common struct {
ChainId string
NodeCount int
TTL time.Duration
RPCUrl string
PrivateKey string
NodeUrl string
Mnemonic string
Account string
ObservationSource string
JuelsPerFeeCoinSource string
Expand Down Expand Up @@ -101,8 +101,8 @@ func NewCommon() *Common {
ChainId: chainID,
NodeCount: getNodeCount(),
TTL: getTTL(),
RPCUrl: getEnv("RPC_URL"),
PrivateKey: getEnv("PRIVATE_KEY"),
NodeUrl: getEnv("NODE_URL"),
Mnemonic: getEnv("MNEMONIC"),
Account: getEnv("ACCOUNT"),
ObservationSource: observationSource,
JuelsPerFeeCoinSource: juelsPerFeeCoinSource,
Expand All @@ -121,8 +121,8 @@ func (c *Common) SetDefaultEnvironment(t *testing.T) {
//if c.Testnet {
//wasmdUrl = c.RPCUrl
//}
if c.RPCUrl != "" {
wasmdUrl = c.RPCUrl
if c.NodeUrl != "" {
wasmdUrl = c.NodeUrl
}
baseTOML := fmt.Sprintf(`[[Cosmos]]
Enabled = true
Expand Down
28 changes: 14 additions & 14 deletions integration-tests/gauntlet/gauntlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ func (cg *CosmosGauntlet) FetchGauntletJsonOutput() (*GauntletResponse, error) {
}

// SetupNetwork Sets up a new network and sets the NODE_URL for Devnet / Cosmos RPC
func (cg *CosmosGauntlet) SetupNetwork(addr string) error {
cg.G.AddNetworkConfigVar("NODE_URL", addr)
func (cg *CosmosGauntlet) SetupNetwork(nodeUrl string, mnemonic string) error {
cg.G.AddNetworkConfigVar("NODE_URL", nodeUrl)
cg.G.AddNetworkConfigVar("MNEMONIC", mnemonic)
err := cg.G.WriteNetworkConfigMap(cg.dir + "packages-ts/gauntlet-cosmos-contracts/networks/")
if err != nil {
return err
Expand All @@ -94,8 +95,8 @@ func (cg *CosmosGauntlet) InstallDependencies() error {
return nil
}

func (cg *CosmosGauntlet) UploadContract(name string) (int, error) {
_, err := cg.G.ExecCommand([]string{"upload", name}, *cg.options)
func (cg *CosmosGauntlet) UploadContracts(names []string) (int, error) {
_, err := cg.G.ExecCommand(append([]string{"upload"}, names...), *cg.options)
if err != nil {
return 0, err
}
Expand Down Expand Up @@ -169,16 +170,15 @@ func (cg *CosmosGauntlet) DeployOCR2ControllerContract(minSubmissionValue int64,
}

func (cg *CosmosGauntlet) DeployAccessControllerContract() (string, error) {
return "", errors.New("TODO")
// _, err := cg.G.ExecCommand([]string{"access_controller:deploy"}, *cg.options)
// if err != nil {
// return "", err
// }
// cg.gr, err = cg.FetchGauntletJsonOutput()
// if err != nil {
// return "", err
// }
// return cg.gr.Responses[0].Contract, nil
_, err := cg.G.ExecCommand([]string{"access_controller:deploy"}, *cg.options)
if err != nil {
return "", err
}
cg.gr, err = cg.FetchGauntletJsonOutput()
if err != nil {
return "", err
}
return cg.gr.Responses[0].Contract, nil
}

func (cg *CosmosGauntlet) DeployOCR2ProxyContract(aggregator string) (string, error) {
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestOCRBasic(t *testing.T) {
err = cg.InstallDependencies()
require.NoError(t, err, "Failed to install gauntlet dependencies")

err = cg.SetupNetwork(commonConfig.RPCUrl)
err = cg.SetupNetwork(commonConfig.NodeUrl, commonConfig.Mnemonic)
require.NoError(t, err, "Setting up gauntlet network should not fail")

// TODO: uncomment once we are ready to test rounds
Expand All @@ -37,7 +37,7 @@ func TestOCRBasic(t *testing.T) {
// TODO: fund nodes if necessary

// store the cw20_base contract so we have the token contract, and then deploy the LINK token.
_, err = cg.UploadContract("cw20_base")
_, err = cg.UploadContracts([]string{"cw20_base", "access_controller"})
require.NoError(t, err, "Could not upload cw20_base contract")

linkTokenAddress, err := cg.DeployLinkTokenContract()
Expand Down Expand Up @@ -74,7 +74,7 @@ func TestOCRBasic(t *testing.T) {
_, err = cg.SetOCRBilling(observationPaymentGjuels, transmissionPaymentGjuels, ocrAddress)
require.NoError(t, err, "Could not set OCR billing")

chainlinkClient, err := common.NewChainlinkClient(commonConfig.Env, commonConfig.ChainName, commonConfig.ChainId, commonConfig.RPCUrl)
chainlinkClient, err := common.NewChainlinkClient(commonConfig.Env, commonConfig.ChainName, commonConfig.ChainId, commonConfig.NodeUrl)
require.NoError(t, err, "Could not create chainlink client")

cfg, err := chainlinkClient.LoadOCR2Config([]string{commonConfig.Account})
Expand Down

0 comments on commit e544405

Please sign in to comment.