foundry
foundry copied to clipboard
forge script --broadcast hangs with "waiting for receipts"
Component
Forge, Cast
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 (293fad7 2024-01-14T00:19:24.272194000Z)
What command(s) is the bug in?
No response
Operating System
macOS (Apple Silicon)
Describe the bug
I'm running a fairly heavy script (deploying the OP stack contracts), and when doing this, forge script
sometimes hang on "Waiting for receipts."
After inspecting the geth logs, it seems that 5 out of the 50 sent transactions simply linger in the mempool (marked as "executable" but not "queued").
My hunch is that this is due to the basefee being set too low by forge. Some of the contracts being deployed are really large.
The problem does not appear every time, I believe it is due to how the transactions are split in blocks. In the instance I was debugging, there was one block with 7 txs and 4M gas and one block with 38 txs and 28M gas.
Because geth --dev
doesn't produce blocks when there is no txs that can be included in a block, the basefee never goes down and the remaining txs are stuck in limbo forever.
It's possible that the problem is something else, but this seems like the simplest explanation.
The problem is also solved when setting --dev.period 1
on the geth node. It could also probably be solved by manually specifying a high basefee with --with-gas-price
on forge script
(since it's a local devnet).
Nevertheless, it seems like a pretty annoying issue, and it's hard to debug, it would be great if forge script
could poll the RPC for the basefee and check if it needs to reprice the transactions.
This might also cause issues on non-dev setups. I'm usually not able to use this deploy script for deployments of the OP stack on testnets, resorting to using the --slow
flag. I had those issues pinned on the RPC being flaky, but now I'm wondering if it's not the same problem after all.
experiencing the same issue using a mainnet forked anvil node. wasn't experience this in nightly-5b7e4cb3c882b28f3c32ba580de27ce7381f415a script hanging on "waiting for receipts"
increase gas-price-limit
increase gas-price-limit
How? Please help me out, having trouble finding online resources. What's the right gas price to set, how do I increase it?
forge script script/DeployScript.s.sol --rpc-url $ETHEREUM_SEPOLIA --broadcast --account bob --priority-gas-price 1 -vvvv
Running the above currently and it hangs on waiting for receipts
increase gas-price-limit
How? Please help me out, having trouble finding online resources. What's the right gas price to set, how do I increase it?
forge script script/DeployScript.s.sol --rpc-url $ETHEREUM_SEPOLIA --broadcast --account bob --priority-gas-price 1 -vvvv
Running the above currently and it hangs on waiting for receipts
Same here. Trying to run a script which does several transactions, but it gets stuck waiting for receipts.
Encountering this in Arbitrum, haven't tested on other networks. Scripts can only be broadcasted fully with the help of --resume
. Sometimes a receipt or two is received before the hang.
I am using following justfile
scripts for this:
@deploy script sig:
forge script $1 --sig "$2()" --ffi --broadcast \
--chain arbitrum \
--fork-url "$RPC_ARBITRUM" \
--verify
@resume script sig:
forge script $1 --sig "$2()" --ffi --broadcast \
--chain arbitrum \
--skip-simulation \
--rpc-url "$RPC_ARBITRUM" \
--verify \
--resume