Skip to content

Commit

Permalink
merge develop + linter fixes (#714)
Browse files Browse the repository at this point in the history
* fix: remove default pass on linters (#711)

* remove default pass on integration tests + relayer

* upgrade to go1.21.6

* fix relay linter issues

* fix e2e test linter

* fix e2e tests

* linter fixes
  • Loading branch information
aalu1418 authored May 21, 2024
1 parent ff1204a commit b7dfda5
Show file tree
Hide file tree
Showing 27 changed files with 242 additions and 285 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ jobs:
nix_path: nixpkgs=channel:nixos-unstable
- name: golangci-lint
run: nix develop -c make lint-go-integration-tests
- name: Print lint report artifact
if: failure()
shell: bash
run: cat ./integration-tests/golangci-lint-integration-tests-report.xml
- name: Store lint report artifact
if: always()
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
Expand All @@ -35,9 +39,13 @@ jobs:
nix_path: nixpkgs=channel:nixos-unstable
- name: golangci-lint
run: nix develop -c make lint-go-relay
- name: Print lint report artifact
if: failure()
shell: bash
run: cat ./pkg/golangci-lint-relay-report.xml
- name: Store lint report artifact
if: always()
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: golangci-lint-relay-report
path: ./pkg/golangci-lint-relay-report.xml
path: ./pkg/golangci-lint-relay-report.xml
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
nodejs 18.13.0
yarn 1.22.19
rust 1.59.0
golang 1.21.1
golangci-lint 1.52.1
golang 1.21.6
golangci-lint 1.55.2
pulumi 3.40.1
ginkgo 2.5.1
actionlint 1.6.22
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ gomodtidy:

.PHONY: lint-go-integration-tests
lint-go-integration-tests:
cd ./integration-tests && golangci-lint --max-issues-per-linter 0 --max-same-issues 0 --color=always --exclude=dot-imports --timeout 10m --out-format checkstyle:golangci-lint-integration-tests-report.xml run || true
cd ./integration-tests && golangci-lint --max-issues-per-linter 0 --max-same-issues 0 --color=always --exclude=dot-imports --timeout 10m --out-format checkstyle:golangci-lint-integration-tests-report.xml run

.PHONY: lint-go-relay
lint-go-relay:
cd ./pkg && golangci-lint --max-issues-per-linter 0 --max-same-issues 0 --color=always --exclude=dot-imports --timeout 10m --out-format checkstyle:golangci-lint-relay-report.xml run || true
cd ./pkg && golangci-lint --max-issues-per-linter 0 --max-same-issues 0 --color=always --exclude=dot-imports --timeout 10m --out-format checkstyle:golangci-lint-relay-report.xml run

.PHONY: upgrade-e2e-solana-image
upgrade-e2e-solana-image:
Expand Down
30 changes: 15 additions & 15 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/smartcontractkit/chainlink-solana

go 1.21
go 1.21.6

require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
Expand Down
44 changes: 23 additions & 21 deletions integration-tests/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,41 @@ import (
"testing"
"time"

"github.com/gagliardetto/solana-go"
"github.com/google/uuid"
"github.com/lib/pq"
"github.com/rs/zerolog/log"
"golang.org/x/crypto/curve25519"
"gopkg.in/guregu/null.v4"

"github.com/gagliardetto/solana-go"
"github.com/smartcontractkit/libocr/offchainreporting2/confighelper"
"github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median"
"github.com/smartcontractkit/libocr/offchainreporting2/types"

"github.com/smartcontractkit/chainlink-common/pkg/config"
chainConfig "github.com/smartcontractkit/chainlink-solana/integration-tests/config"
tc "github.com/smartcontractkit/chainlink-solana/integration-tests/testconfig"
ctfconfig "github.com/smartcontractkit/chainlink-testing-framework/config"
ctf_test_env "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env"
"github.com/smartcontractkit/chainlink-testing-framework/k8s/environment"
"github.com/smartcontractkit/chainlink-testing-framework/k8s/pkg/helm/chainlink"
mock_adapter "github.com/smartcontractkit/chainlink-testing-framework/k8s/pkg/helm/mock-adapter"
"github.com/smartcontractkit/chainlink-testing-framework/k8s/pkg/helm/sol"
"github.com/smartcontractkit/chainlink-testing-framework/utils/ptr"

"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/contracts"
"github.com/smartcontractkit/chainlink/integration-tests/docker/test_env"
"github.com/smartcontractkit/chainlink/integration-tests/types/config/node"

cl "github.com/smartcontractkit/chainlink/v2/core/services/chainlink"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/store/models"

"github.com/smartcontractkit/chainlink-common/pkg/config"
commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config"

test_env_sol "github.com/smartcontractkit/chainlink-solana/integration-tests/docker/test_env"
chainConfig "github.com/smartcontractkit/chainlink-solana/integration-tests/config"
test_env_sol "github.com/smartcontractkit/chainlink-solana/integration-tests/docker/testenv"
"github.com/smartcontractkit/chainlink-solana/integration-tests/solclient"
tc "github.com/smartcontractkit/chainlink-solana/integration-tests/testconfig"
cl_solana "github.com/smartcontractkit/chainlink-solana/pkg/solana"
solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config"
)
Expand All @@ -66,7 +68,7 @@ type TestEnvDetails struct {

type ChainDetails struct {
ChainName string
ChainId string
ChainID string
RPCUrl string
RPCURLExternal string
WSURLExternal string
Expand Down Expand Up @@ -141,20 +143,20 @@ func New(testConfig *tc.TestConfig) *Common {
config = chainConfig.DevnetConfig()
privateKeyString = *testConfig.Common.PrivateKey

if *testConfig.Common.RPC_URL != "" {
config.RPCUrl = *testConfig.Common.RPC_URL
config.WSUrl = *testConfig.Common.WS_URL
if *testConfig.Common.RPCURL != "" {
config.RPCUrl = *testConfig.Common.RPCURL
config.WSUrl = *testConfig.Common.WsURL
config.ProgramAddresses = &chainConfig.ProgramAddresses{
OCR2: *testConfig.SolanaConfig.OCR2ProgramId,
AccessController: *testConfig.SolanaConfig.AccessControllerProgramId,
Store: *testConfig.SolanaConfig.StoreProgramId,
OCR2: *testConfig.SolanaConfig.OCR2ProgramID,
AccessController: *testConfig.SolanaConfig.AccessControllerProgramID,
Store: *testConfig.SolanaConfig.StoreProgramID,
}
}
}

c = &Common{
ChainDetails: &ChainDetails{
ChainId: config.ChainID,
ChainID: config.ChainID,
RPCUrl: config.RPCUrl,
ChainName: config.ChainName,
ProgramAddresses: config.ProgramAddresses,
Expand Down Expand Up @@ -182,7 +184,7 @@ func (c *Common) CreateNodeKeysBundle(nodes []*client.ChainlinkClient) ([]client
}

peerID := p2pkeys.Data[0].Attributes.PeerID
txKey, _, err := n.CreateTxKey(c.ChainDetails.ChainName, c.ChainDetails.ChainId)
txKey, _, err := n.CreateTxKey(c.ChainDetails.ChainName, c.ChainDetails.ChainID)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -286,7 +288,7 @@ func OffChainConfigParamsFromNodes(nodeCount int, nkb []client.NodeKeysBundle) (
}, nil
}

func CreateBridges(ContractsIdxMapToContractsNodeInfo map[int]*ContractNodeInfo, mockUrl string, isK8s bool) error {
func CreateBridges(ContractsIdxMapToContractsNodeInfo map[int]*ContractNodeInfo, mockURL string, isK8s bool) error {
for i, nodesInfo := range ContractsIdxMapToContractsNodeInfo {
// Bootstrap node first
var err error
Expand All @@ -301,7 +303,7 @@ func CreateBridges(ContractsIdxMapToContractsNodeInfo map[int]*ContractNodeInfo,
}
sourceValueBridge := client.BridgeTypeAttributes{
Name: nodeContractPairID,
URL: fmt.Sprintf("%s/%s", mockUrl, "five"),
URL: fmt.Sprintf("%s/%s", mockURL, "five"),
RequestData: "{}",
}
observationSource := client.ObservationSourceSpecBridge(&sourceValueBridge)
Expand All @@ -315,7 +317,7 @@ func CreateBridges(ContractsIdxMapToContractsNodeInfo map[int]*ContractNodeInfo,
}
juelsBridge := client.BridgeTypeAttributes{
Name: nodeContractPairID + "juels",
URL: fmt.Sprintf("%s/%s", mockUrl, "five"),
URL: fmt.Sprintf("%s/%s", mockURL, "five"),
RequestData: "{}",
}
juelsSource := client.ObservationSourceSpecBridge(&juelsBridge)
Expand Down Expand Up @@ -348,7 +350,7 @@ func CreateBridges(ContractsIdxMapToContractsNodeInfo map[int]*ContractNodeInfo,
}
sourceValueBridge := client.BridgeTypeAttributes{
Name: nodeContractPairID,
URL: fmt.Sprintf("%s/%s", mockUrl, "five"),
URL: fmt.Sprintf("%s/%s", mockURL, "five"),
RequestData: "{}",
}
observationSource := client.ObservationSourceSpecBridge(&sourceValueBridge)
Expand All @@ -362,7 +364,7 @@ func CreateBridges(ContractsIdxMapToContractsNodeInfo map[int]*ContractNodeInfo,
}
juelsBridge := client.BridgeTypeAttributes{
Name: nodeContractPairID + "juels",
URL: fmt.Sprintf("%s/%s", mockUrl, "five"),
URL: fmt.Sprintf("%s/%s", mockURL, "five"),
RequestData: "{}",
}
juelsSource := client.ObservationSourceSpecBridge(&juelsBridge)
Expand Down Expand Up @@ -401,7 +403,7 @@ func (c *Common) CreateJobsForContract(contractNodeInfo *ContractNodeInfo) error
"ocr2ProgramID": contractNodeInfo.OCR2.ProgramAddress(),
"transmissionsID": contractNodeInfo.Store.TransmissionsAddress(),
"storeProgramID": contractNodeInfo.Store.ProgramAddress(),
"chainID": c.ChainDetails.ChainId,
"chainID": c.ChainDetails.ChainID,
}
bootstrapPeers := []client.P2PData{
{
Expand Down Expand Up @@ -485,7 +487,7 @@ func BuildNodeContractPairID(node *client.ChainlinkClient, ocr2Addr string) (str
func (c *Common) DefaultNodeConfig() *cl.Config {
solConfig := cl_solana.TOMLConfig{
Enabled: ptr.Ptr(true),
ChainID: ptr.Ptr(c.ChainDetails.ChainId),
ChainID: ptr.Ptr(c.ChainDetails.ChainID),
Nodes: []*solcfg.Node{
{
Name: ptr.Ptr("primary"),
Expand Down
Loading

0 comments on commit b7dfda5

Please sign in to comment.