From 4f5f832137d544f628337588573059ba72ccdcce Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 19 Apr 2023 17:11:32 +0300 Subject: [PATCH] [#268] notary_preparator: Actualize notary requests parsing After https://github.com/nspcc-dev/neo-go/commit/75d7891ca183f0e24b8fb13d21b7076a95ddebbd `neo-go` does claim that an empty invocation script is the only way to fill missing signature for unsigned notary requests. The new notary actor does it that way and, therefore, breaks notary request parsing by the Alphabet because of skipping any request that is not filled with a dummy (64 zeros) invocation script. Support both way. The "Dummy" approach will be dropped later. Signed-off-by: Pavel Karpy --- CHANGELOG.md | 1 + pkg/morph/event/notary_preparator.go | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 738fb38e..954bad84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Changelog for FrostFS Node - Take network settings into account during netmap contract update (#100) - Read config files from dir even if config file not provided via `--config` for node (#238) - Expired by more than 1 epoch objects could be returned (#262) +- Notary requests parsing according to `neo-go`'s updates (#268) ### Removed ### Updated diff --git a/pkg/morph/event/notary_preparator.go b/pkg/morph/event/notary_preparator.go index 3d499fec..f7b10d90 100644 --- a/pkg/morph/event/notary_preparator.go +++ b/pkg/morph/event/notary_preparator.go @@ -185,13 +185,15 @@ func (p Preparator) validateNotaryRequest(nr *payload.P2PNotaryRequest) error { } invokerWitness := ln == 4 + multiInvScript := nr.MainTransaction.Scripts[1].InvocationScript + // alphabet node should handle only notary requests - // that have been sent unsigned(by storage nodes) => - // such main TXs should have dummy scripts as an - // invocation script + // that have been sent unsigned (by storage nodes) => + // such main TXs should have either a dummy or an + // empty script as an invocation script // // this check prevents notary flow recursion - if !bytes.Equal(nr.MainTransaction.Scripts[1].InvocationScript, p.dummyInvocationScript) { + if len(multiInvScript) > 0 && !bytes.Equal(nr.MainTransaction.Scripts[1].InvocationScript, p.dummyInvocationScript) { return ErrTXAlreadyHandled }