Skip to content

Commit

Permalink
Merge pull request #6334 from multiversx/multiTransfer_execute_by_user
Browse files Browse the repository at this point in the history
Multi transfer execute by user flag
  • Loading branch information
sstanculeanu authored Jul 29, 2024
2 parents 268f82f + 28f517a commit 552fbac
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cmd/node/config/enableEpochs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@
# FixRelayedBaseCostEnableEpoch represents the epoch when the fix for relayed base cost will be enabled
FixRelayedBaseCostEnableEpoch = 7

# MultiESDTNFTTransferAndExecuteByUserEnableEpoch represents the epoch when enshrined sovereign cross chain opcodes are enabled
MultiESDTNFTTransferAndExecuteByUserEnableEpoch = 9999999

# BLSMultiSignerEnableEpoch represents the activation epoch for different types of BLS multi-signers
BLSMultiSignerEnableEpoch = [
{ EnableEpoch = 0, Type = "no-KOSK" },
Expand Down
4 changes: 4 additions & 0 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,9 @@ const (
// MetricCryptoOpcodesV2EnableEpoch represents the epoch when crypto opcodes v2 feature is enabled
MetricCryptoOpcodesV2EnableEpoch = "erd_crypto_opcodes_v2_enable_epoch"

// MetricMultiESDTNFTTransferAndExecuteByUserEnableEpoch represents the epoch when enshrined sovereign opcodes are enabled
MetricMultiESDTNFTTransferAndExecuteByUserEnableEpoch = "erd_multi_esdt_transfer_execute_by_user_enable_epoch"

// MetricMaxNodesChangeEnableEpoch holds configuration for changing the maximum number of nodes and the enabling epoch
MetricMaxNodesChangeEnableEpoch = "erd_max_nodes_change_enable_epoch"

Expand Down Expand Up @@ -1229,5 +1232,6 @@ const (
UnJailCleanupFlag core.EnableEpochFlag = "UnJailCleanupFlag"
RelayedTransactionsV3Flag core.EnableEpochFlag = "RelayedTransactionsV3Flag"
FixRelayedBaseCostFlag core.EnableEpochFlag = "FixRelayedBaseCostFlag"
MultiESDTNFTTransferAndExecuteByUserFlag core.EnableEpochFlag = "MultiESDTNFTTransferAndExecuteByUserFlag"
// 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 @@ -768,6 +768,12 @@ func (handler *enableEpochsHandler) createAllFlagsMap() {
},
activationEpoch: handler.enableEpochsConfig.FixRelayedBaseCostEnableEpoch,
},
common.MultiESDTNFTTransferAndExecuteByUserFlag: {
isActiveInEpoch: func(epoch uint32) bool {
return epoch >= handler.enableEpochsConfig.MultiESDTNFTTransferAndExecuteByUserEnableEpoch
},
activationEpoch: handler.enableEpochsConfig.MultiESDTNFTTransferAndExecuteByUserEnableEpoch,
},
}
}

Expand Down
2 changes: 2 additions & 0 deletions common/enablers/enableEpochsHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ func createEnableEpochsConfig() config.EnableEpochs {
CryptoOpcodesV2EnableEpoch: 104,
RelayedTransactionsV3EnableEpoch: 105,
FixRelayedBaseCostEnableEpoch: 106,
MultiESDTNFTTransferAndExecuteByUserEnableEpoch: 107,
}
}

Expand Down Expand Up @@ -444,6 +445,7 @@ func TestEnableEpochsHandler_GetActivationEpoch(t *testing.T) {
require.Equal(t, cfg.CryptoOpcodesV2EnableEpoch, handler.GetActivationEpoch(common.CryptoOpcodesV2Flag))
require.Equal(t, cfg.RelayedTransactionsV3EnableEpoch, handler.GetActivationEpoch(common.RelayedTransactionsV3Flag))
require.Equal(t, cfg.FixRelayedBaseCostEnableEpoch, handler.GetActivationEpoch(common.FixRelayedBaseCostFlag))
require.Equal(t, cfg.MultiESDTNFTTransferAndExecuteByUserEnableEpoch, handler.GetActivationEpoch(common.MultiESDTNFTTransferAndExecuteByUserFlag))
}

func TestEnableEpochsHandler_IsInterfaceNil(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions config/epochConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ type EnableEpochs struct {
UnJailCleanupEnableEpoch uint32
RelayedTransactionsV3EnableEpoch uint32
FixRelayedBaseCostEnableEpoch uint32
MultiESDTNFTTransferAndExecuteByUserEnableEpoch uint32
BLSMultiSignerEnableEpoch []MultiSignerConfig
}

Expand Down
4 changes: 4 additions & 0 deletions config/tomlConfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,9 @@ func TestEnableEpochConfig(t *testing.T) {
# FixRelayedBaseCostEnableEpoch represents the epoch when the fix for relayed base cost will be enabled
FixRelayedBaseCostEnableEpoch = 100
# MultiESDTNFTTransferAndExecuteByUserEnableEpoch represents the epoch when enshrined sovereign cross chain opcodes are enabled
MultiESDTNFTTransferAndExecuteByUserEnableEpoch = 101
# MaxNodesChangeEnableEpoch holds configuration for changing the maximum number of nodes and the enabling epoch
MaxNodesChangeEnableEpoch = [
{ EpochEnable = 44, MaxNumNodes = 2169, NodesToShufflePerShard = 80 },
Expand Down Expand Up @@ -996,6 +999,7 @@ func TestEnableEpochConfig(t *testing.T) {
CryptoOpcodesV2EnableEpoch: 98,
RelayedTransactionsV3EnableEpoch: 99,
FixRelayedBaseCostEnableEpoch: 100,
MultiESDTNFTTransferAndExecuteByUserEnableEpoch: 101,
MaxNodesChangeEnableEpoch: []MaxNodesChangeConfig{
{
EpochEnable: 44,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/multiversx/mx-chain-scenario-go v1.4.4-0.20240725072925-89c927c8b6a6
github.com/multiversx/mx-chain-storage-go v1.0.16-0.20240725070753-aa7fb322ebdf
github.com/multiversx/mx-chain-vm-common-go v1.5.13-0.20240725072715-8806f1301087
github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240725073737-3f682a6c59db
github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240726084628-e3e50b6f78d7
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.68-0.20240725073104-85ec99cb9260
github.com/multiversx/mx-chain-vm-v1_3-go v1.3.69-0.20240725073322-952f3197e2e2
github.com/multiversx/mx-chain-vm-v1_4-go v1.4.98-0.20240725073616-3b96f06509cf
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,8 @@ github.com/multiversx/mx-chain-storage-go v1.0.16-0.20240725070753-aa7fb322ebdf
github.com/multiversx/mx-chain-storage-go v1.0.16-0.20240725070753-aa7fb322ebdf/go.mod h1:ptvW/8r6bam55mVpeVZbyvvvydYM0DQwcPOH0W4Xyx8=
github.com/multiversx/mx-chain-vm-common-go v1.5.13-0.20240725072715-8806f1301087 h1:ovxs8X50iBL9TOkn0qHrkuXrBS1Y/EWfQOYmFEaXRNs=
github.com/multiversx/mx-chain-vm-common-go v1.5.13-0.20240725072715-8806f1301087/go.mod h1:nNGN+rdLRN8Nd6OhFGrkEZS5Ipj5IQCvFT0L/iQbOpU=
github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240725073737-3f682a6c59db h1:ZSvHaMsoL0hNfaVBsBZskUdMEaKu+Fdrx3KZrSBbkio=
github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240725073737-3f682a6c59db/go.mod h1:CFOSVrsHOzaO5YX2L/wyjP76L+BE/9rh+SereQV3pHA=
github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240726084628-e3e50b6f78d7 h1:LN9W/RcrhNR3dLB9FhsuCl9fViwceyjzMUeL/s9SBIs=
github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240726084628-e3e50b6f78d7/go.mod h1:CFOSVrsHOzaO5YX2L/wyjP76L+BE/9rh+SereQV3pHA=
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.68-0.20240725073104-85ec99cb9260 h1:Ny3s7dw2oF6AVq4kZYmhNYWvAuLEbd48JPPIC6tFzOA=
github.com/multiversx/mx-chain-vm-v1_2-go v1.2.68-0.20240725073104-85ec99cb9260/go.mod h1:NFRX6UrkBMb28HFKZyKwH894uxfrZyfuFqMF1KBVqFw=
github.com/multiversx/mx-chain-vm-v1_3-go v1.3.69-0.20240725073322-952f3197e2e2 h1:TM45+UXZV5DYOHlbGiHyQm44hOlBid8g9qfvYqopILs=
Expand Down
1 change: 1 addition & 0 deletions node/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ func InitConfigMetrics(
appStatusHandler.SetUInt64Value(common.MetricDynamicESDTEnableEpoch, uint64(enableEpochs.DynamicESDTEnableEpoch))
appStatusHandler.SetUInt64Value(common.MetricEGLDInMultiTransferEnableEpoch, uint64(enableEpochs.EGLDInMultiTransferEnableEpoch))
appStatusHandler.SetUInt64Value(common.MetricCryptoOpcodesV2EnableEpoch, uint64(enableEpochs.CryptoOpcodesV2EnableEpoch))
appStatusHandler.SetUInt64Value(common.MetricMultiESDTNFTTransferAndExecuteByUserEnableEpoch, uint64(enableEpochs.MultiESDTNFTTransferAndExecuteByUserEnableEpoch))

for i, nodesChangeConfig := range enableEpochs.MaxNodesChangeEnableEpoch {
epochEnable := fmt.Sprintf("%s%d%s", common.MetricMaxNodesChangeEnableEpoch, i, common.EpochEnableSuffix)
Expand Down
2 changes: 2 additions & 0 deletions node/metrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ func TestInitConfigMetrics(t *testing.T) {
ScToScLogEventEnableEpoch: 103,
RelayedTransactionsV3EnableEpoch: 104,
FixRelayedBaseCostEnableEpoch: 105,
MultiESDTNFTTransferAndExecuteByUserEnableEpoch: 106,
MaxNodesChangeEnableEpoch: []config.MaxNodesChangeConfig{
{
EpochEnable: 0,
Expand Down Expand Up @@ -330,6 +331,7 @@ func TestInitConfigMetrics(t *testing.T) {
"erd_set_sc_to_sc_log_event_enable_epoch": uint32(103),
"erd_relayed_transactions_v3_enable_epoch": uint32(104),
"erd_fix_relayed_base_cost_enable_epoch": uint32(105),
"erd_multi_esdt_transfer_execute_by_user_enable_epoch": uint32(106),
"erd_max_nodes_change_enable_epoch": nil,
"erd_total_supply": "12345",
"erd_hysteresis": "0.100000",
Expand Down
1 change: 1 addition & 0 deletions statusHandler/statusMetricsProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ func (sm *statusMetrics) EnableEpochsMetrics() (map[string]interface{}, error) {
enableEpochsMetrics[common.MetricDynamicESDTEnableEpoch] = sm.uint64Metrics[common.MetricDynamicESDTEnableEpoch]
enableEpochsMetrics[common.MetricEGLDInMultiTransferEnableEpoch] = sm.uint64Metrics[common.MetricEGLDInMultiTransferEnableEpoch]
enableEpochsMetrics[common.MetricCryptoOpcodesV2EnableEpoch] = sm.uint64Metrics[common.MetricCryptoOpcodesV2EnableEpoch]
enableEpochsMetrics[common.MetricMultiESDTNFTTransferAndExecuteByUserEnableEpoch] = sm.uint64Metrics[common.MetricMultiESDTNFTTransferAndExecuteByUserEnableEpoch]

numNodesChangeConfig := sm.uint64Metrics[common.MetricMaxNodesChangeEnableEpoch+"_count"]

Expand Down
2 changes: 2 additions & 0 deletions statusHandler/statusMetricsProvider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ func TestStatusMetrics_EnableEpochMetrics(t *testing.T) {
sm.SetUInt64Value(common.MetricDynamicESDTEnableEpoch, uint64(4))
sm.SetUInt64Value(common.MetricEGLDInMultiTransferEnableEpoch, uint64(4))
sm.SetUInt64Value(common.MetricCryptoOpcodesV2EnableEpoch, uint64(4))
sm.SetUInt64Value(common.MetricMultiESDTNFTTransferAndExecuteByUserEnableEpoch, uint64(4))

maxNodesChangeConfig := []map[string]uint64{
{
Expand Down Expand Up @@ -529,6 +530,7 @@ func TestStatusMetrics_EnableEpochMetrics(t *testing.T) {
common.MetricDynamicESDTEnableEpoch: uint64(4),
common.MetricEGLDInMultiTransferEnableEpoch: uint64(4),
common.MetricCryptoOpcodesV2EnableEpoch: uint64(4),
common.MetricMultiESDTNFTTransferAndExecuteByUserEnableEpoch: uint64(4),

common.MetricMaxNodesChangeEnableEpoch: []map[string]interface{}{
{
Expand Down

0 comments on commit 552fbac

Please sign in to comment.