diff --git a/pkg/innerring/processors/container/process_container.go b/pkg/innerring/processors/container/process_container.go index ba093060..0cb97ca2 100644 --- a/pkg/innerring/processors/container/process_container.go +++ b/pkg/innerring/processors/container/process_container.go @@ -82,6 +82,12 @@ func (cp *Processor) checkPutContainer(ctx *putContainerContext) error { return fmt.Errorf("incorrect subnetwork: %w", err) } + // check homomorphic hashing setting + err = checkHomomorphicHashing(cp.netState, cnr) + if err != nil { + return fmt.Errorf("incorrect homomorphic hashing setting: %w", err) + } + // check native name and zone err = checkNNS(ctx, cnr) if err != nil { @@ -237,3 +243,16 @@ func checkSubnet(subCli *morphsubnet.Client, cnr containerSDK.Container) error { return nil } + +func checkHomomorphicHashing(ns NetworkState, cnr containerSDK.Container) error { + netSetting, err := ns.HomomorphicHashDisabled() + if err != nil { + return fmt.Errorf("could not get setting in contract: %w", err) + } + + if cnrSetting := containerSDK.IsHomomorphicHashingDisabled(cnr); netSetting != cnrSetting { + return fmt.Errorf("network setting: %t, container setting: %t", netSetting, cnrSetting) + } + + return nil +} diff --git a/pkg/innerring/processors/container/processor.go b/pkg/innerring/processors/container/processor.go index cd03e202..039eb5fb 100644 --- a/pkg/innerring/processors/container/processor.go +++ b/pkg/innerring/processors/container/processor.go @@ -53,6 +53,14 @@ type NetworkState interface { // Must return any error encountered // which did not allow reading the value. Epoch() (uint64, error) + + // HomomorphicHashDisabled must return boolean that + // represents homomorphic network state: + // * true if hashing is disabled; + // * false if hashing is enabled. + // + // which did not allow reading the value. + HomomorphicHashDisabled() (bool, error) } const (