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: LogQuery panics on error #2695

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

0xZerohero
Copy link
Contributor

Motivation

LogQuery is supposed to return stream of Results, but it panics on error.

thread 'main' panicked at /home/zerohero/Work/oob/ethers-rs/ethers-providers/src/toolbox/log_query.rs:120:44:
`async fn` resumed after completion
stack backtrace:
   0: rust_begin_unwind
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5
   1: core::panicking::panic_fmt
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:127:5
   3: <ethers_providers::toolbox::log_query::LogQuery<P> as futures_core::stream::Stream>::poll_next::{{closure}}
             at ./ethers-providers/src/toolbox/log_query.rs:120:44
   4: <ethers_providers::toolbox::log_query::LogQuery<P> as futures_core::stream::Stream>::poll_next
             at ./ethers-providers/src/toolbox/log_query.rs:128:72
   5: <futures_util::stream::stream::collect::Collect<St,C> as core::future::future::Future>::poll
             at /home/zerohero/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.28/src/stream/stream/collect.rs:50:26
   6: paginated_logs::main::{{closure}}

To reproduce the issue you can run the test in this PR on master.

Solution

We have to return Poll::Ready(None) to stop the stream after returning the error.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

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.

None yet

1 participant