Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor DefaultCapConfig into multiple funcs #15882

Draft
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

vyzaldysanchez
Copy link
Contributor

Requires

Supports

Copy link
Contributor

github-actions bot commented Jan 9, 2025

AER Report: CI Core

aer_workflow , commit , Detect Changes , Clean Go Tidy & Generate , Scheduled Run Frequency , Core Tests (go_core_tests) , Core Tests (go_core_tests_integration) , Core Tests (go_core_ccip_deployment_tests) , Core Tests (go_core_fuzz) , Core Tests (go_core_race_tests) , GolangCI Lint (deployment) , test-scripts , lint , SonarQube Scan

1. File is not goimports-ed with -local github.com/smartcontractkit/chainlink: Golang Lint (deployment)

Source of Error:
Golang Lint (deployment)	2025-01-10T21:21:27.0825412Z deployment/keystone/changeset/internal/deploy.go:18: File is not `goimports`-ed with -local github.com/smartcontractkit/chainlink (goimports)
Golang Lint (deployment)	2025-01-10T21:21:27.0827097Z 	capabilitiespb "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb"
Golang Lint (deployment)	2025-01-10T21:21:27.0827911Z 	"github.com/smartcontractkit/chainlink-common/pkg/values"
Golang Lint (deployment)	2025-01-10T21:21:27.0829099Z deployment/keystone/changeset/internal/test/utils.go:13: File is not `goimports`-ed with -local github.com/smartcontractkit/chainlink (goimports)
Golang Lint (deployment)	2025-01-10T21:21:27.0830494Z 	"github.com/stretchr/testify/require"
Golang Lint (deployment)	2025-01-10T21:21:27.0831595Z 	"google.golang.org/protobuf/proto"
Golang Lint (deployment)	2025-01-10T21:21:27.0833530Z deployment/keystone/changeset/internal/update_nodes_test.go:14: File is not `goimports`-ed with -local github.com/smartcontractkit/chainlink (goimports)
Golang Lint (deployment)	2025-01-10T21:21:27.0834947Z 	capabilitiespb "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb"
Golang Lint (deployment)	2025-01-10T21:21:27.0835941Z 	"github.com/smartcontractkit/chainlink-common/pkg/values"

Why: The error indicates that the Go files are not formatted according to the goimports tool with the -local flag set to github.com/smartcontractkit/chainlink. This flag is used to group imports from the local repository separately from third-party imports.

Suggested fix: Run goimports -local github.com/smartcontractkit/chainlink -w . in the relevant directories to automatically format the imports correctly.

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

}

func FromCapabilitiesRegistryCapability(cap *capabilities_registry.CapabilitiesRegistryCapability, e deployment.Environment, registryChainSelector uint64) (*RegisteredCapability, error) {
type RegisteredCapabilityConfig struct {
DefaultConfig map[string]any
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't seem right. is the config serialized to the chain?

ExecutableConfig *RegisteredCapabilityRemoteExecutableConfig
}

type RegisteredCapabilityRemoteTriggerConfig struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how are you determining this type? is there some more basic building-block type that we can use?

BatchCollectionPeriod time.Duration
}

type RegisteredCapabilityRemoteTargetConfig struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these structs used?

RequestHashExcludedAttributes: []string{"signed_report.Signatures"}, // TODO: const defn in a common place
},
func GetTriggerCapConfig(refresh time.Duration, expiry time.Duration, minResponsesToAggregate uint32, defaultCfg map[string]any) (*capabilitiespb.CapabilityConfig, error) {
dCfg, err := values.WrapMap(defaultCfg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to have the caller pass a values.Map (or what ever the

}, nil
}

func GetConsensusCapConfig(defaultCfg map[string]any) (*capabilitiespb.CapabilityConfig, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these functions are odd - they do very little and add little abstraction. why bother? the shouldn't be public, at minimum.

}

func FromCapabilitiesRegistryCapability(cap *capabilities_registry.CapabilitiesRegistryCapability, e deployment.Environment, registryChainSelector uint64) (*RegisteredCapability, error) {
func FromCapabilitiesRegistryCapability(capReg *capabilities_registry.CapabilitiesRegistryCapability, e deployment.Environment, registryChainSelector uint64, cfg []byte) (*RegisteredCapability, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should take the proto object and do the conversation to bytes rather then take bytes

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants