Skip to content
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

Manually follow EIP-155 in certain circumstances #26

Merged
merged 5 commits into from
Feb 1, 2019
Merged

Conversation

jtobin
Copy link
Contributor

@jtobin jtobin commented Jan 29, 2019

Resolves #12.

Ledger does not seem to handle EIP-155 automatically. When using a Ledger, if the block number is at least FORK_BLKNUM = 2675000, one needs to pre-set the ECDSA signature parameters with r = 0, s = 0, and v = chainId prior to signing.

The easiest way to handle this on our end is to just branch on the network type, since mainnet and Ropsten have obviously passed FORK_BLKNUM.

This is somewhat awkward when dealing with offline transactions, since we might want to test them on a local network as well. For now we can assume that users generating offline transactions wish to later submit them to mainnet, but the best thing to do is probably to add an 'advanced' tab to offline transaction generation where one can disable the defaulted-on EIP-155 settings in that case.

See:

LedgerHQ/ledgerjs#43 (comment)

https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md

@Fang-
Copy link
Member

Fang- commented Jan 29, 2019

This is somewhat awkward when dealing with offline transactions

Wait, don't we still give the user the "what network" dropdown when in offline mode? We should, because it affects the transaction as you've discovered.

@juped
Copy link

juped commented Jan 30, 2019

Much obliged for fixing my issue!

@jtobin
Copy link
Contributor Author

jtobin commented Jan 31, 2019

@juped No sweat!

@iamwillkim
Copy link
Contributor

This is somewhat awkward when dealing with offline transactions

Wait, don't we still give the user the "what network" dropdown when in offline mode? We should, because it affects the transaction as you've discovered.

@Fang- Making a separate issue for this

Ledger does not seem to handle EIP-155 automatically.  When using a
Ledger, if the block number is at least FORK_BLKNUM = 2675000, one needs
to pre-set the ECDSA signature parameters with r = 0, s = 0, and v =
chainId prior to signing.

The easiest way to handle this on our end is to just branch on the
network type, since mainnet and Ropsten have obviously passed
FORK_BLKNUM.

This is somewhat awkward when dealing with offline transactions, since
we might want to test them on a local network as well.  For now we can
assume that users generating offline transactions wish to later submit
them to mainnet, but the best thing to do is probably to add an
'advanced' tab to offline transaction generation where one can disable
the defaulted-on EIP-155 settings in this case.

See:

See LedgerHQ/ledgerjs#43 (comment)

https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
At present these always point to mainnet, so are invalid when using
Ropsten, local nodes, etc.

This commit fixes things so that the Etherscan links are disabled, or
are just not visible, when using a network other than Ropsten / mainnet,
and ensures that the links go to the right place when using Ropsten.

Additionally, this fixes a bug where some links were using an old
'disabled' property instead of 'prop-disabled', and so were enabled when
they shouldn't be (including on mainnet).
@jtobin
Copy link
Contributor Author

jtobin commented Feb 1, 2019

This got out of sync with master, so I've rebased and force-pushed. Should be good to go again. I've also tacked on a fix for some issues around Etherscan links.

@iamwillkim
Copy link
Contributor

Bridge crashes when I try to sign the tx tro set my networking keys on localnet with my Ledger. Screencap below:

image

This must have somehow fallen out in a rebase or merge.
@jtobin
Copy link
Contributor Author

jtobin commented Feb 1, 2019

@iamwillkim As always, nice catch. That was the previous Ledger fix which must have fallen out in a merge -- ditching the form components in #24 required a lot of manual stitching.

We should probably devote some effort to adding proptypes/tests at this point. The Will Kim test suite continues to be extremely effective, but is no doubt expensive to run.

@iamwillkim
Copy link
Contributor

Hear hear! I'll make it an issue.

In other news, this PR looks good to me.

@iamwillkim iamwillkim merged commit 23d8ffb into master Feb 1, 2019
@iamwillkim iamwillkim deleted the jt-issue-12 branch February 1, 2019 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants