foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Forge Scripts mnemonic-path flag not working as intended

Open crisgarner opened this issue 2 years ago • 5 comments

Component

Forge

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

  • [x] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (b192af4 2022-05-30T00:08:26.00382Z)

What command(s) is the bug in?

forge script $FILE --rpc $RPC --mnemonic-path $PATH

Operating System

macOS (Apple Silicon)

Describe the bug

There are two issues, first one is the: documentation says --mnemonic-path but CLI requests --mnemonic-paths. Also doesn't matter the path I put I'm not getting on the script a different msg.sender (tested with --private-key and it does change)

crisgarner avatar Jun 01 '22 02:06 crisgarner

cc @joshieDo

mattsse avatar Jun 01 '22 10:06 mattsse

you can still manually set the sender with --sender ADDRESS

I'm still thinking about the best way to check for the presence of one wallet in the beginning of the process, that sets the sender by default. That's why it only exists for --private-key

joshieDo avatar Jun 01 '22 10:06 joshieDo

@joshieDo do you mean that we cant have a script

  • run forge scripts
  • load a seed phrase from mnemonic path
  • run script based on that mnemonic and index?

ShravanSunder avatar Jun 16 '22 00:06 ShravanSunder

No, no I don't. You can have all that, given that you have the addresses of each path.

If you want to explicitly specify an account which would be the msg.sender during the script, then you can pass --sender ADDRESS. This address will now be the msg.sender, the deployer of any necessary libraries and the address to be used on startBroadcast() and broadcast().

If during the script you want to use other address to broadcast a tx other than msg.sender, then you can always pass it as broadcast(adddress) and startBroadcast(address)

As always, make sure not to test it in prod, and have some asserts and requires during the script, just to make sure everything is happening as you expect!

joshieDo avatar Jun 16 '22 09:06 joshieDo

@joshieDo is there a clear to do here?

wilsoncusack avatar Aug 04 '22 16:08 wilsoncusack

I'm not clear on if there's any todo's here. There's also now the deriveKey and rememberKey cheats that provide another way to use mnemonics, so going to close this. Happy to reopen if there's some action/bug here

mds1 avatar Apr 11 '23 21:04 mds1