Skip to content

Commit

Permalink
pull gauntlet configs from solclient
Browse files Browse the repository at this point in the history
  • Loading branch information
aalu1418 committed Mar 29, 2024
1 parent 04d40a4 commit f8fc83f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
38 changes: 25 additions & 13 deletions integration-tests/common/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,23 +207,14 @@ func (m *OCRv2TestState) NewSolanaClientSetup(networkSettings *solclient.SolNetw

}

func (m *OCRv2TestState) NewGauntletSetup() (*gauntlet.SolanaGauntlet, error) {
cfg := m.ConfigureGauntlet(utils.TestingSecret)
g, err := gauntlet.NewSolanaGauntlet(fmt.Sprintf("%s/gauntlet", utils.ProjectRoot))
if err != nil {
return nil, err
}
return g, g.SetupNetwork(cfg)
}

func (m *OCRv2TestState) SetupClients(enableGauntlet bool) {
// setup direct solana API
m.Client, m.err = m.NewSolanaClientSetup(m.Client.Config)
require.NoError(m.T, m.err, "error setting up sol client")

// setup gauntlet
if enableGauntlet {
m.Gauntlet, m.err = m.NewGauntletSetup()
m.Gauntlet, m.err = gauntlet.NewSolanaGauntlet(fmt.Sprintf("%s/gauntlet", utils.ProjectRoot))
require.NoError(m.T, m.err, "error setting up gauntlet")
}

Expand Down Expand Up @@ -278,7 +269,7 @@ func (m *OCRv2TestState) DeployContracts(contractsDir string) {
require.NoError(m.T, cd.ValidateProgramsDeployed())
m.Client.LinkToken, err = cd.DeployLinkTokenContract()
require.NoError(m.T, err)
err = FundOracles(m.Client, m.NodeKeysBundle, big.NewFloat(1e4)) // TODO: handle if devnet
err = FundOracles(m.Client, m.NodeKeysBundle, big.NewFloat(1e4)) // TODO: handle if devnet?
require.NoError(m.T, err)

m.initializeNodesInContractsMap()
Expand All @@ -303,10 +294,13 @@ func (m *OCRv2TestState) DeployContracts(contractsDir string) {
}

func (m *OCRv2TestState) DeployFeedWithGauntlet(i int) error {
gauntletConfig := m.ConfigureGauntletFromState(utils.TestingSecret)
require.NoError(m.T, m.Gauntlet.SetupNetwork(gauntletConfig))

_, err := m.Gauntlet.DeployOCR2()
require.NoError(m.T, err, "Error deploying OCR")

gauntletConfig := m.ConfigureGauntlet(utils.TestingSecret)
// TODO: cleanup duplicate logic
bundleData := make([]client.NodeKeysBundle, len(m.ContractsNodeSetup[i].NodeKeysBundle))
copy(bundleData, m.ContractsNodeSetup[i].NodeKeysBundle)

Expand Down Expand Up @@ -628,7 +622,25 @@ func (m *OCRv2TestState) GenerateProposalAcceptConfig(
}
}

func (m *OCRv2TestState) ConfigureGauntlet(secret string) map[string]string {
func (m *OCRv2TestState) ConfigureGauntletFromState(secret string) map[string]string {
if err := os.Setenv("SECRET", secret); err != nil {
panic("Error setting SECRET")
}

return map[string]string{
"NODE_URL": m.Common.SolanaUrl,
"PRIVATE_KEY": m.Client.DefaultWallet.PrivateKey.String(),
"PROGRAM_ID_OCR2": m.Client.ProgramWallets["ocr2-keypair.json"].PublicKey().String(),
"PROGRAM_ID_ACCESS_CONTROLLER": m.Client.ProgramWallets["access_controller-keypair.json"].PublicKey().String(),
"PROGRAM_ID_STORE": m.Client.ProgramWallets["store-keypair.json"].PublicKey().String(),
"LINK": m.LinkToken.Address(),
// unused?
// "WS_URL": wsUrl,
// "VAULT": vault,
}
}

func (m *OCRv2TestState) ConfigureGauntletFromEnv(secret string) map[string]string {
err := os.Setenv("SECRET", secret)
if err != nil {
panic("Error setting SECRET")
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/smoke/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestSolanaGauntletOCRV2Smoke(t *testing.T) {
err = state.Common.CreateSolanaChainAndNode(state.GetChainlinkNodes())
require.NoError(t, err)

gauntletConfig := state.ConfigureGauntlet(utils.TestingSecret)
gauntletConfig := state.ConfigureGauntletFromEnv(utils.TestingSecret)
err = sg.SetupNetwork(gauntletConfig)
require.NoError(t, err, "Error setting gauntlet network")

Expand Down

0 comments on commit f8fc83f

Please sign in to comment.