mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 01:41:48 +00:00
vm: move InteropNameToID to emit package
This commit is contained in:
parent
93d2a3e031
commit
bfbbef952a
9 changed files with 40 additions and 34 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -54,7 +55,7 @@ func getPanicSource(need bool, message string) string {
|
|||
}
|
||||
|
||||
func logGetter(logs *[]string) vm.InteropGetterFunc {
|
||||
logID := vm.InteropNameToID([]byte("Neo.Runtime.Log"))
|
||||
logID := emit.InteropNameToID([]byte("Neo.Runtime.Log"))
|
||||
return func(id uint32) *vm.InteropFuncPrice {
|
||||
if id != logID {
|
||||
return nil
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -18,7 +19,7 @@ func TestVerifyGood(t *testing.T) {
|
|||
src := getVerifyProg(pub, sig, msg)
|
||||
|
||||
v, p := vmAndCompileInterop(t, src)
|
||||
p.interops[vm.InteropNameToID([]byte("Neo.Crypto.ECDsaVerify"))] = func(v *vm.VM) error {
|
||||
p.interops[emit.InteropNameToID([]byte("Neo.Crypto.ECDsaVerify"))] = func(v *vm.VM) error {
|
||||
assert.Equal(t, msg, v.Estack().Pop().Bytes())
|
||||
assert.Equal(t, pub, v.Estack().Pop().Bytes())
|
||||
assert.Equal(t, sig, v.Estack().Pop().Bytes())
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neo-go/pkg/compiler"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/emit"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -80,10 +81,10 @@ func newStoragePlugin() *storagePlugin {
|
|||
mem: make(map[string][]byte),
|
||||
interops: make(map[uint32]vm.InteropFunc),
|
||||
}
|
||||
s.interops[vm.InteropNameToID([]byte("Neo.Storage.Get"))] = s.Get
|
||||
s.interops[vm.InteropNameToID([]byte("Neo.Storage.Put"))] = s.Put
|
||||
s.interops[vm.InteropNameToID([]byte("Neo.Storage.GetContext"))] = s.GetContext
|
||||
s.interops[vm.InteropNameToID([]byte("Neo.Runtime.Notify"))] = s.Notify
|
||||
s.interops[emit.InteropNameToID([]byte("Neo.Storage.Get"))] = s.Get
|
||||
s.interops[emit.InteropNameToID([]byte("Neo.Storage.Put"))] = s.Put
|
||||
s.interops[emit.InteropNameToID([]byte("Neo.Storage.GetContext"))] = s.GetContext
|
||||
s.interops[emit.InteropNameToID([]byte("Neo.Runtime.Notify"))] = s.Notify
|
||||
return s
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue