-
Notifications
You must be signed in to change notification settings - Fork 21.4k
Closed
Milestone
Description
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 passesinput
anddata
is nil, we do X - If we expect
data
, the users passes bothinput
anddata
, which are not equal, we do Y
And vice versa. Maybe X is convert+warn, and maybe Y is reject+warn.
zxm2023