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

Feature: Enable forge create without signed tx #1060

Closed
sambacha opened this issue Mar 26, 2022 · 14 comments
Closed

Feature: Enable forge create without signed tx #1060

sambacha opened this issue Mar 26, 2022 · 14 comments
Labels
C-forge Command: forge Cmd-forge-create Command: forge create T-feature Type: feature

Comments

@sambacha
Copy link
Contributor

Component

Forge, Cast

Describe the feature you would like

I would like to use metamask or hashicorp vault to sign transactions for deployments. Forge currently requires a key be provided, it does not wait/poll for the request to return/etc. At minimum forge should wait for a transaction receipt. This is how metamask support would work: it sends the transaction signing request via rpc to metamask, metamask will return a transaction hash to it.

Additional context

No response

@sambacha sambacha added the T-feature Type: feature label Mar 26, 2022
@sambacha
Copy link
Contributor Author

sambacha commented Mar 27, 2022

You have to synchronize your wallet and then you debug it

I do not understand what you are saying? There is no 'synchronize'

@onbjerg
Copy link
Collaborator

onbjerg commented Mar 27, 2022

Please keep it civil 😄

@onbjerg onbjerg added C-forge Command: forge Cmd-forge-create Command: forge create labels Mar 27, 2022
@sambacha
Copy link
Contributor Author

Please keep it civil 😄

truffle / hardhat both have this capability

@onbjerg
Copy link
Collaborator

onbjerg commented Apr 13, 2022

I'm trying to infer here, so correct me if I'm wrong.

Going by #1273 (comment) and some of the details in this issue

If I understand correctly, you want to sign with a remote signer. This should already be possible using ETH_FROM (or -f/--from) together with ETH_RPC_URL (or --rpc-url) - Forge should ask the RPC to sign the transaction with the signer for ETH_FROM.

So:

  • To use HashiCorp Vault or something similar, you would need to write a wrapper that handles the required RPC requests
  • I don't think we can support MetaMask as that would require MetaMask to expose an endpoint.

Lastly, "At minimum forge should wait for a transaction receipt." - it already does this, so if you are observing something different, please provide steps to reproduce.

I've had some troubles understanding exactly what this issue was about since it talks about wallet providers, receipts and MetaMask RPC support (which I don't think is a thing?), but the title of the issue suggest you want a forge create --dry command or similar (i.e. one that does not sign the data).

@onbjerg onbjerg added this to Foundry Apr 17, 2022
@onbjerg onbjerg moved this to Todo in Foundry Apr 17, 2022
@chimera-defi
Copy link

Not the author but I was looking for a forge create --dry or some way to create a tx then sign it later / in step using a hardware wallet provider.
Basically keep the private key secure and not paste it into the cli on create every time
Seems similar to what the author maybe wants.
See this issue in hardhat-deploy for an example
wighawag/hardhat-deploy#88

@sambacha
Copy link
Contributor Author

I'm trying to infer here, so correct me if I'm wrong.

Going by #1273 (comment) and some of the details in this issue

If I understand correctly, you want to sign with a remote signer. This should already be possible using ETH_FROM (or -f/--from) together with ETH_RPC_URL (or --rpc-url) - Forge should ask the RPC to sign the transaction with the signer for ETH_FROM.

So:

  • To use HashiCorp Vault or something similar, you would need to write a wrapper that handles the required RPC requests

  • I don't think we can support MetaMask as that would require MetaMask to expose an endpoint.

Lastly, "At minimum forge should wait for a transaction receipt." - it already does this, so if you are observing something different, please provide steps to reproduce.

I've had some troubles understanding exactly what this issue was about since it talks about wallet providers, receipts and MetaMask RPC support (which I don't think is a thing?), but the title of the issue suggest you want a forge create --dry command or similar (i.e. one that does not sign the data).

Thank you for the detailed response. I will try later today. Also for metamask support I am using this: https://github.com/manifoldfinance/walletbus which basically bridges the shell to the browser window where metamask is enabled.

