[#73] morph: Rename vars that collide with package names
Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
parent
c1742e581b
commit
8c092eebba
1 changed files with 23 additions and 23 deletions
|
@ -414,43 +414,43 @@ func (c *Client) roleList(r noderoles.Role) (keys.PublicKeys, error) {
|
||||||
//
|
//
|
||||||
// Wraps any error to frostfsError.
|
// Wraps any error to frostfsError.
|
||||||
func toStackParameter(value any) (sc.Parameter, error) {
|
func toStackParameter(value any) (sc.Parameter, error) {
|
||||||
var result = sc.Parameter{
|
var res = sc.Parameter{
|
||||||
Value: value,
|
Value: value,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch v := value.(type) {
|
switch v := value.(type) {
|
||||||
case []byte:
|
case []byte:
|
||||||
result.Type = sc.ByteArrayType
|
res.Type = sc.ByteArrayType
|
||||||
case int:
|
case int:
|
||||||
result.Type = sc.IntegerType
|
res.Type = sc.IntegerType
|
||||||
result.Value = big.NewInt(int64(v))
|
res.Value = big.NewInt(int64(v))
|
||||||
case int64:
|
case int64:
|
||||||
result.Type = sc.IntegerType
|
res.Type = sc.IntegerType
|
||||||
result.Value = big.NewInt(v)
|
res.Value = big.NewInt(v)
|
||||||
case uint64:
|
case uint64:
|
||||||
result.Type = sc.IntegerType
|
res.Type = sc.IntegerType
|
||||||
result.Value = new(big.Int).SetUint64(v)
|
res.Value = new(big.Int).SetUint64(v)
|
||||||
case [][]byte:
|
case [][]byte:
|
||||||
arr := make([]sc.Parameter, 0, len(v))
|
arr := make([]sc.Parameter, 0, len(v))
|
||||||
for i := range v {
|
for i := range v {
|
||||||
elem, err := toStackParameter(v[i])
|
elem, err := toStackParameter(v[i])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
arr = append(arr, elem)
|
arr = append(arr, elem)
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Type = sc.ArrayType
|
res.Type = sc.ArrayType
|
||||||
result.Value = arr
|
res.Value = arr
|
||||||
case string:
|
case string:
|
||||||
result.Type = sc.StringType
|
res.Type = sc.StringType
|
||||||
case util.Uint160:
|
case util.Uint160:
|
||||||
result.Type = sc.ByteArrayType
|
res.Type = sc.ByteArrayType
|
||||||
result.Value = v.BytesBE()
|
res.Value = v.BytesBE()
|
||||||
case noderoles.Role:
|
case noderoles.Role:
|
||||||
result.Type = sc.IntegerType
|
res.Type = sc.IntegerType
|
||||||
result.Value = big.NewInt(int64(v))
|
res.Value = big.NewInt(int64(v))
|
||||||
case keys.PublicKeys:
|
case keys.PublicKeys:
|
||||||
arr := make([][]byte, 0, len(v))
|
arr := make([][]byte, 0, len(v))
|
||||||
for i := range v {
|
for i := range v {
|
||||||
|
@ -459,13 +459,13 @@ func toStackParameter(value any) (sc.Parameter, error) {
|
||||||
|
|
||||||
return toStackParameter(arr)
|
return toStackParameter(arr)
|
||||||
case bool:
|
case bool:
|
||||||
result.Type = sc.BoolType
|
res.Type = sc.BoolType
|
||||||
result.Value = v
|
res.Value = v
|
||||||
default:
|
default:
|
||||||
return result, wrapFrostFSError(fmt.Errorf("chain/client: unsupported parameter %v", value))
|
return res, wrapFrostFSError(fmt.Errorf("chain/client: unsupported parameter %v", value))
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MagicNumber returns the magic number of the network
|
// MagicNumber returns the magic number of the network
|
||||||
|
@ -509,7 +509,7 @@ func (c *Client) MsPerBlock() (res int64, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsValidScript returns true if invocation script executes with HALT state.
|
// IsValidScript returns true if invocation script executes with HALT state.
|
||||||
func (c *Client) IsValidScript(script []byte, signers []transaction.Signer) (res bool, err error) {
|
func (c *Client) IsValidScript(script []byte, signers []transaction.Signer) (valid bool, err error) {
|
||||||
c.switchLock.RLock()
|
c.switchLock.RLock()
|
||||||
defer c.switchLock.RUnlock()
|
defer c.switchLock.RUnlock()
|
||||||
|
|
||||||
|
@ -517,12 +517,12 @@ func (c *Client) IsValidScript(script []byte, signers []transaction.Signer) (res
|
||||||
return false, ErrConnectionLost
|
return false, ErrConnectionLost
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := c.client.InvokeScript(script, signers)
|
res, err := c.client.InvokeScript(script, signers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, fmt.Errorf("invokeScript: %w", err)
|
return false, fmt.Errorf("invokeScript: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.State == vmstate.Halt.String(), nil
|
return res.State == vmstate.Halt.String(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NotificationChannel returns channel than receives subscribed
|
// NotificationChannel returns channel than receives subscribed
|
||||||
|
|
Loading…
Reference in a new issue