diff --git a/tools/preconf-rpc/fastswap/fastswap.go b/tools/preconf-rpc/fastswap/fastswap.go index a80a58bbf..ef3cd3e88 100644 --- a/tools/preconf-rpc/fastswap/fastswap.go +++ b/tools/preconf-rpc/fastswap/fastswap.go @@ -224,12 +224,12 @@ func (s *Service) callBarter(ctx context.Context, reqBody barterRequest, logDesc req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", s.barterAPIKey)) - s.logger.Debug("calling Barter API", + s.logger.Info("calling Barter API", "type", logDescription, - "url", s.barterBaseURL+"/swap", - "source", reqBody.Source, - "target", reqBody.Target, - "sellAmount", reqBody.SellAmount, + "inputToken", reqBody.Source, + "outputToken", reqBody.Target, + "inputAmount", reqBody.SellAmount, + "outputAmount", reqBody.MinReturn, ) resp, err := s.httpClient.Do(req) @@ -384,7 +384,8 @@ func (s *Service) HandleSwap(ctx context.Context, req SwapRequest) (*SwapResult, nextBaseFee = big.NewInt(30_000_000_000) // 30 gwei fallback } gasTipCap := big.NewInt(0) // No priority fee - mev-commit bid handles inclusion - gasFeeCap := nextBaseFee // GasFeeCap = BaseFee (tip is 0) + // add buffer to fee cap to account for changes + gasFeeCap := new(big.Int).Mul(nextBaseFee, big.NewInt(2)) // 6. Build the transaction chainID := big.NewInt(int64(s.chainID)) diff --git a/tools/preconf-rpc/sender/sender.go b/tools/preconf-rpc/sender/sender.go index 700dcd10a..68297aaca 100644 --- a/tools/preconf-rpc/sender/sender.go +++ b/tools/preconf-rpc/sender/sender.go @@ -111,6 +111,7 @@ type Store interface { DeductBalance(ctx context.Context, account common.Address, amount *big.Int) error StoreTransaction(ctx context.Context, txn *Transaction, commitments []*bidderapiv1.Commitment, logs []*types.Log) error GetTransactionByHash(ctx context.Context, txnHash common.Hash) (*Transaction, error) + StoreReceipt(ctx context.Context, receipt *types.Receipt) error } type Bidder interface { @@ -579,6 +580,23 @@ func (t *TxSender) processQueuedTransactions(ctx context.Context) { txn.Status = TxStatusFailed txn.Details = err.Error() t.clearBlockAttemptHistory(txn, time.Now()) + + // Store a failed receipt to unblock the user's wallet + receipt := &types.Receipt{ + Type: txn.Transaction.Type(), + Status: types.ReceiptStatusFailed, + TxHash: txn.Hash(), + ContractAddress: common.Address{}, + GasUsed: 0, // 0 since no execution happened + CumulativeGasUsed: 0, + BlockHash: common.Hash{}, // Pending/Unknown + BlockNumber: big.NewInt(0), // Pending/Unknown + TransactionIndex: 0, + } + if storeErr := t.store.StoreReceipt(ctx, receipt); storeErr != nil { + t.logger.Error("Failed to store failed receipt", "error", storeErr) + } + defer t.signalReceiptAvailable(txn.Hash()) return t.store.StoreTransaction(ctx, txn, nil, nil) } diff --git a/tools/preconf-rpc/sender/sender_test.go b/tools/preconf-rpc/sender/sender_test.go index 71fad15cc..635455f69 100644 --- a/tools/preconf-rpc/sender/sender_test.go +++ b/tools/preconf-rpc/sender/sender_test.go @@ -162,6 +162,13 @@ func (m *mockStore) GetTransactionByHash( return txn, nil } +func (m *mockStore) StoreReceipt( + ctx context.Context, + receipt *types.Receipt, +) error { + return nil +} + type bidOp struct { bidAmount *big.Int slashAmount *big.Int