@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.
- package/CHANGELOG.md +11 -187
- package/Makefile +2 -2
- package/ante/ante.go +2 -2
- package/ante/inbound.go +1 -2
- package/ante/inbound_test.go +3 -1
- package/ante/vm_admission.go +1 -2
- package/app/app.go +255 -174
- package/app/encoding.go +6 -3
- package/app/export.go +50 -21
- package/app/genesis.go +7 -5
- package/app/params/encoding.go +1 -1
- package/app/params/proto.go +6 -4
- package/app/sim_test.go +11 -13
- package/app/txconfig/tx_config.go +169 -0
- package/app/upgrade.go +52 -97
- package/app/upgrade_test.go +1 -1
- package/cmd/agd/agvm.go +1 -1
- package/cmd/agd/main.go +1 -1
- package/cmd/libdaemon/main.go +2 -2
- package/daemon/cmd/root.go +99 -30
- package/daemon/cmd/root_test.go +12 -27
- package/daemon/main.go +2 -9
- package/git-revision.txt +1 -1
- package/go.mod +129 -109
- package/go.sum +228 -469
- package/package.json +2 -2
- package/proto/agoric/swingset/msgs.proto +46 -9
- package/proto/agoric/swingset/swingset.proto +7 -2
- package/proto/agoric/vbank/vbank.proto +1 -1
- package/proto/agoric/vibc/msgs.proto +4 -0
- package/tests/e2e/vbank/vbank_test.go +172 -0
- package/tests/integrations/types/aminojson_test.go +214 -0
- package/tests/integrations/vbank/vbank_test.go +348 -0
- package/third_party/proto/amino/amino.proto +6 -1
- package/third_party/proto/cosmos/base/v1beta1/coin.proto +18 -5
- package/third_party/proto/cosmos/upgrade/v1beta1/upgrade.proto +4 -8
- package/third_party/proto/ibc/core/channel/v1/channel.proto +42 -17
- package/third_party/proto/ibc/core/client/v1/client.proto +48 -40
- package/types/address_hooks.go +2 -2
- package/types/address_hooks_test.go +3 -3
- package/types/ibc_packet.go +3 -3
- package/types/ibc_packet_test.go +3 -3
- package/types/kv_entry_helpers.go +3 -3
- package/types/kv_entry_helpers_test.go +2 -2
- package/types/legacy_address_encoder.go +58 -0
- package/vm/proto_json_test.go +1 -1
- package/vm/server.go +2 -1
- package/x/swingset/abci.go +2 -2
- package/x/swingset/client/cli/tx.go +16 -14
- package/x/swingset/config.go +1 -1
- package/x/swingset/genesis.go +2 -1
- package/x/swingset/handler.go +2 -1
- package/x/swingset/keeper/extension_snapshotter.go +14 -5
- package/x/swingset/keeper/extension_snapshotter_test.go +1 -1
- package/x/swingset/keeper/keeper.go +21 -17
- package/x/swingset/keeper/keeper_test.go +10 -7
- package/x/swingset/keeper/msg_server.go +26 -5
- package/x/swingset/keeper/swing_store_exports_handler.go +1 -1
- package/x/swingset/keeper/swing_store_exports_handler_test.go +1 -1
- package/x/swingset/module.go +20 -22
- package/x/swingset/types/codec.go +10 -5
- package/x/swingset/types/default-params.go +13 -12
- package/x/swingset/types/expected_keepers.go +5 -4
- package/x/swingset/types/msgs.go +50 -36
- package/x/swingset/types/msgs.pb.go +60 -51
- package/x/swingset/types/params_test.go +21 -20
- package/x/swingset/types/swingset.pb.go +67 -61
- package/x/vbank/genesis.go +12 -8
- package/x/vbank/handler.go +2 -1
- package/x/vbank/keeper/grpc_query.go +4 -1
- package/x/vbank/keeper/keeper.go +108 -23
- package/x/vbank/keeper/querier.go +4 -1
- package/x/vbank/keeper/rewards.go +6 -2
- package/x/vbank/module.go +47 -75
- package/x/vbank/types/expected_keepers.go +15 -10
- package/x/vbank/types/key.go +3 -0
- package/x/vbank/types/params.go +4 -3
- package/x/vbank/types/vbank.pb.go +41 -40
- package/x/vbank/vbank.go +25 -10
- package/x/vbank/vbank_test.go +213 -154
- package/x/vibc/handler.go +2 -1
- package/x/vibc/keeper/keeper.go +10 -10
- package/x/vibc/keeper/migrations.go +1 -1
- package/x/vibc/keeper/triggers.go +1 -1
- package/x/vibc/module.go +5 -22
- package/x/vibc/types/codec.go +2 -1
- package/x/vibc/types/expected_keepers.go +7 -5
- package/x/vibc/types/ibc_module.go +5 -5
- package/x/vibc/types/msgs.go +30 -7
- package/x/vibc/types/msgs.pb.go +29 -25
- package/x/vibc/types/receiver.go +2 -2
- package/x/vlocalchain/handler.go +2 -1
- package/x/vlocalchain/keeper/keeper.go +17 -5
- package/x/vlocalchain/keeper/keeper_test.go +3 -2
- package/x/vlocalchain/types/expected_keepers.go +7 -4
- package/x/vlocalchain/vlocalchain_test.go +38 -26
- package/x/vstorage/genesis.go +10 -10
- package/x/vstorage/handler.go +2 -1
- package/x/vstorage/keeper/keeper.go +68 -46
- package/x/vstorage/keeper/keeper_test.go +35 -19
- package/x/vstorage/module.go +27 -13
- package/x/vstorage/testing/queue.go +5 -3
- package/x/vstorage/vstorage.go +2 -1
- package/x/vstorage/vstorage_test.go +21 -17
- package/x/vtransfer/genesis.go +1 -3
- package/x/vtransfer/handler.go +3 -2
- package/x/vtransfer/ibc_middleware.go +5 -5
- package/x/vtransfer/ibc_middleware_test.go +43 -29
- package/x/vtransfer/keeper/keeper.go +35 -33
- package/x/vtransfer/module.go +8 -11
- package/x/vtransfer/types/expected_keepers.go +3 -3
- package/x/vtransfer/utils_test.go +26 -11
- 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
|
-
}
|
package/x/vibc/types/codec.go
CHANGED
|
@@ -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
|
-
|
|
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/
|
|
6
|
-
clienttypes "github.com/cosmos/ibc-go/
|
|
7
|
-
channel "github.com/cosmos/ibc-go/
|
|
8
|
-
ibcexported "github.com/cosmos/ibc-go/
|
|
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
|
|
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/
|
|
10
|
-
channeltypes "github.com/cosmos/ibc-go/
|
|
11
|
-
porttypes "github.com/cosmos/ibc-go/
|
|
12
|
-
host "github.com/cosmos/ibc-go/
|
|
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/
|
|
14
|
+
"github.com/cosmos/ibc-go/v8/modules/core/exported"
|
|
15
15
|
|
|
16
16
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
17
17
|
)
|
package/x/vibc/types/msgs.go
CHANGED
|
@@ -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/
|
|
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
|
-
//
|
|
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
|
}
|
package/x/vibc/types/msgs.pb.go
CHANGED
|
@@ -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/
|
|
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
|
-
//
|
|
132
|
-
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74,
|
|
133
|
-
0x14,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
132
|
+
// 401 bytes of a gzipped FileDescriptorProto
|
|
133
|
+
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x3d, 0xaf, 0xda, 0x30,
|
|
134
|
+
0x14, 0x4d, 0xa8, 0x84, 0x54, 0x53, 0xfa, 0x11, 0xf5, 0x03, 0xa5, 0x52, 0x4c, 0x33, 0x21, 0x24,
|
|
135
|
+
0x6c, 0x41, 0x87, 0x4a, 0x6c, 0x30, 0x17, 0xa9, 0x85, 0x4e, 0x5d, 0x2a, 0xc7, 0xb1, 0x4c, 0x44,
|
|
136
|
+
0x12, 0x47, 0x71, 0x40, 0xe5, 0x2f, 0xb4, 0xaa, 0xd4, 0xb9, 0x53, 0xf5, 0x7e, 0x01, 0x3f, 0x83,
|
|
137
|
+
0x91, 0xf1, 0x4d, 0xd1, 0x13, 0x0c, 0x3c, 0x31, 0x32, 0xbe, 0xe9, 0x29, 0x71, 0xf2, 0x80, 0xe1,
|
|
138
|
+
0x2d, 0xc9, 0xc9, 0xb9, 0x3e, 0x27, 0xbe, 0xe7, 0x5e, 0xf0, 0x96, 0x70, 0x11, 0x7b, 0x14, 0x2f,
|
|
139
|
+
0x3c, 0x87, 0xe2, 0x40, 0x72, 0x89, 0xa2, 0x58, 0x24, 0xc2, 0xa8, 0x29, 0x1e, 0x65, 0xbc, 0xf9,
|
|
140
|
+
0x8a, 0x04, 0x5e, 0x28, 0x70, 0xfe, 0x54, 0x75, 0xf3, 0x35, 0x17, 0x5c, 0xe4, 0x10, 0x67, 0xa8,
|
|
141
|
+
0x60, 0x3f, 0x64, 0x2e, 0x54, 0xc4, 0x0c, 0xd3, 0x29, 0x09, 0x43, 0xe6, 0xe3, 0x45, 0xb7, 0x84,
|
|
142
|
+
0xea, 0x88, 0xfd, 0xa7, 0x02, 0xea, 0x23, 0xc9, 0x27, 0x2c, 0x74, 0xbf, 0x10, 0x3a, 0x63, 0x89,
|
|
143
|
+
0xf1, 0x0d, 0x54, 0xa3, 0x1c, 0x35, 0xf4, 0xa6, 0xde, 0xaa, 0xf5, 0xde, 0x23, 0xcf, 0xa1, 0x28,
|
|
144
|
+
0x73, 0x41, 0xa5, 0x74, 0xd1, 0x45, 0xea, 0xf0, 0x10, 0xae, 0x53, 0xa8, 0x1d, 0x52, 0x58, 0x48,
|
|
145
|
+
0x8e, 0x29, 0xac, 0x2f, 0x49, 0xe0, 0xf7, 0x6d, 0xf5, 0x6d, 0x8f, 0x8b, 0x82, 0xf1, 0x5b, 0x07,
|
|
146
|
+
0x55, 0xc9, 0x42, 0x97, 0xc5, 0x8d, 0x4a, 0x53, 0x6f, 0x3d, 0x1b, 0xca, 0x43, 0x0a, 0x9f, 0xca,
|
|
147
|
+
0xb9, 0x13, 0x78, 0x49, 0xc2, 0xe2, 0x63, 0x0a, 0x5f, 0x2a, 0xe1, 0x03, 0x65, 0xdf, 0xa5, 0xb0,
|
|
148
|
+
0xc3, 0xbd, 0x64, 0x3a, 0x77, 0x10, 0x15, 0x01, 0xa6, 0x42, 0x06, 0x42, 0x16, 0xaf, 0x8e, 0x74,
|
|
149
|
+
0x67, 0x38, 0x59, 0x46, 0x4c, 0xa2, 0x01, 0xa5, 0x03, 0xd7, 0x8d, 0x99, 0x94, 0xff, 0xf6, 0xab,
|
|
150
|
+
0xf6, 0x73, 0x9f, 0x71, 0x42, 0x97, 0x3f, 0x88, 0xa2, 0xae, 0xf6, 0xab, 0xf6, 0xe9, 0x2f, 0xe3,
|
|
151
|
+
0xe2, 0x0a, 0xfd, 0xc6, 0xed, 0x7f, 0xa8, 0xfd, 0xda, 0xaf, 0xda, 0x2f, 0xf2, 0xa0, 0x4f, 0xdd,
|
|
152
|
+
0xdb, 0xef, 0xc0, 0x9b, 0x8b, 0x38, 0xc6, 0x4c, 0x46, 0x22, 0x94, 0xac, 0x37, 0x01, 0x4f, 0x46,
|
|
153
|
+
0x92, 0x1b, 0x9f, 0x01, 0x38, 0xcb, 0xca, 0x44, 0x67, 0x73, 0x41, 0x17, 0x42, 0xd3, 0x7e, 0xbc,
|
|
154
|
+
0x56, 0x9a, 0x0e, 0xbf, 0xae, 0xb7, 0x96, 0xbe, 0xd9, 0x5a, 0xfa, 0xcd, 0xd6, 0xd2, 0xff, 0xee,
|
|
155
|
+
0x2c, 0x6d, 0xb3, 0xb3, 0xb4, 0xeb, 0x9d, 0xa5, 0x7d, 0xff, 0x74, 0xd6, 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.
|
package/x/vibc/types/receiver.go
CHANGED
|
@@ -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/
|
|
10
|
+
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
|
|
11
11
|
|
|
12
|
-
"github.com/cosmos/ibc-go/
|
|
12
|
+
"github.com/cosmos/ibc-go/v8/modules/core/exported"
|
|
13
13
|
|
|
14
14
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
15
15
|
)
|
package/x/vlocalchain/handler.go
CHANGED
|
@@ -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)
|
|
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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.
|
|
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",
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
"
|
|
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/
|
|
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/
|
|
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 =
|
|
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
|
|
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)
|
|
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
|
|
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:
|
|
123
|
-
Balance:
|
|
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
|
-
|
|
133
|
-
|
|
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(
|
|
145
|
+
txRouter.SetInterfaceRegistry(encCfg.InterfaceRegistry)
|
|
137
146
|
queryRouter := baseapp.NewGRPCQueryRouter()
|
|
138
|
-
queryRouter.SetInterfaceRegistry(
|
|
147
|
+
queryRouter.SetInterfaceRegistry(encCfg.InterfaceRegistry)
|
|
139
148
|
|
|
140
|
-
|
|
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(
|
|
154
|
+
transfertypes.RegisterInterfaces(encCfg.InterfaceRegistry)
|
|
144
155
|
transfertypes.RegisterMsgServer(txRouter, transfer)
|
|
145
156
|
transfertypes.RegisterQueryServer(queryRouter, transfer)
|
|
146
|
-
stakingtypes.RegisterInterfaces(
|
|
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
|
-
|
|
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",
|
|
220
|
-
alreadyAddr: []sdk.Coin{sdk.NewCoin("stale",
|
|
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.
|
|
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",
|
|
362
|
-
alreadyAddr: []sdk.Coin{sdk.NewCoin("stale",
|
|
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{}
|
package/x/vstorage/genesis.go
CHANGED
|
@@ -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
|
|
31
|
-
Data: []*types.DataEntry{},
|
|
32
|
-
}
|
|
29
|
+
return NewGenesisState()
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
func InitGenesis(ctx sdk.Context, keeper Keeper, data *types.GenesisState)
|
|
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 =
|
|
43
|
-
return gs
|
|
42
|
+
gs.Data = data
|
|
43
|
+
return gs, nil
|
|
44
44
|
}
|
package/x/vstorage/handler.go
CHANGED
|
@@ -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)
|
|
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)
|