[#770] ir/container: Support notary Put

Implement `NotaryContractProcessor` by IR
container processor. Add support for notary
`put` container operation. Do not parse `put`
non-notary notifications in notary enabled
environment.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-08-25 14:35:17 +03:00 committed by Pavel Karpy
parent 9921358f09
commit 13f1273e82
3 changed files with 60 additions and 9 deletions

View file

@ -3,6 +3,7 @@ package container
import (
"fmt"
"github.com/nspcc-dev/neo-go/pkg/network/payload"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
@ -14,6 +15,10 @@ type Put struct {
signature []byte
publicKey []byte
token []byte
// For notary notifications only.
// Contains raw transactions of notary request.
notaryRequest *payload.P2PNotaryRequest
}
const expectedItemNumPut = 4
@ -36,6 +41,12 @@ func (p Put) SessionToken() []byte {
return p.token
}
// NotaryRequest returns raw notary request if notification
// was received via notary service. Otherwise, returns nil.
func (p Put) NotaryRequest() *payload.P2PNotaryRequest {
return p.notaryRequest
}
// ParsePut from notification into container event structure.
func ParsePut(params []stackitem.Item) (event.Event, error) {
var (