forked from TrueCloudLab/frostfs-node
[#1538] morph/client: Remove TryNotary() option from side-chain contracts
The notary is always enabled and this option does always work. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
5c3b2d95ba
commit
6a51086030
11 changed files with 9 additions and 40 deletions
|
@ -135,7 +135,7 @@ func createContainerInfoProvider(cli *client.Client) (container.InfoProvider, er
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("resolve container contract hash: %w", err)
|
return nil, fmt.Errorf("resolve container contract hash: %w", err)
|
||||||
}
|
}
|
||||||
cc, err := morphcontainer.NewFromMorph(cli, sh, 0, morphcontainer.TryNotary())
|
cc, err := morphcontainer.NewFromMorph(cli, sh, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("create morph container client: %w", err)
|
return nil, fmt.Errorf("create morph container client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1464,7 +1464,7 @@ func (c *cfg) createTombstoneSource() *tombstone.ExpirationChecker {
|
||||||
func (c *cfg) createContainerInfoProvider(ctx context.Context) container.InfoProvider {
|
func (c *cfg) createContainerInfoProvider(ctx context.Context) container.InfoProvider {
|
||||||
return container.NewInfoProvider(func() (container.Source, error) {
|
return container.NewInfoProvider(func() (container.Source, error) {
|
||||||
c.initMorphComponents(ctx)
|
c.initMorphComponents(ctx)
|
||||||
cc, err := containerClient.NewFromMorph(c.cfgMorph.client, c.cfgContainer.scriptHash, 0, containerClient.TryNotary())
|
cc, err := containerClient.NewFromMorph(c.cfgMorph.client, c.cfgContainer.scriptHash, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import (
|
||||||
func initContainerService(_ context.Context, c *cfg) {
|
func initContainerService(_ context.Context, c *cfg) {
|
||||||
// container wrapper that tries to invoke notary
|
// container wrapper that tries to invoke notary
|
||||||
// requests if chain is configured so
|
// requests if chain is configured so
|
||||||
wrap, err := cntClient.NewFromMorph(c.cfgMorph.client, c.cfgContainer.scriptHash, 0, cntClient.TryNotary())
|
wrap, err := cntClient.NewFromMorph(c.cfgMorph.client, c.cfgContainer.scriptHash, 0)
|
||||||
fatalOnErr(err)
|
fatalOnErr(err)
|
||||||
|
|
||||||
c.shared.cnrClient = wrap
|
c.shared.cnrClient = wrap
|
||||||
|
|
|
@ -44,7 +44,7 @@ func (c *cfg) initMorphComponents(ctx context.Context) {
|
||||||
|
|
||||||
c.log.Info(ctx, logs.FrostFSNodeNotarySupport)
|
c.log.Info(ctx, logs.FrostFSNodeNotarySupport)
|
||||||
|
|
||||||
wrap, err := nmClient.NewFromMorph(c.cfgMorph.client, c.cfgNetmap.scriptHash, 0, nmClient.TryNotary())
|
wrap, err := nmClient.NewFromMorph(c.cfgMorph.client, c.cfgNetmap.scriptHash, 0)
|
||||||
fatalOnErr(err)
|
fatalOnErr(err)
|
||||||
|
|
||||||
var netmapSource netmap.Source
|
var netmapSource netmap.Source
|
||||||
|
|
|
@ -380,7 +380,6 @@ func (s *Server) initClientsFromMorph() (*serverMorphClients, error) {
|
||||||
// form morph container client's options
|
// form morph container client's options
|
||||||
morphCnrOpts := make([]container.Option, 0, 3)
|
morphCnrOpts := make([]container.Option, 0, 3)
|
||||||
morphCnrOpts = append(morphCnrOpts,
|
morphCnrOpts = append(morphCnrOpts,
|
||||||
container.TryNotary(),
|
|
||||||
container.AsAlphabet(),
|
container.AsAlphabet(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -390,12 +389,12 @@ func (s *Server) initClientsFromMorph() (*serverMorphClients, error) {
|
||||||
}
|
}
|
||||||
s.containerClient = result.CnrClient
|
s.containerClient = result.CnrClient
|
||||||
|
|
||||||
s.netmapClient, err = nmClient.NewFromMorph(s.morphClient, s.contracts.netmap, fee, nmClient.TryNotary(), nmClient.AsAlphabet())
|
s.netmapClient, err = nmClient.NewFromMorph(s.morphClient, s.contracts.netmap, fee, nmClient.AsAlphabet())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
s.balanceClient, err = balanceClient.NewFromMorph(s.morphClient, s.contracts.balance, fee, balanceClient.TryNotary(), balanceClient.AsAlphabet())
|
s.balanceClient, err = balanceClient.NewFromMorph(s.morphClient, s.contracts.balance, fee, balanceClient.AsAlphabet())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,15 +54,7 @@ type Option func(*opts)
|
||||||
type opts []client.StaticClientOption
|
type opts []client.StaticClientOption
|
||||||
|
|
||||||
func defaultOpts() *opts {
|
func defaultOpts() *opts {
|
||||||
return new(opts)
|
return &opts{client.TryNotary()}
|
||||||
}
|
|
||||||
|
|
||||||
// TryNotary returns option to enable
|
|
||||||
// notary invocation tries.
|
|
||||||
func TryNotary() Option {
|
|
||||||
return func(o *opts) {
|
|
||||||
*o = append(*o, client.TryNotary())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AsAlphabet returns option to sign main TX
|
// AsAlphabet returns option to sign main TX
|
||||||
|
|
|
@ -21,8 +21,6 @@ type TransferPrm struct {
|
||||||
|
|
||||||
// TransferX transfers p.Amount of GASe-12 from p.From to p.To
|
// TransferX transfers p.Amount of GASe-12 from p.From to p.To
|
||||||
// with details p.Details through direct smart contract call.
|
// with details p.Details through direct smart contract call.
|
||||||
//
|
|
||||||
// If TryNotary is provided, calls notary contract.
|
|
||||||
func (c *Client) TransferX(ctx context.Context, p TransferPrm) error {
|
func (c *Client) TransferX(ctx context.Context, p TransferPrm) error {
|
||||||
from, err := p.From.ScriptHash()
|
from, err := p.From.ScriptHash()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -73,15 +73,7 @@ type opts struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultOpts() *opts {
|
func defaultOpts() *opts {
|
||||||
return new(opts)
|
return &opts{staticOpts: []client.StaticClientOption{client.TryNotary()}}
|
||||||
}
|
|
||||||
|
|
||||||
// TryNotary returns option to enable
|
|
||||||
// notary invocation tries.
|
|
||||||
func TryNotary() Option {
|
|
||||||
return func(o *opts) {
|
|
||||||
o.staticOpts = append(o.staticOpts, client.TryNotary())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AsAlphabet returns option to sign main TX
|
// AsAlphabet returns option to sign main TX
|
||||||
|
|
|
@ -66,8 +66,6 @@ func (d *DeletePrm) SetKey(key []byte) {
|
||||||
//
|
//
|
||||||
// Returns valid until block and any error encountered that caused
|
// Returns valid until block and any error encountered that caused
|
||||||
// the removal to interrupt.
|
// the removal to interrupt.
|
||||||
//
|
|
||||||
// If TryNotary is provided, calls notary contract.
|
|
||||||
func (c *Client) Delete(ctx context.Context, p DeletePrm) (uint32, error) {
|
func (c *Client) Delete(ctx context.Context, p DeletePrm) (uint32, error) {
|
||||||
if len(p.signature) == 0 && !p.IsControl() {
|
if len(p.signature) == 0 && !p.IsControl() {
|
||||||
return 0, errNilArgument
|
return 0, errNilArgument
|
||||||
|
|
|
@ -94,8 +94,6 @@ func (p *PutPrm) SetZone(zone string) {
|
||||||
//
|
//
|
||||||
// Returns calculated container identifier and any error
|
// Returns calculated container identifier and any error
|
||||||
// encountered that caused the saving to interrupt.
|
// encountered that caused the saving to interrupt.
|
||||||
//
|
|
||||||
// If TryNotary is provided, calls notary contract.
|
|
||||||
func (c *Client) Put(ctx context.Context, p PutPrm) error {
|
func (c *Client) Put(ctx context.Context, p PutPrm) error {
|
||||||
if len(p.sig) == 0 || len(p.key) == 0 {
|
if len(p.sig) == 0 || len(p.key) == 0 {
|
||||||
return errNilArgument
|
return errNilArgument
|
||||||
|
|
|
@ -65,15 +65,7 @@ type Option func(*opts)
|
||||||
type opts []client.StaticClientOption
|
type opts []client.StaticClientOption
|
||||||
|
|
||||||
func defaultOpts() *opts {
|
func defaultOpts() *opts {
|
||||||
return new(opts)
|
return &opts{client.TryNotary()}
|
||||||
}
|
|
||||||
|
|
||||||
// TryNotary returns option to enable
|
|
||||||
// notary invocation tries.
|
|
||||||
func TryNotary() Option {
|
|
||||||
return func(o *opts) {
|
|
||||||
*o = append(*o, client.TryNotary())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AsAlphabet returns option to sign main TX
|
// AsAlphabet returns option to sign main TX
|
||||||
|
|
Loading…
Reference in a new issue