6

Does anyone know if the fields are inclusive? The documentation doesn't specify, and I would assume that they are probably inclusive fields unless otherwise stated, but it would be nice to confirm this.

1 Answer 1

3

A quick whirlwind tour of the filter code... (Instead of simply running some tests to output some logs.)

When we create a new filter the order of events is as follows. NewFilter() in ./eth/filters/api.go calls newLogFilter() which sets some variables to the values of fromBlock and toBlock, using SetBeginBlock() and SetEndBlock() in ./eth/filters/filter.go.

When the filter is invoked to output some logs, the callchain ends with a call to Find() in filter.go. This in turn calls mipFind(), which contains the following line:

for num := start / level * level; num <= end; num += level {

Where start and end are the values we originally passed to NewFilter().

Here the := for the starting block and <= for the ending block imply inclusivity.

1
  • I tested this with Erigon's RPCDaemon and I cannot reproduce the end block inclusivity. Commented Jan 30, 2023 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.