From 9001fcac53378b7bded9829636d742d23c1e5bdc Mon Sep 17 00:00:00 2001 From: robertsasu Date: Fri, 26 Jul 2024 10:36:39 +0300 Subject: [PATCH 1/2] adding separate flag --- vmhost/flags.go | 3 +++ vmhost/hostCore/host.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/vmhost/flags.go b/vmhost/flags.go index b9f4d008b..b329b1b6e 100644 --- a/vmhost/flags.go +++ b/vmhost/flags.go @@ -5,4 +5,7 @@ import "github.com/multiversx/mx-chain-core-go/core" const ( // CryptoOpcodesV2Flag defines the flag that activates the new crypto APIs for RC1.7 CryptoOpcodesV2Flag core.EnableEpochFlag = "CryptoOpcodesV2Flag" + + // MultiESDTNFTTransferAndExecuteByUserFlag defines the flag that activates the enshrined sovereign functions + MultiESDTNFTTransferAndExecuteByUserFlag core.EnableEpochFlag = "MultiESDTNFTTransferAndExecuteByUserFlag" ) diff --git a/vmhost/hostCore/host.go b/vmhost/hostCore/host.go index 8ba4ec040..90f3530f2 100644 --- a/vmhost/hostCore/host.go +++ b/vmhost/hostCore/host.go @@ -544,6 +544,10 @@ func (host *vmHost) AreInSameShard(leftAddress []byte, rightAddress []byte) bool // IsAllowedToExecute returns true if the special opcode is allowed to be run by the address func (host *vmHost) IsAllowedToExecute(opcode string) bool { + if !host.enableEpochsHandler.IsFlagEnabled(vmhost.MultiESDTNFTTransferAndExecuteByUserFlag) { + return false + } + mapAddresses, ok := host.mapOpcodeAddressIsAllowed[opcode] if !ok { return false From e3e50b6f78d79f273e828526823b7d529795ea72 Mon Sep 17 00:00:00 2001 From: robertsasu Date: Fri, 26 Jul 2024 11:46:28 +0300 Subject: [PATCH 2/2] adding separate flag --- vmhost/hostCore/host.go | 1 + 1 file changed, 1 insertion(+) diff --git a/vmhost/hostCore/host.go b/vmhost/hostCore/host.go index 90f3530f2..8fe028ab5 100644 --- a/vmhost/hostCore/host.go +++ b/vmhost/hostCore/host.go @@ -40,6 +40,7 @@ const internalVMErrors = "internalVMErrors" // allFlags must have all flags used by mx-chain-vm-go in the current version var allFlags = []core.EnableEpochFlag{ vmhost.CryptoOpcodesV2Flag, + vmhost.MultiESDTNFTTransferAndExecuteByUserFlag, } // vmHost implements HostContext interface.