Skip to content
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

Bci 3621/try new estimation for insufficient fund error instead of retry #14234

Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
090341b
update insufficient fund error to retry new estimation
huangzhen1997 Aug 26, 2024
7e81cec
add comment
huangzhen1997 Aug 26, 2024
7b293b4
add change set
huangzhen1997 Aug 26, 2024
8eb8a92
modify
huangzhen1997 Aug 26, 2024
a6168e1
fix test
huangzhen1997 Aug 27, 2024
b68fb2d
rewrite unit test to modify chain config locally in the unit test
huangzhen1997 Aug 27, 2024
f12c248
Merge branch 'develop' into BCI-3621/try-new-estimation-for-insuffici…
huangzhen1997 Aug 27, 2024
c93063d
remove a previous change
huangzhen1997 Aug 27, 2024
d7f19d1
remove unrelated comment
huangzhen1997 Aug 27, 2024
e858f60
extra
huangzhen1997 Aug 27, 2024
a581071
rephrase
huangzhen1997 Aug 27, 2024
acc9bfa
update comments
huangzhen1997 Aug 27, 2024
3cff2fc
refactor
huangzhen1997 Aug 27, 2024
5cde6d3
revert unit test
huangzhen1997 Aug 27, 2024
d71e9d2
Merge branch 'develop' into BCI-3621/try-new-estimation-for-insuffici…
huangzhen1997 Aug 27, 2024
aa7f9e2
update comments
huangzhen1997 Aug 27, 2024
6f490e3
refactor func call args
huangzhen1997 Aug 27, 2024
614da69
rename
huangzhen1997 Aug 27, 2024
27d6bdf
modify test
huangzhen1997 Aug 27, 2024
ff694a1
fix
huangzhen1997 Aug 28, 2024
c386194
revert function param
huangzhen1997 Aug 28, 2024
a8c424c
changeset
huangzhen1997 Aug 28, 2024
0ce01b4
changeset
huangzhen1997 Aug 28, 2024
84cc573
rephrase
huangzhen1997 Aug 28, 2024
765f061
address comments, refactor
huangzhen1997 Aug 28, 2024
6689d8a
refactor func name
huangzhen1997 Aug 28, 2024
0fdbc37
modify retrycount
huangzhen1997 Aug 28, 2024
15cbf29
fix unit tests
huangzhen1997 Aug 28, 2024
119f77d
rename
huangzhen1997 Aug 28, 2024
10c5cf9
rename
huangzhen1997 Aug 28, 2024
064c0ea
small refactor
huangzhen1997 Aug 28, 2024
5a6dfcc
nit
huangzhen1997 Aug 28, 2024
2113d34
update error
huangzhen1997 Aug 28, 2024
776a9db
modify test
huangzhen1997 Aug 28, 2024
940bdb9
add comments
huangzhen1997 Aug 28, 2024
26d071c
rm unused
huangzhen1997 Aug 28, 2024
2badc93
comments
huangzhen1997 Aug 29, 2024
d6e780b
fix
huangzhen1997 Aug 29, 2024
54e7c4d
adding returned retryable
huangzhen1997 Aug 29, 2024
9882b19
return true for retryable
huangzhen1997 Aug 29, 2024
ff4c290
one more
huangzhen1997 Aug 29, 2024
f019504
address comments
huangzhen1997 Aug 29, 2024
dfea008
revert changes in unit test, just update comment
huangzhen1997 Sep 2, 2024
d7c4f8d
Merge branch 'develop' into BCI-3621/try-new-estimation-for-insuffici…
huangzhen1997 Sep 2, 2024
12b2d92
update comment
huangzhen1997 Sep 3, 2024
8f60729
Merge branch 'develop' into BCI-3621/try-new-estimation-for-insuffici…
huangzhen1997 Sep 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename
  • Loading branch information
huangzhen1997 committed Aug 28, 2024
commit 10c5cf96cfa2355030e681a1acd04a0410c7f0d4
8 changes: 4 additions & 4 deletions common/txmgr/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,15 +713,15 @@ func (eb *Broadcaster[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) repl
}

func (eb *Broadcaster[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) replaceAttemptWithNewEstimation(ctx context.Context, lgr logger.Logger, etx txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], attempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) (updatedAttempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error, retryable bool) {
replacementAttempt, fee, feeLimit, retryable, err := eb.NewTxAttemptWithType(ctx, etx, lgr, attempt.TxType, feetypes.OptForceRefetch)
newEstimatedAttempt, fee, feeLimit, retryable, err := eb.NewTxAttemptWithType(ctx, etx, lgr, attempt.TxType, feetypes.OptForceRefetch)
if err != nil {
return replacementAttempt, fmt.Errorf("replaceAttemptWithNewEstimation failed to build new attempt: %w", err), retryable
return newEstimatedAttempt, fmt.Errorf("replaceAttemptWithNewEstimation failed to build new attempt: %w", err), retryable
}
lgr.Warnw("L2 rejected transaction due to incorrect fee, re-estimated and will try again",
amit-momin marked this conversation as resolved.
Show resolved Hide resolved
"etxID", etx.ID, "err", err, "newGasPrice", fee, "newGasLimit", feeLimit)

replacementAttempt, err = eb.saveReplacementAttempt(ctx, lgr, attempt, replacementAttempt, fee, feeLimit)
return replacementAttempt, err, retryable
newEstimatedAttempt, err = eb.saveReplacementAttempt(ctx, lgr, attempt, newEstimatedAttempt, fee, feeLimit)
return newEstimatedAttempt, err, retryable
}

func (eb *Broadcaster[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) saveReplacementAttempt(ctx context.Context, lgr logger.Logger, attempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], replacementAttempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], newFee FEE, newFeeLimit uint64) (newAttempt txmgrtypes.TxAttempt[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error) {
Expand Down
Loading