Skip to content
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
1 change: 1 addition & 0 deletions data/pools/transactionPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ func (pool *TransactionPool) addToPendingBlockEvaluatorOnce(txgroup []transactio
Round: r,
FirstValid: tx.Txn.FirstValid,
LastValid: tx.Txn.LastValid,
Early: false,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions data/transactions/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type TxnDeadError struct {
Round basics.Round
FirstValid basics.Round
LastValid basics.Round
Early bool
}

func (err *TxnDeadError) Error() string {
Expand Down
1 change: 1 addition & 0 deletions data/transactions/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ func (tx Header) Alive(tc TxnContext) error {
Round: round,
FirstValid: tx.FirstValid,
LastValid: tx.LastValid,
Early: round < tx.FirstValid,
}
}

Expand Down
17 changes: 13 additions & 4 deletions data/txHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ var transactionGroupTxSyncAlreadyCommitted = metrics.MakeCounter(metrics.Transac

var transactionMessageTxPoolRememberCounter = metrics.NewTagCounter(
"algod_transaction_messages_txpool_remember_{TAG}", "Number of transaction messages not remembered by txpool b/c if {TAG}",
txPoolRememberTagCap, txPoolRememberPendingEval, txPoolRememberTagNoSpace, txPoolRememberTagFee, txPoolRememberTagTxnDead, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
txPoolRememberTagCap, txPoolRememberPendingEval, txPoolRememberTagNoSpace, txPoolRememberTagFee, txPoolRememberTagTxnDead, txPoolRememberTagTxnEarly, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
txPoolRememberTagTxID, txPoolRememberTagLease, txPoolRememberTagTxIDEval, txPoolRememberTagLeaseEval, txPoolRememberTagEvalGeneric,
)

var transactionMessageTxPoolCheckCounter = metrics.NewTagCounter(
"algod_transaction_messages_txpool_check_{TAG}", "Number of transaction messages that didn't pass check by txpool b/c if {TAG}",
txPoolRememberTagTxnNotWellFormed, txPoolRememberTagTxnDead, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
txPoolRememberTagTxnNotWellFormed, txPoolRememberTagTxnDead, txPoolRememberTagTxnEarly, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
txPoolRememberTagTxID, txPoolRememberTagLease, txPoolRememberTagTxIDEval, txPoolRememberTagLeaseEval, txPoolRememberTagEvalGeneric,
)

Expand All @@ -85,6 +85,7 @@ const (
txPoolRememberTagNoSpace = "no_space"
txPoolRememberTagFee = "fee"
txPoolRememberTagTxnDead = "txn_dead"
txPoolRememberTagTxnEarly = "txn_early"
txPoolRememberTagTooLarge = "too_large"
txPoolRememberTagGroupID = "groupid"
txPoolRememberTagTxID = "txid"
Expand Down Expand Up @@ -290,7 +291,11 @@ func (handler *TxHandler) checkReportErrors(err error) {
transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnNotWellFormed, 1)
return
case *transactions.TxnDeadError:
transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnDead, 1)
if err.Early {
transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnEarly, 1)
} else {
transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnDead, 1)
}
return
case *ledgercore.TransactionInLedgerError:
if err.InBlockEvaluator {
Expand Down Expand Up @@ -348,7 +353,11 @@ func (handler *TxHandler) rememberReportErrors(err error) {
transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagFee, 1)
return
case *transactions.TxnDeadError:
transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagTxnDead, 1)
if err.Early {
transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagTxnEarly, 1)
} else {
transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagTxnDead, 1)
}
return
case *ledgercore.TransactionInLedgerError:
if err.InBlockEvaluator {
Expand Down
12 changes: 11 additions & 1 deletion data/txHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1763,9 +1763,19 @@ func TestTxHandlerRememberReportErrorsWithTxPool(t *testing.T) {
handler.postProcessCheckedTxn(&wi)
require.Equal(t, 1, getMetricCounter(txPoolRememberTagEvalGeneric))

// trigger TxnDeadErr from the evaluator
// trigger TxnDeadErr from the evaluator for "early" case
txn2 = txn1
txn2.FirstValid = ledger.LastRound() + 10
prevTxnEarly := getMetricCounter(txPoolRememberTagTxnEarly)
wi.unverifiedTxGroup = []transactions.SignedTxn{txn2.Sign(secrets[0])}
handler.postProcessCheckedTxn(&wi)
require.Equal(t, prevTxnEarly+1, getMetricCounter(txPoolRememberTagTxnEarly))
handler.checkAlreadyCommitted(&wi)
require.Equal(t, 1, getCheckMetricCounter(txPoolRememberTagTxnEarly))

// trigger TxnDeadErr from the evaluator for "late" case
txn2 = txn1
txn2.LastValid = 0
prevTxnDead := getMetricCounter(txPoolRememberTagTxnDead)
wi.unverifiedTxGroup = []transactions.SignedTxn{txn2.Sign(secrets[0])}
handler.postProcessCheckedTxn(&wi)
Expand Down