Merge pull request #6006 from filecoin-project/asr/proofs-update
Update to latest proofs
This commit is contained in:
commit
335a2df062
@ -6,6 +6,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||||
)
|
)
|
||||||
@ -91,3 +93,5 @@ const SlashablePowerDelay = 20
|
|||||||
const InteractivePoRepConfidence = 6
|
const InteractivePoRepConfidence = 6
|
||||||
|
|
||||||
const BootstrapPeerThreshold = 1
|
const BootstrapPeerThreshold = 1
|
||||||
|
|
||||||
|
var WhitelistedBlock = cid.Undef
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
)
|
)
|
||||||
|
|
||||||
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
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
|
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
|
||||||
const BootstrapPeerThreshold = 2
|
const BootstrapPeerThreshold = 2
|
||||||
|
|
||||||
|
var WhitelistedBlock = cid.Undef
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
)
|
)
|
||||||
|
|
||||||
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
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
|
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
|
||||||
const BootstrapPeerThreshold = 4
|
const BootstrapPeerThreshold = 4
|
||||||
|
|
||||||
|
var WhitelistedBlock = cid.Undef
|
||||||
|
@ -81,3 +81,6 @@ const PropagationDelaySecs = uint64(6)
|
|||||||
|
|
||||||
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
|
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
|
||||||
const BootstrapPeerThreshold = 4
|
const BootstrapPeerThreshold = 4
|
||||||
|
|
||||||
|
// we skip checks on message validity in this block to sidestep the zero-bls signature
|
||||||
|
var WhitelistedBlock = MustParseCid("bafy2bzaceapyg2uyzk7vueh3xccxkuwbz3nxewjyguoxvhx77malc2lzn2ybi")
|
||||||
|
@ -5,6 +5,7 @@ package build
|
|||||||
import (
|
import (
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
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
|
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
|
||||||
const BootstrapPeerThreshold = 4
|
const BootstrapPeerThreshold = 4
|
||||||
|
|
||||||
|
var WhitelistedBlock = cid.Undef
|
||||||
|
@ -2,6 +2,7 @@ package build
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
"github.com/libp2p/go-libp2p-core/protocol"
|
"github.com/libp2p/go-libp2p-core/protocol"
|
||||||
|
|
||||||
@ -28,3 +29,12 @@ func MustParseAddress(addr string) address.Address {
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func MustParseCid(c string) cid.Cid {
|
||||||
|
ret, err := cid.Decode(c)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
@ -12,6 +12,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/network"
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
|
|
||||||
@ -105,6 +106,7 @@ var (
|
|||||||
Devnet = true
|
Devnet = true
|
||||||
ZeroAddress = MustParseAddress("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a")
|
ZeroAddress = MustParseAddress("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a")
|
||||||
|
|
||||||
|
WhitelistedBlock = cid.Undef
|
||||||
BootstrappersFile = ""
|
BootstrappersFile = ""
|
||||||
GenesisFile = ""
|
GenesisFile = ""
|
||||||
)
|
)
|
||||||
|
@ -751,6 +751,10 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock, use
|
|||||||
}
|
}
|
||||||
|
|
||||||
msgsCheck := async.Err(func() error {
|
msgsCheck := async.Err(func() error {
|
||||||
|
if b.Cid() == build.WhitelistedBlock {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if err := syncer.checkBlockMessages(ctx, b, baseTs); err != nil {
|
if err := syncer.checkBlockMessages(ctx, b, baseTs); err != nil {
|
||||||
return xerrors.Errorf("block had invalid messages: %w", err)
|
return xerrors.Errorf("block had invalid messages: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||||
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/crypto"
|
"github.com/filecoin-project/go-state-types/crypto"
|
||||||
"github.com/filecoin-project/lotus/lib/sigs"
|
"github.com/filecoin-project/lotus/lib/sigs"
|
||||||
|
|
||||||
@ -18,6 +22,76 @@ var signaturesCmd = &cli.Command{
|
|||||||
Usage: "tools involving signatures",
|
Usage: "tools involving signatures",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []*cli.Command{
|
||||||
sigsVerifyVoteCmd,
|
sigsVerifyVoteCmd,
|
||||||
|
sigsVerifyBlsMsgsCmd,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var sigsVerifyBlsMsgsCmd = &cli.Command{
|
||||||
|
Name: "verify-bls",
|
||||||
|
Description: "given a block, verifies the bls signature of the messages in the block",
|
||||||
|
Usage: "<blockCid>",
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
if cctx.Args().Len() != 1 {
|
||||||
|
return xerrors.Errorf("usage: <blockCid>")
|
||||||
|
}
|
||||||
|
|
||||||
|
api, closer, err := lcli.GetFullNodeAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer closer()
|
||||||
|
ctx := lcli.ReqContext(cctx)
|
||||||
|
|
||||||
|
bc, err := cid.Decode(cctx.Args().First())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
b, err := api.ChainGetBlock(ctx, bc)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ms, err := api.ChainGetBlockMessages(ctx, bc)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var sigCids []cid.Cid // this is what we get for people not wanting the marshalcbor method on the cid type
|
||||||
|
var pubks [][]byte
|
||||||
|
|
||||||
|
for _, m := range ms.BlsMessages {
|
||||||
|
sigCids = append(sigCids, m.Cid())
|
||||||
|
|
||||||
|
if m.From.Protocol() != address.BLS {
|
||||||
|
return xerrors.Errorf("address must be BLS address")
|
||||||
|
}
|
||||||
|
|
||||||
|
pubks = append(pubks, m.From.Payload())
|
||||||
|
}
|
||||||
|
|
||||||
|
msgsS := make([]ffi.Message, len(sigCids))
|
||||||
|
pubksS := make([]ffi.PublicKey, len(sigCids))
|
||||||
|
for i := 0; i < len(sigCids); i++ {
|
||||||
|
msgsS[i] = sigCids[i].Bytes()
|
||||||
|
copy(pubksS[i][:], pubks[i][:ffi.PublicKeyBytes])
|
||||||
|
}
|
||||||
|
|
||||||
|
sigS := new(ffi.Signature)
|
||||||
|
copy(sigS[:], b.BLSAggregate.Data[:ffi.SignatureBytes])
|
||||||
|
|
||||||
|
if len(sigCids) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
valid := ffi.HashVerify(sigS, msgsS, pubksS)
|
||||||
|
if !valid {
|
||||||
|
return xerrors.New("bls aggregate signature failed to verify")
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("BLS siggys valid!")
|
||||||
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
extern/filecoin-ffi
vendored
2
extern/filecoin-ffi
vendored
@ -1 +1 @@
|
|||||||
Subproject commit b6e0b35fb49ed0fedb6a6a473b222e3b8a7d7f17
|
Subproject commit d82899449741ce190e950a3582ebe33806f018a9
|
Loading…
Reference in New Issue
Block a user