mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-07 23:10:32 +00:00
core: add VM into interop context
This commit is contained in:
parent
b0f0dc5352
commit
995053f2eb
20 changed files with 384 additions and 382 deletions
|
@ -159,10 +159,9 @@ func TestNativeContract_InvokeInternal(t *testing.T) {
|
|||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
v := vm.New()
|
||||
v.GasLimit = -1
|
||||
ic := chain.newInteropContext(trigger.Application,
|
||||
dao.NewSimple(storage.NewMemoryStore(), netmode.UnitTestNet), nil, nil)
|
||||
v := ic.SpawnVM()
|
||||
|
||||
t.Run("fail, bad current script hash", func(t *testing.T) {
|
||||
v.LoadScriptWithHash([]byte{1}, util.Uint160{1, 2, 3}, smartcontract.All)
|
||||
|
@ -171,7 +170,7 @@ func TestNativeContract_InvokeInternal(t *testing.T) {
|
|||
v.Estack().PushVal(tn.Metadata().Name)
|
||||
|
||||
// it's prohibited to call natives directly
|
||||
require.Error(t, native.Call(ic, v))
|
||||
require.Error(t, native.Call(ic))
|
||||
})
|
||||
|
||||
t.Run("success", func(t *testing.T) {
|
||||
|
@ -180,7 +179,7 @@ func TestNativeContract_InvokeInternal(t *testing.T) {
|
|||
v.Estack().PushVal("sum")
|
||||
v.Estack().PushVal(tn.Metadata().Name)
|
||||
|
||||
require.NoError(t, native.Call(ic, v))
|
||||
require.NoError(t, native.Call(ic))
|
||||
|
||||
value := v.Estack().Pop().BigInt()
|
||||
require.Equal(t, int64(42), value.Int64())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue