@agoric/cosmos 0.34.2-dev-7386420.0 → 0.34.2-dev-7bf5870.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 CHANGED
@@ -214,7 +214,7 @@ type GaiaApp struct { // nolint: golint
214
214
  vibcPort int
215
215
  vstoragePort int
216
216
 
217
- upgradePlan *upgradetypes.Plan
217
+ upgradeDetails *upgradeDetails
218
218
 
219
219
  invCheckPeriod uint
220
220
 
@@ -829,8 +829,21 @@ func NewAgoricApp(
829
829
  func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) {
830
830
  return func(ctx sdk.Context, plan upgradetypes.Plan, fromVm module.VersionMap) (module.VersionMap, error) {
831
831
  app.CheckControllerInited(false)
832
- // Record the plan to send to SwingSet
833
- app.upgradePlan = &plan
832
+
833
+ // Each CoreProposalStep runs sequentially, and can be constructed from
834
+ // one or more modules executing in parallel within the step.
835
+ CoreProposalSteps := []vm.CoreProposalStep{
836
+ // vm.CoreProposalStepForModules("@agoric/builders/scripts/vats/init-network.js"),
837
+ }
838
+
839
+ app.upgradeDetails = &upgradeDetails{
840
+ // Record the plan to send to SwingSet
841
+ Plan: plan,
842
+ // Core proposals that should run during the upgrade block
843
+ // These will be merged with any coreProposals specified in the
844
+ // upgradeInfo field of the upgrade plan ran as subsequent steps
845
+ CoreProposals: vm.CoreProposalsFromSteps(CoreProposalSteps...),
846
+ }
834
847
 
835
848
  // Always run module migrations
836
849
  mvm, err := app.mm.RunMigrations(ctx, app.configurator, fromVm)
@@ -865,18 +878,23 @@ func normalizeModuleAccount(ctx sdk.Context, ak authkeeper.AccountKeeper, name s
865
878
  ak.SetModuleAccount(ctx, newAcct)
866
879
  }
867
880
 
881
+ type upgradeDetails struct {
882
+ Plan upgradetypes.Plan `json:"plan"`
883
+ CoreProposals *vm.CoreProposals `json:"coreProposals,omitempty"`
884
+ }
885
+
868
886
  type cosmosInitAction struct {
869
887
  vm.ActionHeader `actionType:"AG_COSMOS_INIT"`
870
- ChainID string `json:"chainID"`
871
- IsBootstrap bool `json:"isBootstrap"`
872
- Params swingset.Params `json:"params"`
873
- SupplyCoins sdk.Coins `json:"supplyCoins"`
874
- UpgradePlan *upgradetypes.Plan `json:"upgradePlan,omitempty"`
875
- LienPort int `json:"lienPort"`
876
- StoragePort int `json:"storagePort"`
877
- SwingsetPort int `json:"swingsetPort"`
878
- VbankPort int `json:"vbankPort"`
879
- VibcPort int `json:"vibcPort"`
888
+ ChainID string `json:"chainID"`
889
+ IsBootstrap bool `json:"isBootstrap"`
890
+ UpgradeDetails *upgradeDetails `json:"upgradeDetails,omitempty"`
891
+ Params swingset.Params `json:"params"`
892
+ SupplyCoins sdk.Coins `json:"supplyCoins"`
893
+ LienPort int `json:"lienPort"`
894
+ StoragePort int `json:"storagePort"`
895
+ SwingsetPort int `json:"swingsetPort"`
896
+ VbankPort int `json:"vbankPort"`
897
+ VibcPort int `json:"vibcPort"`
880
898
  }
881
899
 
882
900
  // Name returns the name of the App
@@ -901,22 +919,22 @@ func (app *GaiaApp) initController(ctx sdk.Context, bootstrap bool) {
901
919
 
902
920
  // Begin initializing the controller here.
903
921
  action := &cosmosInitAction{
904
- ChainID: ctx.ChainID(),
905
- IsBootstrap: bootstrap,
906
- Params: app.SwingSetKeeper.GetParams(ctx),
907
- SupplyCoins: sdk.NewCoins(app.BankKeeper.GetSupply(ctx, "uist")),
908
- UpgradePlan: app.upgradePlan,
909
- LienPort: app.lienPort,
910
- StoragePort: app.vstoragePort,
911
- SwingsetPort: app.swingsetPort,
912
- VbankPort: app.vbankPort,
913
- VibcPort: app.vibcPort,
922
+ ChainID: ctx.ChainID(),
923
+ IsBootstrap: bootstrap,
924
+ Params: app.SwingSetKeeper.GetParams(ctx),
925
+ SupplyCoins: sdk.NewCoins(app.BankKeeper.GetSupply(ctx, "uist")),
926
+ UpgradeDetails: app.upgradeDetails,
927
+ LienPort: app.lienPort,
928
+ StoragePort: app.vstoragePort,
929
+ SwingsetPort: app.swingsetPort,
930
+ VbankPort: app.vbankPort,
931
+ VibcPort: app.vibcPort,
914
932
  }
915
933
  // This uses `BlockingSend` as a friendly wrapper for `sendToController`
916
934
  //
917
935
  // CAVEAT: we are restarting after an in-consensus halt or just because this
918
936
  // node felt like it. The controller must be able to handle either case
919
- // (inConsensus := action.IsBootstrap || action.UpgradePlan != nil).
937
+ // (inConsensus := action.IsBootstrap || action.UpgradeDetails != nil).
920
938
  out, err := app.SwingSetKeeper.BlockingSend(ctx, action)
921
939
 
922
940
  // fmt.Fprintf(os.Stderr, "AG_COSMOS_INIT Returned from SwingSet: %s, %v\n", out, err)
package/git-revision.txt CHANGED
@@ -1 +1 @@
1
- 7386420
1
+ 7bf5870
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/cosmos",
3
- "version": "0.34.2-dev-7386420.0+7386420",
3
+ "version": "0.34.2-dev-7bf5870.0+7bf5870",
4
4
  "description": "Connect JS to the Cosmos blockchain SDK",
5
5
  "parsers": {
6
6
  "js": "mjs"
@@ -38,5 +38,5 @@
38
38
  "typeCoverage": {
39
39
  "atLeast": 0
40
40
  },
41
- "gitHead": "738642095d444795a16ee23c6e34e97f0f8e37ba"
41
+ "gitHead": "7bf587060268281ef4b53ed89cefccfd9cd3f8ea"
42
42
  }
@@ -0,0 +1,31 @@
1
+ package vm
2
+
3
+ // CoreProposalStep is a set of core proposal configs which are executed
4
+ // concurrently
5
+ type CoreProposalStep []Jsonable
6
+
7
+ // CoreProposals is one possible shape for core proposals expressed as a series
8
+ // of sequential steps
9
+ // see SequentialCoreProposals in packages/deploy-script-support/src/extract-proposal.js
10
+ type CoreProposals struct {
11
+ Steps []CoreProposalStep `json:"steps"`
12
+ }
13
+
14
+ // CoreProposalStepForModules generates a single core proposal step from
15
+ // the given modules, which will be executed concurrently during that step
16
+ func CoreProposalStepForModules(modules ...string) CoreProposalStep {
17
+ step := make([]Jsonable, len(modules))
18
+ for i := range modules {
19
+ step[i] = modules[i]
20
+ }
21
+ return step
22
+ }
23
+
24
+ // CoreProposalsFromSteps returns a CoreProposals from the given steps
25
+ func CoreProposalsFromSteps(steps ...CoreProposalStep) *CoreProposals {
26
+ if steps == nil {
27
+ // Deal with https://github.com/golang/go/issues/37711
28
+ return &CoreProposals{Steps: []CoreProposalStep{}}
29
+ }
30
+ return &CoreProposals{Steps: steps}
31
+ }