[#755] innerring: Check container owner namespace

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-11-20 17:03:19 +03:00
parent 1cd2bfe51a
commit a3ef7b58b4
6 changed files with 218 additions and 20 deletions

View file

@ -4,6 +4,7 @@ import (
"errors"
"fmt"
frostfsidclient "git.frostfs.info/TrueCloudLab/frostfs-contract/frostfsid/client"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
containercore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/container"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/metrics"
@ -32,15 +33,20 @@ type (
NotarySignAndInvokeTX(mainTx *transaction.Transaction) error
}
FrostFSIDClient interface {
GetSubject(addr util.Uint160) (*frostfsidclient.Subject, error)
}
// Processor of events produced by container contract in the sidechain.
Processor struct {
log *logger.Logger
metrics metrics.Register
pool *ants.Pool
alphabetState AlphabetState
cnrClient ContClient // notary must be enabled
morphClient MorphClient
netState NetworkState
log *logger.Logger
metrics metrics.Register
pool *ants.Pool
alphabetState AlphabetState
cnrClient ContClient // notary must be enabled
morphClient MorphClient
netState NetworkState
frostFSIDClient FrostFSIDClient
}
// Params of the processor constructor.
@ -52,6 +58,7 @@ type (
ContainerClient ContClient
MorphClient MorphClient
NetworkState NetworkState
FrostFSIDClient FrostFSIDClient
}
)
@ -86,6 +93,8 @@ func New(p *Params) (*Processor, error) {
return nil, errors.New("ir/container: Morph client is not set")
case p.NetworkState == nil:
return nil, errors.New("ir/container: network state is not set")
case p.FrostFSIDClient == nil:
return nil, errors.New("ir/container: FrostFSID client is not set")
}
p.Log.Debug(logs.ContainerContainerWorkerPool, zap.Int("size", p.PoolSize))
@ -101,13 +110,14 @@ func New(p *Params) (*Processor, error) {
}
return &Processor{
log: p.Log,
metrics: metricsRegister,
pool: pool,
alphabetState: p.AlphabetState,
cnrClient: p.ContainerClient,
netState: p.NetworkState,
morphClient: p.MorphClient,
log: p.Log,
metrics: metricsRegister,
pool: pool,
alphabetState: p.AlphabetState,
cnrClient: p.ContainerClient,
netState: p.NetworkState,
morphClient: p.MorphClient,
frostFSIDClient: p.FrostFSIDClient,
}, nil
}