Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update log levels #609

Merged
merged 2 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call interfaces.Call
if transfer == nil {
transfer = new(big.Int)
}
log.Warn("Gas estimation capped by limited funds", "original", hi, "balance", balance,
log.Info("Gas estimation capped by limited funds", "original", hi, "balance", balance,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can occur if a user requests too much gas, so we should not consider it an unexpected warn log

"sent", transfer, "feecap", feeCap, "fundable", allowance)
hi = allowance.Uint64()
}
Expand Down
2 changes: 1 addition & 1 deletion core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,7 @@ func (bc *BlockChain) reorg(oldBlock, newBlock *types.Block) error {
logFn(msg, "number", commonBlock.Number(), "hash", commonBlock.Hash(),
"drop", len(oldChain), "dropfrom", oldChain[0].Hash(), "add", len(newChain), "addfrom", newChain[0].Hash())
} else {
log.Warn("Unlikely preference change (rewind to ancestor) occurred", "oldnum", oldHead.Number(), "oldhash", oldHead.Hash(), "newnum", newHead.Number(), "newhash", newHead.Hash())
log.Debug("Preference change (rewind to ancestor) occurred", "oldnum", oldHead.Number(), "oldhash", oldHead.Hash(), "newnum", newHead.Number(), "newhash", newHead.Hash())
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follows update made in Coreth to reduce this to Debug since this can occur on restart when a node rewinds its preference to the last accepted block.

}
// Insert the new chain(except the head block(reverse order)),
// taking care of the proper incremental order.
Expand Down
4 changes: 2 additions & 2 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1162,14 +1162,14 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr
if transfer == nil {
transfer = new(hexutil.Big)
}
log.Warn("Gas estimation capped by limited funds", "original", hi, "balance", balance,
log.Info("Gas estimation capped by limited funds", "original", hi, "balance", balance,
"sent", transfer.ToInt(), "maxFeePerGas", feeCap, "fundable", allowance)
hi = allowance.Uint64()
}
}
// Recap the highest gas allowance with specified gascap.
if gasCap != 0 && hi > gasCap {
log.Warn("Caller gas above allowance, capping", "requested", hi, "cap", gasCap)
log.Info("Caller gas above allowance, capping", "requested", hi, "cap", gasCap)
hi = gasCap
}
cap = hi
Expand Down
2 changes: 1 addition & 1 deletion internal/ethapi/transaction_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (t
gas = uint64(*args.Gas)
}
if globalGasCap != 0 && globalGasCap < gas {
log.Warn("Caller gas above allowance, capping", "requested", gas, "cap", globalGasCap)
log.Info("Caller gas above allowance, capping", "requested", gas, "cap", globalGasCap)
gas = globalGasCap
}
var (
Expand Down
8 changes: 4 additions & 4 deletions plugin/evm/message/cross_chain_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ func (c *crossChainHandler) HandleEthCallRequest(ctx context.Context, requesting
transactionArgs := ethapi.TransactionArgs{}
err := json.Unmarshal(ethCallRequest.RequestArgs, &transactionArgs)
if err != nil {
log.Debug("error occurred with JSON unmarshalling ethCallRequest.RequestArgs", "err", err)
log.Error("error occurred with JSON unmarshalling ethCallRequest.RequestArgs", "err", err)
return nil, nil
}

result, err := ethapi.DoCall(ctx, c.backend, transactionArgs, lastAcceptedBlockNumberOrHash, nil, c.backend.RPCEVMTimeout(), c.backend.RPCGasCap())
if err != nil {
log.Debug("error occurred with EthCall", "err", err, "transactionArgs", ethCallRequest.RequestArgs, "blockNumberOrHash", lastAcceptedBlockNumberOrHash)
log.Error("error occurred with EthCall", "err", err, "transactionArgs", ethCallRequest.RequestArgs, "blockNumberOrHash", lastAcceptedBlockNumberOrHash)
return nil, nil
}

executionResult, err := json.Marshal(&result)
if err != nil {
log.Debug("error occurred with JSON marshalling result", "err", err)
log.Error("error occurred with JSON marshalling result", "err", err)
Comment on lines +46 to +58
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These requests should only come from a VM running on the same node, so failing to serve the request should be considered a warning at this time.

Note: CrossChainHandler is not used by any VM at this time

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be a Warn? not an Error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is assuming that requests coming from the same node. This is a feature that's not in use atm, so it depends on if VMs that wanted to use this should only send requests that should be successful 🤔

That was my logic when updating to Error at least.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of right now, if this log showed up I'd want to know about it rather than only wanting to know about it if it showed up in a large quantity or a surge, so I'm going to leave this as is for now.

We may want to change this in the future if the access pattern for it changes.

return nil, nil
}

Expand All @@ -65,7 +65,7 @@ func (c *crossChainHandler) HandleEthCallRequest(ctx context.Context, requesting

responseBytes, err := c.crossChainCodec.Marshal(Version, response)
if err != nil {
log.Warn("error occurred with marshalling EthCallResponse", "err", err, "EthCallResponse", response)
log.Error("error occurred with marshalling EthCallResponse", "err", err, "EthCallResponse", response)
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/evm/syncervm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (client *stateSyncerClient) syncBlocks(ctx context.Context, fromHash common
}
blocks, err := client.client.GetBlocks(ctx, nextHash, nextHeight, parentsPerRequest)
if err != nil {
log.Warn("could not get blocks from peer", "err", err, "nextHash", nextHash, "remaining", i+1)
log.Error("could not get blocks from peer", "err", err, "nextHash", nextHash, "remaining", i+1)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that it has failed to sync, so this should be increased from Warn to Error

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be possible for the peer to send us a malformed blocks and trigger this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to client.client.GetBlocks includes retries so if we exhaust retries we can log Error since we will return err and the sync has failed.

return err
}
for _, block := range blocks {
Expand Down
4 changes: 2 additions & 2 deletions plugin/evm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func (vm *VM) Initialize(
vm.syntacticBlockValidator = NewBlockValidator()

if g.Config.FeeConfig == commontype.EmptyFeeConfig {
log.Warn("No fee config given in genesis, setting default fee config", "DefaultFeeConfig", params.DefaultFeeConfig)
log.Info("No fee config given in genesis, setting default fee config", "DefaultFeeConfig", params.DefaultFeeConfig)
g.Config.FeeConfig = params.DefaultFeeConfig
}

Expand Down Expand Up @@ -369,7 +369,7 @@ func (vm *VM) Initialize(
log.Info("Setting fee recipient", "address", address)
vm.ethConfig.Miner.Etherbase = address
} else {
log.Warn("Config has not specified any coinbase address. Defaulting to the blackhole address.")
log.Info("Config has not specified any coinbase address. Defaulting to the blackhole address.")
vm.ethConfig.Miner.Etherbase = constants.BlackholeAddr
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func (h *handler) handleCallMsg(ctx *callProc, msg *jsonrpcMessage) *jsonrpcMess
if resp.Error.Data != nil {
ctx = append(ctx, "errdata", resp.Error.Data)
}
h.log.Warn("Served "+msg.Method, ctx...)
h.log.Info("Served "+msg.Method, ctx...)
} else {
h.log.Debug("Served "+msg.Method, ctx...)
}
Expand Down
4 changes: 2 additions & 2 deletions sync/handlers/block_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (b *BlockRequestHandler) OnBlockRequest(ctx context.Context, nodeID ids.Nod

buf := new(bytes.Buffer)
if err := block.EncodeRLP(buf); err != nil {
log.Warn("failed to RLP encode block", "hash", block.Hash(), "height", block.NumberU64(), "err", err)
log.Error("failed to RLP encode block", "hash", block.Hash(), "height", block.NumberU64(), "err", err)
return nil, nil
}

Expand All @@ -100,7 +100,7 @@ func (b *BlockRequestHandler) OnBlockRequest(ctx context.Context, nodeID ids.Nod
}
responseBytes, err := b.codec.Marshal(message.Version, response)
if err != nil {
log.Warn("failed to marshal BlockResponse, dropping request", "nodeID", nodeID, "requestID", requestID, "hash", blockRequest.Hash, "parents", blockRequest.Parents, "blocksLen", len(response.Blocks), "err", err)
log.Error("failed to marshal BlockResponse, dropping request", "nodeID", nodeID, "requestID", requestID, "hash", blockRequest.Hash, "parents", blockRequest.Parents, "blocksLen", len(response.Blocks), "err", err)
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion sync/handlers/code_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (n *CodeRequestHandler) OnCodeRequest(_ context.Context, nodeID ids.NodeID,
codeResponse := message.CodeResponse{Data: codeBytes}
responseBytes, err := n.codec.Marshal(message.Version, codeResponse)
if err != nil {
log.Warn("could not marshal CodeResponse, dropping request", "nodeID", nodeID, "requestID", requestID, "request", codeRequest, "err", err)
log.Error("could not marshal CodeResponse, dropping request", "nodeID", nodeID, "requestID", requestID, "request", codeRequest, "err", err)
return nil, nil
}
n.stats.UpdateCodeBytesReturned(uint32(totalBytes))
Expand Down
2 changes: 1 addition & 1 deletion warp/handlers/signature_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s *signatureRequestHandler) OnSignatureRequest(ctx context.Context, nodeID
response := message.SignatureResponse{Signature: signature}
responseBytes, err := s.codec.Marshal(message.Version, &response)
if err != nil {
log.Warn("could not marshal SignatureResponse, dropping request", "nodeID", nodeID, "requestID", requestID, "err", err)
log.Error("could not marshal SignatureResponse, dropping request", "nodeID", nodeID, "requestID", requestID, "err", err)
return nil, nil
}

Expand Down