@agoric/cosmos 0.34.1-dev-b8d6697.0 → 0.34.2-calypso-dev-84eb287.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 (188) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/MAINTAINERS.md +3 -0
  3. package/Makefile +65 -38
  4. package/ante/ante.go +11 -11
  5. package/ante/inbound_test.go +11 -2
  6. package/ante/vm_admission.go +2 -1
  7. package/app/app.go +396 -211
  8. package/app/export.go +13 -9
  9. package/app/sim_test.go +4 -4
  10. package/app/upgrade.go +215 -0
  11. package/binding.gyp.in +1 -1
  12. package/cmd/agd/agvm.go +42 -0
  13. package/cmd/agd/main.go +134 -10
  14. package/cmd/libdaemon/main.go +67 -53
  15. package/cmd/libdaemon/main_test.go +37 -0
  16. package/daemon/cmd/genaccounts.go +22 -18
  17. package/daemon/cmd/root.go +253 -52
  18. package/daemon/cmd/root_test.go +190 -2
  19. package/daemon/cmd/testnet.go +17 -6
  20. package/daemon/main.go +6 -3
  21. package/e2e_test/Makefile +29 -0
  22. package/e2e_test/README.md +100 -0
  23. package/e2e_test/go.mod +217 -0
  24. package/e2e_test/go.sum +1323 -0
  25. package/e2e_test/ibc_conformance_test.go +56 -0
  26. package/e2e_test/pfm_test.go +613 -0
  27. package/e2e_test/util.go +271 -0
  28. package/git-revision.txt +1 -1
  29. package/go.mod +130 -78
  30. package/go.sum +865 -213
  31. package/package.json +9 -5
  32. package/proto/agoric/swingset/genesis.proto +14 -0
  33. package/proto/agoric/swingset/swingset.proto +6 -3
  34. package/proto/agoric/vlocalchain/.clang-format +7 -0
  35. package/proto/agoric/vlocalchain/vlocalchain.proto +31 -0
  36. package/proto/agoric/vstorage/query.proto +53 -1
  37. package/proto/agoric/vtransfer/genesis.proto +18 -0
  38. package/scripts/protocgen.sh +16 -6
  39. package/third_party/proto/buf.yaml +1 -0
  40. package/third_party/proto/cosmos/base/query/v1beta1/pagination.proto +4 -1
  41. package/third_party/proto/cosmos/base/v1beta1/coin.proto +7 -4
  42. package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +16 -6
  43. package/third_party/proto/cosmos_proto/cosmos.proto +97 -0
  44. package/third_party/proto/google/api/annotations.proto +1 -1
  45. package/third_party/proto/google/api/http.proto +181 -120
  46. package/third_party/proto/google/api/httpbody.proto +9 -6
  47. package/third_party/proto/google/protobuf/any.proto +1 -7
  48. package/third_party/proto/ibc/core/channel/v1/channel.proto +15 -1
  49. package/third_party/proto/ibc/core/client/v1/client.proto +9 -6
  50. package/types/kv_entry.go +114 -0
  51. package/types/kv_entry_helpers.go +276 -0
  52. package/types/kv_entry_helpers_test.go +237 -0
  53. package/types/kv_entry_test.go +143 -0
  54. package/upgradegaia.sh +21 -12
  55. package/vm/action.go +134 -0
  56. package/vm/action_test.go +149 -0
  57. package/vm/client.go +113 -0
  58. package/vm/client_test.go +182 -0
  59. package/vm/controller.go +18 -49
  60. package/vm/core_proposals.go +51 -0
  61. package/vm/jsonrpcconn/jsonrpcconn.go +160 -0
  62. package/vm/jsonrpcconn/jsonrpcconn_test.go +126 -0
  63. package/vm/proto_json.go +38 -0
  64. package/vm/proto_json_test.go +103 -0
  65. package/vm/server.go +124 -0
  66. package/x/swingset/abci.go +26 -37
  67. package/x/swingset/alias.go +9 -6
  68. package/x/swingset/client/cli/query.go +2 -2
  69. package/x/swingset/client/cli/tx.go +52 -33
  70. package/x/swingset/client/proposal_handler.go +2 -17
  71. package/x/swingset/genesis.go +163 -37
  72. package/x/swingset/handler.go +2 -1
  73. package/x/swingset/keeper/extension_snapshotter.go +309 -0
  74. package/x/swingset/keeper/extension_snapshotter_test.go +104 -0
  75. package/x/swingset/keeper/keeper.go +95 -48
  76. package/x/swingset/keeper/keeper_test.go +77 -0
  77. package/x/swingset/keeper/migrations.go +7 -2
  78. package/x/swingset/keeper/msg_server.go +71 -56
  79. package/x/swingset/keeper/proposal.go +15 -9
  80. package/x/swingset/keeper/querier.go +24 -15
  81. package/x/swingset/keeper/swing_store_exports_handler.go +872 -0
  82. package/x/swingset/keeper/swing_store_exports_handler_test.go +247 -0
  83. package/x/swingset/keeper/test_utils.go +16 -0
  84. package/x/swingset/module.go +33 -11
  85. package/x/swingset/proposal_handler.go +5 -4
  86. package/x/swingset/swingset.go +73 -0
  87. package/x/swingset/testing/queue.go +17 -0
  88. package/x/swingset/types/codec.go +2 -2
  89. package/x/swingset/types/default-params.go +23 -17
  90. package/x/swingset/types/expected_keepers.go +14 -2
  91. package/x/swingset/types/genesis.pb.go +361 -18
  92. package/x/swingset/types/msgs.go +87 -26
  93. package/x/swingset/types/msgs.pb.go +16 -16
  94. package/x/swingset/types/params.go +76 -1
  95. package/x/swingset/types/params_test.go +116 -0
  96. package/x/swingset/types/proposal.go +10 -9
  97. package/x/swingset/types/swingset.pb.go +83 -81
  98. package/x/swingset/types/types.go +30 -28
  99. package/x/vbank/genesis.go +0 -2
  100. package/x/vbank/handler.go +2 -1
  101. package/x/vbank/keeper/keeper.go +3 -2
  102. package/x/vbank/keeper/querier.go +9 -4
  103. package/x/vbank/keeper/rewards.go +1 -1
  104. package/x/vbank/module.go +0 -5
  105. package/x/vbank/types/msgs.go +0 -12
  106. package/x/vbank/vbank.go +34 -32
  107. package/x/vbank/vbank_test.go +20 -20
  108. package/x/vibc/alias.go +3 -0
  109. package/x/vibc/handler.go +17 -15
  110. package/x/vibc/keeper/keeper.go +113 -89
  111. package/x/vibc/keeper/triggers.go +101 -0
  112. package/x/vibc/module.go +5 -8
  113. package/x/vibc/types/expected_keepers.go +28 -6
  114. package/x/vibc/types/ibc_module.go +336 -0
  115. package/x/vibc/types/msgs.go +1 -1
  116. package/x/vibc/types/msgs.pb.go +1 -1
  117. package/x/vibc/types/receiver.go +170 -0
  118. package/x/vlocalchain/alias.go +19 -0
  119. package/x/vlocalchain/handler.go +21 -0
  120. package/x/vlocalchain/keeper/keeper.go +279 -0
  121. package/x/vlocalchain/keeper/keeper_test.go +97 -0
  122. package/x/vlocalchain/types/codec.go +34 -0
  123. package/x/vlocalchain/types/key.go +27 -0
  124. package/x/vlocalchain/types/msgs.go +16 -0
  125. package/x/vlocalchain/types/vlocalchain.pb.go +1072 -0
  126. package/x/vlocalchain/vlocalchain.go +114 -0
  127. package/x/vlocalchain/vlocalchain_test.go +434 -0
  128. package/x/vstorage/README.md +138 -0
  129. package/x/vstorage/capdata/capdata.go +298 -0
  130. package/x/vstorage/capdata/capdata_test.go +352 -0
  131. package/x/vstorage/client/cli/query.go +51 -4
  132. package/x/vstorage/genesis.go +0 -3
  133. package/x/vstorage/handler.go +2 -1
  134. package/x/vstorage/keeper/grpc_query.go +220 -0
  135. package/x/vstorage/keeper/keeper.go +75 -57
  136. package/x/vstorage/keeper/keeper_grpc_test.go +300 -0
  137. package/x/vstorage/keeper/keeper_test.go +40 -62
  138. package/x/vstorage/keeper/querier.go +39 -14
  139. package/x/vstorage/keeper/querier_test.go +113 -0
  140. package/x/vstorage/module.go +0 -5
  141. package/x/vstorage/testing/queue.go +27 -0
  142. package/x/vstorage/types/path_keys.go +22 -10
  143. package/x/vstorage/types/path_keys_test.go +84 -18
  144. package/x/vstorage/types/query.pb.go +646 -36
  145. package/x/vstorage/types/query.pb.gw.go +119 -0
  146. package/x/vstorage/types/types.go +0 -66
  147. package/x/vstorage/vstorage.go +33 -35
  148. package/x/vstorage/vstorage_test.go +19 -19
  149. package/x/vtransfer/alias.go +13 -0
  150. package/x/vtransfer/genesis.go +39 -0
  151. package/x/vtransfer/genesis_test.go +12 -0
  152. package/x/vtransfer/handler.go +20 -0
  153. package/x/vtransfer/ibc_middleware.go +186 -0
  154. package/x/vtransfer/ibc_middleware_test.go +448 -0
  155. package/x/vtransfer/keeper/keeper.go +281 -0
  156. package/x/vtransfer/module.go +124 -0
  157. package/x/vtransfer/types/expected_keepers.go +38 -0
  158. package/x/vtransfer/types/genesis.pb.go +327 -0
  159. package/x/vtransfer/types/key.go +9 -0
  160. package/x/vtransfer/types/msgs.go +9 -0
  161. package/ante/fee.go +0 -96
  162. package/app/const.go +0 -6
  163. package/cmd/helper/main.go +0 -21
  164. package/proto/agoric/lien/genesis.proto +0 -25
  165. package/proto/agoric/lien/lien.proto +0 -25
  166. package/x/lien/alias.go +0 -17
  167. package/x/lien/genesis.go +0 -58
  168. package/x/lien/genesis_test.go +0 -101
  169. package/x/lien/keeper/account.go +0 -285
  170. package/x/lien/keeper/keeper.go +0 -254
  171. package/x/lien/keeper/keeper_test.go +0 -623
  172. package/x/lien/lien.go +0 -203
  173. package/x/lien/lien_test.go +0 -529
  174. package/x/lien/module.go +0 -115
  175. package/x/lien/spec/01_concepts.md +0 -146
  176. package/x/lien/spec/02_messages.md +0 -96
  177. package/x/lien/types/accountkeeper.go +0 -81
  178. package/x/lien/types/accountstate.go +0 -27
  179. package/x/lien/types/expected_keepers.go +0 -18
  180. package/x/lien/types/genesis.pb.go +0 -567
  181. package/x/lien/types/key.go +0 -25
  182. package/x/lien/types/lien.pb.go +0 -403
  183. package/x/swingset/keeper/snapshotter.go +0 -491
  184. package/x/swingset/keeper/snapshotter_test.go +0 -185
  185. package/x/swingset/legacy/v32/params.go +0 -37
  186. package/x/swingset/legacy/v32/params_test.go +0 -133
  187. package/x/vibc/ibc.go +0 -442
  188. /package/{src/index.cjs → index.cjs} +0 -0
