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

Use EthBlockNumberOrHash wherever we need to decode one #12766

Open
rvagg opened this issue Dec 10, 2024 · 0 comments
Open

Use EthBlockNumberOrHash wherever we need to decode one #12766

rvagg opened this issue Dec 10, 2024 · 0 comments

Comments

@rvagg
Copy link
Member

rvagg commented Dec 10, 2024

In eth.go, and a some other places (including the new TipSetResolver introduced in #12762), we parse these types of eth strings - they can be one of the pre-defined values or a block hash or a block number. The problem is that we have inconsistent handling of them. Sometimes we just take the string and switch it and other times we explicitly json-decode it using EthBlockNumberOrHash.

We should:

  1. Make internal methods that take these strings take a EthBlockNumberOrHash instead
  2. Make our external API methods that currently take a string immediately have to convert it to a EthBlockNumberOrHash before using it
  3. Each method that takes one, should additionally validate that it's within bounds of what it can deal with: sometimes it's not allowed to take certain forms, we should assert that on the EthBlockNumberOrHash that we get back, perhaps add validation methods to EthBlockNumberOrHash itself for common cases. e.g. "earliest" is parsed by some functions and immediately errors, maybe we should handle that?

Needs a little bit of research into the various ETH APIs we support and what go-ethereum (and friends) allows in the various calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📌 Triage
Development

No branches or pull requests

1 participant