Skip to content

Commit

Permalink
add system vm critical section
Browse files Browse the repository at this point in the history
  • Loading branch information
AdoAdoAdo committed May 21, 2024
1 parent f7efd0f commit b8674ca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vm/process/systemVM.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b8674ca

Please sign in to comment.