From 0e885d32a60086e28ab818f41ee23bdc4cbc4f88 Mon Sep 17 00:00:00 2001 From: Awbrey Hughlett Date: Fri, 21 Feb 2025 13:41:09 -0600 Subject: [PATCH] update reference to common --- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- pkg/solana/chainreader/event_read_binding.go | 39 +------------------- 5 files changed, 7 insertions(+), 44 deletions(-) diff --git a/go.mod b/go.mod index 98e5298c1..81dd5000c 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/prometheus/client_golang v1.20.5 github.com/smartcontractkit/chainlink-ccip v0.0.0-20250203132120-f0d42463e405 github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250206215114-fb6c3c35e8e3 - github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221044241-800d6b475fad + github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221193850-cf5644cdb336 github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250211162441-3d6cea220efb github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919 github.com/stretchr/testify v1.10.0 diff --git a/go.sum b/go.sum index 5118abed6..74985fb1a 100644 --- a/go.sum +++ b/go.sum @@ -584,8 +584,8 @@ github.com/smartcontractkit/chainlink-ccip v0.0.0-20250203132120-f0d42463e405 h1 github.com/smartcontractkit/chainlink-ccip v0.0.0-20250203132120-f0d42463e405/go.mod h1:UEnHaxkUsfreeA7rR45LMmua1Uen95tOFUR8/AI9BAo= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250206215114-fb6c3c35e8e3 h1:f4F/7OCuMybsPKKXXvLQz+Q1hGq07I1cfoWy5EA9iRg= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250206215114-fb6c3c35e8e3/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60= -github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221044241-800d6b475fad h1:n7vQtigsgTKIhrN0FxfO9PpeqOVHNn9GBkQijwjPFBU= -github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221044241-800d6b475fad/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68= +github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221193850-cf5644cdb336 h1:BpKU+vD3k1cDdSFMb49i896PlRTOShM3Vdbd7fChtfM= +github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221193850-cf5644cdb336/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250211162441-3d6cea220efb h1:LWijSyJ2lhppkFLN19EGsLHZXQ5wen2DEk1cyR0tV+o= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250211162441-3d6cea220efb/go.mod h1:4JqpgFy01LaqG1yM2iFTzwX3ZgcAvW9WdstBZQgPHzU= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index dcc73ff81..824587e65 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -16,7 +16,7 @@ require ( github.com/rs/zerolog v1.33.0 github.com/smartcontractkit/chainlink-ccip v0.0.0-20250212131315-e9b53b05b02a github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250206215114-fb6c3c35e8e3 - github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221044241-800d6b475fad + github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221193850-cf5644cdb336 github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250213035259-e727e73f6181 github.com/smartcontractkit/chainlink-testing-framework/lib v1.51.0 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.10 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 2d5949b4c..ad4bd465a 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1104,8 +1104,8 @@ github.com/smartcontractkit/chainlink-ccip v0.0.0-20250212131315-e9b53b05b02a h1 github.com/smartcontractkit/chainlink-ccip v0.0.0-20250212131315-e9b53b05b02a/go.mod h1:Hht/OJq/PxC+gnBCIPyzHt4Otsw6mYwUVsmtOqIvlxo= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250206215114-fb6c3c35e8e3 h1:f4F/7OCuMybsPKKXXvLQz+Q1hGq07I1cfoWy5EA9iRg= github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250206215114-fb6c3c35e8e3/go.mod h1:Bmwq4lNb5tE47sydN0TKetcLEGbgl+VxHEWp4S0LI60= -github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221044241-800d6b475fad h1:n7vQtigsgTKIhrN0FxfO9PpeqOVHNn9GBkQijwjPFBU= -github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221044241-800d6b475fad/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68= +github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221193850-cf5644cdb336 h1:BpKU+vD3k1cDdSFMb49i896PlRTOShM3Vdbd7fChtfM= +github.com/smartcontractkit/chainlink-common v0.4.2-0.20250221193850-cf5644cdb336/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68= github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5 h1:CvDfgWoLoYPapOumE/UZCplfCu5oNmy9BuH+6V6+fJ8= github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20250128203428-08031923fbe5/go.mod h1:pDZagSGjs9U+l4YIFhveDznMHqxuuz+5vRxvVgpbdr8= github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6AnNt+Wg64sVG+XSA49c= diff --git a/pkg/solana/chainreader/event_read_binding.go b/pkg/solana/chainreader/event_read_binding.go index 4fd7d82b1..e9b5fe262 100644 --- a/pkg/solana/chainreader/event_read_binding.go +++ b/pkg/solana/chainreader/event_read_binding.go @@ -298,7 +298,7 @@ func (b *eventReadBinding) extractFilterSubkeys(offChainParams any) ([]query.Exp for offChainKey, idx := range b.indexedSubKeys.lookup { itemType := codec.WrapItemType(true, b.namespace, b.genericName+"."+offChainKey) - fieldVal, err := valueForPath(reflect.ValueOf(offChainParams), offChainKey) + fieldVal, err := commoncodec.ValueForPath(reflect.ValueOf(offChainParams), offChainKey) if err != nil { return nil, fmt.Errorf("%w: no value for path %s; err: %w", types.ErrInternal, b.genericName+"."+offChainKey, err) } @@ -513,40 +513,3 @@ func (k *indexedSubkeys) indexForKey(key string) (uint64, bool) { return idx, ok } - -func valueForPath(from reflect.Value, itemType string) (any, error) { - if itemType == "" { - return from.Interface(), nil - } - - switch from.Kind() { - case reflect.Pointer: - if from.IsNil() { - from = reflect.New(from.Type().Elem()) - } - - elem, err := valueForPath(from.Elem(), itemType) - if err != nil { - return nil, err - } - - return elem, nil - case reflect.Array, reflect.Slice: - return nil, fmt.Errorf("%w: cannot extract a field from an array or slice", types.ErrInvalidType) - case reflect.Struct: - head, tail := commoncodec.ItemTyper(itemType).Next() - - field := from.FieldByName(head) - if !field.IsValid() { - return nil, fmt.Errorf("%w: field not found for path %s and itemType %s", types.ErrInvalidType, from, itemType) - } - - if tail == "" { - return field.Interface(), nil - } - - return valueForPath(field, tail) - default: - return nil, fmt.Errorf("%w: cannot extract a field from kind %s", types.ErrInvalidType, from.Kind()) - } -}