[#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

@ -0,0 +1,32 @@
package client
import (
"testing"
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
"github.com/stretchr/testify/require"
)
func TestFees(t *testing.T) {
var v fees
const method = "some method"
var (
fee fixedn.Fixed8
def = fixedn.Fixed8(13)
)
v.setDefault(def)
fee = v.feeForMethod(method)
require.True(t, fee.Equal(def))
const customFee = fixedn.Fixed8(10)
v.setFeeForMethod(method, customFee)
fee = v.feeForMethod(method)
require.Equal(t, customFee, fee)
}