Add a whitelisted block

This commit is contained in:
Aayush Rajasekaran 2021-04-09 02:58:22 -04:00
parent 470bd307c3
commit c1e4eb3b20
9 changed files with 33 additions and 0 deletions

View File

@ -6,6 +6,8 @@ import (
"os"
"strconv"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/policy"
)
@ -91,3 +93,5 @@ const SlashablePowerDelay = 20
const InteractivePoRepConfidence = 6
const BootstrapPeerThreshold = 1
var WhitelistedBlock = cid.Undef

View File

@ -7,6 +7,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/policy"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/ipfs/go-cid"
)
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
@ -51,3 +52,5 @@ const PropagationDelaySecs = uint64(6)
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
const BootstrapPeerThreshold = 2
var WhitelistedBlock = cid.Undef

View File

@ -7,6 +7,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/policy"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/ipfs/go-cid"
)
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
@ -62,3 +63,5 @@ const PropagationDelaySecs = uint64(6)
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
const BootstrapPeerThreshold = 4
var WhitelistedBlock = cid.Undef

View File

@ -81,3 +81,6 @@ const PropagationDelaySecs = uint64(6)
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
const BootstrapPeerThreshold = 4
// we skip checks on message validity in this block to sidestep the zero-bls signature
var WhitelistedBlock = MustParseCid("bafy2bzaceapyg2uyzk7vueh3xccxkuwbz3nxewjyguoxvhx77malc2lzn2ybi")

View File

@ -5,6 +5,7 @@ package build
import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/ipfs/go-cid"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
)
@ -71,3 +72,5 @@ const PropagationDelaySecs = uint64(6)
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
const BootstrapPeerThreshold = 4
var WhitelistedBlock = cid.Undef

View File

@ -2,6 +2,7 @@ package build
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/protocol"
@ -28,3 +29,12 @@ func MustParseAddress(addr string) address.Address {
return ret
}
func MustParseCid(c string) cid.Cid {
ret, err := cid.Decode(c)
if err != nil {
panic(err)
}
return ret
}

View File

@ -12,6 +12,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network"
"github.com/ipfs/go-cid"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
@ -105,6 +106,7 @@ var (
Devnet = true
ZeroAddress = MustParseAddress("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a")
WhitelistedBlock = cid.Undef
BootstrappersFile = ""
GenesisFile = ""
)

View File

@ -751,6 +751,10 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock, use
}
msgsCheck := async.Err(func() error {
if b.Cid() == build.WhitelistedBlock {
return nil
}
if err := syncer.checkBlockMessages(ctx, b, baseTs); err != nil {
return xerrors.Errorf("block had invalid messages: %w", err)
}

View File

@ -90,6 +90,7 @@ var sigsVerifyBlsMsgsCmd = &cli.Command{
return xerrors.New("bls aggregate signature failed to verify")
}
fmt.Println("BLS siggys valid!")
return nil
},
}