Skip to content

Commit 49ddefd

Browse files
authored
Merge pull request #7362 from multiversx/merge-master-into-rc/supernova-2022.10.22
Merge master into rc/supernova 2022.10.22
2 parents f9f075e + d35f96e commit 49ddefd

171 files changed

Lines changed: 4833 additions & 957 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/node/CLI.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ GLOBAL OPTIONS:
7373
--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 ,
7474
--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
7575
--p2p-prometheus-metrics Boolean option for enabling the /debug/metrics/prometheus route for p2p prometheus metrics
76+
--state-accesses-types-to-collect value String slice option for enabling collecting specified state accesses types. Can be (READ, WRITE)
7677
--help, -h show help
7778
--version, -v print the version
7879

cmd/node/config/config.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,19 @@
383383
ShardIDProviderType = "BinarySplit"
384384
NumShards = 4
385385

386+
[StateAccessesStorage]
387+
[StateAccessesStorage.Cache]
388+
Name = "StateAccessesStorage"
389+
Capacity = 5000
390+
Type = "SizeLRU"
391+
SizeInBytes = 10485760 #10MB
392+
[StateAccessesStorage.DB]
393+
FilePath = "StateAccesses"
394+
Type = "LvlDBSerial"
395+
BatchDelaySeconds = 2
396+
MaxBatchSize = 100
397+
MaxOpenFiles = 10
398+
386399
[PeerAccountsTrieStorage]
387400
[PeerAccountsTrieStorage.Cache]
388401
Name = "PeerAccountsTrieStorage"
@@ -738,6 +751,11 @@
738751
Enabled = false
739752
MaxSizeInBytes = 10485760 #10MB
740753

754+
[StateAccessesCollectorConfig]
755+
TypesToCollect = [] # These can be "READ","WRITE".
756+
SaveToStorage = false
757+
WithAccountChanges = false
758+
741759
[BlockSizeThrottleConfig]
742760
MinSizeInBytes = 104857 # 104857 is 10% from 1MB
743761
MaxSizeInBytes = 943718 # 943718 is 90% from 1MB

cmd/node/config/enableEpochs.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,15 @@
366366
# BarnardOpcodesEnableEpoch represents the epoch when Barnard opcodes will be enabled
367367
BarnardOpcodesEnableEpoch = 1
368368

369-
# FixGetBalanceEnableEpoch represents the epoch when Barnard opcodes will be enabled
369+
# FixGetBalanceEnableEpoch represents the epoch when get balance opcode fix is enabled
370370
FixGetBalanceEnableEpoch = 1
371371

372372
# AutomaticActivationOfNodesDisableEpoch represents the epoch when automatic activation of nodes for validators is disabled
373373
AutomaticActivationOfNodesDisableEpoch = 1
374374

