@agoric/cosmos 0.35.0-u12.0 → 0.35.0-u14.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.
Files changed (91) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/Makefile +25 -12
  3. package/ante/ante.go +7 -5
  4. package/ante/inbound_test.go +8 -0
  5. package/app/app.go +139 -108
  6. package/app/export.go +13 -9
  7. package/app/sim_test.go +4 -4
  8. package/cmd/agd/main.go +5 -3
  9. package/cmd/libdaemon/main.go +5 -2
  10. package/daemon/cmd/genaccounts.go +13 -9
  11. package/daemon/cmd/root.go +38 -17
  12. package/daemon/cmd/root_test.go +1 -1
  13. package/daemon/cmd/testnet.go +17 -6
  14. package/daemon/main.go +3 -2
  15. package/git-revision.txt +1 -1
  16. package/go.mod +117 -76
  17. package/go.sum +858 -210
  18. package/package.json +3 -3
  19. package/proto/agoric/vstorage/query.proto +53 -1
  20. package/scripts/protocgen.sh +12 -1
  21. package/third_party/proto/buf.yaml +1 -0
  22. package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +4 -1
  23. package/third_party/proto/cosmos/base/v1beta1/coin.proto +7 -4
  24. package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +16 -6
  25. package/third_party/proto/cosmos_proto/cosmos.proto +97 -0
  26. package/third_party/proto/google/api/annotations.proto +1 -1
  27. package/third_party/proto/google/api/http.proto +181 -120
  28. package/third_party/proto/google/api/httpbody.proto +9 -6
  29. package/third_party/proto/google/protobuf/any.proto +1 -7
  30. package/third_party/proto/ibc/core/channel/v1/channel.proto +15 -1
  31. package/third_party/proto/ibc/core/client/v1/client.proto +9 -6
  32. package/upgradegaia.sh +13 -4
  33. package/vm/action.go +133 -0
  34. package/vm/action_test.go +129 -0
  35. package/vm/controller.go +9 -16
  36. package/vm/core_proposals.go +31 -0
  37. package/x/lien/keeper/account.go +16 -11
  38. package/x/lien/keeper/keeper.go +5 -4
  39. package/x/lien/keeper/keeper_test.go +9 -9
  40. package/x/lien/lien.go +6 -4
  41. package/x/lien/lien_test.go +20 -16
  42. package/x/swingset/abci.go +25 -33
  43. package/x/swingset/client/cli/query.go +2 -2
  44. package/x/swingset/client/cli/tx.go +48 -33
  45. package/x/swingset/client/proposal_handler.go +2 -17
  46. package/x/swingset/keeper/keeper.go +69 -15
  47. package/x/swingset/keeper/keeper_test.go +1 -1
  48. package/x/swingset/keeper/migrations.go +7 -2
  49. package/x/swingset/keeper/msg_server.go +66 -49
  50. package/x/swingset/keeper/proposal.go +14 -8
  51. package/x/swingset/keeper/querier.go +14 -6
  52. package/x/swingset/keeper/swing_store_exports_handler.go +5 -1
  53. package/x/swingset/proposal_handler.go +3 -3
  54. package/x/swingset/swingset.go +4 -2
  55. package/x/swingset/types/codec.go +2 -2
  56. package/x/swingset/types/default-params.go +22 -16
  57. package/x/swingset/types/expected_keepers.go +11 -0
  58. package/x/swingset/types/msgs.go +43 -2
  59. package/x/swingset/types/msgs.pb.go +16 -16
  60. package/x/swingset/types/params.go +74 -0
  61. package/x/swingset/types/params_test.go +116 -0
  62. package/x/swingset/types/proposal.go +5 -5
  63. package/x/swingset/types/types.go +30 -28
  64. package/x/vbank/keeper/keeper.go +3 -2
  65. package/x/vbank/keeper/querier.go +6 -2
  66. package/x/vbank/keeper/rewards.go +1 -1
  67. package/x/vbank/vbank.go +19 -17
  68. package/x/vbank/vbank_test.go +18 -18
  69. package/x/vibc/handler.go +3 -8
  70. package/x/vibc/ibc.go +79 -126
  71. package/x/vibc/keeper/keeper.go +19 -18
  72. package/x/vibc/types/expected_keepers.go +13 -5
  73. package/x/vibc/types/msgs.go +1 -1
  74. package/x/vibc/types/msgs.pb.go +1 -1
  75. package/x/vstorage/README.md +138 -0
  76. package/x/vstorage/capdata/capdata.go +298 -0
  77. package/x/vstorage/capdata/capdata_test.go +352 -0
  78. package/x/vstorage/client/cli/query.go +51 -4
  79. package/x/vstorage/keeper/grpc_query.go +221 -0
  80. package/x/vstorage/keeper/keeper.go +3 -2
  81. package/x/vstorage/keeper/keeper_grpc_test.go +300 -0
  82. package/x/vstorage/keeper/keeper_test.go +1 -1
  83. package/x/vstorage/keeper/querier.go +6 -2
  84. package/x/vstorage/keeper/querier_test.go +112 -0
  85. package/x/vstorage/types/query.pb.go +646 -36
  86. package/x/vstorage/types/query.pb.gw.go +119 -0
  87. package/x/vstorage/vstorage.go +16 -15
  88. package/x/vstorage/vstorage_test.go +5 -5
  89. package/x/swingset/legacy/v32/params.go +0 -37
  90. package/x/swingset/legacy/v32/params_test.go +0 -133
  91. /package/{src/index.cjs → index.cjs} +0 -0
