-
Notifications
You must be signed in to change notification settings - Fork 62
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
Factory trace filters #882
Conversation
@@ -710,7 +716,74 @@ const getMatchedLogs = async ( | |||
logs, | |||
logFilters: [ | |||
...service.logFilterSources.map((l) => l.criteria), | |||
...factoryLogFilters, | |||
...factoryLogFilters.filter((f) => f.address.length !== 0), |
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.
I think I actually caught a subtle bug in the getMatchedLogs
function here that would cause us to match on every "address" in the case when there were no child addresses in the database.
block: RpcBlock; | ||
transactions: RpcTransaction[]; | ||
transactionReceipts: RpcTransactionReceipt[]; | ||
traces: SyncCallTrace[]; |
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.
Any reason this isn't called RpcCallTrace
?
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 Rpc
prefixed types are all from viem
const logSources = sources.filter( | ||
(s): s is LogSource | FactoryLogSource => | ||
sourceIsLog(s) || sourceIsFactoryLog(s), | ||
); | ||
const callTraceSources = sources.filter( | ||
(s): s is CallTraceSource | FactoryCallTraceSource => | ||
sourceIsCallTrace(s) || sourceIsFactoryCallTrace(s), |
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.
Nice, this makes a lot of sense now
logOrFactorySources.some( | ||
(source) => source.criteria.includeTransactionReceipts, | ||
) || | ||
logSources.some((source) => source.criteria.includeTransactionReceipts) || |
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.
shouldJoinReceipts
will always be true if there is a call trace source, right? Because callTraceSource.includeTransactionReceipts
is hard-coded to true
?
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.
No, the includeTransactionReceipts
config is still used to skip joins when possible if the user doesn't want the receipt in their indexing function. includeTransactionReceipt
is not used when deciding whether or not to fetch transaction receipts in the sync services, because we know that we will always need them and because we always fetch them, we always cache them.
(service.logFilterSources.length > 0 || | ||
service.factoryLogSources.length > 0); |
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.
Correct me if I'm wrong but I think this is redundant, and we can simply rename positiveBloomFilter to shouldRequestLogs
?
@@ -108,9 +110,10 @@ export const create = ({ | |||
onFatalError: (error: Error) => void; | |||
}): Service => { | |||
const logFilterSources = sources.filter(sourceIsLog); |
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.
Should this be renamed to logSources
for consistency?
No description provided.