@agoric/cosmos 0.34.2-upgrade-16-dev-8879538.0 → 0.34.2-upgrade-16-dev-24665a9.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/app/app.go +121 -46
- package/cmd/agd/main.go +4 -4
- package/cmd/libdaemon/main.go +6 -6
- package/daemon/cmd/root.go +3 -7
- package/daemon/main.go +3 -2
- package/git-revision.txt +1 -1
- package/go.mod +3 -0
- package/go.sum +2 -2
- package/package.json +2 -2
- package/proto/agoric/vtransfer/genesis.proto +18 -0
- package/vm/client_test.go +6 -8
- package/vm/controller.go +3 -0
- package/vm/proto_json.go +38 -0
- package/vm/proto_json_test.go +103 -0
- package/x/swingset/alias.go +2 -0
- package/x/swingset/keeper/keeper.go +8 -20
- package/x/swingset/keeper/test_utils.go +16 -0
- package/x/swingset/module.go +7 -2
- package/x/swingset/testing/queue.go +17 -0
- package/x/swingset/types/msgs.go +19 -0
- package/x/vbank/genesis.go +0 -2
- package/x/vbank/types/msgs.go +0 -12
- package/x/vbank/vbank.go +6 -6
- package/x/vbank/vbank_test.go +2 -2
- package/x/vibc/alias.go +1 -1
- package/x/vibc/types/receiver.go +17 -7
- package/x/vlocalchain/handler.go +2 -1
- package/x/vlocalchain/keeper/keeper_test.go +66 -1
- package/x/vlocalchain/vlocalchain.go +26 -21
- package/x/vlocalchain/vlocalchain_test.go +133 -4
- package/x/vstorage/keeper/keeper.go +5 -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/app/app.go
CHANGED
|
@@ -44,7 +44,6 @@ import (
|
|
|
44
44
|
"github.com/cosmos/cosmos-sdk/x/capability"
|
|
45
45
|
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
|
46
46
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
|
47
|
-
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
|
|
48
47
|
distr "github.com/cosmos/cosmos-sdk/x/distribution"
|
|
49
48
|
distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client"
|
|
50
49
|
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
|
@@ -87,14 +86,14 @@ import (
|
|
|
87
86
|
icahostkeeper "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/keeper"
|
|
88
87
|
icahosttypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/host/types"
|
|
89
88
|
icatypes "github.com/cosmos/ibc-go/v6/modules/apps/27-interchain-accounts/types"
|
|
90
|
-
"github.com/cosmos/ibc-go/v6/modules/apps/transfer"
|
|
89
|
+
ibctransfer "github.com/cosmos/ibc-go/v6/modules/apps/transfer"
|
|
91
90
|
ibctransferkeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper"
|
|
92
91
|
ibctransfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
|
|
93
92
|
ibc "github.com/cosmos/ibc-go/v6/modules/core"
|
|
94
93
|
ibcclient "github.com/cosmos/ibc-go/v6/modules/core/02-client"
|
|
95
94
|
ibcclientclient "github.com/cosmos/ibc-go/v6/modules/core/02-client/client"
|
|
96
95
|
ibcclienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
|
|
97
|
-
|
|
96
|
+
ibcporttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types"
|
|
98
97
|
ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host"
|
|
99
98
|
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
|
|
100
99
|
"github.com/gorilla/mux"
|
|
@@ -121,6 +120,9 @@ import (
|
|
|
121
120
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vibc"
|
|
122
121
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vlocalchain"
|
|
123
122
|
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vstorage"
|
|
123
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer"
|
|
124
|
+
vtransferkeeper "github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/keeper"
|
|
125
|
+
testtypes "github.com/cosmos/ibc-go/v6/testing/types"
|
|
124
126
|
|
|
125
127
|
// Import the packet forward middleware
|
|
126
128
|
packetforward "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v6/packetforward"
|
|
@@ -172,7 +174,7 @@ var (
|
|
|
172
174
|
ibc.AppModuleBasic{},
|
|
173
175
|
upgrade.AppModuleBasic{},
|
|
174
176
|
evidence.AppModuleBasic{},
|
|
175
|
-
|
|
177
|
+
ibctransfer.AppModuleBasic{},
|
|
176
178
|
vesting.AppModuleBasic{},
|
|
177
179
|
ica.AppModuleBasic{},
|
|
178
180
|
packetforward.AppModuleBasic{},
|
|
@@ -180,6 +182,7 @@ var (
|
|
|
180
182
|
vstorage.AppModuleBasic{},
|
|
181
183
|
vibc.AppModuleBasic{},
|
|
182
184
|
vbank.AppModuleBasic{},
|
|
185
|
+
vtransfer.AppModuleBasic{},
|
|
183
186
|
)
|
|
184
187
|
|
|
185
188
|
// module account permissions
|
|
@@ -220,6 +223,7 @@ type GaiaApp struct { // nolint: golint
|
|
|
220
223
|
vibcPort int
|
|
221
224
|
vstoragePort int
|
|
222
225
|
vlocalchainPort int
|
|
226
|
+
vtransferPort int
|
|
223
227
|
|
|
224
228
|
upgradeDetails *upgradeDetails
|
|
225
229
|
|
|
@@ -260,6 +264,7 @@ type GaiaApp struct { // nolint: golint
|
|
|
260
264
|
VibcKeeper vibc.Keeper
|
|
261
265
|
VbankKeeper vbank.Keeper
|
|
262
266
|
VlocalchainKeeper vlocalchain.Keeper
|
|
267
|
+
VtransferKeeper vtransferkeeper.Keeper
|
|
263
268
|
|
|
264
269
|
// make scoped keepers public for test purposes
|
|
265
270
|
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
|
|
@@ -296,9 +301,8 @@ func NewGaiaApp(
|
|
|
296
301
|
appOpts servertypes.AppOptions,
|
|
297
302
|
baseAppOptions ...func(*baseapp.BaseApp),
|
|
298
303
|
) *GaiaApp {
|
|
299
|
-
defaultController
|
|
300
|
-
fmt.
|
|
301
|
-
return "", nil
|
|
304
|
+
var defaultController vm.Sender = func(ctx context.Context, needReply bool, jsonRequest string) (jsonReply string, err error) {
|
|
305
|
+
return "", fmt.Errorf("unexpected VM upcall with no controller: %s", jsonRequest)
|
|
302
306
|
}
|
|
303
307
|
return NewAgoricApp(
|
|
304
308
|
defaultController, vm.NewAgdServer(),
|
|
@@ -308,7 +312,7 @@ func NewGaiaApp(
|
|
|
308
312
|
}
|
|
309
313
|
|
|
310
314
|
func NewAgoricApp(
|
|
311
|
-
sendToController
|
|
315
|
+
sendToController vm.Sender, agdServer *vm.AgdServer,
|
|
312
316
|
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool,
|
|
313
317
|
homePath string, invCheckPeriod uint, encodingConfig gaiaappparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp),
|
|
314
318
|
) *GaiaApp {
|
|
@@ -327,7 +331,8 @@ func NewAgoricApp(
|
|
|
327
331
|
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey,
|
|
328
332
|
evidencetypes.StoreKey, ibctransfertypes.StoreKey, packetforwardtypes.StoreKey,
|
|
329
333
|
capabilitytypes.StoreKey, feegrant.StoreKey, authzkeeper.StoreKey, icahosttypes.StoreKey,
|
|
330
|
-
swingset.StoreKey, vstorage.StoreKey, vibc.StoreKey,
|
|
334
|
+
swingset.StoreKey, vstorage.StoreKey, vibc.StoreKey,
|
|
335
|
+
vlocalchain.StoreKey, vtransfer.StoreKey, vbank.StoreKey,
|
|
331
336
|
)
|
|
332
337
|
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
|
|
333
338
|
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
|
|
@@ -450,11 +455,11 @@ func NewAgoricApp(
|
|
|
450
455
|
)
|
|
451
456
|
|
|
452
457
|
// This function is tricky to get right, so we build it ourselves.
|
|
453
|
-
callToController := func(ctx sdk.Context,
|
|
458
|
+
callToController := func(ctx sdk.Context, jsonRequest string) (jsonReply string, err error) {
|
|
454
459
|
app.CheckControllerInited(true)
|
|
455
460
|
// We use SwingSet-level metering to charge the user for the call.
|
|
456
461
|
defer app.AgdServer.SetControllerContext(ctx)()
|
|
457
|
-
return sendToController(sdk.WrapSDKContext(ctx), true,
|
|
462
|
+
return sendToController(sdk.WrapSDKContext(ctx), true, jsonRequest)
|
|
458
463
|
}
|
|
459
464
|
|
|
460
465
|
setBootstrapNeeded := func() {
|
|
@@ -514,6 +519,19 @@ func NewAgoricApp(
|
|
|
514
519
|
vibcIBCModule := vibc.NewIBCModule(app.VibcKeeper)
|
|
515
520
|
app.vibcPort = app.AgdServer.MustRegisterPortHandler("vibc", vibc.NewReceiver(app.VibcKeeper))
|
|
516
521
|
|
|
522
|
+
app.VtransferKeeper = vtransferkeeper.NewKeeper(
|
|
523
|
+
appCodec,
|
|
524
|
+
keys[vtransfer.StoreKey],
|
|
525
|
+
app.VibcKeeper,
|
|
526
|
+
scopedTransferKeeper,
|
|
527
|
+
app.SwingSetKeeper.PushAction,
|
|
528
|
+
)
|
|
529
|
+
|
|
530
|
+
vtransferModule := vtransfer.NewAppModule(app.VtransferKeeper)
|
|
531
|
+
app.vtransferPort = app.AgdServer.MustRegisterPortHandler("vtransfer",
|
|
532
|
+
vibc.NewReceiver(app.VtransferKeeper),
|
|
533
|
+
)
|
|
534
|
+
|
|
517
535
|
app.VbankKeeper = vbank.NewKeeper(
|
|
518
536
|
appCodec, keys[vbank.StoreKey], app.GetSubspace(vbank.ModuleName),
|
|
519
537
|
app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName,
|
|
@@ -555,56 +573,64 @@ func NewAgoricApp(
|
|
|
555
573
|
app.IBCKeeper.ChannelKeeper,
|
|
556
574
|
app.DistrKeeper,
|
|
557
575
|
app.BankKeeper,
|
|
558
|
-
|
|
576
|
+
// Make vtransfer the middleware wrapper for the IBCKeeper.
|
|
577
|
+
app.VtransferKeeper.GetICS4Wrapper(),
|
|
559
578
|
)
|
|
560
579
|
|
|
561
580
|
app.TransferKeeper = ibctransferkeeper.NewKeeper(
|
|
562
581
|
appCodec,
|
|
563
582
|
keys[ibctransfertypes.StoreKey],
|
|
564
583
|
app.GetSubspace(ibctransfertypes.ModuleName),
|
|
565
|
-
app.PacketForwardKeeper,
|
|
584
|
+
app.PacketForwardKeeper, // Wire in the middleware ICS4Wrapper.
|
|
566
585
|
app.IBCKeeper.ChannelKeeper,
|
|
567
586
|
&app.IBCKeeper.PortKeeper,
|
|
568
587
|
app.AccountKeeper,
|
|
569
588
|
app.BankKeeper,
|
|
570
589
|
scopedTransferKeeper,
|
|
571
590
|
)
|
|
572
|
-
|
|
573
|
-
transferIBCModule := transfer.NewIBCModule(app.TransferKeeper)
|
|
591
|
+
|
|
574
592
|
app.PacketForwardKeeper.SetTransferKeeper(app.TransferKeeper)
|
|
575
|
-
transferPFMModule := packetforward.NewIBCMiddleware(
|
|
576
|
-
transferIBCModule,
|
|
577
|
-
app.PacketForwardKeeper,
|
|
578
|
-
0, // retries on timeout
|
|
579
|
-
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, // forward timeout
|
|
580
|
-
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, // refund timeout
|
|
581
|
-
)
|
|
582
593
|
|
|
594
|
+
// NewAppModule uses a pointer to the host keeper in case there's a need to
|
|
595
|
+
// tie a circular knot with IBC middleware before icahostkeeper.NewKeeper
|
|
596
|
+
// can be called.
|
|
583
597
|
app.ICAHostKeeper = icahostkeeper.NewKeeper(
|
|
584
598
|
appCodec, keys[icahosttypes.StoreKey],
|
|
585
599
|
app.GetSubspace(icahosttypes.SubModuleName),
|
|
586
|
-
app.
|
|
600
|
+
app.IBCKeeper.ChannelKeeper, // This is where middleware binding would happen.
|
|
587
601
|
app.IBCKeeper.ChannelKeeper,
|
|
588
602
|
&app.IBCKeeper.PortKeeper,
|
|
589
603
|
app.AccountKeeper,
|
|
590
604
|
scopedICAHostKeeper,
|
|
591
605
|
app.MsgServiceRouter(),
|
|
592
606
|
)
|
|
593
|
-
icaModule := ica.NewAppModule(nil, &app.ICAHostKeeper)
|
|
594
607
|
icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper)
|
|
608
|
+
icaModule := ica.NewAppModule(nil, &app.ICAHostKeeper)
|
|
609
|
+
|
|
610
|
+
ics20TransferModule := ibctransfer.NewAppModule(app.TransferKeeper)
|
|
611
|
+
|
|
612
|
+
// Create the IBC router, which maps *module names* (not PortIDs) to modules.
|
|
613
|
+
ibcRouter := ibcporttypes.NewRouter()
|
|
595
614
|
|
|
596
|
-
//
|
|
597
|
-
|
|
598
|
-
// PortIDs) to modules.
|
|
599
|
-
ibcRouter := porttypes.NewRouter()
|
|
615
|
+
// Add an IBC route for the ICA Host.
|
|
616
|
+
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule)
|
|
600
617
|
|
|
601
|
-
//
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
// -
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
618
|
+
// Add an IBC route for vIBC.
|
|
619
|
+
ibcRouter.AddRoute(vibc.ModuleName, vibcIBCModule)
|
|
620
|
+
|
|
621
|
+
// Add an IBC route for ICS-20 fungible token transfers, wrapping base
|
|
622
|
+
// Cosmos functionality with middleware (from the inside out, Cosmos
|
|
623
|
+
// packet-forwarding and then our own "vtransfer").
|
|
624
|
+
var ics20TransferIBCModule ibcporttypes.IBCModule = ibctransfer.NewIBCModule(app.TransferKeeper)
|
|
625
|
+
ics20TransferIBCModule = packetforward.NewIBCMiddleware(
|
|
626
|
+
ics20TransferIBCModule,
|
|
627
|
+
app.PacketForwardKeeper,
|
|
628
|
+
0, // retries on timeout
|
|
629
|
+
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, // forward timeout
|
|
630
|
+
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp, // refund timeout
|
|
631
|
+
)
|
|
632
|
+
ics20TransferIBCModule = vtransfer.NewIBCMiddleware(ics20TransferIBCModule, app.VtransferKeeper)
|
|
633
|
+
ibcRouter.AddRoute(ibctransfertypes.ModuleName, ics20TransferIBCModule)
|
|
608
634
|
|
|
609
635
|
// Seal the router
|
|
610
636
|
app.IBCKeeper.SetRouter(ibcRouter)
|
|
@@ -658,13 +684,14 @@ func NewAgoricApp(
|
|
|
658
684
|
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
|
|
659
685
|
ibc.NewAppModule(app.IBCKeeper),
|
|
660
686
|
params.NewAppModule(app.ParamsKeeper),
|
|
661
|
-
|
|
687
|
+
ics20TransferModule,
|
|
662
688
|
icaModule,
|
|
663
689
|
packetforward.NewAppModule(app.PacketForwardKeeper),
|
|
664
690
|
vstorage.NewAppModule(app.VstorageKeeper),
|
|
665
691
|
swingset.NewAppModule(app.SwingSetKeeper, &app.SwingStoreExportsHandler, setBootstrapNeeded, app.ensureControllerInited, swingStoreExportDir),
|
|
666
692
|
vibcModule,
|
|
667
693
|
vbankModule,
|
|
694
|
+
vtransferModule,
|
|
668
695
|
)
|
|
669
696
|
|
|
670
697
|
// During begin block slashing happens after distr.BeginBlocker so that
|
|
@@ -673,11 +700,15 @@ func NewAgoricApp(
|
|
|
673
700
|
// NOTE: staking module is required if HistoricalEntries param > 0
|
|
674
701
|
// NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC)
|
|
675
702
|
app.mm.SetOrderBeginBlockers(
|
|
703
|
+
// Cosmos-SDK modules appear roughly in the order used by simapp and gaiad.
|
|
676
704
|
// upgrades should be run first
|
|
677
705
|
upgradetypes.ModuleName,
|
|
678
706
|
capabilitytypes.ModuleName,
|
|
707
|
+
// params influence many other modules, so it should be near the top.
|
|
708
|
+
paramstypes.ModuleName,
|
|
679
709
|
govtypes.ModuleName,
|
|
680
710
|
stakingtypes.ModuleName,
|
|
711
|
+
// ibc apps are grouped together
|
|
681
712
|
ibctransfertypes.ModuleName,
|
|
682
713
|
ibchost.ModuleName,
|
|
683
714
|
icatypes.ModuleName,
|
|
@@ -691,7 +722,6 @@ func NewAgoricApp(
|
|
|
691
722
|
evidencetypes.ModuleName,
|
|
692
723
|
authz.ModuleName,
|
|
693
724
|
feegrant.ModuleName,
|
|
694
|
-
paramstypes.ModuleName,
|
|
695
725
|
vestingtypes.ModuleName,
|
|
696
726
|
vstorage.ModuleName,
|
|
697
727
|
// This will cause the swingset controller to init if it hadn't yet, passing
|
|
@@ -699,12 +729,15 @@ func NewAgoricApp(
|
|
|
699
729
|
swingset.ModuleName,
|
|
700
730
|
vibc.ModuleName,
|
|
701
731
|
vbank.ModuleName,
|
|
732
|
+
vtransfer.ModuleName,
|
|
702
733
|
)
|
|
703
734
|
app.mm.SetOrderEndBlockers(
|
|
704
|
-
|
|
705
|
-
vbank.ModuleName,
|
|
735
|
+
// Cosmos-SDK modules appear roughly in the order used by simapp and gaiad.
|
|
706
736
|
govtypes.ModuleName,
|
|
707
737
|
stakingtypes.ModuleName,
|
|
738
|
+
// vibc is an Agoric-specific IBC app, so group it here with other IBC apps.
|
|
739
|
+
vibc.ModuleName,
|
|
740
|
+
vtransfer.ModuleName,
|
|
708
741
|
ibctransfertypes.ModuleName,
|
|
709
742
|
ibchost.ModuleName,
|
|
710
743
|
icatypes.ModuleName,
|
|
@@ -722,7 +755,11 @@ func NewAgoricApp(
|
|
|
722
755
|
paramstypes.ModuleName,
|
|
723
756
|
upgradetypes.ModuleName,
|
|
724
757
|
vestingtypes.ModuleName,
|
|
725
|
-
//
|
|
758
|
+
// Putting vbank before SwingSet VM will enable vbank to capture all event
|
|
759
|
+
// history that was produced all the other modules, and push those balance
|
|
760
|
+
// changes on the VM's actionQueue.
|
|
761
|
+
vbank.ModuleName,
|
|
762
|
+
// SwingSet VM needs to be last, for it to capture all the pushed actions.
|
|
726
763
|
swingset.ModuleName,
|
|
727
764
|
// And then vstorage, to produce SwingSet-induced events.
|
|
728
765
|
vstorage.ModuleName,
|
|
@@ -739,26 +776,28 @@ func NewAgoricApp(
|
|
|
739
776
|
capabilitytypes.ModuleName,
|
|
740
777
|
authtypes.ModuleName,
|
|
741
778
|
banktypes.ModuleName,
|
|
779
|
+
paramstypes.ModuleName,
|
|
742
780
|
distrtypes.ModuleName,
|
|
743
781
|
stakingtypes.ModuleName,
|
|
744
782
|
slashingtypes.ModuleName,
|
|
745
783
|
govtypes.ModuleName,
|
|
746
784
|
minttypes.ModuleName,
|
|
747
785
|
ibctransfertypes.ModuleName,
|
|
786
|
+
packetforwardtypes.ModuleName,
|
|
748
787
|
ibchost.ModuleName,
|
|
749
788
|
icatypes.ModuleName,
|
|
750
789
|
evidencetypes.ModuleName,
|
|
751
790
|
feegrant.ModuleName,
|
|
752
791
|
authz.ModuleName,
|
|
753
792
|
genutiltypes.ModuleName,
|
|
754
|
-
paramstypes.ModuleName,
|
|
755
793
|
upgradetypes.ModuleName,
|
|
756
794
|
vestingtypes.ModuleName,
|
|
795
|
+
// Agoric-specific modules go last since they may rely on other SDK modules.
|
|
757
796
|
vstorage.ModuleName,
|
|
758
797
|
vbank.ModuleName,
|
|
759
798
|
vibc.ModuleName,
|
|
799
|
+
vtransfer.ModuleName,
|
|
760
800
|
swingset.ModuleName,
|
|
761
|
-
packetforwardtypes.ModuleName,
|
|
762
801
|
}
|
|
763
802
|
|
|
764
803
|
app.mm.SetOrderInitGenesis(moduleOrderForGenesisAndUpgrade...)
|
|
@@ -787,7 +826,7 @@ func NewAgoricApp(
|
|
|
787
826
|
params.NewAppModule(app.ParamsKeeper),
|
|
788
827
|
evidence.NewAppModule(app.EvidenceKeeper),
|
|
789
828
|
ibc.NewAppModule(app.IBCKeeper),
|
|
790
|
-
|
|
829
|
+
ics20TransferModule,
|
|
791
830
|
)
|
|
792
831
|
|
|
793
832
|
app.sm.RegisterStoreDecoders()
|
|
@@ -837,10 +876,10 @@ func NewAgoricApp(
|
|
|
837
876
|
Added: []string{
|
|
838
877
|
packetforwardtypes.ModuleName, // Added PFM
|
|
839
878
|
vlocalchain.ModuleName, // Agoric added vlocalchain
|
|
879
|
+
vtransfer.ModuleName, // Agoric added vtransfer
|
|
840
880
|
},
|
|
841
881
|
Deleted: []string{
|
|
842
|
-
|
|
843
|
-
"lien", // Agoric removed the lien module
|
|
882
|
+
"lien", // Agoric removed the lien module
|
|
844
883
|
},
|
|
845
884
|
}
|
|
846
885
|
|
|
@@ -904,6 +943,7 @@ func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Conte
|
|
|
904
943
|
vm.CoreProposalStepForModules(
|
|
905
944
|
"@agoric/builders/scripts/vats/init-network.js",
|
|
906
945
|
"@agoric/builders/scripts/vats/init-localchain.js",
|
|
946
|
+
"@agoric/builders/scripts/vats/init-transfer.js",
|
|
907
947
|
),
|
|
908
948
|
// Add new vats for price feeds. The existing ones will be retired shortly.
|
|
909
949
|
vm.CoreProposalStepForModules(
|
|
@@ -983,6 +1023,7 @@ type cosmosInitAction struct {
|
|
|
983
1023
|
VbankPort int `json:"vbankPort"`
|
|
984
1024
|
VibcPort int `json:"vibcPort"`
|
|
985
1025
|
VlocalchainPort int `json:"vlocalchainPort"`
|
|
1026
|
+
VtransferPort int `json:"vtransferPort"`
|
|
986
1027
|
}
|
|
987
1028
|
|
|
988
1029
|
// Name returns the name of the App
|
|
@@ -1018,6 +1059,7 @@ func (app *GaiaApp) initController(ctx sdk.Context, bootstrap bool) {
|
|
|
1018
1059
|
VbankPort: app.vbankPort,
|
|
1019
1060
|
VibcPort: app.vibcPort,
|
|
1020
1061
|
VlocalchainPort: app.vlocalchainPort,
|
|
1062
|
+
VtransferPort: app.vtransferPort,
|
|
1021
1063
|
}
|
|
1022
1064
|
// This uses `BlockingSend` as a friendly wrapper for `sendToController`
|
|
1023
1065
|
//
|
|
@@ -1282,11 +1324,44 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
|
|
|
1282
1324
|
paramsKeeper.Subspace(slashingtypes.ModuleName)
|
|
1283
1325
|
paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypesv1.ParamKeyTable())
|
|
1284
1326
|
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
|
|
1327
|
+
paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable())
|
|
1285
1328
|
paramsKeeper.Subspace(ibchost.ModuleName)
|
|
1286
1329
|
paramsKeeper.Subspace(icahosttypes.SubModuleName)
|
|
1287
|
-
paramsKeeper.Subspace(packetforwardtypes.ModuleName).WithKeyTable(packetforwardtypes.ParamKeyTable())
|
|
1288
1330
|
paramsKeeper.Subspace(swingset.ModuleName)
|
|
1289
1331
|
paramsKeeper.Subspace(vbank.ModuleName)
|
|
1290
1332
|
|
|
1291
1333
|
return paramsKeeper
|
|
1292
1334
|
}
|
|
1335
|
+
|
|
1336
|
+
// TestingApp functions
|
|
1337
|
+
|
|
1338
|
+
// GetBaseApp implements the TestingApp interface.
|
|
1339
|
+
func (app *GaiaApp) GetBaseApp() *baseapp.BaseApp {
|
|
1340
|
+
return app.BaseApp
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
// GetStakingKeeper implements the TestingApp interface.
|
|
1344
|
+
func (app *GaiaApp) GetStakingKeeper() testtypes.StakingKeeper {
|
|
1345
|
+
return app.StakingKeeper
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
// GetIBCKeeper implements the TestingApp interface.
|
|
1349
|
+
func (app *GaiaApp) GetIBCKeeper() *ibckeeper.Keeper {
|
|
1350
|
+
return app.IBCKeeper
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
// GetScopedIBCKeeper implements the TestingApp interface.
|
|
1354
|
+
func (app *GaiaApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper {
|
|
1355
|
+
return app.ScopedIBCKeeper
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
// GetTxConfig implements the TestingApp interface.
|
|
1359
|
+
func (app *GaiaApp) GetTxConfig() client.TxConfig {
|
|
1360
|
+
return MakeEncodingConfig().TxConfig
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
// For testing purposes
|
|
1364
|
+
func (app *GaiaApp) SetSwingStoreExportDir(dir string) {
|
|
1365
|
+
module := app.mm.Modules[swingset.ModuleName].(swingset.AppModule)
|
|
1366
|
+
module.SetSwingStoreExportDir(dir)
|
|
1367
|
+
}
|
package/cmd/agd/main.go
CHANGED
|
@@ -57,12 +57,12 @@ func main() {
|
|
|
57
57
|
var shutdown func() error
|
|
58
58
|
|
|
59
59
|
nodePort := 1
|
|
60
|
-
sendToNode
|
|
60
|
+
var sendToNode vm.Sender = func(ctx context.Context, needReply bool, jsonRequest string) (jsonReply string, err error) {
|
|
61
61
|
if vmClient == nil {
|
|
62
62
|
return "", errors.New("sendToVM called without VM client set up")
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
if
|
|
65
|
+
if jsonRequest == "shutdown" {
|
|
66
66
|
// We could ask nicely, but don't bother.
|
|
67
67
|
if shutdown != nil {
|
|
68
68
|
return "", shutdown()
|
|
@@ -73,10 +73,10 @@ func main() {
|
|
|
73
73
|
msg := vm.Message{
|
|
74
74
|
Port: nodePort,
|
|
75
75
|
NeedsReply: needReply,
|
|
76
|
-
Data:
|
|
76
|
+
Data: jsonRequest,
|
|
77
77
|
}
|
|
78
78
|
var reply string
|
|
79
|
-
err
|
|
79
|
+
err = vmClient.Call(vm.ReceiveMessageMethod, msg, &reply)
|
|
80
80
|
return reply, err
|
|
81
81
|
}
|
|
82
82
|
|
package/cmd/libdaemon/main.go
CHANGED
|
@@ -37,22 +37,22 @@ var agdServer *vm.AgdServer
|
|
|
37
37
|
|
|
38
38
|
// ConnectVMClientCodec creates an RPC client codec and a sender to the
|
|
39
39
|
// in-process implementation of the VM.
|
|
40
|
-
func ConnectVMClientCodec(ctx context.Context, nodePort int, sendFunc func(int, int, string)) (*vm.ClientCodec,
|
|
40
|
+
func ConnectVMClientCodec(ctx context.Context, nodePort int, sendFunc func(int, int, string)) (*vm.ClientCodec, vm.Sender) {
|
|
41
41
|
vmClientCodec = vm.NewClientCodec(ctx, sendFunc)
|
|
42
42
|
vmClient := rpc.NewClientWithCodec(vmClientCodec)
|
|
43
43
|
|
|
44
|
-
sendToNode
|
|
45
|
-
if
|
|
44
|
+
var sendToNode vm.Sender = func(ctx context.Context, needReply bool, jsonRequest string) (jsonReply string, err error) {
|
|
45
|
+
if jsonRequest == "shutdown" {
|
|
46
46
|
return "", vmClientCodec.Close()
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
msg := vm.Message{
|
|
50
50
|
Port: nodePort,
|
|
51
51
|
NeedsReply: needReply,
|
|
52
|
-
Data:
|
|
52
|
+
Data: jsonRequest,
|
|
53
53
|
}
|
|
54
54
|
var reply string
|
|
55
|
-
err
|
|
55
|
+
err = vmClient.Call(vm.ReceiveMessageMethod, msg, &reply)
|
|
56
56
|
return reply, err
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -72,7 +72,7 @@ func RunAgCosmosDaemon(nodePort C.int, toNode C.sendFunc, cosmosArgs []*C.char)
|
|
|
72
72
|
panic(err)
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
var sendToNode
|
|
75
|
+
var sendToNode vm.Sender
|
|
76
76
|
|
|
77
77
|
sendFunc := func(port int, reply int, str string) {
|
|
78
78
|
C.invokeSendFunc(toNode, C.int(port), C.int(reply), C.CString(str))
|
package/daemon/cmd/root.go
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
package cmd
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
"context"
|
|
5
4
|
"errors"
|
|
6
5
|
"io"
|
|
7
6
|
"os"
|
|
@@ -42,16 +41,13 @@ import (
|
|
|
42
41
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
43
42
|
)
|
|
44
43
|
|
|
45
|
-
// Sender is a function that sends a request to the controller.
|
|
46
|
-
type Sender func(ctx context.Context, needReply bool, str string) (string, error)
|
|
47
|
-
|
|
48
44
|
var AppName = "agd"
|
|
49
45
|
var OnStartHook func(*vm.AgdServer, log.Logger, servertypes.AppOptions) error
|
|
50
46
|
var OnExportHook func(*vm.AgdServer, log.Logger, servertypes.AppOptions) error
|
|
51
47
|
|
|
52
48
|
// NewRootCmd creates a new root command for simd. It is called once in the
|
|
53
49
|
// main function.
|
|
54
|
-
func NewRootCmd(sender Sender) (*cobra.Command, params.EncodingConfig) {
|
|
50
|
+
func NewRootCmd(sender vm.Sender) (*cobra.Command, params.EncodingConfig) {
|
|
55
51
|
encodingConfig := gaia.MakeEncodingConfig()
|
|
56
52
|
initClientCtx := client.Context{}.
|
|
57
53
|
WithCodec(encodingConfig.Marshaler).
|
|
@@ -125,7 +121,7 @@ func initAppConfig() (string, interface{}) {
|
|
|
125
121
|
return serverconfig.DefaultConfigTemplate, *srvCfg
|
|
126
122
|
}
|
|
127
123
|
|
|
128
|
-
func initRootCmd(sender Sender, rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
|
|
124
|
+
func initRootCmd(sender vm.Sender, rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
|
|
129
125
|
cfg := sdk.GetConfig()
|
|
130
126
|
cfg.Seal()
|
|
131
127
|
|
|
@@ -252,7 +248,7 @@ func txCommand() *cobra.Command {
|
|
|
252
248
|
|
|
253
249
|
type appCreator struct {
|
|
254
250
|
encCfg params.EncodingConfig
|
|
255
|
-
sender Sender
|
|
251
|
+
sender vm.Sender
|
|
256
252
|
agdServer *vm.AgdServer
|
|
257
253
|
}
|
|
258
254
|
|
package/daemon/main.go
CHANGED
|
@@ -13,12 +13,13 @@ import (
|
|
|
13
13
|
"github.com/Agoric/agoric-sdk/golang/cosmos/agoric"
|
|
14
14
|
app "github.com/Agoric/agoric-sdk/golang/cosmos/app"
|
|
15
15
|
"github.com/Agoric/agoric-sdk/golang/cosmos/daemon/cmd"
|
|
16
|
+
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
16
17
|
|
|
17
18
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
18
19
|
)
|
|
19
20
|
|
|
20
21
|
// DefaultController is a stub controller.
|
|
21
|
-
var DefaultController = func(ctx context.Context, needReply bool,
|
|
22
|
+
var DefaultController vm.Sender = func(ctx context.Context, needReply bool, jsonRequest string) (jsonReply string, err error) {
|
|
22
23
|
return "", fmt.Errorf("Controller not configured; did you mean to use `ag-chain-cosmos` instead?")
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -28,7 +29,7 @@ func Run() {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
// RunWithController starts the app with a custom upcall handler.
|
|
31
|
-
func RunWithController(sendToController
|
|
32
|
+
func RunWithController(sendToController vm.Sender) {
|
|
32
33
|
// Exit on Control-C and kill.
|
|
33
34
|
// Without this explicitly, ag-chain-cosmos ignores them.
|
|
34
35
|
sigs := make(chan os.Signal, 1)
|
package/git-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
24665a9
|
package/go.mod
CHANGED
|
@@ -192,6 +192,9 @@ replace (
|
|
|
192
192
|
// Pick up an IAVL race fix.
|
|
193
193
|
github.com/cosmos/iavl => github.com/cosmos/iavl v0.19.7
|
|
194
194
|
|
|
195
|
+
// Use a version of ibc-go that is compatible with the above forks.
|
|
196
|
+
github.com/cosmos/ibc-go/v6 => github.com/agoric-labs/ibc-go/v6 v6.3.1-alpha.agoric.2
|
|
197
|
+
|
|
195
198
|
// use cometbft
|
|
196
199
|
// Use our fork at least until post-v0.34.14 is released with
|
|
197
200
|
// https://github.com/tendermint/tendermint/issue/6899 resolved.
|
package/go.sum
CHANGED
|
@@ -236,6 +236,8 @@ github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.4 h1:i5IgChQjTyWulV/y5
|
|
|
236
236
|
github.com/agoric-labs/cosmos-sdk v0.46.16-alpha.agoric.2.4/go.mod h1:d7e4h+w7FNBNmE6ysp6duBVuQg67pqMtvsLwpT9ca3E=
|
|
237
237
|
github.com/agoric-labs/cosmos-sdk/ics23/go v0.8.0-alpha.agoric.1 h1:2jvHI/2d+psWAZy6FQ0vXJCHUtfU3ZbbW+pQFL04arQ=
|
|
238
238
|
github.com/agoric-labs/cosmos-sdk/ics23/go v0.8.0-alpha.agoric.1/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg=
|
|
239
|
+
github.com/agoric-labs/ibc-go/v6 v6.3.1-alpha.agoric.2 h1:vEzy4JaExzlWNHV3ZSVXEVZcRE9loEFUjieE2TXwDdI=
|
|
240
|
+
github.com/agoric-labs/ibc-go/v6 v6.3.1-alpha.agoric.2/go.mod h1:L1xcBjCLIHN7Wd9j6cAQvZertn56pq+eRGFZjRO5bsY=
|
|
239
241
|
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
|
240
242
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
241
243
|
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
@@ -380,8 +382,6 @@ github.com/cosmos/iavl v0.19.7 h1:ij32FaEnwxfEurtK0QKDNhTWFnz6NUmrI5gky/WnoY0=
|
|
|
380
382
|
github.com/cosmos/iavl v0.19.7/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw=
|
|
381
383
|
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v6 v6.1.2 h1:Hz4nkpStoXIHrC77CIEyu2mRiN2qysGEZPFRf0fpv7w=
|
|
382
384
|
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v6 v6.1.2/go.mod h1:Jo934o/sW7fNxuOa/TjCalSalz+1Fd649eLyANaJx8g=
|
|
383
|
-
github.com/cosmos/ibc-go/v6 v6.3.1 h1:/5ur3AsmNW8WuOevfODHlaY5Ze236PBNE3vVo9o3fQA=
|
|
384
|
-
github.com/cosmos/ibc-go/v6 v6.3.1/go.mod h1:Dm14j9s094bGyCEE8W4fD+2t8IneHv+cz+80Mvwjr1w=
|
|
385
385
|
github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo=
|
|
386
386
|
github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA=
|
|
387
387
|
github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmos",
|
|
3
|
-
"version": "0.34.2-upgrade-16-dev-
|
|
3
|
+
"version": "0.34.2-upgrade-16-dev-24665a9.0+24665a9",
|
|
4
4
|
"description": "Connect JS to the Cosmos blockchain SDK",
|
|
5
5
|
"parsers": {
|
|
6
6
|
"js": "mjs"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"typeCoverage": {
|
|
40
40
|
"atLeast": 0
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "24665a97248b854fcb01185d360429301470ed57"
|
|
43
43
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
package agoric.vtransfer;
|
|
3
|
+
|
|
4
|
+
import "gogoproto/gogo.proto";
|
|
5
|
+
|
|
6
|
+
option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/types";
|
|
7
|
+
|
|
8
|
+
// The initial and exported module state.
|
|
9
|
+
message GenesisState {
|
|
10
|
+
option (gogoproto.equal) = false;
|
|
11
|
+
|
|
12
|
+
// The list of account addresses that are being watched by the VM.
|
|
13
|
+
repeated bytes watched_addresses = 1 [
|
|
14
|
+
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress",
|
|
15
|
+
(gogoproto.jsontag) = "watched_addresses",
|
|
16
|
+
(gogoproto.moretags) = "yaml:\"watched_addresses\""
|
|
17
|
+
];
|
|
18
|
+
}
|
package/vm/client_test.go
CHANGED
|
@@ -11,30 +11,28 @@ import (
|
|
|
11
11
|
"github.com/Agoric/agoric-sdk/golang/cosmos/vm"
|
|
12
12
|
)
|
|
13
13
|
|
|
14
|
-
type Sender func(ctx context.Context, needReply bool, str string) (string, error)
|
|
15
|
-
|
|
16
14
|
type errorWrapper struct {
|
|
17
15
|
Error string `json:"error"`
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
// ConnectVMClientCodec creates an RPC client codec and a sender to the
|
|
21
19
|
// in-process implementation of the VM.
|
|
22
|
-
func ConnectVMClientCodec(ctx context.Context, nodePort int, sendFunc func(int, int, string)) (*vm.ClientCodec, Sender) {
|
|
20
|
+
func ConnectVMClientCodec(ctx context.Context, nodePort int, sendFunc func(int, int, string)) (*vm.ClientCodec, vm.Sender) {
|
|
23
21
|
vmClientCodec := vm.NewClientCodec(ctx, sendFunc)
|
|
24
22
|
vmClient := rpc.NewClientWithCodec(vmClientCodec)
|
|
25
23
|
|
|
26
|
-
sendToNode := func(ctx context.Context, needReply bool,
|
|
27
|
-
if
|
|
24
|
+
sendToNode := func(ctx context.Context, needReply bool, jsonRequest string) (jsonReply string, err error) {
|
|
25
|
+
if jsonRequest == "shutdown" {
|
|
28
26
|
return "", vmClientCodec.Close()
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
msg := vm.Message{
|
|
32
30
|
Port: nodePort,
|
|
33
31
|
NeedsReply: needReply,
|
|
34
|
-
Data:
|
|
32
|
+
Data: jsonRequest,
|
|
35
33
|
}
|
|
36
34
|
var reply string
|
|
37
|
-
err
|
|
35
|
+
err = vmClient.Call(vm.ReceiveMessageMethod, msg, &reply)
|
|
38
36
|
return reply, err
|
|
39
37
|
}
|
|
40
38
|
|
|
@@ -42,7 +40,7 @@ func ConnectVMClientCodec(ctx context.Context, nodePort int, sendFunc func(int,
|
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
type Fixture struct {
|
|
45
|
-
SendToNode Sender
|
|
43
|
+
SendToNode vm.Sender
|
|
46
44
|
SendToGo func(port int, msgStr string) string
|
|
47
45
|
ReplyToGo func(replyPort int, isError bool, respStr string) int
|
|
48
46
|
}
|
package/vm/controller.go
CHANGED
|
@@ -7,6 +7,9 @@ import (
|
|
|
7
7
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
8
8
|
)
|
|
9
9
|
|
|
10
|
+
// Sender makes a request of our associated VM.
|
|
11
|
+
type Sender func(ctx context.Context, needReply bool, jsonRequest string) (jsonReply string, err error)
|
|
12
|
+
|
|
10
13
|
type ControllerAdmissionMsg interface {
|
|
11
14
|
sdk.Msg
|
|
12
15
|
CheckAdmissibility(sdk.Context, interface{}) error
|