Skip to content

Commit

Permalink
[CAPPL-60] Use new EncoderFactory interface in ocr3 capability
Browse files Browse the repository at this point in the history
  • Loading branch information
bolekk authored and ettec committed Sep 27, 2024
1 parent f9fe452 commit 1e345c5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
20 changes: 20 additions & 0 deletions core/capabilities/encoder_factory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package capabilities

import (
"fmt"

"github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/values"
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm"
)

func NewEncoder(name string, config *values.Map, lggr logger.Logger) (types.Encoder, error) {
switch name {
case "EVM":
return evm.NewEVMEncoder(config)
// TODO: add a "no-op" encoder for users who only want to use dynamic ones?
default:
return nil, fmt.Errorf("encoder %s not supported", name)
}
}
3 changes: 1 addition & 2 deletions core/capabilities/integration_tests/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocr2key"
p2ptypes "github.com/smartcontractkit/chainlink/v2/core/services/p2p/types"
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm"
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/v3/reportcodec"
"github.com/smartcontractkit/chainlink/v2/core/utils/testutils/heavyweight"
)
Expand Down Expand Up @@ -153,7 +152,7 @@ func createDons(ctx context.Context, t *testing.T, lggr logger.Logger, reportsSi
requestTimeout := 10 * time.Minute
cfg := ocr3.Config{
Logger: lggr,
EncoderFactory: evm.NewEVMEncoder,
EncoderFactory: capabilities.NewEncoder,

Check failure on line 155 in core/capabilities/integration_tests/setup.go

View workflow job for this annotation

GitHub Actions / lint

cannot use capabilities.NewEncoder (value of type func(name string, config *values.Map, lggr "github.com/smartcontractkit/chainlink-common/pkg/logger".Logger) ("github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".Encoder, error)) as "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".EncoderFactory value in struct literal

Check failure on line 155 in core/capabilities/integration_tests/setup.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

cannot use capabilities.NewEncoder (value of type func(name string, config *values.Map, lggr "github.com/smartcontractkit/chainlink-common/pkg/logger".Logger) ("github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".Encoder, error)) as "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".EncoderFactory value in struct literal

Check failure on line 155 in core/capabilities/integration_tests/setup.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

cannot use capabilities.NewEncoder (value of type func(name string, config *values.Map, lggr "github.com/smartcontractkit/chainlink-common/pkg/logger".Logger) ("github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".Encoder, error)) as "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".EncoderFactory value in struct literal

Check failure on line 155 in core/capabilities/integration_tests/setup.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

cannot use capabilities.NewEncoder (value of type func(name string, config *values.Map, lggr "github.com/smartcontractkit/chainlink-common/pkg/logger".Logger) ("github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".Encoder, error)) as "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".EncoderFactory value in struct literal
AggregatorFactory: capabilities.NewAggregator,
RequestTimeout: &requestTimeout,
}
Expand Down
3 changes: 1 addition & 2 deletions plugins/cmd/chainlink-ocr3-capability/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
ocr3rp "github.com/smartcontractkit/chainlink-common/pkg/loop/reportingplugins/ocr3"
"github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink/v2/core/capabilities"
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm"
)

const (
Expand All @@ -24,7 +23,7 @@ func main() {

c := ocr3.Config{
Logger: s.Logger,
EncoderFactory: evm.NewEVMEncoder,
EncoderFactory: capabilities.NewEncoder,

Check failure on line 26 in plugins/cmd/chainlink-ocr3-capability/main.go

View workflow job for this annotation

GitHub Actions / goreleaser-build-publish-chainlink

cannot use capabilities.NewEncoder (value of type func(name string, config *values.Map, lggr "github.com/smartcontractkit/chainlink-common/pkg/logger".Logger) ("github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".Encoder, error)) as "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".EncoderFactory value in struct literal

Check failure on line 26 in plugins/cmd/chainlink-ocr3-capability/main.go

View workflow job for this annotation

GitHub Actions / goreleaser-build-publish-ccip

cannot use capabilities.NewEncoder (value of type func(name string, config *values.Map, lggr "github.com/smartcontractkit/chainlink-common/pkg/logger".Logger) ("github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".Encoder, error)) as "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".EncoderFactory value in struct literal

Check failure on line 26 in plugins/cmd/chainlink-ocr3-capability/main.go

View workflow job for this annotation

GitHub Actions / lint

cannot use capabilities.NewEncoder (value of type func(name string, config *values.Map, lggr "github.com/smartcontractkit/chainlink-common/pkg/logger".Logger) ("github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".Encoder, error)) as "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".EncoderFactory value in struct literal

Check failure on line 26 in plugins/cmd/chainlink-ocr3-capability/main.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

cannot use capabilities.NewEncoder (value of type func(name string, config *values.Map, lggr "github.com/smartcontractkit/chainlink-common/pkg/logger".Logger) ("github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".Encoder, error)) as "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".EncoderFactory value in struct literal

Check failure on line 26 in plugins/cmd/chainlink-ocr3-capability/main.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

cannot use capabilities.NewEncoder (value of type func(name string, config *values.Map, lggr "github.com/smartcontractkit/chainlink-common/pkg/logger".Logger) ("github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".Encoder, error)) as "github.com/smartcontractkit/chainlink-common/pkg/capabilities/consensus/ocr3/types".EncoderFactory value in struct literal
AggregatorFactory: capabilities.NewAggregator,
}
p := ocr3.NewOCR3(c)
Expand Down

0 comments on commit 1e345c5

Please sign in to comment.