change genesis fields to match interop

This commit is contained in:
Jeromy 2020-03-21 15:25:00 -07:00
parent f3781e8329
commit f1dbd35407
10 changed files with 28 additions and 19 deletions

View File

@ -70,7 +70,7 @@ func makeTs(t *testing.T, h abi.ChainEpoch, msgcid cid.Cid) *types.TipSet {
ParentMessageReceipts: dummyCid, ParentMessageReceipts: dummyCid,
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS}, BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS}, BLSAggregate: &crypto.Signature{Type: crypto.SigTypeBLS},
}, },
{ {
Height: h, Height: h,
@ -83,7 +83,7 @@ func makeTs(t *testing.T, h abi.ChainEpoch, msgcid cid.Cid) *types.TipSet {
ParentMessageReceipts: dummyCid, ParentMessageReceipts: dummyCid,
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS}, BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS}, BLSAggregate: &crypto.Signature{Type: crypto.SigTypeBLS},
}, },
}) })

View File

@ -30,7 +30,7 @@ func TestTsCache(t *testing.T) {
Messages: dummyCid, Messages: dummyCid,
ParentMessageReceipts: dummyCid, ParentMessageReceipts: dummyCid,
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS}, BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS}, BLSAggregate: &crypto.Signature{Type: crypto.SigTypeBLS},
}}) }})
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@ -72,7 +72,7 @@ func TestTsCacheNulls(t *testing.T) {
Messages: dummyCid, Messages: dummyCid,
ParentMessageReceipts: dummyCid, ParentMessageReceipts: dummyCid,
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS}, BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS}, BLSAggregate: &crypto.Signature{Type: crypto.SigTypeBLS},
}}) }})
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

View File

@ -5,10 +5,8 @@ import (
"encoding/json" "encoding/json"
"github.com/filecoin-project/go-amt-ipld/v2" "github.com/filecoin-project/go-amt-ipld/v2"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/account" "github.com/filecoin-project/specs-actors/actors/builtin/account"
"github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/filecoin-project/specs-actors/actors/runtime" "github.com/filecoin-project/specs-actors/actors/runtime"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
@ -254,10 +252,9 @@ func MakeGenesisBlock(ctx context.Context, bs bstore.Blockstore, sys runtime.Sys
} }
b := &types.BlockHeader{ b := &types.BlockHeader{
Miner: builtin.InitActorAddr, Miner: builtin.SystemActorAddr,
Ticket: genesisticket, Ticket: genesisticket,
EPostProof: types.EPostProof{ EPostProof: types.EPostProof{
Proofs: []abi.PoStProof{{ProofBytes: []byte("not a real proof")}},
PostRand: []byte("i guess this is kinda random"), PostRand: []byte("i guess this is kinda random"),
}, },
Parents: []cid.Cid{}, Parents: []cid.Cid{},
@ -266,8 +263,8 @@ func MakeGenesisBlock(ctx context.Context, bs bstore.Blockstore, sys runtime.Sys
ParentStateRoot: stateroot, ParentStateRoot: stateroot,
Messages: mmb.Cid(), Messages: mmb.Cid(),
ParentMessageReceipts: emptyroot, ParentMessageReceipts: emptyroot,
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS, Data: []byte("signatureeee")}, BLSAggregate: nil,
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS, Data: []byte("block signatureeee")}, BlockSig: nil,
Timestamp: template.Timestamp, Timestamp: template.Timestamp,
} }

View File

@ -133,7 +133,7 @@ func MinerCreateBlock(ctx context.Context, sm *stmgr.StateManager, w *wallet.Wal
return fullBlock, nil return fullBlock, nil
} }
func aggregateSignatures(sigs []crypto.Signature) (crypto.Signature, error) { func aggregateSignatures(sigs []crypto.Signature) (*crypto.Signature, error) {
var blsSigs []bls.Signature var blsSigs []bls.Signature
for _, s := range sigs { for _, s := range sigs {
var bsig bls.Signature var bsig bls.Signature
@ -142,7 +142,7 @@ func aggregateSignatures(sigs []crypto.Signature) (crypto.Signature, error) {
} }
aggSig := bls.Aggregate(blsSigs) aggSig := bls.Aggregate(blsSigs)
return crypto.Signature{ return &crypto.Signature{
Type: crypto.SigTypeBLS, Type: crypto.SigTypeBLS,
Data: aggSig[:], Data: aggSig[:],
}, nil }, nil

View File

@ -874,7 +874,7 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
return nil return nil
} }
func (syncer *Syncer) verifyBlsAggregate(ctx context.Context, sig crypto.Signature, msgs []cid.Cid, pubks []bls.PublicKey) error { func (syncer *Syncer) verifyBlsAggregate(ctx context.Context, sig *crypto.Signature, msgs []cid.Cid, pubks []bls.PublicKey) error {
_, span := trace.StartSpan(ctx, "syncer.verifyBlsAggregate") _, span := trace.StartSpan(ctx, "syncer.verifyBlsAggregate")
defer span.End() defer span.End()
span.AddAttributes( span.AddAttributes(

View File

@ -53,7 +53,7 @@ type BlockHeader struct {
Messages cid.Cid // 8 Messages cid.Cid // 8
BLSAggregate crypto.Signature // 9 BLSAggregate *crypto.Signature // 9
Timestamp uint64 // 10 Timestamp uint64 // 10

View File

@ -36,7 +36,7 @@ func testBlockHeader(t testing.TB) *BlockHeader {
}, },
Parents: []cid.Cid{c, c}, Parents: []cid.Cid{c, c},
ParentMessageReceipts: c, ParentMessageReceipts: c,
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS, Data: []byte("boo! im a signature")}, BLSAggregate: &crypto.Signature{Type: crypto.SigTypeBLS, Data: []byte("boo! im a signature")},
ParentWeight: NewInt(123125126212), ParentWeight: NewInt(123125126212),
Messages: c, Messages: c,
Height: 85919298723, Height: 85919298723,

View File

@ -267,8 +267,20 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error {
{ {
pb, err := br.PeekByte()
if err != nil {
return err
}
if pb == cbg.CborNull[0] {
var nbuf [1]byte
if _, err := br.Read(nbuf[:]); err != nil {
return err
}
} else {
t.BLSAggregate = new(crypto.Signature)
if err := t.BLSAggregate.UnmarshalCBOR(br); err != nil { if err := t.BLSAggregate.UnmarshalCBOR(br); err != nil {
return xerrors.Errorf("unmarshaling t.BLSAggregate: %w", err) return xerrors.Errorf("unmarshaling t.BLSAggregate pointer: %w", err)
}
} }
} }

View File

@ -68,7 +68,7 @@ func MkBlock(parents *types.TipSet, weightInc uint64, ticketNonce uint64) *types
}, },
Parents: pcids, Parents: pcids,
ParentMessageReceipts: c, ParentMessageReceipts: c,
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS, Data: []byte("boo! im a signature")}, BLSAggregate: &crypto.Signature{Type: crypto.SigTypeBLS, Data: []byte("boo! im a signature")},
ParentWeight: weight, ParentWeight: weight,
Messages: c, Messages: c,
Height: height, Height: height,

View File

@ -7,7 +7,7 @@ import (
"io" "io"
"github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi"
cid "github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen" cbg "github.com/whyrusleeping/cbor-gen"
xerrors "golang.org/x/xerrors" xerrors "golang.org/x/xerrors"
) )