-
Notifications
You must be signed in to change notification settings - Fork 26
Add filtering to logs bloom check for gas price #193
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
Conversation
ethutil/validate_logs_with_block.go
Outdated
| func ValidateLogsWithBlockHeader(logs []types.Log, header *types.Header, optLogsBloomCheck ...LogsBloomCheckFunc) bool { | ||
| // Allow callers to override the check logic (e.g. filtering certain logs). | ||
| if len(optLogsBloomCheck) > 0 && optLogsBloomCheck[0] != nil { | ||
| return optLogsBloomCheck[0](logs, header) |
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.
if we're just replacing the full logic of the function, then the caller can just call a different function instead of this one..? if you prefer that approach, it works, and we can just have a LogsBloomCheckFunc type exactly as you have.. and on the caller side, it can assign the validation function it wants..
in which case, I'd remove this optLogsBloomCheck argument, and keep the LogsBloomCheckFunc and keep the ConvertLogsToBloom exported like you did.
I think that approach is great. I suggest the following:
type LogsBloomCheckFunc func(logs []types.Log, header *types.Header) bool
type LogsFilterFunc func(logs []types.Log, header *types.Header) []type.Log
func ValidateLogsWithBlockHeader(logs []types.Log, header *types.Header) bool {
// leave this function as it was, so it adheres to the LogsBloomCheckFunc type
}
.. then really the caller could just call..
if hyperEvm {
logs = LogsFilterForHyperEVM(logs)
}
ValidateLogsWithBlockHeader(logs, header)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.
Yeah good call, added this. The only difference is I included the block in the LogsFilterFunc params so txns can be used in filtering
This PR updates the block command's
--check-logs-bloomflag to filter out logs from transactions withgasPrice == 0. This excludes system transactions on HyperEVM (https://www.quicknode.com/docs/hyperliquid/endpoints#key-implementation-differences), making logs bloom check validation work.