Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Expose LogMeta type and add more fields, and expose FilterBlockOption #294

Merged
merged 4 commits into from
May 13, 2021

Conversation

GCdePaula
Copy link
Contributor

Motivation

The types LogMeta and FilterBlockOption are not public, and I believe they should be. Also, the LogMeta is rather terse, and could use more metadata.

Solution

I've exported the two types and added more fields to LogsMeta.

However, there's one important consideration on adding more fields. The procedure that maps the type Log into LogMeta heavily uses expect on Option types. This behavior follows what was previously there, just extended to the new fields. If we look at the json-rpc API, it says these fields are only null when the block is pending. In other words, this is at least as safe it was previously, and it is probably safe. One possible alternative is implementing TryFrom, instead of From. But maybe this can be done in another PR.

Cheers!

Copy link
Owner

@gakonst gakonst left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for the change. I don't think this would be an issue for mined blocks for the reasons you wrote. If somebody encounters this in the future, we could rename the current function to something like query_with_meta_unchecked and make the query_with_meta return a Result.

@gakonst gakonst merged commit 6ec8312 into gakonst:master May 13, 2021
meetmangukiya pushed a commit to meetmangukiya/ethers-rs that referenced this pull request Mar 21, 2022
* chore: add .gitignore when initializing git repo

* chore: cargo fmt

Co-authored-by: Georgios Konstantopoulos <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants