-
Notifications
You must be signed in to change notification settings - Fork 676
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
docs: document vm.prompt
display in script with external libs
#1315
Comments
I encountered the same issue. I believe there's a problem with the deployment of external libraries and the prompt sequence. When using a script where external libraries need to be deployed, this task is performed first, even before the The inputs from the second prompt overwrite those from the first. Initially, I thought the duplicated prompt was related to the simulation of the script, but using the |
vm.prompt
display in script with external libsforge script
): duplicate vm.prompt
display in script with external libs
@klkvr Potentially related to foundry-rs/foundry#8639? |
This is happening because of the way scripts handle external libraries deployment when private key is not known before running the script. Forge needs to know which address to use to deploy external libraries, and if the only signer is being resolved dynamically in script (in this case, by prompting private key), then we need to run script second time with correctly calculated library addresses, deployed by the prompted private key This is is not specific to |
Thanks for the explanation! Could a fix potentially be to skip showing the prompts the second time around and reuse the values provided the first time? |
Maybe it's simpler to invoke the script with |
This could work, though it might result in unexpected edge cases in situations where prompts order is not deterministic, so its hard to come up with a generally working approach here
if it will be missing, then script will just dry-run with default sender, and once you try to broadcast it will throw a error saying that script is missing sender, do you need some different behavior for this case? |
@klkvr never mind my suggestion, the problem is the same with |
is the script still using |
No I removed it since the |
Ok never mind I tried again and there is no double prompt with |
forge script
): duplicate vm.prompt
display in script with external libsvm.prompt
display in script with external libs
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (a0a0020 2024-08-12T00:21:34.427762642Z)
What command(s) is the bug in?
forge script
Operating System
Linux
Describe the bug
Repro code: https://github.com/beeb/foundry-repro-prompt-lib
When a contract must be linked against external libraries, and a Foundry script deploys such contract, prompts are
shown twice.
Reproduction steps:
anvil -a 1
forge script -f http://localhost:8545 --broadcast script/Counter.s.sol:CounterScript
0xac0974bec3...
If the deployed contract does not have external libraries that must be linked, the problem does not happen.
The text was updated successfully, but these errors were encountered: