foundry
foundry copied to clipboard
feat(cast): implement auto gas price adjustment for stuck transactions in `cast send`
Motivation
Closes #4454
Solution
Implement a new flag called --bump-fee
, in cast send
, to automatically bump transactions gas price. The idea is to be able to automatically replace stuck transactions during busy network times. Instead of manually adjusting the gas price, the user can specify the --bump-fee
flag and cast
will automatically adjust the gas price to replace the transaction.
The following safeguards have been implemented:
- A gas price bump limit percentage can be set by the user, by default it it set to 150%. It represents the maximum total percentage increase allowed for gas price. For example, a value of 150 means the gas price will never exceed 150% of the original price (1.5 times the initial price).
- A maximum number of gas price bumps can also be set by the user, by default set to 3.
The gas price increment is also configurable. By default, it is set to 10%, meaning that the gas price will be increased by 10% of the original gas price on each retry.