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

accounts/usbwallet: support dynamic tx #30180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shrimalmadhur
Copy link

@shrimalmadhur shrimalmadhur commented Jul 17, 2024

Fixes #30173

  • Add support for EIP 1559 Dynamic tx using ledger

@@ -353,7 +367,9 @@ func (w *ledgerDriver) ledgerSign(derivationPath []uint32, tx *types.Transaction
// Chunk size selection to mitigate an underlying RLP deserialization issue on the ledger app.
// https://github.com/LedgerHQ/app-ethereum/issues/409
chunk := 255
for ; len(payload)%chunk <= ledgerEip155Size; chunk-- {
if tx.Type() == types.LegacyTxType {
Copy link
Author

@shrimalmadhur shrimalmadhur Jul 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is need for DynamicTx. Does this bug exist in DynamicTx too or it only exist in EIP155?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workaround can be left in place for all tx types. It's just a way of modifying the transfer so it doesn't trigger a certain bug in the firmware.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fjl this doesn't seems to work for other tx. This could very well be due to the way typed tx are formed.

if tx.Type() == types.DynamicFeeTxType {
	if txrlp, err = rlp.EncodeToBytes([]interface{}{chainID, tx.Nonce(), tx.GasTipCap(), tx.GasFeeCap(), tx.Gas(), tx.To(), tx.Value(), tx.Data(), tx.AccessList()}); err != nil {
		return common.Address{}, nil, err
	}
	// append type to transaction
	txrlp = append([]byte{tx.Type()}, txrlp...)
}

I am not sure how to handle this bug here.
Ledger throws error

transaction type not supported

Copy link
Contributor

@holiman holiman Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I was going to ask you to show some snippet from ledger-docs or something, to demonstrate that they do accept this format, where you prepend the type into the payload like this.

But, seeing as the ledger throws transaction type not supported -- doesn't this mean that this PR is moot, and that the ledger (at least with the software version you are using) does not support signing non-legacy transactions?

Copy link
Author

@shrimalmadhur shrimalmadhur Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@holiman So the error transaction type not supported appears when I apply for ; len(payload)%chunk <= ledgerEip155Size; chunk-- logic for non legacy tx. If I don't do it - Ledger signing works. I have tested with my Ledger nano S. Let me find relevant ledger code

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you go @holiman https://github.com/LedgerHQ/app-ethereum/blob/develop/src/ethUstream.c#L300 - from what I understand it supports it.

@shrimalmadhur shrimalmadhur changed the title usbwallet: support dynamic tx accounts/usbwallet: support dynamic tx Jul 17, 2024
@shrimalmadhur
Copy link
Author

I am also not sure why the ci test is failing. doesn't seem related? How can I rerun it?

@gballet gballet self-assigned this Jul 18, 2024
@shrimalmadhur
Copy link
Author

Hey @gballet I saw you assigned this task to yourself. Wondering when you can take a look at it?

@shrimalmadhur shrimalmadhur requested a review from fjl July 25, 2024 04:21
@fjl
Copy link
Contributor

fjl commented Aug 29, 2024

@gballet was assigned because he has a Ledger to test this with.

@holiman
Copy link
Contributor

holiman commented Aug 29, 2024

@gballet was assigned because he has a Ledger to test this with.

Yeah I also have a few, for testing, so I can also give this a spin

@shrimalmadhur
Copy link
Author

@gballet was assigned because he has a Ledger to test this with.

Yeah I also have a few, for testing, so I can also give this a spin

awesome! thanks. let me know how your testing goes.

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.

Support LondonSigner in Ledger USBWallet
4 participants