Skip to content

Commit

Permalink
Merge pull request #844 from multiversx/lcswillems-patch-2
Browse files Browse the repository at this point in the history
Add timeout parameter to ScenarioVMHostBuilder
  • Loading branch information
sasurobert authored Jun 13, 2024
2 parents 48f94ef + 5fbcb08 commit 5f1cbb8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scenario/vmBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,22 @@ var _ scenexec.VMBuilder = (*ScenarioVMHostBuilder)(nil)
// DefaultVMType is the VM type argument we use in tests.
var DefaultVMType = []byte{5, 0}

// DefaultTimeOutForSCExecutionInMilliseconds is the mainnet timeout.
var DefaultTimeOutForSCExecutionInMilliseconds uint32 = 10000

// VMTestExecutor parses, interprets and executes both .test.json tests and .scen.json scenarios with VM.
type ScenarioVMHostBuilder struct {
OverrideVMExecutor executor.ExecutorAbstractFactory
VMType []byte
OverrideVMExecutor executor.ExecutorAbstractFactory
VMType []byte
TimeOutForSCExecutionInMilliseconds uint32
}

// NewScenarioVMHostBuilder creates a default ScenarioVMHostBuilder.
func NewScenarioVMHostBuilder() *ScenarioVMHostBuilder {
return &ScenarioVMHostBuilder{
OverrideVMExecutor: nil,
VMType: DefaultVMType,
OverrideVMExecutor: nil,
VMType: DefaultVMType,
TimeOutForSCExecutionInMilliseconds: DefaultTimeOutForSCExecutionInMilliseconds,
}
}

Expand Down Expand Up @@ -90,6 +95,7 @@ func (svb *ScenarioVMHostBuilder) NewVM(
WasmerSIGSEGVPassthrough: false,
Hasher: worldmock.DefaultHasher,
MapOpcodeAddressIsAllowed: map[string]map[string]struct{}{},
TimeOutForSCExecutionInMilliseconds: svb.TimeOutForSCExecutionInMilliseconds,
})

}
Expand Down

0 comments on commit 5f1cbb8

Please sign in to comment.