Catch cases where new old miners with bad code were getting made

This commit is contained in:
whyrusleeping 2020-01-17 21:20:56 -08:00
parent 3962d4204b
commit f9ea6969c3
5 changed files with 18 additions and 3 deletions

View File

@ -1,3 +1,5 @@
package build
const ForkBlizzardHeight = 6288
const ForkFrigidHeight = 7950

View File

@ -161,7 +161,7 @@ func (ia InitActor) Exec(act *types.Actor, vmctx types.VMContext, p *ExecParams)
func IsBuiltinActor(code cid.Cid) bool {
switch code {
case StorageMarketCodeCid, StoragePowerCodeCid, StorageMinerCodeCid, AccountCodeCid, InitCodeCid, MultisigCodeCid, PaymentChannelCodeCid:
case StorageMarketCodeCid, StoragePowerCodeCid, StorageMinerCodeCid, StorageMiner2CodeCid, AccountCodeCid, InitCodeCid, MultisigCodeCid, PaymentChannelCodeCid:
return true
default:
return false

View File

@ -85,7 +85,13 @@ func (spa StoragePowerActor) CreateStorageMiner(act *types.Actor, vmctx types.VM
return nil, aerrors.Newf(1, "not enough funds passed to cover required miner collateral (needed %s, got %s)", reqColl, vmctx.Message().Value)
}
encoded, err := CreateExecParams(StorageMinerCodeCid, &StorageMinerConstructorParams{
// FORK
minerCid := StorageMinerCodeCid
if vmctx.BlockHeight() > build.ForkBlizzardHeight {
minerCid = StorageMiner2CodeCid
}
encoded, err := CreateExecParams(minerCid, &StorageMinerConstructorParams{
Owner: params.Owner,
Worker: params.Worker,
SectorSize: params.SectorSize,

View File

@ -23,6 +23,13 @@ func (sm *StateManager) handleStateForks(ctx context.Context, pstate cid.Cid, he
return cid.Undef, xerrors.Errorf("blizzard bug fix failed: %w", err)
}
return npstate, nil
case build.ForkFrigidHeight:
npstate, err := fixBlizzardAMTBug(ctx, sm, pstate)
if err != nil {
return cid.Undef, xerrors.Errorf("frigid bug fix failed: %w", err)
}
return npstate, nil
}
}

View File

@ -221,7 +221,7 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
for addr, m := range actors {
for actor, c := range m {
if actor.Code != actors2.StorageMinerCodeCid {
if !(actor.Code == actors2.StorageMinerCodeCid || actor.Code == actors2.StorageMiner2CodeCid) {
continue
}