self review, cleanup

This commit is contained in:
whyrusleeping 2019-09-08 15:54:47 -07:00
parent 74f68dc630
commit bc7f86ef05
6 changed files with 1 additions and 26 deletions

View File

@ -32,7 +32,7 @@ import (
var log = logging.Logger("gen")
const msgsPerBlock = 2
const msgsPerBlock = 20
type ChainGen struct {
accounts []address.Address
@ -128,14 +128,6 @@ func NewGenerator() (*ChainGen, error) {
PeerIDs: []peer.ID{"peerID1", "peerID2"},
}
/*
minercfg := &GenMinerCfg{
Workers: []address.Address{worker},
Owners: []address.Address{worker},
PeerIDs: []peer.ID{"peerID1"},
}
*/
genb, err := MakeGenesisBlock(bs, map[address.Address]types.BigInt{
worker: types.NewInt(50000),
banker: types.NewInt(90000000),
@ -286,7 +278,6 @@ func (cg *ChainGen) NextTipSet() (*MinedTipSet, error) {
}
cg.curTipset = store.NewFullTipSet(blks)
fmt.Printf("Mined tipset %s (%d) on top of %s (%d)\n", cg.curTipset.Cids(), cg.curTipset.TipSet().Height(), base.Cids(), base.Height())
return &MinedTipSet{
TipSet: cg.curTipset,
@ -298,7 +289,6 @@ func (cg *ChainGen) makeBlock(parents *types.TipSet, m address.Address, eproof t
ts := parents.MinTimestamp() + (uint64(len(tickets)) * build.BlockDelay)
fmt.Println("Make block: ", parents.Height(), len(tickets))
fblk, err := MinerCreateBlock(context.TODO(), cg.sm, cg.w, m, parents, tickets, eproof, msgs, ts)
if err != nil {
return nil, err

View File

@ -1,7 +1,6 @@
package gen
import (
"fmt"
"testing"
)
@ -15,7 +14,6 @@ func testGeneration(t testing.TB, n int, msgs int) {
var height int
for i := 0; i < n; i++ {
fmt.Println("LOOP: ", i)
mts, err := g.NextTipSet()
if err != nil {
t.Fatalf("error at H:%d, %s", i, err)

View File

@ -2,7 +2,6 @@ package gen
import (
"context"
"fmt"
bls "github.com/filecoin-project/go-bls-sigs"
cid "github.com/ipfs/go-cid"
@ -25,7 +24,6 @@ func MinerCreateBlock(ctx context.Context, sm *stmgr.StateManager, w *wallet.Wal
return nil, errors.Wrap(err, "failed to load tipset state")
}
fmt.Println("HEIGHT CALC: ", parents.Height(), len(tickets))
height := parents.Height() + uint64(len(tickets))
vmi, err := vm.NewVM(st, height, miner, sm.ChainStore())

View File

@ -89,7 +89,6 @@ func (sm *StateManager) computeTipSetState(cids []cid.Cid) (cid.Cid, error) {
bms, sms, err := sm.cs.MessagesForBlock(b)
if err != nil {
panic("stop a sec: " + err.Error())
return cid.Undef, xerrors.Errorf("failed to get messages for block: %w", err)
}

View File

@ -46,14 +46,6 @@ func (ts *TipSet) UnmarshalJSON(b []byte) error {
}
func NewTipSet(blks []*BlockHeader) (*TipSet, error) {
/*
sort.Slice(blks, func(i, j int) bool {
a := blks[i].LastTicket()
b := blks[j].LastTicket()
return bytes.Compare(a.VDFResult, b.VDFResult) < 0
})
*/
var ts TipSet
ts.cids = []cid.Cid{blks[0].Cid()}
ts.blks = blks

View File

@ -41,8 +41,6 @@ func (inv *invoker) Invoke(act *types.Actor, vmctx types.VMContext, method uint6
code, ok := inv.builtInCode[act.Code]
if !ok {
fmt.Println("bad code? ", act.Code)
fmt.Println("miner actor code cid: ", actors.StorageMinerCodeCid)
return nil, aerrors.Newf(255, "no code for actor %s", act.Code)
}
if method >= uint64(len(code)) || code[method] == nil {