mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 23:42:23 +00:00
Merge pull request #3374 from nspcc-dev/improve-err
*: improve error text for System.Crypto.CheckMultisig handling
This commit is contained in:
commit
f8ca51db93
2 changed files with 3 additions and 3 deletions
|
@ -18,14 +18,14 @@ import (
|
||||||
func ECDSASecp256r1CheckMultisig(ic *interop.Context) error {
|
func ECDSASecp256r1CheckMultisig(ic *interop.Context) error {
|
||||||
pkeys, err := ic.VM.Estack().PopSigElements()
|
pkeys, err := ic.VM.Estack().PopSigElements()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("wrong parameters: %w", err)
|
return fmt.Errorf("wrong key parameters: %w", err)
|
||||||
}
|
}
|
||||||
if !ic.VM.AddGas(ic.BaseExecFee() * fee.ECDSAVerifyPrice * int64(len(pkeys))) {
|
if !ic.VM.AddGas(ic.BaseExecFee() * fee.ECDSAVerifyPrice * int64(len(pkeys))) {
|
||||||
return errors.New("gas limit exceeded")
|
return errors.New("gas limit exceeded")
|
||||||
}
|
}
|
||||||
sigs, err := ic.VM.Estack().PopSigElements()
|
sigs, err := ic.VM.Estack().PopSigElements()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("wrong parameters: %w", err)
|
return fmt.Errorf("wrong signature parameters: %w", err)
|
||||||
}
|
}
|
||||||
// It's ok to have more keys than there are signatures (it would
|
// It's ok to have more keys than there are signatures (it would
|
||||||
// just mean that some keys didn't sign), but not the other way around.
|
// just mean that some keys didn't sign), but not the other way around.
|
||||||
|
|
|
@ -345,7 +345,7 @@ func (s *Stack) PopSigElements() ([][]byte, error) {
|
||||||
default:
|
default:
|
||||||
num = int(item.BigInt().Int64())
|
num = int(item.BigInt().Int64())
|
||||||
if num < 1 || num > s.Len() {
|
if num < 1 || num > s.Len() {
|
||||||
return nil, fmt.Errorf("wrong number of elements: %d", num)
|
return nil, fmt.Errorf("wrong number of elements: need %d, have %d", num, s.Len())
|
||||||
}
|
}
|
||||||
elems = make([][]byte, num)
|
elems = make([][]byte, num)
|
||||||
for i := 0; i < num; i++ {
|
for i := 0; i < num; i++ {
|
||||||
|
|
Loading…
Reference in a new issue