-
Notifications
You must be signed in to change notification settings - Fork 465
mini-rollup of several issues #498
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
Changes from all commits
e9b53c0
30711bb
b6000e9
7fd2043
4774e99
11517aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,13 +52,13 @@ extension TransactionOptions: Decodable { | |
|
||
public init(from decoder: Decoder) throws { | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
if let gasLimit = try decodeHexToBigUInt(container, key: .gas) { | ||
if let gasLimit = try decodeHexToBigUInt(container, key: .gas, allowOptional:true) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While working with Web3+structures source i'm kind of confused: As i see this lib took it's struct from web3.js, where some struct fields are optional. But at the same time i've found Eth JSON-RPC specification Transaction scheme where none of that are optional. It looks kind official tho. I've lack of experience in Ethereum itself, so maybe you're could explain to me why there's such ignorance of specification happening even in kind of it's official implementation like web3.js? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the problem here is that to code expects to drop down to provide a default if the call to On a larger scope, yes nonce should never be optional, I was not trying to address that issue. That should be handled at a higher level. The input here could come from a number of sources, where nonce may no be known yet. The same goes for the various gas values, as if this is a 1559 transaction those values may not exist. Furthermore, if the transaction is pending and not mined yet, those values may also not be present, as they are not known yet. Issue #469 |
||
self.gasLimit = .manual(gasLimit) | ||
} else { | ||
self.gasLimit = .automatic | ||
} | ||
|
||
if let gasPrice = try decodeHexToBigUInt(container, key: .gasPrice) { | ||
if let gasPrice = try decodeHexToBigUInt(container, key: .gasPrice, allowOptional:true) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's i see that optionality happening since this struct should work with both EIP-1559 Transactions and legacy transaction where the first one don't have that field already, am i correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as my previous comment |
||
self.gasPrice = .manual(gasPrice) | ||
} else { | ||
self.gasPrice = .automatic | ||
|
@@ -85,13 +85,13 @@ extension TransactionOptions: Decodable { | |
let value = try decodeHexToBigUInt(container, key: .value) | ||
self.value = value | ||
|
||
if let nonce = try decodeHexToBigUInt(container, key: .nonce) { | ||
if let nonce = try decodeHexToBigUInt(container, key: .nonce, allowOptional:true) { | ||
self.nonce = .manual(nonce) | ||
} else { | ||
self.nonce = .pending | ||
} | ||
|
||
if let callOnBlock = try decodeHexToBigUInt(container, key: .nonce) { | ||
if let callOnBlock = try decodeHexToBigUInt(container, key: .callOnBlock, allowOptional:true) { | ||
self.callOnBlock = .exactBlockNumber(callOnBlock) | ||
} else { | ||
self.callOnBlock = .pending | ||
|
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 it just me, or these lines are equal?
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.
spelling correction from gn to ng in Single. it's hard to spot
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, now i see