native: implement designate contract history retention

Follow neo-project/neo#2007. Fix getDesignatedByRole price along the way.
This commit is contained in:
Roman Khimov 2020-11-05 19:34:48 +03:00
parent 7121686571
commit 9e781bff47
6 changed files with 174 additions and 49 deletions

View file

@ -6,6 +6,7 @@ import (
"testing"
"github.com/nspcc-dev/neo-go/pkg/config/netmode"
"github.com/nspcc-dev/neo-go/pkg/core/block"
"github.com/nspcc-dev/neo-go/pkg/core/interop/interopnames"
"github.com/nspcc-dev/neo-go/pkg/core/native"
"github.com/nspcc-dev/neo-go/pkg/core/state"
@ -136,8 +137,10 @@ func TestOracle_Request(t *testing.T) {
pub := priv.PublicKey()
tx := transaction.New(netmode.UnitTestNet, []byte{}, 0)
bl := block.New(netmode.UnitTestNet)
bl.Index = bc.BlockHeight() + 1
setSigner(tx, testchain.CommitteeScriptHash())
ic := bc.newInteropContext(trigger.Application, bc.dao, nil, tx)
ic := bc.newInteropContext(trigger.Application, bc.dao, bl, tx)
ic.SpawnVM()
ic.VM.LoadScript([]byte{byte(opcode.RET)})
err = bc.contracts.Designate.DesignateAsRole(ic, native.RoleOracle, keys.PublicKeys{pub})