@@ -0,0 +1,112 @@
1
+ package keeper
2
+
3
+ import (
4
+ "bytes"
5
+ "testing"
6
+
7
+ agoric "github.com/Agoric/agoric-sdk/golang/cosmos/types"
8
+
9
+ abci "github.com/tendermint/tendermint/abci/types"
10
+
11
+ "github.com/cosmos/cosmos-sdk/codec"
12
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
13
+ )
14
+
15
+ func TestQuerier(t *testing.T) {
16
+ testKit := makeTestKit()
17
+ ctx, keeper := testKit.ctx, testKit.vstorageKeeper
18
+ legacyQuerierCdc := codec.NewAminoCodec(codec.NewLegacyAmino())
19
+ querier := NewQuerier(keeper, legacyQuerierCdc.LegacyAmino)
20
+
21
+ // Populate mock data
22
+ keeper.SetStorage(ctx, agoric.NewKVEntry("foo.bar", "42"))
23
+ keeper.SetStorage(ctx, agoric.NewKVEntry("foo.baz", "hello"))
24
+
25
+ type testCase struct {
26
+ label string
27
+ path []string
28
+ expected []byte
29
+ err *sdkerrors.Error
30
+ }
31
+ testCases := []testCase{}
32
+
33
+ // Test invalid endpoint
34
+ testCases = append(testCases, []testCase{
35
+ {label: "invalid endpoint",
36
+ path: []string{"foo"},
37
+ err: sdkerrors.ErrUnknownRequest,
38
+ },
39
+ }...)
40
+
41
+ // Test invalid arguments to valid data and children endpoints
42
+ for _, endpoint := range []string{"data", "children"} {
43
+ testCases = append(testCases, []testCase{
44
+ {label: endpoint + ": no entry path",
45
+ path: []string{endpoint},
46
+ err: sdkerrors.ErrInvalidRequest,
47
+ },
48
+ {label: endpoint + ": too many segments",
49
+ path: []string{endpoint, "foo", "bar"},
50
+ err: sdkerrors.ErrInvalidRequest,
51
+ },
52
+ {label: endpoint + ": invalid path",
53
+ path: []string{endpoint, ".", ""},
54
+ err: sdkerrors.ErrInvalidRequest,
55
+ },
56
+ }...)
57
+ }
58
+
59
+ // Test data endpoint with valid vstorage path
60
+ testCases = append(testCases, []testCase{
61
+ {label: "data: non-existent path",
62
+ path: []string{"data", "bar"},
63
+ // DO NOT CHANGE
64
+ // The UI and CLI check for the specific cosmos-sdk error code & codespace
65
+ err: sdkerrors.ErrNotFound,
66
+ },
67
+ {label: "data: path with no data",
68
+ path: []string{"data", "foo"},
69
+ // DO NOT CHANGE
70
+ // The UI and CLI check for the specific cosmos-sdk error code & codespace
71
+ err: sdkerrors.ErrNotFound,
72
+ },
73
+ {label: "data: path with data",
74
+ path: []string{"data", "foo.bar"},
75
+ expected: []byte("{\n \"value\": \"42\"\n}"),
76
+ },
77
+ }...)
78
+
79
+ // Ensure stability of cosmos-sdk error codes
80
+ if codespace, code, _ := sdkerrors.ABCIInfo(sdkerrors.ErrNotFound, true); codespace != "sdk" || code != 38 {
81
+ t.Errorf("cosmos-sdk ErrNotFound has codespace %s, code %d, expected sdk/38", codespace, code)
82
+ }
83
+
84
+ // Test children endpoint with valid vstorage path
85
+ testCases = append(testCases, []testCase{
86
+ {label: "children: non-existent path",
87
+ path: []string{"children", "bar"},
88
+ expected: []byte("{\n \"children\": []\n}"),
89
+ },
90
+ {label: "children: path with no children",
91
+ path: []string{"children", "foo.bar"},
92
+ expected: []byte("{\n \"children\": []\n}"),
93
+ },
94
+ {label: "children: path with children",
95
+ path: []string{"children", "foo"},
96
+ expected: []byte("{\n \"children\": [\n \"bar\",\n \"baz\"\n ]\n}"),
97
+ },
98
+ }...)
99
+
100
+ for _, desc := range testCases {
101
+ res, err := querier(ctx, desc.path, abci.RequestQuery{})
102
+ if desc.err != nil {
103
+ if err == nil {
104
+ t.Errorf("%s: got no error, want error %q", desc.label, *desc.err)
105
+ } else if codespace, code, _ := sdkerrors.ABCIInfo(err, true); codespace != desc.err.Codespace() || code != desc.err.ABCICode() {
106
+ t.Errorf("%s: got error %v, want error %q", desc.label, err, *desc.err)
107
+ }
108
+ } else if !bytes.Equal(res, desc.expected) {
109
+ t.Errorf("%s: wrong result: %#v, expected %#v", desc.label, string(res), string(desc.expected))
110
+ }
111
+ }
112
+ }