-
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
Don't notify cache about nonces; pass the account nonce provider, instead #6603
Conversation
Optimization: encode hash to hex only on log TRACE level set
…/mx-chain-go into MX-16107-no-more-notify
…ace(). Encoding will happen under the hood (if trace is active).
…rom account state is necessary).
@@ -600,6 +600,7 @@ func createProcessorsForShardGenesisBlock(arg ArgsGenesisBlockCreator, enableEpo | |||
disabledScheduledTxsExecutionHandler, | |||
disabledProcessedMiniBlocksTracker, | |||
arg.TxExecutionOrderHandler, | |||
disabledGuardian.NewDisabledGuardedAccountHandler(), |
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.
Genesis components, we can pass this object.
IsInterfaceNil() bool | ||
} | ||
|
||
// TxCache defines the functionality for the transactions cache | ||
type TxCache interface { | ||
SelectTransactions(gasRequested uint64, maxNum int) ([]*txcache.WrappedTransaction, uint64) | ||
NotifyAccountNonce(accountKey []byte, nonce uint64) | ||
SelectTransactions(accountStateProvider txcache.AccountStateProvider, gasRequested uint64, maxNum int, selectionLoopMaximumDuration time.Duration) ([]*txcache.WrappedTransaction, uint64) |
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.
Now, we pass the (wrapped) accounts adapter; the mempool will be much more informed during selection.
@@ -136,15 +130,6 @@ func checkMiniBlocksBuilderArgs(args miniBlocksBuilderArgs) error { | |||
return nil | |||
} | |||
|
|||
func (mbb *miniBlocksBuilder) updateAccountShardsInfo(tx *transaction.Transaction, wtx *txcache.WrappedTransaction) { |
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.
Was used for mempool notifications.
@@ -446,6 +448,26 @@ func TestTxsPreprocessor_NewTransactionPreprocessorNilProcessedMiniBlocksTracker | |||
assert.Equal(t, process.ErrNilProcessedMiniBlocksTracker, err) | |||
} | |||
|
|||
func TestTxsPreprocessor_NewTransactionPreprocessorNilTxExecutionOrderHandler(t *testing.T) { |
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.
Was missing before.
@@ -143,3 +144,6 @@ const TxCacheSelectionGasRequested = 10_000_000_000 | |||
|
|||
// TxCacheSelectionMaxNumTxs defines the maximum number of transactions that should be selected from the cache. | |||
const TxCacheSelectionMaxNumTxs = 50000 | |||
|
|||
// TxCacheSelectionLoopMaximumDuration defines the maximum duration for the loop that selects transactions from the cache. | |||
const TxCacheSelectionLoopMaximumDuration = 250 * time.Millisecond |
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.
Question for review: all right?
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.
sounds good for 6 second round time, can remain like this. should be much lower for sub second round times
log.Trace("accountsDB.saveAccountToTrie", | ||
"address", hex.EncodeToString(accountHandler.AddressBytes()), | ||
) | ||
log.Trace("accountsDB.saveAccountToTrie", "address", accountHandler.AddressBytes()) |
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.
Still sub-optimal (slice is copied by value when returned by the function), but a bit better.
go.mod
Outdated
@@ -20,7 +20,7 @@ require ( | |||
github.com/multiversx/mx-chain-es-indexer-go v1.7.10 | |||
github.com/multiversx/mx-chain-logger-go v1.0.15 | |||
github.com/multiversx/mx-chain-scenario-go v1.4.4 | |||
github.com/multiversx/mx-chain-storage-go v1.0.17 | |||
github.com/multiversx/mx-chain-storage-go v1.0.18-0.20241124203643-93c958ad66cf |
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.
do not forget actual release
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.
Will be set after all merges into the feat branch, right before preparing the release.
@@ -143,3 +144,6 @@ const TxCacheSelectionGasRequested = 10_000_000_000 | |||
|
|||
// TxCacheSelectionMaxNumTxs defines the maximum number of transactions that should be selected from the cache. | |||
const TxCacheSelectionMaxNumTxs = 50000 | |||
|
|||
// TxCacheSelectionLoopMaximumDuration defines the maximum duration for the loop that selects transactions from the cache. | |||
const TxCacheSelectionLoopMaximumDuration = 250 * time.Millisecond |
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.
sounds good for 6 second round time, can remain like this. should be much lower for sub second round times
@@ -20,7 +20,7 @@ require ( | |||
github.com/multiversx/mx-chain-es-indexer-go v1.7.10 | |||
github.com/multiversx/mx-chain-logger-go v1.0.15 | |||
github.com/multiversx/mx-chain-scenario-go v1.4.4 | |||
github.com/multiversx/mx-chain-storage-go v1.0.17 | |||
github.com/multiversx/mx-chain-storage-go v1.0.18-0.20241126200205-8a0cb502901f |
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.
don't forget to update after fixes.
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 reference the latest commit from here: https://github.com/multiversx/mx-chain-storage-go/pull/57/commits.
A proper tag be set after all merges into the feat branch, right before preparing the release.
@@ -34,15 +33,10 @@ var _ process.PreProcessor = (*transactions)(nil) | |||
var log = logger.GetOrCreate("process/block/preprocess") | |||
|
|||
// 200% bandwidth to allow 100% overshooting estimations | |||
const selectionGasBandwidthIncreasePercent = 200 | |||
const selectionGasBandwidthIncreasePercent = 400 |
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.
maybe move these two constants in config?
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 should, yes. Added MX-16201 (we have some other constants to move to config).
Reasoning behind the pull request
Proposed changes
txs.accountTxsShards
requestHandler
(found by @sstanculeanu and @miiu96): 5bb1b40.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
?