Skip to content

Commit

Permalink
morph: Fix estimations announcements
Browse files Browse the repository at this point in the history
Some contract methods still require regular (non-notary) calls.

Signed-off-by: Pavel Karpy <[email protected]>
  • Loading branch information
carpawell committed Aug 4, 2023
1 parent aeab4ca commit 9eb49fd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cmd/neofs-node/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ const (
)

func initContainerService(c *cfg) {
// container wrapper that tries to invoke notary
// requests if chain is configured so
// container wrapper that invokes notary
// requests with the (empty) Alphabet signature
wrap, err := cntClient.NewFromMorph(c.cfgMorph.client, c.cfgContainer.scriptHash, 0)
fatalOnErr(err)

c.shared.cnrClient = wrap

// container wrapper that always sends non-notary
// requests
wrapperNoNotary, err := cntClient.NewFromMorph(c.cfgMorph.client, c.cfgContainer.scriptHash, 0)
wrapperNoNotary, err := cntClient.NewFromMorph(c.cfgMorph.client, c.cfgContainer.scriptHash, 0, cntClient.DisableNotarySigning())
fatalOnErr(err)

cnrSrc := cntClient.AsContainerSource(wrap)
Expand Down
21 changes: 18 additions & 3 deletions pkg/morph/client/container/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ func NewFromMorph(cli *client.Client, contract util.Uint160, fee fixedn.Fixed8,
o.staticOpts = append(o.staticOpts, client.WithCustomFee(putNamedMethod, o.feePutNamed))
}

if !o.disableNotarySigning {
o.staticOpts = append(o.staticOpts, client.TryNotary())
}

sc, err := client.NewStatic(cli, contract, fee, o.staticOpts...)
if err != nil {
return nil, fmt.Errorf("can't create container static client: %w", err)
Expand All @@ -85,13 +89,24 @@ type opts struct {
feePutNamedSet bool
feePutNamed fixedn.Fixed8

disableNotarySigning bool

staticOpts []client.StaticClientOption
}

func defaultOpts() *opts {
var o = new(opts)
o.staticOpts = append(o.staticOpts, client.TryNotary())
return o
return new(opts)
}

// DisableNotarySigning returns option to disable
// notary request signing. With that option, every
// call will be created, signed with provided key
// (a single regular sign) and sent to the side
// chain.
func DisableNotarySigning() Option {
return func(o *opts) {
o.disableNotarySigning = true
}
}

// AsAlphabet returns option to sign main TX
Expand Down

0 comments on commit 9eb49fd

Please sign in to comment.