@agoric/cosmos 0.35.0-u21.0 → 0.35.0-u22.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 (113) hide show
  1. package/CHANGELOG.md +11 -187
  2. package/Makefile +2 -2
  3. package/ante/ante.go +2 -2
  4. package/ante/inbound.go +1 -2
  5. package/ante/inbound_test.go +3 -1
  6. package/ante/vm_admission.go +1 -2
  7. package/app/app.go +255 -174
  8. package/app/encoding.go +6 -3
  9. package/app/export.go +50 -21
  10. package/app/genesis.go +7 -5
  11. package/app/params/encoding.go +1 -1
  12. package/app/params/proto.go +6 -4
  13. package/app/sim_test.go +11 -13
  14. package/app/txconfig/tx_config.go +169 -0
  15. package/app/upgrade.go +52 -97
  16. package/app/upgrade_test.go +1 -1
  17. package/cmd/agd/agvm.go +1 -1
  18. package/cmd/agd/main.go +1 -1
  19. package/cmd/libdaemon/main.go +2 -2
  20. package/daemon/cmd/root.go +99 -30
  21. package/daemon/cmd/root_test.go +12 -27
  22. package/daemon/main.go +2 -9
  23. package/git-revision.txt +1 -1
  24. package/go.mod +129 -109
  25. package/go.sum +228 -469
  26. package/package.json +2 -2
  27. package/proto/agoric/swingset/msgs.proto +46 -9
  28. package/proto/agoric/swingset/swingset.proto +7 -2
  29. package/proto/agoric/vbank/vbank.proto +1 -1
  30. package/proto/agoric/vibc/msgs.proto +4 -0
  31. package/tests/e2e/vbank/vbank_test.go +172 -0
  32. package/tests/integrations/types/aminojson_test.go +214 -0
  33. package/tests/integrations/vbank/vbank_test.go +348 -0
  34. package/third_party/proto/amino/amino.proto +6 -1
  35. package/third_party/proto/cosmos/base/v1beta1/coin.proto +18 -5
  36. package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +4 -8
  37. package/third_party/proto/ibc/core/channel/v1/channel.proto +42 -17
  38. package/third_party/proto/ibc/core/client/v1/client.proto +48 -40
  39. package/types/address_hooks.go +2 -2
  40. package/types/address_hooks_test.go +3 -3
  41. package/types/ibc_packet.go +3 -3
  42. package/types/ibc_packet_test.go +3 -3
  43. package/types/kv_entry_helpers.go +3 -3
  44. package/types/kv_entry_helpers_test.go +2 -2
  45. package/types/legacy_address_encoder.go +58 -0
  46. package/vm/proto_json_test.go +1 -1
  47. package/vm/server.go +2 -1
  48. package/x/swingset/abci.go +2 -2
  49. package/x/swingset/client/cli/tx.go +16 -14
  50. package/x/swingset/config.go +1 -1
  51. package/x/swingset/genesis.go +2 -1
  52. package/x/swingset/handler.go +2 -1
  53. package/x/swingset/keeper/extension_snapshotter.go +14 -5
  54. package/x/swingset/keeper/extension_snapshotter_test.go +1 -1
  55. package/x/swingset/keeper/keeper.go +21 -17
  56. package/x/swingset/keeper/keeper_test.go +10 -7
  57. package/x/swingset/keeper/msg_server.go +26 -5
  58. package/x/swingset/keeper/swing_store_exports_handler.go +1 -1
  59. package/x/swingset/keeper/swing_store_exports_handler_test.go +1 -1
  60. package/x/swingset/module.go +20 -22
  61. package/x/swingset/types/codec.go +10 -5
  62. package/x/swingset/types/default-params.go +13 -12
  63. package/x/swingset/types/expected_keepers.go +5 -4
  64. package/x/swingset/types/msgs.go +50 -36
  65. package/x/swingset/types/msgs.pb.go +60 -51
  66. package/x/swingset/types/params_test.go +21 -20
  67. package/x/swingset/types/swingset.pb.go +67 -61
  68. package/x/vbank/genesis.go +12 -8
  69. package/x/vbank/handler.go +2 -1
  70. package/x/vbank/keeper/grpc_query.go +4 -1
  71. package/x/vbank/keeper/keeper.go +108 -23
  72. package/x/vbank/keeper/querier.go +4 -1
  73. package/x/vbank/keeper/rewards.go +6 -2
  74. package/x/vbank/module.go +47 -75
  75. package/x/vbank/types/expected_keepers.go +15 -10
  76. package/x/vbank/types/key.go +3 -0
  77. package/x/vbank/types/params.go +4 -3
  78. package/x/vbank/types/vbank.pb.go +41 -40
  79. package/x/vbank/vbank.go +25 -10
  80. package/x/vbank/vbank_test.go +213 -154
  81. package/x/vibc/handler.go +2 -1
  82. package/x/vibc/keeper/keeper.go +10 -10
  83. package/x/vibc/keeper/migrations.go +1 -1
  84. package/x/vibc/keeper/triggers.go +1 -1
  85. package/x/vibc/module.go +5 -22
  86. package/x/vibc/types/codec.go +2 -1
  87. package/x/vibc/types/expected_keepers.go +7 -5
  88. package/x/vibc/types/ibc_module.go +5 -5
  89. package/x/vibc/types/msgs.go +30 -7
  90. package/x/vibc/types/msgs.pb.go +29 -25
  91. package/x/vibc/types/receiver.go +2 -2
  92. package/x/vlocalchain/handler.go +2 -1
  93. package/x/vlocalchain/keeper/keeper.go +17 -5
  94. package/x/vlocalchain/keeper/keeper_test.go +3 -2
  95. package/x/vlocalchain/types/expected_keepers.go +7 -4
  96. package/x/vlocalchain/vlocalchain_test.go +38 -26
  97. package/x/vstorage/genesis.go +10 -10
  98. package/x/vstorage/handler.go +2 -1
  99. package/x/vstorage/keeper/keeper.go +68 -46
  100. package/x/vstorage/keeper/keeper_test.go +35 -19
  101. package/x/vstorage/module.go +27 -13
  102. package/x/vstorage/testing/queue.go +5 -3
  103. package/x/vstorage/vstorage.go +2 -1
  104. package/x/vstorage/vstorage_test.go +21 -17
  105. package/x/vtransfer/genesis.go +1 -3
  106. package/x/vtransfer/handler.go +3 -2
  107. package/x/vtransfer/ibc_middleware.go +5 -5
  108. package/x/vtransfer/ibc_middleware_test.go +43 -29
  109. package/x/vtransfer/keeper/keeper.go +35 -33
  110. package/x/vtransfer/module.go +8 -11
  111. package/x/vtransfer/types/expected_keepers.go +3 -3
  112. package/x/vtransfer/utils_test.go +26 -11
  113. package/daemon/cmd/testnet.go +0 -539
