Skip to content

Commit

Permalink
Merge pull request #6045 from multiversx/arch-config-tweaks-in-chain-…
Browse files Browse the repository at this point in the history
…simulator

Applied custom arch config tweaks on the chain simulator
  • Loading branch information
iulianpascalau authored Mar 15, 2024
2 parents 3a34a4a + 6d81fe8 commit 515aa50
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions node/chainSimulator/configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/multiversx/mx-chain-go/common/factory"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/genesis/data"
"github.com/multiversx/mx-chain-go/node"
"github.com/multiversx/mx-chain-go/node/chainSimulator/dtos"
"github.com/multiversx/mx-chain-go/sharding"
"github.com/multiversx/mx-chain-go/storage/storageunit"
Expand Down Expand Up @@ -125,6 +126,8 @@ func CreateChainSimulatorConfigs(args ArgsChainSimulatorConfigs) (*ArgsConfigsSi
return nil, err
}

node.ApplyArchCustomConfigs(configs)

if args.AlterConfigsFunction != nil {
args.AlterConfigsFunction(configs)
}
Expand Down
7 changes: 4 additions & 3 deletions node/customConfigsArm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import (
"github.com/multiversx/mx-chain-go/config"
)

func applyArchCustomConfigs(configs *config.Configs) {
log.Debug("applyArchCustomConfigs", "architecture", runtime.GOARCH)
// ApplyArchCustomConfigs will apply configuration tweaks based on the architecture the node is running on
func ApplyArchCustomConfigs(configs *config.Configs) {
log.Debug("ApplyArchCustomConfigs", "architecture", runtime.GOARCH)

firstSupportedWasmer2VMVersion := "v1.5"
log.Debug("applyArchCustomConfigs - hardcoding the initial VM to " + firstSupportedWasmer2VMVersion)
log.Debug("ApplyArchCustomConfigs - hardcoding the initial VM to " + firstSupportedWasmer2VMVersion)
configs.GeneralConfig.VirtualMachine.Execution.WasmVMVersions = []config.WasmVMVersionByEpoch{
{
StartEpoch: 0,
Expand Down
4 changes: 2 additions & 2 deletions node/customConfigsArm64_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestApplyArchCustomConfigs(t *testing.T) {
expectedVMConfig.Execution.WasmVMVersions = expectedVMWasmVersionsConfig
expectedVMConfig.Querying.WasmVMVersions = expectedVMWasmVersionsConfig

applyArchCustomConfigs(providedConfigs)
ApplyArchCustomConfigs(providedConfigs)

assert.Equal(t, expectedVMConfig, providedConfigs.GeneralConfig.VirtualMachine)
})
Expand All @@ -78,7 +78,7 @@ func TestApplyArchCustomConfigs(t *testing.T) {
expectedVMConfig.Execution.WasmVMVersions = expectedVMWasmVersionsConfig
expectedVMConfig.Querying.WasmVMVersions = expectedVMWasmVersionsConfig

applyArchCustomConfigs(providedConfigs)
ApplyArchCustomConfigs(providedConfigs)

expectedConfig := &config.Configs{
GeneralConfig: &config.Config{
Expand Down
5 changes: 3 additions & 2 deletions node/customConfigsDefault.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/multiversx/mx-chain-go/config"
)

func applyArchCustomConfigs(_ *config.Configs) {
log.Debug("applyArchCustomConfigs - nothing to do", "architecture", runtime.GOARCH)
// ApplyArchCustomConfigs will apply configuration tweaks based on the architecture the node is running on
func ApplyArchCustomConfigs(_ *config.Configs) {
log.Debug("ApplyArchCustomConfigs - nothing to do", "architecture", runtime.GOARCH)
}
4 changes: 2 additions & 2 deletions node/customConfigsDefault_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestApplyArchCustomConfigs(t *testing.T) {
},
}

applyArchCustomConfigs(providedConfigs)
ApplyArchCustomConfigs(providedConfigs)

assert.Equal(t, executionVMConfig, providedConfigs.GeneralConfig.VirtualMachine.Execution)
assert.Equal(t, queryVMConfig, providedConfigs.GeneralConfig.VirtualMachine.Querying)
Expand All @@ -67,7 +67,7 @@ func TestApplyArchCustomConfigs(t *testing.T) {
emptyConfigs := &config.Configs{
GeneralConfig: &config.Config{},
}
applyArchCustomConfigs(providedConfigs)
ApplyArchCustomConfigs(providedConfigs)

assert.Equal(t, emptyConfigs, providedConfigs)
})
Expand Down
2 changes: 1 addition & 1 deletion node/nodeRunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (nr *nodeRunner) executeOneComponentCreationCycle(
goRoutinesNumberStart := runtime.NumGoroutine()

log.Debug("applying custom configs based on the current architecture")
applyArchCustomConfigs(nr.configs)
ApplyArchCustomConfigs(nr.configs)

configs := nr.configs
flagsConfig := configs.FlagsConfig
Expand Down

0 comments on commit 515aa50

Please sign in to comment.