From 54523d2949232a3cde3e70b5041334dd32d94135 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Dec 2020 14:33:39 +0300 Subject: [PATCH] [#255] ir: Replace audit client creation to invoke package Signed-off-by: Leonard Lyubich --- pkg/innerring/innerring.go | 5 +---- pkg/innerring/invoke/enhanced.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 9902821b0..8449d8789 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -17,7 +17,6 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap" "github.com/nspcc-dev/neofs-node/pkg/innerring/timers" "github.com/nspcc-dev/neofs-node/pkg/morph/client" - auditClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit" auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" "github.com/nspcc-dev/neofs-node/pkg/morph/subscriber" @@ -220,13 +219,11 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error return nil, err } - staticAuditClient, err := client.NewStatic(server.morphClient, server.contracts.audit, 0) + server.auditClient, err = invoke.NewNoFeeAuditClient(server.morphClient, server.contracts.audit) if err != nil { return nil, err } - server.auditClient = auditWrapper.WrapClient(auditClient.New(staticAuditClient)) - auditTaskManager := audittask.New( audittask.WithQueueCapacity(cfg.GetUint32("audit.task.queue_capacity")), audittask.WithWorkerPool(auditPool), diff --git a/pkg/innerring/invoke/enhanced.go b/pkg/innerring/invoke/enhanced.go index 8c3c63f85..20dc7764b 100644 --- a/pkg/innerring/invoke/enhanced.go +++ b/pkg/innerring/invoke/enhanced.go @@ -5,6 +5,8 @@ import ( "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-node/pkg/morph/client" + "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit" + auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper" morphContainer "github.com/nspcc-dev/neofs-node/pkg/morph/client/container" wrapContainer "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" morphNetmap "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap" @@ -42,3 +44,13 @@ func NewNoFeeNetmapClient(cli *client.Client, contract util.Uint160) (*wrapNetma return wrapNetmap.New(enhancedNetmapClient) } + +// NewNoFeeAuditClient creates wrapper to work with Audit contract. +func NewNoFeeAuditClient(cli *client.Client, contract util.Uint160) (*auditWrapper.ClientWrapper, error) { + staticClient, err := client.NewStatic(cli, contract, readOnlyFee) + if err != nil { + return nil, err + } + + return auditWrapper.WrapClient(audit.New(staticClient)), nil +}