foundry
foundry copied to clipboard
cast send: add `--bump-fee` flag that resends with iteratively increasing gas price
Component
Cast
Describe the feature you would like
I'm using cast send extensively in some scripts. Sometimes they fail with replacement transaction underpriced. I suggest having a flag that allows bumping the gas price automatically so that the script can replace the stuck transaction.
- Option A:
--bump-fee. If the transaction encounters the above error, we try resending it with iteratively increasing gas price (e.g. +10%) until we succeed. - Option B:
--bump-fee <MAX_GAS_PRICE>. Same as above but provide an upper limit.
I can take a go at implementing this if you think this would be a useful feature.
Additional context
No response
we have --gas-estimate-multiplier in script which we can easily integrate here as well
@mattsse, I would like to pick this up. Could you give me some advice on how to solve this issue?
@mattsse @Thegaram I would like to pick this up!
Just some pointers I thought about before starting this:
- Where do we store the
fee(maxGas) in storage, so we can iteratively bump next time? - How do we reset
feeafter bumping? This is what I am proposing:- If any
sendcall succeeds, we reset the state - Else, we continuously increment if the
bump-feeflag is passed
- If any
Just a note @hackermayor1 — #4874 will add some changes to cast send that might affect your PR.
@Evalir any thoughts from the questions raised by @hackermayor1
I would like to pick this up!
Just some pointers I thought about before starting this:
Where do we store the fee (maxGas) in storage, so we can iteratively bump next time? How do we reset fee after bumping? This is what I am proposing: If any send call succeeds, we reset the state Else, we continuously increment if the bump-fee flag is passed
Closing in favor of https://github.com/foundry-rs/foundry/issues/1803
Hi @zerosnacks, these two seems to be different features. #1803 is a static, one-time multiplier, while this issue requests a way to automatically resend a transaction with a higher gas price.
I'm interested!
I'm interested!
Assigned!
Related: https://github.com/foundry-rs/foundry/issues/9067, this is a static multiplier for gas price for forge script / forge test whereas this ticket proposes an iteratively bumping up to a limit in cast
I think the ability to specify a max limit as proposed is important for safety / control
I'm interested!
Assigned!
Related: #9067, this is a static multiplier for
gas priceforforge script / forge testwhereas this ticket proposes an iteratively bumping up to a limit incastI think the ability to specify a max limit as proposed is important for safety / control
I agree, we should implement safeguards. I was thinking of the following:
- Gas price limit (by default, could be set to 150% or 200% of the initial gas price)
- Maximum number of bumps (default: 5) or set a timeout (default: 1 min for example)
- Configurable bump increase (default: 10%)
Unassigned, see #9147