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 stuck when running anvil with fixed block time #7844

Closed
2 tasks done
Tracked by #8269
Thegaram opened this issue May 3, 2024 · 3 comments
Closed
2 tasks done
Tracked by #8269

bug: forge script stuck when running anvil with fixed block time #7844

Thegaram opened this issue May 3, 2024 · 3 comments
Labels
C-anvil Command: anvil Cmd-forge-script Command: forge script P-normal Priority: normal T-bug Type: bug T-to-investigate Type: to investigate T-to-reproduce Type: requires reproduction
Milestone

Comments

@Thegaram
Copy link

Thegaram commented May 3, 2024

Component

Anvil

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (d495216 2024-05-03T00:21:54.426103000Z)

What command(s) is the bug in?

No response

Operating System

macOS (Apple Silicon)

Describe the bug

Not sure if this is an issue with anvil or forge script.

I have a forge script that sends about 60 transactions. It works well with anvil, but it's stuck indefinitely with anvil --block-time 3.

[⠑] Compiling...
No files changed, compilation skipped
Script ran successfully.

## Setting up 1 EVM.

==========================

Chain 111111

Estimated gas price: 0.158191454 gwei

Estimated total gas used for script: 44606349

Estimated amount required: 0.007056343205941446 ETH

==========================
##
Sending transactions [0 - 56].
⠒ [00:00:00] [###############################################################################################################################>---------------------------------------------------------------------] 37/57 txes (0.1s)##
Waiting for receipts.
⠐ [00:00:07] [##############################################################################################################>--------------------------------------------------------------------------------] 33/57 receipts (160.9s)

On the anvil console output I see one block with a bunch of transactions, the next block with 1 transaction, then all subsequent blocks have 0 transactions. I also see non-stop eth_getTransactionReceipt logs.

It works if I run forge script with --batch-size 10, but it's stuck with the default setting.

@Thegaram Thegaram added the T-bug Type: bug label May 3, 2024
@zerosnacks zerosnacks added C-anvil Command: anvil Cmd-forge-script Command: forge script labels Jun 27, 2024
@zerosnacks zerosnacks added the T-to-investigate Type: to investigate label Jul 15, 2024
@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
@gititGoro
Copy link

The --slow option is the solution. The scripts try to spam the chain with as many TXs at once. From the docs

--slow
    Makes sure a transaction is sent, only after its previous one has been confirmed and succeeded.

@zerosnacks zerosnacks added T-to-reproduce Type: requires reproduction P-normal Priority: normal labels Oct 22, 2024
@zerosnacks zerosnacks changed the title Forge script stuck when running anvil with fixed block time bug: forge script stuck when running anvil with fixed block time Oct 22, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Oct 22, 2024
@grandizzy
Copy link
Collaborator

grandizzy commented Nov 10, 2024

@Thegaram could you pls try with latest version, waiting for receipt was changed to better handle errors and avoid infinite loop (#9253) so wonder what's the output. Thank you!

@grandizzy
Copy link
Collaborator

optimistically closing it as waiting for receipt should not get stuck anymore after the fix. please reopen if you hit this again, thank you!

@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil Cmd-forge-script Command: forge script P-normal Priority: normal T-bug Type: bug T-to-investigate Type: to investigate T-to-reproduce Type: requires reproduction
Projects
Archived in project
Development

No branches or pull requests

4 participants