[#1008] ir/container: Customize fee for named container registration

In notary disabled environment, approval of container creation with nice
name attribute takes much more additional GAS than other operations
(due to NNS invocation).

Morph library changes:
  * add the ability to specify per-op fees using `StaticClient` options;
  * add the ability to customize fee for `Put` operation with named
    container in container morph client.

Inner Ring changes:
  * add `fee.named_container_register` config value which specifies
    additional GAS fee for the approvals of the named container
    registrations;
  * pass the config value to `WithCustomFeeForNamedPut` option of
    container morph client.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-12-07 12:54:21 +03:00 committed by Alex Vanin
parent b4c36a109d
commit feb0a65efb
7 changed files with 185 additions and 34 deletions

View file

@ -8,13 +8,19 @@ import (
// FeeConfig is an instance that returns extra fee values for contract
// invocations without notary support.
type FeeConfig struct {
mainchain, sidechain fixedn.Fixed8
registerNamedCnr,
mainchain,
sidechain fixedn.Fixed8
}
// NewFeeConfig constructs FeeConfig from viper.Viper instance. Latter must not be nil.
//
// Fee for named container registration is taken from "fee.named_container_register" value.
func NewFeeConfig(v *viper.Viper) *FeeConfig {
return &FeeConfig{
mainchain: fixedn.Fixed8(v.GetInt64("fee.main_chain")),
sidechain: fixedn.Fixed8(v.GetInt64("fee.side_chain")),
registerNamedCnr: fixedn.Fixed8(v.GetInt64("fee.named_container_register")),
mainchain: fixedn.Fixed8(v.GetInt64("fee.main_chain")),
sidechain: fixedn.Fixed8(v.GetInt64("fee.side_chain")),
}
}
@ -25,3 +31,8 @@ func (f FeeConfig) MainChainFee() fixedn.Fixed8 {
func (f FeeConfig) SideChainFee() fixedn.Fixed8 {
return f.sidechain
}
// NamedContainerRegistrationFee returns additional GAS fee for named container registration in NeoFS network.
func (f FeeConfig) NamedContainerRegistrationFee() fixedn.Fixed8 {
return f.registerNamedCnr
}