@agoric/cosmos 0.35.0-upgrade-14-dev-c8f9e7b.0 → 0.35.0-upgrade-16a-dev-fb592e4.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 +121 -77
- package/MAINTAINERS.md +3 -0
- package/Makefile +36 -26
- package/ante/ante.go +7 -9
- package/ante/inbound_test.go +3 -2
- package/ante/vm_admission.go +2 -1
- package/app/app.go +212 -140
- package/app/upgrade.go +76 -0
- package/cmd/agd/agvm.go +42 -0
- package/cmd/agd/main.go +130 -11
- package/cmd/libdaemon/main.go +64 -53
- package/cmd/libdaemon/main_test.go +2 -1
- package/daemon/cmd/root.go +171 -74
- package/daemon/cmd/root_test.go +189 -1
- package/daemon/main.go +4 -2
- package/e2e_test/Makefile +29 -0
- package/e2e_test/README.md +100 -0
- package/e2e_test/go.mod +217 -0
- package/e2e_test/go.sum +1323 -0
- package/e2e_test/ibc_conformance_test.go +56 -0
- package/e2e_test/pfm_test.go +613 -0
- package/e2e_test/util.go +271 -0
- package/git-revision.txt +1 -1
- package/go.mod +22 -11
- package/go.sum +17 -13
- package/package.json +9 -5
- package/proto/agoric/swingset/genesis.proto +4 -0
- package/proto/agoric/swingset/swingset.proto +1 -1
- package/proto/agoric/vlocalchain/.clang-format +7 -0
- package/proto/agoric/vlocalchain/vlocalchain.proto +31 -0
- package/proto/agoric/vtransfer/genesis.proto +18 -0
- package/scripts/protocgen.sh +7 -8
- package/types/kv_entry_helpers.go +42 -0
- package/upgradegaia.sh +8 -8
- package/vm/action.go +5 -4
- package/vm/action_test.go +31 -11
- package/vm/client.go +113 -0
- package/vm/client_test.go +182 -0
- package/vm/controller.go +17 -40
- package/vm/core_proposals.go +22 -2
- package/vm/jsonrpcconn/jsonrpcconn.go +160 -0
- package/vm/jsonrpcconn/jsonrpcconn_test.go +126 -0
- package/vm/proto_json.go +38 -0
- package/vm/proto_json_test.go +103 -0
- package/vm/server.go +124 -0
- package/x/swingset/abci.go +10 -10
- package/x/swingset/alias.go +2 -0
- package/x/swingset/client/cli/tx.go +4 -0
- package/x/swingset/genesis.go +84 -24
- package/x/swingset/handler.go +2 -1
- package/x/swingset/keeper/extension_snapshotter.go +2 -2
- package/x/swingset/keeper/keeper.go +13 -25
- package/x/swingset/keeper/msg_server.go +18 -18
- package/x/swingset/keeper/proposal.go +3 -3
- package/x/swingset/keeper/querier.go +12 -11
- package/x/swingset/keeper/swing_store_exports_handler.go +21 -6
- package/x/swingset/keeper/test_utils.go +16 -0
- package/x/swingset/module.go +7 -7
- package/x/swingset/proposal_handler.go +2 -1
- package/x/swingset/testing/queue.go +17 -0
- package/x/swingset/types/default-params.go +1 -1
- package/x/swingset/types/expected_keepers.go +3 -2
- package/x/swingset/types/genesis.pb.go +78 -25
- package/x/swingset/types/msgs.go +44 -24
- package/x/swingset/types/params.go +2 -1
- package/x/swingset/types/proposal.go +5 -4
- package/x/swingset/types/swingset.pb.go +1 -1
- package/x/vbank/genesis.go +0 -2
- package/x/vbank/handler.go +2 -1
- package/x/vbank/keeper/querier.go +4 -3
- package/x/vbank/module.go +0 -5
- package/x/vbank/types/msgs.go +0 -12
- package/x/vbank/vbank.go +9 -9
- package/x/vbank/vbank_test.go +2 -2
- package/x/vibc/alias.go +3 -0
- package/x/vibc/handler.go +16 -9
- package/x/vibc/keeper/keeper.go +102 -65
- package/x/vibc/keeper/triggers.go +101 -0
- package/x/vibc/module.go +5 -8
- package/x/vibc/types/expected_keepers.go +13 -0
- package/x/vibc/types/ibc_module.go +336 -0
- package/x/vibc/types/receiver.go +170 -0
- package/x/vlocalchain/alias.go +19 -0
- package/x/vlocalchain/handler.go +21 -0
- package/x/vlocalchain/keeper/keeper.go +279 -0
- package/x/vlocalchain/keeper/keeper_test.go +97 -0
- package/x/vlocalchain/types/codec.go +34 -0
- package/x/vlocalchain/types/key.go +27 -0
- package/x/vlocalchain/types/msgs.go +16 -0
- package/x/vlocalchain/types/vlocalchain.pb.go +1072 -0
- package/x/vlocalchain/vlocalchain.go +114 -0
- package/x/vlocalchain/vlocalchain_test.go +434 -0
- package/x/vstorage/handler.go +2 -1
- package/x/vstorage/keeper/grpc_query.go +0 -1
- package/x/vstorage/keeper/keeper.go +13 -20
- package/x/vstorage/keeper/querier.go +6 -5
- package/x/vstorage/keeper/querier_test.go +4 -3
- package/x/vstorage/module.go +0 -5
- package/x/vstorage/testing/queue.go +27 -0
- package/x/vtransfer/alias.go +13 -0
- package/x/vtransfer/genesis.go +39 -0
- package/x/vtransfer/genesis_test.go +12 -0
- package/x/vtransfer/handler.go +20 -0
- package/x/vtransfer/ibc_middleware.go +186 -0
- package/x/vtransfer/ibc_middleware_test.go +448 -0
- package/x/vtransfer/keeper/keeper.go +281 -0
- package/x/vtransfer/module.go +124 -0
- package/x/vtransfer/types/expected_keepers.go +38 -0
- package/x/vtransfer/types/genesis.pb.go +327 -0
- package/x/vtransfer/types/key.go +9 -0
- package/x/vtransfer/types/msgs.go +9 -0
- package/ante/fee.go +0 -96
- package/proto/agoric/lien/genesis.proto +0 -25
- package/proto/agoric/lien/lien.proto +0 -25
- package/x/lien/alias.go +0 -17
- package/x/lien/genesis.go +0 -58
- package/x/lien/genesis_test.go +0 -101
- package/x/lien/keeper/account.go +0 -290
- package/x/lien/keeper/keeper.go +0 -255
- package/x/lien/keeper/keeper_test.go +0 -623
- package/x/lien/lien.go +0 -205
- package/x/lien/lien_test.go +0 -533
- package/x/lien/module.go +0 -115
- package/x/lien/spec/01_concepts.md +0 -146
- package/x/lien/spec/02_messages.md +0 -96
- package/x/lien/types/accountkeeper.go +0 -81
- package/x/lien/types/accountstate.go +0 -27
- package/x/lien/types/expected_keepers.go +0 -18
- package/x/lien/types/genesis.pb.go +0 -567
- package/x/lien/types/key.go +0 -25
- package/x/lien/types/lien.pb.go +0 -403
- package/x/vibc/ibc.go +0 -394
- /package/{src/index.cjs → index.cjs} +0 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
2
|
+
// source: agoric/vtransfer/genesis.proto
|
|
3
|
+
|
|
4
|
+
package types
|
|
5
|
+
|
|
6
|
+
import (
|
|
7
|
+
fmt "fmt"
|
|
8
|
+
github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types"
|
|
9
|
+
_ "github.com/gogo/protobuf/gogoproto"
|
|
10
|
+
proto "github.com/gogo/protobuf/proto"
|
|
11
|
+
io "io"
|
|
12
|
+
math "math"
|
|
13
|
+
math_bits "math/bits"
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
// Reference imports to suppress errors if they are not otherwise used.
|
|
17
|
+
var _ = proto.Marshal
|
|
18
|
+
var _ = fmt.Errorf
|
|
19
|
+
var _ = math.Inf
|
|
20
|
+
|
|
21
|
+
// This is a compile-time assertion to ensure that this generated file
|
|
22
|
+
// is compatible with the proto package it is being compiled against.
|
|
23
|
+
// A compilation error at this line likely means your copy of the
|
|
24
|
+
// proto package needs to be updated.
|
|
25
|
+
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
|
26
|
+
|
|
27
|
+
// The initial and exported module state.
|
|
28
|
+
type GenesisState struct {
|
|
29
|
+
WatchedAddresses []github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,rep,name=watched_addresses,json=watchedAddresses,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"watched_addresses" yaml:"watched_addresses"`
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
func (m *GenesisState) Reset() { *m = GenesisState{} }
|
|
33
|
+
func (m *GenesisState) String() string { return proto.CompactTextString(m) }
|
|
34
|
+
func (*GenesisState) ProtoMessage() {}
|
|
35
|
+
func (*GenesisState) Descriptor() ([]byte, []int) {
|
|
36
|
+
return fileDescriptor_fd0b59a10ad6824e, []int{0}
|
|
37
|
+
}
|
|
38
|
+
func (m *GenesisState) XXX_Unmarshal(b []byte) error {
|
|
39
|
+
return m.Unmarshal(b)
|
|
40
|
+
}
|
|
41
|
+
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
42
|
+
if deterministic {
|
|
43
|
+
return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic)
|
|
44
|
+
} else {
|
|
45
|
+
b = b[:cap(b)]
|
|
46
|
+
n, err := m.MarshalToSizedBuffer(b)
|
|
47
|
+
if err != nil {
|
|
48
|
+
return nil, err
|
|
49
|
+
}
|
|
50
|
+
return b[:n], nil
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
func (m *GenesisState) XXX_Merge(src proto.Message) {
|
|
54
|
+
xxx_messageInfo_GenesisState.Merge(m, src)
|
|
55
|
+
}
|
|
56
|
+
func (m *GenesisState) XXX_Size() int {
|
|
57
|
+
return m.Size()
|
|
58
|
+
}
|
|
59
|
+
func (m *GenesisState) XXX_DiscardUnknown() {
|
|
60
|
+
xxx_messageInfo_GenesisState.DiscardUnknown(m)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var xxx_messageInfo_GenesisState proto.InternalMessageInfo
|
|
64
|
+
|
|
65
|
+
func (m *GenesisState) GetWatchedAddresses() []github_com_cosmos_cosmos_sdk_types.AccAddress {
|
|
66
|
+
if m != nil {
|
|
67
|
+
return m.WatchedAddresses
|
|
68
|
+
}
|
|
69
|
+
return nil
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
func init() {
|
|
73
|
+
proto.RegisterType((*GenesisState)(nil), "agoric.vtransfer.GenesisState")
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
func init() { proto.RegisterFile("agoric/vtransfer/genesis.proto", fileDescriptor_fd0b59a10ad6824e) }
|
|
77
|
+
|
|
78
|
+
var fileDescriptor_fd0b59a10ad6824e = []byte{
|
|
79
|
+
// 249 bytes of a gzipped FileDescriptorProto
|
|
80
|
+
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x4c, 0xcf, 0x2f,
|
|
81
|
+
0xca, 0x4c, 0xd6, 0x2f, 0x2b, 0x29, 0x4a, 0xcc, 0x2b, 0x4e, 0x4b, 0x2d, 0xd2, 0x4f, 0x4f, 0xcd,
|
|
82
|
+
0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0xc8, 0xeb, 0xc1,
|
|
83
|
+
0xe5, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x92, 0xfa, 0x20, 0x16, 0x44, 0x9d, 0xd2, 0x32,
|
|
84
|
+
0x46, 0x2e, 0x1e, 0x77, 0x88, 0xce, 0xe0, 0x92, 0xc4, 0x92, 0x54, 0xa1, 0x7e, 0x46, 0x2e, 0xc1,
|
|
85
|
+
0xf2, 0xc4, 0x92, 0xe4, 0x8c, 0xd4, 0x94, 0xf8, 0xc4, 0x94, 0x94, 0xa2, 0xd4, 0xe2, 0xe2, 0xd4,
|
|
86
|
+
0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x1e, 0xa7, 0xa4, 0x57, 0xf7, 0xe4, 0x31, 0x25, 0x3f, 0xdd,
|
|
87
|
+
0x93, 0x97, 0xa8, 0x4c, 0xcc, 0xcd, 0xb1, 0x52, 0xc2, 0x90, 0x52, 0xfa, 0x75, 0x4f, 0x5e, 0x37,
|
|
88
|
+
0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0x39, 0xbf, 0x38, 0x37, 0xbf,
|
|
89
|
+
0x18, 0x4a, 0xe9, 0x16, 0xa7, 0x64, 0xeb, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0x39, 0x26, 0x27,
|
|
90
|
+
0x3b, 0x42, 0xf4, 0x04, 0x09, 0x40, 0x0d, 0x71, 0x84, 0x99, 0x61, 0xc5, 0xf2, 0x62, 0x81, 0x3c,
|
|
91
|
+
0x83, 0x53, 0xd8, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38,
|
|
92
|
+
0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xd9, 0x20, 0x59,
|
|
93
|
+
0xe0, 0x08, 0x09, 0x15, 0x88, 0xe7, 0xc1, 0x16, 0xa4, 0xe7, 0xe7, 0x24, 0xe6, 0xa5, 0xc3, 0x6c,
|
|
94
|
+
0xae, 0x40, 0x0a, 0x30, 0xb0, 0xd5, 0x49, 0x6c, 0xe0, 0x70, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff,
|
|
95
|
+
0xff, 0x78, 0x52, 0xc9, 0xd5, 0x51, 0x01, 0x00, 0x00,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
|
|
99
|
+
size := m.Size()
|
|
100
|
+
dAtA = make([]byte, size)
|
|
101
|
+
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
102
|
+
if err != nil {
|
|
103
|
+
return nil, err
|
|
104
|
+
}
|
|
105
|
+
return dAtA[:n], nil
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) {
|
|
109
|
+
size := m.Size()
|
|
110
|
+
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
114
|
+
i := len(dAtA)
|
|
115
|
+
_ = i
|
|
116
|
+
var l int
|
|
117
|
+
_ = l
|
|
118
|
+
if len(m.WatchedAddresses) > 0 {
|
|
119
|
+
for iNdEx := len(m.WatchedAddresses) - 1; iNdEx >= 0; iNdEx-- {
|
|
120
|
+
i -= len(m.WatchedAddresses[iNdEx])
|
|
121
|
+
copy(dAtA[i:], m.WatchedAddresses[iNdEx])
|
|
122
|
+
i = encodeVarintGenesis(dAtA, i, uint64(len(m.WatchedAddresses[iNdEx])))
|
|
123
|
+
i--
|
|
124
|
+
dAtA[i] = 0xa
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return len(dAtA) - i, nil
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int {
|
|
131
|
+
offset -= sovGenesis(v)
|
|
132
|
+
base := offset
|
|
133
|
+
for v >= 1<<7 {
|
|
134
|
+
dAtA[offset] = uint8(v&0x7f | 0x80)
|
|
135
|
+
v >>= 7
|
|
136
|
+
offset++
|
|
137
|
+
}
|
|
138
|
+
dAtA[offset] = uint8(v)
|
|
139
|
+
return base
|
|
140
|
+
}
|
|
141
|
+
func (m *GenesisState) Size() (n int) {
|
|
142
|
+
if m == nil {
|
|
143
|
+
return 0
|
|
144
|
+
}
|
|
145
|
+
var l int
|
|
146
|
+
_ = l
|
|
147
|
+
if len(m.WatchedAddresses) > 0 {
|
|
148
|
+
for _, b := range m.WatchedAddresses {
|
|
149
|
+
l = len(b)
|
|
150
|
+
n += 1 + l + sovGenesis(uint64(l))
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return n
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
func sovGenesis(x uint64) (n int) {
|
|
157
|
+
return (math_bits.Len64(x|1) + 6) / 7
|
|
158
|
+
}
|
|
159
|
+
func sozGenesis(x uint64) (n int) {
|
|
160
|
+
return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
|
161
|
+
}
|
|
162
|
+
func (m *GenesisState) Unmarshal(dAtA []byte) error {
|
|
163
|
+
l := len(dAtA)
|
|
164
|
+
iNdEx := 0
|
|
165
|
+
for iNdEx < l {
|
|
166
|
+
preIndex := iNdEx
|
|
167
|
+
var wire uint64
|
|
168
|
+
for shift := uint(0); ; shift += 7 {
|
|
169
|
+
if shift >= 64 {
|
|
170
|
+
return ErrIntOverflowGenesis
|
|
171
|
+
}
|
|
172
|
+
if iNdEx >= l {
|
|
173
|
+
return io.ErrUnexpectedEOF
|
|
174
|
+
}
|
|
175
|
+
b := dAtA[iNdEx]
|
|
176
|
+
iNdEx++
|
|
177
|
+
wire |= uint64(b&0x7F) << shift
|
|
178
|
+
if b < 0x80 {
|
|
179
|
+
break
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
fieldNum := int32(wire >> 3)
|
|
183
|
+
wireType := int(wire & 0x7)
|
|
184
|
+
if wireType == 4 {
|
|
185
|
+
return fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
|
|
186
|
+
}
|
|
187
|
+
if fieldNum <= 0 {
|
|
188
|
+
return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
189
|
+
}
|
|
190
|
+
switch fieldNum {
|
|
191
|
+
case 1:
|
|
192
|
+
if wireType != 2 {
|
|
193
|
+
return fmt.Errorf("proto: wrong wireType = %d for field WatchedAddresses", wireType)
|
|
194
|
+
}
|
|
195
|
+
var byteLen int
|
|
196
|
+
for shift := uint(0); ; shift += 7 {
|
|
197
|
+
if shift >= 64 {
|
|
198
|
+
return ErrIntOverflowGenesis
|
|
199
|
+
}
|
|
200
|
+
if iNdEx >= l {
|
|
201
|
+
return io.ErrUnexpectedEOF
|
|
202
|
+
}
|
|
203
|
+
b := dAtA[iNdEx]
|
|
204
|
+
iNdEx++
|
|
205
|
+
byteLen |= int(b&0x7F) << shift
|
|
206
|
+
if b < 0x80 {
|
|
207
|
+
break
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if byteLen < 0 {
|
|
211
|
+
return ErrInvalidLengthGenesis
|
|
212
|
+
}
|
|
213
|
+
postIndex := iNdEx + byteLen
|
|
214
|
+
if postIndex < 0 {
|
|
215
|
+
return ErrInvalidLengthGenesis
|
|
216
|
+
}
|
|
217
|
+
if postIndex > l {
|
|
218
|
+
return io.ErrUnexpectedEOF
|
|
219
|
+
}
|
|
220
|
+
m.WatchedAddresses = append(m.WatchedAddresses, make([]byte, postIndex-iNdEx))
|
|
221
|
+
copy(m.WatchedAddresses[len(m.WatchedAddresses)-1], dAtA[iNdEx:postIndex])
|
|
222
|
+
iNdEx = postIndex
|
|
223
|
+
default:
|
|
224
|
+
iNdEx = preIndex
|
|
225
|
+
skippy, err := skipGenesis(dAtA[iNdEx:])
|
|
226
|
+
if err != nil {
|
|
227
|
+
return err
|
|
228
|
+
}
|
|
229
|
+
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
230
|
+
return ErrInvalidLengthGenesis
|
|
231
|
+
}
|
|
232
|
+
if (iNdEx + skippy) > l {
|
|
233
|
+
return io.ErrUnexpectedEOF
|
|
234
|
+
}
|
|
235
|
+
iNdEx += skippy
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if iNdEx > l {
|
|
240
|
+
return io.ErrUnexpectedEOF
|
|
241
|
+
}
|
|
242
|
+
return nil
|
|
243
|
+
}
|
|
244
|
+
func skipGenesis(dAtA []byte) (n int, err error) {
|
|
245
|
+
l := len(dAtA)
|
|
246
|
+
iNdEx := 0
|
|
247
|
+
depth := 0
|
|
248
|
+
for iNdEx < l {
|
|
249
|
+
var wire uint64
|
|
250
|
+
for shift := uint(0); ; shift += 7 {
|
|
251
|
+
if shift >= 64 {
|
|
252
|
+
return 0, ErrIntOverflowGenesis
|
|
253
|
+
}
|
|
254
|
+
if iNdEx >= l {
|
|
255
|
+
return 0, io.ErrUnexpectedEOF
|
|
256
|
+
}
|
|
257
|
+
b := dAtA[iNdEx]
|
|
258
|
+
iNdEx++
|
|
259
|
+
wire |= (uint64(b) & 0x7F) << shift
|
|
260
|
+
if b < 0x80 {
|
|
261
|
+
break
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
wireType := int(wire & 0x7)
|
|
265
|
+
switch wireType {
|
|
266
|
+
case 0:
|
|
267
|
+
for shift := uint(0); ; shift += 7 {
|
|
268
|
+
if shift >= 64 {
|
|
269
|
+
return 0, ErrIntOverflowGenesis
|
|
270
|
+
}
|
|
271
|
+
if iNdEx >= l {
|
|
272
|
+
return 0, io.ErrUnexpectedEOF
|
|
273
|
+
}
|
|
274
|
+
iNdEx++
|
|
275
|
+
if dAtA[iNdEx-1] < 0x80 {
|
|
276
|
+
break
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
case 1:
|
|
280
|
+
iNdEx += 8
|
|
281
|
+
case 2:
|
|
282
|
+
var length int
|
|
283
|
+
for shift := uint(0); ; shift += 7 {
|
|
284
|
+
if shift >= 64 {
|
|
285
|
+
return 0, ErrIntOverflowGenesis
|
|
286
|
+
}
|
|
287
|
+
if iNdEx >= l {
|
|
288
|
+
return 0, io.ErrUnexpectedEOF
|
|
289
|
+
}
|
|
290
|
+
b := dAtA[iNdEx]
|
|
291
|
+
iNdEx++
|
|
292
|
+
length |= (int(b) & 0x7F) << shift
|
|
293
|
+
if b < 0x80 {
|
|
294
|
+
break
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if length < 0 {
|
|
298
|
+
return 0, ErrInvalidLengthGenesis
|
|
299
|
+
}
|
|
300
|
+
iNdEx += length
|
|
301
|
+
case 3:
|
|
302
|
+
depth++
|
|
303
|
+
case 4:
|
|
304
|
+
if depth == 0 {
|
|
305
|
+
return 0, ErrUnexpectedEndOfGroupGenesis
|
|
306
|
+
}
|
|
307
|
+
depth--
|
|
308
|
+
case 5:
|
|
309
|
+
iNdEx += 4
|
|
310
|
+
default:
|
|
311
|
+
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
|
312
|
+
}
|
|
313
|
+
if iNdEx < 0 {
|
|
314
|
+
return 0, ErrInvalidLengthGenesis
|
|
315
|
+
}
|
|
316
|
+
if depth == 0 {
|
|
317
|
+
return iNdEx, nil
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return 0, io.ErrUnexpectedEOF
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
var (
|
|
324
|
+
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
|
|
325
|
+
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
|
|
326
|
+
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
|
|
327
|
+
)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
package types
|
|
2
|
+
|
|
3
|
+
const RouterKey = ModuleName // this was defined in your key.go file
|
|
4
|
+
|
|
5
|
+
type InvokeMemo struct {
|
|
6
|
+
InvokeOnAcknowledgementPacket string `json:"invokeOnAcknowledgementPacket"`
|
|
7
|
+
InvokeOnTimeoutPacket string `json:"invokeOnTimeoutPacket"`
|
|
8
|
+
InvokeWriteAcknowledgement string `json:"invokeWriteAcknowledgement"`
|
|
9
|
+
}
|
package/ante/fee.go
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
package ante
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"fmt"
|
|
5
|
-
|
|
6
|
-
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
7
|
-
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
|
8
|
-
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
// DeductFeeDecorator deducts fees from the first signer of the tx
|
|
12
|
-
// If the first signer does not have the funds to pay for the fees, return with InsufficientFunds error
|
|
13
|
-
// Call next AnteHandler if fees successfully deducted
|
|
14
|
-
// CONTRACT: Tx must implement FeeTx interface to use DeductFeeDecorator
|
|
15
|
-
type DeductFeeDecorator struct {
|
|
16
|
-
ak AccountKeeper
|
|
17
|
-
bankKeeper types.BankKeeper
|
|
18
|
-
feegrantKeeper FeegrantKeeper
|
|
19
|
-
feeCollectorName string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
func NewDeductFeeDecorator(ak AccountKeeper, bk types.BankKeeper, fk FeegrantKeeper, feeCollectorName string) DeductFeeDecorator {
|
|
23
|
-
return DeductFeeDecorator{
|
|
24
|
-
ak: ak,
|
|
25
|
-
bankKeeper: bk,
|
|
26
|
-
feegrantKeeper: fk,
|
|
27
|
-
feeCollectorName: feeCollectorName,
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
func (dfd DeductFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
|
|
32
|
-
feeTx, ok := tx.(sdk.FeeTx)
|
|
33
|
-
if !ok {
|
|
34
|
-
return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "Tx must be a FeeTx")
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if addr := dfd.ak.GetModuleAddress(dfd.feeCollectorName); addr == nil {
|
|
38
|
-
return ctx, fmt.Errorf("Fee collector module account (%s) has not been set", dfd.feeCollectorName)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
fee := feeTx.GetFee()
|
|
42
|
-
feePayer := feeTx.FeePayer()
|
|
43
|
-
feeGranter := feeTx.FeeGranter()
|
|
44
|
-
|
|
45
|
-
deductFeesFrom := feePayer
|
|
46
|
-
|
|
47
|
-
// if feegranter set deduct fee from feegranter account.
|
|
48
|
-
// this works with only when feegrant enabled.
|
|
49
|
-
if feeGranter != nil {
|
|
50
|
-
if dfd.feegrantKeeper == nil {
|
|
51
|
-
return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "fee grants are not enabled")
|
|
52
|
-
} else if !feeGranter.Equals(feePayer) {
|
|
53
|
-
err := dfd.feegrantKeeper.UseGrantedFees(ctx, feeGranter, feePayer, fee, tx.GetMsgs())
|
|
54
|
-
|
|
55
|
-
if err != nil {
|
|
56
|
-
return ctx, sdkerrors.Wrapf(err, "%s not allowed to pay fees from %s", feeGranter, feePayer)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
deductFeesFrom = feeGranter
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
deductFeesFromAcc := dfd.ak.GetAccount(ctx, deductFeesFrom)
|
|
64
|
-
if deductFeesFromAcc == nil {
|
|
65
|
-
return ctx, sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "fee payer address: %s does not exist", deductFeesFrom)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// deduct the fees
|
|
69
|
-
if !feeTx.GetFee().IsZero() {
|
|
70
|
-
err = DeductFees(dfd.bankKeeper, ctx, deductFeesFromAcc, feeTx.GetFee(), dfd.feeCollectorName)
|
|
71
|
-
if err != nil {
|
|
72
|
-
return ctx, err
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
events := sdk.Events{sdk.NewEvent(sdk.EventTypeTx,
|
|
77
|
-
sdk.NewAttribute(sdk.AttributeKeyFee, feeTx.GetFee().String()),
|
|
78
|
-
)}
|
|
79
|
-
ctx.EventManager().EmitEvents(events)
|
|
80
|
-
|
|
81
|
-
return next(ctx, tx, simulate)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// DeductFees deducts fees from the given account.
|
|
85
|
-
func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc types.AccountI, fees sdk.Coins, feeCollectorName string) error {
|
|
86
|
-
if !fees.IsValid() {
|
|
87
|
-
return sdkerrors.Wrapf(sdkerrors.ErrInsufficientFee, "invalid fee amount: %s", fees)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
err := bankKeeper.SendCoinsFromAccountToModule(ctx, acc.GetAddress(), feeCollectorName, fees)
|
|
91
|
-
if err != nil {
|
|
92
|
-
return sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, err.Error())
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return nil
|
|
96
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
package agoric.lien;
|
|
3
|
-
|
|
4
|
-
import "gogoproto/gogo.proto";
|
|
5
|
-
import "agoric/lien/lien.proto";
|
|
6
|
-
|
|
7
|
-
option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/lien/types";
|
|
8
|
-
|
|
9
|
-
// The initial or exported state.
|
|
10
|
-
message GenesisState {
|
|
11
|
-
option (gogoproto.equal) = false;
|
|
12
|
-
|
|
13
|
-
repeated AccountLien liens = 1 [
|
|
14
|
-
(gogoproto.nullable) = false
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// The lien on a particular account
|
|
19
|
-
message AccountLien {
|
|
20
|
-
// Account address, bech32-encoded.
|
|
21
|
-
string address = 1;
|
|
22
|
-
|
|
23
|
-
// The liened amount. Should be nonzero.
|
|
24
|
-
Lien lien = 2;
|
|
25
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
package agoric.lien;
|
|
3
|
-
|
|
4
|
-
import "gogoproto/gogo.proto";
|
|
5
|
-
import "cosmos/base/v1beta1/coin.proto";
|
|
6
|
-
|
|
7
|
-
option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/lien/types";
|
|
8
|
-
|
|
9
|
-
// Lien contains the lien state of a particular account.
|
|
10
|
-
message Lien {
|
|
11
|
-
// coins holds the amount liened
|
|
12
|
-
repeated cosmos.base.v1beta1.Coin coins = 1 [
|
|
13
|
-
(gogoproto.nullable) = false,
|
|
14
|
-
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
|
|
15
|
-
(gogoproto.moretags) = "yaml:\"coins\""
|
|
16
|
-
];
|
|
17
|
-
// delegated tracks the net amount delegated for non-vesting accounts,
|
|
18
|
-
// or zero coins for vesting accounts.
|
|
19
|
-
// (Vesting accounts have their own fields to track delegation.)
|
|
20
|
-
repeated cosmos.base.v1beta1.Coin delegated = 2 [
|
|
21
|
-
(gogoproto.nullable) = false,
|
|
22
|
-
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
|
|
23
|
-
(gogoproto.moretags) = "yaml:\"delegated\""
|
|
24
|
-
];
|
|
25
|
-
}
|
package/x/lien/alias.go
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
package lien
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"github.com/Agoric/agoric-sdk/golang/cosmos/x/lien/keeper"
|
|
5
|
-
"github.com/Agoric/agoric-sdk/golang/cosmos/x/lien/types"
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
var (
|
|
9
|
-
ModuleName = types.ModuleName
|
|
10
|
-
NewKeeper = keeper.NewKeeper
|
|
11
|
-
NewWrappedAccountKeeper = types.NewWrappedAccountKeeper
|
|
12
|
-
StoreKey = types.StoreKey
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
type (
|
|
16
|
-
Keeper = keeper.Keeper
|
|
17
|
-
)
|
package/x/lien/genesis.go
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
package lien
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"github.com/Agoric/agoric-sdk/golang/cosmos/x/lien/types"
|
|
5
|
-
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
// DefaultGenesisState returns an empty GenesisState.
|
|
9
|
-
func DefaultGenesisState() types.GenesisState {
|
|
10
|
-
return types.GenesisState{}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// ValidateGenesis returns whether genesisState is well-formed.
|
|
14
|
-
// Since liens can apply to otherwise empty accounts and the source of truth
|
|
15
|
-
// is stored at the Swingset level, we can only validate the addresses.
|
|
16
|
-
func ValidateGenesis(genesisState types.GenesisState) error {
|
|
17
|
-
for _, accountLien := range genesisState.Liens {
|
|
18
|
-
_, err := sdk.AccAddressFromBech32(accountLien.Address)
|
|
19
|
-
if err != nil {
|
|
20
|
-
return err
|
|
21
|
-
}
|
|
22
|
-
err = accountLien.Lien.Coins.Validate()
|
|
23
|
-
if err != nil {
|
|
24
|
-
return err
|
|
25
|
-
}
|
|
26
|
-
err = accountLien.Lien.Delegated.Validate()
|
|
27
|
-
if err != nil {
|
|
28
|
-
return err
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return nil
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// InitGenesis uses the genesisState to initialize the store.
|
|
35
|
-
func InitGenesis(ctx sdk.Context, keeper Keeper, genesisState types.GenesisState) {
|
|
36
|
-
for _, accLien := range genesisState.Liens {
|
|
37
|
-
addr, err := sdk.AccAddressFromBech32(accLien.GetAddress())
|
|
38
|
-
if err != nil {
|
|
39
|
-
panic(err) // not possible if genesis state was validated
|
|
40
|
-
}
|
|
41
|
-
lien := accLien.GetLien()
|
|
42
|
-
keeper.SetLien(ctx, addr, *lien)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// ExportGenesis reads the store and returns an equivalent GenesisState.
|
|
47
|
-
func ExportGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState {
|
|
48
|
-
genesisState := types.GenesisState{}
|
|
49
|
-
keeper.IterateLiens(ctx, func(addr sdk.AccAddress, lien types.Lien) bool {
|
|
50
|
-
accLien := types.AccountLien{
|
|
51
|
-
Address: addr.String(),
|
|
52
|
-
Lien: &lien,
|
|
53
|
-
}
|
|
54
|
-
genesisState.Liens = append(genesisState.Liens, accLien)
|
|
55
|
-
return false
|
|
56
|
-
})
|
|
57
|
-
return genesisState
|
|
58
|
-
}
|
package/x/lien/genesis_test.go
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
package lien
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"testing"
|
|
5
|
-
|
|
6
|
-
"github.com/Agoric/agoric-sdk/golang/cosmos/x/lien/types"
|
|
7
|
-
|
|
8
|
-
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
|
9
|
-
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
func mkcoin(denom string) func(int64) sdk.Coin {
|
|
13
|
-
return func(amt int64) sdk.Coin { return sdk.NewInt64Coin(denom, amt) }
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
var (
|
|
17
|
-
ubld = mkcoin("ubld")
|
|
18
|
-
urun = mkcoin("urun")
|
|
19
|
-
inval = func(amt int64) sdk.Coin { return sdk.Coin{Denom: "x", Amount: sdk.NewInt(amt)} }
|
|
20
|
-
coins = sdk.NewCoins
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
func TestDefaultGenesis(t *testing.T) {
|
|
24
|
-
defaultGenesisState := DefaultGenesisState()
|
|
25
|
-
if err := ValidateGenesis(defaultGenesisState); err != nil {
|
|
26
|
-
t.Errorf("DefaultGenesisState did not validate %v: %e", defaultGenesisState, err)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
func TestValidateGenesis(t *testing.T) {
|
|
31
|
-
_, _, addr1 := testdata.KeyTestPubAddr()
|
|
32
|
-
_, _, addr2 := testdata.KeyTestPubAddr()
|
|
33
|
-
for _, tt := range []struct {
|
|
34
|
-
name string
|
|
35
|
-
state types.GenesisState
|
|
36
|
-
fail bool
|
|
37
|
-
}{
|
|
38
|
-
{
|
|
39
|
-
name: "empty",
|
|
40
|
-
state: types.GenesisState{},
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "typical",
|
|
44
|
-
state: types.GenesisState{
|
|
45
|
-
Liens: []types.AccountLien{
|
|
46
|
-
{Address: addr1.String(), Lien: &types.Lien{
|
|
47
|
-
Coins: coins(ubld(123)),
|
|
48
|
-
Delegated: coins(ubld(456)),
|
|
49
|
-
}},
|
|
50
|
-
{Address: addr2.String(), Lien: &types.Lien{
|
|
51
|
-
Coins: coins(ubld(246), urun(135)),
|
|
52
|
-
Delegated: coins(),
|
|
53
|
-
}},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: "bad addr",
|
|
59
|
-
state: types.GenesisState{
|
|
60
|
-
Liens: []types.AccountLien{
|
|
61
|
-
{Address: "x", Lien: &types.Lien{}},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
fail: true,
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: "bad coins",
|
|
68
|
-
state: types.GenesisState{
|
|
69
|
-
Liens: []types.AccountLien{
|
|
70
|
-
{
|
|
71
|
-
Address: addr1.String(),
|
|
72
|
-
Lien: &types.Lien{Coins: []sdk.Coin{inval(6)}},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
fail: true,
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: "bad delegated",
|
|
80
|
-
state: types.GenesisState{
|
|
81
|
-
Liens: []types.AccountLien{
|
|
82
|
-
{
|
|
83
|
-
Address: addr2.String(),
|
|
84
|
-
Lien: &types.Lien{Delegated: []sdk.Coin{inval(6)}},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
fail: true,
|
|
89
|
-
},
|
|
90
|
-
} {
|
|
91
|
-
t.Run(tt.name, func(t *testing.T) {
|
|
92
|
-
err := ValidateGenesis(tt.state)
|
|
93
|
-
switch {
|
|
94
|
-
case err != nil && !tt.fail:
|
|
95
|
-
t.Errorf("invalid genesis state %v: %v", tt.state, err)
|
|
96
|
-
case err == nil && tt.fail:
|
|
97
|
-
t.Errorf("expected invalid genesis %v", tt.state)
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
}
|
|
101
|
-
}
|