Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BCI-3989][common] - CR methods err when service unstarted #705

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
352adfe
check cr service is started
Farber98 Aug 14, 2024
173eca4
small refactor
Farber98 Aug 15, 2024
e16b694
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Aug 15, 2024
0d8a1b0
remove unused error
Farber98 Aug 15, 2024
af1fabf
bind before start
Farber98 Aug 15, 2024
4dcb052
add comments to tests
Farber98 Aug 15, 2024
4d966e6
startChainReader method
Farber98 Aug 15, 2024
5006bec
check methods return error when called without starting service
Farber98 Aug 16, 2024
cc3066b
Revert "check methods return error when called without starting service"
Farber98 Aug 16, 2024
b697ce2
service started checked working for both get latest value methods
Farber98 Aug 16, 2024
855b38c
close chain reader after tests
Farber98 Aug 16, 2024
fe91e30
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Aug 22, 2024
0cf190e
remove duplicate fields
Farber98 Aug 22, 2024
8e1388b
rename interface tester new methods
Farber98 Aug 23, 2024
72d3790
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Aug 23, 2024
215fb70
make start and close safe for concurrent use
Farber98 Aug 23, 2024
585ccc9
use atomic bool for isStarted flag
Farber98 Aug 24, 2024
81aaf5c
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Aug 26, 2024
1830e25
remove start as only closed is needed
Farber98 Aug 26, 2024
dd6363c
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Aug 28, 2024
dd26cd7
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Aug 28, 2024
50c55ef
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Aug 29, 2024
699bdf8
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Aug 30, 2024
fa1ace8
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Sep 3, 2024
bed6fbf
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Sep 4, 2024
208ef02
add start method to the interface. add start and close calls where ne…
Farber98 Sep 4, 2024
a453d2d
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Sep 5, 2024
0d7af20
fix conflicts with chain components pr
Farber98 Sep 5, 2024
647bdde
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Sep 12, 2024
489fd0a
fix pr conflicts
Farber98 Sep 12, 2024
e8ed82b
add flag to control if we return cr started
Farber98 Sep 15, 2024
66ba7cd
fix encodings iface
Farber98 Sep 15, 2024
392195f
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Sep 15, 2024
4e67d8d
refactor codec and chaincomponents ifaces
Farber98 Sep 16, 2024
54d7016
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Sep 16, 2024
e728084
Revert "Merge branch 'main' into BCI-3989-cr-methods-error-when-unsta…
Farber98 Sep 16, 2024
953d786
Reapply "Merge branch 'main' into BCI-3989-cr-methods-error-when-unst…
Farber98 Sep 17, 2024
f94c2c9
Merge branch 'main' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Sep 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"sort"
"strings"
"sync"
"sync/atomic"
"testing"
"time"

Expand Down Expand Up @@ -311,6 +312,18 @@ func (it *fakeContractReaderInterfaceTester) GetChainWriter(_ *testing.T) types.

func (it *fakeContractReaderInterfaceTester) DirtyContracts() {}

func (it *fakeContractReaderInterfaceTester) StartContractReader(t *testing.T) {
fake, ok := it.impl.(*fakeContractReader)
assert.True(t, ok)
require.NoError(t, fake.Start(context.Background()))
}

