Merge pull request #11407 from filecoin-project/asr/calibnet-master
chore: forward-port calibnet hotfix to master
This commit is contained in:
commit
7344dd5eb3
@ -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)
|
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 {
|
err = actorsIn.ForEach(func(a address.Address, inActor *types.Actor) error {
|
||||||
outActor, err := actorsOut.GetActor(a)
|
outActor, err := actorsOut.GetActor(a)
|
||||||
if err != nil {
|
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)
|
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)
|
return xerrors.Errorf("mismatched head for actor %s", a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,6 +178,7 @@ func (sm *StateManager) HandleStateForks(ctx context.Context, root cid.Cid, heig
|
|||||||
retCid := root
|
retCid := root
|
||||||
u := sm.stateMigrations[height]
|
u := sm.stateMigrations[height]
|
||||||
if u != nil && u.upgrade != nil {
|
if u != nil && u.upgrade != nil {
|
||||||
|
if height != build.UpgradeWatermelonFixHeight {
|
||||||
migCid, ok, err := u.migrationResultCache.Get(ctx, root)
|
migCid, ok, err := u.migrationResultCache.Get(ctx, root)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if ok {
|
if ok {
|
||||||
@ -189,12 +190,14 @@ func (sm *StateManager) HandleStateForks(ctx context.Context, root cid.Cid, heig
|
|||||||
} else {
|
} else {
|
||||||
log.Debug("no cached migration found, migrating from scratch")
|
log.Debug("no cached migration found, migrating from scratch")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
log.Warnw("STARTING migration", "height", height, "from", root)
|
log.Warnw("STARTING migration", "height", height, "from", root)
|
||||||
// Yes, we clone the cache, even for the final upgrade epoch. Why? Reverts. We may
|
// Yes, we clone the cache, even for the final upgrade epoch. Why? Reverts. We may
|
||||||
// have to migrate multiple times.
|
// have to migrate multiple times.
|
||||||
tmpCache := u.cache.Clone()
|
tmpCache := u.cache.Clone()
|
||||||
|
var err error
|
||||||
retCid, err = u.upgrade(ctx, sm, tmpCache, cb, root, height, ts)
|
retCid, err = u.upgrade(ctx, sm, tmpCache, cb, root, height, ts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorw("FAILED migration", "height", height, "from", root, "error", err)
|
log.Errorw("FAILED migration", "height", height, "from", root, "error", err)
|
||||||
|
@ -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")
|
log.Info("invalid consensus fault: submitted blocks are the same")
|
||||||
return ret, totalGas
|
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
|
// (1) check conditions necessary to any consensus fault
|
||||||
|
|
||||||
// were blocks mined by same miner?
|
// were blocks mined by same miner?
|
||||||
|
@ -325,7 +325,7 @@ minerLoop:
|
|||||||
"block-time", btime, "time", build.Clock.Now(), "difference", build.Clock.Since(btime))
|
"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)
|
witness, fault, err := m.sf.MinedBlock(ctx, b.Header, base.TipSet.Height()+base.NullRounds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("<!!> SLASH FILTER ERRORED: %s", err)
|
log.Errorf("<!!> SLASH FILTER ERRORED: %s", err)
|
||||||
|
@ -57,7 +57,7 @@ func (a *SyncAPI) SyncSubmitBlock(ctx context.Context, blk *types.BlockMsg) erro
|
|||||||
return xerrors.Errorf("loading parent block: %w", err)
|
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)
|
witness, fault, err := a.SlashFilter.MinedBlock(ctx, blk.Header, parent.Height)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("<!!> SLASH FILTER ERRORED: %s", err)
|
log.Errorf("<!!> SLASH FILTER ERRORED: %s", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user