-
Notifications
You must be signed in to change notification settings - Fork 237
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
Support Alchemy in get_logs #180
Conversation
From `ethereum::tests` to `ethereum`.
Alchemy uses a different error format.
Currently supports Infura and Alchemy services.
f7b34b6
to
a7c94c8
Compare
Alchemy gives custom server errors for: - query exceeded timeout, and - query block range includes an unknown block number
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 👍 ,maybe add some more trace!
s?
Err(web3::Error::Rpc(err)) if err.code.code() == RpcErrorCode::LimitExceeded.code() => { | ||
return Err(GetLogsError::QueryLimit) | ||
Err(Rpc(err)) if err.code.code() == LimitExceeded.code() => { | ||
return Err(GetLogsError::QueryLimit); |
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.
Maybe it would be useful to trace!
when we hit the limit on infura & alchemy too?
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.
I wasn't sure since its a valid, expected response. And it does occur quite regularly. If anything I guess one would add these traces in the calling function?
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.
Oh,if it happens often then yes, definitely.
This PR adds support for the Alchemy Ethereum endpoint.
Background
Querying for Ethereum logs can result in a filter range which is too large i.e. the query would return too many values. Generally, the Ethereum endpoint returns the
LimitExceeded
RPC error, however it turns out the Alchemy usesInvalidParams
to indicate this instead.In addition, Alchemy also throws custom errors when
This PR includes supporting those.
Other included work
Our CI currently only run Ethereum tests against the Infura endpoint specified in our Github secrets. I've added secrets for Alchemy and renamed the secrets to be less general. The CI now runs the Ethereum tests twice, once each for Infura and Alchemy endpoints.
Other comments
Overall, this Ethereum "interface" could use a larger refactor including a CI overhaul to make testing these specific endpoints more obvious. And adding dependency injection for things like
get_logs
and other related, more complicated things so that we can test scenarios without relying on an actual Ethereum endpoint directly.As part of this overhaul we should also somehow test / imitate other likely Ethereum node types directly if possible.
Closes #42.