@agoric/cosmos 0.32.3-dev-2788f8d.0 → 0.32.3-dev-6a45c15.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.
Files changed (2) hide show
  1. package/app/app.go +25 -0
  2. package/package.json +2 -2
package/app/app.go CHANGED
@@ -774,10 +774,28 @@ func NewAgoricApp(
774
774
  func upgrade10Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) {
775
775
  return func(ctx sdk.Context, plan upgradetypes.Plan, fromVm module.VersionMap) (module.VersionMap, error) {
776
776
  app.VstorageKeeper.MigrateNoDataPlaceholders(ctx) // upgrade-10 only
777
+ normalizeProvisionAccount(ctx, app.AccountKeeper)
777
778
  return fromVm, nil
778
779
  }
779
780
  }
780
781
 
782
+ // normalizeProvisionAccount ensures that the vbank/provision account is a module account,
783
+ // initializing or updating it if necessary.
784
+ func normalizeProvisionAccount(ctx sdk.Context, ak authkeeper.AccountKeeper) {
785
+ provisionAddr := ak.GetModuleAddress(vbanktypes.ProvisionPoolName)
786
+ provisionAcct := ak.GetAccount(ctx, provisionAddr)
787
+ if _, ok := provisionAcct.(authtypes.ModuleAccountI); ok {
788
+ return
789
+ }
790
+ perms := maccPerms[vbanktypes.ProvisionPoolName]
791
+ newAcct := authtypes.NewEmptyModuleAccount(vbanktypes.ProvisionPoolName, perms...)
792
+ if provisionAcct != nil {
793
+ newAcct.AccountNumber = provisionAcct.GetAccountNumber()
794
+ newAcct.Sequence = provisionAcct.GetSequence()
795
+ }
796
+ ak.SetModuleAccount(ctx, newAcct)
797
+ }
798
+
781
799
  type cosmosInitAction struct {
782
800
  Type string `json:"type"`
783
801
  ChainID string `json:"chainID"`
@@ -855,6 +873,10 @@ func (app *GaiaApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci
855
873
  stdlog.Printf("Genesis time %s is in %s\n", genTime, d)
856
874
  }
857
875
 
876
+ // initialize the provision module account, to avoid its implicit creation
877
+ // as a default account upon receiving a transfer. See BockedAddrs().
878
+ normalizeProvisionAccount(ctx, app.AccountKeeper)
879
+
858
880
  return res
859
881
  }
860
882
 
@@ -911,6 +933,9 @@ func (app *GaiaApp) BlockedAddrs() map[string]bool {
911
933
  modAccAddrs := make(map[string]bool)
912
934
  for acc := range maccPerms {
913
935
  // The provision pool is not blocked from receiving funds.
936
+ // NOTE: because of this, the provision pool must be explicitly
937
+ // initialized as a module account during bootstrap to avoid
938
+ // implicit creation as a default accunt when funds are received.
914
939
  if acc == vbanktypes.ProvisionPoolName {
915
940
  continue
916
941
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/cosmos",
3
- "version": "0.32.3-dev-2788f8d.0+2788f8d",
3
+ "version": "0.32.3-dev-6a45c15.0+6a45c15",
4
4
  "description": "Connect JS to the Cosmos blockchain SDK",
5
5
  "parsers": {
6
6
  "js": "mjs"
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "2788f8d1343b7206b1b6322febdba52f3514e964"
50
+ "gitHead": "6a45c158c7177e955de1a24cc2d258b6d5f1a582"
51
51
  }