Skip to content
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

Refactor indexing #2889

Merged

Conversation

tkporter
Copy link
Collaborator

@tkporter tkporter commented Nov 3, 2023

Description

  • Stops creating a new client a bunch of times in rpc.rs (I haven't yet changed grpc.rs - this is because the client's functions are &mut self, so will have to think about what to do here)
  • Changes unwrap_or_none_result to not include the let Some(varname) bit so we can do let varname = unwrap_or_none_result!(...)
  • Instead of a get_parser(&self, ...) fn that returns a closure, we just pass a the function Self::[data_type]_parser
  • Refactors these parsers to be a bit more defensive - e.g. each param is represented as an Option so it's clear if one isn't parsed, and we also get the _contract_address param (which is auto-set by the cosmwasm runtime). It returns a ParsedEvent<T> so that we can return the _contract_address in there too
  • Refactors the range indexing in rpc.rs, including an important fix to ensure that the contract address of an event is the one we actually want to index

Drive-by changes

n/a

Related issues

n/a

Backward compatibility

Fully

Testing

Unit tests, ran locally

@tkporter tkporter requested a review from daniel-savu as a code owner November 3, 2023 11:20
rust/chains/hyperlane-cosmos/src/interchain_gas.rs Outdated Show resolved Hide resolved
rust/chains/hyperlane-cosmos/src/interchain_gas.rs Outdated Show resolved Hide resolved
rust/chains/hyperlane-cosmos/src/providers/rpc.rs Outdated Show resolved Hide resolved
rust/chains/hyperlane-cosmos/src/providers/rpc.rs Outdated Show resolved Hide resolved
rust/chains/hyperlane-cosmos/src/providers/rpc.rs Outdated Show resolved Hide resolved
@tkporter tkporter merged commit 453734a into trevor/new-featv3-cosmos-oct-28 Nov 3, 2023
2 of 4 checks passed
@tkporter tkporter deleted the trevor/cosmos-indexing-refactor-nov-3 branch November 3, 2023 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants