Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
00b54ef
collect state changes
BeniaminDrasovean Sep 8, 2023
75dff98
add more unit tests
BeniaminDrasovean Sep 13, 2023
ed0f9d6
get state changes for each transaction
BeniaminDrasovean Sep 14, 2023
a05808d
pass stateChangesCollector as argument
BeniaminDrasovean Sep 15, 2023
db454f1
add flag for collectStateChanges
BeniaminDrasovean Sep 15, 2023
01d832b
add comments and unit test for stateChangesCollector
BeniaminDrasovean Sep 15, 2023
49a8c8a
Merge branch 'rc/v1.6.0' into state-changes-collector
BeniaminDrasovean Sep 18, 2023
676a23c
Merge pull request #5879 from multiversx/merge-rc/v1.7.0-in-feat/ligh…
iulianpascalau Jan 26, 2024
39eaa54
Merge remote-tracking branch 'origin/rc/v1.7.0' into state-changes-co…
BeniaminDrasovean Jan 26, 2024
7e6aa45
fix after merge
BeniaminDrasovean Jan 26, 2024
820264b
Merge branch 'feat/light-client-support' into state-changes-collector
BeniaminDrasovean Jan 26, 2024
33b6daf
correlate state changes to a tx hash
BeniaminDrasovean Jan 30, 2024
93c0e5b
Merge remote-tracking branch 'origin/rc/v1.7.0' into merge-rc/1.7.0-i…
BeniaminDrasovean Mar 18, 2024
edcbe7b
Merge pull request #6049 from multiversx/merge-rc/1.7.0-in-feat/light…
BeniaminDrasovean Mar 18, 2024
858ae75
Merge branch 'feat/light-client-support' into state-changes-collector
BeniaminDrasovean Mar 18, 2024
5331072
fix after merge
BeniaminDrasovean Mar 18, 2024
5bf73a7
accounts adapter api for interceptors
ssd04 Jul 2, 2024
56f4020
added dump to json file
ssd04 Jul 4, 2024
a7efc56
added reset and collect state in accounts db
ssd04 Jul 4, 2024
3ae6652
read state changes in trackable data trie
ssd04 Jul 5, 2024
33d471c
added json encoder
ssd04 Jul 9, 2024
5b04c8f
change to save to level db
ssd04 Jul 9, 2024
00f7ba4
use diabled components for peer accounts
ssd04 Jul 9, 2024
d31042c
add save account operation type
ssd04 Jul 12, 2024
a232b4b
added changed fields on save account
ssd04 Jul 16, 2024
c501ee9
added revert state changes
ssd04 Jul 19, 2024
4f579cc
remove state changes collector from journal entries
ssd04 Aug 2, 2024
7d950ef
added meta data for stateChanges dto
ssd04 Aug 3, 2024
485e094
added more unit tests
ssd04 Aug 5, 2024
867bffe
fix index out of bounds
ssd04 Aug 6, 2024
b87e3f0
update separate components for state changes data analysis
ssd04 Aug 26, 2024
ce8c152
fix referencies
ssd04 Aug 26, 2024
d7c357e
update unit tests
ssd04 Aug 27, 2024
a3cc4af
fix integration tests
ssd04 Aug 27, 2024
55ebfd6
fix more tests
ssd04 Aug 28, 2024
0310268
added state changes collector to hostDriver.
cristure Sep 2, 2024
682e417
some fixes.
cristure Sep 2, 2024
9836fde
fixes after review
BeniaminDrasovean Sep 4, 2024
5bf6ee7
Merge branch 'feat/state-changes' into state-changes-collector
BeniaminDrasovean Sep 4, 2024
ccffe6d
Merge pull request #5585 from multiversx/state-changes-collector
AdoAdoAdo Sep 4, 2024
9b37165
Merge branch 'feat/state-changes' into state-changes-read-operations
ssd04 Sep 4, 2024
265cbe8
added todo comment for db config variable
ssd04 Sep 4, 2024
f6bff48
migrated stateChanges to proto structure in mx-chain-core-go.
cristure Sep 5, 2024
a57053e
moved all the state changes in mx-chain-core-go.
cristure Sep 6, 2024
f8c9ba5
fixed nil pointer reference.
cristure Sep 6, 2024
09802ae
moved collected state changes in outport block.
cristure Sep 6, 2024
28f38a8
update core-go.
cristure Sep 6, 2024
c2b2857
refactor to remove duplicated code
ssd04 Sep 6, 2024
d88fa86
fix linter issues
ssd04 Sep 6, 2024
f492061
commit go.sum.
cristure Sep 9, 2024
1623567
Merge remote-tracking branch 'refs/remotes/origin/feat/state-changes'…
cristure Sep 9, 2024
b4b49d6
update dependencies.
cristure Sep 9, 2024
4869c40
Merge remote-tracking branch 'origin/state-changes-read-operations' i…
cristure Sep 9, 2024
291f6c0
fix after merge.
cristure Sep 9, 2024
2250354
fix version and imports.
cristure Sep 9, 2024
62d2326
fix some tests.
cristure Sep 9, 2024
c860684
fix broken import.
cristure Sep 9, 2024
c482523
another round of tests fixed.
cristure Sep 9, 2024
30d5dd9
fix linter.
cristure Sep 9, 2024
9d983f1
fixes after review.
cristure Sep 10, 2024
776d2b1
fix missing argument.
cristure Sep 10, 2024
1f90b5d
fixes after review.
cristure Sep 12, 2024
e774eea
revert due to failing test.
cristure Sep 12, 2024
494a7b3
fix failing test.
cristure Sep 12, 2024
4b971e2
fix more tests.
cristure Sep 12, 2024
676c5a5
cosmetic changes.
cristure Sep 13, 2024
d892b5e
added test for new method and minor fixes.
cristure Sep 13, 2024
8bd428b
update mx-chain-es-indexer
cristure Sep 13, 2024
6a8dc41
revert variables.sh
cristure Sep 13, 2024
0ffca72
improved readability.
cristure Sep 13, 2024
43e7cb8
fixes after review.
cristure Sep 17, 2024
260b7b4
bumped mx-chain-core-go version.
cristure Sep 17, 2024
bfc6add
Merge pull request #6429 from multiversx/state-changes-outport
cristure Sep 18, 2024
ef20419
bump mx-chain-core go version.
cristure Sep 18, 2024
a04eed2
Merge pull request #6476 from multiversx/update-proto-stuctures
AdoAdoAdo Sep 18, 2024
d5a81a5
fixes after review
ssd04 Sep 19, 2024
9f68130
add data analysis collector unit tests
ssd04 Sep 20, 2024
ea2cf1a
updated core enums in state changes.
cristure Sep 24, 2024
8ae48f7
updated tests with new proto types for state changes.
cristure Sep 24, 2024
038dde0
update to use mock for state changes collector
ssd04 Sep 26, 2024
004d008
fix linter issues.
cristure Sep 27, 2024
d6383f5
Merge remote-tracking branch 'origin/state-changes-read-operations' i…
cristure Sep 27, 2024
d866489
Update factory/status/export_test.go
cristure Oct 1, 2024
0aa84f3
Merge branch 'state-changes-read-operations' into update_enums_state
cristure Oct 1, 2024
d892499
Merge pull request #6296 from multiversx/state-changes-read-operations
ssd04 Oct 25, 2024
3e7330b
Merge branch 'feat/state-changes' into update_enums_state
ssd04 Oct 25, 2024
bf83198
refactor state changes collector.
cristure Oct 28, 2024
277733b
rework data analysis collector.
cristure Oct 29, 2024
7767701
added some more tests and fixed interface.
cristure Oct 29, 2024
c527a42
add mock state changes collector in tests.
cristure Oct 29, 2024
81a982f
fix publish method.
cristure Oct 29, 2024
9c13bd0
fix accounts db test.
cristure Oct 29, 2024
4621778
add unkeyed fields.
cristure Oct 29, 2024
dd21bf0
cosmetic changes.
cristure Oct 29, 2024
77c4ab6
remove unused error.
cristure Oct 29, 2024
215a5a7
added new method to the interface.
cristure Oct 30, 2024
133f1c1
reworked store method.
cristure Oct 30, 2024
5cd1778
cosmetic changes.
cristure Oct 30, 2024
64e01aa
fix stub.
cristure Oct 30, 2024
89f452d
added test and new args to config.toml
cristure Oct 31, 2024
d0efc49
merged the 2 collector components.
cristure Oct 31, 2024
23498fa
fix unit test.
cristure Oct 31, 2024
305041c
added peer accounts config.
cristure Nov 4, 2024
5450ae1
Merge pull request #6495 from multiversx/update_enums_state
cristure Nov 4, 2024
7550483
Merge branch 'master' into merge-master-inro-feat-state-changes
ssd04 Dec 12, 2024
7864f29
conflicts fixes
ssd04 Dec 12, 2024
b3e0fac
update core version
ssd04 Dec 12, 2024
3d30a70
conflicts fixes
ssd04 Dec 12, 2024
2b41727
Merge pull request #6673 from multiversx/merge-master-inro-feat-state…
AdoAdoAdo Dec 12, 2024
bffdc76
fix state changes store check
ssd04 Dec 16, 2024
8e0416f
added unit tests
ssd04 Dec 16, 2024
dd49376
update nil check
ssd04 Dec 16, 2024
e7c81c9
Merge pull request #6679 from multiversx/fix-state-changes-collector-…
ssd04 Dec 16, 2024
aac0db4
Merge branch 'rc/spica-patch-relayedv3' into merge-spica-patch-relaye…
ssd04 Feb 5, 2025
7a8cee0
fixes after merge conflicts
ssd04 Feb 5, 2025
3a16db3
Merge pull request #6779 from multiversx/merge-spica-patch-relayedv3-…
ssd04 Feb 5, 2025
c5fff3d
Merge branch 'master' into merge-master-into-feat-state-changes
ssd04 Feb 6, 2025
3925e74
update go mod
ssd04 Feb 6, 2025
7353927
Merge pull request #6780 from multiversx/merge-master-into-feat-state…
AdoAdoAdo Feb 7, 2025
bed12a8
add logging for state changes collector
BeniaminDrasovean Feb 13, 2025
7099ac3
add txHash for SCRs and reward TXs
BeniaminDrasovean Feb 13, 2025
7d959d9
small code style fix
BeniaminDrasovean Feb 17, 2025
a583c02
export version for the data trie changes
BeniaminDrasovean Feb 18, 2025
a4a00fa
fix state changes collector index out of bounds
ssd04 Feb 21, 2025
1a543b0
fix pruning bug
BeniaminDrasovean Feb 25, 2025
3c5edb1
do not revert more state changes than necessary
BeniaminDrasovean Feb 26, 2025
c663eca
set index for state changes fixes
BeniaminDrasovean Mar 4, 2025
b1baacc
fix failing test
BeniaminDrasovean Mar 6, 2025
c27f2bc
Merge pull request #6826 from multiversx/fix-state-changes-collector-…
BeniaminDrasovean Mar 13, 2025
b11f957
Merge pull request #6803 from multiversx/logging-for-state-changes
BeniaminDrasovean Mar 19, 2025
e48f42f
add unit test for revert fix, and update go mod
BeniaminDrasovean Mar 19, 2025
8cda3d1
Merge pull request #6897 from multiversx/unit-test-for-revert-fix
BeniaminDrasovean Mar 19, 2025
74fae0f
fix casting WARN
BeniaminDrasovean Apr 1, 2025
12f850a
Merge branch 'feat/state-changes' into fix-state-changes-collector-index
BeniaminDrasovean Apr 1, 2025
6fc8c5b
refactor and rename stateAccessCollector
BeniaminDrasovean Apr 9, 2025
7b84004
add marshaller to stateAccessesCollector
BeniaminDrasovean Apr 10, 2025
c1f50c0
naming fix and add missing comment
BeniaminDrasovean Apr 10, 2025
ef50d32
add mutex protection for Store
BeniaminDrasovean Apr 10, 2025
998c1f5
renaming fixes
BeniaminDrasovean Apr 14, 2025
ff156ac
test fix
BeniaminDrasovean Apr 14, 2025
7bb7a24
create stateAccessesStorer
BeniaminDrasovean Apr 14, 2025
09138ef
refactor config for stateAccessesCollector
BeniaminDrasovean Apr 15, 2025
5b88db1
fix linter issue
BeniaminDrasovean Apr 15, 2025
8c4bb1d
update flag
BeniaminDrasovean Apr 15, 2025
9f84baf
small fix
BeniaminDrasovean Apr 15, 2025
5e5deb1
use pruningStorer for stateAccesses
BeniaminDrasovean Apr 15, 2025
64ce4a0
remove collector for peer accounts
BeniaminDrasovean Apr 16, 2025
5dd3a7d
add TODO
BeniaminDrasovean Apr 16, 2025
770d73e
do not compute stateAccessesForTxs multiple times
BeniaminDrasovean Apr 16, 2025
8992f3c
add comment to config entry
BeniaminDrasovean Apr 16, 2025
f47d682
merge state accesss for same account in the same tx
BeniaminDrasovean Apr 17, 2025
e8712d5
fix failing tests
BeniaminDrasovean Apr 28, 2025
89db070
added unit tests
danielradu10 Apr 28, 2025
2452545
fixes after reviews
danielradu10 Apr 29, 2025
cd42a94
Merge pull request #6965 from multiversx/unit-tests
BeniaminDrasovean Apr 29, 2025
8a6c81e
fix after review
BeniaminDrasovean Apr 29, 2025
d9cf3cd
update go mod
BeniaminDrasovean Apr 30, 2025
5f66a8c
renamings
BeniaminDrasovean Apr 30, 2025
e2dff3b
Merge pull request #6926 from multiversx/fix-state-changes-collector-…
BeniaminDrasovean May 5, 2025
fd40ada
Merge remote-tracking branch 'origin/feat/state-changes' into merge-s…
BeniaminDrasovean Jun 12, 2025
9ac532b
update go mod
BeniaminDrasovean Jun 12, 2025
5582eaf
remove test artifacts
BeniaminDrasovean Jun 12, 2025
e6d8438
update go mod
BeniaminDrasovean Jul 7, 2025
9e815bc
Merge pull request #6958 from multiversx/merge-same-account-accessess
BeniaminDrasovean Jul 7, 2025
bb762bf
Merge remote-tracking branch 'origin/rc/barnard' into merge-barnard-i…
BeniaminDrasovean Jul 15, 2025
dadae9b
update go mod
BeniaminDrasovean Jul 15, 2025
095f112
Merge pull request #7110 from multiversx/merge-barnard-in-feat/state-…
BeniaminDrasovean Jul 15, 2025
030d8c1
Merge branch 'master' into merge-master-into-state-changes
ssd04 Aug 19, 2025
ed98e40
Merge pull request #7196 from multiversx/merge-master-into-state-changes
ssd04 Aug 19, 2025
93e12b5
use account changes as int
BeniaminDrasovean Sep 8, 2025
ceb3b00
fix stub
BeniaminDrasovean Sep 8, 2025
d14fd64
fix after review
BeniaminDrasovean Sep 8, 2025
14f09f0
update go mod after merge
BeniaminDrasovean Sep 9, 2025
d138bcb
Merge remote-tracking branch 'origin/rc/teegarden' into merge-rc/teeg…
BeniaminDrasovean Sep 9, 2025
f6c6f55
Merge pull request #7232 from multiversx/refactor-account-changes
BeniaminDrasovean Sep 9, 2025
c2c7090
Merge remote-tracking branch 'origin/feat/state-changes' into merge-r…
BeniaminDrasovean Sep 9, 2025
a66c2e2
update go mod
BeniaminDrasovean Sep 9, 2025
757f2de
Merge pull request #7236 from multiversx/merge-rc/teegarden-in-feat/s…
BeniaminDrasovean Sep 9, 2025
26ef1cb
Merge branch 'rc/teegarden' into merge-teegarden-into-feat-state-changes
ssd04 Sep 15, 2025
2968f41
Merge pull request #7252 from multiversx/merge-teegarden-into-feat-st…
ssd04 Sep 15, 2025
860a431
export original key and val in dataTrieChanges
BeniaminDrasovean Sep 18, 2025
b40f443
add unit test
BeniaminDrasovean Sep 22, 2025
6b1fd93
update logLevel for some prints
BeniaminDrasovean Sep 22, 2025
e2a9cba
fix after review
BeniaminDrasovean Sep 24, 2025
6db9b07
Merge pull request #7270 from multiversx/dataTrieChanges-refactor
BeniaminDrasovean Sep 29, 2025
d16cb2c
fix dataTrieChanges delete
BeniaminDrasovean Oct 1, 2025
ea8617b
Update comment
BeniaminDrasovean Oct 1, 2025
7ea645e
fix failing tests
BeniaminDrasovean Oct 1, 2025
a7db176
add missing test and update go mod
BeniaminDrasovean Oct 2, 2025
5ee992d
Merge pull request #7293 from multiversx/dataTrieChanges-fixes
BeniaminDrasovean Oct 8, 2025
d2fd074
Merge remote-tracking branch 'origin/rc/barnard-patch-3' into merge-r…
BeniaminDrasovean Oct 8, 2025
8059224
update go mod
BeniaminDrasovean Oct 8, 2025
cf5a0ae
Merge pull request #7316 from multiversx/merge-rc/barnard-patch-3-in-…
BeniaminDrasovean Oct 8, 2025
55480f0
add StateAccessesCollector to testFullNode
BeniaminDrasovean Oct 8, 2025
192f4c0
arrange code
BeniaminDrasovean Oct 8, 2025
d242374
small fix
BeniaminDrasovean Oct 8, 2025
7d08af0
Merge pull request #7319 from multiversx/stateAccessesColector-test-fix
BeniaminDrasovean Oct 8, 2025
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 cmd/node/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ GLOBAL OPTIONS:
--operation-mode operation mode String flag for specifying the desired operation mode(s) of the node, resulting in altering some configuration values accordingly. Possible values are: snapshotless-observer, full-archive, db-lookup-extension, historical-balances or `""` (empty). Multiple values can be separated via ,
--repopulate-tokens-supplies Boolean flag for repopulating the tokens supplies database. It will delete the current data, iterate over the entire trie and add he new obtained supplies
--p2p-prometheus-metrics Boolean option for enabling the /debug/metrics/prometheus route for p2p prometheus metrics
--state-accesses-types-to-collect value String slice option for enabling collecting specified state accesses types. Can be (READ, WRITE)
--help, -h show help
--version, -v print the version

Expand Down
18 changes: 18 additions & 0 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,19 @@
ShardIDProviderType = "BinarySplit"
NumShards = 4

[StateAccessesStorage]
[StateAccessesStorage.Cache]
Name = "StateAccessesStorage"
Capacity = 5000
Type = "SizeLRU"
SizeInBytes = 10485760 #10MB
[StateAccessesStorage.DB]
FilePath = "StateAccesses"
Type = "LvlDBSerial"
BatchDelaySeconds = 2
MaxBatchSize = 100
MaxOpenFiles = 10

[PeerAccountsTrieStorage]
[PeerAccountsTrieStorage.Cache]
Name = "PeerAccountsTrieStorage"
Expand Down Expand Up @@ -696,6 +709,11 @@
Enabled = false
MaxSizeInBytes = 10485760 #10MB

[StateAccessesCollectorConfig]
TypesToCollect = [] # These can be "READ","WRITE".
SaveToStorage = false
WithAccountChanges = false

[BlockSizeThrottleConfig]
MinSizeInBytes = 104857 # 104857 is 10% from 1MB
MaxSizeInBytes = 943718 # 943718 is 90% from 1MB
Expand Down
13 changes: 11 additions & 2 deletions cmd/node/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"os"
"runtime"

logger "github.com/multiversx/mx-chain-logger-go"
"github.com/urfave/cli"

"github.com/multiversx/mx-chain-go/common"
"github.com/multiversx/mx-chain-go/common/operationmodes"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/facade"
logger "github.com/multiversx/mx-chain-logger-go"
"github.com/urfave/cli"
)

var (
Expand Down Expand Up @@ -408,6 +409,13 @@ var (
Name: "p2p-prometheus-metrics",
Usage: "Boolean option for enabling the /debug/metrics/prometheus route for p2p prometheus metrics",
}

// stateAccessesTypesToCollect defines a flag for collecting specified types of state accesses
// If enabled, it will override the configuration
stateAccessesTypesToCollect = cli.StringSliceFlag{
Name: "state-accesses-types-to-collect",
Usage: "String slice option for enabling collecting specified state accesses types. Can be (READ, WRITE)",
}
)

func getFlags() []cli.Flag {
Expand Down Expand Up @@ -470,6 +478,7 @@ func getFlags() []cli.Flag {
operationMode,
repopulateTokensSupplies,
p2pPrometheusMetrics,
stateAccessesTypesToCollect,
}
}

Expand Down
10 changes: 7 additions & 3 deletions cmd/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import (

"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/core/check"
logger "github.com/multiversx/mx-chain-logger-go"
"github.com/multiversx/mx-chain-logger-go/file"
"github.com/urfave/cli"

"github.com/multiversx/mx-chain-go/cmd/node/factory"
"github.com/multiversx/mx-chain-go/common"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/config/overridableConfig"
"github.com/multiversx/mx-chain-go/node"
logger "github.com/multiversx/mx-chain-logger-go"
"github.com/multiversx/mx-chain-logger-go/file"
"github.com/urfave/cli"
// test point 1 for custom profiler
)

