@agoric/cosmos 0.34.2-dev-bef63e5.0 → 0.34.2-dev-92855b2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/git-revision.txt CHANGED
@@ -1 +1 @@
1
- bef63e5
1
+ 92855b2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/cosmos",
3
- "version": "0.34.2-dev-bef63e5.0+bef63e5",
3
+ "version": "0.34.2-dev-92855b2.0+92855b2",
4
4
  "description": "Connect JS to the Cosmos blockchain SDK",
5
5
  "parsers": {
6
6
  "js": "mjs"
@@ -38,5 +38,5 @@
38
38
  "typeCoverage": {
39
39
  "atLeast": 0
40
40
  },
41
- "gitHead": "bef63e5f0c6ad6a553b3eef69d722c060995a247"
41
+ "gitHead": "92855b2b3fb3f6e533cdbebccb7aa92f7448d331"
42
42
  }
@@ -229,7 +229,7 @@ func NewCmdSubmitCoreEvalProposal() *cobra.Command {
229
229
  Specify at least one pair of permit.json and code.js files`,
230
230
  RunE: func(cmd *cobra.Command, args []string) error {
231
231
  if len(args)%2 != 0 {
232
- return fmt.Errorf("must specify an even number of permit.json and code.js files")
232
+ return fmt.Errorf("must specify paired permit.json and code.js files")
233
233
  }
234
234
 
235
235
  clientCtx, err := client.GetClientTxContext(cmd)
@@ -44,7 +44,7 @@ func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
44
44
  case LegacyQueryKeys:
45
45
  return legacyQueryKeys(ctx, strings.Join(path[1:], "/"), req, keeper, legacyQuerierCdc)
46
46
  default:
47
- return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown swingset query endpoint")
47
+ return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown swingset query path")
48
48
  }
49
49
  }
50
50
  }
@@ -3,6 +3,7 @@ package types
3
3
  import (
4
4
  "encoding/json"
5
5
  "errors"
6
+ "fmt"
6
7
 
7
8
  vstoragetypes "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/types"
8
9
  sdk "github.com/cosmos/cosmos-sdk/types"
@@ -25,18 +26,16 @@ func NewEgress(nickname string, peer sdk.AccAddress, powerFlags []string) *Egres
25
26
  }
26
27
  }
27
28
 
28
- // FIXME: Should have @endo/nat
29
+ // Nat is analogous to @endo/nat
30
+ // https://github.com/endojs/endo/blob/master/packages/nat
29
31
  func Nat(num float64) (uint64, error) {
30
- if num < 0 {
31
- return 0, errors.New("Not a natural")
32
- }
33
-
34
- nat := uint64(num)
35
- if float64(nat) != num {
36
- return 0, errors.New("Not a precise integer")
32
+ if 0 <= num && num < (1<<53) {
33
+ nat := uint64(num)
34
+ if float64(nat) == num {
35
+ return nat, nil
36
+ }
37
37
  }
38
-
39
- return nat, nil
38
+ return 0, errors.New("Not a Nat")
40
39
  }
41
40
 
42
41
  type Messages struct {
@@ -60,11 +59,11 @@ func UnmarshalMessagesJSON(jsonString string) (ret *Messages, err error) {
60
59
 
61
60
  ackFloat, ok := packet[1].(float64)
62
61
  if !ok {
63
- return nil, errors.New("Ack is not an integer")
62
+ return nil, errors.New("Ack is not a number")
64
63
  }
65
64
  ret.Ack, err = Nat(ackFloat)
66
65
  if err != nil {
67
- return nil, err
66
+ return nil, errors.New("Ack is not a Nat")
68
67
  }
69
68
 
70
69
  msgs, ok := packet[0].([]interface{})
@@ -77,21 +76,21 @@ func UnmarshalMessagesJSON(jsonString string) (ret *Messages, err error) {
77
76
  for i, rawMsg := range msgs {
78
77
  arrMsg, ok := rawMsg.([]interface{})
79
78
  if !ok || len(arrMsg) != 2 {
80
- return nil, errors.New("Message is not a pair")
79
+ return nil, fmt.Errorf("Messages[%d] is not a pair", i)
81
80
  }
82
81
 
83
82
  numFloat, ok := arrMsg[0].(float64)
84
83
  if !ok {
85
- return nil, errors.New("Message Num is not an integer")
84
+ return nil, fmt.Errorf("Messages[%d] Num is not a number", i)
86
85
  }
87
86
  ret.Nums[i], err = Nat(numFloat)
88
87
  if err != nil {
89
- return nil, errors.New("Message num is not a Nat")
88
+ return nil, fmt.Errorf("Messages[%d] Num is not a Nat", i)
90
89
  }
91
90
 
92
91
  ret.Messages[i], ok = arrMsg[1].(string)
93
92
  if !ok {
94
- return nil, errors.New("Message is not a string")
93
+ return nil, fmt.Errorf("Messages[%d] body is not a string", i)
95
94
  }
96
95
  }
97
96
 
@@ -23,7 +23,7 @@ func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
23
23
  return queryState(ctx, path[1:], req, k, legacyQuerierCdc)
24
24
 
25
25
  default:
26
- return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown query path: %s", path[0])
26
+ return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown vbank query path")
27
27
  }
28
28
  }
29
29
  }
@@ -51,7 +51,7 @@ func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
51
51
  }
52
52
  return queryChildren(ctx, entryPath, req, keeper, legacyQuerierCdc)
53
53
  default:
54
- return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown vstorage query endpoint")
54
+ return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "unknown vstorage query path")
55
55
  }
56
56
  }
57
57
  }