forked from TrueCloudLab/frostfs-contract
[#150] container: make config key public
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
fef6a6cb36
commit
e5c5cc30c0
2 changed files with 7 additions and 5 deletions
|
@ -51,7 +51,8 @@ const (
|
|||
nnsHasAliasKey = "nnsHasAlias"
|
||||
notaryDisabledKey = "notary"
|
||||
|
||||
containerFeeKey = "ContainerFee"
|
||||
// RegistrationFeeKey is a key in netmap config which contains fee for container registration.
|
||||
RegistrationFeeKey = "ContainerFee"
|
||||
|
||||
containerIDSize = 32 // SHA256 size
|
||||
|
||||
|
@ -177,7 +178,7 @@ func PutNamed(container []byte, signature interop.Signature,
|
|||
from := common.WalletToScriptHash(ownerID)
|
||||
netmapContractAddr := storage.Get(ctx, netmapContractKey).(interop.Hash160)
|
||||
balanceContractAddr := storage.Get(ctx, balanceContractKey).(interop.Hash160)
|
||||
containerFee := contract.Call(netmapContractAddr, "config", contract.ReadOnly, containerFeeKey).(int)
|
||||
containerFee := contract.Call(netmapContractAddr, "config", contract.ReadOnly, RegistrationFeeKey).(int)
|
||||
balance := contract.Call(balanceContractAddr, "balanceOf", contract.ReadOnly, from).(int)
|
||||
|
||||
if balance < containerFee*len(alphabet) {
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
"github.com/nspcc-dev/neo-go/pkg/wallet"
|
||||
"github.com/nspcc-dev/neofs-contract/container"
|
||||
"github.com/nspcc-dev/neofs-contract/nns"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
@ -40,7 +41,7 @@ func prepareContainerContract(t *testing.T, bc *core.Blockchain) (util.Uint160,
|
|||
ctrContainer, err := ContractInfo(CommitteeAcc.Contract.ScriptHash(), containerPath)
|
||||
require.NoError(t, err)
|
||||
|
||||
deployNetmapContract(t, bc, ctrBalance.Hash, ctrContainer.Hash, "ContainerFee", int64(containerFee))
|
||||
deployNetmapContract(t, bc, ctrBalance.Hash, ctrContainer.Hash, container.RegistrationFeeKey, int64(containerFee))
|
||||
balHash := deployBalanceContract(t, bc, ctrNetmap.Hash, ctrContainer.Hash)
|
||||
return deployContainerContract(t, bc, ctrNetmap.Hash, ctrBalance.Hash, addrNNS), balHash
|
||||
}
|
||||
|
@ -119,8 +120,8 @@ func TestContainerPut(t *testing.T) {
|
|||
"whateveriwant@world.com", int64(0), int64(0), int64(0), int64(0))
|
||||
AddBlockCheckHalt(t, bc, tx)
|
||||
|
||||
putArgs := []interface{}{container, dummySig, dummyPub, dummyToken, "baddomain", "neofs"}
|
||||
tx = PrepareInvoke(t, bc, acc, h, "putNamed", putArgs...)
|
||||
tx = PrepareInvoke(t, bc, acc, h, "putNamed",
|
||||
c.value, c.sig, c.pub, c.token, "baddomain", "neofs")
|
||||
AddBlock(t, bc, tx)
|
||||
CheckFault(t, bc, tx.Hash(), "committee must own registered domain")
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue