From 3ef5b0ff9c81188fc8f8cebeded197385a8764d6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 12 May 2021 11:15:04 +0300 Subject: [PATCH] [#493] node: Do not add fee in smart contract calls Calls to contracts by storage nodes do not lead to the accumulation of multisignatures in the contract memory, so the call cost can always be accurately calculated in advance without additional fee. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/accounting.go | 2 +- cmd/neofs-node/config.go | 16 ---------------- cmd/neofs-node/container.go | 2 +- cmd/neofs-node/morph.go | 2 +- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/cmd/neofs-node/accounting.go b/cmd/neofs-node/accounting.go index 76bb2c429..d5d3c33e9 100644 --- a/cmd/neofs-node/accounting.go +++ b/cmd/neofs-node/accounting.go @@ -18,7 +18,7 @@ func initAccountingService(c *cfg) { staticClient, err := client.NewStatic( c.cfgMorph.client, c.cfgAccounting.scriptHash, - c.cfgAccounting.fee, + 0, ) fatalOnErr(err) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 9d3a64562..4601fb0e1 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -11,7 +11,6 @@ import ( "sync" "time" - "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/netmap" @@ -83,17 +82,14 @@ const ( // config keys for cfgAccounting cfgAccountingContract = "accounting.scripthash" - cfgAccountingFee = "accounting.fee" // config keys for cfgNetmap cfgNetmapContract = "netmap.scripthash" - cfgNetmapFee = "netmap.fee" cfgNetmapWorkerPoolEnabled = "netmap.async_worker.enabled" cfgNetmapWorkerPoolSize = "netmap.async_worker.size" // config keys for cfgContainer cfgContainerContract = "container.scripthash" - cfgContainerFee = "container.fee" cfgContainerWorkerPoolEnabled = "container.async_worker.enabled" cfgContainerWorkerPoolSize = "container.async_worker.size" @@ -241,15 +237,11 @@ type cfgMorph struct { type cfgAccounting struct { scriptHash util.Uint160 - - fee fixedn.Fixed8 } type cfgContainer struct { scriptHash util.Uint160 - fee fixedn.Fixed8 - parsers map[event.Type]event.Parser subscribers map[event.Type][]event.Handler workerPool util2.WorkerPool // pool for asynchronous handlers @@ -259,8 +251,6 @@ type cfgNetmap struct { scriptHash util.Uint160 wrapper *nmwrapper.Wrapper - fee fixedn.Fixed8 - parsers map[event.Type]event.Parser subscribers map[event.Type][]event.Handler @@ -391,16 +381,13 @@ func initCfg(path string) *cfg { apiVersion: pkg.SDKVersion(), cfgAccounting: cfgAccounting{ scriptHash: u160Accounting, - fee: fixedn.Fixed8(viperCfg.GetInt(cfgAccountingFee)), }, cfgContainer: cfgContainer{ scriptHash: u160Container, - fee: fixedn.Fixed8(viperCfg.GetInt(cfgContainerFee)), workerPool: containerWorkerPool, }, cfgNetmap: cfgNetmap{ scriptHash: u160Netmap, - fee: fixedn.Fixed8(viperCfg.GetInt(cfgNetmapFee)), state: state, workerPool: netmapWorkerPool, reBootstrapInterval: viperCfg.GetUint64(cfgReBootstrapInterval), @@ -471,10 +458,8 @@ func defaultConfiguration(v *viper.Viper) { v.SetDefault(cfgAPIClientDialTimeout, 5*time.Second) v.SetDefault(cfgAccountingContract, "1aeefe1d0dfade49740fff779c02cd4a0538ffb1") - v.SetDefault(cfgAccountingFee, "1") v.SetDefault(cfgContainerContract, "9d2ca84d7fb88213c4baced5a6ed4dc402309039") - v.SetDefault(cfgContainerFee, "1") v.SetDefault(cfgContainerWorkerPoolEnabled, true) v.SetDefault(cfgContainerWorkerPoolSize, 10) @@ -482,7 +467,6 @@ func defaultConfiguration(v *viper.Viper) { v.SetDefault(cfgReputationWorkerPoolSize, 10) v.SetDefault(cfgNetmapContract, "75194459637323ea8837d2afe8225ec74a5658c3") - v.SetDefault(cfgNetmapFee, "1") v.SetDefault(cfgNetmapWorkerPoolEnabled, true) v.SetDefault(cfgNetmapWorkerPoolSize, 10) diff --git a/cmd/neofs-node/container.go b/cmd/neofs-node/container.go index 0d53b012a..c28680ab4 100644 --- a/cmd/neofs-node/container.go +++ b/cmd/neofs-node/container.go @@ -43,7 +43,7 @@ func initContainerService(c *cfg) { staticClient, err := client.NewStatic( c.cfgMorph.client, c.cfgContainer.scriptHash, - c.cfgContainer.fee, + 0, ) fatalOnErr(err) diff --git a/cmd/neofs-node/morph.go b/cmd/neofs-node/morph.go index 845ebb04d..438fba13f 100644 --- a/cmd/neofs-node/morph.go +++ b/cmd/neofs-node/morph.go @@ -77,7 +77,7 @@ func initMorphComponents(c *cfg) { staticClient, err := client.NewStatic( c.cfgMorph.client, c.cfgNetmap.scriptHash, - c.cfgContainer.fee, + 0, ) fatalOnErr(err)