self review, cleanup
This commit is contained in:
parent
74f68dc630
commit
bc7f86ef05
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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())
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user