foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.33k stars 1.76k forks source link

`No associated wallet for addresses` when using trezor with `forge script` #9294

Closed shaspitz closed 3 days ago

shaspitz commented 1 week ago

Component

Forge

Have you ensured that all of these are up to date?

What version of Foundry are you on?

forge 0.2.0 (e028b92 2024-11-11T00:26:04.968342000Z)

What command(s) is the bug in?

forge script

Operating System

macOS (Apple Silicon)

Describe the bug

Maybe related to https://github.com/foundry-rs/foundry/issues/7342.

I am experiencing an issue with forge 0.2.0 (e028b92 2024-11-11T00:26:04.968342000Z). I'm trying to specify forge script to use the m/44'/60'/0'/0/0 derivation path from my trezor, but the command is not finding/using the correct derivation path.

Note I am using trezor safe 5 (one of the newer models).

Command:

forge script scripts/validator-registry/DeployVanillaRegistry.s.sol:Deploy --rpc-url $URL --sender $SENDER --via-ir --chain-id $CHAIN_ID --use 0.8.26 --broadcast --verify --trezor --hd-paths 'm/44'\''/60'\''/0'\''/0/0'

Then password is asked for twice on hw wallet

Error:

Error: No associated wallet for addresses: [*SENDER from above*]. Unlocked wallets: [0xfb20adf75beb049fa5b60c798c3045e548c4cdfb]

This unlocked wallet is unrecognized, and does not show up in Trezor Suite.

shaspitz commented 1 week ago

Note also in Trezor Suite, SENDER from the commands says its derivation path is m/44'/60'/0'/0/0

shaspitz commented 1 week ago

Current trezor firmware version is https://github.com/trezor/trezor-firmware/blob/7f373ae71eca855dd41b4a0fdcc7cadaa13a8281/core/CHANGELOG.T3T1.md

shaspitz commented 1 week ago

@klkvr @zerosnacks am I missing some configuration here, or is this a bug? Thanks!

grandizzy commented 1 week ago

@shaspitz try passing HD path as --hd-paths "m/44'/60'/0'/0/0" see a sample here https://github.com/foundry-rs/foundry/issues/4692#issuecomment-2390714190

shaspitz commented 1 week ago

Hey, I just tried

forge script scripts/validator-registry/DeployVanillaRegistry.s.sol:Deploy --rpc-url $URL --sender $SENDER --via-ir --chain-id $CHAIN_ID --use 0.8.26 --broadcast --verify --trezor --hd-paths "m/44'/60'/0'/0/0"

and had the same resp:

Error: No associated wallet for addresses: [*SENDER from above*]. Unlocked wallets: [0xfb20adf75beb049fa5b60c798c3045e548c4cdfb]
grandizzy commented 1 week ago

thanks, then most probably same with #7342 you linked

shaspitz commented 1 week ago

To add context, if I replace --hd-paths with --mnemonic-indexes and try values of 0,1,2, etc., I can get the unlocked address to change. But that address is never the same as the expected sender

zerosnacks commented 1 week ago

considering we inherit most of the underlying logic through Alloy https://github.com/alloy-rs/alloy/tree/main/crates/signer-trezor and then the trezor-client next steps would be to narrow down if this is an issue in Foundry or in the underlying

shaspitz commented 3 days ago

Hey this was a trezor "passphrase" issue on my end, closing