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,
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: &crypto.Signature{Type: crypto.SigTypeBLS},
},
{
Height: h,
@ -83,7 +83,7 @@ func makeTs(t *testing.T, h abi.ChainEpoch, msgcid cid.Cid) *types.TipSet {
ParentMessageReceipts: dummyCid,
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,
ParentMessageReceipts: dummyCid,
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: &crypto.Signature{Type: crypto.SigTypeBLS},
}})
if err != nil {
t.Fatal(err)
@ -72,7 +72,7 @@ func TestTsCacheNulls(t *testing.T) {
Messages: dummyCid,
ParentMessageReceipts: dummyCid,
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: &crypto.Signature{Type: crypto.SigTypeBLS},
}})
if err != nil {
t.Fatal(err)

View File

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

View File

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

View File

@ -874,7 +874,7 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
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")
defer span.End()
span.AddAttributes(

View File

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

View File

@ -36,7 +36,7 @@ func testBlockHeader(t testing.TB) *BlockHeader {
},
Parents: []cid.Cid{c, 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),
Messages: c,
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 {
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,
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,
Messages: c,
Height: height,

View File

@ -7,7 +7,7 @@ import (
"io"
"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"
xerrors "golang.org/x/xerrors"
)