package/x/vibc/module.go CHANGED
@@ -14,7 +14,6 @@ import (
14
14
  cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
15
15
  "github.com/cosmos/cosmos-sdk/types/module"
16
16
 
17
- abci "github.com/cometbft/cometbft/abci/types"
18
17
  sdk "github.com/cosmos/cosmos-sdk/types"
19
18
  )
20
19
 
@@ -28,6 +27,11 @@ var (
28
27
  type AppModuleBasic struct {
29
28
  }
30
29
 
30
+ // IsAppModule implements the appmodule.AppModule interface.
31
+ func (am AppModule) IsAppModule() {}
32
+
33
+ // IsOnePerModuleType is a marker function just indicates that this is a one-per-module type.
34
+ func (am AppModule) IsOnePerModuleType() {}
31
35
  func (AppModuleBasic) Name() string {
32
36
  return ModuleName
33
37
  }
@@ -86,15 +90,6 @@ func (AppModule) Name() string {
86
90
 
87
91
  func (AppModule) ConsensusVersion() uint64 { return 2 }
88
92
 
89
- // BeginBlock implements the AppModule interface
90
- func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
91
- }
92
-
93
- // EndBlock implements the AppModule interface
94
- func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate {
95
- return []abci.ValidatorUpdate{}
96
- }
97
-
98
93
  // RegisterInvariants implements the AppModule interface
99
94
  func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
100
95
  // TODO
@@ -111,15 +106,3 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
111
106
  panic(err)
112
107
  }
113
108
  }
114
-
115
- // InitGenesis performs genesis initialization for the ibc-transfer module. It returns
116
- // no validator updates.
117
- func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate {
118
- return []abci.ValidatorUpdate{}
119
- }
120
-
121
- // ExportGenesis returns the exported genesis state as raw bytes for the ibc-transfer
122
- // module.
123
- func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
124
- return nil
125
- }
@@ -2,6 +2,7 @@ package types
2
2
 
