@agoric/cosmos 0.34.2-dev-0cc126e.0 → 0.34.2-dev-52bc8ec.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 +9 -99
- package/git-revision.txt +1 -1
- package/package.json +2 -2
- package/app/const.go +0 -6
package/app/app.go
CHANGED
|
@@ -790,13 +790,18 @@ func NewAgoricApp(
|
|
|
790
790
|
app.SetBeginBlocker(app.BeginBlocker)
|
|
791
791
|
app.SetEndBlocker(app.EndBlocker)
|
|
792
792
|
|
|
793
|
+
const (
|
|
794
|
+
upgradeName = "agoric-upgrade-12"
|
|
795
|
+
upgradeNameTest = "agorictest-upgrade-12"
|
|
796
|
+
)
|
|
797
|
+
|
|
793
798
|
app.UpgradeKeeper.SetUpgradeHandler(
|
|
794
799
|
upgradeName,
|
|
795
|
-
|
|
800
|
+
upgrade12Handler(app, upgradeName),
|
|
796
801
|
)
|
|
797
802
|
app.UpgradeKeeper.SetUpgradeHandler(
|
|
798
803
|
upgradeNameTest,
|
|
799
|
-
|
|
804
|
+
upgrade12Handler(app, upgradeNameTest),
|
|
800
805
|
)
|
|
801
806
|
|
|
802
807
|
if loadLatest {
|
|
@@ -819,108 +824,13 @@ func NewAgoricApp(
|
|
|
819
824
|
return app
|
|
820
825
|
}
|
|
821
826
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
func (eventHandler swingStoreMigrationEventHandler) OnExportStarted(height uint64, retrieveSwingStoreExport func() error) error {
|
|
827
|
-
return retrieveSwingStoreExport()
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
func (eventHandler swingStoreMigrationEventHandler) OnExportRetrieved(provider swingsetkeeper.SwingStoreExportProvider) (err error) {
|
|
831
|
-
exportDataReader, err := provider.GetExportDataReader()
|
|
832
|
-
if err != nil {
|
|
833
|
-
return err
|
|
834
|
-
}
|
|
835
|
-
defer exportDataReader.Close()
|
|
836
|
-
|
|
837
|
-
var hasExportData bool
|
|
838
|
-
|
|
839
|
-
for {
|
|
840
|
-
entry, err := exportDataReader.Read()
|
|
841
|
-
if err == io.EOF {
|
|
842
|
-
break
|
|
843
|
-
} else if err != nil {
|
|
844
|
-
return err
|
|
845
|
-
}
|
|
846
|
-
hasExportData = true
|
|
847
|
-
if !entry.HasValue() {
|
|
848
|
-
return fmt.Errorf("no value for export data key %s", entry.Key())
|
|
849
|
-
}
|
|
850
|
-
eventHandler.swingStore.Set([]byte(entry.Key()), []byte(entry.StringValue()))
|
|
851
|
-
}
|
|
852
|
-
if !hasExportData {
|
|
853
|
-
return fmt.Errorf("export data had no entries")
|
|
854
|
-
}
|
|
855
|
-
return nil
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
// upgrade11Handler performs standard upgrade actions plus custom actions for upgrade-11.
|
|
859
|
-
func upgrade11Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) {
|
|
827
|
+
// upgrade12Handler performs standard upgrade actions plus custom actions for upgrade-12.
|
|
828
|
+
func upgrade12Handler(app *GaiaApp, targetUpgrade string) func(sdk.Context, upgradetypes.Plan, module.VersionMap) (module.VersionMap, error) {
|
|
860
829
|
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVm module.VersionMap) (module.VersionMap, error) {
|
|
861
830
|
app.CheckControllerInited(false)
|
|
862
831
|
// Record the plan to send to SwingSet
|
|
863
832
|
app.upgradePlan = &plan
|
|
864
833
|
|
|
865
|
-
// Perform swing-store migrations. We do this in the app upgrade handler
|
|
866
|
-
// since it involves multiple modules (x/vstorage and x/swingset) which
|
|
867
|
-
// don't strictly have a version change on their own.
|
|
868
|
-
|
|
869
|
-
// We are at the begining of the upgrade block, so all stores are commited
|
|
870
|
-
// as of the end of the previous block
|
|
871
|
-
savedBlockHeight := uint64(ctx.BlockHeight() - 1)
|
|
872
|
-
|
|
873
|
-
// First, repair swing-store metadata in case this node was previously
|
|
874
|
-
// initialized from a state-sync snapshot. This is done with a check on the
|
|
875
|
-
// block height to catch early any hangover related mismatch.
|
|
876
|
-
// Only entries related to missing historical metadata are imported, but we
|
|
877
|
-
// don't know what these look like here, so we provide it all.
|
|
878
|
-
getSwingStoreExportDataFromVstorage := func() (reader agorictypes.KVEntryReader, err error) {
|
|
879
|
-
return agorictypes.NewVstorageDataEntriesReader(
|
|
880
|
-
app.VstorageKeeper.ExportStorageFromPrefix(ctx, swingsetkeeper.StoragePathSwingStore),
|
|
881
|
-
), nil
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
// We're not restoring any artifact to swing-store, nor have any to provide
|
|
885
|
-
readNoArtifact := func() (artifact swingsettypes.SwingStoreArtifact, err error) {
|
|
886
|
-
return artifact, io.EOF
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
err := app.SwingStoreExportsHandler.RestoreExport(
|
|
890
|
-
swingsetkeeper.SwingStoreExportProvider{
|
|
891
|
-
BlockHeight: savedBlockHeight,
|
|
892
|
-
GetExportDataReader: getSwingStoreExportDataFromVstorage,
|
|
893
|
-
ReadNextArtifact: readNoArtifact,
|
|
894
|
-
},
|
|
895
|
-
swingsetkeeper.SwingStoreRestoreOptions{
|
|
896
|
-
ArtifactMode: swingsetkeeper.SwingStoreArtifactModeNone,
|
|
897
|
-
ExportDataMode: swingsetkeeper.SwingStoreExportDataModeRepairMetadata,
|
|
898
|
-
},
|
|
899
|
-
)
|
|
900
|
-
if err != nil {
|
|
901
|
-
return nil, err
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
// Then migrate the swing-store shadow copy:
|
|
905
|
-
// 1. Remove the swing-store "export data" shadow-copy entries from vstorage.
|
|
906
|
-
// 2. Export swing-store "export-data" (as of the previous block) through a
|
|
907
|
-
// handler that writes every entry into the swingset module's new Store.
|
|
908
|
-
app.VstorageKeeper.RemoveEntriesWithPrefix(ctx, swingsetkeeper.StoragePathSwingStore)
|
|
909
|
-
err = app.SwingStoreExportsHandler.InitiateExport(
|
|
910
|
-
savedBlockHeight,
|
|
911
|
-
swingStoreMigrationEventHandler{swingStore: app.SwingSetKeeper.GetSwingStore(ctx)},
|
|
912
|
-
swingsetkeeper.SwingStoreExportOptions{
|
|
913
|
-
ArtifactMode: swingsetkeeper.SwingStoreArtifactModeNone,
|
|
914
|
-
ExportDataMode: swingsetkeeper.SwingStoreExportDataModeAll,
|
|
915
|
-
},
|
|
916
|
-
)
|
|
917
|
-
if err == nil {
|
|
918
|
-
err = swingsetkeeper.WaitUntilSwingStoreExportDone()
|
|
919
|
-
}
|
|
920
|
-
if err != nil {
|
|
921
|
-
return nil, err
|
|
922
|
-
}
|
|
923
|
-
|
|
924
834
|
// Always run module migrations
|
|
925
835
|
mvm, err := app.mm.RunMigrations(ctx, app.configurator, fromVm)
|
|
926
836
|
if err != nil {
|
package/git-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
52bc8ec
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmos",
|
|
3
|
-
"version": "0.34.2-dev-
|
|
3
|
+
"version": "0.34.2-dev-52bc8ec.0+52bc8ec",
|
|
4
4
|
"description": "Connect JS to the Cosmos blockchain SDK",
|
|
5
5
|
"parsers": {
|
|
6
6
|
"js": "mjs"
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "52bc8ecaca025779a026d0396e07c4f620ef3a0a"
|
|
39
39
|
}
|