From a3b325db5db1af0764a2dc67666dad3d1e51a099 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Sat, 19 Dec 2020 21:00:12 +0100 Subject: [PATCH] Disable consensus faults during upgrade orange Signed-off-by: Jakub Sztandera --- chain/gen/slashfilter/slashfilter.go | 5 ++++- chain/vm/syscalls.go | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/chain/gen/slashfilter/slashfilter.go b/chain/gen/slashfilter/slashfilter.go index a73f3e2f6..cb12ddb08 100644 --- a/chain/gen/slashfilter/slashfilter.go +++ b/chain/gen/slashfilter/slashfilter.go @@ -2,6 +2,7 @@ package slashfilter import ( "fmt" + "github.com/filecoin-project/lotus/build" "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 { - 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 } diff --git a/chain/vm/syscalls.go b/chain/vm/syscalls.go index ba6ee2f1d..b063e5f25 100644 --- a/chain/vm/syscalls.go +++ b/chain/vm/syscalls.go @@ -17,6 +17,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/crypto" "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/builtin/miner" "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) } + // 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? if blockA.Cid().Equals(blockB.Cid()) { return nil, fmt.Errorf("no consensus fault: submitted blocks are the same") } - // (1) check conditions necessary to any consensus fault // were blocks mined by same miner?