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

[Bug] Some transactions may fail signing on Ledger #164

Closed
DaniPopes opened this issue Jan 30, 2024 · 0 comments
Closed

[Bug] Some transactions may fail signing on Ledger #164

DaniPopes opened this issue Jan 30, 2024 · 0 comments
Labels
bug Something isn't working c-signer-ledger

Comments

@DaniPopes
Copy link
Member

Component

signers

What version of Alloy are you on?

d024781

Operating System

Linux

Describe the bug

During testing for #161 I encountered a legacy transaction that failed signing with: Code 6a80 APDU_CODE_BAD_KEY_HANDLE

It seems that this only happens with specific calldata that might be known to the device.

This is the transaction:

async fn test_sign_tx_legacy() {
// https://github.com/gakonst/ethers-rs/blob/90b87bd85be98caa8bb592b67f3f9acbc8a409cf/ethers-signers/src/ledger/app.rs#L321
let mut tx = alloy_consensus::TxLegacy {
nonce: 5,
gas_price: 400e9 as u128,
gas_limit: 1000000,
to: alloy_consensus::TxKind::Call(address!("2ed7afa17473e17ac59908f088b4371d28585476")),
// TODO: this fails for some reason with 6a80 APDU_CODE_BAD_KEY_HANDLE
// approve uni v2 router 0xff
// input: bytes!("095ea7b30000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),
input: bytes!("01020304"),
value: U256::from(100e18 as u128),
chain_id: Some(69420),
};
/*
assert_eq!(tx.encoded_for_signing(), hex!("f87005855d21dba000830f4240942ed7afa17473e17ac59908f088b4371d2858547689056bc75e2d63100000b844095ea7b30000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
*/
test_sign_tx_generic(&mut tx).await;
}

Ported from an ethers-rs test, which also failed with the same error.

@DaniPopes DaniPopes added the bug Something isn't working label Jan 30, 2024
@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2024
@DaniPopes DaniPopes reopened this Jul 31, 2024
@jenpaff jenpaff closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working c-signer-ledger
Projects
None yet
Development

No branches or pull requests

3 participants