Disable consensus faults during upgrade orange

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-12-19 21:00:12 +01:00
parent 24dd6e01d7
commit a3b325db5d
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA
2 changed files with 15 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package slashfilter
import ( import (
"fmt" "fmt"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -27,7 +28,9 @@ func New(dstore ds.Batching) *SlashFilter {
} }
func (f *SlashFilter) MinedBlock(bh *types.BlockHeader, parentEpoch abi.ChainEpoch) error { func (f *SlashFilter) MinedBlock(bh *types.BlockHeader, parentEpoch abi.ChainEpoch) error {
if bh.Height < build.UpgradeOrangeHeight+build.Finality { if bh.Height > build.UpgradeOrangeHeight-build.Finality &&
bh.Height < build.UpgradeOrangeHeight+build.Finality {
// consenssus faults disabled during Upgrade Orange
return nil return nil
} }

View File

@ -17,6 +17,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
@ -107,11 +108,20 @@ func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte) (*runtime2.Conse
return nil, xerrors.Errorf("cannot decode second block header: %f", decodeErr) return nil, xerrors.Errorf("cannot decode second block header: %f", decodeErr)
} }
// workaround chain halt
if blockA.Height > build.UpgradeOrangeHeight-build.Finality &&
blockA.Height < build.UpgradeOrangeHeight+build.Finality {
return nil, xerrors.Errorf("consensus reporting disabled around Upgrade Orange")
}
if blockB.Height > build.UpgradeOrangeHeight-build.Finality &&
blockB.Height < build.UpgradeOrangeHeight+build.Finality {
return nil, xerrors.Errorf("consensus reporting disabled around Upgrade Orange")
}
// are blocks the same? // are blocks the same?
if blockA.Cid().Equals(blockB.Cid()) { if blockA.Cid().Equals(blockB.Cid()) {
return nil, fmt.Errorf("no consensus fault: submitted blocks are the same") return nil, fmt.Errorf("no consensus fault: submitted blocks are the same")
} }
// (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?