diff --git a/Makefile b/Makefile index 62ae8c5f7cc..08ec7a68759 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,7 @@ benchmark-arwen: go test -v -count=1 -test.bench 'Benchmark_VmDeployWithCPUCalculateAndExecute' -test.run='noruns' ./integrationTests/vm/arwen go test -v -count=1 -test.bench 'Benchmark_VmDeployWithStringConcatAndExecute' -test.run='noruns' ./integrationTests/vm/arwen +#TODO: this is no longer required should be removed in a subsequent PR arwen: ifndef ARWEN_PATH $(error ARWEN_PATH is undefined) diff --git a/cmd/assessment/benchmarks/erc20Benchmark.go b/cmd/assessment/benchmarks/erc20Benchmark.go index d6f81c3767e..27a923a1294 100644 --- a/cmd/assessment/benchmarks/erc20Benchmark.go +++ b/cmd/assessment/benchmarks/erc20Benchmark.go @@ -48,7 +48,6 @@ func (eb *erc20Benchmark) Run() (time.Duration, error) { createTestGasMap(), eb.scFilename, eb.function, - false, ) if err != nil { return 0, err diff --git a/cmd/node/config/config.toml b/cmd/node/config/config.toml index ccd1928b7b6..f5eaec0fd33 100644 --- a/cmd/node/config/config.toml +++ b/cmd/node/config/config.toml @@ -640,38 +640,29 @@ [VirtualMachine] [VirtualMachine.Execution] - OutOfProcessEnabled = true ArwenVersions = [ - { StartEpoch = 0, Version = "v1.2", OutOfProcessSupported = false }, - { StartEpoch = 3, Version = "v1.3", OutOfProcessSupported = false }, - { StartEpoch = 4, Version = "v1.2", OutOfProcessSupported = false }, - { StartEpoch = 5, Version = "v1.3", OutOfProcessSupported = false }, - { StartEpoch = 6, Version = "v1.2", OutOfProcessSupported = false }, - { StartEpoch = 7, Version = "v1.3", OutOfProcessSupported = false }, - { StartEpoch = 8, Version = "v1.2", OutOfProcessSupported = false }, - { StartEpoch = 9, Version = "v1.3", OutOfProcessSupported = false }, + { StartEpoch = 0, Version = "v1.2" }, + { StartEpoch = 3, Version = "v1.3" }, + { StartEpoch = 4, Version = "v1.2" }, + { StartEpoch = 5, Version = "v1.3" }, + { StartEpoch = 6, Version = "v1.2" }, + { StartEpoch = 7, Version = "v1.3" }, + { StartEpoch = 8, Version = "v1.2" }, + { StartEpoch = 9, Version = "v1.3" }, ] - [VirtualMachine.Execution.OutOfProcessConfig] - LogsMarshalizer = "json" - MessagesMarshalizer = "json" - MaxLoopTime = 1000 + [VirtualMachine.Querying] NumConcurrentVMs = 1 - OutOfProcessEnabled = true ArwenVersions = [ - { StartEpoch = 0, Version = "v1.2", OutOfProcessSupported = false }, - { StartEpoch = 3, Version = "v1.3", OutOfProcessSupported = false }, - { StartEpoch = 4, Version = "v1.2", OutOfProcessSupported = false }, - { StartEpoch = 5, Version = "v1.3", OutOfProcessSupported = false }, - { StartEpoch = 6, Version = "v1.2", OutOfProcessSupported = false }, - { StartEpoch = 7, Version = "v1.3", OutOfProcessSupported = false }, - { StartEpoch = 8, Version = "v1.2", OutOfProcessSupported = false }, - { StartEpoch = 9, Version = "v1.3", OutOfProcessSupported = false }, + { StartEpoch = 0, Version = "v1.2" }, + { StartEpoch = 3, Version = "v1.3" }, + { StartEpoch = 4, Version = "v1.2" }, + { StartEpoch = 5, Version = "v1.3" }, + { StartEpoch = 6, Version = "v1.2" }, + { StartEpoch = 7, Version = "v1.3" }, + { StartEpoch = 8, Version = "v1.2" }, + { StartEpoch = 9, Version = "v1.3" }, ] - [VirtualMachine.Querying.OutOfProcessConfig] - LogsMarshalizer = "json" - MessagesMarshalizer = "json" - MaxLoopTime = 10000 [Hardfork] EnableTrigger = true diff --git a/cmd/node/factory/structs.go b/cmd/node/factory/structs.go index 3958bb7d7d6..d00f782ba7b 100644 --- a/cmd/node/factory/structs.go +++ b/cmd/node/factory/structs.go @@ -1309,7 +1309,6 @@ func generateGenesisHeadersAndApplyInitialBalances(args *processComponentsFactor economicsData := args.economicsData genesisVmConfig := args.mainConfig.VirtualMachine.Execution - genesisVmConfig.OutOfProcessConfig.MaxLoopTime = 5000 // 5 seconds arg := genesisProcess.ArgsGenesisBlockCreator{ GenesisTime: uint64(nodesSetup.StartTime), diff --git a/cmd/node/main.go b/cmd/node/main.go index 02f24e3958e..36f00a8c03a 100644 --- a/cmd/node/main.go +++ b/cmd/node/main.go @@ -1884,9 +1884,9 @@ func createShardCoordinator( return nil, "", err } if selfShardId == core.DisabledShardIDAsObserver { - pubKeyBytes, err := pubKey.ToByteArray() - if err != nil { - return nil, core.NodeTypeObserver, fmt.Errorf("%w while assigning random shard ID for observer", err) + pubKeyBytes, errConvert := pubKey.ToByteArray() + if errConvert != nil { + return nil, core.NodeTypeObserver, fmt.Errorf("%w while assigning random shard ID for observer", errConvert) } selfShardId = core.AssignShardForPubKeyWhenNotSpecified(pubKeyBytes, nodesConfig.NumberOfShards()) @@ -1935,9 +1935,9 @@ func createNodesCoordinator( return nil, nil, err } if shardIDAsObserver == core.DisabledShardIDAsObserver { - pubKeyBytes, err := pubKey.ToByteArray() - if err != nil { - return nil, nil, fmt.Errorf("%w while assigning random shard ID for observer", err) + pubKeyBytes, errConvert := pubKey.ToByteArray() + if errConvert != nil { + return nil, nil, fmt.Errorf("%w while assigning random shard ID for observer", errConvert) } shardIDAsObserver = core.AssignShardForPubKeyWhenNotSpecified(pubKeyBytes, nodesConfig.NumberOfShards()) @@ -2759,7 +2759,6 @@ func createScQueryElement( } } else { queryVirtualMachineConfig := generalConfig.VirtualMachine.Querying.VirtualMachineConfig - queryVirtualMachineConfig.OutOfProcessEnabled = true argsNewVMFactory := shard.ArgVMContainerFactory{ Config: queryVirtualMachineConfig, BlockGasLimit: economics.MaxGasLimitPerBlock(shardCoordinator.SelfId()), diff --git a/config/config.go b/config/config.go index 5c9a5e0c55c..a6fae36b890 100644 --- a/config/config.go +++ b/config/config.go @@ -347,16 +347,13 @@ type VirtualMachineServicesConfig struct { // VirtualMachineConfig holds configuration for a Virtual Machine service type VirtualMachineConfig struct { - OutOfProcessConfig VirtualMachineOutOfProcessConfig - OutOfProcessEnabled bool - ArwenVersions []ArwenVersionByEpoch + ArwenVersions []ArwenVersionByEpoch } // ArwenVersionByEpoch represents the Arwen version to be used starting with an epoch type ArwenVersionByEpoch struct { - StartEpoch uint32 - OutOfProcessSupported bool - Version string + StartEpoch uint32 + Version string } // QueryVirtualMachineConfig holds the configuration for the virtual machine(s) used in query process @@ -365,13 +362,6 @@ type QueryVirtualMachineConfig struct { NumConcurrentVMs int } -// VirtualMachineOutOfProcessConfig holds configuration for out-of-process virtual machine(s) -type VirtualMachineOutOfProcessConfig struct { - LogsMarshalizer string - MessagesMarshalizer string - MaxLoopTime int -} - // HardforkConfig holds the configuration for the hardfork trigger type HardforkConfig struct { ExportStateStorageConfig StorageConfig diff --git a/config/tomlConfig_test.go b/config/tomlConfig_test.go index ea80871d501..c6e241ce22b 100644 --- a/config/tomlConfig_test.go +++ b/config/tomlConfig_test.go @@ -39,15 +39,9 @@ func TestTomlParser(t *testing.T) { consensusType := "bls" vmConfig := VirtualMachineConfig{ - OutOfProcessEnabled: false, - OutOfProcessConfig: VirtualMachineOutOfProcessConfig{ - LogsMarshalizer: "json", - MessagesMarshalizer: "json", - MaxLoopTime: 1000, - }, ArwenVersions: []ArwenVersionByEpoch{ - {StartEpoch: 12, Version: "v0.3", OutOfProcessSupported: true}, - {StartEpoch: 88, Version: "v1.2", OutOfProcessSupported: false}, + {StartEpoch: 12, Version: "v0.3"}, + {StartEpoch: 88, Version: "v1.2"}, }, } cfgExpected := Config{ @@ -103,7 +97,6 @@ func TestTomlParser(t *testing.T) { }, }, } - cfgExpected.VirtualMachine.Querying.OutOfProcessEnabled = true testString := ` [MiniBlocksStorage] [MiniBlocksStorage.Cache] @@ -149,26 +142,17 @@ func TestTomlParser(t *testing.T) { [VirtualMachine] [VirtualMachine.Execution] - OutOfProcessEnabled = false ArwenVersions = [ - { StartEpoch = 12, Version = "v0.3", OutOfProcessSupported = true}, - { StartEpoch = 88, Version = "v1.2", OutOfProcessSupported = false}, + { StartEpoch = 12, Version = "v0.3" }, + { StartEpoch = 88, Version = "v1.2" }, ] - [VirtualMachine.Execution.OutOfProcessConfig] - LogsMarshalizer = "json" - MessagesMarshalizer = "json" - MaxLoopTime = 1000 + [VirtualMachine.Querying] NumConcurrentVMs = 16 - OutOfProcessEnabled = true ArwenVersions = [ - { StartEpoch = 12, Version = "v0.3", OutOfProcessSupported = true}, - { StartEpoch = 88, Version = "v1.2", OutOfProcessSupported = false}, + { StartEpoch = 12, Version = "v0.3" }, + { StartEpoch = 88, Version = "v1.2" }, ] - [VirtualMachine.Querying.OutOfProcessConfig] - LogsMarshalizer = "json" - MessagesMarshalizer = "json" - MaxLoopTime = 1000 ` cfg := Config{} diff --git a/genesis/process/genesisBlockCreator_test.go b/genesis/process/genesisBlockCreator_test.go index feb604e83fd..6b8c0837972 100644 --- a/genesis/process/genesisBlockCreator_test.go +++ b/genesis/process/genesisBlockCreator_test.go @@ -62,10 +62,8 @@ func createMockArgument( DataPool: testscommon.NewPoolsHolderMock(), TxLogsProcessor: &mock.TxLogProcessorMock{}, VirtualMachineConfig: config.VirtualMachineConfig{ - OutOfProcessEnabled: true, - OutOfProcessConfig: config.VirtualMachineOutOfProcessConfig{MaxLoopTime: 999}, ArwenVersions: []config.ArwenVersionByEpoch{ - {StartEpoch: 0, OutOfProcessSupported: false, Version: "*"}, + {StartEpoch: 0, Version: "*"}, }, }, HardForkConfig: config.HardforkConfig{}, diff --git a/integrationTests/multiShard/hardFork/hardFork_test.go b/integrationTests/multiShard/hardFork/hardFork_test.go index 301ed94f080..dc7e53249c9 100644 --- a/integrationTests/multiShard/hardFork/hardFork_test.go +++ b/integrationTests/multiShard/hardFork/hardFork_test.go @@ -413,10 +413,8 @@ func hardForkImport( GasSchedule: mock.NewGasScheduleNotifierMock(gasSchedule), TxLogsProcessor: &mock.TxLogsProcessorStub{}, VirtualMachineConfig: config.VirtualMachineConfig{ - OutOfProcessEnabled: true, - OutOfProcessConfig: config.VirtualMachineOutOfProcessConfig{MaxLoopTime: 999}, ArwenVersions: []config.ArwenVersionByEpoch{ - {StartEpoch: 0, OutOfProcessSupported: false, Version: "*"}, + {StartEpoch: 0, Version: "*"}, }, }, HardForkConfig: config.HardforkConfig{ diff --git a/integrationTests/testInitializer.go b/integrationTests/testInitializer.go index 5bd9ae3032e..fd5cf779beb 100644 --- a/integrationTests/testInitializer.go +++ b/integrationTests/testInitializer.go @@ -543,10 +543,8 @@ func CreateFullGenesisBlocks( GasSchedule: mock.NewGasScheduleNotifierMock(gasSchedule), TxLogsProcessor: &mock.TxLogsProcessorStub{}, VirtualMachineConfig: config.VirtualMachineConfig{ - OutOfProcessEnabled: true, - OutOfProcessConfig: config.VirtualMachineOutOfProcessConfig{MaxLoopTime: 999}, ArwenVersions: []config.ArwenVersionByEpoch{ - {StartEpoch: 0, OutOfProcessSupported: false, Version: "*"}, + {StartEpoch: 0, Version: "*"}, }, }, TrieStorageManagers: trieStorageManagers, @@ -648,10 +646,8 @@ func CreateGenesisMetaBlock( GasSchedule: mock.NewGasScheduleNotifierMock(gasSchedule), TxLogsProcessor: &mock.TxLogsProcessorStub{}, VirtualMachineConfig: config.VirtualMachineConfig{ - OutOfProcessEnabled: true, - OutOfProcessConfig: config.VirtualMachineOutOfProcessConfig{MaxLoopTime: 999}, ArwenVersions: []config.ArwenVersionByEpoch{ - {StartEpoch: 0, OutOfProcessSupported: false, Version: "*"}, + {StartEpoch: 0, Version: "*"}, }, }, HardForkConfig: config.HardforkConfig{}, diff --git a/integrationTests/testProcessorNode.go b/integrationTests/testProcessorNode.go index c2f8474994d..8acfcf38bf7 100644 --- a/integrationTests/testProcessorNode.go +++ b/integrationTests/testProcessorNode.go @@ -835,10 +835,8 @@ func (tpn *TestProcessorNode) createFullSCQueryService() { } else { argsNewVMFactory := shard.ArgVMContainerFactory{ Config: config.VirtualMachineConfig{ - OutOfProcessEnabled: true, - OutOfProcessConfig: config.VirtualMachineOutOfProcessConfig{MaxLoopTime: 999}, ArwenVersions: []config.ArwenVersionByEpoch{ - {StartEpoch: 0, OutOfProcessSupported: false, Version: "*"}, + {StartEpoch: 0, Version: "*"}, }, }, BlockGasLimit: tpn.EconomicsData.MaxGasLimitPerBlock(tpn.ShardCoordinator.SelfId()), @@ -1311,10 +1309,8 @@ func (tpn *TestProcessorNode) initInnerProcessors(gasMap map[string]map[string]u maxGasLimitPerBlock := uint64(0xFFFFFFFFFFFFFFFF) argsNewVMFactory := shard.ArgVMContainerFactory{ Config: config.VirtualMachineConfig{ - OutOfProcessEnabled: false, - OutOfProcessConfig: config.VirtualMachineOutOfProcessConfig{MaxLoopTime: 999}, ArwenVersions: []config.ArwenVersionByEpoch{ - {StartEpoch: 0, OutOfProcessSupported: false, Version: "*"}, + {StartEpoch: 0, Version: "*"}, }, }, BlockGasLimit: maxGasLimitPerBlock, diff --git a/integrationTests/vm/arwen/arwenVM/arwenVM_test.go b/integrationTests/vm/arwen/arwenVM/arwenVM_test.go index 5a920cb2c9d..2b4b1e4eeb8 100644 --- a/integrationTests/vm/arwen/arwenVM/arwenVM_test.go +++ b/integrationTests/vm/arwen/arwenVM/arwenVM_test.go @@ -303,11 +303,11 @@ func TestMultipleTimesERC20BigIntInBatches(t *testing.T) { } gasSchedule, _ := core.LoadGasScheduleConfig("../../../../cmd/node/config/gasSchedules/gasScheduleV2.toml") - durations, err := DeployAndExecuteERC20WithBigInt(3, 1000, gasSchedule, "../testdata/erc20-c-03/wrc20_arwen.wasm", "transferToken", false) + durations, err := DeployAndExecuteERC20WithBigInt(3, 1000, gasSchedule, "../testdata/erc20-c-03/wrc20_arwen.wasm", "transferToken") require.Nil(t, err) displayBenchmarksResults(durations) - durations, err = DeployAndExecuteERC20WithBigInt(3, 1000, nil, "../testdata/erc20-c-03/wrc20_arwen.wasm", "transferToken", true) + durations, err = DeployAndExecuteERC20WithBigInt(3, 1000, nil, "../testdata/erc20-c-03/wrc20_arwen.wasm", "transferToken") require.Nil(t, err) displayBenchmarksResults(durations) } @@ -317,11 +317,11 @@ func TestMultipleTimesERC20RustBigIntInBatches(t *testing.T) { t.Skip("this is not a short test") } gasSchedule, _ := core.LoadGasScheduleConfig("../../../../cmd/node/config/gasSchedules/gasScheduleV2.toml") - durations, err := DeployAndExecuteERC20WithBigInt(3, 1000, gasSchedule, "../testdata/erc20-c-03/rust-simple-erc20.wasm", "transfer", false) + durations, err := DeployAndExecuteERC20WithBigInt(3, 1000, gasSchedule, "../testdata/erc20-c-03/rust-simple-erc20.wasm", "transfer") require.Nil(t, err) displayBenchmarksResults(durations) - durations, err = DeployAndExecuteERC20WithBigInt(3, 1000, nil, "../testdata/erc20-c-03/rust-simple-erc20.wasm", "transfer", true) + durations, err = DeployAndExecuteERC20WithBigInt(3, 1000, nil, "../testdata/erc20-c-03/rust-simple-erc20.wasm", "transfer") require.Nil(t, err) displayBenchmarksResults(durations) } @@ -367,7 +367,6 @@ func TestDeployERC20WithNotEnoughGasShouldReturnOutOfGas(t *testing.T) { ownerAddressBytes, ownerBalance, gasSchedule, - false, vm.ArgEnableEpoch{}, ) require.Nil(t, err) @@ -407,7 +406,6 @@ func TestJournalizingAndTimeToProcessChange(t *testing.T) { ownerAddressBytes, ownerBalance, nil, - false, vm.ArgEnableEpoch{}, ) require.Nil(t, err) @@ -614,7 +612,6 @@ func TestAndCatchTrieError(t *testing.T) { ownerAddressBytes, ownerBalance, nil, - false, vm.ArgEnableEpoch{}, ) require.Nil(t, err) diff --git a/integrationTests/vm/arwen/arwenVM/gasSchedule_test.go b/integrationTests/vm/arwen/arwenVM/gasSchedule_test.go index c3dfc9581b4..9734a2e9005 100644 --- a/integrationTests/vm/arwen/arwenVM/gasSchedule_test.go +++ b/integrationTests/vm/arwen/arwenVM/gasSchedule_test.go @@ -127,7 +127,7 @@ func TestGasModel(t *testing.T) { } fmt.Println("gasSchedule: " + big.NewInt(int64(totalOp)).String()) fmt.Println("ERC20 BIGINT") - durations, err := DeployAndExecuteERC20WithBigInt(1, 100, gasSchedule, "../testdata/erc20-c-03/wrc20_arwen.wasm", "transferToken", false) + durations, err := DeployAndExecuteERC20WithBigInt(1, 100, gasSchedule, "../testdata/erc20-c-03/wrc20_arwen.wasm", "transferToken") require.Nil(t, err) displayBenchmarksResults(durations) diff --git a/integrationTests/vm/arwen/arwenVM/testRunner.go b/integrationTests/vm/arwen/arwenVM/testRunner.go index 1a9ff0d3f3f..e0603b9f9db 100644 --- a/integrationTests/vm/arwen/arwenVM/testRunner.go +++ b/integrationTests/vm/arwen/arwenVM/testRunner.go @@ -55,7 +55,6 @@ func RunTest( ownerAddressBytes, ownerBalance, gasSchedule, - false, vm.ArgEnableEpoch{}, ) if err != nil { @@ -125,7 +124,6 @@ func DeployAndExecuteERC20WithBigInt( gasSchedule map[string]map[string]uint64, fileName string, functionName string, - outOfProcess bool, ) ([]time.Duration, error) { ownerAddressBytes := []byte("12345678901234567890123456789011") ownerNonce := uint64(11) @@ -140,7 +138,6 @@ func DeployAndExecuteERC20WithBigInt( ownerAddressBytes, ownerBalance, gasSchedule, - outOfProcess, vm.ArgEnableEpoch{}, ) if err != nil { diff --git a/integrationTests/vm/arwen/delegation/delegation_test.go b/integrationTests/vm/arwen/delegation/delegation_test.go index f1c39d5dde1..c6f2279c75d 100644 --- a/integrationTests/vm/arwen/delegation/delegation_test.go +++ b/integrationTests/vm/arwen/delegation/delegation_test.go @@ -212,7 +212,7 @@ func TestDelegationProcessManyAotInProcess(t *testing.T) { t.Skip("this is not a short test") } - delegationProcessManyTimes(t, "../testdata/delegation/delegation_v0_5_1_full.wasm", false, 2, 1) + delegationProcessManyTimes(t, "../testdata/delegation/delegation_v0_5_1_full.wasm", 2, 1) } func TestDelegationShrinkedProcessManyAotInProcess(t *testing.T) { @@ -220,7 +220,7 @@ func TestDelegationShrinkedProcessManyAotInProcess(t *testing.T) { t.Skip("this is not a short test") } - delegationProcessManyTimes(t, "../testdata/delegation/delegation_v0_5_2_full.wasm", false, 2, 1) + delegationProcessManyTimes(t, "../testdata/delegation/delegation_v0_5_2_full.wasm", 2, 1) } func TestDelegationProcessManyTimeCompileWithOutOfProcess(t *testing.T) { @@ -228,10 +228,10 @@ func TestDelegationProcessManyTimeCompileWithOutOfProcess(t *testing.T) { t.Skip("this is not a short test") } - delegationProcessManyTimes(t, "../testdata/delegation/delegation_v0_5_1_full.wasm", true, 100, 1) + delegationProcessManyTimes(t, "../testdata/delegation/delegation_v0_5_1_full.wasm", 100, 1) } -func delegationProcessManyTimes(t *testing.T, fileName string, outOfProcess bool, txPerBenchmark int, numRun int) { +func delegationProcessManyTimes(t *testing.T, fileName string, txPerBenchmark int, numRun int) { ownerAddressBytes := []byte("12345678901234567890123456789011") ownerNonce := uint64(11) ownerBalance := big.NewInt(10000000000000) @@ -246,7 +246,6 @@ func delegationProcessManyTimes(t *testing.T, fileName string, outOfProcess bool ownerAddressBytes, ownerBalance, gasSchedule, - outOfProcess, vm.ArgEnableEpoch{}, ) require.Nil(t, err) diff --git a/integrationTests/vm/arwen/utils.go b/integrationTests/vm/arwen/utils.go index b1767c641ef..379b4a3b15b 100644 --- a/integrationTests/vm/arwen/utils.go +++ b/integrationTests/vm/arwen/utils.go @@ -228,10 +228,8 @@ func (context *TestContext) initVMAndBlockchainHook() { } vmFactoryConfig := config.VirtualMachineConfig{ - OutOfProcessEnabled: false, - OutOfProcessConfig: config.VirtualMachineOutOfProcessConfig{MaxLoopTime: 999}, ArwenVersions: []config.ArwenVersionByEpoch{ - {StartEpoch: 0, OutOfProcessSupported: false, Version: "*"}, + {StartEpoch: 0, Version: "*"}, }, } diff --git a/integrationTests/vm/testInitializer.go b/integrationTests/vm/testInitializer.go index 16e2e455e25..086c05278ec 100644 --- a/integrationTests/vm/testInitializer.go +++ b/integrationTests/vm/testInitializer.go @@ -381,7 +381,6 @@ func CreateOneSCExecutorMockVM(accnts state.AccountsAdapter) vmcommon.VMExecutio func CreateVMAndBlockchainHook( accnts state.AccountsAdapter, gasSchedule map[string]map[string]uint64, - outOfProcess bool, shardCoordinator sharding.Coordinator, ) (process.VirtualMachinesContainer, *hooks.BlockChainHookImpl) { actualGasSchedule := gasSchedule @@ -420,10 +419,8 @@ func CreateVMAndBlockchainHook( maxGasLimitPerBlock := uint64(0xFFFFFFFFFFFFFFFF) argsNewVMFactory := shard.ArgVMContainerFactory{ Config: config.VirtualMachineConfig{ - OutOfProcessEnabled: outOfProcess, - OutOfProcessConfig: config.VirtualMachineOutOfProcessConfig{MaxLoopTime: 999}, ArwenVersions: []config.ArwenVersionByEpoch{ - {StartEpoch: 0, OutOfProcessSupported: false, Version: "*"}, + {StartEpoch: 0, Version: "*"}, }, }, BlockGasLimit: maxGasLimitPerBlock, @@ -714,7 +711,7 @@ func CreatePreparedTxProcessorAndAccountsWithVMs( feeAccumulator, _ := postprocess.NewFeeAccumulator() accounts := CreateInMemoryShardAccountsDB() _, _ = CreateAccount(accounts, senderAddressBytes, senderNonce, senderBalance) - vmContainer, blockchainHook := CreateVMAndBlockchainHook(accounts, nil, false, oneShardCoordinator) + vmContainer, blockchainHook := CreateVMAndBlockchainHook(accounts, nil, oneShardCoordinator) txProcessor, testScProcessor, scForwarder, _, err := CreateTxProcessorWithOneSCExecutorWithVMs( accounts, vmContainer, @@ -742,7 +739,7 @@ func CreatePreparedTxProcessorAndAccountsWithVMs( func CreatePreparedTxProcessorWithVMs(argEnableEpoch ArgEnableEpoch) (*VMTestContext, error) { feeAccumulator, _ := postprocess.NewFeeAccumulator() accounts := CreateInMemoryShardAccountsDB() - vmContainer, blockchainHook := CreateVMAndBlockchainHook(accounts, nil, false, oneShardCoordinator) + vmContainer, blockchainHook := CreateVMAndBlockchainHook(accounts, nil, oneShardCoordinator) txProcessor, scProcessor, scForwarder, economicsData, err := CreateTxProcessorWithOneSCExecutorWithVMs( accounts, vmContainer, @@ -774,13 +771,12 @@ func CreateTxProcessorArwenVMWithGasSchedule( senderAddressBytes []byte, senderBalance *big.Int, gasSchedule map[string]map[string]uint64, - outOfProcess bool, argEnableEpoch ArgEnableEpoch, ) (*VMTestContext, error) { feeAccumulator, _ := postprocess.NewFeeAccumulator() accounts := CreateInMemoryShardAccountsDB() _, _ = CreateAccount(accounts, senderAddressBytes, senderNonce, senderBalance) - vmContainer, blockchainHook := CreateVMAndBlockchainHook(accounts, gasSchedule, outOfProcess, oneShardCoordinator) + vmContainer, blockchainHook := CreateVMAndBlockchainHook(accounts, gasSchedule, oneShardCoordinator) txProcessor, scProcessor, scForwarder, _, err := CreateTxProcessorWithOneSCExecutorWithVMs( accounts, vmContainer, @@ -915,7 +911,7 @@ func GetIntValueFromSC(gasSchedule map[string]map[string]uint64, accnts state.Ac // GetVmOutput - func GetVmOutput(gasSchedule map[string]map[string]uint64, accnts state.AccountsAdapter, scAddressBytes []byte, funcName string, args ...[]byte) *vmcommon.VMOutput { - vmContainer, blockChainHook := CreateVMAndBlockchainHook(accnts, gasSchedule, false, oneShardCoordinator) + vmContainer, blockChainHook := CreateVMAndBlockchainHook(accnts, gasSchedule, oneShardCoordinator) defer func() { _ = vmContainer.Close() }() @@ -944,7 +940,7 @@ func GetVmOutput(gasSchedule map[string]map[string]uint64, accnts state.Accounts // ComputeGasLimit - func ComputeGasLimit(gasSchedule map[string]map[string]uint64, testContext *VMTestContext, tx *dataTx.Transaction) uint64 { - vmContainer, blockChainHook := CreateVMAndBlockchainHook(testContext.Accounts, gasSchedule, false, oneShardCoordinator) + vmContainer, blockChainHook := CreateVMAndBlockchainHook(testContext.Accounts, gasSchedule, oneShardCoordinator) defer func() { _ = vmContainer.Close() }() @@ -1031,7 +1027,7 @@ func CreatePreparedTxProcessorWithVMsMultiShard(selfShardID uint32, argEnableEpo if selfShardID == core.MetachainShardId { vmContainer, blockchainHook = CreateVMAndBlockchainHookMeta(accounts, nil, shardCoordinator, argEnableEpoch) } else { - vmContainer, blockchainHook = CreateVMAndBlockchainHook(accounts, nil, false, shardCoordinator) + vmContainer, blockchainHook = CreateVMAndBlockchainHook(accounts, nil, shardCoordinator) } txProcessor, scProcessor, scrForwarder, economicsData, err := CreateTxProcessorWithOneSCExecutorWithVMs( diff --git a/process/factory/shard/vmContainerFactory.go b/process/factory/shard/vmContainerFactory.go index adb022560bf..c6c427e6c92 100644 --- a/process/factory/shard/vmContainerFactory.go +++ b/process/factory/shard/vmContainerFactory.go @@ -7,8 +7,6 @@ import ( arwen12 "github.com/ElrondNetwork/arwen-wasm-vm/arwen" arwenHost12 "github.com/ElrondNetwork/arwen-wasm-vm/arwen/host" - ipcCommon12 "github.com/ElrondNetwork/arwen-wasm-vm/ipc/common" - ipcMarshaling12 "github.com/ElrondNetwork/arwen-wasm-vm/ipc/marshaling" ipcNodePart12 "github.com/ElrondNetwork/arwen-wasm-vm/ipc/nodepart" arwen13 "github.com/ElrondNetwork/arwen-wasm-vm/v1_3/arwen" arwenHost13 "github.com/ElrondNetwork/arwen-wasm-vm/v1_3/arwen/host" @@ -206,20 +204,8 @@ func (vmf *vmContainerFactory) shouldReplaceArwenInstance( ) bool { specificVersionRequired := newVersion.Version != "*" differentVersion := newVersion.Version != currentVM.GetVersion() - differentProcessSpace := vmf.shouldChangeProcessSpace(newVersion, currentVM) - return (specificVersionRequired && differentVersion) || differentProcessSpace -} - -func (vmf *vmContainerFactory) shouldChangeProcessSpace( - newVersion config.ArwenVersionByEpoch, - currentVM vmcommon.VMExecutionHandler, -) bool { - if !vmf.config.OutOfProcessEnabled { - return false - } - - return newVersion.OutOfProcessSupported != vmf.isArwenOutOfProcess(currentVM) + return specificVersionRequired && differentVersion } func (vmf *vmContainerFactory) isArwenOutOfProcess(vm vmcommon.VMExecutionHandler) bool { @@ -228,10 +214,6 @@ func (vmf *vmContainerFactory) isArwenOutOfProcess(vm vmcommon.VMExecutionHandle } func (vmf *vmContainerFactory) createArwenVM(version config.ArwenVersionByEpoch) (vmcommon.VMExecutionHandler, error) { - if version.OutOfProcessSupported && vmf.config.OutOfProcessEnabled { - return vmf.createOutOfProcessArwenVMByVersion(version) - } - return vmf.createInProcessArwenVMByVersion(version) } @@ -258,16 +240,6 @@ func (vmf *vmContainerFactory) createInProcessArwenVMByVersion(version config.Ar } } -func (vmf *vmContainerFactory) createOutOfProcessArwenVMByVersion(version config.ArwenVersionByEpoch) (vmcommon.VMExecutionHandler, error) { - logVMContainerFactory.Debug("createOutOfProcessArwenVM", "version", version) - switch version.Version { - case "v1.2": - return vmf.createOutOfProcessArwenVMV12() - default: - return nil, process.ErrArwenOutOfProcessUnsupported - } -} - func (vmf *vmContainerFactory) createInProcessArwenVMV12() (vmcommon.VMExecutionHandler, error) { hostParameters := &arwen12.VMHostParameters{ VMType: factory.ArwenVirtualMachine, @@ -298,36 +270,6 @@ func (vmf *vmContainerFactory) createInProcessArwenVMV13() (vmcommon.VMExecution return arwenHost13.NewArwenVM(vmf.blockChainHookImpl, hostParameters) } -func (vmf *vmContainerFactory) createOutOfProcessArwenVMV12() (vmcommon.VMExecutionHandler, error) { - outOfProcessConfig := vmf.config.OutOfProcessConfig - logsMarshalizer := ipcMarshaling12.ParseKind(outOfProcessConfig.LogsMarshalizer) - messagesMarshalizer := ipcMarshaling12.ParseKind(outOfProcessConfig.MessagesMarshalizer) - maxLoopTime := outOfProcessConfig.MaxLoopTime - - logger.GetLogLevelPattern() - - arwenVM, err := ipcNodePart12.NewArwenDriver( - vmf.blockChainHookImpl, - ipcCommon12.ArwenArguments{ - VMHostParameters: arwen12.VMHostParameters{ - VMType: factory.ArwenVirtualMachine, - BlockGasLimit: vmf.blockGasLimit, - GasSchedule: vmf.gasSchedule.LatestGasSchedule(), - ProtocolBuiltinFunctions: vmf.builtinFunctions, - ElrondProtectedKeyPrefix: []byte(core.ElrondProtectedKeyPrefix), - ArwenV2EnableEpoch: vmf.deployEnableEpoch, - AheadOfTimeEnableEpoch: vmf.aheadOfTimeGasUsageEnableEpoch, - DynGasLockEnableEpoch: vmf.deployEnableEpoch, - ArwenV3EnableEpoch: vmf.arwenV3EnableEpoch, - }, - LogsMarshalizer: logsMarshalizer, - MessagesMarshalizer: messagesMarshalizer, - }, - ipcNodePart12.Config{MaxLoopTime: maxLoopTime}, - ) - return arwenVM, err -} - func (vmf *vmContainerFactory) closePreviousVM(vm vmcommon.VMExecutionHandler) { vmf.blockChainHookImpl.ClearCompiledCodes() logVMContainerFactory.Debug("AOT compilation cache cleared") diff --git a/process/factory/shard/vmContainerFactory_test.go b/process/factory/shard/vmContainerFactory_test.go index f048c7da68f..8ab993c021e 100644 --- a/process/factory/shard/vmContainerFactory_test.go +++ b/process/factory/shard/vmContainerFactory_test.go @@ -177,11 +177,11 @@ func TestVmContainerFactory_ResolveArwenVersion(t *testing.T) { epochNotifier.CheckEpoch(10) require.Equal(t, "v1.2", getArwenVersion(t, container)) - require.True(t, isOutOfProcess(t, container)) + require.False(t, isOutOfProcess(t, container)) epochNotifier.CheckEpoch(11) require.Equal(t, "v1.2", getArwenVersion(t, container)) - require.True(t, isOutOfProcess(t, container)) + require.False(t, isOutOfProcess(t, container)) epochNotifier.CheckEpoch(12) require.Equal(t, "v1.3", getArwenVersion(t, container)) @@ -215,16 +215,10 @@ func getArwenVersion(t testing.TB, container process.VirtualMachinesContainer) s func makeVMConfig() config.VirtualMachineConfig { return config.VirtualMachineConfig{ - OutOfProcessEnabled: true, - OutOfProcessConfig: config.VirtualMachineOutOfProcessConfig{ - LogsMarshalizer: "json", - MessagesMarshalizer: "json", - MaxLoopTime: 1000, - }, ArwenVersions: []config.ArwenVersionByEpoch{ - {StartEpoch: 0, Version: "v1.2", OutOfProcessSupported: false}, - {StartEpoch: 10, Version: "v1.2", OutOfProcessSupported: true}, - {StartEpoch: 12, Version: "v1.3", OutOfProcessSupported: false}, + {StartEpoch: 0, Version: "v1.2"}, + {StartEpoch: 10, Version: "v1.2"}, + {StartEpoch: 12, Version: "v1.3"}, }, } }