-
Notifications
You must be signed in to change notification settings - Fork 161
Conversation
* addded PublicFilterAPI * added filter logs func to filter based on params * added Unmarshal func from go-ethereum
end = criteria.ToBlock.Int64() | ||
} | ||
to := big.NewInt(end) | ||
results := e.getLogs() |
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.
Would it not be beneficial to include the range filter on the type you created to abstract this logic so you aren't doing it duplicate times?
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 you elaborate on what you mean from the above?
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.
Just replicating the e.getLogs and filterLogs calls, can't the filter just be generated in this if/ else then call these equivalently outside of it for consistency?
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.
still need some clarity here.... e.getLogs
is the actual call to retrieve the logs whereas filterLogs
does the filtering. We want to keep this functionality separate when we introduce bloom filters so that we only call filterLogs
on the logs that may meet the filter criteria which will be indicated by the bloom filter.
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.
to be more specific, I just mean having the functionality to create a range filter like you do with NewBlockFilter()
then get logs and filter them below this conditional (let me know what you think of this
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 only problem I have is that you are handling block filters and range filters asymmetrically, which is somewhat hard to follow. Also small thing with this is that it adds a linting issue with returning both in the coniditonal (that doesn't matter as much)
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.
:D
Changes made in this PR:
PublicFilterAPI
querier.go
filterLogs
,UnmarshalJSON
funcs fromgo-ethereum
To Test:
Deploy Contract and Emit Events:
Remaining todos for logs:
blockHash
inPrepare
func prior to log entry (will also then enable filtering byblockHash