From 17059b34eaa2267752ec0f31de71a97dbd463be6 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 31 Aug 2022 14:09:55 +0300 Subject: [PATCH] [#1743] morph: Fix non-notary calls Some methods add "IR" suffix to its names in notary enabled envs because of contract logic. It was broken due to incorrect notary state reading (tryNotary != notary is enabled). Signed-off-by: Pavel Karpy --- CHANGELOG.md | 1 + pkg/morph/client/notary.go | 6 ++++++ pkg/morph/client/static.go | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f00729e..ad514fa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Changelog for NeoFS Node ### Fixed - Panic on write-cache's `Delete` operation (#1664) - Payload duplication in `neofs-cli storagegroup put` (#1706) +- Contract calls in notary disabled environments (#1743) ### Removed diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index 1671800c..26d57171 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -116,6 +116,12 @@ func (c *Client) EnableNotarySupport(opts ...NotaryOption) error { return nil } +// IsNotaryEnabled returns true if EnableNotarySupport has been successfully +// called before. +func (c *Client) IsNotaryEnabled() bool { + return c.notary != nil +} + // ProbeNotary checks if native `Notary` contract is presented on chain. func (c *Client) ProbeNotary() (res bool) { c.switchLock.RLock() diff --git a/pkg/morph/client/static.go b/pkg/morph/client/static.go index 5787b0a6..207b97d0 100644 --- a/pkg/morph/client/static.go +++ b/pkg/morph/client/static.go @@ -34,7 +34,7 @@ type staticOpts struct { // // See also TryNotary. func (s *StaticClient) WithNotary() bool { - return s.tryNotary + return s.client.IsNotaryEnabled() } // IsAlpha returns Alphabet status of the client.