-
Notifications
You must be signed in to change notification settings - Fork 249
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
Update to go-ethereum 1.8.1 #702
Conversation
5ea4092
to
70faac8
Compare
@pombeirp what about other |
@mandrigin you're right, I was so focused on making the transition to 1.8.1 work well that in the end I overlooked removing the 1.7 patches. But I'm not sure that the one 1.7-only patch can be removed. If you see the differences, the behavior upstream is not the same as in our patch: So maybe I need to rename this patch to |
@pombeirp hmm that's weird, I'm a pretty much sure I saw that fixed on master... I'll double check. |
geth/common/utils.go
Outdated
if args.Input == nil && args.Data == nil { | ||
// If neither Input nor Data were initialized, let's pass an empty slice in Input | ||
emptyByteArray := hexutil.Bytes(make([]byte, 0)) | ||
args.Input = &emptyByteArray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Input
is a pointer why can't it be nil
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adambabik the changes to the SendTxArgs
struct were based on the fact that is looked like a clone of the one in vendor/github.com/ethereum/go-ethereum/internal/ethapi/api.go
, so I assumed we wanted to keep them in sync (even the comments in our struct are identical). If we have the freedom over our own struct, we should have a comment on it that clarifies that. I'll add one for your review.
geth/common/rpccall.go
Outdated
if err != nil { | ||
return nil | ||
} | ||
|
||
return (*hexutil.Big)(parsedValue) | ||
_v := hexutil.Uint64(parsedValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_v
is a bit strange in Go. v := hexutil.Uint64(parsedValue)
looks ordinary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix
geth/common/types.go
Outdated
Nonce *hexutil.Uint64 `json:"nonce"` | ||
// We accept "data" and "input" for backwards-compatibility reasons. "input" is the | ||
// newer name and should be preferred by clients. | ||
Data *hexutil.Bytes `json:"data"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to change the data type to *hexutil.Bytes
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, I was trying to keep it similar to geth's struct. Will change it to Input hexutil.Bytes
.
geth/common/types.go
Outdated
Nonce *hexutil.Uint64 `json:"nonce"` | ||
// We accept "data" and "input" for backwards-compatibility reasons. "input" is the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's our internal struct, so maybe we can remove all Data
field and fix all occurrences in this PR?
geth/common/utils.go
Outdated
@@ -143,6 +144,11 @@ func Fatalf(reason interface{}, args ...interface{}) { | |||
|
|||
// CreateTransaction returns a transaction object. | |||
func CreateTransaction(ctx context.Context, args SendTxArgs) *QueuedTx { | |||
if args.Input == nil && args.Data == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why we need this condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was more of a sanity check during the migration that slipped through.
geth/transactions/txqueue_manager.go
Outdated
input = args.Data | ||
} | ||
if input == nil { | ||
return hash, errors.New("Missing Input/Data byte array") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be totally fine. Do you get an error if data
passed to tx := types.NewTransaction(nonce, toAddr, value, gas, gasPrice, data)
is nil
?
@pombeirp Overall it looks good. I am not really sure about these changes to |
@adambabik thanks for the review so far. Regarding |
70faac8
to
15f1027
Compare
15f1027
to
6a9fe8f
Compare
6a9fe8f
to
355bd76
Compare
…` and `TestCallRawResultGetTransactionReceipt()`. Part of #665
355bd76
to
c3c2eb0
Compare
Adding missing tests on bloom filter logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much cleaner 👏 LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 huge job! just a few questions...
geth/common/rpccall.go
Outdated
@@ -94,23 +94,23 @@ func (r RPCCall) ParseValue() *hexutil.Big { | |||
|
|||
// ParseGas returns the hex big associated with the call. | |||
// nolint: dupl | |||
func (r RPCCall) ParseGas() *hexutil.Big { | |||
func (r RPCCall) ParseGas() hexutil.Uint64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make any sense to actually return also an error here, what do you think?
@@ -84,8 +84,8 @@ func toCallArg(msg ethereum.CallMsg) interface{} { | |||
if msg.Value != nil { | |||
arg["value"] = (*hexutil.Big)(msg.Value) | |||
} | |||
if msg.Gas != nil { | |||
arg["gas"] = (*hexutil.Big)(msg.Gas) | |||
if msg.Gas != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 0
for sure an invalid value for Gas?
Before the logic assumed that there are 3 types of values: non-set (nil
), set, but 0, set, != 0.
Here we lost one state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if so I'd extracted it to a constant to simplify changes in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hence my question above (#702 (comment)). I'm not against keeping the old version that uses nil
, tbh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted the changes to Gas
type. I don't think that we gain much by doing that.
geth/transactions/txqueue_manager.go
Outdated
} | ||
} else { | ||
gas = uint64(args.Gas) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if gas
set here is < defaultGas
?
- [`0014-whisperv6-notifications.patch`](./0014-whisperv6-notifications.patch) — adds Whisper v6 notifications (need to be reviewed and documented) | ||
- [`0015-whisperv6-envelopes-tracing.patch`](./0015-whisperv6-envelopes-tracing.patch) — adds Whisper v6 envelope tracing (need to be reviewed and documented) | ||
- [`0017-geth-18-downgrade-to-whisperv5.patch`](./0017-geth-18-downgrade-to-whisperv5.patch) — some files in geth 1.8 import Whisper v6, instead of v5. This patch ensures v5 is used everywhere |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also have a word here about the xgo patches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you see the README.md file in the geth-xgo
folder? Or are you just saying we should add a mention here to that folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, missed that file. it's fine then.
c3c2eb0
to
53fac7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐️
This PR updates our vendored geth to 1.8.1, while making sure that any updates to whisper v6 in upstream are reverted to v5.
This involved:
0011-geth-17-whisperv6-70fbc87.patch
, since v6 no longer needs patchingChanges of interest in 1.8.1:
GasLimit
andGasUsed
fields of blocks and transactions have typeuint64
instead of*big.Int
. This is a breaking API change. (#15466)Closes #665