-
Notifications
You must be signed in to change notification settings - Fork 10
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
Supporting forge script
for Foundry tools
#247
Comments
I had a shot at this locally and on PreviewNet, but I can't seem to reproduce any failures. Here's what I got: $ cast wallet new
Successfully created new keypair.
Address: 0xd6AACF6C06908dd6CB525bd7d999A7C9F36c6AaE
Private key: 0x32589b2b129a420489a109929f5aa82a3e6ff116303972c4e0fb3e9163d9edd5 $ forge create --rpc-url https://previewnet.evm.nodes.onflow.org \
--private-key 0x32589b2b129a420489a109929f5aa82a3e6ff116303972c4e0fb3e9163d9edd5 \
--legacy \
src/Counter.sol:Counter
[⠊] Compiling...
No files changed, compilation skipped
Deployer: 0xd6AACF6C06908dd6CB525bd7d999A7C9F36c6AaE
Deployed to: 0x50aC67b41B4610657F895f2f80a3Fc2816ca172C
Transaction hash: 0x13d699907209491f85f5858337cfb6f29918560bcf4c362239e68b34c1b528e6 $ export PRIVATE_KEY=0x32589b2b129a420489a109929f5aa82a3e6ff116303972c4e0fb3e9163d9edd5
$ forge script script/Counter.s.sol:CounterScript \
--broadcast \
-vvv \
--legacy \
--rpc-url https://previewnet.evm.nodes.onflow.org/
[⠒] Compiling...
No files changed, compilation skipped
Script ran successfully.
## Setting up 1 EVM.
==========================
Chain 646
Estimated gas price: 0 gwei
Estimated total gas used for script: 138729
Estimated amount required: 0. ETH
==========================
##
Sending transactions [0 - 0].
⠁ [00:00:00] [###########################################################################################] 1/1 txes (0.0s)##
Waiting for receipts.
⠉ [00:00:07] [#######################################################################################] 1/1 receipts (0.0s)
##### 646
✅ [Success]Hash: 0xb92434f0e232993b091c9a6a819a593e0e908f72fc79012ef8ce800ef268944c
Contract Address: 0x9d533aeD3486648B2A94e73899CA57D82E3856b3
Block: 5988
Gas Used: 106733
==========================
ONCHAIN EXECUTION COMPLETE & SUCCESSFUL.
Total Paid: 0. ETH (106733 gas * avg 0 gwei)
Transactions saved to: /home/mpeter/Dev/forge-testing/broadcast/Counter.s.sol/646/run-latest.json
Sensitive values saved to: /home/mpeter/Dev/forge-testing/cache/Counter.s.sol/646/run-latest.json @nvdtf Can you make another attempt on this, and let me know? |
I just recreated and tried again and got success like you. Can't produce a failure right now, but this was the behaviour when I reported this issue. I need to find what triggers failures and if it's happening still or not. Will report back to Circle to test. Will keep this issue open in case we find out more. |
Getting errors now, can't produce a success case:
UPDATE 2: Could Foundry be querying accounts for nonces and can't fetch them? |
@sideninja for visibility |
I found a way to make the failure go away:
This makes me think this might be related to block production on PreviewNet and what tools expect. Using the faucet produces a new block. Maybe if the latest block is stale, the tool can't query something it needs like a nonce? |
@nvdtf Thanks for the detailed breakdown.
Regarding the above, this looks similar to the issue I discovered here: NomicFoundation/hardhat-ignition#738 (comment). Where the command hangs until the necessary blocks for tx confirmation are produced. |
@nvdtf Regarding the block of USDC EVM deployment, I think this comment, solves the error you faced. As for the current issue, I am not able to re-produce a failure, neither locally nor in PreviewNet.
I found out that hardhat-ignition plugin makes use of confirmations, which is basically related to block production. But there's a setting to override this. I am closing the issue for now. Feel free to re-open, if you find something strange 🙏 |
Instructions
Foundry is a popular EVM toolchain. We've received reports from partners having trouble using it with Flow PreviewNet, specifically the
script
feature to manage deployments and updates.A similar problem has been observed with HardHat Ignition (NomicFoundation/hardhat-ignition#738).
Problem
Foundry can deploy contracts normally using
forge create
but deployments withforge script
error. The error we see is:This error does not happen continuously. There are periods of time where the script runs and succeeds but mostly it fails with the above error. We couldn't find a specific pattern to succeed/fail.
Steps to Reproduce
Here's a quick way to reproduce this error:
Init a new project:
Create new key pair and fund with faucet:
Normal deployment succeeds with starter template contract:
forge create --rpc-url https://previewnet.evm.nodes.onflow.org \ --private-key $YOUR_PRIVATE_KEY \ --legacy \ src/Counter.sol:Counter
Update
script/Counter.s.sol
:Run script (will fail):
export PRIVATE_KEY=0xPRIVATE_KEY forge script script/Counter.s.sol:CounterScript \ --broadcast \ -vvv \ --legacy \ --rpc-url https://previewnet.evm.nodes.onflow.org/
Acceptance Criteria
forge script
should function properly asforge create
.Context
This is blocking to USDC EVM development as they are relying on deployment scripts. You can check out sample Circle scripts here but the simple case outlined above will also reproduce the error.
The text was updated successfully, but these errors were encountered: