Skip to content
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

rc/spica-patch-mempool #6613

Merged
merged 172 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
859fd8d
Reference newer storage-go.
andreibancioiu Jul 9, 2024
10c67f1
Fix tests.
andreibancioiu Jul 9, 2024
fd214d6
Newer storage-go.
andreibancioiu Jul 10, 2024
8f92b0c
Adjust NumTxPerSenderBatchForFillingMiniblock, MaxGasBandwidthPerBatc…
andreibancioiu Jul 10, 2024
3ea4345
Update go.mod.
andreibancioiu Jul 10, 2024
3b2f40e
Fix tests.
andreibancioiu Jul 10, 2024
1202873
Integrate new selection parameter.
andreibancioiu Jul 15, 2024
fea4455
Adjust / skip test.
andreibancioiu Jul 15, 2024
61efec0
Some TODOs, update reference of storage-go.
andreibancioiu Jul 15, 2024
81e742a
Optimize shardedTxPool.removeTxBulk.
andreibancioiu Jul 16, 2024
6e7d92d
Testing workaround - notify account nonce when adding tx in pool.
andreibancioiu Jul 17, 2024
17aa534
Update reference.
andreibancioiu Jul 17, 2024
618f2f0
Extra check on workaround for testing.
andreibancioiu Jul 17, 2024
04a2764
Pass epoch notifier to sharded TX pool.
andreibancioiu Jul 26, 2024
6841919
calculate hash only on log trace level set.
cristure Jul 26, 2024
85d93ac
add non-memory thrasher test.
cristure Jul 29, 2024
3a2a25a
Minor refactoring / cleanup.
andreibancioiu Jul 29, 2024
20f174f
Define account nonce provider. Pass epoch notifier and account nonce …
andreibancioiu Jul 30, 2024
652d417
Fix some tests.
andreibancioiu Jul 30, 2024
9063904
In sharded tx pool, on tx add, notify cache about sender nonce.
andreibancioiu Jul 30, 2024
c8f4d6d
Fix additional tests.
andreibancioiu Jul 31, 2024
f126716
Fix short test.
andreibancioiu Jul 31, 2024
8a4f344
Fix linter.
andreibancioiu Jul 31, 2024
416ad59
Fix long tests (return err in nonce provider).
andreibancioiu Jul 31, 2024
25cd44f
Adjust log, tests. Plus minor refactoring.
andreibancioiu Aug 6, 2024
8bde909
Merge branch 'master' into master-into-mempool-2024-09-08
andreibancioiu Aug 8, 2024
ce579e3
Merge branch 'master' into mempool-10
andreibancioiu Aug 8, 2024
c48f5d2
Merge pull request #6381 from multiversx/master-into-mempool-2024-09-08
andreibancioiu Aug 8, 2024
665c53c
Add TODO.
andreibancioiu Aug 20, 2024
2d641f5
Merge branch 'master' into mempool-10
andreibancioiu Aug 20, 2024
8125028
Merge branch 'feat/mempool-plus-plus' into mempool-10
andreibancioiu Aug 20, 2024
53c679b
Merge branch 'master' into master-into-feat-mempool-plus-plus-2024-08-20
andreibancioiu Aug 20, 2024
52058da
Merge pull request #6397 from multiversx/master-into-feat-mempool-plu…
andreibancioiu Aug 20, 2024
bf90aff
Merge branch 'feat/mempool-plus-plus' into mempool-10
andreibancioiu Aug 20, 2024
79eb08c
Merge branch 'rc/v1.7.next1' into benchmark_trie
AdoAdoAdo Sep 3, 2024
5f8d3d4
Reference mempool (update).
andreibancioiu Sep 6, 2024
d4c35bc
Merge branch 'mempool-10' of ssh://github.com/multiversx/mx-chain-go …
andreibancioiu Sep 6, 2024
1ec7c5c
Merge branch 'rc/v1.7.next1' into benchmark_trie
andreibancioiu Sep 6, 2024
af01f4a
Convert artificial test into a benchmark.
andreibancioiu Sep 6, 2024
365f31b
Alter log level.
andreibancioiu Sep 18, 2024
050e9e1
Merge pull request #6579 from multiversx/master
andreibancioiu Nov 4, 2024
4166323
Merge branch 'feat/mempool-plus-plus' into mempool-10
andreibancioiu Nov 4, 2024
72b7534
Integrate new mempool. Fix short tests.
andreibancioiu Nov 4, 2024
cd5076b
Fix some long tests.
andreibancioiu Nov 4, 2024
77ae8af
Bad txs should be logged with "debug" level (low incidence).
andreibancioiu Nov 5, 2024
dd3729d
Integrate selection with txs limit.
andreibancioiu Nov 5, 2024
8349dcf
Fix interface.
andreibancioiu Nov 5, 2024
5c9f999
Fix tests.
andreibancioiu Nov 5, 2024
4ae8d38
Fix constant.
andreibancioiu Nov 5, 2024
84e41dc
shouldNotifyCacheAboutSenderNonce (or not).
andreibancioiu Nov 5, 2024
9fc3b29
Reference newest storage-go.
andreibancioiu Nov 6, 2024
ccad4bf
Reference newer storage-go.
andreibancioiu Nov 6, 2024
18698c1
Call notifyTransactionProviderIfNeeded() within createScheduledMiniBl…
andreibancioiu Nov 6, 2024
caaf1ef
Remove code not needed (was thought to be useful for the initial memp…
andreibancioiu Nov 6, 2024
72a8f5a
Fix concurrency issue.
andreibancioiu Nov 6, 2024
f00bbde
Do not alter log level anymore.
andreibancioiu Nov 6, 2024
0b39162
Optimize cleanup around scheduled transactions.
andreibancioiu Nov 7, 2024
3d9cb44
Merge branch 'rc/v1.7.next1' into selection-by-ppu
andreibancioiu Nov 7, 2024
1a5806e
Fix some long tests (mempool).
andreibancioiu Nov 7, 2024
3962e4d
Adjust call of "notifyTransactionProviderIfNeeded".
andreibancioiu Nov 7, 2024
fdb86cb
Undo changes related to scheduled txs cleanup.
andreibancioiu Nov 8, 2024
c8e978e
Reference new storage-go. Send account notifications upon creating / …
andreibancioiu Nov 11, 2024
d4a53bf
Commit changes to go.mod.
andreibancioiu Nov 11, 2024
23634d7
Fix go.sum.
andreibancioiu Nov 11, 2024
248813f
Reference new storage go and fix long tests.
andreibancioiu Nov 12, 2024
a585719
When reverting a block, ForgetAllAccountNoncesInMempool.
andreibancioiu Nov 12, 2024
22026c6
Fix mock.
andreibancioiu Nov 12, 2024
5f8d03f
Fix after self-review.
andreibancioiu Nov 12, 2024
5db19b5
Fix after self review (refactor, comments, additional tests).
andreibancioiu Nov 12, 2024
cc2eda5
Additional unit tests.
andreibancioiu Nov 12, 2024
6ee6292
Fix import.
andreibancioiu Nov 12, 2024
a498ef0
Fix linter issues.
andreibancioiu Nov 12, 2024
878d7b6
Fix tests.
andreibancioiu Nov 13, 2024
90bbf04
Fix after review (part 1).
andreibancioiu Nov 13, 2024
e0590fe
Fix after review (part 2).
andreibancioiu Nov 13, 2024
ba08014
fix spamming warnings from apiTransactionProcessor
sstanculeanu Nov 13, 2024
febe899
No more ForgetAllAccountNonces().
andreibancioiu Nov 13, 2024
535d51b
Remove NotifyAccountNonce().
andreibancioiu Nov 13, 2024
bca90d9
Properly invoke NewTxCache().
andreibancioiu Nov 13, 2024
278acf9
Reference new storage-go.
andreibancioiu Nov 13, 2024
f533a2b
Fix long test.
andreibancioiu Nov 14, 2024
43ae39d
Merge branch 'master' into selection-by-ppu
andreibancioiu Nov 14, 2024
20dde29
Merge pull request #6604 from multiversx/fix_spam_logs
sstanculeanu Nov 14, 2024
aae947b
Newer storage (upon fix after review).
andreibancioiu Nov 14, 2024
b6d55cb
Merge branch 'selection-by-ppu' of ssh://github.com/multiversx/mx-cha…
andreibancioiu Nov 14, 2024
eda1a61
Fix memory tests.
andreibancioiu Nov 14, 2024
4b8fb0a
Newer storage-go.
andreibancioiu Nov 14, 2024
a98f0a4
Merge branch 'selection-by-ppu' into MX-16107-no-more-notify
andreibancioiu Nov 14, 2024
0cb7187
Sketch CS test: TestMempoolWithChainSimulator_Eviction.
andreibancioiu Nov 14, 2024
bc70dcc
Merge branch 'rc/v1.7.next1' into benchmark_trie
andreibancioiu Nov 14, 2024
6a80857
Merge pull request #6338 from multiversx/benchmark_trie
andreibancioiu Nov 14, 2024
c4f2db5
Optimize GetExistingAccount(). Only encode address if log level is TR…
andreibancioiu Nov 14, 2024
1cb7594
Merge branch 'MX-16107-no-more-notify' of ssh://github.com/multiversx…
andreibancioiu Nov 14, 2024
5656a3e
Merge pull request #6610 from multiversx/merge_master_into_spica_patc…
sstanculeanu Nov 15, 2024
ea50a40
Merge branch 'rc/spica-patch-mempool' into selection-by-ppu
andreibancioiu Nov 15, 2024
3ddc19f
Use proper tag for storage-go.
andreibancioiu Nov 15, 2024
26ddc02
Pass account nonce provider (backed by the accounts adapter) to Selec…
andreibancioiu Nov 15, 2024
38aeb55
Optimized logging. Don't directly encode to hex before calling log.Tr…
andreibancioiu Nov 15, 2024
297e530
Remove logic around "accountTxsShards" (was only needed for mempool n…
andreibancioiu Nov 15, 2024
e1d4287
Remove code not needed anymore.
andreibancioiu Nov 15, 2024
f84a3c6
Minor refactoring around nonce account provider.
andreibancioiu Nov 15, 2024
9aec5b9
Sketch additional CS tests (WIP).
andreibancioiu Nov 15, 2024
5b937db
AccountNonceProvider becomes AccountStateProvider (more information f…
andreibancioiu Nov 18, 2024
7fa9a6c
Merge branch 'selection-by-ppu' into MX-16107-no-more-notify
andreibancioiu Nov 18, 2024
7741b4e
Fix tests, reference newer storage.
andreibancioiu Nov 18, 2024
da36969
Fix long test.
andreibancioiu Nov 19, 2024
377cca5
Optimizations. Fix after self-review.
andreibancioiu Nov 19, 2024
5bb1b40
Fix old concurrency issue.
andreibancioiu Nov 19, 2024
0d295b8
Fix linter issues.
andreibancioiu Nov 19, 2024
f87f1c3
Remove unused field.
andreibancioiu Nov 19, 2024
4834372
Sketch a simulator for transactions selection - called in CreateBlock…
andreibancioiu Nov 19, 2024
9ff7f5c
Feed guardian checker into process/block/preprocess/transactions.
andreibancioiu Nov 19, 2024
0b5c262
Enhance accountStateProvider - make it know about guardians.
andreibancioiu Nov 19, 2024
cf4f1a8
Reference newer storage-go.
andreibancioiu Nov 20, 2024
1faa7f1
Fix tests.
andreibancioiu Nov 20, 2024
5b00521
Newer storage go. Additional tracing.
andreibancioiu Nov 20, 2024
4d7e013
Merge pull request #6581 from multiversx/selection-by-ppu
andreibancioiu Nov 20, 2024
7953116
Merge branch 'feat/mempool' into MX-16107-no-more-notify
andreibancioiu Nov 20, 2024
e1cb834
Fix tests.
andreibancioiu Nov 20, 2024
eca8029
Reference new storage-go.
andreibancioiu Nov 21, 2024
9005e76
Fix tests, fix after self-review.
andreibancioiu Nov 21, 2024
cfd1ea8
Remove chain simulator test (since it's not polished). Will be added …
andreibancioiu Nov 21, 2024
e02d607
In "interceptedHeader", handle concurrent access.
andreibancioiu Nov 22, 2024
aacbedc
Transaction selection - call "VerifyGuardian" within AccountStateProv…
andreibancioiu Nov 24, 2024
2d52815
Handle non-executable transactions related to guardians in a separate…
andreibancioiu Nov 24, 2024
2a160f3
Fix linter issues.
andreibancioiu Nov 25, 2024
d36c7c5
Merge branch 'MX-16107-no-more-notify' into MX-16179-guardians
andreibancioiu Nov 25, 2024
7d0b272
Add some unit tests.
andreibancioiu Nov 25, 2024
7da7ef3
Rename state provider to selection session.
andreibancioiu Nov 25, 2024
47159a5
(final) fix after self-review.
andreibancioiu Nov 25, 2024
da02598
Merge branch 'MX-16107-no-more-notify' into MX-16179-guardians
andreibancioiu Nov 25, 2024
7376985
Reference newer storage-go.
andreibancioiu Nov 25, 2024
1cb65c2
Sketch GetTransferredValue(). Work in progress.
andreibancioiu Nov 26, 2024
16e35e2
Additional tests.
andreibancioiu Nov 26, 2024
25b2594
Fix after review.
andreibancioiu Nov 26, 2024
cdc543f
Merge branch 'MX-16107-no-more-notify' into MX-16179-guardians
andreibancioiu Nov 27, 2024
c1695d3
Merge branch 'MX-16179-guardians' into MX-16160-consumed-balance
andreibancioiu Nov 27, 2024
6090ae4
Update reference to storage-go.
andreibancioiu Nov 27, 2024
e04679e
Merge pull request #6603 from multiversx/MX-16107-no-more-notify
andreibancioiu Nov 27, 2024
90d05c0
Merge branch 'feat/mempool' into MX-16179-guardians
andreibancioiu Nov 27, 2024
f2f6acf
Fix after review.
andreibancioiu Nov 28, 2024
959affe
Merge branch 'MX-16179-guardians' into MX-16160-consumed-balance
andreibancioiu Nov 28, 2024
960b81e
Merge pull request #6628 from multiversx/MX-16179-guardians
andreibancioiu Nov 28, 2024
6e33cbf
Fix after review. Benchmark.
andreibancioiu Nov 28, 2024
59d7ec7
Merge branch 'feat/mempool' into MX-16160-consumed-balance
andreibancioiu Nov 28, 2024
7eed6f5
Fix long test.
andreibancioiu Nov 28, 2024
03e21bf
Merge pull request #6637 from multiversx/MX-16160-consumed-balance
AdoAdoAdo Nov 28, 2024
619e579
Sketch mempool host. Move "GetTransferredValue()".
andreibancioiu Nov 29, 2024
33bf019
Add tests, reference storage-go.
andreibancioiu Nov 29, 2024
9428366
Fix after review.
andreibancioiu Nov 29, 2024
8185866
Implement an ephemeral accounts cache within a selection session.
andreibancioiu Nov 29, 2024
d556eb8
Merge pull request #6641 from multiversx/MX-16211-optimize-get-value
andreibancioiu Nov 29, 2024
9b1afba
Merge branch 'feat/mempool' into MX-16223-mempool-memoization
andreibancioiu Nov 29, 2024
91c17ad
Reference newer storage-go.
andreibancioiu Nov 29, 2024
ffaeb85
Merge branch 'MX-16223-mempool-memoization' of ssh://github.com/multi…
andreibancioiu Nov 29, 2024
389c78b
Add unit test, fix after review (references to storage-go).
andreibancioiu Nov 29, 2024
a7c336e
Merge pull request #6643 from multiversx/MX-16223-mempool-memoization
andreibancioiu Nov 29, 2024
881d8f5
Adjust TxDataPool.SizePerSender.
andreibancioiu Dec 2, 2024
8bce7d1
Merge pull request #6644 from multiversx/MX-16202-sender-constraints
andreibancioiu Dec 2, 2024
d75b3eb
Optimization: lower "maxNum" when selecting transactions.
andreibancioiu Dec 2, 2024
801c199
Reference storage-go.
andreibancioiu Dec 2, 2024
11fc7c6
Merge pull request #6645 from multiversx/MX-16207-selection-max-num
andreibancioiu Dec 2, 2024
8a9b204
change to fetch tokens by NonFungibleESDTv2 type
ssd04 Dec 3, 2024
58179fa
add custom handling for getting non fungible tokens
ssd04 Dec 3, 2024
cfa9338
handle also dynamic nft and sft
ssd04 Dec 4, 2024
4b2d82e
Merge branch 'rc/spica-patch-mempool' into fix-api-nfts-tokens-type
ssd04 Dec 4, 2024
7c4667b
Merge pull request #6640 from multiversx/feat/mempool
andreibancioiu Dec 5, 2024
04fd98d
Merge branch 'rc/spica-patch-mempool' into fix-api-nfts-tokens-type
andreibancioiu Dec 5, 2024
1bccd60
update mx-chain-storage-go to tag
sstanculeanu Dec 5, 2024
e65a3d4
Merge pull request #6647 from multiversx/fix-api-nfts-tokens-type
sstanculeanu Dec 5, 2024
e1b7df8
Merge branch 'rc/spica-patch-mempool' into proper_tag
sstanculeanu Dec 5, 2024
861b336
Merge pull request #6653 from multiversx/proper_tag
sstanculeanu Dec 5, 2024
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
2 changes: 1 addition & 1 deletion api/groups/networkGroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func NewNetworkGroup(facade networkFacadeHandler) (*networkGroup, error) {
{
Path: getNFTsPath,
Method: http.MethodGet,
Handler: ng.getHandlerFuncForEsdt(core.NonFungibleESDT),
Handler: ng.getHandlerFuncForEsdt(core.NonFungibleESDTv2),
},
{
Path: directStakedInfoPath,
Expand Down
4 changes: 2 additions & 2 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,9 @@
[TxDataPool]
Name = "TxDataPool"
Capacity = 600000
SizePerSender = 20000
SizePerSender = 5001
SizeInBytes = 419430400 #400MB
SizeInBytesPerSender = 12288000
SizeInBytesPerSender = 12288000 #12MB
Type = "TxCache"
Shards = 16

Expand Down
1 change: 1 addition & 0 deletions cmd/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ func attachFileLogger(log logger.Logger, flagsConfig *config.ContextFlagsConfig)
logger.ToggleCorrelation(flagsConfig.EnableLogCorrelation)
logger.ToggleLoggerName(flagsConfig.EnableLogName)
logLevelFlagValue := flagsConfig.LogLevel

err = logger.SetLogLevel(logLevelFlagValue)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions consensus/broadcast/delayedBroadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ func (dbb *delayedBlockBroadcaster) interceptedHeader(_ string, headerHash []byt
)

alarmsToCancel := make([]string, 0)
dbb.mutDataForBroadcast.RLock()
dbb.mutDataForBroadcast.Lock()
for i, broadcastData := range dbb.valHeaderBroadcastData {
samePrevRandSeed := bytes.Equal(broadcastData.header.GetPrevRandSeed(), headerHandler.GetPrevRandSeed())
sameRound := broadcastData.header.GetRound() == headerHandler.GetRound()
Expand All @@ -663,7 +663,7 @@ func (dbb *delayedBlockBroadcaster) interceptedHeader(_ string, headerHash []byt
}
}

dbb.mutDataForBroadcast.RUnlock()
dbb.mutDataForBroadcast.Unlock()

for _, alarmID := range alarmsToCancel {
dbb.alarm.Cancel(alarmID)
Expand Down
3 changes: 0 additions & 3 deletions dataRetriever/constants.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package dataRetriever

// TxPoolNumSendersToPreemptivelyEvict instructs tx pool eviction algorithm to remove this many senders when eviction takes place
const TxPoolNumSendersToPreemptivelyEvict = uint32(100)

// UnsignedTxPoolName defines the name of the unsigned transactions pool
const UnsignedTxPoolName = "uTxPool"

Expand Down
3 changes: 0 additions & 3 deletions dataRetriever/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ var ErrCacheConfigInvalidSize = errors.New("cache parameter [size] is not valid,
// ErrCacheConfigInvalidShards signals that the cache parameter "shards" is invalid
var ErrCacheConfigInvalidShards = errors.New("cache parameter [shards] is not valid, it must be a positive number")

// ErrCacheConfigInvalidEconomics signals that an economics parameter required by the cache is invalid
var ErrCacheConfigInvalidEconomics = errors.New("cache-economics parameter is not valid")

// ErrCacheConfigInvalidSharding signals that a sharding parameter required by the cache is invalid
var ErrCacheConfigInvalidSharding = errors.New("cache-sharding parameter is not valid")

Expand Down
6 changes: 5 additions & 1 deletion dataRetriever/factory/dataPoolFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ func NewDataPoolFromConfig(args ArgsDataPool) (dataRetriever.PoolsHolder, error)
if check.IfNil(args.ShardCoordinator) {
return nil, dataRetriever.ErrNilShardCoordinator
}
if check.IfNil(args.Marshalizer) {
return nil, dataRetriever.ErrNilMarshalizer
}
if check.IfNil(args.PathManager) {
return nil, dataRetriever.ErrNilPathManager
}
Expand All @@ -61,9 +64,10 @@ func NewDataPoolFromConfig(args ArgsDataPool) (dataRetriever.PoolsHolder, error)

txPool, err := txpool.NewShardedTxPool(txpool.ArgShardedTxPool{
Config: factory.GetCacherFromConfig(mainConfig.TxDataPool),
TxGasHandler: args.EconomicsData,
Marshalizer: args.Marshalizer,
NumberOfShards: args.ShardCoordinator.NumberOfShards(),
SelfShardID: args.ShardCoordinator.SelfId(),
TxGasHandler: args.EconomicsData,
})
if err != nil {
return nil, fmt.Errorf("%w while creating the cache for the transactions", err)
Expand Down
19 changes: 6 additions & 13 deletions dataRetriever/factory/dataPoolFactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ func TestNewDataPoolFromConfig_MissingDependencyShouldErr(t *testing.T) {
require.Nil(t, holder)
require.Equal(t, dataRetriever.ErrNilShardCoordinator, err)

args = getGoodArgs()
args.Marshalizer = nil
holder, err = NewDataPoolFromConfig(args)
require.Nil(t, holder)
require.Equal(t, dataRetriever.ErrNilMarshalizer, err)

args = getGoodArgs()
args.PathManager = nil
holder, err = NewDataPoolFromConfig(args)
Expand Down Expand Up @@ -76,43 +82,30 @@ func TestNewDataPoolFromConfig_BadConfigShouldErr(t *testing.T) {
args.Config.HeadersPoolConfig.MaxHeadersPerShard = 0
holder, err = NewDataPoolFromConfig(args)
require.Nil(t, holder)
fmt.Println(err)
require.True(t, errors.Is(err, headersCache.ErrInvalidHeadersCacheParameter))
require.True(t, strings.Contains(err.Error(), "the cache for the headers"))

args = getGoodArgs()
args.Config.TxBlockBodyDataPool.Capacity = 0
holder, err = NewDataPoolFromConfig(args)
require.Nil(t, holder)
fmt.Println(err)
require.NotNil(t, err)
require.True(t, strings.Contains(err.Error(), "must provide a positive size while creating the cache for the miniblocks"))

args = getGoodArgs()
args.Config.PeerBlockBodyDataPool.Capacity = 0
holder, err = NewDataPoolFromConfig(args)
require.Nil(t, holder)
fmt.Println(err)
require.NotNil(t, err)
require.True(t, strings.Contains(err.Error(), "must provide a positive size while creating the cache for the peer mini block body"))

args = getGoodArgs()
args.Config.TrieSyncStorage.Capacity = 0
holder, err = NewDataPoolFromConfig(args)
require.Nil(t, holder)
fmt.Println(err)
require.True(t, errors.Is(err, storage.ErrCacheSizeInvalid))
require.True(t, strings.Contains(err.Error(), "the cache for the trie nodes"))

args = getGoodArgs()
args.Config.TrieSyncStorage.EnableDB = true
args.Config.TrieSyncStorage.DB.Type = "invalid DB type"
holder, err = NewDataPoolFromConfig(args)
require.Nil(t, holder)
fmt.Println(err)
require.True(t, errors.Is(err, storage.ErrNotSupportedDBType))
require.True(t, strings.Contains(err.Error(), "the db for the trie nodes"))

args = getGoodArgs()
args.Config.TrieNodesChunksDataPool.Type = "invalid cache type"
holder, err = NewDataPoolFromConfig(args)
Expand Down
32 changes: 19 additions & 13 deletions dataRetriever/requestHandlers/requestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/multiversx/mx-chain-go/dataRetriever"
"github.com/multiversx/mx-chain-go/epochStart"
"github.com/multiversx/mx-chain-go/process/factory"
"github.com/multiversx/mx-chain-logger-go"
logger "github.com/multiversx/mx-chain-logger-go"
)

var _ epochStart.RequestHandler = (*resolverRequestHandler)(nil)
Expand Down Expand Up @@ -571,10 +571,12 @@ func (rrh *resolverRequestHandler) RequestValidatorInfo(hash []byte) {
return
}

epoch := rrh.getEpoch()

log.Debug("requesting validator info messages from network",
"topic", common.ValidatorInfoTopic,
"hash", hash,
"epoch", rrh.epoch,
"epoch", epoch,
)

requester, err := rrh.requestersFinder.MetaChainRequester(common.ValidatorInfoTopic)
Expand All @@ -583,20 +585,20 @@ func (rrh *resolverRequestHandler) RequestValidatorInfo(hash []byte) {
"error", err.Error(),
"topic", common.ValidatorInfoTopic,
"hash", hash,
"epoch", rrh.epoch,
"epoch", epoch,
)
return
}

rrh.whiteList.Add([][]byte{hash})

err = requester.RequestDataFromHash(hash, rrh.epoch)
err = requester.RequestDataFromHash(hash, epoch)
if err != nil {
log.Debug("RequestValidatorInfo.RequestDataFromHash",
"error", err.Error(),
"topic", common.ValidatorInfoTopic,
"hash", hash,
"epoch", rrh.epoch,
"epoch", epoch,
)
return
}
Expand All @@ -611,10 +613,12 @@ func (rrh *resolverRequestHandler) RequestValidatorsInfo(hashes [][]byte) {
return
}

epoch := rrh.getEpoch()

log.Debug("requesting validator info messages from network",
"topic", common.ValidatorInfoTopic,
"num hashes", len(unrequestedHashes),
"epoch", rrh.epoch,
"epoch", epoch,
)

requester, err := rrh.requestersFinder.MetaChainRequester(common.ValidatorInfoTopic)
Expand All @@ -623,7 +627,7 @@ func (rrh *resolverRequestHandler) RequestValidatorsInfo(hashes [][]byte) {
"error", err.Error(),
"topic", common.ValidatorInfoTopic,
"num hashes", len(unrequestedHashes),
"epoch", rrh.epoch,
"epoch", epoch,
)
return
}
Expand All @@ -636,13 +640,13 @@ func (rrh *resolverRequestHandler) RequestValidatorsInfo(hashes [][]byte) {

rrh.whiteList.Add(unrequestedHashes)

err = validatorInfoRequester.RequestDataFromHashArray(unrequestedHashes, rrh.epoch)
err = validatorInfoRequester.RequestDataFromHashArray(unrequestedHashes, epoch)
if err != nil {
log.Debug("RequestValidatorInfo.RequestDataFromHash",
"error", err.Error(),
"topic", common.ValidatorInfoTopic,
"num hashes", len(unrequestedHashes),
"epoch", rrh.epoch,
"epoch", epoch,
)
return
}
Expand Down Expand Up @@ -827,11 +831,13 @@ func (rrh *resolverRequestHandler) GetNumPeersToQuery(key string) (int, int, err

// RequestPeerAuthenticationsByHashes asks for peer authentication messages from specific peers hashes
func (rrh *resolverRequestHandler) RequestPeerAuthenticationsByHashes(destShardID uint32, hashes [][]byte) {
epoch := rrh.getEpoch()

log.Debug("requesting peer authentication messages from network",
"topic", common.PeerAuthenticationTopic,
"shard", destShardID,
"num hashes", len(hashes),
"epoch", rrh.epoch,
"epoch", epoch,
)

requester, err := rrh.requestersFinder.MetaChainRequester(common.PeerAuthenticationTopic)
Expand All @@ -840,7 +846,7 @@ func (rrh *resolverRequestHandler) RequestPeerAuthenticationsByHashes(destShardI
"error", err.Error(),
"topic", common.PeerAuthenticationTopic,
"shard", destShardID,
"epoch", rrh.epoch,
"epoch", epoch,
)
return
}
Expand All @@ -851,13 +857,13 @@ func (rrh *resolverRequestHandler) RequestPeerAuthenticationsByHashes(destShardI
return
}

err = peerAuthRequester.RequestDataFromHashArray(hashes, rrh.epoch)
err = peerAuthRequester.RequestDataFromHashArray(hashes, epoch)
if err != nil {
log.Debug("RequestPeerAuthenticationsByHashes.RequestDataFromHashArray",
"error", err.Error(),
"topic", common.PeerAuthenticationTopic,
"shard", destShardID,
"epoch", rrh.epoch,
"epoch", epoch,
)
}
}
16 changes: 14 additions & 2 deletions dataRetriever/shardedData/shardedData.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"sync"

"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/core/counting"
"github.com/multiversx/mx-chain-core-go/marshal"
"github.com/multiversx/mx-chain-go/dataRetriever"
Expand Down Expand Up @@ -52,7 +53,7 @@ func NewShardedData(name string, config storageunit.CacheConfig) (*shardedData,
NumChunks: config.Shards,
MaxNumItems: config.Capacity,
MaxNumBytes: uint32(config.SizeInBytes),
NumItemsToPreemptivelyEvict: storage.TxPoolNumTxsToPreemptivelyEvict,
NumItemsToPreemptivelyEvict: storage.ShardedDataNumItemsToPreemptivelyEvict,
}

err := configPrototype.Verify()
Expand Down Expand Up @@ -161,14 +162,25 @@ func (sd *shardedData) RemoveSetOfDataFromPool(keys [][]byte, cacheID string) {
return
}

stopWatch := core.NewStopWatch()
stopWatch.Start("removal")

numRemoved := 0
for _, key := range keys {
if store.cache.RemoveWithResult(key) {
numRemoved++
}
}

log.Trace("shardedData.removeTxBulk()", "name", sd.name, "cacheID", cacheID, "numToRemove", len(keys), "numRemoved", numRemoved)
stopWatch.Stop("removal")

log.Debug("shardedData.removeTxBulk",
"name", sd.name,
"cacheID", cacheID,
"numToRemove", len(keys),
"numRemoved", numRemoved,
"duration", stopWatch.GetMeasurement("removal"),
)
}

// ImmunizeSetOfDataAgainstEviction marks the items as non-evictable
Expand Down
20 changes: 5 additions & 15 deletions dataRetriever/txpool/argShardedTxPool.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package txpool

import (
"encoding/json"
"fmt"

"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/marshal"
"github.com/multiversx/mx-chain-go/dataRetriever"
"github.com/multiversx/mx-chain-go/storage/storageunit"
"github.com/multiversx/mx-chain-go/storage/txcache"
)

// ArgShardedTxPool is the argument for ShardedTxPool's constructor
type ArgShardedTxPool struct {
Config storageunit.CacheConfig
TxGasHandler txcache.TxGasHandler
TxGasHandler txGasHandler
Marshalizer marshal.Marshalizer
NumberOfShards uint32
SelfShardID uint32
}
Expand All @@ -40,22 +40,12 @@ func (args *ArgShardedTxPool) verify() error {
if check.IfNil(args.TxGasHandler) {
return fmt.Errorf("%w: TxGasHandler is not valid", dataRetriever.ErrNilTxGasHandler)
}
if args.TxGasHandler.MinGasPrice() == 0 {
return fmt.Errorf("%w: MinGasPrice is not valid", dataRetriever.ErrCacheConfigInvalidEconomics)
if check.IfNil(args.Marshalizer) {
return fmt.Errorf("%w: Marshalizer is not valid", dataRetriever.ErrNilMarshalizer)
}
if args.NumberOfShards == 0 {
return fmt.Errorf("%w: NumberOfShards is not valid", dataRetriever.ErrCacheConfigInvalidSharding)
}

return nil
}

// String returns a readable representation of the object
func (args *ArgShardedTxPool) String() string {
bytes, err := json.Marshal(args)
if err != nil {
log.Error("ArgShardedTxPool.String()", "err", err)
}

return string(bytes)
}
8 changes: 8 additions & 0 deletions dataRetriever/txpool/interface.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package txpool

import (
"math/big"

"github.com/multiversx/mx-chain-core-go/data"
"github.com/multiversx/mx-chain-go/storage"
"github.com/multiversx/mx-chain-go/storage/txcache"
)
Expand All @@ -17,3 +20,8 @@ type txCache interface {
Diagnose(deep bool)
GetTransactionsPoolForSender(sender string) []*txcache.WrappedTransaction
}

type txGasHandler interface {
ComputeTxFee(tx data.TransactionWithFeeHandler) *big.Int
IsInterfaceNil() bool
}
Loading
Loading