3
3
  import (
4
4
  "github.com/cosmos/cosmos-sdk/codec"
5
+ "github.com/cosmos/cosmos-sdk/codec/legacy"
5
6
  cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
6
7
  cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
7
8
  sdk "github.com/cosmos/cosmos-sdk/types"
@@ -28,7 +29,7 @@ func init() {
28
29
 
29
30
  // RegisterCodec registers concrete types on the Amino codec
30
31
  func RegisterCodec(cdc *codec.LegacyAmino) {
31
- cdc.RegisterConcrete(&MsgSendPacket{}, ModuleName+"/SendPacket", nil)
32
+ legacy.RegisterAminoMsg(cdc, &MsgSendPacket{}, ModuleName+"/SendPacket")
32
33
  }
33
34
 
34
35
  // RegisterInterfaces registers the x/swingset interfaces types with the interface registry
@@ -1,15 +1,17 @@
1
1
  package types
2
2
 
3
3
  import (
4
+ context "context"
5
+
4
6
  sdk "github.com/cosmos/cosmos-sdk/types"
5
- capability "github.com/cosmos/cosmos-sdk/x/capability/types"
6
- clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
7
- channel "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
8
- ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
7
+ capability "github.com/cosmos/ibc-go/modules/capability/types"
8
+ clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
9
+ channel "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
10
+ ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
9
11
  )
10
12
 
11
13
  type BankKeeper interface {
12
- GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
14
+ GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin
13
15
  }
14
16
 
15
17
  // ChannelKeeper defines the expected IBC channel keeper
@@ -6,12 +6,12 @@ import (
6
6
  sdkioerrors "cosmossdk.io/errors"
7
7
  agtypes "github.com/Agoric/agoric-sdk/golang/cosmos/types"
8
8
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
9
- capability "github.com/cosmos/cosmos-sdk/x/capability/types"
10
- channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
11
- porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
12
- host "github.com/cosmos/ibc-go/v7/modules/core/24-host"
9
+ capability "github.com/cosmos/ibc-go/modules/capability/types"
10
+ channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
11
+ porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
12
+ host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
13
13
 
14
- "github.com/cosmos/ibc-go/v7/modules/core/exported"
14
+ "github.com/cosmos/ibc-go/v8/modules/core/exported"
15
15
 
16
16
  sdk "github.com/cosmos/cosmos-sdk/types"
17
17
  )
@@ -1,16 +1,44 @@
1
1
  package types
2
2
 
3
3
  import (
4
+ sdkioerrors "cosmossdk.io/errors"
5
+ "cosmossdk.io/x/tx/signing"
6
+
4
7
  sdk "github.com/cosmos/cosmos-sdk/types"
8
+
5
9
  sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
6
10
 
7
- chanTypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
11
+ chanTypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
12
+
13
+ "google.golang.org/protobuf/proto"
14
+ "google.golang.org/protobuf/protoadapt"
15
+ "google.golang.org/protobuf/reflect/protoreflect"
8
16
  )
9
17
 
10
18
  const RouterKey = ModuleName // this was defined in your key.go file
11
19
 
12
20
  var _ sdk.Msg = &MsgSendPacket{}
13
21
 
22
+ // Replacing msg.GetSigners() but before we can adopt AddressString.
23
+ // https://github.com/cosmos/cosmos-sdk/issues/20077#issuecomment-2062601533
24
+ func createSignerFieldFunc(fieldName protoreflect.Name) signing.GetSignersFunc {
25
+ return func(msgIn proto.Message) ([][]byte, error) {
26
+ msg := msgIn.ProtoReflect()
27
+ if !msg.Has(msg.Descriptor().Fields().ByName(fieldName)) {
28
+ return nil, sdkioerrors.Wrapf(sdkerrors.ErrInvalidRequest, "message %T does not have field %s", msgIn, fieldName)
29
+ }
30
+ addr := msg.Get(msg.Descriptor().Fields().ByName(fieldName)).Interface().([]byte)
31
+ return [][]byte{addr}, nil
32
+ }
33
+ }
34
+
35
+ func DefineCustomGetSigners(options *signing.Options) {
36
+ options.DefineCustomGetSigners(
37
+ proto.MessageName(protoadapt.MessageV2Of(&MsgSendPacket{})),
38
+ createSignerFieldFunc("sender"),
39
+ )
40
+ }
41
+
14
42
  // NewMsgSendPacket returns a new send request
15
43
  func NewMsgSendPacket(packet chanTypes.Packet, sender sdk.AccAddress) *MsgSendPacket {
16
44
  return &MsgSendPacket{
@@ -31,12 +59,7 @@ func (msg MsgSendPacket) ValidateBasic() error {
31
59
  return msg.Packet.ValidateBasic()
32
60
  }
33
61
 
34
- // GetSignBytes implements sdk.Msg
35
- func (msg MsgSendPacket) GetSignBytes() []byte {
36
- return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
37
- }
38
-
39
- // GetSigners implements sdk.Msg
62
+ // GetSigners defines whose signature is required
40
63
  func (msg MsgSendPacket) GetSigners() []sdk.AccAddress {
41
64
  return []sdk.AccAddress{msg.Sender}
42
65
  }
@@ -7,10 +7,11 @@ import (
7
7
  context "context"
8
8
  fmt "fmt"
9
9
  github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
10
+ _ "github.com/cosmos/cosmos-sdk/types/tx/amino"
10
11
  _ "github.com/cosmos/gogoproto/gogoproto"
11
12
  grpc1 "github.com/cosmos/gogoproto/grpc"
12
13
  proto "github.com/cosmos/gogoproto/proto"
13
- types "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
14
+ types "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
14
15
  grpc "google.golang.org/grpc"
15
16
  codes "google.golang.org/grpc/codes"
16
17
  status "google.golang.org/grpc/status"
@@ -128,30 +129,33 @@ func init() {
128
129
  func init() { proto.RegisterFile("agoric/vibc/msgs.proto", fileDescriptor_78e9bb7be62a4c00) }
129
130
 
130
131
  var fileDescriptor_78e9bb7be62a4c00 = []byte{
131
- // 354 bytes of a gzipped FileDescriptorProto
132
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xbf, 0x6e, 0xea, 0x30,
133
- 0x14, 0xc6, 0x93, 0x7b, 0xaf, 0x90, 0xae, 0xb9, 0x48, 0x57, 0x51, 0xff, 0xa0, 0x54, 0x8a, 0x69,
134
- 0x26, 0x16, 0x6c, 0x41, 0x87, 0x4a, 0x6c, 0x30, 0x17, 0xa9, 0x0d, 0x9d, 0xba, 0x25, 0x8e, 0x65,
135
- 0x52, 0x48, 0x1c, 0xe5, 0x04, 0x54, 0xde, 0xa2, 0x8f, 0xd0, 0xc7, 0x61, 0x64, 0x6b, 0xa7, 0xa8,
136
- 0x82, 0xa5, 0x62, 0x64, 0xec, 0x54, 0x25, 0x4e, 0x2a, 0x18, 0x3a, 0xf9, 0xf8, 0x3b, 0xe7, 0x3b,
137
- 0xd6, 0xcf, 0x1f, 0x3a, 0x73, 0x85, 0x4c, 0x02, 0x46, 0x17, 0x81, 0xc7, 0x68, 0x08, 0x02, 0x48,
138
- 0x9c, 0xc8, 0x54, 0x1a, 0x75, 0xa5, 0x93, 0x5c, 0x37, 0x4f, 0x84, 0x14, 0xb2, 0xd0, 0x69, 0x5e,
139
- 0xa9, 0x11, 0xf3, 0x32, 0xb7, 0x30, 0x99, 0x70, 0xca, 0x26, 0x6e, 0x14, 0xf1, 0x19, 0x5d, 0x74,
140
- 0xab, 0x52, 0x8d, 0xd8, 0xaf, 0x3a, 0x6a, 0x8c, 0x40, 0x8c, 0x79, 0xe4, 0xdf, 0xba, 0x6c, 0xca,
141
- 0x53, 0xe3, 0x1e, 0xd5, 0xe2, 0xa2, 0x6a, 0xea, 0x2d, 0xbd, 0x5d, 0xef, 0x5d, 0x90, 0xc0, 0x63,
142
- 0x24, 0xdf, 0x42, 0x2a, 0xeb, 0xa2, 0x4b, 0xd4, 0xf0, 0x10, 0xaf, 0x32, 0xac, 0xed, 0x32, 0x5c,
143
- 0x5a, 0xf6, 0x19, 0x6e, 0x2c, 0xdd, 0x70, 0xd6, 0xb7, 0xd5, 0xdd, 0x76, 0xca, 0x86, 0xf1, 0x88,
144
- 0x6a, 0xc0, 0x23, 0x9f, 0x27, 0xcd, 0x5f, 0x2d, 0xbd, 0xfd, 0x6f, 0xe8, 0xec, 0x32, 0xfc, 0x17,
145
- 0xe6, 0x5e, 0x18, 0xa4, 0x29, 0x4f, 0xf6, 0x19, 0xfe, 0xaf, 0x7c, 0xdf, 0x92, 0xfd, 0x99, 0xe1,
146
- 0x8e, 0x08, 0xd2, 0xc9, 0xdc, 0x23, 0x4c, 0x86, 0x94, 0x49, 0x08, 0x25, 0x94, 0x47, 0x07, 0xfc,
147
- 0x29, 0x4d, 0x97, 0x31, 0x07, 0x32, 0x60, 0x6c, 0xe0, 0xfb, 0x09, 0x07, 0x70, 0xca, 0x17, 0xfa,
148
- 0x7f, 0x3e, 0x5e, 0xb0, 0x66, 0x9f, 0xa3, 0xd3, 0x23, 0x30, 0x87, 0x43, 0x2c, 0x23, 0xe0, 0xbd,
149
- 0x31, 0xfa, 0x3d, 0x02, 0x61, 0xdc, 0x20, 0x74, 0x40, 0x6d, 0x92, 0x83, 0xef, 0x24, 0x47, 0x46,
150
- 0xd3, 0xfe, 0xb9, 0x57, 0x2d, 0x1d, 0xde, 0xad, 0x36, 0x96, 0xbe, 0xde, 0x58, 0xfa, 0xfb, 0xc6,
151
- 0xd2, 0x9f, 0xb7, 0x96, 0xb6, 0xde, 0x5a, 0xda, 0xdb, 0xd6, 0xd2, 0x1e, 0xae, 0x0f, 0x20, 0x06,
152
- 0x2a, 0x4a, 0xb5, 0xae, 0x80, 0x10, 0x72, 0xe6, 0x46, 0xa2, 0xa2, 0x7b, 0x52, 0x29, 0x17, 0x64,
153
- 0x5e, 0xad, 0x48, 0xe8, 0xea, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x45, 0x01, 0xfd, 0x45, 0x01, 0x02,
154
- 0x00, 0x00,
132
+ // 401 bytes of a gzipped FileDescriptorProto
133
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x3d, 0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d6, 0xf9, 0x40, 0xed, 0x84,
156
+ 0xb2, 0xcb, 0x3b, 0xe7, 0xc2, 0x27, 0x21, 0x2f, 0x23, 0xf9, 0xa9, 0xd6, 0x25, 0x8f, 0xc3, 0xa9,
157
+ 0xe6, 0x73, 0xfd, 0x78, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xca, 0x58, 0x43, 0x3c, 0x4a, 0x02, 0x00,
158
+ 0x00,
155
159
  }
156
160
 
157
161
  // Reference imports to suppress errors if they are not otherwise used.
@@ -7,9 +7,9 @@ import (
7
7
 
8
8
  "github.com/Agoric/agoric-sdk/golang/cosmos/types"
9
9
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
10
- channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
10
+ channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
11
11
 
12
- "github.com/cosmos/ibc-go/v7/modules/core/exported"
12
+ "github.com/cosmos/ibc-go/v8/modules/core/exported"
13
13
 
14
14
  sdk "github.com/cosmos/cosmos-sdk/types"
15
15
  )
@@ -5,12 +5,13 @@ import (
5
5
 
6
6
  sdkioerrors "cosmossdk.io/errors"
7
7
  "github.com/Agoric/agoric-sdk/golang/cosmos/x/vlocalchain/keeper"
8
+ "github.com/cosmos/cosmos-sdk/baseapp"
8
9
  sdk "github.com/cosmos/cosmos-sdk/types"
9
10
  sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
10
11
  )
11
12
 
12
13
  // NewHandler returns a handler for "vlocalchain" type messages.
13
- func NewHandler(keeper keeper.Keeper) sdk.Handler {
14
+ func NewHandler(keeper keeper.Keeper) baseapp.MsgServiceHandler {
14
15
  return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
15
16
  switch msg := msg.(type) {
16
17
  default:
@@ -8,12 +8,13 @@ import (
8
8
  "strings"
9
9
  "unicode"
10
10
 
11
+ errorsmod "cosmossdk.io/errors"
11
12
  "github.com/cosmos/gogoproto/jsonpb"
12
13
  "github.com/cosmos/gogoproto/proto"
13
14
 
15
+ storetypes "cosmossdk.io/store/types"
14
16
  "github.com/cosmos/cosmos-sdk/codec"
15
17
  codectypes "github.com/cosmos/cosmos-sdk/codec/types"
16
- storetypes "github.com/cosmos/cosmos-sdk/store/types"
17
18
  sdk "github.com/cosmos/cosmos-sdk/types"
18
19
  sdkaddress "github.com/cosmos/cosmos-sdk/types/address"
19
20
 
@@ -138,7 +139,7 @@ func (k Keeper) Query(cctx context.Context, qm types.QueryRequest) (*types.Query
138
139
  Height: ctx.BlockHeight(),
139
140
  }
140
141
 
141
- abcires, err := handler(ctx, req)
142
+ abcires, err := handler(ctx, &req)
142
143
  if err != nil {
143
144
  return nil, err
144
145
  }
@@ -180,9 +181,20 @@ type HasValidateBasic interface {
180
181
  func (k Keeper) authenticateTx(msgs []sdk.Msg, actualSigner string) error {
181
182
  for _, msg := range msgs {
182
183
  // Validate that all required signers are satisfied (i.e. they match the actual signer).
183
- for _, requiredSignerAddress := range msg.GetSigners() {
184
- requiredSigner := requiredSignerAddress.String()
185
- if requiredSigner != actualSigner {
184
+
185
+ // obtain the message signers using the proto signer annotations
186
+ // the msgv2 return value is discarded as it is not used
187
+ requiredSigners, _, err := k.cdc.GetMsgV1Signers(msg)
188
+ if err != nil {
189
+ return errorsmod.Wrapf(err, "failed to obtain required message signers for message type %s", sdk.MsgTypeURL(msg))
190
+ }
191
+
192
+ for _, requiredSignerBytes := range requiredSigners {
193
+ requiredSigner, err := k.acctKeeper.AddressCodec().BytesToString(requiredSignerBytes)
194
+ if err != nil {
195
+ return errorsmod.Wrapf(err, "failed to convert required signer bytes to string for message type %s", sdk.MsgTypeURL(msg))
196
+ }
197
+ if actualSigner != requiredSigner {
186
198
  err := fmt.Errorf("required signer %s does not match actual signer", requiredSigner)
187
199
  return err
188
200
  }
@@ -5,6 +5,7 @@ import (
5
5
 
6
6
  "github.com/stretchr/testify/require"
7
7
 
8
+ sdkmath "cosmossdk.io/math"
8
9
  "github.com/Agoric/agoric-sdk/golang/cosmos/app/params"
9
10
  sdk "github.com/cosmos/cosmos-sdk/types"
10
11
  banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
@@ -41,7 +42,7 @@ func TestKeeper_ParseRequestTypeURL(t *testing.T) {
41
42
 
42
43
  func TestKeeper_DeserializeTxMessages(t *testing.T) {
43
44
  encodingConfig := params.MakeEncodingConfig()
44
- cdc := encodingConfig.Marshaler
45
+ cdc := encodingConfig.Codec
45
46
 
46
47
  banktypes.RegisterInterfaces(encodingConfig.InterfaceRegistry)
47
48
 
@@ -51,7 +52,7 @@ func TestKeeper_DeserializeTxMessages(t *testing.T) {
51
52
  &banktypes.MsgSend{
52
53
  FromAddress: "cosmos1abc",
53
54
  ToAddress: "cosmos1xyz",
54
- Amount: sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100))),
55
+ Amount: sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(100))),
55
56
  },
56
57
  }
57
58
 
@@ -1,12 +1,15 @@
1
1
  package types
2
2
 
3
3
  import (
4
+ "context"
5
+
6
+ address "cosmossdk.io/core/address"
4
7
  sdk "github.com/cosmos/cosmos-sdk/types"
5
- authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
6
8
  )
7
9
 
8
10
  type AccountKeeper interface {
9
- NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
10
- HasAccount(ctx sdk.Context, addr sdk.AccAddress) bool
11
- SetAccount(ctx sdk.Context, acc authtypes.AccountI)
11
+ AddressCodec() address.Codec
12
+ NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
13
+ HasAccount(ctx context.Context, addr sdk.AccAddress) bool
14
+ SetAccount(ctx context.Context, acc sdk.AccountI)
12
15
  }
@@ -7,29 +7,32 @@ import (
7
7
  "testing"
8
8
  "time"
9
9
 
10
- "github.com/Agoric/agoric-sdk/golang/cosmos/app/params"
10
+ address "cosmossdk.io/core/address"
11
+ "cosmossdk.io/log"
12
+ sdkmath "cosmossdk.io/math"
13
+ "cosmossdk.io/store"
14
+ storemetrics "cosmossdk.io/store/metrics"
15
+ storetypes "cosmossdk.io/store/types"
11
16
  "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
12
17
  "github.com/Agoric/agoric-sdk/golang/cosmos/x/vlocalchain"
13
18
  "github.com/Agoric/agoric-sdk/golang/cosmos/x/vlocalchain/types"
14
-
15
- "github.com/cometbft/cometbft/libs/log"
19
+ dbm "github.com/cosmos/cosmos-db"
16
20
  "github.com/cosmos/cosmos-sdk/baseapp"
17
- "github.com/cosmos/cosmos-sdk/store"
18
- storetypes "github.com/cosmos/cosmos-sdk/store/types"
21
+ addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
19
22
  sdk "github.com/cosmos/cosmos-sdk/types"
23
+ "github.com/cosmos/cosmos-sdk/types/module/testutil"
20
24
  authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
21
25
  banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
22
26
  stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
23
- transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
27
+ transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
24
28
 
25
- dbm "github.com/cometbft/cometbft-db"
26
29
  tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
27
30
  "github.com/cosmos/gogoproto/jsonpb"
28
31
  "github.com/cosmos/gogoproto/proto"
29
32
  )
30
33
 
31
34
  var (
32
- vlocalchainStoreKey = sdk.NewKVStoreKey(types.StoreKey)
35
+ vlocalchainStoreKey = storetypes.NewKVStoreKey(types.StoreKey)
33
36
  )
34
37
 
35
38
  const (
@@ -43,16 +46,20 @@ type mockAccounts struct {
43
46
 
44
47
  var _ types.AccountKeeper = (*mockAccounts)(nil)
45
48
 
46
- func (a *mockAccounts) NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI {
49
+ func (a *mockAccounts) NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI {
47
50
  return authtypes.NewBaseAccountWithAddress(addr)
48
51
  }
49
52
 
50
- func (a *mockAccounts) HasAccount(ctx sdk.Context, addr sdk.AccAddress) bool {
53
+ func (a *mockAccounts) AddressCodec() address.Codec {
54
+ return addresscodec.NewBech32Codec(sdk.Bech32MainPrefix)
55
+ }
56
+
57
+ func (a *mockAccounts) HasAccount(ctx context.Context, addr sdk.AccAddress) bool {
51
58
  existing := a.existing[addr.String()]
52
59
  return existing
53
60
  }
54
61
 
55
- func (a *mockAccounts) SetAccount(ctx sdk.Context, acc authtypes.AccountI) {
62
+ func (a *mockAccounts) SetAccount(ctx context.Context, acc sdk.AccountI) {
56
63
  a.existing[acc.GetAddress().String()] = true
57
64
  }
58
65
 
@@ -119,8 +126,8 @@ func (s *mockStaking) UnbondingDelegation(cctx context.Context, req *stakingtype
119
126
  {
120
127
  CreationHeight: 100,
121
128
  CompletionTime: time.Now().UTC().Add(time.Hour * 24 * 7),
122
- InitialBalance: sdk.NewInt(1000),
123
- Balance: sdk.NewInt(500),
129
+ InitialBalance: sdkmath.NewInt(1000),
130
+ Balance: sdkmath.NewInt(500),
124
131
  },
125
132
  },
126
133
  }
@@ -129,21 +136,25 @@ func (s *mockStaking) UnbondingDelegation(cctx context.Context, req *stakingtype
129
136
 
130
137
  // makeTestKit creates a minimal Keeper and Context for use in testing.
131
138
  func makeTestKit(bank *mockBank, transfer *mockTransfer, staking *mockStaking, accts *mockAccounts) (vm.PortHandler, context.Context) {
132
- encodingConfig := params.MakeEncodingConfig()
133
- cdc := encodingConfig.Marshaler
139
+ // Configure address codec in the interface registry using testutil
140
+ encCfg := testutil.MakeTestEncodingConfig()
141
+
142
+ cdc := encCfg.Codec
134
143
 
135
144
  txRouter := baseapp.NewMsgServiceRouter()
136
- txRouter.SetInterfaceRegistry(encodingConfig.InterfaceRegistry)
145
+ txRouter.SetInterfaceRegistry(encCfg.InterfaceRegistry)
137
146
  queryRouter := baseapp.NewGRPCQueryRouter()
138
- queryRouter.SetInterfaceRegistry(encodingConfig.InterfaceRegistry)
147
+ queryRouter.SetInterfaceRegistry(encCfg.InterfaceRegistry)
139
148
 
140
- banktypes.RegisterInterfaces(encodingConfig.InterfaceRegistry)
149
+ // Register all necessary module interfaces
150
+ authtypes.RegisterInterfaces(encCfg.InterfaceRegistry)
151
+ banktypes.RegisterInterfaces(encCfg.InterfaceRegistry)
141
152
  banktypes.RegisterMsgServer(txRouter, bank)
142
153
  banktypes.RegisterQueryServer(queryRouter, bank)
143
- transfertypes.RegisterInterfaces(encodingConfig.InterfaceRegistry)
154
+ transfertypes.RegisterInterfaces(encCfg.InterfaceRegistry)
144
155
  transfertypes.RegisterMsgServer(txRouter, transfer)
145
156
  transfertypes.RegisterQueryServer(queryRouter, transfer)
146
- stakingtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry)
157
+ stakingtypes.RegisterInterfaces(encCfg.InterfaceRegistry)
147
158
  stakingtypes.RegisterMsgServer(txRouter, staking)
148
159
  stakingtypes.RegisterQueryServer(queryRouter, staking)
149
160
 
@@ -151,7 +162,8 @@ func makeTestKit(bank *mockBank, transfer *mockTransfer, staking *mockStaking, a
151
162
  keeper := vlocalchain.NewKeeper(cdc, vlocalchainStoreKey, txRouter, queryRouter, accts)
152
163
 
153
164
  db := dbm.NewMemDB()
154
- ms := store.NewCommitMultiStore(db)
165
+ logger := log.NewNopLogger()
166
+ ms := store.NewCommitMultiStore(db, logger, storemetrics.NewNoOpMetrics())
155
167
  ms.MountStoreWithDB(vlocalchainStoreKey, storetypes.StoreTypeIAVL, db)
156
168
  err := ms.LoadLatestVersion()
157
169
  if err != nil {
@@ -216,8 +228,8 @@ func TestQuery(t *testing.T) {
216
228
  alreadyAddr := sdk.MustBech32ifyAddressBytes("cosmos", []byte("already"))
217
229
  nonexistentAddr := sdk.MustBech32ifyAddressBytes("cosmos", []byte("nonexistent"))
218
230
  bank := &mockBank{balances: map[string]sdk.Coins{
219
- firstAddr: []sdk.Coin{sdk.NewCoin("fresh", sdk.NewInt(123))},
220
- alreadyAddr: []sdk.Coin{sdk.NewCoin("stale", sdk.NewInt(321))},
231
+ firstAddr: []sdk.Coin{sdk.NewCoin("fresh", sdkmath.NewInt(123))},
232
+ alreadyAddr: []sdk.Coin{sdk.NewCoin("stale", sdkmath.NewInt(321))},
221
233
  }}
222
234
  transfer := &mockTransfer{}
223
235
  staking := &mockStaking{}
@@ -286,7 +298,7 @@ func TestQuery(t *testing.T) {
286
298
  t.Fatalf("unexpected error unmarshalling reply: %v: %v", ret, err)
287
299
  }
288
300
 
289
- if !pb.Balances.IsEqual(tc.expected) {
301
+ if !pb.Balances.Equal(tc.expected) {
290
302
  t.Errorf("unexpected balance: expected %v, got %v", tc.expected, pb.Balances)
291
303
  }
292
304
  })
@@ -358,8 +370,8 @@ func TestQuery(t *testing.T) {
358
370
  func TestExecuteTx(t *testing.T) {
359
371
  alreadyAddr := sdk.MustBech32ifyAddressBytes("cosmos", []byte("already"))
360
372
  bank := &mockBank{balances: map[string]sdk.Coins{
361
- firstAddr: []sdk.Coin{sdk.NewCoin("fresh", sdk.NewInt(123))},
362
- alreadyAddr: []sdk.Coin{sdk.NewCoin("stale", sdk.NewInt(321))},
373
+ firstAddr: []sdk.Coin{sdk.NewCoin("fresh", sdkmath.NewInt(123))},
374
+ alreadyAddr: []sdk.Coin{sdk.NewCoin("stale", sdkmath.NewInt(321))},
363
375
  }}
364
376
  transfer := &mockTransfer{}
365
377
  staking := &mockStaking{}
@@ -4,7 +4,6 @@ import (
4
4
  "fmt"
5
5
 
6
6
  "github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage/types"
7
- abci "github.com/cometbft/cometbft/abci/types"
8
7
  sdk "github.com/cosmos/cosmos-sdk/types"
9
8
  )
10
9
 
@@ -27,18 +26,19 @@ func ValidateGenesis(data *types.GenesisState) error {
27
26
  }
28
27
 
29
28
  func DefaultGenesisState() *types.GenesisState {
30
- return &types.GenesisState{
31
- Data: []*types.DataEntry{},
32
- }
29
+ return NewGenesisState()
33
30
  }
34
31
 
35
- func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) []abci.ValidatorUpdate {
36
- keeper.ImportStorage(ctx, data.Data)
37
- return []abci.ValidatorUpdate{}
32
+ func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState) error {
33
+ return keeper.ImportStorage(ctx, data.Data)
38
34
  }
39
35
 
40
- func ExportGenesis(ctx sdk.Context, keeper Keeper) *types.GenesisState {
36
+ func ExportGenesis(ctx sdk.Context, keeper Keeper) (*types.GenesisState, error) {
37
+ data, err := keeper.ExportStorage(ctx)
38
+ if err != nil {
39
+ return nil, err
40
+ }
41
41
  gs := NewGenesisState()
42
- gs.Data = keeper.ExportStorage(ctx)
43
- return gs
42
+ gs.Data = data
43
+ return gs, nil
44
44
  }
@@ -4,12 +4,13 @@ import (
4
4
  "fmt"
5
5
 
6
6
  sdkioerrors "cosmossdk.io/errors"
7
+ "github.com/cosmos/cosmos-sdk/baseapp"
7
8
  sdk "github.com/cosmos/cosmos-sdk/types"
8
9
  sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
9
10
  )
10
11
 
11
12
  // NewHandler returns a handler for "vstorage" type messages.
12
- func NewHandler(k Keeper) sdk.Handler {
13
+ func NewHandler(k Keeper) baseapp.MsgServiceHandler {
13
14
  return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
14
15
  errMsg := fmt.Sprintf("Unrecognized vstorage Msg type: %T", msg)
15
16
  return nil, sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)