-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Base rlp encoded logic in signTransaction on return type of getMessageToSign #99
Conversation
0281c9e
to
e7be828
Compare
@@ -252,9 +252,11 @@ class LedgerBridgeKeyring extends EventEmitter { | |||
// Note also that `getMessageToSign` will return valid RLP for all transaction types, whereas 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.
This comment seems inaccurate 🤔
I thought the whole point of the following condition is that getMessageToSign
doesn't return valid RLP for legacy 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.
@Gudahtt reading through this and the conversation here I think you are right. We might want some clarification from @danjm but I don't know how quickly that will come since he's out til next Tuesday. Do you think we can move forward with this PR otherwise?
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.
Sure, we can fix the comment later
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.
LGTM!
Test case copied over from MetaMask/eth-ledger-bridge-keyring#99
Test case copied over from MetaMask/eth-ledger-bridge-keyring#99
Test case copied over from MetaMask/eth-ledger-bridge-keyring#99
* Upgrade trezor-connect to 8.2.1 This adds support for EIP-1559 for the Trezor T, once we get all this library to work with it as well. We use version "8.2.1-extended" exactly, as we need non-browser support for local tests. * Update @ethereumjs/common to 2.4.0 for 1559 tests * Upgrade @ethereumjs/tx dependency to ^3.2.1 Although 3.3.0 is out, I've selected ^3.2.1 just to match the current version of MetaMask's package.json file. Version 3.2.0 adds support for EIP-1559 transactions. * Test EIP-1559 transaction support Test case copied over from MetaMask/eth-ledger-bridge-keyring#99 * Set ESLint ecmaVersion to 2018 This adds support for object-rest-spread (e.g. {...x, ...y}), without using the babel parser, which we use in tests. This is different from what the Metamask extension has, which is 2017, but they're using the babel parser. * Add EIP-1559 transaction support Creating an unfrozen transaction (added in #88) seems to be a change that was only required in eth-ledger-keyring, not in Trezor, and is fixed by @ethereumjs/tx: v3.1.4 anyway. I've removed this part, since it was causing issues with EIP-1559 transactions, and does not seem necessary for non-EIP-1559 transactions either. * Document EIP1559 support for Model T on README.md * Add method to expose trezor model * Lint fix * Update index.js Co-authored-by: Alois Klink <[email protected]> * Use event listener instead of getFeatures call to set model * Lint fix * Revert getEIP1559Support to getModel * Move event listener first and trigger event via init * Lint fix * Remove error handle in getModel method Co-authored-by: Alois Klink <[email protected]> Co-authored-by: David Walsh <[email protected]>
…eToSign (MetaMask#99) * Base rlp encoded logic in signTransaction on return type of getMessageToSign * Update ethereumjs common library version to support eip1559 txes in tests
This PR follows the advice of this comment #96 (comment), and in
signTransaction
uses the return type ofgetMessageToSign
to decide whether it needs to be RLP encoded or not.The tests are updated to be able to properly test the cases where rlp encoding is and is not needed, which are the legacy and EIP1559 transaction cases respectively.
Although not strictly necessary, now that new transaction type specific properties are present on the test transactions, the mocking of
TransactionFactory.fromTxData
has also been removed. This ensures that the transactions of different types are more thoroughly tested (the alternatively would have been more substantial mocking forTransactionFactory.fromTxData
).