@agoric/cosmos 0.33.0 → 0.33.1-dev-800c2bb.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/Makefile +1 -1
- package/app/app.go +109 -16
- package/app/const.go +2 -2
- package/daemon/cmd/root.go +8 -13
- package/package.json +2 -2
- package/proto/agoric/swingset/msgs.proto +10 -0
- package/proto/agoric/swingset/swingset.proto +14 -0
- package/x/swingset/abci.go +24 -17
- package/x/swingset/alias.go +1 -0
- package/x/swingset/client/cli/tx.go +18 -0
- package/x/swingset/genesis.go +11 -6
- package/x/swingset/keeper/keeper.go +131 -56
- package/x/swingset/keeper/migrations.go +27 -0
- package/x/swingset/keeper/msg_server.go +23 -6
- package/x/swingset/keeper/proposal.go +1 -1
- package/x/swingset/keeper/querier.go +3 -3
- package/x/swingset/keeper/snapshotter.go +491 -0
- package/x/swingset/keeper/snapshotter_test.go +185 -0
- package/x/swingset/legacy/v32/params.go +37 -0
- package/x/swingset/legacy/v32/params_test.go +133 -0
- package/x/swingset/module.go +6 -1
- package/x/swingset/types/default-params.go +5 -2
- package/x/swingset/types/expected_keepers.go +1 -0
- package/x/swingset/types/msgs.go +156 -10
- package/x/swingset/types/msgs.pb.go +142 -47
- package/x/swingset/types/msgs_test.go +174 -0
- package/x/swingset/types/swingset.pb.go +280 -51
- package/x/swingset/types/types.go +1 -1
- package/x/vbank/README.md +1 -1
- package/x/vbank/keeper/keeper.go +15 -1
- package/x/vbank/module.go +13 -1
- package/x/vbank/types/expected_keepers.go +3 -1
- package/x/vbank/vbank.go +8 -0
- package/x/vbank/vbank_test.go +70 -9
- package/x/vstorage/keeper/grpc_query.go +2 -2
- package/x/vstorage/keeper/keeper.go +269 -38
- package/x/vstorage/keeper/keeper_test.go +162 -17
- package/x/vstorage/keeper/querier.go +4 -4
- package/x/vstorage/module.go +2 -0
- package/x/vstorage/types/path_keys.go +10 -3
- package/x/vstorage/types/types.go +66 -0
- package/x/vstorage/vstorage.go +118 -25
- package/x/vstorage/vstorage_test.go +297 -0
|
@@ -230,6 +230,7 @@ func (m *Params) GetQueueMax() []QueueSize {
|
|
|
230
230
|
return nil
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
// The current state of the module.
|
|
233
234
|
type State struct {
|
|
234
235
|
// The allowed number of items to add to queues, as determined by SwingSet.
|
|
235
236
|
// Transactions which attempt to enqueue more should be rejected.
|
|
@@ -494,6 +495,59 @@ func (m *Egress) GetPowerFlags() []string {
|
|
|
494
495
|
return nil
|
|
495
496
|
}
|
|
496
497
|
|
|
498
|
+
// The payload messages used by swingset state-sync
|
|
499
|
+
type ExtensionSnapshotterArtifactPayload struct {
|
|
500
|
+
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" yaml:"name"`
|
|
501
|
+
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data" yaml:"data"`
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
func (m *ExtensionSnapshotterArtifactPayload) Reset() { *m = ExtensionSnapshotterArtifactPayload{} }
|
|
505
|
+
func (m *ExtensionSnapshotterArtifactPayload) String() string { return proto.CompactTextString(m) }
|
|
506
|
+
func (*ExtensionSnapshotterArtifactPayload) ProtoMessage() {}
|
|
507
|
+
func (*ExtensionSnapshotterArtifactPayload) Descriptor() ([]byte, []int) {
|
|
508
|
+
return fileDescriptor_ff9c341e0de15f8b, []int{8}
|
|
509
|
+
}
|
|
510
|
+
func (m *ExtensionSnapshotterArtifactPayload) XXX_Unmarshal(b []byte) error {
|
|
511
|
+
return m.Unmarshal(b)
|
|
512
|
+
}
|
|
513
|
+
func (m *ExtensionSnapshotterArtifactPayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
514
|
+
if deterministic {
|
|
515
|
+
return xxx_messageInfo_ExtensionSnapshotterArtifactPayload.Marshal(b, m, deterministic)
|
|
516
|
+
} else {
|
|
517
|
+
b = b[:cap(b)]
|
|
518
|
+
n, err := m.MarshalToSizedBuffer(b)
|
|
519
|
+
if err != nil {
|
|
520
|
+
return nil, err
|
|
521
|
+
}
|
|
522
|
+
return b[:n], nil
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
func (m *ExtensionSnapshotterArtifactPayload) XXX_Merge(src proto.Message) {
|
|
526
|
+
xxx_messageInfo_ExtensionSnapshotterArtifactPayload.Merge(m, src)
|
|
527
|
+
}
|
|
528
|
+
func (m *ExtensionSnapshotterArtifactPayload) XXX_Size() int {
|
|
529
|
+
return m.Size()
|
|
530
|
+
}
|
|
531
|
+
func (m *ExtensionSnapshotterArtifactPayload) XXX_DiscardUnknown() {
|
|
532
|
+
xxx_messageInfo_ExtensionSnapshotterArtifactPayload.DiscardUnknown(m)
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
var xxx_messageInfo_ExtensionSnapshotterArtifactPayload proto.InternalMessageInfo
|
|
536
|
+
|
|
537
|
+
func (m *ExtensionSnapshotterArtifactPayload) GetName() string {
|
|
538
|
+
if m != nil {
|
|
539
|
+
return m.Name
|
|
540
|
+
}
|
|
541
|
+
return ""
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
func (m *ExtensionSnapshotterArtifactPayload) GetData() []byte {
|
|
545
|
+
if m != nil {
|
|
546
|
+
return m.Data
|
|
547
|
+
}
|
|
548
|
+
return nil
|
|
549
|
+
}
|
|
550
|
+
|
|
497
551
|
func init() {
|
|
498
552
|
proto.RegisterType((*CoreEvalProposal)(nil), "agoric.swingset.CoreEvalProposal")
|
|
499
553
|
proto.RegisterType((*CoreEval)(nil), "agoric.swingset.CoreEval")
|
|
@@ -503,62 +557,67 @@ func init() {
|
|
|
503
557
|
proto.RegisterType((*PowerFlagFee)(nil), "agoric.swingset.PowerFlagFee")
|
|
504
558
|
proto.RegisterType((*QueueSize)(nil), "agoric.swingset.QueueSize")
|
|
505
559
|
proto.RegisterType((*Egress)(nil), "agoric.swingset.Egress")
|
|
560
|
+
proto.RegisterType((*ExtensionSnapshotterArtifactPayload)(nil), "agoric.swingset.ExtensionSnapshotterArtifactPayload")
|
|
506
561
|
}
|
|
507
562
|
|
|
508
563
|
func init() { proto.RegisterFile("agoric/swingset/swingset.proto", fileDescriptor_ff9c341e0de15f8b) }
|
|
509
564
|
|
|
510
565
|
var fileDescriptor_ff9c341e0de15f8b = []byte{
|
|
511
|
-
//
|
|
512
|
-
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4,
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
566
|
+
// 858 bytes of a gzipped FileDescriptorProto
|
|
567
|
+
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xbd, 0x6f, 0x23, 0x45,
|
|
568
|
+
0x14, 0xf7, 0x62, 0x3b, 0xc4, 0xcf, 0xbe, 0xe4, 0x18, 0x22, 0x9d, 0x89, 0x38, 0x4f, 0xb4, 0x14,
|
|
569
|
+
0x44, 0x3a, 0x9d, 0x7d, 0x01, 0x21, 0x24, 0x9f, 0x28, 0xbc, 0x91, 0x4f, 0x27, 0x21, 0x90, 0xd9,
|
|
570
|
+
0x28, 0x14, 0x08, 0xb4, 0x1a, 0xaf, 0xc7, 0x7b, 0x93, 0xac, 0x67, 0xf6, 0x66, 0x26, 0x5f, 0xd7,
|
|
571
|
+
0x23, 0x68, 0x90, 0x10, 0x15, 0x65, 0x6a, 0xfe, 0x92, 0x2b, 0xaf, 0x44, 0x14, 0x0b, 0x4a, 0x1a,
|
|
572
|
+
0x94, 0xd2, 0x25, 0x12, 0x12, 0x9a, 0x99, 0xf5, 0xc6, 0x22, 0x48, 0xa4, 0xb9, 0x6a, 0xdf, 0xe7,
|
|
573
|
+
0xef, 0xbd, 0xf7, 0x7b, 0x33, 0x3b, 0xd0, 0x21, 0x89, 0x90, 0x2c, 0xee, 0xa9, 0x13, 0xc6, 0x13,
|
|
574
|
+
0x45, 0x75, 0x29, 0x74, 0x33, 0x29, 0xb4, 0x40, 0xeb, 0xce, 0xdf, 0x5d, 0x98, 0x37, 0x37, 0x12,
|
|
575
|
+
0x91, 0x08, 0xeb, 0xeb, 0x19, 0xc9, 0x85, 0x6d, 0x76, 0x62, 0xa1, 0x66, 0x42, 0xf5, 0xc6, 0x44,
|
|
576
|
+
0xd1, 0xde, 0xf1, 0xce, 0x98, 0x6a, 0xb2, 0xd3, 0x8b, 0x05, 0xe3, 0xce, 0xef, 0x7f, 0xe7, 0xc1,
|
|
577
|
+
0xdd, 0x5d, 0x21, 0xe9, 0xf0, 0x98, 0xa4, 0x23, 0x29, 0x32, 0xa1, 0x48, 0x8a, 0x36, 0xa0, 0xae,
|
|
578
|
+
0x99, 0x4e, 0x69, 0xdb, 0xdb, 0xf2, 0xb6, 0x1b, 0xa1, 0x53, 0xd0, 0x16, 0x34, 0x27, 0x54, 0xc5,
|
|
579
|
+
0x92, 0x65, 0x9a, 0x09, 0xde, 0x7e, 0xc3, 0xfa, 0x96, 0x4d, 0xe8, 0x23, 0xa8, 0xd3, 0x63, 0x92,
|
|
580
|
+
0xaa, 0x76, 0x75, 0xab, 0xba, 0xdd, 0xfc, 0xe0, 0x9d, 0xee, 0xbf, 0x7a, 0xec, 0x2e, 0x2a, 0x05,
|
|
581
|
+
0xb5, 0x97, 0x39, 0xae, 0x84, 0x2e, 0xba, 0x5f, 0xfb, 0xfe, 0x1c, 0x57, 0x7c, 0x05, 0xab, 0x0b,
|
|
582
|
+
0x37, 0xea, 0x43, 0xeb, 0x40, 0x09, 0x1e, 0x65, 0x54, 0xce, 0x98, 0x56, 0xae, 0x8f, 0xe0, 0xde,
|
|
583
|
+
0x3c, 0xc7, 0x6f, 0x9f, 0x91, 0x59, 0xda, 0xf7, 0x97, 0xbd, 0x7e, 0xd8, 0x34, 0xea, 0xc8, 0x69,
|
|
584
|
+
0xe8, 0x01, 0xbc, 0x79, 0xa0, 0xa2, 0x58, 0x4c, 0xa8, 0x6b, 0x31, 0x40, 0xf3, 0x1c, 0xaf, 0x2d,
|
|
585
|
+
0xd2, 0xac, 0xc3, 0x0f, 0x57, 0x0e, 0xd4, 0xae, 0x11, 0x7e, 0xa8, 0xc2, 0xca, 0x88, 0x48, 0x32,
|
|
586
|
+
0x53, 0xe8, 0x29, 0xac, 0x8d, 0x29, 0xe1, 0xca, 0xc0, 0x46, 0x47, 0x9c, 0xe9, 0xb6, 0x67, 0xa7,
|
|
587
|
+
0x78, 0xf7, 0xc6, 0x14, 0x7b, 0x5a, 0x32, 0x9e, 0x04, 0x26, 0xb8, 0x18, 0xa4, 0x65, 0x33, 0x47,
|
|
588
|
+
0x54, 0xee, 0x73, 0xa6, 0xd1, 0x73, 0x58, 0x9b, 0x52, 0x6a, 0x31, 0xa2, 0x4c, 0xb2, 0xd8, 0x34,
|
|
589
|
+
0xe2, 0xf8, 0x70, 0xcb, 0xe8, 0x9a, 0x65, 0x74, 0x8b, 0x65, 0x74, 0x77, 0x05, 0xe3, 0xc1, 0x23,
|
|
590
|
+
0x03, 0xf3, 0xcb, 0xef, 0x78, 0x3b, 0x61, 0xfa, 0xd9,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, 0xb9, 0x09, 0x75, 0x95, 0x63, 0x28, 0x59, 0x57, 0xf3, 0x1c, 0xbf, 0x55, 0x14, 0x2e, 0x6d,
|
|
612
|
+
0x7e, 0xb8, 0x14, 0x60, 0xe7, 0xaf, 0xf8, 0xdf, 0x7a, 0xf0, 0xde, 0xf0, 0x54, 0x53, 0xae, 0x98,
|
|
613
|
+
0xe0, 0x7b, 0x9c, 0x64, 0xea, 0x99, 0xd0, 0x9a, 0xca, 0x81, 0xd4, 0x6c, 0x4a, 0x62, 0x3d, 0x22,
|
|
614
|
+
0x67, 0xa9, 0x20, 0x13, 0xf4, 0x00, 0x6a, 0x4b, 0xc4, 0xdc, 0x33, 0xf3, 0x15, 0xa4, 0x14, 0xf3,
|
|
615
|
+
0x39, 0x42, 0xac, 0xd1, 0x04, 0x4f, 0x88, 0x26, 0x05, 0x19, 0x36, 0xd8, 0xe8, 0xd7, 0xc1, 0x46,
|
|
616
|
+
0xf3, 0x43, 0x6b, 0x74, 0x7d, 0x04, 0xfb, 0x2f, 0x2f, 0x3a, 0xde, 0xab, 0x8b, 0x8e, 0xf7, 0xc7,
|
|
617
|
+
0x45, 0xc7, 0xfb, 0xf1, 0xb2, 0x53, 0x79, 0x75, 0xd9, 0xa9, 0xfc, 0x7a, 0xd9, 0xa9, 0x7c, 0xf5,
|
|
618
|
+
0x78, 0x89, 0xb0, 0x81, 0x7b, 0x2e, 0xdc, 0xf5, 0xb0, 0x84, 0x25, 0x22, 0x25, 0x3c, 0x59, 0x30,
|
|
619
|
+
0x79, 0x7a, 0xfd, 0x92, 0x58, 0x26, 0xc7, 0x2b, 0xf6, 0x01, 0xf8, 0xf0, 0x9f, 0x00, 0x00, 0x00,
|
|
620
|
+
0xff, 0xff, 0xd2, 0xc0, 0xc3, 0x71, 0x69, 0x06, 0x00, 0x00,
|
|
562
621
|
}
|
|
563
622
|
|
|
564
623
|
func (this *Params) Equal(that interface{}) bool {
|
|
@@ -1079,6 +1138,43 @@ func (m *Egress) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
|
1079
1138
|
return len(dAtA) - i, nil
|
|
1080
1139
|
}
|
|
1081
1140
|
|
|
1141
|
+
func (m *ExtensionSnapshotterArtifactPayload) Marshal() (dAtA []byte, err error) {
|
|
1142
|
+
size := m.Size()
|
|
1143
|
+
dAtA = make([]byte, size)
|
|
1144
|
+
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
1145
|
+
if err != nil {
|
|
1146
|
+
return nil, err
|
|
1147
|
+
}
|
|
1148
|
+
return dAtA[:n], nil
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
func (m *ExtensionSnapshotterArtifactPayload) MarshalTo(dAtA []byte) (int, error) {
|
|
1152
|
+
size := m.Size()
|
|
1153
|
+
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
func (m *ExtensionSnapshotterArtifactPayload) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
1157
|
+
i := len(dAtA)
|
|
1158
|
+
_ = i
|
|
1159
|
+
var l int
|
|
1160
|
+
_ = l
|
|
1161
|
+
if len(m.Data) > 0 {
|
|
1162
|
+
i -= len(m.Data)
|
|
1163
|
+
copy(dAtA[i:], m.Data)
|
|
1164
|
+
i = encodeVarintSwingset(dAtA, i, uint64(len(m.Data)))
|
|
1165
|
+
i--
|
|
1166
|
+
dAtA[i] = 0x12
|
|
1167
|
+
}
|
|
1168
|
+
if len(m.Name) > 0 {
|
|
1169
|
+
i -= len(m.Name)
|
|
1170
|
+
copy(dAtA[i:], m.Name)
|
|
1171
|
+
i = encodeVarintSwingset(dAtA, i, uint64(len(m.Name)))
|
|
1172
|
+
i--
|
|
1173
|
+
dAtA[i] = 0xa
|
|
1174
|
+
}
|
|
1175
|
+
return len(dAtA) - i, nil
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1082
1178
|
func encodeVarintSwingset(dAtA []byte, offset int, v uint64) int {
|
|
1083
1179
|
offset -= sovSwingset(v)
|
|
1084
1180
|
base := offset
|
|
@@ -1255,6 +1351,23 @@ func (m *Egress) Size() (n int) {
|
|
|
1255
1351
|
return n
|
|
1256
1352
|
}
|
|
1257
1353
|
|
|
1354
|
+
func (m *ExtensionSnapshotterArtifactPayload) Size() (n int) {
|
|
1355
|
+
if m == nil {
|
|
1356
|
+
return 0
|
|
1357
|
+
}
|
|
1358
|
+
var l int
|
|
1359
|
+
_ = l
|
|
1360
|
+
l = len(m.Name)
|
|
1361
|
+
if l > 0 {
|
|
1362
|
+
n += 1 + l + sovSwingset(uint64(l))
|
|
1363
|
+
}
|
|
1364
|
+
l = len(m.Data)
|
|
1365
|
+
if l > 0 {
|
|
1366
|
+
n += 1 + l + sovSwingset(uint64(l))
|
|
1367
|
+
}
|
|
1368
|
+
return n
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1258
1371
|
func sovSwingset(x uint64) (n int) {
|
|
1259
1372
|
return (math_bits.Len64(x|1) + 6) / 7
|
|
1260
1373
|
}
|
|
@@ -2306,6 +2419,122 @@ func (m *Egress) Unmarshal(dAtA []byte) error {
|
|
|
2306
2419
|
}
|
|
2307
2420
|
return nil
|
|
2308
2421
|
}
|
|
2422
|
+
func (m *ExtensionSnapshotterArtifactPayload) Unmarshal(dAtA []byte) error {
|
|
2423
|
+
l := len(dAtA)
|
|
2424
|
+
iNdEx := 0
|
|
2425
|
+
for iNdEx < l {
|
|
2426
|
+
preIndex := iNdEx
|
|
2427
|
+
var wire uint64
|
|
2428
|
+
for shift := uint(0); ; shift += 7 {
|
|
2429
|
+
if shift >= 64 {
|
|
2430
|
+
return ErrIntOverflowSwingset
|
|
2431
|
+
}
|
|
2432
|
+
if iNdEx >= l {
|
|
2433
|
+
return io.ErrUnexpectedEOF
|
|
2434
|
+
}
|
|
2435
|
+
b := dAtA[iNdEx]
|
|
2436
|
+
iNdEx++
|
|
2437
|
+
wire |= uint64(b&0x7F) << shift
|
|
2438
|
+
if b < 0x80 {
|
|
2439
|
+
break
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
fieldNum := int32(wire >> 3)
|
|
2443
|
+
wireType := int(wire & 0x7)
|
|
2444
|
+
if wireType == 4 {
|
|
2445
|
+
return fmt.Errorf("proto: ExtensionSnapshotterArtifactPayload: wiretype end group for non-group")
|
|
2446
|
+
}
|
|
2447
|
+
if fieldNum <= 0 {
|
|
2448
|
+
return fmt.Errorf("proto: ExtensionSnapshotterArtifactPayload: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
2449
|
+
}
|
|
2450
|
+
switch fieldNum {
|
|
2451
|
+
case 1:
|
|
2452
|
+
if wireType != 2 {
|
|
2453
|
+
return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
|
|
2454
|
+
}
|
|
2455
|
+
var stringLen uint64
|
|
2456
|
+
for shift := uint(0); ; shift += 7 {
|
|
2457
|
+
if shift >= 64 {
|
|
2458
|
+
return ErrIntOverflowSwingset
|
|
2459
|
+
}
|
|
2460
|
+
if iNdEx >= l {
|
|
2461
|
+
return io.ErrUnexpectedEOF
|
|
2462
|
+
}
|
|
2463
|
+
b := dAtA[iNdEx]
|
|
2464
|
+
iNdEx++
|
|
2465
|
+
stringLen |= uint64(b&0x7F) << shift
|
|
2466
|
+
if b < 0x80 {
|
|
2467
|
+
break
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
intStringLen := int(stringLen)
|
|
2471
|
+
if intStringLen < 0 {
|
|
2472
|
+
return ErrInvalidLengthSwingset
|
|
2473
|
+
}
|
|
2474
|
+
postIndex := iNdEx + intStringLen
|
|
2475
|
+
if postIndex < 0 {
|
|
2476
|
+
return ErrInvalidLengthSwingset
|
|
2477
|
+
}
|
|
2478
|
+
if postIndex > l {
|
|
2479
|
+
return io.ErrUnexpectedEOF
|
|
2480
|
+
}
|
|
2481
|
+
m.Name = string(dAtA[iNdEx:postIndex])
|
|
2482
|
+
iNdEx = postIndex
|
|
2483
|
+
case 2:
|
|
2484
|
+
if wireType != 2 {
|
|
2485
|
+
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
|
|
2486
|
+
}
|
|
2487
|
+
var byteLen int
|
|
2488
|
+
for shift := uint(0); ; shift += 7 {
|
|
2489
|
+
if shift >= 64 {
|
|
2490
|
+
return ErrIntOverflowSwingset
|
|
2491
|
+
}
|
|
2492
|
+
if iNdEx >= l {
|
|
2493
|
+
return io.ErrUnexpectedEOF
|
|
2494
|
+
}
|
|
2495
|
+
b := dAtA[iNdEx]
|
|
2496
|
+
iNdEx++
|
|
2497
|
+
byteLen |= int(b&0x7F) << shift
|
|
2498
|
+
if b < 0x80 {
|
|
2499
|
+
break
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
if byteLen < 0 {
|
|
2503
|
+
return ErrInvalidLengthSwingset
|
|
2504
|
+
}
|
|
2505
|
+
postIndex := iNdEx + byteLen
|
|
2506
|
+
if postIndex < 0 {
|
|
2507
|
+
return ErrInvalidLengthSwingset
|
|
2508
|
+
}
|
|
2509
|
+
if postIndex > l {
|
|
2510
|
+
return io.ErrUnexpectedEOF
|
|
2511
|
+
}
|
|
2512
|
+
m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...)
|
|
2513
|
+
if m.Data == nil {
|
|
2514
|
+
m.Data = []byte{}
|
|
2515
|
+
}
|
|
2516
|
+
iNdEx = postIndex
|
|
2517
|
+
default:
|
|
2518
|
+
iNdEx = preIndex
|
|
2519
|
+
skippy, err := skipSwingset(dAtA[iNdEx:])
|
|
2520
|
+
if err != nil {
|
|
2521
|
+
return err
|
|
2522
|
+
}
|
|
2523
|
+
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
2524
|
+
return ErrInvalidLengthSwingset
|
|
2525
|
+
}
|
|
2526
|
+
if (iNdEx + skippy) > l {
|
|
2527
|
+
return io.ErrUnexpectedEOF
|
|
2528
|
+
}
|
|
2529
|
+
iNdEx += skippy
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
if iNdEx > l {
|
|
2534
|
+
return io.ErrUnexpectedEOF
|
|
2535
|
+
}
|
|
2536
|
+
return nil
|
|
2537
|
+
}
|
|
2309
2538
|
func skipSwingset(dAtA []byte) (n int, err error) {
|
|
2310
2539
|
l := len(dAtA)
|
|
2311
2540
|
iNdEx := 0
|
|
@@ -25,7 +25,7 @@ func NewEgress(nickname string, peer sdk.AccAddress, powerFlags []string) *Egres
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
// FIXME: Should have @
|
|
28
|
+
// FIXME: Should have @endo/nat
|
|
29
29
|
func Nat(num float64) (uint64, error) {
|
|
30
30
|
if num < 0 {
|
|
31
31
|
return 0, errors.New("Not a natural")
|
package/x/vbank/README.md
CHANGED
|
@@ -22,7 +22,7 @@ The Vbank module maintains no significant state, but will access stored state th
|
|
|
22
22
|
|
|
23
23
|
Purse operations which change the balance result in a downcall to this module to update the underlying account. A downcall is also made to query the account balance.
|
|
24
24
|
|
|
25
|
-
Upon an `EndBlock()` call, the module will scan the block for all `MsgSend` and `MsgMultiSend` events (see `cosmos-sdk/x/bank/spec/04_events.md`) and perform a `VBANK_BALANCE_UPDATE` upcall for all denominations held in
|
|
25
|
+
Upon an `EndBlock()` call, the module will scan the block for all `MsgSend` and `MsgMultiSend` events (see `cosmos-sdk/x/bank/spec/04_events.md`) and perform a `VBANK_BALANCE_UPDATE` upcall for all denominations held in *only the mentioned module accounts*.
|
|
26
26
|
|
|
27
27
|
The following fields are common to the Vbank messages:
|
|
28
28
|
- `"address"`, `"recipient"`, `"sender"`: account address as a bech32-encoded string
|
package/x/vbank/keeper/keeper.go
CHANGED
|
@@ -5,6 +5,7 @@ import (
|
|
|
5
5
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
6
6
|
|
|
7
7
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vbank/types"
|
|
8
|
+
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
8
9
|
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
|
9
10
|
|
|
10
11
|
vm "github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
@@ -79,7 +80,20 @@ func (k Keeper) GrabCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) e
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
func (k Keeper) GetModuleAccountAddress(ctx sdk.Context, name string) sdk.AccAddress {
|
|
82
|
-
|
|
83
|
+
acct := k.accountKeeper.GetModuleAccount(ctx, name)
|
|
84
|
+
if acct == nil {
|
|
85
|
+
return nil
|
|
86
|
+
}
|
|
87
|
+
return acct.GetAddress()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
func (k Keeper) IsModuleAccount(ctx sdk.Context, addr sdk.AccAddress) bool {
|
|
91
|
+
acc := k.accountKeeper.GetAccount(ctx, addr)
|
|
92
|
+
if acc == nil {
|
|
93
|
+
return false
|
|
94
|
+
}
|
|
95
|
+
_, ok := acc.(authtypes.ModuleAccountI)
|
|
96
|
+
return ok
|
|
83
97
|
}
|
|
84
98
|
|
|
85
99
|
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
|
package/x/vbank/module.go
CHANGED
|
@@ -155,6 +155,19 @@ NextEvent:
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
// Prune the addressToUpdate map to only include module accounts. We prune
|
|
159
|
+
// only after recording and consolidating all account updates to minimize the
|
|
160
|
+
// number of account keeper queries.
|
|
161
|
+
unfilteredAddresses := addressToUpdate
|
|
162
|
+
addressToUpdate = make(map[string]sdk.Coins, len(addressToUpdate))
|
|
163
|
+
for addr, denoms := range unfilteredAddresses {
|
|
164
|
+
accAddr, err := sdk.AccAddressFromBech32(addr)
|
|
165
|
+
if err == nil && am.keeper.IsModuleAccount(ctx, accAddr) {
|
|
166
|
+
// Pass through the module account.
|
|
167
|
+
addressToUpdate[addr] = denoms
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
158
171
|
// Dump all the addressToBalances entries to SwingSet.
|
|
159
172
|
action := getBalanceUpdate(ctx, am.keeper, addressToUpdate)
|
|
160
173
|
if action != nil {
|
|
@@ -162,7 +175,6 @@ NextEvent:
|
|
|
162
175
|
if err != nil {
|
|
163
176
|
panic(err)
|
|
164
177
|
}
|
|
165
|
-
|
|
166
178
|
}
|
|
167
179
|
|
|
168
180
|
if err := am.keeper.DistributeRewards(ctx); err != nil {
|
|
@@ -2,6 +2,7 @@ package types
|
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
4
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
5
|
+
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
5
6
|
)
|
|
6
7
|
|
|
7
8
|
// A subset of github.com/cosmos/cosmos-sdk/x/bank/keeper.Keeper
|
|
@@ -16,5 +17,6 @@ type BankKeeper interface {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
type AccountKeeper interface {
|
|
19
|
-
|
|
20
|
+
GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI
|
|
21
|
+
GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
|
|
20
22
|
}
|
package/x/vbank/vbank.go
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
package vbank
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
+
"context"
|
|
4
5
|
"encoding/json"
|
|
5
6
|
"fmt"
|
|
6
7
|
stdlog "log"
|
|
7
8
|
"sort"
|
|
8
9
|
|
|
9
10
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
11
|
+
"github.com/cosmos/cosmos-sdk/baseapp"
|
|
10
12
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
11
13
|
)
|
|
12
14
|
|
|
@@ -241,5 +243,11 @@ func (ch portHandler) Receive(ctx *vm.ControllerContext, str string) (ret string
|
|
|
241
243
|
}
|
|
242
244
|
|
|
243
245
|
func (am AppModule) PushAction(ctx sdk.Context, action vm.Jsonable) error {
|
|
246
|
+
// vbank actions are not triggered by a swingset message in a transaction, so we need to
|
|
247
|
+
// synthesize unique context information.
|
|
248
|
+
// We use a fixed placeholder value for the txHash context, and can simply use `0` for the
|
|
249
|
+
// message index as there is only one such action per block.
|
|
250
|
+
ctx = ctx.WithContext(context.WithValue(ctx.Context(), baseapp.TxHashContextKey, "x/vbank"))
|
|
251
|
+
ctx = ctx.WithContext(context.WithValue(ctx.Context(), baseapp.TxMsgIdxContextKey, 0))
|
|
244
252
|
return am.keeper.PushAction(ctx, action)
|
|
245
253
|
}
|
package/x/vbank/vbank_test.go
CHANGED
|
@@ -13,6 +13,7 @@ import (
|
|
|
13
13
|
"github.com/cosmos/cosmos-sdk/store"
|
|
14
14
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
15
15
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
16
|
+
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
|
16
17
|
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
|
|
17
18
|
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
|
18
19
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
@@ -98,7 +99,7 @@ func decodeBalances(encoded []byte) (balances, uint64, error) {
|
|
|
98
99
|
return nil, 0, err
|
|
99
100
|
}
|
|
100
101
|
b := newBalances()
|
|
101
|
-
fmt.Printf("updated balances %v\n", balanceUpdate.Updated)
|
|
102
|
+
// fmt.Printf("updated balances %v\n", balanceUpdate.Updated)
|
|
102
103
|
for _, u := range balanceUpdate.Updated {
|
|
103
104
|
account(u.Address, coin(u.Denom, u.Amount))(b)
|
|
104
105
|
}
|
|
@@ -514,7 +515,14 @@ func Test_EndBlock_Events(t *testing.T) {
|
|
|
514
515
|
sdk.NewInt64Coin("arcadeTokens", 7),
|
|
515
516
|
),
|
|
516
517
|
}}
|
|
517
|
-
|
|
518
|
+
acct := &mockAuthKeeper{
|
|
519
|
+
accounts: map[string]authtypes.AccountI{
|
|
520
|
+
addr1: &authtypes.ModuleAccount{BaseAccount: &authtypes.BaseAccount{ Address: addr1 }},
|
|
521
|
+
addr2: &authtypes.ModuleAccount{BaseAccount: &authtypes.BaseAccount{ Address: addr2 }},
|
|
522
|
+
addr3: &authtypes.BaseAccount{ Address: addr3 },
|
|
523
|
+
},
|
|
524
|
+
}
|
|
525
|
+
keeper, ctx := makeTestKit(acct, bank)
|
|
518
526
|
// Turn off rewards.
|
|
519
527
|
keeper.SetParams(ctx, types.Params{PerEpochRewardFraction: sdk.ZeroDec()})
|
|
520
528
|
msgsSent := []string{}
|
|
@@ -552,6 +560,14 @@ func Test_EndBlock_Events(t *testing.T) {
|
|
|
552
560
|
{Key: []byte("amount"), Value: []byte("500ubld,600urun,700ushmoo")},
|
|
553
561
|
},
|
|
554
562
|
},
|
|
563
|
+
{
|
|
564
|
+
Type: "non_modaccount",
|
|
565
|
+
Attributes: []abci.EventAttribute{
|
|
566
|
+
{Key: []byte("receiver"), Value: []byte(addr3)},
|
|
567
|
+
{Key: []byte("spender"), Value: []byte(addr4)},
|
|
568
|
+
{Key: []byte("amount"), Value: []byte("100ubld")},
|
|
569
|
+
},
|
|
570
|
+
},
|
|
555
571
|
}
|
|
556
572
|
em := sdk.NewEventManagerWithHistory(events)
|
|
557
573
|
ctx = ctx.WithEventManager(em)
|
|
@@ -730,16 +746,47 @@ func Test_EndBlock_Rewards(t *testing.T) {
|
|
|
730
746
|
}
|
|
731
747
|
}
|
|
732
748
|
|
|
733
|
-
type
|
|
749
|
+
type mockAuthKeeper struct{
|
|
750
|
+
accounts map[string]authtypes.AccountI
|
|
751
|
+
modAddrs map[string]string
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
func (ma mockAuthKeeper) GetModuleAccount(ctx sdk.Context, name string) authtypes.ModuleAccountI {
|
|
755
|
+
addr, ok := ma.modAddrs[name]
|
|
756
|
+
if !ok {
|
|
757
|
+
return nil
|
|
758
|
+
}
|
|
759
|
+
acct, ok := ma.accounts[addr]
|
|
760
|
+
if !ok {
|
|
761
|
+
panic("missing module account")
|
|
762
|
+
}
|
|
763
|
+
return acct.(authtypes.ModuleAccountI)
|
|
764
|
+
}
|
|
734
765
|
|
|
735
|
-
func (ma
|
|
736
|
-
|
|
766
|
+
func (ma mockAuthKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI {
|
|
767
|
+
// fmt.Printf("GetAccount %s\n", addr.String())
|
|
768
|
+
return ma.accounts[addr.String()]
|
|
737
769
|
}
|
|
738
770
|
|
|
739
771
|
func Test_Module_Account(t *testing.T) {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
772
|
+
moduleBech32 := "cosmos1ae0lmtzlgrcnla9xjkpaarq5d5dfez639v3rgf"
|
|
773
|
+
moduleJson, err := json.Marshal(moduleBech32)
|
|
774
|
+
if err != nil {
|
|
775
|
+
t.Fatalf("got error = %v", err)
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
acct := &mockAuthKeeper{
|
|
779
|
+
accounts: map[string]authtypes.AccountI{
|
|
780
|
+
moduleBech32: authtypes.NewEmptyModuleAccount("vbank/reserve"),
|
|
781
|
+
addr1: authtypes.NewBaseAccountWithAddress(sdk.MustAccAddressFromBech32(addr1)),
|
|
782
|
+
},
|
|
783
|
+
modAddrs: map[string]string{
|
|
784
|
+
"vbank/reserve": moduleBech32,
|
|
785
|
+
},
|
|
786
|
+
}
|
|
787
|
+
keeper, ctx := makeTestKit(acct, nil)
|
|
788
|
+
am := AppModule{keeper: keeper}
|
|
789
|
+
ch := NewPortHandler(am, keeper)
|
|
743
790
|
ctlCtx := &vm.ControllerContext{Context: ctx}
|
|
744
791
|
|
|
745
792
|
mod1 := "vbank/reserve"
|
|
@@ -750,8 +797,22 @@ func Test_Module_Account(t *testing.T) {
|
|
|
750
797
|
if err != nil {
|
|
751
798
|
t.Fatalf("got error = %v", err)
|
|
752
799
|
}
|
|
753
|
-
|
|
800
|
+
|
|
801
|
+
expected := string(moduleJson)
|
|
754
802
|
if ret != expected {
|
|
755
803
|
t.Errorf("got ret = %v, want %v", ret, expected)
|
|
756
804
|
}
|
|
805
|
+
|
|
806
|
+
modAddr := sdk.MustAccAddressFromBech32(moduleBech32)
|
|
807
|
+
if !keeper.IsModuleAccount(ctx, modAddr) {
|
|
808
|
+
t.Errorf("got IsModuleAccount modAddr = false, want true")
|
|
809
|
+
}
|
|
810
|
+
notModAddr := sdk.MustAccAddressFromBech32(addr1)
|
|
811
|
+
if keeper.IsModuleAccount(ctx, notModAddr) {
|
|
812
|
+
t.Errorf("got IsModuleAccount notModAddr = true, want false")
|
|
813
|
+
}
|
|
814
|
+
missingAddr := sdk.MustAccAddressFromBech32(addr2)
|
|
815
|
+
if keeper.IsModuleAccount(ctx, missingAddr) {
|
|
816
|
+
t.Errorf("got IsModuleAccount missingAddr = false, want true")
|
|
817
|
+
}
|
|
757
818
|
}
|