@sambacha
Copy link
Contributor Author

@chimera-defi given an ABI file you can call encode a transaction using this utility: https://www.npmjs.com/package/solidity-gencall - is this something like you are looking for?

I am pretty sure there is a way to do the same in Foundry through cast as well

@chimera-defi
Copy link

chimera-defi commented Apr 18, 2022

@chimera-defi given an ABI file you can call encode a transaction using this utility: https://www.npmjs.com/package/solidity-gencall - is this something like you are looking for?

I am pretty sure there is a way to do the same in Foundry through cast as well

Hey @sambacha something like that yea but would be nice to have in rust as part of foundry instead of as a standalone npm repo.
Basically looking to deploy from hardware wallets.
Do you recall the cast cmd you were thinking of?

@onbjerg
Copy link
Collaborator

onbjerg commented Apr 18, 2022

If you want to deploy from a Hardware wallet, you can use --ledger or --trezor. See the docs (specifically the wallet options)

@chimera-defi
Copy link

chimera-defi commented Apr 21, 2022 via email

@sambacha
Copy link
Contributor Author

I'm trying to infer here, so correct me if I'm wrong.

Going by #1273 (comment) and some of the details in this issue

If I understand correctly, you want to sign with a remote signer. This should already be possible using ETH_FROM (or -f/--from) together with ETH_RPC_URL (or --rpc-url) - Forge should ask the RPC to sign the transaction with the signer for ETH_FROM.

So:

  • To use HashiCorp Vault or something similar, you would need to write a wrapper that handles the required RPC requests
  • I don't think we can support MetaMask as that would require MetaMask to expose an endpoint.

Lastly, "At minimum forge should wait for a transaction receipt." - it already does this, so if you are observing something different, please provide steps to reproduce.

I've had some troubles understanding exactly what this issue was about since it talks about wallet providers, receipts and MetaMask RPC support (which I don't think is a thing?), but the title of the issue suggest you want a forge create --dry command or similar (i.e. one that does not sign the data).

The problem is eth_createAccessList which forge tries to call and metamask does not support

code: -32601
data: {origin: 'http://localhost:3000'}
message: "The method \"eth_createAccessList\" does not exist / is not available."

Also, setting ETH_FROM gives me this error:

Error:
   0: error accessing local wallet, did you set a private key, mnemonic or keystore? Run `cast send --help` or `forge create --help` and use the corresponding CLI flag to set your key via --private-key, --mnemonic-path, --interactive, --trezor or --ledger. Alternatively, if you're using a local node with unlocked accounts, set the `ETH_FROM` environment variable to the address of the account you want to use

BUT

cast send --rpc-url http://localhost:24012/rpc --from 0xcFa7Eae32032bF431aEd95532142A9c2B35715D4 0xcFa7Eae32032bF431aEd95532142A9c2B35715D4

works?

@sambacha
Copy link
Contributor Author

I end up getting this error now:

$ cast send --rpc-url http://localhost:24012/rpc --from 0xcFa7Eae32032bF431aEd95532142A9c2B35715D4 0xcFa7Eae32032bF431aEd95532142A9c2B35715D4 --gas-price 15010499
Error:
   0: (code: -32602, message: Invalid transaction envelope type: specified type "0x02" but including maxFeePerGas and maxPriorityFeePerGas requires type: "0x2", data: None)

@onbjerg
Copy link
Collaborator

onbjerg commented Apr 24, 2022

This seems like a totally separate issue? Can you please clarify what this issue is about?

@sambacha
Copy link
Contributor Author

This seems like a totally separate issue? Can you please clarify what this issue is about?

This is working now for forge as well, thx!

Repository owner moved this from Todo to Done in Foundry May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-create Command: forge create T-feature Type: feature
Projects
Archived in project
Development

No branches or pull requests

4 participants
@onbjerg @sambacha @chimera-defi and others