Skip to content

Commit

Permalink
Fixes linter
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzaldysanchez committed Aug 8, 2024
1 parent 88cb3ff commit c822f70
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 40 deletions.
2 changes: 1 addition & 1 deletion core/services/registrysyncer/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"testing"
"time"

capabilitiespb "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
Expand All @@ -15,6 +14,7 @@ import (
ragetypes "github.com/smartcontractkit/libocr/ragep2p/types"

"github.com/smartcontractkit/chainlink-common/pkg/capabilities"
capabilitiespb "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb"
"github.com/smartcontractkit/chainlink-common/pkg/values"

kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry"
Expand Down
39 changes: 0 additions & 39 deletions core/services/registrysyncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ import (
"time"

"github.com/smartcontractkit/chainlink-common/pkg/capabilities"
capabilitiespb "github.com/smartcontractkit/chainlink-common/pkg/capabilities/pb"
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives"
"github.com/smartcontractkit/chainlink-common/pkg/values"
"google.golang.org/protobuf/proto"

kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry"
"github.com/smartcontractkit/chainlink/v2/core/logger"
Expand Down Expand Up @@ -199,42 +196,6 @@ func (s *registrySyncer) updateStateLoop() {
}
}

func unmarshalCapabilityConfig(data []byte) (capabilities.CapabilityConfiguration, error) {
cconf := &capabilitiespb.CapabilityConfig{}
err := proto.Unmarshal(data, cconf)
if err != nil {
return capabilities.CapabilityConfiguration{}, err
}

var remoteTriggerConfig *capabilities.RemoteTriggerConfig
var remoteTargetConfig *capabilities.RemoteTargetConfig

switch cconf.GetRemoteConfig().(type) {
case *capabilitiespb.CapabilityConfig_RemoteTriggerConfig:
prtc := cconf.GetRemoteTriggerConfig()
remoteTriggerConfig = &capabilities.RemoteTriggerConfig{}
remoteTriggerConfig.RegistrationRefresh = prtc.RegistrationRefresh.AsDuration()
remoteTriggerConfig.RegistrationExpiry = prtc.RegistrationExpiry.AsDuration()
remoteTriggerConfig.MinResponsesToAggregate = prtc.MinResponsesToAggregate
remoteTriggerConfig.MessageExpiry = prtc.MessageExpiry.AsDuration()
case *capabilitiespb.CapabilityConfig_RemoteTargetConfig:
prtc := cconf.GetRemoteTargetConfig()
remoteTargetConfig = &capabilities.RemoteTargetConfig{}
remoteTargetConfig.RequestHashExcludedAttributes = prtc.RequestHashExcludedAttributes
}

dc, err := values.FromMapValueProto(cconf.DefaultConfig)
if err != nil {
return capabilities.CapabilityConfiguration{}, err
}

return capabilities.CapabilityConfiguration{
DefaultConfig: dc,
RemoteTriggerConfig: remoteTriggerConfig,
RemoteTargetConfig: remoteTargetConfig,
}, nil
}

func (s *registrySyncer) localRegistry(ctx context.Context) (*LocalRegistry, error) {
var caps []kcr.CapabilitiesRegistryCapabilityInfo
err := s.reader.GetLatestValue(ctx, "CapabilitiesRegistry", "getCapabilities", primitives.Unconfirmed, nil, &caps)
Expand Down

0 comments on commit c822f70

Please sign in to comment.