-
Notifications
You must be signed in to change notification settings - Fork 204
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
Mempool: handle not-executable transactions related to guardians #6628
Conversation
@@ -288,7 +288,7 @@ func (txProc *baseTxProcessor) checkGuardedAccountUnguardedTxPermission(tx *tran | |||
return nil | |||
} | |||
|
|||
func (txProc *baseTxProcessor) verifyGuardian(tx *transaction.Transaction, account state.UserAccountHandler) error { | |||
func (txProc *baseTxProcessor) VerifyGuardian(tx *transaction.Transaction, account state.UserAccountHandler) 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.
We now export this function (design workaround).
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.
We not?
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.
*we now (updated message above)
@@ -1417,7 +1411,12 @@ func (txs *transactions) computeSortedTxs( | |||
sortedTransactionsProvider := createSortedTransactionsProvider(txShardPool) | |||
log.Debug("computeSortedTxs.GetSortedTransactions") | |||
|
|||
sortedTxs := sortedTransactionsProvider.GetSortedTransactions(txs.accountStateProvider) | |||
session, err := newSelectionSession(txs.basePreProcess.accounts, txs.txProcessor) |
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 is intended. I've moved the instantiation here (and renamed the provider to session) - in the future, we can add an additional memoization mechanism within the session (hold the loaded account in a map). Once the selection ends, the session is simply dropped.
// Will be called by mempool during transaction selection. | ||
func (session *selectionSession) IsBadlyGuarded(tx data.TransactionHandler) bool { | ||
address := tx.GetSndAddr() | ||
account, err := session.accountsAdapter.GetExistingAccount(address) |
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.
In the near future, we'll add a memoization mechanism here (at a higher level than the accounts adapter cache).
@@ -288,7 +288,7 @@ func (txProc *baseTxProcessor) checkGuardedAccountUnguardedTxPermission(tx *tran | |||
return nil | |||
} | |||
|
|||
func (txProc *baseTxProcessor) verifyGuardian(tx *transaction.Transaction, account state.UserAccountHandler) error { | |||
func (txProc *baseTxProcessor) VerifyGuardian(tx *transaction.Transaction, account state.UserAccountHandler) 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.
We not?
process/transaction/export_test.go
Outdated
@@ -102,7 +102,7 @@ func (inTx *InterceptedTransaction) CheckMaxGasPrice() error { | |||
|
|||
// VerifyGuardian calls the un-exported method verifyGuardian | |||
func (txProc *txProcessor) VerifyGuardian(tx *transaction.Transaction, account state.UserAccountHandler) 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.
there is no need for this export now
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.
Indeed, removed (actually, by mistake, I did a bad recursive call).
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/mempool #6628 +/- ##
===============================================
Coverage ? 78.68%
===============================================
Files ? 754
Lines ? 99291
Branches ? 0
===============================================
Hits ? 78127
Misses ? 15891
Partials ? 5273 ☔ View full report in Codecov by Sentry. |
Reasoning behind the pull request
Proposed changes
VerifyGuardian
function.Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?