From 4e6839b5ef839c867c3d26b23831edd708dddd8d Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 14 Apr 2020 15:13:52 -0700 Subject: [PATCH] some small cleanup --- chain/beacon/drand/drand.go | 9 +-------- chain/gen/gen.go | 4 ---- chain/store/store.go | 1 - node/modules/storageminer.go | 4 ---- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/chain/beacon/drand/drand.go b/chain/beacon/drand/drand.go index f20d36a70..7d6c6746d 100644 --- a/chain/beacon/drand/drand.go +++ b/chain/beacon/drand/drand.go @@ -2,7 +2,6 @@ package drand import ( "context" - "fmt" "sync" "time" @@ -118,7 +117,6 @@ func (db *DrandBeacon) handleStreamingUpdates() { } for e := range ch { - fmt.Println("Entry: ", e.Round, e.Signature) db.cacheValue(types.BeaconEntry{ Round: e.Round, Data: e.Signature, @@ -130,7 +128,7 @@ func (db *DrandBeacon) handleStreamingUpdates() { } func (db *DrandBeacon) Entry(ctx context.Context, round uint64) <-chan beacon.Response { - fmt.Println("requesting drand entry: ", round) + // check cache, it it if there, otherwise query the endpoint cres := db.getCachedValue(round) if cres != nil { out := make(chan beacon.Response, 1) @@ -142,7 +140,6 @@ func (db *DrandBeacon) Entry(ctx context.Context, round uint64) <-chan beacon.Re out := make(chan beacon.Response, 1) go func() { - // check cache, it it if there, otherwise query the endpoint resp, err := db.client.PublicRand(ctx, db.peers[0], &dproto.PublicRandRequest{Round: round}) var br beacon.Response @@ -196,13 +193,9 @@ func (db *DrandBeacon) VerifyEntry(curr types.BeaconEntry, prev types.BeaconEntr } func (db *DrandBeacon) MaxBeaconRoundForEpoch(filEpoch abi.ChainEpoch, prevEntry types.BeaconEntry) uint64 { - fmt.Println("MAX BEACON ROUND FOR EPOCH: ", filEpoch) - fmt.Println("filecoin genesis time: ", db.filGenTime) - fmt.Println("drand genesis time: ", db.drandGenTime) // TODO: sometimes the genesis time for filecoin is zero and this goes negative latestTs := ((uint64(filEpoch) * db.filRoundTime) + db.filGenTime) - db.filRoundTime dround := (latestTs - db.drandGenTime) / uint64(db.interval.Seconds()) - fmt.Println("max beacon round will be: ", dround) return dround } diff --git a/chain/gen/gen.go b/chain/gen/gen.go index aa1c1956c..05083f3d7 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -215,10 +215,6 @@ func NewGenerator() (*ChainGen, error) { miners := []address.Address{maddr1, maddr2} beac := beacon.NewMockBeacon(time.Second) - //beac, err := drand.NewDrandBeacon(tpl.Timestamp, build.BlockDelay) - //if err != nil { - //return nil, xerrors.Errorf("could not create beacon: %w", err) - //} gen := &ChainGen{ bs: bs, diff --git a/chain/store/store.go b/chain/store/store.go index 6d8bf4ce9..d076d2599 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -893,7 +893,6 @@ func (cs *ChainStore) TryFillTipSet(ts *types.TipSet) (*FullTipSet, error) { } func DrawRandomness(rbase []byte, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) { - //log.Desugar().WithOptions(zap.AddCallerSkip(2)).Sugar().Warnw("DrawRandomness", "base", rbase, "dsep", pers, "round", round, "entropy", entropy) h := blake2b.New256() if err := binary.Write(h, binary.BigEndian, int64(pers)); err != nil { return nil, xerrors.Errorf("deriving randomness: %w", err) diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index f69e58a9b..a50dbfeb2 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -2,7 +2,6 @@ package modules import ( "context" - "fmt" "net/http" "reflect" @@ -384,8 +383,5 @@ func MinerRandomBeacon(api lapi.FullNode) (beacon.RandomBeacon, error) { return nil, err } - fmt.Println("Making miner random beacon: ", gents.Blocks()[0].Timestamp) - - //return beacon.NewMockBeacon(build.BlockDelay * time.Second) return drand.NewDrandBeacon(gents.Blocks()[0].Timestamp, build.BlockDelay) }