Expand Down Expand Up @@ -260,6 +261,9 @@ func readConfigs(ctx *cli.Context, log logger.Logger) (*config.Configs, error) {
if ctx.IsSet(identityFlagName.Name) {
preferencesConfig.Preferences.Identity = ctx.GlobalString(identityFlagName.Name)
}
if ctx.IsSet(stateAccessesTypesToCollect.Name) {
generalConfig.StateAccessesCollectorConfig.TypesToCollect = ctx.GlobalStringSlice(stateAccessesTypesToCollect.Name)
}

return &config.Configs{
GeneralConfig: generalConfig,
Expand Down
21 changes: 15 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,20 @@ type Config struct {
SmartContractsStorageForSCQuery StorageConfig
TrieEpochRootHashStorage StorageConfig
SmartContractsStorageSimulate StorageConfig
StateAccessesStorage StorageConfig

BootstrapStorage StorageConfig
MetaBlockStorage StorageConfig
ProofsStorage StorageConfig

AccountsTrieStorage StorageConfig
PeerAccountsTrieStorage StorageConfig
EvictionWaitingList EvictionWaitingListConfig
StateTriesConfig StateTriesConfig
TrieStorageManagerConfig TrieStorageManagerConfig
AccountsTrieStorage StorageConfig
PeerAccountsTrieStorage StorageConfig
EvictionWaitingList EvictionWaitingListConfig
StateTriesConfig StateTriesConfig
StateAccessesCollectorConfig StateAccessesCollectorConfig
TrieStorageManagerConfig TrieStorageManagerConfig
TrieLeavesRetrieverConfig TrieLeavesRetrieverConfig
BadBlocksCache CacheConfig
BadBlocksCache CacheConfig

TxBlockBodyDataPool CacheConfig
PeerBlockBodyDataPool CacheConfig
Expand Down Expand Up @@ -333,6 +335,13 @@ type StateTriesConfig struct {
StateStatisticsEnabled bool
}

// StateAccessesCollectorConfig will hold information about state accesses collector
type StateAccessesCollectorConfig struct {
TypesToCollect []string
SaveToStorage bool
WithAccountChanges bool
}

// TrieStorageManagerConfig will hold config information about trie storage manager
type TrieStorageManagerConfig struct {
PruningBufferLen uint32
Expand Down
4 changes: 4 additions & 0 deletions dataRetriever/unitType.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const (
ScheduledSCRsUnit UnitType = 22
// ProofsUnit is the header proofs unit identifier
ProofsUnit UnitType = 23
// StateAccessesUnit is the state accesses storage unit identifier
StateAccessesUnit UnitType = 24

// ShardHdrNonceHashDataUnit is the header nonce-hash pair data unit identifier
//TODO: Add only unit types lower than 100
Expand Down Expand Up @@ -114,6 +116,8 @@ func (ut UnitType) String() string {
return "ScheduledSCRsUnit"
case ProofsUnit:
return "ProofsUnit"
case StateAccessesUnit:
return "StateAccessesUnit"
}

if ut < ShardHdrNonceHashDataUnit {
Expand Down
4 changes: 4 additions & 0 deletions epochStart/bootstrap/disabled/disabledAccountsAdapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ func (a *accountsAdapter) GetStackDebugFirstEntry() []byte {
return nil
}

// SetTxHashForLatestStateAccesses -
func (a *accountsAdapter) SetTxHashForLatestStateAccesses(_ []byte) {
}

// Close -
func (a *accountsAdapter) Close() error {
return nil
Expand Down
14 changes: 8 additions & 6 deletions epochStart/metachain/baseRewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import (
"github.com/multiversx/mx-chain-core-go/data/rewardTx"
"github.com/multiversx/mx-chain-core-go/hashing/sha256"
"github.com/multiversx/mx-chain-core-go/marshal"
vmcommon "github.com/multiversx/mx-chain-vm-common-go"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/multiversx/mx-chain-go/epochStart"
"github.com/multiversx/mx-chain-go/epochStart/mock"
"github.com/multiversx/mx-chain-go/process"
Expand All @@ -27,9 +31,6 @@ import (
stateMock "github.com/multiversx/mx-chain-go/testscommon/state"
"github.com/multiversx/mx-chain-go/testscommon/storage"
"github.com/multiversx/mx-chain-go/trie"
vmcommon "github.com/multiversx/mx-chain-vm-common-go"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestBaseRewardsCreator_NilShardCoordinator(t *testing.T) {
Expand Down Expand Up @@ -1160,9 +1161,10 @@ func getBaseRewardsArguments() BaseRewardsCreatorArgs {

trieFactoryManager, _ := trie.CreateTrieStorageManager(storageManagerArgs, storage.GetStorageManagerOptions())
argsAccCreator := factory.ArgsAccountCreator{
Hasher: hasher,
Marshaller: marshalizer,
EnableEpochsHandler: &enableEpochsHandlerMock.EnableEpochsHandlerStub{},
Hasher: hasher,
Marshaller: marshalizer,
EnableEpochsHandler: &enableEpochsHandlerMock.EnableEpochsHandlerStub{},
StateAccessesCollector: &stateMock.StateAccessesCollectorStub{},
}
accCreator, _ := factory.NewAccountCreator(argsAccCreator)
enableEpochsHandler := &enableEpochsHandlerMock.EnableEpochsHandlerStub{}
Expand Down
22 changes: 12 additions & 10 deletions epochStart/metachain/systemSCs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,13 +756,14 @@ func createAccountsDB(
spm, _ := storagePruningManager.NewStoragePruningManager(ewl, 10)

args := state.ArgsAccountsDB{
Trie: tr,
Hasher: hasher,
Marshaller: marshaller,
AccountFactory: accountFactory,
StoragePruningManager: spm,
AddressConverter: &testscommon.PubkeyConverterMock{},
SnapshotsManager: disabledState.NewDisabledSnapshotsManager(),
Trie: tr,
Hasher: hasher,
Marshaller: marshaller,
AccountFactory: accountFactory,
StoragePruningManager: spm,
AddressConverter: &testscommon.PubkeyConverterMock{},
SnapshotsManager: disabledState.NewDisabledSnapshotsManager(),
StateAccessesCollector: disabledState.NewDisabledStateAccessesCollector(),
}
adb, _ := state.NewAccountsDB(args)
return adb
Expand All @@ -778,9 +779,10 @@ func createFullArgumentsForSystemSCProcessing(enableEpochsConfig config.EnableEp

trieFactoryManager, _ := trie.CreateTrieStorageManager(storageManagerArgs, storageMock.GetStorageManagerOptions())
argsAccCreator := factory.ArgsAccountCreator{
Hasher: hasher,
Marshaller: marshalizer,
EnableEpochsHandler: &enableEpochsHandlerMock.EnableEpochsHandlerStub{},
Hasher: hasher,
Marshaller: marshalizer,
EnableEpochsHandler: &enableEpochsHandlerMock.EnableEpochsHandlerStub{},
StateAccessesCollector: disabledState.NewDisabledStateAccessesCollector(),
}
accCreator, _ := factory.NewAccountCreator(argsAccCreator)
peerAccCreator := factory.NewPeerAccountCreator()
Expand Down
22 changes: 12 additions & 10 deletions factory/api/apiResolverFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,10 @@ func createShardVmContainerFactory(args scQueryElementArgs, argsHook hooks.ArgBl

func createNewAccountsAdapterApi(args scQueryElementArgs, chainHandler data.ChainHandler) (state.AccountsAdapterAPI, common.StorageManager, error) {
argsAccCreator := factoryState.ArgsAccountCreator{
Hasher: args.coreComponents.Hasher(),
Marshaller: args.coreComponents.InternalMarshalizer(),
EnableEpochsHandler: args.coreComponents.EnableEpochsHandler(),
Hasher: args.coreComponents.Hasher(),
Marshaller: args.coreComponents.InternalMarshalizer(),
EnableEpochsHandler: args.coreComponents.EnableEpochsHandler(),
StateAccessesCollector: args.stateComponents.StateAccessesCollector(),
}
accountFactory, err := factoryState.NewAccountCreator(argsAccCreator)
if err != nil {
Expand Down Expand Up @@ -596,13 +597,14 @@ func createNewAccountsAdapterApi(args scQueryElementArgs, chainHandler data.Chai
}

argsAPIAccountsDB := state.ArgsAccountsDB{
Trie: merkleTrie,
Hasher: args.coreComponents.Hasher(),
Marshaller: args.coreComponents.InternalMarshalizer(),
AccountFactory: accountFactory,
StoragePruningManager: storagePruning,
AddressConverter: args.coreComponents.AddressPubKeyConverter(),
SnapshotsManager: disabledState.NewDisabledSnapshotsManager(),
Trie: merkleTrie,
Hasher: args.coreComponents.Hasher(),
Marshaller: args.coreComponents.InternalMarshalizer(),
AccountFactory: accountFactory,
StoragePruningManager: storagePruning,
AddressConverter: args.coreComponents.AddressPubKeyConverter(),
SnapshotsManager: disabledState.NewDisabledSnapshotsManager(),
StateAccessesCollector: disabledState.NewDisabledStateAccessesCollector(),
}

provider, err := blockInfoProviders.NewCurrentBlockInfo(chainHandler)
Expand Down
4 changes: 4 additions & 0 deletions factory/api/apiResolverFactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/multiversx/mx-chain-go/process"
"github.com/multiversx/mx-chain-go/process/sync/disabled"
"github.com/multiversx/mx-chain-go/state"
stateDisabled "github.com/multiversx/mx-chain-go/state/disabled"
"github.com/multiversx/mx-chain-go/testscommon"
componentsMock "github.com/multiversx/mx-chain-go/testscommon/components"
"github.com/multiversx/mx-chain-go/testscommon/dataRetriever"
Expand Down Expand Up @@ -344,6 +345,9 @@ func createMockSCQueryElementArgs() api.SCQueryElementArgs {
PeerAccountsCalled: func() state.AccountsAdapter {
return &stateMocks.AccountsStub{}
},
StateAccessesCollectorCalled: func() state.StateAccessesCollector {
return stateDisabled.NewDisabledStateAccessesCollector()
},
},
StatusCoreComponents: &factory.StatusCoreComponentsStub{
AppStatusHandlerCalled: func() core.AppStatusHandler {
Expand Down
1 change: 1 addition & 0 deletions factory/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ type StateComponentsHolder interface {
TrieStorageManagers() map[string]common.StorageManager
MissingTrieNodesNotifier() common.MissingTrieNodesNotifier
TrieLeavesRetriever() common.TrieLeavesRetriever
StateAccessesCollector() state.StateAccessesCollector
Close() error
IsInterfaceNil() bool
}
Expand Down
10 changes: 10 additions & 0 deletions factory/mock/stateComponentsHolderStub.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type StateComponentsHolderStub struct {
TrieStorageManagersCalled func() map[string]common.StorageManager
MissingTrieNodesNotifierCalled func() common.MissingTrieNodesNotifier
TrieLeavesRetrieverCalled func() common.TrieLeavesRetriever
StateAccessesCollectorCalled func() state.StateAccessesCollector
}

// PeerAccounts -
Expand Down Expand Up @@ -88,6 +89,15 @@ func (s *StateComponentsHolderStub) TrieLeavesRetriever() common.TrieLeavesRetri
return nil
}

// StateAccessesCollector -
func (s *StateComponentsHolderStub) StateAccessesCollector() state.StateAccessesCollector {
if s.StateAccessesCollectorCalled != nil {
return s.StateAccessesCollectorCalled()
}

return nil
}

// Close -
func (s *StateComponentsHolderStub) Close() error {
return nil
Expand Down
14 changes: 10 additions & 4 deletions factory/processing/blockProcessorCreator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import (

"github.com/multiversx/mx-chain-core-go/core"
dataBlock "github.com/multiversx/mx-chain-core-go/data/block"
logger "github.com/multiversx/mx-chain-logger-go"
vmcommon "github.com/multiversx/mx-chain-vm-common-go"
"github.com/multiversx/mx-chain-vm-common-go/parsers"

"github.com/multiversx/mx-chain-go/common"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/dataRetriever"
Expand Down Expand Up @@ -42,9 +46,6 @@ import (
"github.com/multiversx/mx-chain-go/state/syncer"
"github.com/multiversx/mx-chain-go/storage/txcache"
"github.com/multiversx/mx-chain-go/vm"
logger "github.com/multiversx/mx-chain-logger-go"
vmcommon "github.com/multiversx/mx-chain-vm-common-go"
"github.com/multiversx/mx-chain-vm-common-go/parsers"
)

type blockProcessorAndVmFactories struct {
Expand Down Expand Up @@ -274,6 +275,8 @@ func (pcf *processComponentsFactory) newShardBlockProcessor(
pcf.state.AccountsAdapter(),
pcf.coreData.AddressPubKeyConverter(),
pcf.bootstrapComponents.ShardCoordinator(),
pcf.coreData.InternalMarshalizer(),
pcf.coreData.Hasher(),
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -442,6 +445,7 @@ func (pcf *processComponentsFactory) newShardBlockProcessor(
BlockProcessingCutoffHandler: blockProcessingCutoffHandler,
ManagedPeersHolder: pcf.crypto.ManagedPeersHolder(),
SentSignaturesTracker: sentSignaturesTracker,
StateAccessesCollector: pcf.state.StateAccessesCollector(),
}
arguments := block.ArgShardProcessor{
ArgBaseProcessor: argumentsBaseProcessor,
Expand Down Expand Up @@ -879,6 +883,7 @@ func (pcf *processComponentsFactory) newMetaBlockProcessor(
BlockProcessingCutoffHandler: blockProcessingCutoffhandler,
ManagedPeersHolder: pcf.crypto.ManagedPeersHolder(),
SentSignaturesTracker: sentSignaturesTracker,
StateAccessesCollector: pcf.state.StateAccessesCollector(),
}

esdtOwnerAddress, err := pcf.coreData.AddressPubKeyConverter().Decode(pcf.systemSCConfig.ESDTSystemSCConfig.OwnerAddress)
Expand Down Expand Up @@ -1024,7 +1029,7 @@ func (pcf *processComponentsFactory) createOutportDataProvider(
return factoryOutportProvider.CreateOutportDataProvider(factoryOutportProvider.ArgOutportDataProviderFactory{
HasDrivers: pcf.statusComponents.OutportHandler().HasDrivers(),
AddressConverter: pcf.coreData.AddressPubKeyConverter(),
AccountsDB: pcf.state.AccountsAdapter(),
AccountsDB: pcf.state.AccountsAdapterAPI(),
Marshaller: pcf.coreData.InternalMarshalizer(),
EsdtDataStorageHandler: pcf.esdtNftStorage,
TransactionsStorer: txsStorer,
Expand All @@ -1039,6 +1044,7 @@ func (pcf *processComponentsFactory) createOutportDataProvider(
EnableEpochsHandler: pcf.coreData.EnableEpochsHandler(),
ExecutionOrderGetter: pcf.txExecutionOrderHandler,
ProofsPool: pcf.data.Datapool().Proofs(),
StateAccessesCollector: pcf.state.StateAccessesCollector(),
})
}

Expand Down
Loading
Loading