func (it *fakeContractReaderInterfaceTester) CloseContractReader(t *testing.T) {
fake, ok := it.impl.(*fakeContractReader)
assert.True(t, ok)
require.NoError(t, fake.Close())
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having trouble seeing why we need these helper methods. impl is already a ContractReader, so we don't need to cast it to a specific fake type:

Suggested change
func (it *fakeContractReaderInterfaceTester) StartContractReader(t *testing.T) {
fake, ok := it.impl.(*fakeContractReader)
assert.True(t, ok)
require.NoError(t, fake.Start(context.Background()))
}
func (it *fakeContractReaderInterfaceTester) CloseContractReader(t *testing.T) {
fake, ok := it.impl.(*fakeContractReader)
assert.True(t, ok)
require.NoError(t, fake.Close())
}
func (it *fakeContractReaderInterfaceTester) StartContractReader(t *testing.T) {
require.NoError(t, it.impl.Start(context.Background()))
}
func (it *fakeContractReaderInterfaceTester) CloseContractReader(t *testing.T) {
require.NoError(t, it.impl.Close())
}

Additionally, there is already a GetContractReader method, so callers that are doing this:

	tester.StartContractReader(t)
	defer tester.CloseContractReader(t)

Could instead do this:

	tester.GetContractReader(t).Start(ctx)
	defer tester.GetContractReader(t).Close()

Or better yet:

	servicetest.Run(t, tester.GetContractReader(t))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmank88 @silaslenihan I couldn't do it this way. Tests fail for the loop relay client.

Pushed some changes with a new idea:

  • Modify testCases and Setup to receive a startCR flag and control whether we should start CR or not
  • With this, Start and Close will be handled by Setup with Cleanup

All tests are passing, including new ones where we test that the service does not start. Let me know your thoughts

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please update the description? I'm having trouble understanding the fundamental problem we are trying to solve.

Copy link
Collaborator

@jmank88 jmank88 Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the BasicTester interface is used more generally than for just contract reader, I don't think it makes sense to add a contract-reader-only argument to BasicTester.Setup.

Copy link
Contributor Author

@Farber98 Farber98 Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fundamental problem we are trying to solve: We only want GetLatestValue, BatchGetLatestValue and QueryKey to be called when the service CR is in Started state. If CR has not yet been started, we should return an error.

To test this new behavior, we need a way to get the CR in both states (started and not started).

We can't just call Start and Close directly on the return of GetContractReader to achieve this. This is because we also run relay client loop tests here. We are calling Start and Close on the client and not on the server as would be required.

The two solutions I proposed were aimed at solving this problem, the one with the helper methods and now the one with the flag. I feel like the one with the flag is cleaner. We are providing in the testCase the startCR flag to determine if the underlying Setup function should return the service in started or unstarted state

What do you think about defining a new interface similar to BasicTester but use it specifically on contract-reader?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't just call Start and Close directly on the return of GetContractReader to achieve this. This is because we also run relay client loop tests here. We are calling Start and Close on the client and not on the server as would be required.

The two solutions I proposed were aimed at solving this problem, the one with the helper methods and now the one with the flag.

Something isn't adding up here. The modification that I proposed to your helper methods was intended to execute exactly equivalently. It was not proposing a change in behavior - definitely not one that switched from client to server or vice versa. If the helper method solution was valid, then we should revisit it, but in the most simplified form.

Copy link
Contributor Author

@Farber98 Farber98 Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a new solution with interfaces refactor and comments on changes. If do you think it's okay we can go with it. Else, I'll revisit the one with the helper methods in the most simplified form


func (it *fakeContractReaderInterfaceTester) GetBindings(_ *testing.T) []types.BoundContract {
return []types.BoundContract{
{Name: AnyContractName, Address: AnyContractName},
Expand Down Expand Up @@ -345,8 +358,11 @@ type fakeContractReader struct {
stored []TestStruct
batchStored BatchCallEntry
lock sync.Mutex
isStarted atomic.Bool
}

var errServiceNotStarted = errors.New("ContractReader service not started")

type fakeChainWriter struct {
types.ChainWriter
cr *fakeContractReader
Expand Down Expand Up @@ -393,9 +409,15 @@ func (f *fakeChainWriter) GetFeeComponents(ctx context.Context) (*types.ChainFee
return &types.ChainFeeComponents{}, nil
}

func (f *fakeContractReader) Start(_ context.Context) error { return nil }
func (f *fakeContractReader) Start(_ context.Context) error {
f.isStarted.Store(true)
return nil
}

func (f *fakeContractReader) Close() error { return nil }
func (f *fakeContractReader) Close() error {
f.isStarted.Store(false)
return nil
}

func (f *fakeContractReader) Ready() error { panic("unimplemented") }

Expand Down Expand Up @@ -433,6 +455,10 @@ func (f *fakeContractReader) SetBatchLatestValues(batchCallEntry BatchCallEntry)
}

func (f *fakeContractReader) GetLatestValue(_ context.Context, readIdentifier string, confidenceLevel primitives.ConfidenceLevel, params, returnVal any) error {
if !f.isStarted.Load() {
return errServiceNotStarted
}

if strings.HasSuffix(readIdentifier, MethodReturningAlterableUint64) {
r := returnVal.(*uint64)
for i := len(f.vals) - 1; i >= 0; i-- {
Expand Down Expand Up @@ -507,6 +533,10 @@ func (f *fakeContractReader) GetLatestValue(_ context.Context, readIdentifier st
}

func (f *fakeContractReader) BatchGetLatestValues(_ context.Context, request types.BatchGetLatestValuesRequest) (types.BatchGetLatestValuesResult, error) {
if !f.isStarted.Load() {
return nil, errServiceNotStarted
}

result := make(types.BatchGetLatestValuesResult)
for requestContract, requestContractBatch := range request {
storedContractBatch := f.batchStored[requestContract]
Expand Down Expand Up @@ -560,6 +590,10 @@ func (f *fakeContractReader) BatchGetLatestValues(_ context.Context, request typ
}

func (f *fakeContractReader) QueryKey(_ context.Context, _ types.BoundContract, filter query.KeyFilter, limitAndSort query.LimitAndSort, _ any) ([]types.Sequence, error) {
if !f.isStarted.Load() {
return nil, errServiceNotStarted
}

if filter.Key == EventName {
f.lock.Lock()
defer f.lock.Unlock()
Expand Down
96 changes: 96 additions & 0 deletions pkg/types/interfacetests/chain_components_interface_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
type ChainComponentsInterfaceTester[T TestingT[T]] interface {
BasicTester[T]
GetContractReader(t T) types.ContractReader
StartContractReader(t T)
CloseContractReader(t T)
GetChainWriter(t T) types.ChainWriter
GetBindings(t T) []types.BoundContract
// DirtyContracts signals to the underlying tester than the test contracts are dirty, i.e. the state has been changed such that
Expand Down Expand Up @@ -59,6 +61,17 @@ func RunContractReaderInterfaceTests[T TestingT[T]](t T, tester ChainComponentsI

func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester ChainComponentsInterfaceTester[T], mockRun bool) {
tests := []testcase[T]{
{
name: "Get latest value without starting service returns error",
test: func(t T) {
ctx := tests.Context(t)
cr := tester.GetContractReader(t)
bindings := tester.GetBindings(t)
bound := bindingsByName(bindings, AnyContractName)[0] // minimum of one bound contract expected, otherwise panics
require.NoError(t, cr.Bind(ctx, tester.GetBindings(t)))
require.Error(t, cr.GetLatestValue(ctx, bound.ReadIdentifier(MethodTakingLatestParamsReturningTestStruct), primitives.Unconfirmed, nil, nil))
},
},
{
name: "Gets the latest value",
test: func(t T) {
Expand All @@ -77,6 +90,8 @@ func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester Ch
bound := bindingsByName(bindings, AnyContractName)[0] // minimum of one bound contract expected, otherwise panics

require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

actual := &TestStruct{}
params := &LatestParams{I: 1}
Expand All @@ -98,6 +113,8 @@ func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester Ch
bound := bindingsByName(bindings, AnyContractName)[0]

require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

var prim uint64
require.NoError(t, cr.GetLatestValue(ctx, bound.ReadIdentifier(MethodReturningUint64), primitives.Unconfirmed, nil, &prim))
Expand All @@ -113,6 +130,8 @@ func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester Ch
bindings := tester.GetBindings(t)

require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

var returnVal1 uint64
callArgs := ExpectedGetLatestValueArgs{
Expand Down Expand Up @@ -154,6 +173,8 @@ func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester Ch
bound := bindingsByName(bindings, AnySecondContractName)[0]

require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

var prim uint64
require.NoError(t, cr.GetLatestValue(ctx, bound.ReadIdentifier(MethodReturningUint64), primitives.Unconfirmed, nil, &prim))
Expand All @@ -170,6 +191,8 @@ func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester Ch
bound := bindingsByName(bindings, AnyContractName)[0]

require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

var slice []uint64
require.NoError(t, cr.GetLatestValue(ctx, bound.ReadIdentifier(MethodReturningUint64Slice), primitives.Unconfirmed, nil, &slice))
Expand All @@ -190,6 +213,8 @@ func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester Ch

cr := tester.GetContractReader(t)
require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

actual := &TestStructWithExtraField{}
require.NoError(t, cr.GetLatestValue(ctx, bound.ReadIdentifier(MethodReturningSeenStruct), primitives.Unconfirmed, testStruct, actual))
Expand All @@ -211,6 +236,8 @@ func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester Ch
bound := bindingsByName(bindings, AnyContractName)[0]

require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)
contracts := tester.GetBindings(t)

ts := CreateTestStruct[T](0, tester)
Expand All @@ -235,6 +262,8 @@ func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester Ch
bound := bindingsByName(bindings, AnyContractName)[0]

require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)
ts1 := CreateTestStruct[T](2, tester)

txID := SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts1, bindings[0], types.Unconfirmed)
Expand Down Expand Up @@ -271,6 +300,8 @@ func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester Ch
bound := bindingsByName(bindings, AnyContractName)[0]

require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

result := &TestStruct{}
err := cr.GetLatestValue(ctx, bound.ReadIdentifier(EventName), primitives.Unconfirmed, nil, &result)
Expand All @@ -286,6 +317,8 @@ func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester Ch
bound := bindingsByName(bindings, AnyContractName)[0]

require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)
ts0 := CreateTestStruct(0, tester)

contracts := tester.GetBindings(t)
Expand Down Expand Up @@ -314,6 +347,37 @@ func runContractReaderGetLatestValueInterfaceTests[T TestingT[T]](t T, tester Ch

func runContractReaderBatchGetLatestValuesInterfaceTests[T TestingT[T]](t T, tester ChainComponentsInterfaceTester[T], mockRun bool) {
testCases := []testcase[T]{
{
name: "BatchGetLatestValues without starting service returns error",
test: func(t T) {
// setup test data
firstItem := CreateTestStruct(1, tester)
bindings := tester.GetBindings(t)
bound := bindingsByName(bindings, AnyContractName)[0]

batchCallEntry := make(BatchCallEntry)
batchCallEntry[bound] = ContractBatchEntry{{Name: MethodTakingLatestParamsReturningTestStruct, ReturnValue: &firstItem}}
batchChainWrite(t, tester, batchCallEntry, mockRun)

// setup call data
params, actual := &LatestParams{I: 1}, &TestStruct{}
batchGetLatestValueRequest := make(types.BatchGetLatestValuesRequest)
batchGetLatestValueRequest[bound] = []types.BatchRead{
{
ReadName: MethodTakingLatestParamsReturningTestStruct,
Params: params,
ReturnVal: actual,
},
}

ctx := tests.Context(t)
cr := tester.GetContractReader(t)

require.NoError(t, cr.Bind(ctx, tester.GetBindings(t)))
_, err := cr.BatchGetLatestValues(ctx, batchGetLatestValueRequest)
require.Error(t, err)
},
},
{
name: "BatchGetLatestValues works",
test: func(t T) {
Expand Down Expand Up @@ -341,6 +405,8 @@ func runContractReaderBatchGetLatestValuesInterfaceTests[T TestingT[T]](t T, tes
cr := tester.GetContractReader(t)

require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)
result, err := cr.BatchGetLatestValues(ctx, batchGetLatestValueRequest)
require.NoError(t, err)

Expand Down Expand Up @@ -371,6 +437,8 @@ func runContractReaderBatchGetLatestValuesInterfaceTests[T TestingT[T]](t T, tes
ctx := tests.Context(t)
cr := tester.GetContractReader(t)
require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

result, err := cr.BatchGetLatestValues(ctx, batchGetLatestValuesRequest)
require.NoError(t, err)
Expand All @@ -397,6 +465,8 @@ func runContractReaderBatchGetLatestValuesInterfaceTests[T TestingT[T]](t T, tes
ctx := tests.Context(t)
cr := tester.GetContractReader(t)
require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

result, err := cr.BatchGetLatestValues(ctx, batchGetLatestValuesRequest)
require.NoError(t, err)
Expand Down Expand Up @@ -426,6 +496,8 @@ func runContractReaderBatchGetLatestValuesInterfaceTests[T TestingT[T]](t T, tes
ctx := tests.Context(t)
cr := tester.GetContractReader(t)
require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)
result, err := cr.BatchGetLatestValues(ctx, batchGetLatestValueRequest)
require.NoError(t, err)

Expand Down Expand Up @@ -453,6 +525,8 @@ func runContractReaderBatchGetLatestValuesInterfaceTests[T TestingT[T]](t T, tes
ctx := tests.Context(t)
cr := tester.GetContractReader(t)
require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)
result, err := cr.BatchGetLatestValues(ctx, batchGetLatestValueRequest)
require.NoError(t, err)

Expand Down Expand Up @@ -491,6 +565,8 @@ func runContractReaderBatchGetLatestValuesInterfaceTests[T TestingT[T]](t T, tes
ctx := tests.Context(t)
cr := tester.GetContractReader(t)
require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

result, err := cr.BatchGetLatestValues(ctx, batchGetLatestValueRequest)
require.NoError(t, err)
Expand Down Expand Up @@ -527,6 +603,8 @@ func runContractReaderBatchGetLatestValuesInterfaceTests[T TestingT[T]](t T, tes
ctx := tests.Context(t)
cr := tester.GetContractReader(t)
require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

result, err := cr.BatchGetLatestValues(ctx, batchGetLatestValueRequest)
require.NoError(t, err)
Expand Down Expand Up @@ -569,6 +647,8 @@ func runContractReaderBatchGetLatestValuesInterfaceTests[T TestingT[T]](t T, tes
ctx := tests.Context(t)
cr := tester.GetContractReader(t)
require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

result, err := cr.BatchGetLatestValues(ctx, batchGetLatestValueRequest)
require.NoError(t, err)
Expand All @@ -592,6 +672,18 @@ func runContractReaderBatchGetLatestValuesInterfaceTests[T TestingT[T]](t T, tes

func runQueryKeyInterfaceTests[T TestingT[T]](t T, tester ChainComponentsInterfaceTester[T]) {
tests := []testcase[T]{
{
name: "QueryKey without starting service returns error",
test: func(t T) {
ctx := tests.Context(t)
cr := tester.GetContractReader(t)
bindings := tester.GetBindings(t)
bound := bindingsByName(bindings, AnyContractName)[0]
require.NoError(t, cr.Bind(ctx, tester.GetBindings(t)))
_, err := cr.QueryKey(ctx, bound, query.KeyFilter{Key: EventName}, query.LimitAndSort{}, &TestStruct{})
require.Error(t, err)
},
},
{
name: "QueryKey returns not found if sequence never happened",
test: func(t T) {
Expand All @@ -601,6 +693,8 @@ func runQueryKeyInterfaceTests[T TestingT[T]](t T, tester ChainComponentsInterfa
bound := bindingsByName(bindings, AnyContractName)[0]

require.NoError(t, cr.Bind(ctx, tester.GetBindings(t)))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)

logs, err := cr.QueryKey(ctx, bound, query.KeyFilter{Key: EventName}, query.LimitAndSort{}, &TestStruct{})

Expand All @@ -616,6 +710,8 @@ func runQueryKeyInterfaceTests[T TestingT[T]](t T, tester ChainComponentsInterfa
bindings := tester.GetBindings(t)

require.NoError(t, cr.Bind(ctx, bindings))
tester.StartContractReader(t)
defer tester.CloseContractReader(t)
bound := bindingsByName(bindings, AnyContractName)[0]

ts1 := CreateTestStruct[T](0, tester)
Expand Down
Loading