package/x/lien/lien.go DELETED
@@ -1,203 +0,0 @@
1
- // Package lien is a cosmos-sdk module that implements liens.
2
- // Liens are an encumbrance that prevents the transfer of tokens
3
- // out of an account, much like the unvested tokens in a vesting
4
- // account. See spec/ for full details.
5
- package lien
6
-
7
- import (
8
- "encoding/json"
9
- "fmt"
10
- "math"
11
-
12
- "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
13
-
14
- sdk "github.com/cosmos/cosmos-sdk/types"
15
- )
16
-
17
- // portHandler implements a vm.PortHandler.
18
- type portHandler struct {
19
- keeper Keeper
20
- }
21
-
22
- // portMessage is a struct that any lien bridge message can unmarshal into.
23
- type portMessage struct {
24
- Type string `json:"type"`
25
- Address string `json:"address"`
26
- Denom string `json:"denom"`
27
- Delta sdk.Int `json:"delta"`
28
- Validators []string `json:"validators"`
29
- Delegators []string `json:"delegators"`
30
- }
31
-
32
- // msgAccountState marshals into the AccountState message for the lien bridge.
33
- type msgAccountState struct {
34
- CurrentTime int64 `json:"currentTime"`
35
- Total sdk.Int `json:"total"`
36
- Bonded sdk.Int `json:"bonded"`
37
- Unbonding sdk.Int `json:"unbonding"`
38
- Locked sdk.Int `json:"locked"`
39
- Liened sdk.Int `json:"liened"`
40
- // TODO: send unvested amount
41
- }
42
-
43
- type delegatorState struct {
44
- ValidatorIdx []int `json:"val_idx"`
45
- Values []sdk.Int `json:"values"`
46
- Other sdk.Int `json:"other"`
47
- }
48
-
49
- type msgStaking struct {
50
- EpochTag string `json:"epoch_tag"`
51
- Denom string `json:"denom"`
52
- // the following fields are arrays of pointer types so we can use JSON null
53
- // for out-of-band values
54
- ValidatorValues []*sdk.Int `json:"validator_values"`
55
- DelegatorStates []*delegatorState `json:"delegator_states"`
56
- }
57
-
58
- // NewPortHandler returns a port handler for the Keeper.
59
- func NewPortHandler(k Keeper) vm.PortHandler {
60
- return portHandler{keeper: k}
61
- }
62
-
63
- const (
64
- LIEN_GET_ACCOUNT_STATE = "LIEN_GET_ACCOUNT_STATE"
65
- LIEN_GET_STAKING = "LIEN_GET_STAKING"
66
- LIEN_CHANGE_LIENED = "LIEN_CHANGE_LIENED"
67
- )
68
-
69
- // Receive implements the vm.PortHandler method.
70
- // Receives and processes a bridge message, returning the
71
- // JSON-encoded response or error.
72
- // See spec/02_messages.md for the messages and responses.
73
- func (ch portHandler) Receive(ctx *vm.ControllerContext, str string) (string, error) {
74
- var msg portMessage
75
- err := json.Unmarshal([]byte(str), &msg)
76
- if err != nil {
77
- return "", err
78
- }
79
- switch msg.Type {
80
- case LIEN_GET_ACCOUNT_STATE:
81
- return ch.handleGetAccountState(ctx.Context, msg)
82
-
83
- case LIEN_GET_STAKING:
84
- return ch.handleGetStaking(ctx.Context, msg)
85
-
86
- case LIEN_CHANGE_LIENED:
87
- return ch.handleChangeLiened(ctx.Context, msg)
88
- }
89
- return "", fmt.Errorf("unrecognized type %s", msg.Type)
90
- }
91
-
92
- func (ch portHandler) handleGetStaking(ctx sdk.Context, msg portMessage) (string, error) {
93
- reply := msgStaking{
94
- EpochTag: fmt.Sprint(ctx.BlockHeight()),
95
- Denom: ch.keeper.BondDenom(ctx),
96
- ValidatorValues: make([]*sdk.Int, len(msg.Validators)),
97
- DelegatorStates: make([]*delegatorState, len(msg.Delegators)),
98
- }
99
- validatorIndex := map[string]int{} // map of validators addresses to indexes
100
- for i, v := range msg.Validators {
101
- validatorIndex[v] = i
102
- valAddr, err := sdk.ValAddressFromBech32(v)
103
- if err != nil {
104
- reply.ValidatorValues[i] = nil
105
- continue
106
- }
107
- value := sdk.NewInt(0)
108
- validator, found := ch.keeper.GetValidator(ctx, valAddr)
109
- if found {
110
- value = validator.Tokens
111
- }
112
- reply.ValidatorValues[i] = &value
113
- }
114
- for i, d := range msg.Delegators {
115
- addr, err := sdk.AccAddressFromBech32(d)
116
- if err != nil {
117
- reply.DelegatorStates[i] = nil
118
- continue
119
- }
120
- delegations := ch.keeper.GetDelegatorDelegations(ctx, addr, math.MaxUint16)
121
- // Note that the delegations were returned in a specific order - no nodeterminism
122
- state := delegatorState{
123
- ValidatorIdx: make([]int, 0, len(delegations)),
124
- Values: make([]sdk.Int, 0, len(delegations)),
125
- Other: sdk.NewInt(0),
126
- }
127
- for _, d := range delegations {
128
- valAddr, err := sdk.ValAddressFromBech32(d.ValidatorAddress)
129
- if err != nil {
130
- panic(err)
131
- }
132
- validator, found := ch.keeper.GetValidator(ctx, valAddr)
133
- if !found {
134
- panic("validator not found")
135
- }
136
- shares := d.GetShares()
137
- tokens := validator.TokensFromShares(shares).RoundInt()
138
- valIndex, found := validatorIndex[valAddr.String()]
139
- if found {
140
- state.ValidatorIdx = append(state.ValidatorIdx, valIndex)
141
- state.Values = append(state.Values, tokens)
142
- } else {
143
- state.Other = state.Other.Add(tokens)
144
- }
145
- }
146
- reply.DelegatorStates[i] = &state
147
- }
148
- bz, err := json.Marshal(&reply)
149
- if err != nil {
150
- return "", fmt.Errorf("cannot marshal %v: %w", reply, err)
151
- }
152
- return string(bz), nil
153
- }
154
-
155
- // handleGetAccountState processes a LIEN_GET_ACCOUNT_STATE message.
156
- // See spec/02_messages.md for the messages and responses.
157
- func (ch portHandler) handleGetAccountState(ctx sdk.Context, msg portMessage) (string, error) {
158
- addr, err := sdk.AccAddressFromBech32(msg.Address)
159
- if err != nil {
160
- return "", fmt.Errorf("cannot convert %s to address: %w", msg.Address, err)
161
- }
162
- denom := msg.Denom
163
- if err = sdk.ValidateDenom(denom); err != nil {
164
- return "", fmt.Errorf("invalid denom %s: %w", denom, err)
165
- }
166
- state := ch.keeper.GetAccountState(ctx, addr)
167
- reply := msgAccountState{
168
- CurrentTime: ctx.BlockTime().Unix(),
169
- Total: state.Total.AmountOf(denom),
170
- Bonded: state.Bonded.AmountOf(denom),
171
- Unbonding: state.Unbonding.AmountOf(denom),
172
- Locked: state.Locked.AmountOf(denom),
173
- Liened: state.Liened.AmountOf(denom),
174
- }
175
- bz, err := json.Marshal(&reply)
176
- if err != nil {
177
- return "", fmt.Errorf("cannot marshal %v: %w", reply, err)
178
- }
179
- return string(bz), nil
180
- }
181
-
182
- // handleChangeLiened processes a LIEN_CHANGE_LIENED message.
183
- // See spec/02_messages.md for the messages and responses.
184
- func (ch portHandler) handleChangeLiened(ctx sdk.Context, msg portMessage) (string, error) {
185
- addr, err := sdk.AccAddressFromBech32(msg.Address)
186
- if err != nil {
187
- return "", fmt.Errorf("cannot convert %s to address: %w", msg.Address, err)
188
- }
189
- denom := msg.Denom
190
- if err = sdk.ValidateDenom(denom); err != nil {
191
- return "", fmt.Errorf("invalid denom %s: %w", denom, err)
192
- }
193
-
194
- newAmt, err := ch.keeper.ChangeLien(ctx, addr, denom, msg.Delta)
195
- if err != nil {
196
- return "", err
197
- }
198
- bz, err := json.Marshal(&newAmt)
199
- if err != nil {
200
- return "", fmt.Errorf("cannot marshal %v: %w", newAmt, err)
201
- }
202
- return string(bz), nil
203
- }