self review, cleanup

This commit is contained in:
whyrusleeping 2019-09-10 17:13:46 -07:00
parent a47969c76b
commit fe2885382c
7 changed files with 5 additions and 18 deletions

View File

@ -116,12 +116,6 @@ func (ia InitActor) Exec(act *types.Actor, vmctx types.VMContext, p *ExecParams)
Head: EmptyCBOR, Head: EmptyCBOR,
Nonce: 0, Nonce: 0,
} }
/*
_, err = vmctx.Storage().Put(struct{}{})
if err != nil {
return nil, err
}
*/
// The call to the actors constructor will set up the initial state // The call to the actors constructor will set up the initial state
// from the given parameters, setting `actor.Head` to a new value when successful. // from the given parameters, setting `actor.Head` to a new value when successful.
@ -183,8 +177,6 @@ func (ias *InitActorState) AddActor(cst *hamt.CborIpldStore, addr address.Addres
nid := ias.NextID nid := ias.NextID
ias.NextID++ ias.NextID++
fmt.Println("ADD ACTOR: ", addr.String())
amap, err := hamt.LoadNode(context.TODO(), cst, ias.AddressMap) amap, err := hamt.LoadNode(context.TODO(), cst, ias.AddressMap)
if err != nil { if err != nil {
return address.Undef, err return address.Undef, err

View File

@ -113,7 +113,6 @@ func (pca PaymentChannelActor) UpdateChannelState(act *types.Actor, vmctx types.
} }
if err := vmctx.VerifySignature(sv.Signature, self.From, vb); err != nil { if err := vmctx.VerifySignature(sv.Signature, self.From, vb); err != nil {
fmt.Printf("bad bits: %x", vb)
return nil, err return nil, err
} }

View File

@ -2,7 +2,6 @@ package actors_test
import ( import (
"context" "context"
"fmt"
"testing" "testing"
"github.com/filecoin-project/go-lotus/chain/actors" "github.com/filecoin-project/go-lotus/chain/actors"
@ -37,7 +36,6 @@ func signVoucher(t *testing.T, w *wallet.Wallet, addr address.Address, sv *types
t.Fatal(err) t.Fatal(err)
} }
fmt.Printf("SIGNING: %x\n", vb)
sv.Signature = sig sv.Signature = sig
} }

View File

@ -198,12 +198,12 @@ func (sma StorageMarketActor) IsMiner(act *types.Actor, vmctx types.VMContext, p
} }
func MinerSetHas(ctx context.Context, vmctx types.VMContext, rcid cid.Cid, maddr address.Address) (bool, aerrors.ActorError) { func MinerSetHas(ctx context.Context, vmctx types.VMContext, rcid cid.Cid, maddr address.Address) (bool, aerrors.ActorError) {
nd, err := hamt.LoadNode(context.TODO(), vmctx.Ipld(), rcid) nd, err := hamt.LoadNode(ctx, vmctx.Ipld(), rcid)
if err != nil { if err != nil {
return false, aerrors.Escalate(err, "failed to load miner set") return false, aerrors.Escalate(err, "failed to load miner set")
} }
err = nd.Find(context.TODO(), string(maddr.Bytes()), nil) err = nd.Find(ctx, string(maddr.Bytes()), nil)
switch err { switch err {
case hamt.ErrNotFound: case hamt.ErrNotFound:
return false, nil return false, nil

View File

@ -67,7 +67,8 @@ func (m mybs) Get(c cid.Cid) (block.Block, error) {
b, err := m.Blockstore.Get(c) b, err := m.Blockstore.Get(c)
if err != nil { if err != nil {
// change to error for stacktraces, don't commit with that pls // change to error for stacktraces, don't commit with that pls
//log.Warnf("Get failed: %s %s", c, err) // TODO: debug why we get so many not founds in tests
log.Warnf("Get failed: %s %s", c, err)
return nil, err return nil, err
} }
@ -119,7 +120,6 @@ func NewGenerator() (*ChainGen, error) {
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to generate receiver key: %w", err) return nil, xerrors.Errorf("failed to generate receiver key: %w", err)
} }
fmt.Println("RECEIVER KEY: ", receievers[r].String())
} }
minercfg := &GenMinerCfg{ minercfg := &GenMinerCfg{

View File

@ -256,7 +256,7 @@ func (tu *syncTestUtil) submitSourceBlocks(to int, h int, n int) {
*/ */
func TestSyncSimple(t *testing.T) { func TestSyncSimple(t *testing.T) {
H := 15 H := 50
tu := prepSyncTest(t, H) tu := prepSyncTest(t, H)
client := tu.addClientNode() client := tu.addClientNode()

View File

@ -74,7 +74,6 @@ func (vmc *VMContext) Put(i cbg.CBORMarshaler) (cid.Cid, aerrors.ActorError) {
if aerr := vmc.ChargeGas(0); aerr != nil { if aerr := vmc.ChargeGas(0); aerr != nil {
return cid.Undef, aerrors.Absorb(err, outOfGasErrCode, "Put out of gas") return cid.Undef, aerrors.Absorb(err, outOfGasErrCode, "Put out of gas")
} }
panic("no u")
return cid.Undef, aerrors.Escalate(err, fmt.Sprintf("putting object %T", i)) return cid.Undef, aerrors.Escalate(err, fmt.Sprintf("putting object %T", i))
} }
return c, nil return c, nil
@ -319,7 +318,6 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *VMContext,
toActor, err := st.GetActor(msg.To) toActor, err := st.GetActor(msg.To)
if err != nil { if err != nil {
if xerrors.Is(err, types.ErrActorNotFound) { if xerrors.Is(err, types.ErrActorNotFound) {
fmt.Println("actor not found on send: ", msg.To.String())
a, err := TryCreateAccountActor(st, msg.To) a, err := TryCreateAccountActor(st, msg.To)
if err != nil { if err != nil {
return nil, aerrors.Absorb(err, 1, "could not create account"), nil return nil, aerrors.Absorb(err, 1, "could not create account"), nil