finish wiring, test passes!

This commit is contained in:
whyrusleeping 2019-07-12 14:36:49 -07:00
parent 9747ed3bef
commit c5e9a8a550
2 changed files with 18 additions and 3 deletions

View File

@ -10,6 +10,8 @@ import (
func init() {
cbor.RegisterCborType(StorageMarketState{})
cbor.RegisterCborType(CreateStorageMinerParams{})
cbor.RegisterCborType(struct{}{})
}
type StorageMarketActor struct{}
@ -53,7 +55,16 @@ func (sma StorageMarketActor) CreateStorageMiner(act *types.Actor, vmctx types.V
smcp.SectorSize = params.SectorSize
smcp.PeerID = params.PeerID
encoded, err := cbor.DumpObject(smcp)
encsmcp, err := cbor.DumpObject(smcp)
if err != nil {
return InvokeRet{}, err
}
var ep ExecParams
ep.Code = StorageMinerCodeCid
ep.Params = encsmcp
encoded, err := cbor.DumpObject(ep)
if err != nil {
return InvokeRet{}, err
}

View File

@ -121,7 +121,11 @@ func TestStorageMarketActorCreateMiner(t *testing.T) {
}
////// END BOILERPLATE //////////
params := &StorageMinerConstructorParams{}
params := &StorageMinerConstructorParams{
Worker: maddr,
SectorSize: types.NewInt(1024),
PeerID: "fakepeerid",
}
enc, err := cbor.DumpObject(params)
if err != nil {
t.Fatal(err)
@ -143,7 +147,7 @@ func TestStorageMarketActorCreateMiner(t *testing.T) {
}
if ret.ExitCode != 0 {
t.Fatal("invocation failed")
t.Fatal("invocation failed: ", ret.ExitCode)
}
outaddr, err := address.NewFromBytes(ret.Return)