-
Notifications
You must be signed in to change notification settings - Fork 22
"FeeBoost" : SVR Gas Strategy #417
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
Changes from all commits
30edb84
48d416b
32a57d4
c74a880
bbef5d5
7fb71f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a test case in |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,28 +23,34 @@ type attemptBuilder struct { | |
| priceMaxKey func(common.Address) *assets.Wei | ||
| keystore keys.TxSigner | ||
| emptyTxLimitDefault uint64 | ||
| feeBoost bool | ||
| } | ||
|
|
||
| func NewAttemptBuilder(priceMaxKey func(common.Address) *assets.Wei, estimator gas.EvmFeeEstimator, keystore keys.TxSigner, emptyTxLimitDefault uint64) *attemptBuilder { | ||
| func NewAttemptBuilder(priceMaxKey func(common.Address) *assets.Wei, estimator gas.EvmFeeEstimator, keystore keys.TxSigner, emptyTxLimitDefault uint64, feeBoost bool) *attemptBuilder { | ||
| return &attemptBuilder{ | ||
| priceMaxKey: priceMaxKey, | ||
| EvmFeeEstimator: estimator, | ||
| keystore: keystore, | ||
| emptyTxLimitDefault: emptyTxLimitDefault, | ||
| feeBoost: feeBoost, | ||
| } | ||
| } | ||
|
|
||
| func (a *attemptBuilder) NewAttempt(ctx context.Context, lggr logger.Logger, tx *types.Transaction, dynamic bool) (*types.Attempt, error) { | ||
| var fee gas.EvmFee | ||
| var estimatedGasLimit uint64 | ||
| var err error | ||
| if tx.IsPurgeable { | ||
| fee, estimatedGasLimit, err = a.EvmFeeEstimator.GetMaxFee(ctx, tx.Data, a.emptyTxLimitDefault, a.priceMaxKey(tx.FromAddress), &tx.FromAddress, &tx.ToAddress) | ||
| if tx.IsPurgeable || a.feeBoost { | ||
| gasLimit := tx.SpecifiedGasLimit | ||
| if tx.IsPurgeable { | ||
| gasLimit = a.emptyTxLimitDefault | ||
| } | ||
| fee, estimatedGasLimit, err = a.GetMaxFee(ctx, tx.Data, gasLimit, a.priceMaxKey(tx.FromAddress), &tx.FromAddress, &tx.ToAddress) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| } else { | ||
| fee, estimatedGasLimit, err = a.EvmFeeEstimator.GetFee(ctx, tx.Data, tx.SpecifiedGasLimit, a.priceMaxKey(tx.FromAddress), &tx.FromAddress, &tx.ToAddress) | ||
| fee, estimatedGasLimit, err = a.GetFee(ctx, tx.Data, tx.SpecifiedGasLimit, a.priceMaxKey(tx.FromAddress), &tx.FromAddress, &tx.ToAddress) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
@@ -69,9 +75,14 @@ func (a *attemptBuilder) NewBumpAttempt(ctx context.Context, lggr logger.Logger, | |
| } | ||
|
|
||
| func (a *attemptBuilder) NewAgnosticBumpAttempt(ctx context.Context, lggr logger.Logger, tx *types.Transaction, dynamic bool) (attempt *types.Attempt, err error) { | ||
| // if the transaction is purgeable, NewAttempt will return the max fee instantly, so there is no need to bump | ||
| // if the transaction is purgeable or feeBoost is enabled, NewAttempt will return the max fee instantly, so there is no need to bump | ||
| attempt, err = a.NewAttempt(ctx, lggr, tx, dynamic) | ||
| if tx.IsPurgeable || err != nil { | ||
|
|
||
| if err != nil { | ||
| return | ||
| } | ||
|
|
||
| if tx.IsPurgeable || a.feeBoost { | ||
| return | ||
| } | ||
|
Comment on lines
77
to
87
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.