foundry icon indicating copy to clipboard operation
foundry copied to clipboard

cast send: add `--bump-fee` flag that resends with iteratively increasing gas price

Open Thegaram opened this issue 2 years ago • 10 comments

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

Thegaram avatar Mar 01 '23 08:03 Thegaram

we have --gas-estimate-multiplier in script which we can easily integrate here as well

mattsse avatar Mar 01 '23 15:03 mattsse

@mattsse, I would like to pick this up. Could you give me some advice on how to solve this issue?

karpa4o4 avatar Apr 13 '23 13:04 karpa4o4

@mattsse @Thegaram I would like to pick this up!

Just some pointers I thought about before starting this:

  1. Where do we store the fee (maxGas) in storage, so we can iteratively bump next time?
  2. How do we reset fee after bumping? This is what I am proposing:
    1. If any send call succeeds, we reset the state
    2. Else, we continuously increment if the bump-fee flag is passed

hackermayor1 avatar May 06 '23 04:05 hackermayor1

Just a note @hackermayor1 — #4874 will add some changes to cast send that might affect your PR.

Evalir avatar May 06 '23 11:05 Evalir

@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

andyrobert3 avatar Jun 25 '23 17:06 andyrobert3

Closing in favor of https://github.com/foundry-rs/foundry/issues/1803

zerosnacks avatar Aug 01 '24 12:08 zerosnacks

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.

Thegaram avatar Aug 02 '24 20:08 Thegaram

I'm interested!

leovct avatar Oct 10 '24 08:10 leovct

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

zerosnacks avatar Oct 10 '24 08:10 zerosnacks

I'm interested!

Assigned!

Related: #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 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%)

leovct avatar Oct 10 '24 08:10 leovct

Unassigned, see #9147

onbjerg avatar Sep 19 '25 13:09 onbjerg