forked from TrueCloudLab/frostfs-node
[#521] *: use stdlib errors
package
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
43e575cec2
commit
71b87155ef
171 changed files with 825 additions and 674 deletions
|
@ -2,13 +2,13 @@ package neofs
|
|||
|
||||
import (
|
||||
"crypto/elliptic"
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type Unbind struct {
|
||||
|
@ -36,30 +36,30 @@ func ParseUnbind(params []stackitem.Item) (event.Event, error) {
|
|||
// parse user
|
||||
user, err := client.BytesFromStackItem(params[0])
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get bind user")
|
||||
return nil, fmt.Errorf("could not get bind user: %w", err)
|
||||
}
|
||||
|
||||
ev.user, err = util.Uint160DecodeBytesBE(user)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not convert unbind user to uint160")
|
||||
return nil, fmt.Errorf("could not convert unbind user to uint160: %w", err)
|
||||
}
|
||||
|
||||
// parse keys
|
||||
unbindKeys, err := client.ArrayFromStackItem(params[1])
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get unbind keys")
|
||||
return nil, fmt.Errorf("could not get unbind keys: %w", err)
|
||||
}
|
||||
|
||||
ev.keys = make([]*keys.PublicKey, 0, len(unbindKeys))
|
||||
for i := range unbindKeys {
|
||||
rawKey, err := client.BytesFromStackItem(unbindKeys[i])
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get unbind public key")
|
||||
return nil, fmt.Errorf("could not get unbind public key: %w", err)
|
||||
}
|
||||
|
||||
key, err := keys.NewPublicKeyFromBytes(rawKey, elliptic.P256())
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not parse unbind public key")
|
||||
return nil, fmt.Errorf("could not parse unbind public key: %w", err)
|
||||
}
|
||||
|
||||
ev.keys = append(ev.keys, key)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue