forked from TrueCloudLab/frostfs-node
[#1558] morph/client: Remove "could not"/"can't"/"failed to" from error messages
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
91d9dc2676
commit
7151c71d51
19 changed files with 55 additions and 55 deletions
|
@ -62,7 +62,7 @@ const (
|
|||
notaryExpirationOfMethod = "expirationOf"
|
||||
setDesignateMethod = "designateAsRole"
|
||||
|
||||
notaryBalanceErrMsg = "can't fetch notary balance"
|
||||
notaryBalanceErrMsg = "fetch notary balance"
|
||||
notaryNotEnabledPanicMsg = "notary support was not enabled on this client"
|
||||
)
|
||||
|
||||
|
@ -155,12 +155,12 @@ func (c *Client) DepositNotary(ctx context.Context, amount fixedn.Fixed8, delta
|
|||
|
||||
bc, err := c.rpcActor.GetBlockCount()
|
||||
if err != nil {
|
||||
return util.Uint256{}, fmt.Errorf("can't get blockchain height: %w", err)
|
||||
return util.Uint256{}, fmt.Errorf("get blockchain height: %w", err)
|
||||
}
|
||||
|
||||
currentTill, err := c.depositExpirationOf()
|
||||
if err != nil {
|
||||
return util.Uint256{}, fmt.Errorf("can't get previous expiration value: %w", err)
|
||||
return util.Uint256{}, fmt.Errorf("get previous expiration value: %w", err)
|
||||
}
|
||||
|
||||
till := max(int64(bc+delta), currentTill)
|
||||
|
@ -197,7 +197,7 @@ func (c *Client) depositNotary(ctx context.Context, amount fixedn.Fixed8, till i
|
|||
[]any{c.acc.PrivateKey().GetScriptHash(), till})
|
||||
if err != nil {
|
||||
if !errors.Is(err, neorpc.ErrAlreadyExists) {
|
||||
return util.Uint256{}, 0, fmt.Errorf("can't make notary deposit: %w", err)
|
||||
return util.Uint256{}, 0, fmt.Errorf("make notary deposit: %w", err)
|
||||
}
|
||||
|
||||
// Transaction is already in mempool waiting to be processed.
|
||||
|
@ -289,7 +289,7 @@ func (c *Client) UpdateNotaryList(ctx context.Context, prm UpdateNotaryListPrm)
|
|||
|
||||
nonce, vub, err := c.CalculateNonceAndVUB(&prm.hash)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not calculate nonce and `valicUntilBlock` values: %w", err)
|
||||
return fmt.Errorf("calculate nonce and `valicUntilBlock` values: %w", err)
|
||||
}
|
||||
|
||||
return c.notaryInvokeAsCommittee(
|
||||
|
@ -338,7 +338,7 @@ func (c *Client) UpdateNeoFSAlphabetList(ctx context.Context, prm UpdateAlphabet
|
|||
|
||||
nonce, vub, err := c.CalculateNonceAndVUB(&prm.hash)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not calculate nonce and `valicUntilBlock` values: %w", err)
|
||||
return fmt.Errorf("calculate nonce and `valicUntilBlock` values: %w", err)
|
||||
}
|
||||
|
||||
return c.notaryInvokeAsCommittee(
|
||||
|
@ -407,7 +407,7 @@ func (c *Client) NotarySignAndInvokeTX(mainTx *transaction.Transaction) error {
|
|||
|
||||
alphabetList, err := c.notary.alphabetSource()
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not fetch current alphabet keys: %w", err)
|
||||
return fmt.Errorf("fetch current alphabet keys: %w", err)
|
||||
}
|
||||
|
||||
cosigners, err := c.notaryCosignersFromTx(mainTx, alphabetList)
|
||||
|
@ -529,24 +529,24 @@ func (c *Client) notaryCosignersFromTx(mainTx *transaction.Transaction, alphabet
|
|||
if ok {
|
||||
pub, err := keys.NewPublicKeyFromBytes(pubBytes, elliptic.P256())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse verification script of signer #2: invalid public key: %w", err)
|
||||
return nil, fmt.Errorf("parse verification script of signer #2: invalid public key: %w", err)
|
||||
}
|
||||
acc = notary.FakeSimpleAccount(pub)
|
||||
} else {
|
||||
m, pubsBytes, ok := vm.ParseMultiSigContract(script)
|
||||
if !ok {
|
||||
return nil, errors.New("failed to parse verification script of signer #2: unknown witness type")
|
||||
return nil, errors.New("parse verification script of signer #2: unknown witness type")
|
||||
}
|
||||
pubs := make(keys.PublicKeys, len(pubsBytes))
|
||||
for i := range pubs {
|
||||
pubs[i], err = keys.NewPublicKeyFromBytes(pubsBytes[i], elliptic.P256())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse verification script of signer #2: invalid public key #%d: %w", i, err)
|
||||
return nil, fmt.Errorf("parse verification script of signer #2: invalid public key #%d: %w", i, err)
|
||||
}
|
||||
}
|
||||
acc, err = notary.FakeMultisigAccount(m, pubs)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create fake account for signer #2: %w", err)
|
||||
return nil, fmt.Errorf("create fake account for signer #2: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -623,7 +623,7 @@ func (c *Client) notaryMultisigAccount(ir []*keys.PublicKey, committee, invokedB
|
|||
err := multisigAccount.ConvertMultisig(m, ir)
|
||||
if err != nil {
|
||||
// wrap error as FrostFS-specific since the call is not related to any client
|
||||
return nil, wrapFrostFSError(fmt.Errorf("can't convert account to inner ring multisig wallet: %w", err))
|
||||
return nil, wrapFrostFSError(fmt.Errorf("convert account to inner ring multisig wallet: %w", err))
|
||||
}
|
||||
} else {
|
||||
// alphabet multisig redeem script is
|
||||
|
@ -632,7 +632,7 @@ func (c *Client) notaryMultisigAccount(ir []*keys.PublicKey, committee, invokedB
|
|||
multisigAccount, err = notary.FakeMultisigAccount(m, ir)
|
||||
if err != nil {
|
||||
// wrap error as FrostFS-specific since the call is not related to any client
|
||||
return nil, wrapFrostFSError(fmt.Errorf("can't make inner ring multisig wallet: %w", err))
|
||||
return nil, wrapFrostFSError(fmt.Errorf("make inner ring multisig wallet: %w", err))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ func (c *Client) notaryMultisigAccount(ir []*keys.PublicKey, committee, invokedB
|
|||
func (c *Client) notaryTxValidationLimit() (uint32, error) {
|
||||
bc, err := c.rpcActor.GetBlockCount()
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("can't get current blockchain height: %w", err)
|
||||
return 0, fmt.Errorf("get current blockchain height: %w", err)
|
||||
}
|
||||
|
||||
minTime := bc + c.notary.txValidTime
|
||||
|
@ -663,7 +663,7 @@ func (c *Client) depositExpirationOf() (int64, error) {
|
|||
|
||||
currentTillBig, err := expirationRes[0].TryInteger()
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("can't parse deposit till value: %w", err)
|
||||
return 0, fmt.Errorf("parse deposit till value: %w", err)
|
||||
}
|
||||
|
||||
return currentTillBig.Int64(), nil
|
||||
|
@ -742,12 +742,12 @@ func alreadyOnChainError(err error) bool {
|
|||
func CalculateNotaryDepositAmount(c *Client, gasMul, gasDiv int64) (fixedn.Fixed8, error) {
|
||||
notaryBalance, err := c.GetNotaryDeposit()
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("could not get notary balance: %w", err)
|
||||
return 0, fmt.Errorf("get notary balance: %w", err)
|
||||
}
|
||||
|
||||
gasBalance, err := c.GasBalance()
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("could not get GAS balance: %w", err)
|
||||
return 0, fmt.Errorf("get GAS balance: %w", err)
|
||||
}
|
||||
|
||||
if gasBalance == 0 {
|
||||
|
@ -796,12 +796,12 @@ func (c *Client) calculateNonceAndVUB(hash *util.Uint256, roundBlockHeight bool)
|
|||
if hash != nil {
|
||||
height, err = c.getTransactionHeight(*hash)
|
||||
if err != nil {
|
||||
return 0, 0, fmt.Errorf("could not get transaction height: %w", err)
|
||||
return 0, 0, fmt.Errorf("get transaction height: %w", err)
|
||||
}
|
||||
} else {
|
||||
height, err = c.rpcActor.GetBlockCount()
|
||||
if err != nil {
|
||||
return 0, 0, fmt.Errorf("could not get chain height: %w", err)
|
||||
return 0, 0, fmt.Errorf("get chain height: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue