diff --git a/pkg/morph/client/netmap/add_peer.go b/pkg/morph/client/netmap/add_peer.go index 42117853..b5736a9d 100644 --- a/pkg/morph/client/netmap/add_peer.go +++ b/pkg/morph/client/netmap/add_peer.go @@ -22,22 +22,31 @@ func (a *AddPeerPrm) SetNodeInfo(nodeInfo *netmap.NodeInfo) { // AddPeer registers peer in NeoFS network through // Netmap contract call. func (c *Client) AddPeer(p AddPeerPrm) error { + var method = addPeerMethod + + if c.client.WithNotary() && c.client.IsAlpha() { + // In notary environments Alphabet must calls AddPeerIR method instead of AddPeer. + // It differs from AddPeer only by name, so we can do this in the same form. + // See https://github.com/nspcc-dev/neofs-contract/issues/154. + method += "IR" + } + if p.nodeInfo == nil { - return fmt.Errorf("nil node info (%s)", addPeerMethod) + return fmt.Errorf("nil node info (%s)", method) } rawNodeInfo, err := p.nodeInfo.Marshal() if err != nil { - return fmt.Errorf("can't marshal node info (%s): %w", addPeerMethod, err) + return fmt.Errorf("can't marshal node info (%s): %w", method, err) } prm := client.InvokePrm{} - prm.SetMethod(addPeerMethod) + prm.SetMethod(method) prm.SetArgs(rawNodeInfo) prm.InvokePrmOptional = p.InvokePrmOptional if err := c.client.Invoke(prm); err != nil { - return fmt.Errorf("could not invoke method (%s): %w", addPeerMethod, err) + return fmt.Errorf("could not invoke method (%s): %w", method, err) } return nil } diff --git a/pkg/morph/client/netmap/update_state.go b/pkg/morph/client/netmap/update_state.go index 695478f1..9bd83f7f 100644 --- a/pkg/morph/client/netmap/update_state.go +++ b/pkg/morph/client/netmap/update_state.go @@ -27,8 +27,17 @@ func (u *UpdatePeerPrm) SetState(state netmap.NodeState) { // UpdatePeerState changes peer status through Netmap contract call. func (c *Client) UpdatePeerState(p UpdatePeerPrm) error { + method := updateStateMethod + + if c.client.WithNotary() && c.client.IsAlpha() { + // In notary environments Alphabet must calls UpdateStateIR method instead of UpdateState. + // It differs from UpdateState only by name, so we can do this in the same form. + // See https://github.com/nspcc-dev/neofs-contract/issues/225. + method += "IR" + } + prm := client.InvokePrm{} - prm.SetMethod(updateStateMethod) + prm.SetMethod(method) prm.SetArgs(int64(p.state.ToV2()), p.key) prm.InvokePrmOptional = p.InvokePrmOptional