diff --git a/go.mod b/go.mod index 5d1af3ade..a0038a463 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.20250220121220-38bb770d2435 + github.com/smartcontractkit/chainlink-common v0.4.2-0.20250219182448-627ef4d2dd99 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 c2587e3dd..58dcd18f5 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.20250220121220-38bb770d2435 h1:wRN3tiCGcKljlBvY3C6BLi7xlG2ADP9g3js+EfsW8mc= -github.com/smartcontractkit/chainlink-common v0.4.2-0.20250220121220-38bb770d2435/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68= +github.com/smartcontractkit/chainlink-common v0.4.2-0.20250219182448-627ef4d2dd99 h1:mrVHrCLT/bfjhLuizS+w4BLwbqAmzsLh9pe3mLb9LnE= +github.com/smartcontractkit/chainlink-common v0.4.2-0.20250219182448-627ef4d2dd99/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 0ba944dc6..bddb38251 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -16,7 +16,7 @@ require ( github.com/pelletier/go-toml/v2 v2.2.3 github.com/rs/zerolog v1.33.0 github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250206215114-fb6c3c35e8e3 - github.com/smartcontractkit/chainlink-common v0.4.2-0.20250220121220-38bb770d2435 + github.com/smartcontractkit/chainlink-common v0.4.2-0.20250220161312-995ae85d9818 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 7f02e99de..d9f9b07e4 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.20250220121220-38bb770d2435 h1:wRN3tiCGcKljlBvY3C6BLi7xlG2ADP9g3js+EfsW8mc= -github.com/smartcontractkit/chainlink-common v0.4.2-0.20250220121220-38bb770d2435/go.mod h1:Z2e1ynSJ4pg83b4Qldbmryc5lmnrI3ojOdg1FUloa68= +github.com/smartcontractkit/chainlink-common v0.4.2-0.20250220161312-995ae85d9818 h1:qZHSb2a4lnmqJNxav1rYhIl0+1IRPRXKmgFsd9CagT0= +github.com/smartcontractkit/chainlink-common v0.4.2-0.20250220161312-995ae85d9818/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/integration-tests/relayinterface/chain_components_test.go b/integration-tests/relayinterface/chain_components_test.go index 1706f9377..7ce37c213 100644 --- a/integration-tests/relayinterface/chain_components_test.go +++ b/integration-tests/relayinterface/chain_components_test.go @@ -95,14 +95,16 @@ func DisableTests(it *SolanaChainComponentsInterfaceTester[*testing.T]) { ContractReaderBatchGetLatestValue, ContractReaderBatchGetLatestValueDifferentParamsResultsRetainOrder, ContractReaderBatchGetLatestValueDifferentParamsResultsRetainOrderMultipleContracts, - // events not yet supported - ContractReaderGetLatestValueGetsLatestForEvent, + + // tests to enable + // ContractReaderQueryKeyNotFound, + // ContractReaderQueryKeyReturnsData, + // ContractReaderGetLatestValueGetsLatestForEvent, ContractReaderGetLatestValueBasedOnConfidenceLevelForEvent, ContractReaderGetLatestValueReturnsNotFoundWhenNotTriggeredForEvent, ContractReaderGetLatestValueWithFilteringForEvent, - // query key not fully implemented yet - ContractReaderQueryKeyReturnsDataAsValuesDotValue, - ContractReaderQueryKeyCanLimitResultsWithCursor, + + // QueryKeys not implemented ContractReaderQueryKeysReturnsDataTwoEventTypes, ContractReaderQueryKeysNotFound, ContractReaderQueryKeysReturnsData, @@ -1057,6 +1059,21 @@ func (it *SolanaChainComponentsInterfaceTester[T]) buildContractReaderConfig(t T EventName: { ChainSpecificName: "TestEvent", ReadType: config.Event, + InputModifications: commoncodec.ModifiersConfig{ + &commoncodec.PropertyExtractorConfig{ + FieldName: "Data", + EnablePathTraverse: true, + }, + &commoncodec.AddressBytesToStringModifierConfig{ + Fields: []string{"AccountStruct.AccountStr"}, + EnablePathTraverse: true, + }, + &commoncodec.ConstrainedBytesToStringModifierConfig{ + Fields: []string{"DifferentField", "NestedDynamicStruct.Inner.S"}, + EnablePathTraverse: true, + MaxLen: 32, + }, + }, OutputModifications: commoncodec.ModifiersConfig{ &commoncodec.PropertyExtractorConfig{FieldName: "Data"}, &commoncodec.AddressBytesToStringModifierConfig{ diff --git a/pkg/solana/chainreader/batch.go b/pkg/solana/chainreader/batch.go index f715216f9..4849a2fc9 100644 --- a/pkg/solana/chainreader/batch.go +++ b/pkg/solana/chainreader/batch.go @@ -81,6 +81,8 @@ func doMethodBatchCall(ctx context.Context, lggr logger.Logger, client MultipleA // map batch call index to key index (some calls are event reads and will be handled by a different binding) dataMap := make(map[int]int) + eventMap := make(map[int]struct{}) + for idx, batchCall := range batch { rBinding, err := bdRegistry.GetReader(batchCall.Namespace, batchCall.ReadName) if err != nil { @@ -102,6 +104,7 @@ func doMethodBatchCall(ctx context.Context, lggr logger.Logger, client MultipleA } results[idx].err = eBinding.GetLatestValue(ctx, batchCall.Params, results[idx].returnVal) + eventMap[idx] = struct{}{} continue } @@ -120,6 +123,10 @@ func doMethodBatchCall(ctx context.Context, lggr logger.Logger, client MultipleA // decode batch call results for idx, batchCall := range batch { + if _, ok := eventMap[idx]; ok { + continue + } + dataIdx, ok := dataMap[idx] if !ok { return nil, fmt.Errorf("%w: unexpected data index state", types.ErrInternal) diff --git a/pkg/solana/chainreader/event_read_binding.go b/pkg/solana/chainreader/event_read_binding.go index e4ba9be5a..6dd45ef1f 100644 --- a/pkg/solana/chainreader/event_read_binding.go +++ b/pkg/solana/chainreader/event_read_binding.go @@ -300,7 +300,7 @@ func (b *eventReadBinding) extractFilterSubkeys(offChainParams any) ([]query.Exp fieldVal, err := valueForPath(reflect.ValueOf(offChainParams), offChainKey) if err != nil { - return nil, fmt.Errorf("%w: no value for path %s", types.ErrInternal, b.genericName+"."+offChainKey) + return nil, fmt.Errorf("%w: no value for path %s; err: %w", types.ErrInternal, b.genericName+"."+offChainKey, err) } onChainValue, err := b.modifier.TransformToOnChain(fieldVal, itemType) @@ -521,6 +521,10 @@ func valueForPath(from reflect.Value, itemType string) (any, error) { 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