-
Notifications
You must be signed in to change notification settings - Fork 569
Apply the bloom filter when query the ethlogs with range of blocks #570
Conversation
Visit https://dashboard.github.orijtech.com?back=0&pr=570&remote=false&repo=tharsis%2Fethermint to see benchmark details. |
also ref: #563 |
Will extend the test cases to enlarge the coverage. |
0ac1349
to
e93aab7
Compare
e93aab7
to
abb4318
Compare
// checkMatches revised the function from | ||
// https://github.com/ethereum/go-ethereum/blob/401354976bb44f0ad4455ca1e0b5c0dc31d9a5f5/core/types/bloom9.go#L88 | ||
func checkMatches(bloom ethtypes.Bloom, filter []filters.BloomIV) bool { | ||
for _, bloomIV := range filter { | ||
if bloomIV.V[0] == bloomIV.V[0]&bloom[bloomIV.I[0]] && | ||
bloomIV.V[1] == bloomIV.V[1]&bloom[bloomIV.I[1]] && | ||
bloomIV.V[2] == bloomIV.V[2]&bloom[bloomIV.I[2]] { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
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.
can we use the BloomLookup
func instead?
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.
The reason I didn't use BloomLookup
is trying to avoid the calculation in https://github.com/ethereum/go-ethereum/blob/401354976bb44f0ad4455ca1e0b5c0dc31d9a5f5/core/types/bloom9.go#L139
If we use it, the bloom for the addresses and the topics in the filter will be calculated against every block.
Also this PR I can put the one-time bloom calculation when the RPC layer creates the filter.
close this PR and open it in #587 |
Closes: #303
Description
This PR revised the implementation in the filter, uses
Bloom index&value sets
instead ofbloombits.Matcher
which doesn't have the bloom indexer DB implementation in the Ethermint project.Therefore,
eth_getLogs
can skip extra data check overhead by only checking the bloom of the block header, and then returns the transaction logs that fit the query criteria.For contributor use:
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerFor admin use:
WIP
,R4R
,docs
, etc)