Skip to content

Commit

Permalink
fix: need to resign resending stale txns (#131)
Browse files Browse the repository at this point in the history
* fix: need to resign resending stale txns

* go mock fix

* fix: fix ci
  • Loading branch information
hunter-bera authored Jan 16, 2025
1 parent 2484d81 commit fe44767
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 17 deletions.
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

0 comments on commit fe44767

Please sign in to comment.