diff --git a/client/eth/client_provider.go b/client/eth/client_provider.go index edc822d..232e805 100644 --- a/client/eth/client_provider.go +++ b/client/eth/client_provider.go @@ -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) { @@ -373,8 +373,6 @@ func (c *ChainProviderImpl) TransactionByHash( return nil, false, ErrClientNotFound } - - /* TxPoolContentFrom returns the pending and queued transactions of this address. Example response: diff --git a/client/eth/mocks/Client.go b/client/eth/mocks/Client.go index af89797..5b1825d 100644 --- a/client/eth/mocks/Client.go +++ b/client/eth/mocks/Client.go @@ -312,6 +312,36 @@ func (_m *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64 return r0, r1 } +// FeeHistory provides a mock function with given fields: ctx, blockCount, lastBlock, rewardPercentiles +func (_m *Client) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error) { + ret := _m.Called(ctx, blockCount, lastBlock, rewardPercentiles) + + if len(ret) == 0 { + panic("no return value specified for FeeHistory") + } + + var r0 *ethereum.FeeHistory + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64, *big.Int, []float64) (*ethereum.FeeHistory, error)); ok { + return rf(ctx, blockCount, lastBlock, rewardPercentiles) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64, *big.Int, []float64) *ethereum.FeeHistory); ok { + r0 = rf(ctx, blockCount, lastBlock, rewardPercentiles) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*ethereum.FeeHistory) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64, *big.Int, []float64) error); ok { + r1 = rf(ctx, blockCount, lastBlock, rewardPercentiles) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // FilterLogs provides a mock function with given fields: ctx, q func (_m *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) { ret := _m.Called(ctx, q) diff --git a/core/transactor/sender/utils.go b/core/transactor/sender/utils.go index b586e3f..c09faf8 100644 --- a/core/transactor/sender/utils.go +++ b/core/transactor/sender/utils.go @@ -20,12 +20,12 @@ 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. @@ -33,23 +33,23 @@ func BumpGas(tx *coretypes.Transaction) *coretypes.Transaction { 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, diff --git a/core/transactor/transactor.go b/core/transactor/transactor.go index 2c632cc..ec3e3f2 100644 --- a/core/transactor/transactor.go +++ b/core/transactor/transactor.go @@ -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)) } }