Skip to content

Commit

Permalink
feat: PRT - new log for failing to recover on node error. (#1606)
Browse files Browse the repository at this point in the history
* new log for failing to recover.

* adding params to log

* adding chain id and apiInterface to log
  • Loading branch information
ranlavanet authored Aug 4, 2024
1 parent 23de584 commit 4d2e829
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ func (pri ParsableRPCInput) GetResult() json.RawMessage {
type GenericMessage interface {
GetHeaders() []pairingtypes.Metadata
DisableErrorHandling()
GetParams() interface{}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ type JsonrpcBatchMessage struct {
chainproxy.BaseMessage
}

func (jbm JsonrpcBatchMessage) GetParams() interface{} {
return nil
}

// on batches we don't want to calculate the batch hash as its impossible to get the args
// we will just return false so retry wont trigger.
func (jbm JsonrpcBatchMessage) GetRawRequestHash() ([]byte, error) {
Expand Down
9 changes: 8 additions & 1 deletion protocol/rpcconsumer/relay_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,14 @@ func (rp *RelayProcessor) shouldRetryRelay(resultsCount int, hashErr error, node
utils.LavaFormatTrace("found hash in map wont retry", utils.LogAttr("hash", hash))
} else {
// We failed enough times. we need to add this to our hash map so we don't waste time on it again.
utils.LavaFormatTrace("adding hash to hash map after NumberOfRetriesAllowedOnNodeErrors errors", utils.LogAttr("hash", hash))
chainId, apiInterface := rp.chainIdAndApiInterfaceGetter.GetChainIdAndApiInterface()
utils.LavaFormatWarning("Failed to recover retries on node errors, might be an invalid input", nil,
utils.LogAttr("api", rp.chainMessage.GetApi().Name),
utils.LogAttr("params", rp.chainMessage.GetRPCMessage().GetParams()),
utils.LogAttr("chainId", chainId),
utils.LogAttr("apiInterface", apiInterface),
utils.LogAttr("hash", hash),
)
rp.relayRetriesManager.AddHashToCache(hash)
}
}
Expand Down

0 comments on commit 4d2e829

Please sign in to comment.