mirror of https://github.com/poanetwork/gecko.git
improve logging and lowercase log messages
This commit is contained in:
parent
3b2fdb3acd
commit
14480a24dc
|
@ -50,7 +50,7 @@ type Transitive struct {
|
|||
|
||||
// Initialize implements the Engine interface
|
||||
func (t *Transitive) Initialize(config Config) error {
|
||||
config.Context.Log.Info("Initializing Avalanche consensus")
|
||||
config.Context.Log.Info("Initializing consensus engine")
|
||||
|
||||
t.Config = config
|
||||
t.metrics.Initialize(config.Context.Log, config.Params.Namespace, config.Params.Metrics)
|
||||
|
@ -71,13 +71,13 @@ func (t *Transitive) finishBootstrapping() error {
|
|||
if vtx, err := t.Config.State.GetVertex(vtxID); err == nil {
|
||||
frontier = append(frontier, vtx)
|
||||
} else {
|
||||
t.Config.Context.Log.Error("Vertex %s failed to be loaded from the frontier with %s", vtxID, err)
|
||||
t.Config.Context.Log.Error("vertex %s failed to be loaded from the frontier with %s", vtxID, err)
|
||||
}
|
||||
}
|
||||
t.Consensus.Initialize(t.Config.Context, t.Params, frontier)
|
||||
t.bootstrapped = true
|
||||
|
||||
t.Config.Context.Log.Info("Bootstrapping finished with %d vertices in the accepted frontier", len(frontier))
|
||||
t.Config.Context.Log.Info("bootstrapping finished with %d vertices in the accepted frontier", len(frontier))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ func (t *Transitive) finishBootstrapping() error {
|
|||
func (t *Transitive) Gossip() error {
|
||||
edge := t.Config.State.Edge()
|
||||
if len(edge) == 0 {
|
||||
t.Config.Context.Log.Debug("Dropping gossip request as no vertices have been accepted")
|
||||
t.Config.Context.Log.Verbo("dropping gossip request as no vertices have been accepted")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -93,18 +93,18 @@ func (t *Transitive) Gossip() error {
|
|||
vtxID := edge[sampler.Sample()]
|
||||
vtx, err := t.Config.State.GetVertex(vtxID)
|
||||
if err != nil {
|
||||
t.Config.Context.Log.Warn("Dropping gossip request as %s couldn't be loaded due to %s", vtxID, err)
|
||||
t.Config.Context.Log.Warn("dropping gossip request as %s couldn't be loaded due to: %s", vtxID, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
t.Config.Context.Log.Debug("Gossiping %s as accepted to the network", vtxID)
|
||||
t.Config.Context.Log.Verbo("gossiping %s as accepted to the network", vtxID)
|
||||
t.Config.Sender.Gossip(vtxID, vtx.Bytes())
|
||||
return nil
|
||||
}
|
||||
|
||||
// Shutdown implements the Engine interface
|
||||
func (t *Transitive) Shutdown() error {
|
||||
t.Config.Context.Log.Info("Shutting down Avalanche consensus")
|
||||
t.Config.Context.Log.Info("shutting down consensus engine")
|
||||
return t.Config.VM.Shutdown()
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ func (t *Transitive) Get(vdr ids.ShortID, requestID uint32, vtxID ids.ID) error
|
|||
// GetAncestors implements the Engine interface
|
||||
func (t *Transitive) GetAncestors(vdr ids.ShortID, requestID uint32, vtxID ids.ID) error {
|
||||
startTime := time.Now()
|
||||
t.Config.Context.Log.Verbo("In GetAncestors. Validator: %s, request ID: %d, vtxID: %s", vdr, requestID, vtxID)
|
||||
t.Config.Context.Log.Verbo("GetAncestors(%s, %d, %s) called", vdr, requestID, vtxID)
|
||||
vertex, err := t.Config.State.GetVertex(vtxID)
|
||||
if err != nil || vertex.Status() == choices.Unknown {
|
||||
t.Config.Context.Log.Verbo("dropping getAncestors")
|
||||
|
@ -164,18 +164,17 @@ func (t *Transitive) GetAncestors(vdr ids.ShortID, requestID uint32, vtxID ids.I
|
|||
|
||||
// Put implements the Engine interface
|
||||
func (t *Transitive) Put(vdr ids.ShortID, requestID uint32, vtxID ids.ID, vtxBytes []byte) error {
|
||||
t.Config.Context.Log.Verbo("Put called for vertexID %s", vtxID)
|
||||
t.Config.Context.Log.Verbo("Put(%s, %d, %s) called", vdr, requestID, vtxID)
|
||||
|
||||
if !t.bootstrapped { // Bootstrapping unfinished --> didn't call Get --> this message is invalid
|
||||
t.Config.Context.Log.Debug("Dropping Put for %s due to bootstrapping", vtxID)
|
||||
t.Config.Context.Log.Debug("dropping Put(%s, %d, %s) due to bootstrapping", vdr, requestID, vtxID)
|
||||
return nil
|
||||
}
|
||||
|
||||
vtx, err := t.Config.State.ParseVertex(vtxBytes)
|
||||
if err != nil {
|
||||
t.Config.Context.Log.Debug("ParseVertex failed due to %s for block:\n%s",
|
||||
err,
|
||||
formatting.DumpBytes{Bytes: vtxBytes})
|
||||
t.Config.Context.Log.Debug("failed to parse vertex %s due to: %s", vtxID, err)
|
||||
t.Config.Context.Log.Verbo("vertex:\n%s", formatting.DumpBytes{Bytes: vtxBytes})
|
||||
return t.GetFailed(vdr, requestID)
|
||||
}
|
||||
_, err = t.insertFrom(vdr, vtx)
|
||||
|
@ -185,7 +184,7 @@ func (t *Transitive) Put(vdr ids.ShortID, requestID uint32, vtxID ids.ID, vtxByt
|
|||
// GetFailed implements the Engine interface
|
||||
func (t *Transitive) GetFailed(vdr ids.ShortID, requestID uint32) error {
|
||||
if !t.bootstrapped { // Bootstrapping unfinished --> didn't call Get --> this message is invalid
|
||||
t.Config.Context.Log.Debug("Dropping GetFailed(%s, %d) due to bootstrapping", vdr, requestID)
|
||||
t.Config.Context.Log.Debug("dropping GetFailed(%s, %d) due to bootstrapping", vdr, requestID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -213,7 +212,7 @@ func (t *Transitive) GetFailed(vdr ids.ShortID, requestID uint32) error {
|
|||
// PullQuery implements the Engine interface
|
||||
func (t *Transitive) PullQuery(vdr ids.ShortID, requestID uint32, vtxID ids.ID) error {
|
||||
if !t.bootstrapped {
|
||||
t.Config.Context.Log.Debug("Dropping PullQuery for %s due to bootstrapping", vtxID)
|
||||
t.Config.Context.Log.Debug("dropping PullQuery(%s, %d, %s) due to bootstrapping", vdr, requestID, vtxID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -241,15 +240,14 @@ func (t *Transitive) PullQuery(vdr ids.ShortID, requestID uint32, vtxID ids.ID)
|
|||
// PushQuery implements the Engine interface
|
||||
func (t *Transitive) PushQuery(vdr ids.ShortID, requestID uint32, vtxID ids.ID, vtxBytes []byte) error {
|
||||
if !t.bootstrapped {
|
||||
t.Config.Context.Log.Debug("Dropping PushQuery for %s due to bootstrapping", vtxID)
|
||||
t.Config.Context.Log.Debug("dropping PushQuery(%s, %d, %s) due to bootstrapping", vdr, requestID, vtxID)
|
||||
return nil
|
||||
}
|
||||
|
||||
vtx, err := t.Config.State.ParseVertex(vtxBytes)
|
||||
if err != nil {
|
||||
t.Config.Context.Log.Warn("ParseVertex failed due to %s for block:\n%s",
|
||||
err,
|
||||
formatting.DumpBytes{Bytes: vtxBytes})
|
||||
t.Config.Context.Log.Debug("failed to parse vertex %s due to: %s", vtxID, err)
|
||||
t.Config.Context.Log.Verbo("vertex:\n%s", formatting.DumpBytes{Bytes: vtxBytes})
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -263,7 +261,7 @@ func (t *Transitive) PushQuery(vdr ids.ShortID, requestID uint32, vtxID ids.ID,
|
|||
// Chits implements the Engine interface
|
||||
func (t *Transitive) Chits(vdr ids.ShortID, requestID uint32, votes ids.Set) error {
|
||||
if !t.bootstrapped {
|
||||
t.Config.Context.Log.Debug("Dropping Chits due to bootstrapping")
|
||||
t.Config.Context.Log.Debug("dropping Chits(%s, %d) due to bootstrapping", vdr, requestID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -294,7 +292,7 @@ func (t *Transitive) QueryFailed(vdr ids.ShortID, requestID uint32) error {
|
|||
// Notify implements the Engine interface
|
||||
func (t *Transitive) Notify(msg common.Message) error {
|
||||
if !t.bootstrapped {
|
||||
t.Config.Context.Log.Warn("Dropping Notify due to bootstrapping")
|
||||
t.Config.Context.Log.Debug("dropping Notify due to bootstrapping")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -398,7 +396,7 @@ func (t *Transitive) insert(vtx avalanche.Vertex) error {
|
|||
}
|
||||
}
|
||||
|
||||
t.Config.Context.Log.Verbo("Vertex: %s is blocking on %d vertices and %d transactions", vtxID, i.vtxDeps.Len(), i.txDeps.Len())
|
||||
t.Config.Context.Log.Verbo("vertex %s is blocking on %d vertices and %d transactions", vtxID, i.vtxDeps.Len(), i.txDeps.Len())
|
||||
|
||||
t.vtxBlocked.Register(&vtxIssuer{i: i})
|
||||
t.txBlocked.Register(&txIssuer{i: i})
|
||||
|
@ -456,7 +454,7 @@ func (t *Transitive) issueRepoll() {
|
|||
preferredIDs := t.Consensus.Preferences().List()
|
||||
numPreferredIDs := len(preferredIDs)
|
||||
if numPreferredIDs == 0 {
|
||||
t.Config.Context.Log.Error("Re-query attempt was dropped due to no pending vertices")
|
||||
t.Config.Context.Log.Error("re-query attempt was dropped due to no pending vertices")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -475,12 +473,12 @@ func (t *Transitive) issueRepoll() {
|
|||
if numVdrs := len(vdrs); numVdrs == p.K && t.polls.Add(t.RequestID, vdrSet.Len()) {
|
||||
t.Config.Sender.PullQuery(vdrSet, t.RequestID, vtxID)
|
||||
} else if numVdrs < p.K {
|
||||
t.Config.Context.Log.Error("Re-query for %s was dropped due to an insufficient number of validators", vtxID)
|
||||
t.Config.Context.Log.Error("re-query for %s was dropped due to an insufficient number of validators", vtxID)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Transitive) issueBatch(txs []snowstorm.Tx) error {
|
||||
t.Config.Context.Log.Verbo("Batching %d transactions into a new vertex", len(txs))
|
||||
t.Config.Context.Log.Verbo("batching %d transactions into a new vertex", len(txs))
|
||||
|
||||
virtuousIDs := t.Consensus.Virtuous().List()
|
||||
sampler := random.Uniform{N: len(virtuousIDs)}
|
||||
|
@ -491,7 +489,7 @@ func (t *Transitive) issueBatch(txs []snowstorm.Tx) error {
|
|||
|
||||
vtx, err := t.Config.State.BuildVertex(parentIDs, txs)
|
||||
if err != nil {
|
||||
t.Config.Context.Log.Warn("Error building new vertex with %d parents and %d transactions", len(parentIDs), len(txs))
|
||||
t.Config.Context.Log.Warn("error building new vertex with %d parents and %d transactions", len(parentIDs), len(txs))
|
||||
return nil
|
||||
}
|
||||
return t.insert(vtx)
|
||||
|
@ -499,7 +497,7 @@ func (t *Transitive) issueBatch(txs []snowstorm.Tx) error {
|
|||
|
||||
func (t *Transitive) sendRequest(vdr ids.ShortID, vtxID ids.ID) {
|
||||
if t.vtxReqs.Contains(vtxID) {
|
||||
t.Config.Context.Log.Debug("Not requesting a vertex because we have recently sent a request")
|
||||
t.Config.Context.Log.Debug("not requesting a vertex because we have recently sent a request")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ type Transitive struct {
|
|||
|
||||
// Initialize implements the Engine interface
|
||||
func (t *Transitive) Initialize(config Config) error {
|
||||
config.Context.Log.Info("Initializing Snowman consensus")
|
||||
config.Context.Log.Info("initializing consensus engine")
|
||||
|
||||
t.Config = config
|
||||
t.metrics.Initialize(
|
||||
|
@ -87,7 +87,7 @@ func (t *Transitive) finishBootstrapping() error {
|
|||
// oracle block
|
||||
tail, err := t.Config.VM.GetBlock(tailID)
|
||||
if err != nil {
|
||||
t.Config.Context.Log.Error("Failed to get last accepted block due to: %s", err)
|
||||
t.Config.Context.Log.Error("failed to get last accepted block due to: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ func (t *Transitive) finishBootstrapping() error {
|
|||
t.Config.VM.SetPreference(tailID)
|
||||
}
|
||||
|
||||
t.Config.Context.Log.Info("Bootstrapping finished with %s as the last accepted block", tailID)
|
||||
t.Config.Context.Log.Info("bootstrapping finished with %s as the last accepted block", tailID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -114,18 +114,18 @@ func (t *Transitive) Gossip() error {
|
|||
blkID := t.Config.VM.LastAccepted()
|
||||
blk, err := t.Config.VM.GetBlock(blkID)
|
||||
if err != nil {
|
||||
t.Config.Context.Log.Warn("Dropping gossip request as %s couldn't be loaded due to %s", blkID, err)
|
||||
t.Config.Context.Log.Warn("dropping gossip request as %s couldn't be loaded due to %s", blkID, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
t.Config.Context.Log.Debug("Gossiping %s as accepted to the network", blkID)
|
||||
t.Config.Context.Log.Debug("gossiping %s as accepted to the network", blkID)
|
||||
t.Config.Sender.Gossip(blkID, blk.Bytes())
|
||||
return nil
|
||||
}
|
||||
|
||||
// Shutdown implements the Engine interface
|
||||
func (t *Transitive) Shutdown() error {
|
||||
t.Config.Context.Log.Info("Shutting down Snowman consensus")
|
||||
t.Config.Context.Log.Info("shutting down consensus engine")
|
||||
return t.Config.VM.Shutdown()
|
||||
}
|
||||
|
||||
|
@ -139,9 +139,7 @@ func (t *Transitive) Get(vdr ids.ShortID, requestID uint32, blkID ids.ID) error
|
|||
// If we failed to get the block, that means either an unexpected error
|
||||
// has occurred, the validator is not following the protocol, or the
|
||||
// block has been pruned.
|
||||
t.Config.Context.Log.Warn("Get called for blockID %s errored with %s",
|
||||
blkID,
|
||||
err)
|
||||
t.Config.Context.Log.Debug("Get(%s, %d, %s) failed with: %s", vdr, requestID, blkID, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -155,7 +153,7 @@ func (t *Transitive) GetAncestors(vdr ids.ShortID, requestID uint32, blkID ids.I
|
|||
startTime := time.Now()
|
||||
blk, err := t.Config.VM.GetBlock(blkID)
|
||||
if err != nil { // Don't have the block. Drop this request.
|
||||
t.Config.Context.Log.Verbo("couldn't get block %s. dropping GetAncestors from %s. Request ID: %s", blkID, vdr, requestID)
|
||||
t.Config.Context.Log.Verbo("couldn't get block %s. dropping GetAncestors(%s, %d, %s)", blkID, vdr, requestID, blkID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -166,7 +164,6 @@ func (t *Transitive) GetAncestors(vdr ids.ShortID, requestID uint32, blkID ids.I
|
|||
for numFetched := 1; numFetched < common.MaxContainersPerMultiPut && time.Since(startTime) < common.MaxTimeFetchingAncestors; numFetched++ {
|
||||
blk = blk.Parent()
|
||||
if blk.Status() == choices.Unknown {
|
||||
t.Config.Context.Log.Debug("couldn't get block %s. dropping GetAncestors from %s. Request ID: %s", blk, vdr, requestID)
|
||||
break
|
||||
}
|
||||
blkBytes := blk.Bytes()
|
||||
|
@ -192,10 +189,8 @@ func (t *Transitive) Put(vdr ids.ShortID, requestID uint32, blkID ids.ID, blkByt
|
|||
|
||||
blk, err := t.Config.VM.ParseBlock(blkBytes)
|
||||
if err != nil {
|
||||
t.Config.Context.Log.Debug("ParseBlock failed due to %s for block:\n%s",
|
||||
err,
|
||||
formatting.DumpBytes{Bytes: blkBytes})
|
||||
|
||||
t.Config.Context.Log.Debug("failed to parse block %s: %s", blkID, err)
|
||||
t.Config.Context.Log.Verbo("block:\n%s", formatting.DumpBytes{Bytes: blkBytes})
|
||||
// because GetFailed doesn't utilize the assumption that we actually
|
||||
// sent a Get message, we can safely call GetFailed here to potentially
|
||||
// abandon the request.
|
||||
|
@ -224,8 +219,7 @@ func (t *Transitive) GetFailed(vdr ids.ShortID, requestID uint32) error {
|
|||
// and also get what the request was for if it exists
|
||||
blkID, ok := t.blkReqs.Remove(vdr, requestID)
|
||||
if !ok {
|
||||
t.Config.Context.Log.Warn("GetFailed called without sending the corresponding Get message from %s",
|
||||
vdr)
|
||||
t.Config.Context.Log.Debug("getFailed(%s, %d) called without having sent corresponding Get", vdr, requestID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -240,8 +234,7 @@ func (t *Transitive) PullQuery(vdr ids.ShortID, requestID uint32, blkID ids.ID)
|
|||
// if the engine hasn't been bootstrapped, we aren't ready to respond to
|
||||
// queries
|
||||
if !t.bootstrapped {
|
||||
t.Config.Context.Log.Debug("Dropping PullQuery for %s due to bootstrapping",
|
||||
blkID)
|
||||
t.Config.Context.Log.Debug("dropping PullQuery(%s, %d, %s) due to bootstrapping", vdr, requestID, blkID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -273,16 +266,15 @@ func (t *Transitive) PushQuery(vdr ids.ShortID, requestID uint32, blkID ids.ID,
|
|||
// if the engine hasn't been bootstrapped, we aren't ready to respond to
|
||||
// queries
|
||||
if !t.bootstrapped {
|
||||
t.Config.Context.Log.Debug("Dropping PushQuery for %s due to bootstrapping", blkID)
|
||||
t.Config.Context.Log.Debug("dropping PushQuery(%s, %d, %s) due to bootstrapping", vdr, requestID, blkID)
|
||||
return nil
|
||||
}
|
||||
|
||||
blk, err := t.Config.VM.ParseBlock(blkBytes)
|
||||
// If the parsing fails, we just drop the request, as we didn't ask for it
|
||||
if err != nil {
|
||||
t.Config.Context.Log.Warn("ParseBlock failed due to %s for block:\n%s",
|
||||
err,
|
||||
formatting.DumpBytes{Bytes: blkBytes})
|
||||
t.Config.Context.Log.Debug("failed to parse block %s: %s", blkID, err)
|
||||
t.Config.Context.Log.Verbo("block:\n%s", formatting.DumpBytes{Bytes: blkBytes})
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -303,17 +295,13 @@ func (t *Transitive) PushQuery(vdr ids.ShortID, requestID uint32, blkID ids.ID,
|
|||
func (t *Transitive) Chits(vdr ids.ShortID, requestID uint32, votes ids.Set) error {
|
||||
// if the engine hasn't been bootstrapped, we shouldn't be receiving chits
|
||||
if !t.bootstrapped {
|
||||
t.Config.Context.Log.Debug("Dropping Chits due to bootstrapping")
|
||||
t.Config.Context.Log.Debug("dropping Chits(%s, %d) due to bootstrapping", vdr, requestID)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Since this is snowman, there should only be one ID in the vote set
|
||||
if votes.Len() != 1 {
|
||||
t.Config.Context.Log.Debug("Chits was called with the wrong number of votes %d. ValidatorID: %s, RequestID: %d",
|
||||
votes.Len(),
|
||||
vdr,
|
||||
requestID)
|
||||
|
||||
t.Config.Context.Log.Debug("Chits(%s, %d) was called with %d votes (expected 1)", vdr, requestID, votes.Len())
|
||||
// because QueryFailed doesn't utilize the assumption that we actually
|
||||
// sent a Query message, we can safely call QueryFailed here to
|
||||
// potentially abandon the request.
|
||||
|
@ -321,7 +309,7 @@ func (t *Transitive) Chits(vdr ids.ShortID, requestID uint32, votes ids.Set) err
|
|||
}
|
||||
vote := votes.List()[0]
|
||||
|
||||
t.Config.Context.Log.Verbo("Chit was called. RequestID: %v. Vote: %s", requestID, vote)
|
||||
t.Config.Context.Log.Verbo("Chits(%s, %d) contains vote for %s", vdr, requestID, vote)
|
||||
|
||||
v := &voter{
|
||||
t: t,
|
||||
|
@ -349,7 +337,7 @@ func (t *Transitive) Chits(vdr ids.ShortID, requestID uint32, votes ids.Set) err
|
|||
func (t *Transitive) QueryFailed(vdr ids.ShortID, requestID uint32) error {
|
||||
// if the engine hasn't been bootstrapped, we won't have sent a query
|
||||
if !t.bootstrapped {
|
||||
t.Config.Context.Log.Warn("Dropping QueryFailed due to bootstrapping")
|
||||
t.Config.Context.Log.Warn("dropping QueryFailed(%s, %d) due to bootstrapping", vdr, requestID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -365,24 +353,24 @@ func (t *Transitive) QueryFailed(vdr ids.ShortID, requestID uint32) error {
|
|||
func (t *Transitive) Notify(msg common.Message) error {
|
||||
// if the engine hasn't been bootstrapped, we shouldn't issuing blocks
|
||||
if !t.bootstrapped {
|
||||
t.Config.Context.Log.Warn("Dropping Notify due to bootstrapping")
|
||||
t.Config.Context.Log.Debug("dropping Notify due to bootstrapping")
|
||||
return nil
|
||||
}
|
||||
|
||||
t.Config.Context.Log.Verbo("Snowman engine notified of %s from the vm", msg)
|
||||
t.Config.Context.Log.Verbo("snowman engine notified of %s from the vm", msg)
|
||||
switch msg {
|
||||
case common.PendingTxs:
|
||||
// the pending txs message means we should attempt to build a block.
|
||||
blk, err := t.Config.VM.BuildBlock()
|
||||
if err != nil {
|
||||
t.Config.Context.Log.Verbo("VM.BuildBlock errored with %s", err)
|
||||
t.Config.Context.Log.Debug("VM.BuildBlock errored with: %s", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
// a newly created block is expected to be processing. If this check
|
||||
// fails, there is potentially an error in the VM this engine is running
|
||||
if status := blk.Status(); status != choices.Processing {
|
||||
t.Config.Context.Log.Warn("Attempting to issue a block with status: %s, expected Processing", status)
|
||||
t.Config.Context.Log.Warn("attempting to issue a block with status: %s, expected Processing", status)
|
||||
}
|
||||
|
||||
// the newly created block should be built on top of the preferred
|
||||
|
@ -390,7 +378,7 @@ func (t *Transitive) Notify(msg common.Message) error {
|
|||
// confirmed.
|
||||
parentID := blk.Parent().ID()
|
||||
if pref := t.Consensus.Preference(); !parentID.Equals(pref) {
|
||||
t.Config.Context.Log.Warn("Built block with parent: %s, expected %s", parentID, pref)
|
||||
t.Config.Context.Log.Warn("built block with parent: %s, expected %s", parentID, pref)
|
||||
}
|
||||
|
||||
added, err := t.insertAll(blk)
|
||||
|
@ -400,12 +388,12 @@ func (t *Transitive) Notify(msg common.Message) error {
|
|||
|
||||
// inserting the block shouldn't have any missing dependencies
|
||||
if added {
|
||||
t.Config.Context.Log.Verbo("Successfully issued new block from the VM")
|
||||
t.Config.Context.Log.Verbo("successfully issued new block from the VM")
|
||||
} else {
|
||||
t.Config.Context.Log.Warn("VM.BuildBlock returned a block that is pending for ancestors")
|
||||
}
|
||||
default:
|
||||
t.Config.Context.Log.Warn("Unexpected message from the VM: %s", msg)
|
||||
t.Config.Context.Log.Warn("unexpected message from the VM: %s", msg)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -515,7 +503,7 @@ func (t *Transitive) insert(blk snowman.Block) error {
|
|||
// block on the parent if needed
|
||||
if parent := blk.Parent(); !t.Consensus.Issued(parent) {
|
||||
parentID := parent.ID()
|
||||
t.Config.Context.Log.Verbo("Block waiting for parent %s", parentID)
|
||||
t.Config.Context.Log.Verbo("block %s waiting for parent %s", blkID, parentID)
|
||||
i.deps.Add(parentID)
|
||||
}
|
||||
|
||||
|
@ -533,10 +521,9 @@ func (t *Transitive) sendRequest(vdr ids.ShortID, blkID ids.ID) {
|
|||
return
|
||||
}
|
||||
|
||||
t.Config.Context.Log.Verbo("Sending Get message for %s", blkID)
|
||||
|
||||
t.RequestID++
|
||||
t.blkReqs.Add(vdr, t.RequestID, blkID)
|
||||
t.Config.Context.Log.Verbo("sending Get(%s, %d, %s)", vdr, t.RequestID, blkID)
|
||||
t.Config.Sender.Get(vdr, t.RequestID, blkID)
|
||||
|
||||
// Tracks performance statistics
|
||||
|
@ -545,7 +532,7 @@ func (t *Transitive) sendRequest(vdr ids.ShortID, blkID ids.ID) {
|
|||
|
||||
// send a pull request for this block ID
|
||||
func (t *Transitive) pullSample(blkID ids.ID) {
|
||||
t.Config.Context.Log.Verbo("About to sample from: %s", t.Config.Validators)
|
||||
t.Config.Context.Log.Verbo("about to sample from: %s", t.Config.Validators)
|
||||
p := t.Consensus.Parameters()
|
||||
vdrs := t.Config.Validators.Sample(p.K)
|
||||
vdrSet := ids.ShortSet{}
|
||||
|
@ -554,13 +541,13 @@ func (t *Transitive) pullSample(blkID ids.ID) {
|
|||
}
|
||||
|
||||
if numVdrs := len(vdrs); numVdrs != p.K {
|
||||
t.Config.Context.Log.Error("Query for %s was dropped due to an insufficient number of validators", blkID)
|
||||
t.Config.Context.Log.Error("query for %s was dropped due to an insufficient number of validators", blkID)
|
||||
return
|
||||
}
|
||||
|
||||
t.RequestID++
|
||||
if !t.polls.Add(t.RequestID, vdrSet.Len()) {
|
||||
t.Config.Context.Log.Error("Query for %s was dropped due to use of a duplicated requestID", blkID)
|
||||
t.Config.Context.Log.Error("query for %s was dropped due to use of a duplicated requestID", blkID)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -569,7 +556,7 @@ func (t *Transitive) pullSample(blkID ids.ID) {
|
|||
|
||||
// send a push request for this block
|
||||
func (t *Transitive) pushSample(blk snowman.Block) {
|
||||
t.Config.Context.Log.Verbo("About to sample from: %s", t.Config.Validators)
|
||||
t.Config.Context.Log.Verbo("about to sample from: %s", t.Config.Validators)
|
||||
p := t.Consensus.Parameters()
|
||||
vdrs := t.Config.Validators.Sample(p.K)
|
||||
vdrSet := ids.ShortSet{}
|
||||
|
@ -579,13 +566,13 @@ func (t *Transitive) pushSample(blk snowman.Block) {
|
|||
|
||||
blkID := blk.ID()
|
||||
if numVdrs := len(vdrs); numVdrs != p.K {
|
||||
t.Config.Context.Log.Error("Query for %s was dropped due to an insufficient number of validators", blkID)
|
||||
t.Config.Context.Log.Error("query for %s was dropped due to an insufficient number of validators", blkID)
|
||||
return
|
||||
}
|
||||
|
||||
t.RequestID++
|
||||
if !t.polls.Add(t.RequestID, vdrSet.Len()) {
|
||||
t.Config.Context.Log.Error("Query for %s was dropped due to use of a duplicated requestID", blkID)
|
||||
t.Config.Context.Log.Error("query for %s was dropped due to use of a duplicated requestID", blkID)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -603,7 +590,7 @@ func (t *Transitive) deliver(blk snowman.Block) error {
|
|||
t.pending.Remove(blkID)
|
||||
|
||||
if err := blk.Verify(); err != nil {
|
||||
t.Config.Context.Log.Debug("Block failed verification due to %s, dropping block", err)
|
||||
t.Config.Context.Log.Debug("block failed verification due to %s, dropping block", err)
|
||||
|
||||
// if verify fails, then all decedents are also invalid
|
||||
t.blocked.Abandon(blkID)
|
||||
|
@ -611,7 +598,7 @@ func (t *Transitive) deliver(blk snowman.Block) error {
|
|||
return t.errs.Err
|
||||
}
|
||||
|
||||
t.Config.Context.Log.Verbo("Adding block to consensus: %s", blkID)
|
||||
t.Config.Context.Log.Verbo("adding block to consensus: %s", blkID)
|
||||
t.Consensus.Add(blk)
|
||||
|
||||
// Add all the oracle blocks if they exist. We call verify on all the blocks
|
||||
|
@ -623,7 +610,7 @@ func (t *Transitive) deliver(blk snowman.Block) error {
|
|||
case OracleBlock:
|
||||
for _, blk := range blk.Options() {
|
||||
if err := blk.Verify(); err != nil {
|
||||
t.Config.Context.Log.Debug("Block failed verification due to %s, dropping block", err)
|
||||
t.Config.Context.Log.Debug("block failed verification due to %s, dropping block", err)
|
||||
dropped = append(dropped, blk)
|
||||
} else {
|
||||
t.Consensus.Add(blk)
|
||||
|
|
Loading…
Reference in New Issue