-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Created a GetFilters function for the logpoller #12621
Conversation
I see you updated files related to |
filters := th.LogPoller.GetFilters() | ||
assert.Equal(t, 3, len(filters)) | ||
assert.True(t, filters["first Filter"].Name == "first Filter") | ||
assert.True(t, reflect.DeepEqual(filters["first Filter"].EventSigs, filter1.EventSigs)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to call reflect.DeepEqual
here, that's already called internally by assert.Equal
. For example, this should work:
assert.True(t, reflect.DeepEqual(filters["first Filter"].EventSigs, filter1.EventSigs)) | |
assert.Equal(t, filter1.EventSigs, filters["first Filter"].EventSigs) |
Actually, all 3 fields could be probably be compared in just one line:
assert.Equal(t, filter1, filters["first Filter"])
But we'd have to add Topic2, Topic3, & Topic4 in the original definition of filter1:
Topic2: evmtypes.HashArray{},
Topic3: evmtypes.HashArray{},
Topic4: evmtypes.HashArray{},
Either way is fine with me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I just decided to use assert.Equal everywhere to remove the use of reflect
. I think this should be fine.
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
The GetFilters method should return a full deep copy of the underlying lp.filters mapping with no pointers whatsoever to the original mapping.
This will be used by Functions to facilitate cleaning up old filters for previous contract versions which are no longer in use.
See here for context: https://chainlink-core.slack.com/archives/C03RCTX5RU0/p1711494411843329