state: store NEF instead of script for contract

NEFs for native contracts are set statically, thus
field values are taken from the reference implementation.
This commit is contained in:
Evgeniy Stratonikov 2021-01-13 15:34:10 +03:00
parent 11191c0a08
commit 0b26b46234
17 changed files with 138 additions and 72 deletions

View file

@ -18,6 +18,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
cinterop "github.com/nspcc-dev/neo-go/pkg/interop"
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/nef"
"github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm"
@ -162,15 +163,19 @@ func TestAppCall(t *testing.T) {
ih := hash.Hash160(inner)
var contractGetter = func(_ dao.DAO, h util.Uint160) (*state.Contract, error) {
if h.Equals(ih) {
innerNef, err := nef.NewFile(inner)
require.NoError(t, err)
return &state.Contract{
Hash: ih,
Script: inner,
NEF: *innerNef,
Manifest: *m,
}, nil
} else if h.Equals(barH) {
barNef, err := nef.NewFile(barCtr)
require.NoError(t, err)
return &state.Contract{
Hash: barH,
Script: barCtr,
NEF: *barNef,
Manifest: *mBar,
}, nil
}