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

fix: need to resign resending stale txns #131

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions client/eth/client_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func (c *ChainProviderImpl) SuggestGasTipCap(ctx context.Context) (*big.Int, err
return nil, ErrClientNotFound
}

// FeeHistory returns the fee history for the given block count, last block, and reward percentiles.
// FeeHistory returns fee history for the given block count, last block, and reward percentiles.
func (c *ChainProviderImpl) FeeHistory(
ctx context.Context, blockCount uint64, lastBlock *big.Int,
rewardPercentiles []float64) (*ethereum.FeeHistory, error) {
Expand Down Expand Up @@ -373,8 +373,6 @@ func (c *ChainProviderImpl) TransactionByHash(
return nil, false, ErrClientNotFound
}



/*
TxPoolContentFrom returns the pending and queued transactions of this address.
Example response:
Expand Down
30 changes: 30 additions & 0 deletions client/eth/mocks/Client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions core/transactor/sender/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,36 @@ func BumpGas(tx *coretypes.Transaction) *coretypes.Transaction {
switch tx.Type() {
case coretypes.DynamicFeeTxType, coretypes.BlobTxType:
// Bump the existing gas tip cap 15% (10% is required but add a buffer to be safe).
bumpedGasTipCap := new(big.Int).Mul(tx.GasTipCap(), multiplier)
bumpedGasTipCap = new(big.Int).Quo(bumpedGasTipCap, quotient)
// bumpedGasTipCap := new(big.Int).Mul(tx.GasTipCap(), multiplier)
// bumpedGasTipCap = new(big.Int).Quo(bumpedGasTipCap, quotient)

// Bump the existing gas fee cap 15% (only 10% required but add a buffer to be safe).
bumpedGasFeeCap := new(big.Int).Mul(tx.GasFeeCap(), multiplier)
bumpedGasFeeCap = new(big.Int).Quo(bumpedGasFeeCap, quotient)
// bumpedGasFeeCap := new(big.Int).Mul(tx.GasFeeCap(), multiplier)
// bumpedGasFeeCap = new(big.Int).Quo(bumpedGasFeeCap, quotient)

if tx.Type() == coretypes.BlobTxType {
// Bump the existing blob gas fee cap 15%. // TODO: verify that this is correct.
bumpedBlobGasFeeCap := new(big.Int).Mul(tx.BlobGasFeeCap(), multiplier)
bumpedBlobGasFeeCap = new(big.Int).Quo(bumpedBlobGasFeeCap, quotient)

innerTx = &coretypes.BlobTx{
Nonce: tx.Nonce(),
To: *tx.To(),
Gas: tx.Gas(),
Value: uint256.MustFromBig(tx.Value()),
Data: tx.Data(),
Nonce: tx.Nonce(),
To: *tx.To(),
Gas: tx.Gas(),
Value: uint256.MustFromBig(tx.Value()),
Data: tx.Data(),
// GasTipCap: uint256.MustFromBig(bumpedGasTipCap),
// GasFeeCap: uint256.MustFromBig(bumpedGasFeeCap),
GasTipCap: nil,
GasFeeCap: nil,
GasTipCap: nil,
GasFeeCap: nil,
BlobFeeCap: uint256.MustFromBig(bumpedBlobGasFeeCap),
BlobHashes: tx.BlobHashes(),
Sidecar: tx.BlobTxSidecar(),
}
} else {
innerTx = &coretypes.DynamicFeeTx{
ChainID: tx.ChainId(),
Nonce: tx.Nonce(),
ChainID: tx.ChainId(),
Nonce: tx.Nonce(),
// GasTipCap: bumpedGasTipCap,
// GasFeeCap: bumpedGasFeeCap,
GasTipCap: nil,
Expand Down
3 changes: 2 additions & 1 deletion core/transactor/transactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ func (t *TxrV2) resendStaleTxns(ctx context.Context, chain eth.Client) error {
if pendingTxs := txPoolContent["pending"]; len(pendingTxs) > 0 {
t.logger.Info("🔄 resending stale (pending in txpool) txs", "count", len(pendingTxs))
for _, tx := range pendingTxs {
t.fire(ctx, &tracker.Response{Transaction: sender.BumpGas(tx)}, false)
resp := &tracker.Response{Transaction: sender.BumpGas(tx)}
t.fire(ctx, resp, true, types.CallMsgFromTx(resp.Transaction))
}
}

Expand Down
Loading