[#11] Rename contract-related NeoFS occurences

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-01-10 16:07:47 +03:00 committed by fyrchik
parent 9cb4b4cc17
commit 054bc4a727
11 changed files with 34 additions and 34 deletions

View file

@ -63,7 +63,7 @@ func parseContracts(cfg *viper.Viper, morph *client.Client, withoutMainNet, with
{"contracts.audit", client.NNSAuditContractName, &result.audit}, {"contracts.audit", client.NNSAuditContractName, &result.audit},
{"contracts.reputation", client.NNSReputationContractName, &result.reputation}, {"contracts.reputation", client.NNSReputationContractName, &result.reputation},
{"contracts.subnet", client.NNSSubnetworkContractName, &result.subnet}, {"contracts.subnet", client.NNSSubnetworkContractName, &result.subnet},
{"contracts.frostfsid", client.NNSNeoFSIDContractName, &result.frostfsID}, {"contracts.frostfsid", client.NNSFrostFSIDContractName, &result.frostfsID},
} }
for _, t := range targets { for _, t := range targets {

View file

@ -670,7 +670,7 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan
// create governance processor // create governance processor
governanceProcessor, err := governance.New(&governance.Params{ governanceProcessor, err := governance.New(&governance.Params{
Log: log, Log: log,
NeoFSClient: frostfsCli, FrostFSClient: frostfsCli,
NetmapClient: server.netmapClient, NetmapClient: server.netmapClient,
AlphabetState: server, AlphabetState: server,
EpochState: server, EpochState: server,
@ -743,7 +743,7 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan
PoolSize: cfg.GetInt("workers.container"), PoolSize: cfg.GetInt("workers.container"),
AlphabetState: server, AlphabetState: server,
ContainerClient: cnrClient, ContainerClient: cnrClient,
NeoFSIDClient: frostfsIDClient, FrostFSIDClient: frostfsIDClient,
NetworkState: server.netmapClient, NetworkState: server.netmapClient,
NotaryDisabled: server.sideNotaryConfig.disabled, NotaryDisabled: server.sideNotaryConfig.disabled,
SubnetClient: subnetClient, SubnetClient: subnetClient,
@ -761,7 +761,7 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan
balanceProcessor, err := balance.New(&balance.Params{ balanceProcessor, err := balance.New(&balance.Params{
Log: log, Log: log,
PoolSize: cfg.GetInt("workers.balance"), PoolSize: cfg.GetInt("workers.balance"),
NeoFSClient: frostfsCli, FrostFSClient: frostfsCli,
BalanceSC: server.contracts.balance, BalanceSC: server.contracts.balance,
AlphabetState: server, AlphabetState: server,
Converter: &server.precision, Converter: &server.precision,
@ -780,8 +780,8 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan
frostfsProcessor, err := frostfs.New(&frostfs.Params{ frostfsProcessor, err := frostfs.New(&frostfs.Params{
Log: log, Log: log,
PoolSize: cfg.GetInt("workers.frostfs"), PoolSize: cfg.GetInt("workers.frostfs"),
NeoFSContract: server.contracts.frostfs, FrostFSContract: server.contracts.frostfs,
NeoFSIDClient: frostfsIDClient, FrostFSIDClient: frostfsIDClient,
BalanceClient: server.balanceClient, BalanceClient: server.balanceClient,
NetmapClient: server.netmapClient, NetmapClient: server.netmapClient,
MorphClient: server.morphClient, MorphClient: server.morphClient,

View file

@ -22,7 +22,7 @@ func (bp *Processor) processLock(lock *balanceEvent.Lock) {
prm.SetLock(lock.LockAccount()) prm.SetLock(lock.LockAccount())
prm.SetHash(lock.TxHash()) prm.SetHash(lock.TxHash())
err := bp.neofsClient.Cheque(prm) err := bp.frostfsClient.Cheque(prm)
if err != nil { if err != nil {
bp.log.Error("can't send lock asset tx", zap.Error(err)) bp.log.Error("can't send lock asset tx", zap.Error(err))
} }

View file

@ -28,7 +28,7 @@ type (
Processor struct { Processor struct {
log *logger.Logger log *logger.Logger
pool *ants.Pool pool *ants.Pool
neofsClient *frostfscontract.Client frostfsClient *frostfscontract.Client
balanceSC util.Uint160 balanceSC util.Uint160
alphabetState AlphabetState alphabetState AlphabetState
converter PrecisionConverter converter PrecisionConverter
@ -38,7 +38,7 @@ type (
Params struct { Params struct {
Log *logger.Logger Log *logger.Logger
PoolSize int PoolSize int
NeoFSClient *frostfscontract.Client FrostFSClient *frostfscontract.Client
BalanceSC util.Uint160 BalanceSC util.Uint160
AlphabetState AlphabetState AlphabetState AlphabetState
Converter PrecisionConverter Converter PrecisionConverter
@ -70,7 +70,7 @@ func New(p *Params) (*Processor, error) {
return &Processor{ return &Processor{
log: p.Log, log: p.Log,
pool: pool, pool: pool,
neofsClient: p.NeoFSClient, frostfsClient: p.FrostFSClient,
balanceSC: p.BalanceSC, balanceSC: p.BalanceSC,
alphabetState: p.AlphabetState, alphabetState: p.AlphabetState,
converter: p.Converter, converter: p.Converter,

View file

@ -39,7 +39,7 @@ type (
PoolSize int PoolSize int
AlphabetState AlphabetState AlphabetState AlphabetState
ContainerClient *container.Client ContainerClient *container.Client
NeoFSIDClient *frostfsid.Client FrostFSIDClient *frostfsid.Client
SubnetClient *morphsubnet.Client SubnetClient *morphsubnet.Client
NetworkState NetworkState NetworkState NetworkState
NotaryDisabled bool NotaryDisabled bool
@ -80,7 +80,7 @@ func New(p *Params) (*Processor, error) {
return nil, errors.New("ir/container: global state is not set") return nil, errors.New("ir/container: global state is not set")
case p.ContainerClient == nil: case p.ContainerClient == nil:
return nil, errors.New("ir/container: Container client is not set") return nil, errors.New("ir/container: Container client is not set")
case p.NeoFSIDClient == nil: case p.FrostFSIDClient == nil:
return nil, errors.New("ir/container: NeoFS ID client is not set") return nil, errors.New("ir/container: NeoFS ID client is not set")
case p.NetworkState == nil: case p.NetworkState == nil:
return nil, errors.New("ir/container: network state is not set") return nil, errors.New("ir/container: network state is not set")
@ -100,7 +100,7 @@ func New(p *Params) (*Processor, error) {
pool: pool, pool: pool,
alphabetState: p.AlphabetState, alphabetState: p.AlphabetState,
cnrClient: p.ContainerClient, cnrClient: p.ContainerClient,
idClient: p.NeoFSIDClient, idClient: p.FrostFSIDClient,
netState: p.NetworkState, netState: p.NetworkState,
notaryDisabled: p.NotaryDisabled, notaryDisabled: p.NotaryDisabled,
subnetClient: p.SubnetClient, subnetClient: p.SubnetClient,

View file

@ -59,8 +59,8 @@ type (
Params struct { Params struct {
Log *logger.Logger Log *logger.Logger
PoolSize int PoolSize int
NeoFSContract util.Uint160 FrostFSContract util.Uint160
NeoFSIDClient *frostfsid.Client FrostFSIDClient *frostfsid.Client
BalanceClient *balance.Client BalanceClient *balance.Client
NetmapClient *nmClient.Client NetmapClient *nmClient.Client
MorphClient *client.Client MorphClient *client.Client
@ -113,7 +113,7 @@ func New(p *Params) (*Processor, error) {
return &Processor{ return &Processor{
log: p.Log, log: p.Log,
pool: pool, pool: pool,
frostfsContract: p.NeoFSContract, frostfsContract: p.FrostFSContract,
balanceClient: p.BalanceClient, balanceClient: p.BalanceClient,
netmapClient: p.NetmapClient, netmapClient: p.NetmapClient,
morphClient: p.MorphClient, morphClient: p.MorphClient,
@ -126,7 +126,7 @@ func New(p *Params) (*Processor, error) {
mintEmitValue: p.MintEmitValue, mintEmitValue: p.MintEmitValue,
gasBalanceThreshold: p.GasBalanceThreshold, gasBalanceThreshold: p.GasBalanceThreshold,
frostfsIDClient: p.NeoFSIDClient, frostfsIDClient: p.FrostFSIDClient,
}, nil }, nil
} }

View file

@ -84,7 +84,7 @@ type (
MorphClient *client.Client MorphClient *client.Client
MainnetClient *client.Client MainnetClient *client.Client
NeoFSClient *frostfscontract.Client FrostFSClient *frostfscontract.Client
NetmapClient *nmClient.Client NetmapClient *nmClient.Client
NotaryDisabled bool NotaryDisabled bool
@ -121,7 +121,7 @@ func New(p *Params) (*Processor, error) {
return &Processor{ return &Processor{
log: p.Log, log: p.Log,
pool: pool, pool: pool,
frostfsClient: p.NeoFSClient, frostfsClient: p.FrostFSClient,
netmapClient: p.NetmapClient, netmapClient: p.NetmapClient,
alphabetState: p.AlphabetState, alphabetState: p.AlphabetState,
epochState: p.EpochState, epochState: p.EpochState,

View file

@ -163,7 +163,7 @@ func (e *notHaltStateError) Error() string {
var errEmptyInvocationScript = errors.New("got empty invocation script from neo node") var errEmptyInvocationScript = errors.New("got empty invocation script from neo node")
// implementation of error interface for NeoFS-specific errors. // implementation of error interface for FrostFS-specific errors.
type frostfsError struct { type frostfsError struct {
err error err error
} }
@ -172,8 +172,8 @@ func (e frostfsError) Error() string {
return fmt.Sprintf("frostfs error: %v", e.err) return fmt.Sprintf("frostfs error: %v", e.err)
} }
// wraps NeoFS-specific error into frostfsError. Arg must not be nil. // wraps FrostFS-specific error into frostfsError. Arg must not be nil.
func wrapNeoFSError(err error) error { func wrapFrostFSError(err error) error {
return frostfsError{err} return frostfsError{err}
} }
@ -216,7 +216,7 @@ func (c *Client) TestInvoke(contract util.Uint160, method string, args ...interf
} }
if val.State != HaltState { if val.State != HaltState {
return nil, wrapNeoFSError(&notHaltStateError{state: val.State, exception: val.FaultException}) return nil, wrapFrostFSError(&notHaltStateError{state: val.State, exception: val.FaultException})
} }
return val.Stack, nil return val.Stack, nil
@ -433,7 +433,7 @@ func toStackParameter(value interface{}) (sc.Parameter, error) {
result.Type = sc.BoolType result.Type = sc.BoolType
result.Value = v result.Value = v
default: default:
return result, wrapNeoFSError(fmt.Errorf("chain/client: unsupported parameter %v", value)) return result, wrapFrostFSError(fmt.Errorf("chain/client: unsupported parameter %v", value))
} }
return result, nil return result, nil

View file

@ -26,8 +26,8 @@ const (
NNSBalanceContractName = "balance.frostfs" NNSBalanceContractName = "balance.frostfs"
// NNSContainerContractName is a name of the container contract in NNS. // NNSContainerContractName is a name of the container contract in NNS.
NNSContainerContractName = "container.frostfs" NNSContainerContractName = "container.frostfs"
// NNSNeoFSIDContractName is a name of the frostfsid contract in NNS. // NNSFrostFSIDContractName is a name of the frostfsid contract in NNS.
NNSNeoFSIDContractName = "frostfsid.frostfs" NNSFrostFSIDContractName = "frostfsid.frostfs"
// NNSNetmapContractName is a name of the netmap contract in NNS. // NNSNetmapContractName is a name of the netmap contract in NNS.
NNSNetmapContractName = "netmap.frostfs" NNSNetmapContractName = "netmap.frostfs"
// NNSProxyContractName is a name of the proxy contract in NNS. // NNSProxyContractName is a name of the proxy contract in NNS.

View file

@ -243,12 +243,12 @@ func (c *Client) GetNotaryDeposit() (res int64, err error) {
} }
if len(items) != 1 { if len(items) != 1 {
return 0, wrapNeoFSError(fmt.Errorf("%v: %w", notaryBalanceErrMsg, errUnexpectedItems)) return 0, wrapFrostFSError(fmt.Errorf("%v: %w", notaryBalanceErrMsg, errUnexpectedItems))
} }
bigIntDeposit, err := items[0].TryInteger() bigIntDeposit, err := items[0].TryInteger()
if err != nil { if err != nil {
return 0, wrapNeoFSError(fmt.Errorf("%v: %w", notaryBalanceErrMsg, err)) return 0, wrapFrostFSError(fmt.Errorf("%v: %w", notaryBalanceErrMsg, err))
} }
return bigIntDeposit.Int64(), nil return bigIntDeposit.Int64(), nil
@ -475,12 +475,12 @@ func (c *Client) notaryInvoke(committee, invokedByAlpha bool, contract util.Uint
// check invocation state // check invocation state
if test.State != HaltState { if test.State != HaltState {
return wrapNeoFSError(&notHaltStateError{state: test.State, exception: test.FaultException}) return wrapFrostFSError(&notHaltStateError{state: test.State, exception: test.FaultException})
} }
// if test invocation failed, then return error // if test invocation failed, then return error
if len(test.Script) == 0 { if len(test.Script) == 0 {
return wrapNeoFSError(errEmptyInvocationScript) return wrapFrostFSError(errEmptyInvocationScript)
} }
// after test invocation we build main multisig transaction // after test invocation we build main multisig transaction
@ -570,7 +570,7 @@ func (c *Client) notaryCosigners(invokedByAlpha bool, ir []*keys.PublicKey, comm
multisigScript, err := sc.CreateMultiSigRedeemScript(m, ir) multisigScript, err := sc.CreateMultiSigRedeemScript(m, ir)
if err != nil { if err != nil {
// wrap error as NeoFS-specific since the call is not related to any client // wrap error as NeoFS-specific since the call is not related to any client
return nil, wrapNeoFSError(fmt.Errorf("can't create ir multisig redeem script: %w", err)) return nil, wrapFrostFSError(fmt.Errorf("can't create ir multisig redeem script: %w", err))
} }
s = append(s, transaction.Signer{ s = append(s, transaction.Signer{
@ -704,7 +704,7 @@ func (c *Client) notaryMultisigAccount(ir []*keys.PublicKey, committee, invokedB
err := multisigAccount.ConvertMultisig(m, ir) err := multisigAccount.ConvertMultisig(m, ir)
if err != nil { if err != nil {
// wrap error as NeoFS-specific since the call is not related to any client // wrap error as NeoFS-specific since the call is not related to any client
return nil, wrapNeoFSError(fmt.Errorf("can't convert account to inner ring multisig wallet: %w", err)) return nil, wrapFrostFSError(fmt.Errorf("can't convert account to inner ring multisig wallet: %w", err))
} }
} else { } else {
// alphabet multisig redeem script is // alphabet multisig redeem script is
@ -713,7 +713,7 @@ func (c *Client) notaryMultisigAccount(ir []*keys.PublicKey, committee, invokedB
multisigAccount, err = notary.FakeMultisigAccount(m, ir) multisigAccount, err = notary.FakeMultisigAccount(m, ir)
if err != nil { if err != nil {
// wrap error as NeoFS-specific since the call is not related to any client // wrap error as NeoFS-specific since the call is not related to any client
return nil, wrapNeoFSError(fmt.Errorf("can't make inner ring multisig wallet: %w", err)) return nil, wrapFrostFSError(fmt.Errorf("can't make inner ring multisig wallet: %w", err))
} }
} }

View file

@ -98,7 +98,7 @@ func StringFromStackItem(param stackitem.Item) (string, error) {
func addFeeCheckerModifier(add int64) func(r *result.Invoke, t *transaction.Transaction) error { func addFeeCheckerModifier(add int64) func(r *result.Invoke, t *transaction.Transaction) error {
return func(r *result.Invoke, t *transaction.Transaction) error { return func(r *result.Invoke, t *transaction.Transaction) error {
if r.State != HaltState { if r.State != HaltState {
return wrapNeoFSError(&notHaltStateError{state: r.State, exception: r.FaultException}) return wrapFrostFSError(&notHaltStateError{state: r.State, exception: r.FaultException})
} }
t.SystemFee += add t.SystemFee += add