From 7b93d9f514003dedd142dffdc3d7e93372853f44 Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Thu, 13 Jun 2019 11:34:32 -0700 Subject: [PATCH 1/2] remove initial fund for our genesis nodes --- node/node_genesis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/node_genesis.go b/node/node_genesis.go index 44ff96462..7457a202a 100644 --- a/node/node_genesis.go +++ b/node/node_genesis.go @@ -90,7 +90,7 @@ func (node *Node) SetupGenesisBlock(db ethdb.Database, shardID uint32) error { if shardID == 0 { // Accounts used by validator/nodes to stake and participate in the network. - AddNodeAddressesToGenesisAlloc(genesisAlloc) + // AddNodeAddressesToGenesisAlloc(genesisAlloc) } // TODO: add ShardID into chainconfig and change ChainID to NetworkID From 3bf797a0577937796cc04322776bd42180545dae Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Thu, 13 Jun 2019 12:12:21 -0700 Subject: [PATCH 2/2] Change mem stats freq and change confusing consensus log --- consensus/consensus_service.go | 2 +- consensus/consensus_v2.go | 8 ++++---- consensus/view_change.go | 6 +++--- internal/memprofiling/lib.go | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/consensus/consensus_service.go b/consensus/consensus_service.go index 0f12bb28e..3a62f4c9b 100644 --- a/consensus/consensus_service.go +++ b/consensus/consensus_service.go @@ -560,7 +560,7 @@ func (consensus *Consensus) checkViewID(msg *PbftMessage) error { consensus.ignoreViewIDCheck = false consensus.consensusTimeout[timeoutConsensus].Start() utils.GetLogger().Debug("viewID and leaderKey override", "viewID", consensus.viewID, "leaderKey", consensus.LeaderPubKey.SerializeToHexStr()[:20]) - utils.GetLogger().Debug("start consensus timeout", "viewID", consensus.viewID, "block", consensus.blockNum) + utils.GetLogger().Debug("Start consensus timer", "viewID", consensus.viewID, "block", consensus.blockNum) return nil } else if msg.ViewID > consensus.viewID { return consensus_engine.ErrViewIDNotMatch diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index 6f5e5888c..55c3186d4 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -572,9 +572,9 @@ func (consensus *Consensus) finalizeCommits() { if consensus.consensusTimeout[timeoutBootstrap].IsActive() { consensus.consensusTimeout[timeoutBootstrap].Stop() - consensus.getLogger().Debug("start consensus timeout; stop bootstrap timeout only once") + consensus.getLogger().Debug("start consensus timer; stop bootstrap timer only once") } else { - consensus.getLogger().Debug("start consensus timeout") + consensus.getLogger().Debug("start consensus timer") } consensus.consensusTimeout[timeoutConsensus].Start() @@ -665,9 +665,9 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) { if consensus.consensusTimeout[timeoutBootstrap].IsActive() { consensus.consensusTimeout[timeoutBootstrap].Stop() - consensus.getLogger().Debug("start consensus timeout; stop bootstrap timeout only once") + consensus.getLogger().Debug("start consensus timer; stop bootstrap timer only once") } else { - consensus.getLogger().Debug("start consensus timeout") + consensus.getLogger().Debug("start consensus timer") } consensus.consensusTimeout[timeoutConsensus].Start() return diff --git a/consensus/view_change.go b/consensus/view_change.go index 4fe38c698..4fc07bd74 100644 --- a/consensus/view_change.go +++ b/consensus/view_change.go @@ -179,7 +179,7 @@ func (consensus *Consensus) startViewChange(viewID uint32) { consensus.consensusTimeout[timeoutViewChange].SetDuration(duration) consensus.consensusTimeout[timeoutViewChange].Start() - consensus.getLogger().Debug("start view change timeout", "viewChangingID", consensus.mode.ViewID()) + consensus.getLogger().Debug("start view change timer", "viewChangingID", consensus.mode.ViewID()) } func (consensus *Consensus) onViewChange(msg *msg_pb.Message) { @@ -366,7 +366,7 @@ func (consensus *Consensus) onViewChange(msg *msg_pb.Message) { consensus.ResetViewChangeState() consensus.consensusTimeout[timeoutViewChange].Stop() consensus.consensusTimeout[timeoutConsensus].Start() - consensus.getLogger().Debug("new leader start consensus timeout and stop view change timeout", "viewChangingID", consensus.mode.ViewID()) + consensus.getLogger().Debug("new leader start consensus timer and stop view change timer", "viewChangingID", consensus.mode.ViewID()) consensus.getLogger().Debug("I am the new leader", "myKey", consensus.PubKey.SerializeToHexStr(), "viewID", consensus.viewID, "block", consensus.blockNum) } consensus.getLogger().Debug("onViewChange", "numSigs", len(consensus.viewIDSigs), "needed", consensus.Quorum()) @@ -485,7 +485,7 @@ func (consensus *Consensus) onNewView(msg *msg_pb.Message) { consensus.getLogger().Info("onNewView === announce") } consensus.getLogger().Debug("new leader changed", "newLeaderKey", consensus.LeaderPubKey.SerializeToHexStr()) - consensus.getLogger().Debug("validator start consensus timeout and stop view change timeout") + consensus.getLogger().Debug("validator start consensus timer and stop view change timer") consensus.consensusTimeout[timeoutConsensus].Start() consensus.consensusTimeout[timeoutViewChange].Stop() } diff --git a/internal/memprofiling/lib.go b/internal/memprofiling/lib.go index 8c7226fe7..926ea0b1a 100644 --- a/internal/memprofiling/lib.go +++ b/internal/memprofiling/lib.go @@ -22,7 +22,7 @@ const ( // Run garbage collector every 30 minutes. gcTime = 10 * time.Minute // Print out memstat every memStatTime. - memStatTime = 30 * time.Second + memStatTime = 300 * time.Second ) // MemProfiling is the struct to watch objects for memprofiling. @@ -100,9 +100,9 @@ func MaybeCallGCPeriodically() { for { select { case <-time.After(gcTime): - PrintMemUsage("mem stats before GC") + PrintMemUsage("Memory stats before GC") runtime.GC() - PrintMemUsage("mem stats after GC") + PrintMemUsage("Memory stats after GC") } } }() @@ -110,7 +110,7 @@ func MaybeCallGCPeriodically() { for { select { case <-time.After(memStatTime): - PrintMemUsage("mem stats") + PrintMemUsage("Memory stats") } } }()