diff --git a/chain/blocksync/cbor_gen.go b/chain/blocksync/cbor_gen.go index 1e569a3ae..9e76e8f64 100644 --- a/chain/blocksync/cbor_gen.go +++ b/chain/blocksync/cbor_gen.go @@ -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" ) diff --git a/chain/stmgr/forks_test.go b/chain/stmgr/forks_test.go index 13dfc0e80..d4a1628fa 100644 --- a/chain/stmgr/forks_test.go +++ b/chain/stmgr/forks_test.go @@ -8,6 +8,10 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/specs-actors/actors/abi" + "github.com/filecoin-project/specs-actors/actors/builtin" + init_ "github.com/filecoin-project/specs-actors/actors/builtin/init" + "github.com/filecoin-project/specs-actors/actors/runtime" + "github.com/filecoin-project/specs-actors/actors/util/adt" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors" @@ -69,10 +73,14 @@ func (ta *testActor) Constructor(act *types.Actor, vmctx types.VMContext, params if err != nil { return nil, err } + empty, err := vmctx.Storage().Put(&adt.EmptyValue{}) + if err != nil { + return nil, err + } fmt.Println("NEW ACTOR ADDRESS IS: ", vmctx.Message().To.String()) - return nil, vmctx.Storage().Commit(actors.EmptyCBOR, c) + return nil, vmctx.Storage().Commit(empty, c) } func (ta *testActor) TestMethod(act *types.Actor, vmctx types.VMContext, params *struct{}) ([]byte, aerrors.ActorError) { @@ -114,8 +122,6 @@ func TestForkHeightTriggers(t *testing.T) { t.Fatal(err) } - actors.BuiltInActors[actcid] = true - // predicting the address here... may break if other assumptions change taddr, err := address.NewIDAddress(1000) if err != nil { @@ -156,7 +162,7 @@ func TestForkHeightTriggers(t *testing.T) { } inv.Register(actcid, &testActor{}, &testActorState{}) - sm.SetVMConstructor(func(c cid.Cid, h abi.ChainEpoch, r vm.Rand, a address.Address, b blockstore.Blockstore, s *types.VMSyscalls) (*vm.VM, error) { + sm.SetVMConstructor(func(c cid.Cid, h abi.ChainEpoch, r vm.Rand, a address.Address, b blockstore.Blockstore, s runtime.Syscalls) (*vm.VM, error) { nvm, err := vm.NewVM(c, h, r, a, b, s) if err != nil { return nil, err @@ -169,7 +175,7 @@ func TestForkHeightTriggers(t *testing.T) { var msgs []*types.SignedMessage - enc, err := actors.SerializeParams(&actors.ExecParams{Code: actcid}) + enc, err := actors.SerializeParams(&init_.ExecParams{CodeCID: actcid}) if err != nil { t.Fatal(err) } @@ -177,7 +183,7 @@ func TestForkHeightTriggers(t *testing.T) { m := &types.Message{ From: cg.Banker(), To: actors.InitAddress, - Method: actors.IAMethods.Exec, + Method: builtin.MethodsInit.Exec, Params: enc, GasLimit: types.NewInt(10000), GasPrice: types.NewInt(0), diff --git a/chain/types/cbor_gen.go b/chain/types/cbor_gen.go index 771cd4e3c..1bf5937fa 100644 --- a/chain/types/cbor_gen.go +++ b/chain/types/cbor_gen.go @@ -9,7 +9,7 @@ import ( "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/crypto" - "github.com/ipfs/go-cid" + cid "github.com/ipfs/go-cid" cbg "github.com/whyrusleeping/cbor-gen" xerrors "golang.org/x/xerrors" ) diff --git a/chain/types/mock/chain.go b/chain/types/mock/chain.go index dc75b15d2..f4780bbb3 100644 --- a/chain/types/mock/chain.go +++ b/chain/types/mock/chain.go @@ -5,10 +5,12 @@ import ( "fmt" "github.com/filecoin-project/go-address" + "github.com/filecoin-project/specs-actors/actors/abi" + "github.com/filecoin-project/specs-actors/actors/crypto" + "github.com/ipfs/go-cid" + "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/wallet" - "github.com/filecoin-project/specs-actors/actors/abi" - "github.com/ipfs/go-cid" ) func Address(i uint64) address.Address { @@ -66,12 +68,12 @@ func MkBlock(parents *types.TipSet, weightInc uint64, ticketNonce uint64) *types }, Parents: pcids, ParentMessageReceipts: c, - BLSAggregate: types.Signature{Type: types.KTBLS, Data: []byte("boo! im a signature")}, + BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS, Data: []byte("boo! im a signature")}, ParentWeight: weight, Messages: c, Height: height, ParentStateRoot: c, - BlockSig: &types.Signature{Type: types.KTBLS, Data: []byte("boo! im a signature")}, + BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS, Data: []byte("boo! im a signature")}, } } diff --git a/lib/sigs/sigs.go b/lib/sigs/sigs.go index 5f467b231..5b304542d 100644 --- a/lib/sigs/sigs.go +++ b/lib/sigs/sigs.go @@ -17,7 +17,7 @@ import ( func Sign(sigType crypto.SigType, privkey []byte, msg []byte) (*crypto.Signature, error) { sv, ok := sigs[sigType] if !ok { - return nil, fmt.Errorf("cannot sign message with signature of unsupported type: %s", sigType) + return nil, fmt.Errorf("cannot sign message with signature of unsupported type: %v", sigType) } sb, err := sv.Sign(privkey, msg) @@ -42,7 +42,7 @@ func Verify(sig *crypto.Signature, addr address.Address, msg []byte) error { sv, ok := sigs[sig.Type] if !ok { - return fmt.Errorf("cannot verify signature of unsupported type: %s", sig.Type) + return fmt.Errorf("cannot verify signature of unsupported type: %v", sig.Type) } return sv.Verify(sig.Data, addr, msg) @@ -52,7 +52,7 @@ func Verify(sig *crypto.Signature, addr address.Address, msg []byte) error { func Generate(sigType crypto.SigType) ([]byte, error) { sv, ok := sigs[sigType] if !ok { - return nil, fmt.Errorf("cannot generate private key of unsupported type: %s", sigType) + return nil, fmt.Errorf("cannot generate private key of unsupported type: %v", sigType) } return sv.GenPrivate() @@ -62,7 +62,7 @@ func Generate(sigType crypto.SigType) ([]byte, error) { func ToPublic(sigType crypto.SigType, pk []byte) ([]byte, error) { sv, ok := sigs[sigType] if !ok { - return nil, fmt.Errorf("cannot generate public key of unsupported type: %s", sigType) + return nil, fmt.Errorf("cannot generate public key of unsupported type: %v", sigType) } return sv.ToPublic(pk) diff --git a/storage/sbmock/sbmock.go b/storage/sbmock/sbmock.go index 499a60fd6..ae74cc887 100644 --- a/storage/sbmock/sbmock.go +++ b/storage/sbmock/sbmock.go @@ -138,13 +138,13 @@ func (sb *SBMock) SealPreCommit(ctx context.Context, sid abi.SectorNumber, ticke ss.lk.Lock() defer ss.lk.Unlock() - ussize := abi.UnpaddedPieceSize(sb.sectorSize) + ussize := abi.PaddedPieceSize(sb.sectorSize).Unpadded() // TODO: verify pieces in sinfo.pieces match passed in pieces var sum abi.UnpaddedPieceSize for _, p := range pieces { - sum += abi.UnpaddedPieceSize(p.Size) + sum += p.Size } if sum != ussize { @@ -294,7 +294,7 @@ func (sb *SBMock) ReadPieceFromSealedSector(ctx context.Context, sectorID abi.Se } func (sb *SBMock) StageFakeData() (abi.SectorNumber, []sectorbuilder.PublicPieceInfo, error) { - usize := abi.UnpaddedPieceSize(sb.sectorSize) + usize := abi.PaddedPieceSize(sb.sectorSize).Unpadded() sid, err := sb.AcquireSectorNumber() if err != nil { return 0, nil, err @@ -357,7 +357,7 @@ func (m mockVerif) GenerateDataCommitment(ssize abi.PaddedPieceSize, pieces []ff if len(pieces) != 1 { panic("todo") } - if pieces[0].Size != abi.UnpaddedPieceSize(ssize) { + if pieces[0].Size != ssize.Unpadded() { panic("todo") } return pieces[0].CommP, nil