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

LogPoller e2e test fixes #1046

Merged
merged 9 commits into from
Feb 7, 2025
Merged

LogPoller e2e test fixes #1046

merged 9 commits into from
Feb 7, 2025

Conversation

dhaidashenko
Copy link
Collaborator

@dhaidashenko dhaidashenko commented Feb 6, 2025

core ref: 461d94af9431de5ee79447ab6972e3d2f64775fe

PR includes the following fixes:

  1. Makes work with EventSignature and Discriminator consistent.
  2. Ensure that already scheduled get block jobs can be canceled if backfill fails
  3. Recover from panic in case of reflect issues & support non addressable arrays for IndexedValue

err := c.workers.Do(ctx, getBlockJobs[i])
if err != nil {
return nil, fmt.Errorf("could not schedule job to fetch blocks for slot: %w", err)
}
}

c.engine.Go(func(ctx context.Context) {
go func() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

need to cancel this goroutine if iteration gets aborted

@@ -38,7 +38,7 @@ func FuzzExtractorHappyPath(f *testing.F) {

stdDecoded, err := base64.StdEncoding.DecodeString(testString)
if err == nil {
require.Equal(t, stdDecoded[:8], extractor.Extract(testString))
require.Equal(t, [8]byte(stdDecoded[:8]), extractor.Extract(testString))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
require.Equal(t, [8]byte(stdDecoded[:8]), extractor.Extract(testString))
require.Equal(t, [discriminatorLength]byte(stdDecoded[:discriminatorLength]), extractor.Extract(testString))

refcount--
if refcount > 0 {
fl.knownDiscriminators[discriminator] = refcount
fl.knownDiscriminators[filter.EventSig] = refcount
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're renaming filter.DiscriminatorRawBytes() to filter.EventSig, shouldn't we also rename fl.knownDiscriminators to fl.knownEventSigs?

if txIndex > 0 && txIndex < math.MaxInt32 && txLogIndex < math.MaxUint32 {
return int64(txIndex<<32) | int64(txLogIndex), nil
if txIndex >= 0 && txIndex < math.MaxInt32 && txLogIndex < math.MaxUint32 {
return int64(txIndex<<32) | int64(txLogIndex), nil //nolint:gosec
Copy link
Contributor

Choose a reason for hiding this comment

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

Weird, was the linter not complaining about this before and it just started?

Comment on lines +259 to +260
result := make([]byte, v.Len())
l := v.Len()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

Suggested change
result := make([]byte, v.Len())
l := v.Len()
l := v.Len()
result := make([]byte, l)

@@ -240,7 +253,15 @@ func newIndexedValue(typedVal any) (iVal IndexedValue, err error) {
// any length array is fine as long as the element type is byte
if t := v.Type(); t.Kind() == reflect.Array {
if t.Elem().Kind() == reflect.Uint8 {
return v.Bytes(), nil
if v.CanAddr() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, interesting! Had to read up on this a bit just now to understand why this is necessary, but I think I get it.

@reductionista
Copy link
Contributor

reductionista commented Feb 7, 2025

Just had a few minor cosmetic suggestions, but I'll leave it up to you whether or not they're worth taking since we're on a tight schedule.

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 75%)

See analysis details on SonarQube

@toblich toblich merged commit 6e6a2f9 into develop Feb 7, 2025
35 of 36 checks passed
@toblich toblich deleted the fix/logpoller-e2e-test-fixes branch February 7, 2025 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants