From 752efc6f8c3c879dcb0158960978f37cfa895551 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 2 Jun 2021 19:29:19 +0300 Subject: [PATCH] [#584] pkg/innerring: Delete using deprecated methods Signed-off-by: Pavel Karpy --- pkg/innerring/blocktimer.go | 2 -- pkg/innerring/innerring.go | 4 ---- pkg/innerring/processors/netmap/processor.go | 3 --- .../processors/reputation/processor.go | 4 ---- pkg/innerring/settlement.go | 2 -- pkg/morph/client/balance/transfer.go | 22 ++--------------- pkg/morph/client/balance/wrapper/transfer.go | 10 -------- pkg/morph/client/container/estimations.go | 18 -------------- .../client/container/wrapper/estimations.go | 24 ------------------- pkg/morph/client/reputation/put.go | 19 --------------- pkg/morph/client/reputation/wrapper/put.go | 11 --------- pkg/morph/client/static.go | 17 ------------- 12 files changed, 2 insertions(+), 134 deletions(-) diff --git a/pkg/innerring/blocktimer.go b/pkg/innerring/blocktimer.go index 2570f3eeff..c0abd6cce3 100644 --- a/pkg/innerring/blocktimer.go +++ b/pkg/innerring/blocktimer.go @@ -28,8 +28,6 @@ type ( epochTimerArgs struct { l *zap.Logger - notaryDisabled bool - nm *netmap.Processor // to handle new epoch tick cnrWrapper *container.Wrapper // to invoke stop container estimation diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index c2a82f7058..01c985e61f 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -450,7 +450,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error nmSrc: nmClient, clientCache: clientCache, balanceClient: balClient, - notaryDisabled: server.sideNotaryConfig.disabled, } auditCalcDeps := &auditSettlementDeps{ @@ -541,7 +540,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error ), AlphabetSyncHandler: alphaSync, NodeValidator: locodeValidator, - NotaryDisabled: server.sideNotaryConfig.disabled, FeeProvider: server.feeConfig, }) if err != nil { @@ -645,7 +643,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error reputationProcessor, err := reputation.New(&reputation.Params{ Log: log, PoolSize: cfg.GetInt("workers.reputation"), - NotaryDisabled: server.sideNotaryConfig.disabled, ReputationContract: server.contracts.reputation, EpochState: server, AlphabetState: server, @@ -665,7 +662,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error // initialize epoch timers server.epochTimer = newEpochTimer(&epochTimerArgs{ l: server.log, - notaryDisabled: server.sideNotaryConfig.disabled, nm: netmapProcessor, cnrWrapper: cnrClient, epoch: server, diff --git a/pkg/innerring/processors/netmap/processor.go b/pkg/innerring/processors/netmap/processor.go index 1257e047f1..ff754257a6 100644 --- a/pkg/innerring/processors/netmap/processor.go +++ b/pkg/innerring/processors/netmap/processor.go @@ -68,7 +68,6 @@ type ( nodeValidator NodeValidator - notaryDisabled bool feeProvider *config.FeeConfig } @@ -91,7 +90,6 @@ type ( NodeValidator NodeValidator - NotaryDisabled bool FeeProvider *config.FeeConfig } ) @@ -154,7 +152,6 @@ func New(p *Params) (*Processor, error) { nodeValidator: p.NodeValidator, - notaryDisabled: p.NotaryDisabled, feeProvider: p.FeeProvider, }, nil } diff --git a/pkg/innerring/processors/reputation/processor.go b/pkg/innerring/processors/reputation/processor.go index de42c29f57..ab30bc3b64 100644 --- a/pkg/innerring/processors/reputation/processor.go +++ b/pkg/innerring/processors/reputation/processor.go @@ -28,8 +28,6 @@ type ( log *zap.Logger pool *ants.Pool - notaryDisabled bool - reputationContract util.Uint160 epochState EpochState @@ -42,7 +40,6 @@ type ( Params struct { Log *zap.Logger PoolSize int - NotaryDisabled bool ReputationContract util.Uint160 EpochState EpochState AlphabetState AlphabetState @@ -77,7 +74,6 @@ func New(p *Params) (*Processor, error) { return &Processor{ log: p.Log, pool: pool, - notaryDisabled: p.NotaryDisabled, reputationContract: p.ReputationContract, epochState: p.EpochState, alphabetState: p.AlphabetState, diff --git a/pkg/innerring/settlement.go b/pkg/innerring/settlement.go index 56ac48fdab..31070795f6 100644 --- a/pkg/innerring/settlement.go +++ b/pkg/innerring/settlement.go @@ -46,8 +46,6 @@ type settlementDeps struct { clientCache *ClientCache balanceClient *balanceClient.Wrapper - - notaryDisabled bool } type auditSettlementDeps struct { diff --git a/pkg/morph/client/balance/transfer.go b/pkg/morph/client/balance/transfer.go index 03bb9a9771..a24a1eb1b6 100644 --- a/pkg/morph/client/balance/transfer.go +++ b/pkg/morph/client/balance/transfer.go @@ -43,34 +43,16 @@ func (t *TransferXArgs) SetDetails(v []byte) { // TransferX directly invokes the call of "transferX" method // of NeoFS Balance contract. func (c *Client) TransferX(args TransferXArgs) error { - return c.transferX(false, args) -} - -// TransferXNotary invokes the call of "transferX" method -// of NeoFS Balance contract via notary contract. -// -// Deprecated: construct underlying StaticClient with TryNotary() option -// and use TransferX. -func (c *Client) TransferXNotary(args TransferXArgs) error { - return c.transferX(true, args) -} - -func (c *Client) transferX(notary bool, args TransferXArgs) error { - f := c.client.Invoke - if notary { - f = c.client.NotaryInvoke - } - - err := f( + err := c.client.Invoke( c.transferXMethod, args.sender, args.recipient, args.amount, args.details, ) - if err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.transferXMethod, err) } + return nil } diff --git a/pkg/morph/client/balance/wrapper/transfer.go b/pkg/morph/client/balance/wrapper/transfer.go index c6e496fabf..406d391876 100644 --- a/pkg/morph/client/balance/wrapper/transfer.go +++ b/pkg/morph/client/balance/wrapper/transfer.go @@ -21,16 +21,6 @@ type TransferPrm struct { // // If TryNotary is provided, calls notary contract. func (w *Wrapper) TransferX(p TransferPrm) error { - return w.transferX(false, p) -} - -// TransferXNotary transfers p.Amount of GASe-12 from p.From to p.To -// with details p.Details via notary contract. -func (w *Wrapper) TransferXNotary(p TransferPrm) error { - return w.transferX(true, p) -} - -func (w *Wrapper) transferX(notary bool, p TransferPrm) error { from, err := owner.ScriptHashBE(p.From) if err != nil { return fmt.Errorf("invalid sender: %w", err) diff --git a/pkg/morph/client/container/estimations.go b/pkg/morph/client/container/estimations.go index 2214dd908f..45eadbb069 100644 --- a/pkg/morph/client/container/estimations.go +++ b/pkg/morph/client/container/estimations.go @@ -27,27 +27,9 @@ func (c *Client) StartEstimation(args StartEstimation) error { return nil } -// Deprecated: construct underlying StaticClient with TryNotary() option -// and use StartEstimation. -func (c *Client) StartEstimationNotary(args StartEstimation) error { - if err := c.client.NotaryInvoke(c.startEstimation, args.epoch); err != nil { - return fmt.Errorf("could not invoke method (%s): %w", c.startEstimation, err) - } - return nil -} - func (c *Client) StopEstimation(args StopEstimation) error { if err := c.client.Invoke(c.stopEstimation, args.epoch); err != nil { return fmt.Errorf("could not invoke method (%s): %w", c.stopEstimation, err) } return nil } - -// Deprecated: construct underlying StaticClient with TryNotary() option -// and use StopEstimation. -func (c *Client) StopEstimationNotary(args StopEstimation) error { - if err := c.client.NotaryInvoke(c.stopEstimation, args.epoch); err != nil { - return fmt.Errorf("could not invoke method (%s): %w", c.stopEstimation, err) - } - return nil -} diff --git a/pkg/morph/client/container/wrapper/estimations.go b/pkg/morph/client/container/wrapper/estimations.go index 4ab76fe2ae..49785992e0 100644 --- a/pkg/morph/client/container/wrapper/estimations.go +++ b/pkg/morph/client/container/wrapper/estimations.go @@ -12,18 +12,6 @@ func (w *Wrapper) StartEstimation(epoch uint64) error { return w.client.StartEstimation(args) } -// StartEstimationNotary votes to produce start estimation notification through -// notary contract. -// -// Deprecated: provide TryNotary() option to NewFromMorph -// and use StartEstimation. -func (w *Wrapper) StartEstimationNotary(epoch uint64) error { - args := container.StartEstimation{} - args.SetEpoch(int64(epoch)) - - return w.client.StartEstimationNotary(args) -} - // StopEstimation votes to produce stop estimation notification. func (w *Wrapper) StopEstimation(epoch uint64) error { args := container.StopEstimation{} @@ -31,15 +19,3 @@ func (w *Wrapper) StopEstimation(epoch uint64) error { return w.client.StopEstimation(args) } - -// StopEstimationNotary votes to produce stop estimation notification through -// notary contract. -// -// Deprecated: provide TryNotary() option to NewFromMorph -// and use StopEstimation. -func (w *Wrapper) StopEstimationNotary(epoch uint64) error { - args := container.StopEstimation{} - args.SetEpoch(int64(epoch)) - - return w.client.StopEstimationNotary(args) -} diff --git a/pkg/morph/client/reputation/put.go b/pkg/morph/client/reputation/put.go index 814b107cb2..9d05b2097e 100644 --- a/pkg/morph/client/reputation/put.go +++ b/pkg/morph/client/reputation/put.go @@ -40,22 +40,3 @@ func (c *Client) Put(args PutArgs) error { } return nil } - -// PutViaNotary invokes notary call of "put reputation value" method of -// reputation contract. -// -// Deprecated: construct underlying StaticClient with TryNotary() option -// and use Put. -func (c *Client) PutViaNotary(args PutArgs) error { - err := c.client.NotaryInvoke( - c.putMethod, - int64(args.epoch), - args.peerID, - args.value, - ) - - if err != nil { - return fmt.Errorf("could not invoke method (%s): %w", c.putMethod, err) - } - return err -} diff --git a/pkg/morph/client/reputation/wrapper/put.go b/pkg/morph/client/reputation/wrapper/put.go index 3123e978fb..7b2c92d095 100644 --- a/pkg/morph/client/reputation/wrapper/put.go +++ b/pkg/morph/client/reputation/wrapper/put.go @@ -43,17 +43,6 @@ func (w *ClientWrapper) Put(v PutArgs) error { return (*reputationClient.Client)(w).Put(args) } -// PutViaNotary invokes notary call of "put reputation value" method of -// reputation contract. -func (w *ClientWrapper) PutViaNotary(v PutArgs) error { - args, err := preparePutArgs(v) - if err != nil { - return err - } - - return (*reputationClient.Client)(w).PutViaNotary(args) -} - func preparePutArgs(v PutArgs) (reputationClient.PutArgs, error) { args := reputationClient.PutArgs{} diff --git a/pkg/morph/client/static.go b/pkg/morph/client/static.go index 513d0a9d3f..cf14cdcfda 100644 --- a/pkg/morph/client/static.go +++ b/pkg/morph/client/static.go @@ -96,20 +96,3 @@ func (s StaticClient) TestInvoke(method string, args ...interface{}) ([]stackite args..., ) } - -// NotaryInvoke calls NotaryInvoke method of Client with static internal -// script hash. Panics if notary support was not enabled in underlying -// morph client. -// -// Deprecated: provide TryNotary() option to NewStatic and use Invoke. -func (s StaticClient) NotaryInvoke(method string, args ...interface{}) error { - if s.client.notary == nil { - panic(notaryNotEnabledPanicMsg) - } - return s.client.notaryInvoke( - false, - s.scScriptHash, - method, - args..., - ) -}