Skip to content

Commit

Permalink
fix/Container estimations contract call (#2467)
Browse files Browse the repository at this point in the history
  • Loading branch information
carpawell authored Aug 4, 2023
2 parents cd628f7 + 9eb49fd commit b657072
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 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
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (c *announceContext) announce() {
return
}

c.log.Debug("trust announcement successfully finished")
c.log.Debug("load announcement successfully finished")
}

func (c *Controller) acquireAnnouncement(prm StartPrm) *announceContext {
Expand Down

0 comments on commit b657072

Please sign in to comment.