Skip to content

Commit

Permalink
Merge pull request #3151 from ElrondNetwork/remove-arwen-oop
Browse files Browse the repository at this point in the history
Removed Arwen OOP option
  • Loading branch information
iulianpascalau authored Jun 8, 2021
2 parents 4bc1f0d + 5500605 commit 9aaa53b
Show file tree
Hide file tree
Showing 19 changed files with 63 additions and 189 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion cmd/assessment/benchmarks/erc20Benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func (eb *erc20Benchmark) Run() (time.Duration, error) {
createTestGasMap(),
eb.scFilename,
eb.function,
false,
)
if err != nil {
return 0, err
Expand Down
43 changes: 17 additions & 26 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion cmd/node/factory/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
13 changes: 6 additions & 7 deletions cmd/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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()),
Expand Down
16 changes: 3 additions & 13 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
30 changes: 7 additions & 23 deletions config/tomlConfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -103,7 +97,6 @@ func TestTomlParser(t *testing.T) {
},
},
}
cfgExpected.VirtualMachine.Querying.OutOfProcessEnabled = true
testString := `
[MiniBlocksStorage]
[MiniBlocksStorage.Cache]
Expand Down Expand Up @@ -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{}
Expand Down
4 changes: 1 addition & 3 deletions genesis/process/genesisBlockCreator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand Down
4 changes: 1 addition & 3 deletions integrationTests/multiShard/hardFork/hardFork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
8 changes: 2 additions & 6 deletions integrationTests/testInitializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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{},
Expand Down
8 changes: 2 additions & 6 deletions integrationTests/testProcessorNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 4 additions & 7 deletions integrationTests/vm/arwen/arwenVM/arwenVM_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -367,7 +367,6 @@ func TestDeployERC20WithNotEnoughGasShouldReturnOutOfGas(t *testing.T) {
ownerAddressBytes,
ownerBalance,
gasSchedule,
false,
vm.ArgEnableEpoch{},
)
require.Nil(t, err)
Expand Down Expand Up @@ -407,7 +406,6 @@ func TestJournalizingAndTimeToProcessChange(t *testing.T) {
ownerAddressBytes,
ownerBalance,
nil,
false,
vm.ArgEnableEpoch{},
)
require.Nil(t, err)
Expand Down Expand Up @@ -614,7 +612,6 @@ func TestAndCatchTrieError(t *testing.T) {
ownerAddressBytes,
ownerBalance,
nil,
false,
vm.ArgEnableEpoch{},
)
require.Nil(t, err)
Expand Down
2 changes: 1 addition & 1 deletion integrationTests/vm/arwen/arwenVM/gasSchedule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 0 additions & 3 deletions integrationTests/vm/arwen/arwenVM/testRunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func RunTest(
ownerAddressBytes,
ownerBalance,
gasSchedule,
false,
vm.ArgEnableEpoch{},
)
if err != nil {
Expand Down Expand Up @@ -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)
Expand All @@ -140,7 +138,6 @@ func DeployAndExecuteERC20WithBigInt(
ownerAddressBytes,
ownerBalance,
gasSchedule,
outOfProcess,
vm.ArgEnableEpoch{},
)
if err != nil {
Expand Down
Loading

0 comments on commit 9aaa53b

Please sign in to comment.