-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Update signTransaction to Consistently Return SignedTransactionInfoAPI
#5312
Conversation
|
Your Render PR Server URL is https://web3js-docs-pr-5312.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-cbll3vpa6gdhl7bpba8g. |
| value: '0x174876e800', | ||
| gas: '0x5208', | ||
| gasPrice: '0x4a817c800', | ||
| type: '0x0', |
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.
We should also add tests for 0x1 and 0x2 transactions
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.
Updated via this commit
| * @param returnFormat ({@link DataFormat} Specifies how the return data should be formatted. | ||
| * @returns {@link SignedTransactionInfoAPI}, an object containing the RLP encoded signed transaction (accessed via the `raw` property) and the signed transaction object (accessed via the `tx` property). | ||
| */ | ||
| export function decodeSignedTransaction<ReturnFormat extends DataFormat>( |
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 this support EIP-2718 Enveloped transactions decoding? I think not, Its only for RLP encoded 0x0 tx decoding?
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.
Yellow paper specifies IMO we should keep |
|
Is it good to have both |
nikoulai
left a comment
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.
Apart from @jdevcs comments, LGTM.
I think we should go with gasLimit as users will be more familiar with yellow paper than the execution specs and would, also, make migration from Ethers.js easier. But, would like to hear the rest of the team.
|
I added code to replace #5387 was created to track this |
Before this PR,
web3Eth.signTransactionwas returning whatever the user passed as thetransactionparameter forrespnose.txwhen the RPC client was returning only the RLP encoded transaction as the RPC response (in the below code example, Ganache was only returning the value labeled asraw, while Geth was returning the entire object (i.e.{ raw: ..., tx: ... })). This resulted in varying returns values based on which client the request was submitted to:If the connected client was Ganache:
If the connected client was Geth:
After this PR:
If the connected client was Ganache:
If the connected client was Geth:
One point of discussion that remains: In the last two above code examples, the response from Ganache returns the
gasLimitproperty because therawencoded transaction is being parsed by@ethereumjs/tx's TransactionFactory. However, the response from Geth returnsgasLimitasgaswhich is what's being done in1.x. The decision to be made it whether we will continue to usegasto describegasLimitin4.xgasforeth_sendTransactiongasLimitcloses #5077