Skip to content

Commit

Permalink
Merge branch 'rc/v1.7.next1' into recreate-trie-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
BeniaminDrasovean authored Apr 15, 2024
2 parents de374b5 + 5232e1e commit f9ee246
Show file tree
Hide file tree
Showing 103 changed files with 4,200 additions and 1,072 deletions.
1 change: 1 addition & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- master
pull_request:
branches: [ master, feat/*, rc/* ]
workflow_dispatch:

permissions:
contents: read
Expand Down
4 changes: 4 additions & 0 deletions api/groups/transactionGroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,10 @@ func validateQuery(sender, fields string, lastNonce, nonceGaps bool) error {
return errors.ErrEmptySenderToGetNonceGaps
}

if fields == "*" {
return nil
}

if fields != "" {
return validateFields(fields)
}
Expand Down
4 changes: 2 additions & 2 deletions api/groups/transactionGroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ func TestTransactionGroup_getTransactionsPool(t *testing.T) {
t.Run("fields + nonce gaps", testTxPoolWithInvalidQuery("?fields=sender,receiver&nonce-gaps=true", apiErrors.ErrFetchingNonceGapsCannotIncludeFields))
t.Run("fields has spaces", testTxPoolWithInvalidQuery("?fields=sender ,receiver", apiErrors.ErrInvalidFields))
t.Run("fields has numbers", testTxPoolWithInvalidQuery("?fields=sender1", apiErrors.ErrInvalidFields))
t.Run("fields + wild card", testTxPoolWithInvalidQuery("?fields=sender,receiver,*", apiErrors.ErrInvalidFields))
t.Run("GetTransactionsPool error should error", func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -816,8 +817,7 @@ func TestTransactionGroup_getTransactionsPool(t *testing.T) {
t.Parallel()

expectedSender := "sender"
providedFields := "sender,receiver"
query := "?by-sender=" + expectedSender + "&fields=" + providedFields
query := "?by-sender=" + expectedSender + "&fields=*"
expectedResp := &common.TransactionsPoolForSenderApiResponse{
Transactions: []common.Transaction{
{
Expand Down
3 changes: 3 additions & 0 deletions cmd/node/config/enableEpochs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@
# AlwaysMergeContextsInEEIEnableEpoch represents the epoch in which the EEI will always merge the contexts
AlwaysMergeContextsInEEIEnableEpoch = 4

# DynamicESDTEnableEpoch represents the epoch when dynamic NFT feature is enabled
DynamicESDTEnableEpoch = 4

# BLSMultiSignerEnableEpoch represents the activation epoch for different types of BLS multi-signers
BLSMultiSignerEnableEpoch = [
{ EnableEpoch = 0, Type = "no-KOSK" },
Expand Down
9 changes: 6 additions & 3 deletions cmd/node/config/fullArchiveP2P.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@
# RefreshIntervalInSec represents the time in seconds between querying for new peers
RefreshIntervalInSec = 10

# ProtocolID represents the protocol that this node will advertize to other peers
# To connect to other nodes, those nodes should have the same ProtocolID string
ProtocolID = "/erd/kad/1.0.0"
# ProtocolIDs represents the protocols that this node will advertise to other peers
# To connect to other nodes, those nodes should have at least one common protocol string
ProtocolIDs = [
"/erd/kad/1.0.0",
"mvx-full-archive",
]

# InitialPeerList represents the list of strings of some known nodes that will bootstrap this node
# The address will be in a self-describing addressing format.
Expand Down
5 changes: 5 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
ESDTNFTAddUri = 500000
ESDTNFTUpdateAttributes = 500000
ESDTNFTMultiTransfer = 1000000
ESDTModifyRoyalties = 500000
ESDTModifyCreator = 500000
ESDTNFTRecreate = 1000000
ESDTNFTUpdate = 1000000
ESDTNFTSetNewURIs = 500000
SetGuardian = 250000
GuardAccount = 250000
UnGuardAccount = 250000
Expand Down
5 changes: 5 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
ESDTNFTAddUri = 500000
ESDTNFTUpdateAttributes = 500000
ESDTNFTMultiTransfer = 1000000
ESDTModifyRoyalties = 500000
ESDTModifyCreator = 500000
ESDTNFTRecreate = 1000000
ESDTNFTUpdate = 1000000
ESDTNFTSetNewURIs = 500000
SetGuardian = 250000
GuardAccount = 250000
UnGuardAccount = 250000
Expand Down
5 changes: 5 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
ESDTNFTAddUri = 500000
ESDTNFTUpdateAttributes = 500000
ESDTNFTMultiTransfer = 1000000
ESDTModifyRoyalties = 500000
ESDTModifyCreator = 500000
ESDTNFTRecreate = 1000000
ESDTNFTUpdate = 1000000
ESDTNFTSetNewURIs = 500000
SetGuardian = 250000
GuardAccount = 250000
UnGuardAccount = 250000
Expand Down
5 changes: 5 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV4.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
ESDTNFTAddUri = 50000
ESDTNFTUpdateAttributes = 50000
ESDTNFTMultiTransfer = 200000
ESDTModifyRoyalties = 500000
ESDTModifyCreator = 500000
ESDTNFTRecreate = 1000000
ESDTNFTUpdate = 1000000
ESDTNFTSetNewURIs = 500000
SetGuardian = 250000
GuardAccount = 250000
UnGuardAccount = 250000
Expand Down
5 changes: 5 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV5.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
ESDTNFTAddUri = 50000
ESDTNFTUpdateAttributes = 50000
ESDTNFTMultiTransfer = 200000
ESDTModifyRoyalties = 500000
ESDTModifyCreator = 500000
ESDTNFTRecreate = 1000000
ESDTNFTUpdate = 1000000
ESDTNFTSetNewURIs = 500000
SetGuardian = 250000
GuardAccount = 250000
UnGuardAccount = 250000
Expand Down
5 changes: 5 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV6.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
ESDTNFTAddUri = 50000
ESDTNFTUpdateAttributes = 50000
ESDTNFTMultiTransfer = 200000
ESDTModifyRoyalties = 500000
ESDTModifyCreator = 500000
ESDTNFTRecreate = 1000000
ESDTNFTUpdate = 1000000
ESDTNFTSetNewURIs = 500000
SetGuardian = 250000
GuardAccount = 250000
UnGuardAccount = 250000
Expand Down
5 changes: 5 additions & 0 deletions cmd/node/config/gasSchedules/gasScheduleV7.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
ESDTNFTUpdateAttributes = 50000
ESDTNFTMultiTransfer = 200000
MultiESDTNFTTransfer = 200000 # should be the same value with the ESDTNFTMultiTransfer
ESDTModifyRoyalties = 500000
ESDTModifyCreator = 500000
ESDTNFTRecreate = 1000000
ESDTNFTUpdate = 1000000
ESDTNFTSetNewURIs = 500000
SetGuardian = 250000
GuardAccount = 250000
UnGuardAccount = 250000
Expand Down
9 changes: 6 additions & 3 deletions cmd/node/config/p2p.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@
# RefreshIntervalInSec represents the time in seconds between querying for new peers
RefreshIntervalInSec = 10

# ProtocolID represents the protocol that this node will advertize to other peers
# To connect to other nodes, those nodes should have the same ProtocolID string
ProtocolID = "/erd/kad/1.0.0"
# ProtocolIDs represents the protocols that this node will advertise to other peers
# To connect to other nodes, those nodes should have at least one common protocol string
ProtocolIDs = [
"/erd/kad/1.0.0",
"mvx-main",
]

# InitialPeerList represents the list of strings of some known nodes that will bootstrap this node
# The address will be in a self-describing addressing format.
Expand Down
16 changes: 10 additions & 6 deletions cmd/node/config/prefs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,22 @@
# so that certain config values need to remain the same during upgrades.
# (for example, an Elasticsearch user wants external.toml->ElasticSearchConnector.Enabled to remain true all the time during upgrades, while the default
# configuration of the node has the false value)
# The Path indicates what value to change, while Value represents the new value in string format. The node operator must make sure
# to follow the same type of the original value (ex: uint32: "37", float32: "37.0", bool: "true")
# The Path indicates what value to change, while Value represents the new value. The node operator must make sure
# to follow the same type of the original value (ex: uint32: 37, float32: 37.0, bool: true)
# Also, the Value can be a struct (ex: { StartEpoch = 0, Version = "1.5" }) or an array (ex: [{ StartEpoch = 0, Version = "1.4" }, { StartEpoch = 1, Version = "1.5" }])
# File represents the file name that holds the configuration. Currently, the supported files are:
# api.toml, config.toml, economics.toml, enableEpochs.toml, enableRounds.toml, external.toml, fullArchiveP2P.toml, p2p.toml, ratings.toml, systemSmartContractsConfig.toml
# -------------------------------
# Un-comment and update the following section in order to enable config values overloading
# -------------------------------
# OverridableConfigTomlValues = [
# { File = "config.toml", Path = "StoragePruning.NumEpochsToKeep", Value = "4" },
# { File = "config.toml", Path = "MiniBlocksStorage.Cache.Name", Value = "MiniBlocksStorage" },
# { File = "external.toml", Path = "ElasticSearchConnector.Enabled", Value = "true" }
#]
# { File = "config.toml", Path = "StoragePruning.NumEpochsToKeep", Value = 4 },
# { File = "config.toml", Path = "MiniBlocksStorage.Cache.Name", Value = "MiniBlocksStorage" },
# { File = "external.toml", Path = "ElasticSearchConnector.Enabled", Value = true },
# { File = "external.toml", Path = "HostDriversConfig", Value = [
# { Enabled = false, URL = "127.0.0.1:22111" },
# ] },
# ]

# BlockProcessingCutoff can be used to stop processing blocks at a certain round, nonce or epoch.
# This can be useful for snapshotting different stuff and also for debugging purposes.
Expand Down
9 changes: 6 additions & 3 deletions cmd/seednode/config/p2p.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@
#RefreshIntervalInSec represents the time in seconds between querying for new peers
RefreshIntervalInSec = 10

#ProtocolID represents the protocol that this node will advertize to other peers
#To connect to other nodes, those nodes should have the same ProtocolID string
ProtocolID = "/erd/kad/1.0.0"
# ProtocolIDs represents the protocols that this node will advertise to other peers
# To connect to other nodes, those nodes should have at least one common protocol string
ProtocolIDs = [
"/erd/kad/1.0.0",
"mvx-main",
]

#InitialPeerList represents the list of strings of some known nodes that will bootstrap this node
#The address will be in a self-describing addressing format.
Expand Down
4 changes: 4 additions & 0 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ const MetricCurrentRound = "erd_current_round"
// MetricNonce is the metric for monitoring the nonce of a node
const MetricNonce = "erd_nonce"

// MetricBlockTimestamp is the metric for monitoring the timestamp of the last synchronized block
const MetricBlockTimestamp = "erd_block_timestamp"

// MetricProbableHighestNonce is the metric for monitoring the max speculative nonce received by the node by listening on the network
const MetricProbableHighestNonce = "erd_probable_highest_nonce"

Expand Down Expand Up @@ -1011,5 +1014,6 @@ const (
StakingQueueFlag core.EnableEpochFlag = "StakingQueueFlag"
StakingV4StartedFlag core.EnableEpochFlag = "StakingV4StartedFlag"
AlwaysMergeContextsInEEIFlag core.EnableEpochFlag = "AlwaysMergeContextsInEEIFlag"
DynamicESDTFlag core.EnableEpochFlag = "DynamicEsdtFlag"
// all new flags must be added to createAllFlagsMap method, as part of enableEpochsHandler allFlagsDefined
)
6 changes: 6 additions & 0 deletions common/enablers/enableEpochsHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,12 @@ func (handler *enableEpochsHandler) createAllFlagsMap() {
},
activationEpoch: handler.enableEpochsConfig.AlwaysMergeContextsInEEIEnableEpoch,
},
common.DynamicESDTFlag: {
isActiveInEpoch: func(epoch uint32) bool {
return epoch >= handler.enableEpochsConfig.DynamicESDTEnableEpoch
},
activationEpoch: handler.enableEpochsConfig.DynamicESDTEnableEpoch,
},
}
}

Expand Down
13 changes: 8 additions & 5 deletions common/enablers/enableEpochsHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ func createEnableEpochsConfig() config.EnableEpochs {
FixGasRemainingForSaveKeyValueBuiltinFunctionEnableEpoch: 93,
ChangeOwnerAddressCrossShardThroughSCEnableEpoch: 94,
CurrentRandomnessOnSortingEnableEpoch: 95,
StakeLimitsEnableEpoch: 95,
StakingV4Step1EnableEpoch: 96,
StakingV4Step2EnableEpoch: 97,
StakingV4Step3EnableEpoch: 98,
AlwaysMergeContextsInEEIEnableEpoch: 99,
StakeLimitsEnableEpoch: 96,
StakingV4Step1EnableEpoch: 97,
StakingV4Step2EnableEpoch: 98,
StakingV4Step3EnableEpoch: 99,
AlwaysMergeContextsInEEIEnableEpoch: 100,
DynamicESDTEnableEpoch: 101,
}
}

Expand Down Expand Up @@ -321,6 +322,7 @@ func TestEnableEpochsHandler_IsFlagEnabled(t *testing.T) {
require.False(t, handler.IsFlagEnabled(common.StakingQueueFlag))
require.True(t, handler.IsFlagEnabled(common.StakingV4StartedFlag))
require.True(t, handler.IsFlagEnabled(common.AlwaysMergeContextsInEEIFlag))
require.True(t, handler.IsFlagEnabled(common.DynamicESDTFlag))
}

func TestEnableEpochsHandler_GetActivationEpoch(t *testing.T) {
Expand Down Expand Up @@ -437,6 +439,7 @@ func TestEnableEpochsHandler_GetActivationEpoch(t *testing.T) {
require.Equal(t, cfg.StakingV4Step1EnableEpoch, handler.GetActivationEpoch(common.StakingQueueFlag))
require.Equal(t, cfg.StakingV4Step1EnableEpoch, handler.GetActivationEpoch(common.StakingV4StartedFlag))
require.Equal(t, cfg.AlwaysMergeContextsInEEIEnableEpoch, handler.GetActivationEpoch(common.AlwaysMergeContextsInEEIFlag))
require.Equal(t, cfg.DynamicESDTEnableEpoch, handler.GetActivationEpoch(common.DynamicESDTFlag))
}

func TestEnableEpochsHandler_IsInterfaceNil(t *testing.T) {
Expand Down
18 changes: 18 additions & 0 deletions common/reflectcommon/export_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package reflectcommon

import "reflect"

// FitsWithinSignedIntegerRange -
func FitsWithinSignedIntegerRange(value reflect.Value, targetType reflect.Type) bool {
return fitsWithinSignedIntegerRange(value, targetType)
}

// FitsWithinUnsignedIntegerRange -
func FitsWithinUnsignedIntegerRange(value reflect.Value, targetType reflect.Type) bool {
return fitsWithinUnsignedIntegerRange(value, targetType)
}

// FitsWithinFloatRange -
func FitsWithinFloatRange(value reflect.Value, targetType reflect.Type) bool {
return fitsWithinFloatRange(value, targetType)
}
Loading

0 comments on commit f9ee246

Please sign in to comment.