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

ethmonitor: review behaviour if Options.LogTopics is defined #55

Closed
attente opened this issue Aug 19, 2022 · 3 comments
Closed

ethmonitor: review behaviour if Options.LogTopics is defined #55

attente opened this issue Aug 19, 2022 · 3 comments

Comments

@attente
Copy link
Contributor

attente commented Aug 19, 2022

topics := [][]common.Hash{}
if len(m.options.LogTopics) > 0 {
topics = append(topics, m.options.LogTopics)
}
logs, err := m.provider.FilterLogs(tctx, ethereum.FilterQuery{
BlockHash: &blockHash,
Topics: topics,
})
if err == nil {
// check the logsBloom from the block to check if we should be expecting logs. logsBloom
// will be included for any indexed logs.
if len(logs) > 0 || block.Bloom() == (types.Bloom{}) {
// successful backfill
if logs == nil {
block.Logs = []types.Log{}
} else {
block.Logs = logs
}
block.OK = true
continue
}
}

I haven't tried this, but I think if topics are specified, then it's possible to receive no logs, while the logs bloom filter is non-zero. This means the block is never considered backfilled and causes the monitor to hang if logs are requested.

@0xbsa
Copy link

0xbsa commented Apr 26, 2023

I'm facing this exact issue. My topics slice is non-empty and the monitor hangs after encountering a block without any matching logs (as per topics filter)

@0xbsa
Copy link

0xbsa commented Apr 26, 2023

Why is this check required at all?

if len(logs) > 0 || block.Bloom() == (types.Bloom{}) {

@pkieltyka
Copy link
Member

outdated

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

No branches or pull requests

3 participants