Skip to content

Wildcard indexing support with RPC data source#415

Merged
DZakh merged 5 commits into
mainfrom
dz/rpc-wildcard
Jan 15, 2025
Merged

Wildcard indexing support with RPC data source#415
DZakh merged 5 commits into
mainfrom
dz/rpc-wildcard

Conversation

@DZakh

@DZakh DZakh commented Jan 13, 2025

Copy link
Copy Markdown
Member
  • Also fix Wildcard events being skipped with Viem decoder enabled for HyperSync data source

@DZakh DZakh requested review from JasoonS and JonoPrest January 13, 2025 12:56

@JonoPrest JonoPrest left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great thanks Dmitry! And thanks for catching the wildcard bug.

Comment on lines +33 to +52
let parseLogOrThrow = (
contractNameAbiMapping: dict<EvmTypes.Abi.t>,
~contractName,
~topics,
~data,
) => {
switch contractNameAbiMapping->Utils.Dict.dangerouslyGetNonOption(contractName) {
| None => raise(UnknownContractName({contractName: contractName}))
| Some(abi) =>
let viemLog: eventLog = {
abi,
data,
topics,
}

try viemLog->decodeEventLogOrThrow catch {
| exn => raise(ParseError(exn))
}
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only question is whether there is any use in actually passing the mapping with key here rather than the abi

Not a big issue though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no big reason for this. I just kept how it similar to how it was before. Ideally decoding for HyperSync and RPC should be done in a single place, so the code is reused and we also apply HyperSync decoder for the RPC data-source.

@DZakh DZakh merged commit 5147174 into main Jan 15, 2025
@DZakh DZakh deleted the dz/rpc-wildcard branch January 15, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants