From 8098d3bffe0ae472cab0d413fee2a39d489b7c70 Mon Sep 17 00:00:00 2001 From: robertsasu Date: Fri, 26 Jul 2024 11:05:09 +0300 Subject: [PATCH 1/3] new flag for multi transfer and execute by user --- cmd/node/config/enableEpochs.toml | 3 +++ common/constants.go | 4 ++++ common/enablers/enableEpochsHandler.go | 6 ++++++ common/enablers/enableEpochsHandler_test.go | 2 ++ config/epochConfig.go | 1 + config/tomlConfig_test.go | 4 ++++ go.mod | 2 +- go.sum | 4 ++-- node/metrics/metrics.go | 1 + node/metrics/metrics_test.go | 1 + statusHandler/statusMetricsProvider.go | 1 + statusHandler/statusMetricsProvider_test.go | 2 ++ 12 files changed, 28 insertions(+), 3 deletions(-) diff --git a/cmd/node/config/enableEpochs.toml b/cmd/node/config/enableEpochs.toml index 7b1177754bb..f088f7b549c 100644 --- a/cmd/node/config/enableEpochs.toml +++ b/cmd/node/config/enableEpochs.toml @@ -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" }, diff --git a/common/constants.go b/common/constants.go index d5875d10de9..984dec87b07 100644 --- a/common/constants.go +++ b/common/constants.go @@ -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" @@ -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 ) diff --git a/common/enablers/enableEpochsHandler.go b/common/enablers/enableEpochsHandler.go index 8b00b91f6f8..d3df21b6bbb 100644 --- a/common/enablers/enableEpochsHandler.go +++ b/common/enablers/enableEpochsHandler.go @@ -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, + }, } } diff --git a/common/enablers/enableEpochsHandler_test.go b/common/enablers/enableEpochsHandler_test.go index ad1bf9d386d..72fafc5a689 100644 --- a/common/enablers/enableEpochsHandler_test.go +++ b/common/enablers/enableEpochsHandler_test.go @@ -121,6 +121,7 @@ func createEnableEpochsConfig() config.EnableEpochs { CryptoOpcodesV2EnableEpoch: 104, RelayedTransactionsV3EnableEpoch: 105, FixRelayedBaseCostEnableEpoch: 106, + MultiESDTNFTTransferAndExecuteByUserEnableEpoch: 107, } } @@ -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) { diff --git a/config/epochConfig.go b/config/epochConfig.go index 4600c6ccb4c..7f965e3c5c5 100644 --- a/config/epochConfig.go +++ b/config/epochConfig.go @@ -120,6 +120,7 @@ type EnableEpochs struct { UnJailCleanupEnableEpoch uint32 RelayedTransactionsV3EnableEpoch uint32 FixRelayedBaseCostEnableEpoch uint32 + MultiESDTNFTTransferAndExecuteByUserEnableEpoch uint32 BLSMultiSignerEnableEpoch []MultiSignerConfig } diff --git a/config/tomlConfig_test.go b/config/tomlConfig_test.go index 554066dfb16..c6cecedc774 100644 --- a/config/tomlConfig_test.go +++ b/config/tomlConfig_test.go @@ -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 }, @@ -996,6 +999,7 @@ func TestEnableEpochConfig(t *testing.T) { CryptoOpcodesV2EnableEpoch: 98, RelayedTransactionsV3EnableEpoch: 99, FixRelayedBaseCostEnableEpoch: 100, + MultiESDTNFTTransferAndExecuteByUserEnableEpoch: 101, MaxNodesChangeEnableEpoch: []MaxNodesChangeConfig{ { EpochEnable: 44, diff --git a/go.mod b/go.mod index 140e76d10c8..2157463e439 100644 --- a/go.mod +++ b/go.mod @@ -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.20240726073639-9001fcac5337 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 diff --git a/go.sum b/go.sum index 1522bc6a3e5..4dd78fb05a5 100644 --- a/go.sum +++ b/go.sum @@ -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.20240726073639-9001fcac5337 h1:CZDuVh/lKUdv+KMkiKrSMFi85lSL8Ykp1at9alM7c1U= +github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240726073639-9001fcac5337/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= diff --git a/node/metrics/metrics.go b/node/metrics/metrics.go index 38c616e97f5..c380c08b95d 100644 --- a/node/metrics/metrics.go +++ b/node/metrics/metrics.go @@ -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) diff --git a/node/metrics/metrics_test.go b/node/metrics/metrics_test.go index 71c96ba7304..bc81912d74a 100644 --- a/node/metrics/metrics_test.go +++ b/node/metrics/metrics_test.go @@ -210,6 +210,7 @@ func TestInitConfigMetrics(t *testing.T) { ScToScLogEventEnableEpoch: 103, RelayedTransactionsV3EnableEpoch: 104, FixRelayedBaseCostEnableEpoch: 105, + MultiESDTNFTTransferAndExecuteByUserEnableEpoch: 106, MaxNodesChangeEnableEpoch: []config.MaxNodesChangeConfig{ { EpochEnable: 0, diff --git a/statusHandler/statusMetricsProvider.go b/statusHandler/statusMetricsProvider.go index b47b6851eae..30ead1e5749 100644 --- a/statusHandler/statusMetricsProvider.go +++ b/statusHandler/statusMetricsProvider.go @@ -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"] diff --git a/statusHandler/statusMetricsProvider_test.go b/statusHandler/statusMetricsProvider_test.go index 2eecf8cd598..02f33d62549 100644 --- a/statusHandler/statusMetricsProvider_test.go +++ b/statusHandler/statusMetricsProvider_test.go @@ -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{ { @@ -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{}{ { From ee15920de256da2ea6cb50d23a667503901e0093 Mon Sep 17 00:00:00 2001 From: robertsasu Date: Fri, 26 Jul 2024 11:35:51 +0300 Subject: [PATCH 2/3] fix test --- node/metrics/metrics_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/node/metrics/metrics_test.go b/node/metrics/metrics_test.go index bc81912d74a..395d42afc15 100644 --- a/node/metrics/metrics_test.go +++ b/node/metrics/metrics_test.go @@ -331,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", From 28f517a3e3df40864838a9123b3aa7191c83a6f2 Mon Sep 17 00:00:00 2001 From: robertsasu Date: Fri, 26 Jul 2024 11:59:27 +0300 Subject: [PATCH 3/3] new vm --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2157463e439..809222ccff9 100644 --- a/go.mod +++ b/go.mod @@ -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.20240726073639-9001fcac5337 + 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 diff --git a/go.sum b/go.sum index 4dd78fb05a5..20cd9322e3b 100644 --- a/go.sum +++ b/go.sum @@ -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.20240726073639-9001fcac5337 h1:CZDuVh/lKUdv+KMkiKrSMFi85lSL8Ykp1at9alM7c1U= -github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240726073639-9001fcac5337/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=