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

Add eth.BlockSpecifier for EIP-1898 Support #9

Closed
ryanschneider opened this issue Dec 9, 2019 · 3 comments
Closed

Add eth.BlockSpecifier for EIP-1898 Support #9

ryanschneider opened this issue Dec 9, 2019 · 3 comments
Assignees
Labels
good first issue Good for newcomers issue-type/feature Feature we are working on but not part of a larger project. project/eth-api size/s 1 to 2 days team/backend Work for a backend engineer.

Comments

@ryanschneider
Copy link
Contributor

ryanschneider commented Dec 9, 2019

Now that Infura is predominately using geth 1.9.x for our backend nodes, I'd like to consider exposing EIP-1898 support, and adding it here seems like a good first step.

I'm picturing something like:

type Tag string //also update eth.BlockNumberOrTag to use this

type BlockSpecifier struct {
  Number *Quantity 
  Tag *Tag
  Hash *Hash
  RequireCanonical *bool
  Raw bool
}

And custom JSON (un)marshal routines that can handle the various cases:

  • raw Quantity or Hash
  • tags ("latest", "pending", etc.)
  • the JSON format in the EIP itself

.Raw can be used when constructing a BlockSpecifier in code to control how it'll be marshaled, if true then the specifier would be marshaled as a simple string instead of a JSON object (e.g. { Tag: Tag("latest") } would be just "latest" and not { "blockNumber": "latest" }.

@frankreed frankreed added team/backend Work for a backend engineer. size/? unknown time estimate labels Feb 7, 2020
@frankreed frankreed added the issue-type/feature Feature we are working on but not part of a larger project. label Apr 9, 2020
@ryanschneider ryanschneider added the good first issue Good for newcomers label Apr 21, 2020
@frankreed frankreed assigned meronym and unassigned ryanschneider Apr 23, 2020
@meronym meronym added size/s 1 to 2 days and removed size/? unknown time estimate labels Apr 24, 2020
@meronym
Copy link
Contributor

meronym commented Apr 24, 2020

@ryanschneider are we concerned about preserving backwards compatibility?

E.g. changing the definition of BlockNumberOrTag from

type BlockNumberOrTag struct {
	number Quantity
	tag    string
}

to

type BlockNumberOrTag struct {
	number Quantity
	tag    Tag
}

might break existing code (outside go-ethlibs)?

@ryanschneider
Copy link
Contributor Author

We're generally ok with breaking compatibility in this module for now, especially if it makes the module itself easier to use, so at this point I still consider this module "v0" with respect to compatibility promises.

For example I'd really like to implement #17 and move away from defining per-RPC methods on node.Client; it'd be a sizable change to the interface to start, but would mean that new RPCs can be added going forward without any changes to implementers of the Client interface in other packages.

@meronym
Copy link
Contributor

meronym commented Apr 30, 2020

Merged EIP-1898 Support into master.

@meronym meronym closed this as completed Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers issue-type/feature Feature we are working on but not part of a larger project. project/eth-api size/s 1 to 2 days team/backend Work for a backend engineer.
Projects
None yet
Development

No branches or pull requests

3 participants