375+
# RelayedTransactionsV1V2DisableEpoch represents the epoch when relayed transactions v1 and v2 are disabled
376+
RelayedTransactionsV1V2DisableEpoch = 1
377+
375378
# BLSMultiSignerEnableEpoch represents the activation epoch for different types of BLS multi-signers
376379
BLSMultiSignerEnableEpoch = [
377380
{ EnableEpoch = 0, Type = "no-KOSK" },

cmd/node/flags.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import (
66
"os"
77
"runtime"
88

9+
logger "github.com/multiversx/mx-chain-logger-go"
10+
"github.com/urfave/cli"
11+
912
"github.com/multiversx/mx-chain-go/common"
1013
"github.com/multiversx/mx-chain-go/common/operationmodes"
1114
"github.com/multiversx/mx-chain-go/config"
1215
"github.com/multiversx/mx-chain-go/facade"
13-
logger "github.com/multiversx/mx-chain-logger-go"
14-
"github.com/urfave/cli"
1516
)
1617

1718
var (
@@ -408,6 +409,13 @@ var (
408409
Name: "p2p-prometheus-metrics",
409410
Usage: "Boolean option for enabling the /debug/metrics/prometheus route for p2p prometheus metrics",
410411
}
412+
413+
// stateAccessesTypesToCollect defines a flag for collecting specified types of state accesses
414+
// If enabled, it will override the configuration
415+
stateAccessesTypesToCollect = cli.StringSliceFlag{
416+
Name: "state-accesses-types-to-collect",
417+
Usage: "String slice option for enabling collecting specified state accesses types. Can be (READ, WRITE)",
418+
}
411419
)
412420

413421
func getFlags() []cli.Flag {
@@ -470,6 +478,7 @@ func getFlags() []cli.Flag {
470478
operationMode,
471479
repopulateTokensSupplies,
472480
p2pPrometheusMetrics,
481+
stateAccessesTypesToCollect,
473482
}
474483
}
475484

cmd/node/main.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import (
88

99
"github.com/multiversx/mx-chain-core-go/core"
1010
"github.com/multiversx/mx-chain-core-go/core/check"
11+
logger "github.com/multiversx/mx-chain-logger-go"
12+
"github.com/multiversx/mx-chain-logger-go/file"
13+
"github.com/urfave/cli"
14+
1115
"github.com/multiversx/mx-chain-go/cmd/node/factory"
1216
"github.com/multiversx/mx-chain-go/common"
1317
"github.com/multiversx/mx-chain-go/config"
1418
"github.com/multiversx/mx-chain-go/config/overridableConfig"
1519
"github.com/multiversx/mx-chain-go/node"
16-
logger "github.com/multiversx/mx-chain-logger-go"
17-
"github.com/multiversx/mx-chain-logger-go/file"
18-
"github.com/urfave/cli"
1920
// test point 1 for custom profiler
2021
)
2122

@@ -260,6 +261,9 @@ func readConfigs(ctx *cli.Context, log logger.Logger) (*config.Configs, error) {
260261
if ctx.IsSet(identityFlagName.Name) {
261262
preferencesConfig.Preferences.Identity = ctx.GlobalString(identityFlagName.Name)
262263
}
264+
if ctx.IsSet(stateAccessesTypesToCollect.Name) {
265+
generalConfig.StateAccessesCollectorConfig.TypesToCollect = ctx.GlobalStringSlice(stateAccessesTypesToCollect.Name)
266+
}
263267

264268
return &config.Configs{
265269
GeneralConfig: generalConfig,

common/constants.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,9 @@ const (
792792
// MetricCryptoOpcodesV2EnableEpoch represents the epoch when crypto opcodes v2 feature is enabled
793793
MetricCryptoOpcodesV2EnableEpoch = "erd_crypto_opcodes_v2_enable_epoch"
794794

795+
// MetricRelayedTransactionsV1V2DisableEpoch represents the epoch when relayed transactions v1 and v2 are disabled
796+
MetricRelayedTransactionsV1V2DisableEpoch = "erd_relayed_transactions_v1_v2_disable_epoch"
797+
795798
// MetricEpochEnable represents the epoch when the max nodes change configuration is applied
796799
MetricEpochEnable = "erd_epoch_enable"
797800

@@ -1301,6 +1304,7 @@ const (
13011304
BarnardOpcodesFlag core.EnableEpochFlag = "BarnardOpcodesFlag"
13021305
AutomaticActivationOfNodesDisableFlag core.EnableEpochFlag = "AutomaticActivationOfNodesDisableFlag"
13031306
FixGetBalanceFlag core.EnableEpochFlag = "FixGetBalanceFlag"
1307+
RelayedTransactionsV1V2DisableFlag core.EnableEpochFlag = "RelayedTransactionsV1V2DisableFlag"
13041308
// all new flags must be added to createAllFlagsMap method, as part of enableEpochsHandler allFlagsDefined
13051309
)
13061310

common/enablers/enableEpochsHandler.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,12 @@ func (handler *enableEpochsHandler) createAllFlagsMap() {
859859
},
860860
activationEpoch: handler.enableEpochsConfig.FixGetBalanceEnableEpoch,
861861
},
862+
common.RelayedTransactionsV1V2DisableFlag: {
863+
isActiveInEpoch: func(epoch uint32) bool {
864+
return epoch >= handler.enableEpochsConfig.RelayedTransactionsV1V2DisableEpoch
865+
},
866+
activationEpoch: handler.enableEpochsConfig.RelayedTransactionsV1V2DisableEpoch,
867+
},
862868
}
863869
}
864870

common/enablers/enableEpochsHandler_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ func createEnableEpochsConfig() config.EnableEpochs {
134134
ValidationOnGobDecodeEnableEpoch: 115,
135135
BarnardOpcodesEnableEpoch: 116,
136136
AutomaticActivationOfNodesDisableEpoch: 117,
137-
SupernovaEnableEpoch: 118,
137+
RelayedTransactionsV1V2DisableEpoch: 118,
138+
SupernovaEnableEpoch: 119,
138139
}
139140
}
140141

