diff --git a/chain/consensus/filcns/upgrades.go b/chain/consensus/filcns/upgrades.go index c1f594a92..3fa3dd995 100644 --- a/chain/consensus/filcns/upgrades.go +++ b/chain/consensus/filcns/upgrades.go @@ -2063,6 +2063,19 @@ func upgradeActorsV12Fix(ctx context.Context, sm *stmgr.StateManager, cache stmg return cid.Undef, xerrors.Errorf("failed to perform migration: %w", err) } + systemState.BuiltinActors = newManifest.Data + newSystemHead, err := adtStore.Put(ctx, &systemState) + if err != nil { + return cid.Undef, xerrors.Errorf("failed to put new system state: %w", err) + } + + systemActor.Head = newSystemHead + if err = actorsOut.SetActor(builtin.SystemActorAddr, systemActor); err != nil { + return cid.Undef, xerrors.Errorf("failed to put new system actor: %w", err) + } + + // Sanity checking + err = actorsIn.ForEach(func(a address.Address, inActor *types.Actor) error { outActor, err := actorsOut.GetActor(a) if err != nil { @@ -2081,7 +2094,7 @@ func upgradeActorsV12Fix(ctx context.Context, sm *stmgr.StateManager, cache stmg return xerrors.Errorf("mismatched address for actor %s: %s != %s", a, inActor.Address, outActor.Address) } - if inActor.Head != outActor.Head { + if inActor.Head != outActor.Head && a != builtin.SystemActorAddr { return xerrors.Errorf("mismatched head for actor %s", a) } diff --git a/chain/stmgr/forks.go b/chain/stmgr/forks.go index 9d59b5428..8d1ac1dfb 100644 --- a/chain/stmgr/forks.go +++ b/chain/stmgr/forks.go @@ -178,16 +178,18 @@ func (sm *StateManager) HandleStateForks(ctx context.Context, root cid.Cid, heig retCid := root u := sm.stateMigrations[height] if u != nil && u.upgrade != nil { - migCid, ok, err := u.migrationResultCache.Get(ctx, root) - if err == nil { - if ok { - log.Infow("CACHED migration", "height", height, "from", root, "to", migCid) - return migCid, nil + if height != build.UpgradeWatermelonFixHeight { + migCid, ok, err := u.migrationResultCache.Get(ctx, root) + if err == nil { + if ok { + log.Infow("CACHED migration", "height", height, "from", root, "to", migCid) + return migCid, nil + } + } else if !errors.Is(err, datastore.ErrNotFound) { + log.Errorw("failed to lookup previous migration result", "err", err) + } else { + log.Debug("no cached migration found, migrating from scratch") } - } else if !errors.Is(err, datastore.ErrNotFound) { - log.Errorw("failed to lookup previous migration result", "err", err) - } else { - log.Debug("no cached migration found, migrating from scratch") } startTime := time.Now() @@ -195,6 +197,7 @@ func (sm *StateManager) HandleStateForks(ctx context.Context, root cid.Cid, heig // Yes, we clone the cache, even for the final upgrade epoch. Why? Reverts. We may // have to migrate multiple times. tmpCache := u.cache.Clone() + var err error retCid, err = u.upgrade(ctx, sm, tmpCache, cb, root, height, ts) if err != nil { log.Errorw("FAILED migration", "height", height, "from", root, "error", err) diff --git a/chain/vm/fvm.go b/chain/vm/fvm.go index 901374a4f..47b4d3320 100644 --- a/chain/vm/fvm.go +++ b/chain/vm/fvm.go @@ -92,6 +92,15 @@ func (x *FvmExtern) VerifyConsensusFault(ctx context.Context, a, b, extra []byte log.Info("invalid consensus fault: submitted blocks are the same") return ret, totalGas } + + // workaround chain halt + if build.IsNearUpgrade(blockA.Height, build.UpgradeWatermelonFixHeight) { + return ret, totalGas + } + if build.IsNearUpgrade(blockB.Height, build.UpgradeWatermelonFixHeight) { + return ret, totalGas + } + // (1) check conditions necessary to any consensus fault // were blocks mined by same miner? diff --git a/miner/miner.go b/miner/miner.go index 2d802e2cf..510ea4f0e 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -324,7 +324,7 @@ minerLoop: "block-time", btime, "time", build.Clock.Now(), "difference", build.Clock.Since(btime)) } - if os.Getenv("LOTUS_MINER_NO_SLASHFILTER") != "_yes_i_know_i_can_and_probably_will_lose_all_my_fil_and_power_" { + if os.Getenv("LOTUS_MINER_NO_SLASHFILTER") != "_yes_i_know_i_can_and_probably_will_lose_all_my_fil_and_power_" && !build.IsNearUpgrade(base.TipSet.Height(), build.UpgradeWatermelonFixHeight) { witness, fault, err := m.sf.MinedBlock(ctx, b.Header, base.TipSet.Height()+base.NullRounds) if err != nil { log.Errorf(" SLASH FILTER ERRORED: %s", err) diff --git a/node/impl/full/sync.go b/node/impl/full/sync.go index 223f5c29e..4bf44363c 100644 --- a/node/impl/full/sync.go +++ b/node/impl/full/sync.go @@ -57,7 +57,7 @@ func (a *SyncAPI) SyncSubmitBlock(ctx context.Context, blk *types.BlockMsg) erro return xerrors.Errorf("loading parent block: %w", err) } - if a.SlashFilter != nil && os.Getenv("LOTUS_NO_SLASHFILTER") != "_yes_i_know_i_can_and_probably_will_lose_all_my_fil_and_power_" { + if a.SlashFilter != nil && os.Getenv("LOTUS_NO_SLASHFILTER") != "_yes_i_know_i_can_and_probably_will_lose_all_my_fil_and_power_" && !build.IsNearUpgrade(blk.Header.Height, build.UpgradeWatermelonFixHeight) { witness, fault, err := a.SlashFilter.MinedBlock(ctx, blk.Header, parent.Height) if err != nil { log.Errorf(" SLASH FILTER ERRORED: %s", err)