[#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 <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-12 11:15:04 +03:00 committed by Leonard Lyubich
parent acd63afd48
commit 3ef5b0ff9c
4 changed files with 3 additions and 19 deletions

View file

@ -18,7 +18,7 @@ func initAccountingService(c *cfg) {
staticClient, err := client.NewStatic( staticClient, err := client.NewStatic(
c.cfgMorph.client, c.cfgMorph.client,
c.cfgAccounting.scriptHash, c.cfgAccounting.scriptHash,
c.cfgAccounting.fee, 0,
) )
fatalOnErr(err) fatalOnErr(err)

View file

@ -11,7 +11,6 @@ import (
"sync" "sync"
"time" "time"
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg"
"github.com/nspcc-dev/neofs-api-go/pkg/netmap" "github.com/nspcc-dev/neofs-api-go/pkg/netmap"
@ -83,17 +82,14 @@ const (
// config keys for cfgAccounting // config keys for cfgAccounting
cfgAccountingContract = "accounting.scripthash" cfgAccountingContract = "accounting.scripthash"
cfgAccountingFee = "accounting.fee"
// config keys for cfgNetmap // config keys for cfgNetmap
cfgNetmapContract = "netmap.scripthash" cfgNetmapContract = "netmap.scripthash"
cfgNetmapFee = "netmap.fee"
cfgNetmapWorkerPoolEnabled = "netmap.async_worker.enabled" cfgNetmapWorkerPoolEnabled = "netmap.async_worker.enabled"
cfgNetmapWorkerPoolSize = "netmap.async_worker.size" cfgNetmapWorkerPoolSize = "netmap.async_worker.size"
// config keys for cfgContainer // config keys for cfgContainer
cfgContainerContract = "container.scripthash" cfgContainerContract = "container.scripthash"
cfgContainerFee = "container.fee"
cfgContainerWorkerPoolEnabled = "container.async_worker.enabled" cfgContainerWorkerPoolEnabled = "container.async_worker.enabled"
cfgContainerWorkerPoolSize = "container.async_worker.size" cfgContainerWorkerPoolSize = "container.async_worker.size"
@ -241,15 +237,11 @@ type cfgMorph struct {
type cfgAccounting struct { type cfgAccounting struct {
scriptHash util.Uint160 scriptHash util.Uint160
fee fixedn.Fixed8
} }
type cfgContainer struct { type cfgContainer struct {
scriptHash util.Uint160 scriptHash util.Uint160
fee fixedn.Fixed8
parsers map[event.Type]event.Parser parsers map[event.Type]event.Parser
subscribers map[event.Type][]event.Handler subscribers map[event.Type][]event.Handler
workerPool util2.WorkerPool // pool for asynchronous handlers workerPool util2.WorkerPool // pool for asynchronous handlers
@ -259,8 +251,6 @@ type cfgNetmap struct {
scriptHash util.Uint160 scriptHash util.Uint160
wrapper *nmwrapper.Wrapper wrapper *nmwrapper.Wrapper
fee fixedn.Fixed8
parsers map[event.Type]event.Parser parsers map[event.Type]event.Parser
subscribers map[event.Type][]event.Handler subscribers map[event.Type][]event.Handler
@ -391,16 +381,13 @@ func initCfg(path string) *cfg {
apiVersion: pkg.SDKVersion(), apiVersion: pkg.SDKVersion(),
cfgAccounting: cfgAccounting{ cfgAccounting: cfgAccounting{
scriptHash: u160Accounting, scriptHash: u160Accounting,
fee: fixedn.Fixed8(viperCfg.GetInt(cfgAccountingFee)),
}, },
cfgContainer: cfgContainer{ cfgContainer: cfgContainer{
scriptHash: u160Container, scriptHash: u160Container,
fee: fixedn.Fixed8(viperCfg.GetInt(cfgContainerFee)),
workerPool: containerWorkerPool, workerPool: containerWorkerPool,
}, },
cfgNetmap: cfgNetmap{ cfgNetmap: cfgNetmap{
scriptHash: u160Netmap, scriptHash: u160Netmap,
fee: fixedn.Fixed8(viperCfg.GetInt(cfgNetmapFee)),
state: state, state: state,
workerPool: netmapWorkerPool, workerPool: netmapWorkerPool,
reBootstrapInterval: viperCfg.GetUint64(cfgReBootstrapInterval), reBootstrapInterval: viperCfg.GetUint64(cfgReBootstrapInterval),
@ -471,10 +458,8 @@ func defaultConfiguration(v *viper.Viper) {
v.SetDefault(cfgAPIClientDialTimeout, 5*time.Second) v.SetDefault(cfgAPIClientDialTimeout, 5*time.Second)
v.SetDefault(cfgAccountingContract, "1aeefe1d0dfade49740fff779c02cd4a0538ffb1") v.SetDefault(cfgAccountingContract, "1aeefe1d0dfade49740fff779c02cd4a0538ffb1")
v.SetDefault(cfgAccountingFee, "1")
v.SetDefault(cfgContainerContract, "9d2ca84d7fb88213c4baced5a6ed4dc402309039") v.SetDefault(cfgContainerContract, "9d2ca84d7fb88213c4baced5a6ed4dc402309039")
v.SetDefault(cfgContainerFee, "1")
v.SetDefault(cfgContainerWorkerPoolEnabled, true) v.SetDefault(cfgContainerWorkerPoolEnabled, true)
v.SetDefault(cfgContainerWorkerPoolSize, 10) v.SetDefault(cfgContainerWorkerPoolSize, 10)
@ -482,7 +467,6 @@ func defaultConfiguration(v *viper.Viper) {
v.SetDefault(cfgReputationWorkerPoolSize, 10) v.SetDefault(cfgReputationWorkerPoolSize, 10)
v.SetDefault(cfgNetmapContract, "75194459637323ea8837d2afe8225ec74a5658c3") v.SetDefault(cfgNetmapContract, "75194459637323ea8837d2afe8225ec74a5658c3")
v.SetDefault(cfgNetmapFee, "1")
v.SetDefault(cfgNetmapWorkerPoolEnabled, true) v.SetDefault(cfgNetmapWorkerPoolEnabled, true)
v.SetDefault(cfgNetmapWorkerPoolSize, 10) v.SetDefault(cfgNetmapWorkerPoolSize, 10)

View file

@ -43,7 +43,7 @@ func initContainerService(c *cfg) {
staticClient, err := client.NewStatic( staticClient, err := client.NewStatic(
c.cfgMorph.client, c.cfgMorph.client,
c.cfgContainer.scriptHash, c.cfgContainer.scriptHash,
c.cfgContainer.fee, 0,
) )
fatalOnErr(err) fatalOnErr(err)

View file

@ -77,7 +77,7 @@ func initMorphComponents(c *cfg) {
staticClient, err := client.NewStatic( staticClient, err := client.NewStatic(
c.cfgMorph.client, c.cfgMorph.client,
c.cfgNetmap.scriptHash, c.cfgNetmap.scriptHash,
c.cfgContainer.fee, 0,
) )
fatalOnErr(err) fatalOnErr(err)