@@ -341,6 +342,7 @@ func TestEnableEpochsHandler_IsFlagEnabled(t *testing.T) {
341342
require.True(t, handler.IsFlagEnabled(common.FixRelayedMoveBalanceToNonPayableSCFlag))
342343
require.True(t, handler.IsFlagEnabled(common.AndromedaFlag))
343344
require.True(t, handler.IsFlagEnabled(common.DynamicESDTFlag))
345+
require.True(t, handler.IsFlagEnabled(common.RelayedTransactionsV1V2DisableFlag))
344346
require.True(t, handler.IsFlagEnabled(common.SupernovaFlag))
345347
}
346348

@@ -477,6 +479,7 @@ func TestEnableEpochsHandler_GetActivationEpoch(t *testing.T) {
477479
require.Equal(t, cfg.BarnardOpcodesEnableEpoch, handler.GetActivationEpoch(common.BarnardOpcodesFlag))
478480
require.Equal(t, cfg.AutomaticActivationOfNodesDisableEpoch, handler.GetActivationEpoch(common.AutomaticActivationOfNodesDisableFlag))
479481
require.Equal(t, cfg.FixGetBalanceEnableEpoch, handler.GetActivationEpoch(common.FixGetBalanceFlag))
482+
require.Equal(t, cfg.RelayedTransactionsV1V2DisableEpoch, handler.GetActivationEpoch(common.RelayedTransactionsV1V2DisableFlag))
480483
require.Equal(t, cfg.SupernovaEnableEpoch, handler.GetActivationEpoch(common.SupernovaFlag))
481484
}
482485

config/config.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,20 @@ type Config struct {
178178
SmartContractsStorageForSCQuery StorageConfig
179179
TrieEpochRootHashStorage StorageConfig
180180
SmartContractsStorageSimulate StorageConfig
181+
StateAccessesStorage StorageConfig
181182

182183
BootstrapStorage StorageConfig
183184
MetaBlockStorage StorageConfig
184185
ProofsStorage StorageConfig
185186

186-
AccountsTrieStorage StorageConfig
187-
PeerAccountsTrieStorage StorageConfig
188-
EvictionWaitingList EvictionWaitingListConfig
189-
StateTriesConfig StateTriesConfig
190-
TrieStorageManagerConfig TrieStorageManagerConfig
187+
AccountsTrieStorage StorageConfig
188+
PeerAccountsTrieStorage StorageConfig
189+
EvictionWaitingList EvictionWaitingListConfig
190+
StateTriesConfig StateTriesConfig
191+
StateAccessesCollectorConfig StateAccessesCollectorConfig
192+
TrieStorageManagerConfig TrieStorageManagerConfig
191193
TrieLeavesRetrieverConfig TrieLeavesRetrieverConfig
192-
BadBlocksCache CacheConfig
194+
BadBlocksCache CacheConfig
193195

194196
TxBlockBodyDataPool CacheConfig
195197
PeerBlockBodyDataPool CacheConfig
@@ -415,6 +417,13 @@ type StateTriesConfig struct {
415417
StateStatisticsEnabled bool
416418
}
417419

420+
// StateAccessesCollectorConfig will hold information about state accesses collector
421+
type StateAccessesCollectorConfig struct {
422+
TypesToCollect []string
423+
SaveToStorage bool
424+
WithAccountChanges bool
425+
}
426+
418427
// TrieStorageManagerConfig will hold config information about trie storage manager
419428
type TrieStorageManagerConfig struct {
420429
PruningBufferLen uint32

config/epochConfig.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ type EnableEpochs struct {
135135
BarnardOpcodesEnableEpoch uint32
136136
FixGetBalanceEnableEpoch uint32
137137
AutomaticActivationOfNodesDisableEpoch uint32
138+
RelayedTransactionsV1V2DisableEpoch uint32
138139
BLSMultiSignerEnableEpoch []MultiSignerConfig
139140
}
140141

0 commit comments

Comments
 (0)