Merge pull request #1440 from filecoin-project/fix/genesis-field-values
Fix/genesis field values
This commit is contained in:
commit
881ed6aef7
@ -124,7 +124,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.Channel.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Channel: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/ipfs/go-cid"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
)
|
||||
|
@ -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},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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(
|
||||
|
@ -53,7 +53,7 @@ type BlockHeader struct {
|
||||
|
||||
Messages cid.Cid // 8
|
||||
|
||||
BLSAggregate crypto.Signature // 9
|
||||
BLSAggregate *crypto.Signature // 9
|
||||
|
||||
Timestamp uint64 // 10
|
||||
|
||||
|
@ -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,
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
|
||||
"github.com/ipfs/go-cid"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
)
|
||||
@ -133,7 +133,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.Miner.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Miner: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -153,7 +153,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error {
|
||||
} else {
|
||||
t.Ticket = new(Ticket)
|
||||
if err := t.Ticket.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Ticket pointer: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.EPostProof.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.EPostProof: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -198,7 +198,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.ParentWeight.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.ParentWeight: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -267,9 +267,21 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error {
|
||||
|
||||
{
|
||||
|
||||
if err := t.BLSAggregate.UnmarshalCBOR(br); err != nil {
|
||||
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 pointer: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// t.Timestamp (uint64) (uint64)
|
||||
@ -302,7 +314,7 @@ func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error {
|
||||
} else {
|
||||
t.BlockSig = new(crypto.Signature)
|
||||
if err := t.BlockSig.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.BlockSig pointer: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -707,7 +719,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.To.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.To: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -716,7 +728,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.From.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.From: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -739,7 +751,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.Value.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Value: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -748,7 +760,7 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.GasPrice.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.GasPrice: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -852,7 +864,7 @@ func (t *SignedMessage) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.Message.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Message: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -861,7 +873,7 @@ func (t *SignedMessage) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.Signature.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Signature: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -1026,7 +1038,7 @@ func (t *Actor) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.Balance.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Balance: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -1238,7 +1250,7 @@ func (t *BlockMsg) UnmarshalCBOR(r io.Reader) error {
|
||||
} else {
|
||||
t.Header = new(BlockHeader)
|
||||
if err := t.Header.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Header pointer: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
2
go.mod
2
go.mod
@ -92,7 +92,7 @@ require (
|
||||
github.com/prometheus/common v0.4.0 // indirect
|
||||
github.com/stretchr/testify v1.4.0
|
||||
github.com/whyrusleeping/bencher v0.0.0-20190829221104-bb6607aa8bba
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200222160900-51052a1e8191
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200321164527-9340289d0ca7
|
||||
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7
|
||||
github.com/whyrusleeping/pubsub v0.0.0-20131020042734-02de8aa2db3d
|
||||
go.opencensus.io v0.22.2
|
||||
|
2
go.sum
2
go.sum
@ -759,6 +759,8 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:X
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200206220010-03c9665e2a66/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200222160900-51052a1e8191 h1:TeuxLwKwQy612jEhfVhGJTqLsM2EwMi1eJE052ug+NY=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200222160900-51052a1e8191/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200321164527-9340289d0ca7 h1:SVU2yhhHHamTPIMT9kk28KSYdO3ykTZeIp5p+6G9qNk=
|
||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200321164527-9340289d0ca7/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
||||
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
|
||||
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
|
||||
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=
|
||||
|
@ -133,7 +133,7 @@ func (t *HelloMessage) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.HeaviestTipSetWeight.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.HeaviestTipSetWeight: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) error {
|
||||
} else {
|
||||
t.Voucher = new(paych.SignedVoucher)
|
||||
if err := t.Voucher.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Voucher pointer: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,7 +294,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.Channel.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Channel: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -304,7 +304,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.Control.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Control: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -314,7 +314,7 @@ func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.Target.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Target: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -694,7 +694,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.Ticket.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Ticket: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
@ -729,7 +729,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error {
|
||||
{
|
||||
|
||||
if err := t.Seed.UnmarshalCBOR(br); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("unmarshaling t.Seed: %w", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user