Skip to content

Commit

Permalink
Merge pull request #8452 from filecoin-project/asr/fvm-consensus-fault
Browse files Browse the repository at this point in the history
fix: FVM: add finality check for consensus faults
  • Loading branch information
magik6k authored Apr 7, 2022
2 parents 20698a7 + d1c0b8b commit e2f4c70
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chain/vm/fvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"context"
"time"

"github.com/filecoin-project/lotus/chain/actors/policy"

"github.com/filecoin-project/go-state-types/network"

"github.com/filecoin-project/go-state-types/big"
Expand Down Expand Up @@ -169,6 +171,10 @@ func (x *FvmExtern) VerifyBlockSig(ctx context.Context, blk *types.BlockHeader)
}

func (x *FvmExtern) workerKeyAtLookback(ctx context.Context, minerId address.Address, height abi.ChainEpoch) (address.Address, int64, error) {
if height < x.epoch-policy.ChainFinality {
return address.Undef, 0, xerrors.Errorf("cannot get worker key (currEpoch %d, height %d)", x.epoch, height)
}

gasUsed := int64(0)
gasAdder := func(gc GasCharge) {
// technically not overflow safe, but that's fine
Expand Down

0 comments on commit e2f4c70

Please sign in to comment.