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

fix: add max results error and default raw codec for eth_getLogs #12671

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

akaladarshi
Copy link
Contributor

Related Issues

#12636

Proposed Changes

  • Adds raw codec while filtering ethereum logs
  • Error out if we hit max result

Checklist

Before you mark the PR ready for review, please make sure that:

@@ -563,6 +566,9 @@ func makePrefillFilterQuery(f *EventFilter) ([]any, string, error) {
clauses = append(clauses, "("+strings.Join(subclauses, " OR ")+")")
}
}
} else {
clauses = append(clauses, "ee.codec=?")
values = append(values, uint64(multicodec.Raw))
Copy link
Member

Choose a reason for hiding this comment

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

This won't work because we call this method from both the eth APIs and also GetActorEventsRaw and SubscribeActorEventsRaw and these APIs want any codec if they don't specify a KeysWithCodec.

I think what you might need to do is extend EventFilter to add a OnlyRaw, or WithCodec or something like that so that when this gets called from the Eth APIs, that can be set so we can restrict to Raw only.

Copy link
Contributor Author

@akaladarshi akaladarshi Nov 7, 2024

Choose a reason for hiding this comment

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

Yeah while testing I realised this. So after going over the code I agree with you on extending the EventFilter.

I am in favour of adding an optional field in EventFilter suggesting, filtering based on this codec if keys are not available.

Codec *uint64 // Optional codec filter, used only if keys are not available

Note: We can also use array of codecs, but I don't think it will be useful because we only use two codecs (CBOR and RAW) to filter from.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, for now just Codec is fine, "only used if KeysWithCodec is not set"

@akaladarshi akaladarshi marked this pull request as ready for review November 7, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📌 Triage
Development

Successfully merging this pull request may close these issues.

2 participants