diff --git a/core/capabilities/encoder_factory.go b/core/capabilities/encoder_factory.go new file mode 100644 index 00000000000..73e129bd855 --- /dev/null +++ b/core/capabilities/encoder_factory.go @@ -0,0 +1,21 @@ +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? + // https://smartcontract-it.atlassian.net/browse/CAPPL-88 + default: + return nil, fmt.Errorf("encoder %s not supported", name) + } +} diff --git a/core/capabilities/integration_tests/setup.go b/core/capabilities/integration_tests/setup.go index f419c05e6c3..1d0ec183e69 100644 --- a/core/capabilities/integration_tests/setup.go +++ b/core/capabilities/integration_tests/setup.go @@ -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" ) @@ -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, AggregatorFactory: capabilities.NewAggregator, RequestTimeout: &requestTimeout, } diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 59d3237c1cd..bfa6fb88fac 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/client_golang v1.20.0 github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chainlink-automation v1.0.4 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715 + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240927162447-20630b333f57 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 github.com/spf13/cobra v1.8.1 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index f342177bae6..b83609e38a7 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1083,8 +1083,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240927145425-578a50b4d7c5 h1:958op4dZQK46g4zk9gQTj0GLa2G+jbuj4oHAnneJ4PI= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240927145425-578a50b4d7c5/go.mod h1:Q51RNKBrkqSJ0U2bwGQx4RL2X7c1qUL3NXVZF2kmCUA= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715 h1:6s5a5g62qvUiHSyknLLw9h8Y0FfdVEsNHc5o/Q/T9w4= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240927162447-20630b333f57 h1:pRiTiFOkPEyvgG0hchcCSZzwUbwYydnZBu0QbVaRnVk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240927162447-20630b333f57/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/go.mod b/go.mod index 4ceef28815f..d0613e07623 100644 --- a/go.mod +++ b/go.mod @@ -75,7 +75,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20240927145425-578a50b4d7c5 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715 + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926153211-84ed150bf0bc github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f diff --git a/go.sum b/go.sum index 683db367311..b2d69e2315e 100644 --- a/go.sum +++ b/go.sum @@ -1044,8 +1044,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240927145425-578a50b4d7c5 h1:958op4dZQK46g4zk9gQTj0GLa2G+jbuj4oHAnneJ4PI= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240927145425-578a50b4d7c5/go.mod h1:Q51RNKBrkqSJ0U2bwGQx4RL2X7c1qUL3NXVZF2kmCUA= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715 h1:6s5a5g62qvUiHSyknLLw9h8Y0FfdVEsNHc5o/Q/T9w4= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926153211-84ed150bf0bc h1:MkdQaT7yADpOAdmIuFSHq6rUKOchqLc0bY+Qt3nrjG4= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926153211-84ed150bf0bc/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 049000bf450..ab5a83f995e 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -40,7 +40,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.23 github.com/smartcontractkit/chainlink-automation v1.0.4 github.com/smartcontractkit/chainlink-ccip v0.0.0-20240927145425-578a50b4d7c5 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715 + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240927162447-20630b333f57 github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.0 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 455d891c812..590e4155b6e 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1425,8 +1425,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240927145425-578a50b4d7c5 h1:958op4dZQK46g4zk9gQTj0GLa2G+jbuj4oHAnneJ4PI= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240927145425-578a50b4d7c5/go.mod h1:Q51RNKBrkqSJ0U2bwGQx4RL2X7c1qUL3NXVZF2kmCUA= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715 h1:6s5a5g62qvUiHSyknLLw9h8Y0FfdVEsNHc5o/Q/T9w4= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240927162447-20630b333f57 h1:pRiTiFOkPEyvgG0hchcCSZzwUbwYydnZBu0QbVaRnVk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240927162447-20630b333f57/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 2c19b0cadb2..49c7f1d43d4 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -15,7 +15,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.33.0 github.com/slack-go/slack v0.12.2 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715 + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240927162447-20630b333f57 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1 github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index aec6ba02de0..a59cc20777a 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1399,8 +1399,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240927145425-578a50b4d7c5 h1:958op4dZQK46g4zk9gQTj0GLa2G+jbuj4oHAnneJ4PI= github.com/smartcontractkit/chainlink-ccip v0.0.0-20240927145425-578a50b4d7c5/go.mod h1:Q51RNKBrkqSJ0U2bwGQx4RL2X7c1qUL3NXVZF2kmCUA= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715 h1:6s5a5g62qvUiHSyknLLw9h8Y0FfdVEsNHc5o/Q/T9w4= -github.com/smartcontractkit/chainlink-common v0.2.3-0.20240925150249-664dd5a59715/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240927162447-20630b333f57 h1:pRiTiFOkPEyvgG0hchcCSZzwUbwYydnZBu0QbVaRnVk= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240927162447-20630b333f57/go.mod h1:F6WUS6N4mP5ScwpwyTyAJc9/vjR+GXbMCRUOVekQi1g= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo= github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 h1:yRk4ektpx/UxwarqAfgxUXLrsYXlaNeP1NOwzHGrK2Q= diff --git a/plugins/cmd/chainlink-ocr3-capability/main.go b/plugins/cmd/chainlink-ocr3-capability/main.go index c70a5a6f2ad..fad82c7b73b 100644 --- a/plugins/cmd/chainlink-ocr3-capability/main.go +++ b/plugins/cmd/chainlink-ocr3-capability/main.go @@ -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 ( @@ -24,7 +23,7 @@ func main() { c := ocr3.Config{ Logger: s.Logger, - EncoderFactory: evm.NewEVMEncoder, + EncoderFactory: capabilities.NewEncoder, AggregatorFactory: capabilities.NewAggregator, } p := ocr3.NewOCR3(c)