-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eval: split TestTransactionGroup from BlockEvaluator using TransactionGroupTester #5818
base: master
Are you sure you want to change the base?
Conversation
…ing TestEvalContext
506b9ed
to
b09a797
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5818 +/- ##
==========================================
- Coverage 51.88% 51.14% -0.75%
==========================================
Files 639 639
Lines 85489 85511 +22
==========================================
- Hits 44359 43736 -623
- Misses 38320 38909 +589
- Partials 2810 2866 +56 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a good idea, I had small comments, but willing to approve as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the idea is to have txpool.Test
executed without taking pool.mu
so do not block actual evaluation. LGTM
@@ -904,10 +904,34 @@ func (eval *BlockEvaluator) ResetTxnBytes() { | |||
eval.blockTxBytes = 0 | |||
} | |||
|
|||
// TestTransactionGroup is only called by tests. | |||
func (eval *BlockEvaluator) TestTransactionGroup(txgroup []transactions.SignedTxn) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then move it to eval_test.go?
@@ -1163,6 +1188,7 @@ func (eval *BlockEvaluator) transaction(txn transactions.SignedTxn, evalParams * | |||
} | |||
|
|||
// Transaction already in the ledger? | |||
// this checks against the txns added to this evaluator; testTransaction currently only checks against committed txns. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// this checks against the txns added to this evaluator; testTransaction currently only checks against committed txns.
This is not 100% accurate, checkDup
checks the ledger as well, maybe reword to "against the txns added to this evaluator and the ledger" ?
Summary
eval.TestTransactionGroup (and TestTransaction) need only read-only access to a few details about the next pending block. This introduces an interface TestEvalContext that is used by the transaction pool, so that there can be parallel TX backlog workers checking if transactions are well-formed and move them from the backlogQueue to the postVerificationQueue.
Test Plan
Updated TxHandler test that was checking Remember() vs Test() and counting metrics bumped by different kinds of err returns.