diff --git a/vm/process/systemVM.go b/vm/process/systemVM.go index 6a3452304fa..90228e4adaa 100644 --- a/vm/process/systemVM.go +++ b/vm/process/systemVM.go @@ -6,9 +6,10 @@ import ( "github.com/multiversx/mx-chain-core-go/core" "github.com/multiversx/mx-chain-core-go/core/check" + vmcommon "github.com/multiversx/mx-chain-vm-common-go" + "github.com/multiversx/mx-chain-go/common" "github.com/multiversx/mx-chain-go/vm" - vmcommon "github.com/multiversx/mx-chain-vm-common-go" ) type systemVM struct { @@ -18,6 +19,7 @@ type systemVM struct { asyncCallbackGasLock uint64 asyncCallStepCost uint64 mutGasLock sync.RWMutex + criticalSection sync.Mutex } // ArgsNewSystemVM defines the needed arguments to create a new system vm @@ -101,6 +103,9 @@ func (s *systemVM) RunSmartContractCreate(input *vmcommon.ContractCreateInput) ( // RunSmartContractCall executes a smart contract according to the input func (s *systemVM) RunSmartContractCall(input *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error) { + s.criticalSection.Lock() + defer s.criticalSection.Unlock() + s.systemEI.CleanCache() s.systemEI.SetSCAddress(input.RecipientAddr) s.systemEI.AddTxValueToSmartContract(input.CallValue, input.RecipientAddr)