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: forge script --broadcast with Trezor fails #7660

Closed
1 of 2 tasks
wanderer opened this issue Apr 14, 2024 · 10 comments
Closed
1 of 2 tasks

bug: forge script --broadcast with Trezor fails #7660

wanderer opened this issue Apr 14, 2024 · 10 comments
Assignees
Labels
T-bug Type: bug

Comments

@wanderer
Copy link

wanderer commented Apr 14, 2024

Component

Forge

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (f625d0f 2024-04-02T00:15:52.692780824Z)

What command(s) is the bug in?

forge script --verifier sourcify ./script/deploy.s.sol:Deploy --rpc-url https://eth.llamarpc.com --broadcast --no-auto-detect -t

Operating System

Linux

Describe the bug

When I try to run a script using my trezor as a wallet i get the following.

Error:                                                                                                                                                                                       
Failed to send transaction                                                                                                                                                                   
                                                                                                                                                                                             
Context:                                                                                                                                                                                     
- (code: -32603, message: failed to send tx, data: None)      
@wanderer wanderer added the T-bug Type: bug label Apr 14, 2024
@wanderer
Copy link
Author

maybe related #7342

@klkvr
Copy link
Member

klkvr commented Apr 14, 2024

@wanderer could you please try updating foundry to latest nightly and running script again? we've recently migrated to new wallet adapters and this migration helped to fix some Ledger issues so Trezor connections might be fixed as well

@wanderer
Copy link
Author

@klkvr i update to forge 0.2.0 (89f0fb9 2024-04-14T00:20:50.727844499Z) and it "sees" the trezor now. But it doesn't use it. It still want to use PRIVATE_KEY.

in my script I have

uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");   

Should this be replaced with a something that is trezor specific?

@klkvr
Copy link
Member

klkvr commented Apr 15, 2024

yeah, you should use vm.startBroadcast() or vm.startBroadcast(address) cheatcodes for hw wallets

@wanderer
Copy link
Author

wanderer commented Apr 15, 2024

using vm.startBroadcast(address) works, in that the trezor is signing. Broadcasting still fails though with the following error

returned an error response: error code -32000: txIndex 0 error: nonce too high: address 0xcb7c5CA542FE243bD1622d2951dEf45c8e3Aaf3F, tx: 18 state: 

I have no idea what is address 0xcb7c5CA542FE243bD1622d2951dEf45c8e3Aaf3F. The address the i was deploying from does have nonce of 18.

I am using --trezor --hd-paths="m/44'/60'/0'/0/2"
Also I have tried with various RPCs

@klkvr
Copy link
Member

klkvr commented Apr 15, 2024

does 0xcb7c5CA542FE243bD1622d2951dEf45c8e3Aaf3F match any other addresses on your Trezor?

@wanderer
Copy link
Author

i check the first dozen or so paths and it does not

@TuDo1403
Copy link

Issue maybe related to trezor-client package trezor/trezor-firmware#3952.

@zerosnacks
Copy link
Member

Pending Alloy release 0.1.5: alloy-rs/alloy#1045

@zerosnacks
Copy link
Member

Marking as resolved by https://github.com/alloy-rs/alloy/releases/tag/v0.2.0 and Foundry having been bumped to 0.2.0 in https://github.com/foundry-rs/foundry/pull/8305/files#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542

Please re-open if this is still an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
None yet
Development

No branches or pull requests

4 participants