forked from TrueCloudLab/frostfs-node
[#932] adm: Move DomainOf
to util
package
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
34fcab3498
commit
fdeb99c52f
19 changed files with 36 additions and 38 deletions
|
@ -92,10 +92,6 @@ const (
|
|||
deployMethodName = "deploy"
|
||||
)
|
||||
|
||||
func domainOf(contract string) string {
|
||||
return contract + ".frostfs"
|
||||
}
|
||||
|
||||
func (c *initializeContext) deployNNS(method string) error {
|
||||
cs := c.getContract(nnsContract)
|
||||
h := cs.Hash
|
||||
|
@ -133,7 +129,7 @@ func (c *initializeContext) deployNNS(method string) error {
|
|||
return fmt.Errorf("failed to create deploy tx for %s: %w", nnsContract, err)
|
||||
}
|
||||
|
||||
if err := c.multiSignAndSend(tx, committeeAccountName); err != nil {
|
||||
if err := c.multiSignAndSend(tx, morphUtil.CommitteeAccountName); err != nil {
|
||||
return fmt.Errorf("can't send deploy transaction: %w", err)
|
||||
}
|
||||
|
||||
|
@ -203,7 +199,7 @@ func (c *initializeContext) deployOrUpdateContracts(w *io2.BufBinWriter, nnsHash
|
|||
cs := c.getContract(ctrName)
|
||||
|
||||
method := updateMethodName
|
||||
ctrHash, err := morphUtil.NNSResolveHash(c.ReadOnlyInvoker, nnsHash, domainOf(ctrName))
|
||||
ctrHash, err := morphUtil.NNSResolveHash(c.ReadOnlyInvoker, nnsHash, morphUtil.DomainOf(ctrName))
|
||||
if err != nil {
|
||||
if errors.Is(err, errMissingNNSRecord) {
|
||||
// if contract not found we deploy it instead of update
|
||||
|
@ -609,7 +605,7 @@ func (c *initializeContext) getFrostfsIDAdminFromContract() (util.Uint160, bool,
|
|||
if err != nil {
|
||||
return util.Uint160{}, false, fmt.Errorf("get nns contract: %w", err)
|
||||
}
|
||||
fidHash, err := morphUtil.NNSResolveHash(c.ReadOnlyInvoker, cs.Hash, domainOf(frostfsIDContract))
|
||||
fidHash, err := morphUtil.NNSResolveHash(c.ReadOnlyInvoker, cs.Hash, morphUtil.DomainOf(frostfsIDContract))
|
||||
if err != nil {
|
||||
return util.Uint160{}, false, fmt.Errorf("resolve frostfsid contract hash: %w", err)
|
||||
}
|
||||
|
@ -638,7 +634,7 @@ func (c *initializeContext) getNetConfigFromNetmapContract() ([]stackitem.Item,
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("get nns contract: %w", err)
|
||||
}
|
||||
nmHash, err := morphUtil.NNSResolveHash(c.ReadOnlyInvoker, cs.Hash, domainOf(netmapContract))
|
||||
nmHash, err := morphUtil.NNSResolveHash(c.ReadOnlyInvoker, cs.Hash, morphUtil.DomainOf(netmapContract))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't get netmap contract hash: %w", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue