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

Inconsistent API #15628

Closed
holiman opened this issue Dec 8, 2017 · 1 comment
Closed

Inconsistent API #15628

holiman opened this issue Dec 8, 2017 · 1 comment
Assignees
Milestone

Comments

@holiman
Copy link
Contributor

holiman commented Dec 8, 2017

The API:s are dangerously inconsistent.

Used in eth.sendTransaction:

type SendTxArgs struct {
...
    Data     hexutil.Bytes   `json:"data"`
...
}

And we also have, returned from e.g. getTransaction:

type RPCTransaction struct {
...
    Input            hexutil.Bytes   `json:"input"`
}

Not to mention

type txdata struct {
...
    Payload      []byte          `json:"input"    gencodec:"required"`

In case someone tries to resend a transaction manually by first fetching from the pool, changing the gas, and resubmitting. What the user won't know, is that the data now resides in input, and won't be present in the replacement tx.

This is a disaster waiting to happen.

Suggested fix

We can't do simple renaming, imo.. I'd prefer doing something like this:

  • If we expect data, the user passes input and data is nil, we do X
  • If we expect data, the users passes both input and data, which are not equal, we do Y

And vice versa. Maybe X is convert+warn, and maybe Y is reject+warn.

@karalabe
Copy link
Member

To be fair, it's called data in the yellowpaper. Maybe we should do a more consistent update throughout the ecosystem?

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

No branches or pull requests

3 participants