Skip to content

Commit

Permalink
Ensures txpool recovers sender for txes
Browse files Browse the repository at this point in the history
There seems to be a bug where the txpool may not appropriately set the
sender address.  This leads to incorrectly admitting transactions into
mining blocks, as the wrong address is referenced.

This commit adds a check that if the sender address is not set, it
attempts to directly recover the sender from the transaction data and
set that instead.
  • Loading branch information
jyellick committed May 17, 2024
1 parent 23ca754 commit 237a74a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions eth/stagedsync/stage_mining_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,17 @@ func getNextTransactions(

var sender libcommon.Address
copy(sender[:], txSlots.Senders.At(i))
if sender == (libcommon.Address{}) {
v, r, s := transaction.RawSignatureValues()
signer := types.MakeSigner(&cfg.chainConfig, header.Number.Uint64(), header.Time)
address, err := transaction.Sender(*signer)
if err != nil {
logger.Error("Recovered sender from txpool as empty but could not recover sender", "txHash", transaction.Hash(), "txType", transaction.Type(), "nonce", transaction.GetNonce(), "v", v, "r", r, "s", s, "err", err)
continue
}
logger.Warn("Recovered sender from txpool as empty", "txHash", transaction.Hash(), "txType", transaction.Type(), "nonce", transaction.GetNonce(), "v", v, "r", r, "s", s, "address", address)
sender = address
}

// Check if tx nonce is too low
txs = append(txs, transaction)
Expand Down

0 comments on commit 237a74a

Please sign in to comment.