(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestAppUpgrade_CannotDeleteLatestVersion(t *testing.T) { |
| 25 | // Skip this test that shows how SDK allows stores to get into irrecoverable state and panics |
| 26 | // TODO: Open PR on SDK with this test. |
| 27 | t.Skip() |
| 28 | encCfg := MakeTestEncodingConfig() |
| 29 | db := dbm.NewMemDB() |
| 30 | app := NewSifApp( |
| 31 | log.NewTMLogger(log.NewSyncWriter(os.Stdout)), |
| 32 | db, |
| 33 | nil, |
| 34 | false, |
| 35 | map[int64]bool{}, |
| 36 | DefaultNodeHome, |
| 37 | 0, |
| 38 | encCfg, |
| 39 | EmptyAppOptions{}, |
| 40 | ) |
| 41 | err := app.LoadLatestVersion() |
| 42 | require.NoError(t, err) |
| 43 | |
| 44 | genesisState := NewDefaultGenesisState(encCfg.Marshaler) |
| 45 | stateBytes, err := json.MarshalIndent(genesisState, "", " ") |
| 46 | require.NoError(t, err) |
| 47 | |
| 48 | // Initialize the chain |
| 49 | app.InitChain( |
| 50 | abci.RequestInitChain{ |
| 51 | Validators: []abci.ValidatorUpdate{}, |
| 52 | AppStateBytes: stateBytes, |
| 53 | }, |
| 54 | ) |
| 55 | |
| 56 | // Commit enough to trigger beginning of pruning soon |
| 57 | for i := 1; i < 105; i++ { |
| 58 | app.BeginBlock(abci.RequestBeginBlock{Header: types.Header{Height: int64(i)}}) |
| 59 | app.EndBlock(abci.RequestEndBlock{Height: int64(i)}) |
| 60 | app.Commit() |
| 61 | } |
| 62 | |
| 63 | app = NewSifApp( |
| 64 | log.NewTMLogger(log.NewSyncWriter(os.Stdout)), |
| 65 | db, |
| 66 | nil, |
| 67 | false, |
| 68 | map[int64]bool{}, |
| 69 | DefaultNodeHome, |
| 70 | 0, |
| 71 | encCfg, |
| 72 | EmptyAppOptions{}, |
| 73 | func(app *baseapp.BaseApp) { |
| 74 | cms := rootmulti.NewStore(db, app.Logger()) |
| 75 | cms.SetPruning(storetypes.PruneDefault) |
| 76 | app.SetCMS(cms) |
| 77 | }, |
| 78 | ) |
| 79 | // Mount and load newStore which will be loaded with version 0, |
| 80 | // because it did not load with an "add" upgrade to set it's initialVersion, |
| 81 | // while the other stores will be at version = blockHeight (i.e 1 here). |
nothing calls this directly
no test coverage detected