@@ -79,7 +79,7 @@ var errChainTipUnreadable = errors.New("chain tip could not be read from the sto
7979func (e * Engine ) chainTip (ctx context.Context , chainId string ) int64 {
8080 tip , fresh , err := e .Store .GetChainTip (ctx , ChainTipKey (chainId ))
8181 if err != nil {
82- utils .LavaFormatDebug ("chain tip unreadable" , utils .LogAttr ("chainId" , chainId ), utils .LogAttr ("error" , err ))
82+ utils .FormatDebug ("chain tip unreadable" , utils .LogAttr ("chainId" , chainId ), utils .LogAttr ("error" , err ))
8383 return tipReadFailed
8484 }
8585 if ! fresh {
@@ -97,10 +97,10 @@ func (e *Engine) GetSharedTip(ctx context.Context, chainId, sharedStateId string
9797 key := SharedTipKey (chainId , sharedStateId )
9898 value , found , err := e .Store .GetInt64 (ctx , key )
9999 if err != nil || ! found {
100- utils .LavaFormatInfo ("Failed fetching state from cache for this user id" , utils .LogAttr ("id" , key ))
100+ utils .FormatInfo ("Failed fetching state from cache for this user id" , utils .LogAttr ("id" , key ))
101101 return 0
102102 }
103- utils .LavaFormatInfo ("getting seen block cache" , utils .LogAttr ("id" , key ), utils .LogAttr ("value" , value ))
103+ utils .FormatInfo ("getting seen block cache" , utils .LogAttr ("id" , key ), utils .LogAttr ("value" , value ))
104104 return value
105105}
106106
@@ -111,7 +111,7 @@ func (e *Engine) SetSharedTip(ctx context.Context, chainId, sharedStateId string
111111 return
112112 }
113113 if err := e .Store .SetInt64IfGreaterOrEqual (ctx , SharedTipKey (chainId , sharedStateId ), seenBlock , ttl ); err != nil {
114- utils .LavaFormatWarning ("failed setting shared-state tip" , err , utils .LogAttr ("chainId" , chainId ))
114+ utils .FormatWarning ("failed setting shared-state tip" , err , utils .LogAttr ("chainId" , chainId ))
115115 }
116116}
117117
@@ -151,7 +151,7 @@ func (e *Engine) setBlocksHashesToHeights(ctx context.Context, chainId string, b
151151 for _ , hashToHeight := range blocksHashesToHeights {
152152 if hashToHeight .Height >= 0 {
153153 if err := e .Store .SetHeight (ctx , HeightKey (chainId , hashToHeight .Hash ), hashToHeight .Height , e .Policy .BlocksHashesToHeights ); err != nil {
154- utils .LavaFormatWarning ("failed setting block hash to height" , err , utils .LogAttr ("chainId" , chainId ))
154+ utils .FormatWarning ("failed setting block hash to height" , err , utils .LogAttr ("chainId" , chainId ))
155155 }
156156 }
157157 }
@@ -186,15 +186,15 @@ func (e *Engine) getRelayInner(ctx context.Context, relayCacheGet *relaytypes.Re
186186 return nil , NotFoundError
187187 }
188188 if cacheVal .Hash == nil {
189- utils .LavaFormatDebug ("returning response" ,
189+ utils .FormatDebug ("returning response" ,
190190 utils.Attribute {Key : "cache_source" , Value : cacheSource },
191191 utils.Attribute {Key : "hash" , Value : "nil" },
192192 utils.Attribute {Key : "response_data" , Value : parser .CapStringLen (string (cacheVal .Response .Data ))},
193193 )
194194 return cacheVal .ToCacheReply (), nil
195195 }
196196 if bytes .Equal (cacheVal .Hash , relayCacheGet .BlockHash ) {
197- utils .LavaFormatDebug ("returning response" ,
197+ utils .FormatDebug ("returning response" ,
198198 utils.Attribute {Key : "cache_source" , Value : cacheSource },
199199 utils.Attribute {Key : "hash" , Value : "match" },
200200 utils.Attribute {Key : "response_data" , Value : parser .CapStringLen (string (cacheVal .Response .Data ))},
@@ -234,7 +234,7 @@ func (e *Engine) GetRelay(ctx context.Context, relayCacheGet *relaytypes.RelayCa
234234 relayCacheGet .RequestedBlock = replaceRequestedBlock (originalRequestedBlock , getLatestBlock )
235235 }
236236
237- utils .LavaFormatDebug ("Got Cache Get" ,
237+ utils .FormatDebug ("Got Cache Get" ,
238238 utils.Attribute {Key : "request_hash" , Value : string (relayCacheGet .RequestHash )},
239239 utils.Attribute {Key : "finalized" , Value : relayCacheGet .Finalized },
240240 utils.Attribute {Key : "requested_block" , Value : originalRequestedBlock },
@@ -273,7 +273,7 @@ func (e *Engine) GetRelay(ctx context.Context, relayCacheGet *relaytypes.RelayCa
273273
274274 if err == nil {
275275 if cacheReply .SeenBlock < min (relayCacheGet .SeenBlock , relayCacheGet .RequestedBlock ) {
276- err = utils .LavaFormatDebug ("reply seen block is smaller than our expectations" ,
276+ err = utils .FormatDebug ("reply seen block is smaller than our expectations" ,
277277 utils .LogAttr ("cacheReply.SeenBlock" , cacheReply .SeenBlock ),
278278 utils .LogAttr ("seenBlock" , relayCacheGet .SeenBlock ),
279279 )
@@ -290,7 +290,7 @@ func (e *Engine) GetRelay(ctx context.Context, relayCacheGet *relaytypes.RelayCa
290290 // context's own error rides along, so a timeout is classified as one.
291291 return cacheReply , false , errors .Join (StoreError , errChainTipUnreadable , ctx .Err ())
292292 }
293- err = utils .LavaFormatDebug ("Requested block is invalid" ,
293+ err = utils .FormatDebug ("Requested block is invalid" ,
294294 utils .LogAttr ("requested block" , relayCacheGet .RequestedBlock ),
295295 utils .LogAttr ("request_hash" , string (relayCacheGet .RequestHash )),
296296 )
@@ -299,7 +299,7 @@ func (e *Engine) GetRelay(ctx context.Context, relayCacheGet *relaytypes.RelayCa
299299
300300 cacheReply .BlocksHashesToHeights = blockHashes
301301 if blockHashes != nil {
302- utils .LavaFormatDebug ("block hashes:" , utils .LogAttr ("hashes" , blockHashes ))
302+ utils .FormatDebug ("block hashes:" , utils .LogAttr ("hashes" , blockHashes ))
303303 }
304304
305305 hit = cacheReply .Reply != nil
@@ -311,7 +311,7 @@ func (e *Engine) GetRelay(ctx context.Context, relayCacheGet *relaytypes.RelayCa
311311// scalars.
312312func (e * Engine ) SetRelay (ctx context.Context , relayCacheSet * relaytypes.RelayCacheSet ) error {
313313 if relayCacheSet .RequestedBlock < 0 {
314- return utils .LavaFormatError ("invalid relay cache set data, request block is negative" , nil , utils.Attribute {Key : "requestBlock" , Value : relayCacheSet .RequestedBlock })
314+ return utils .FormatError ("invalid relay cache set data, request block is negative" , nil , utils.Attribute {Key : "requestBlock" , Value : relayCacheSet .RequestedBlock })
315315 }
316316 latestKnownBlock := int64 (math .Max (float64 (relayCacheSet .Response .LatestBlock ), float64 (relayCacheSet .SeenBlock )))
317317 // Same scoping as GetRelay: the entry and all of its bookkeeping land in the
@@ -321,7 +321,7 @@ func (e *Engine) SetRelay(ctx context.Context, relayCacheSet *relaytypes.RelayCa
321321
322322 cacheKey := RelayKey (relayCacheSet .Finalized , chainId , relayCacheSet .RequestHash , relayCacheSet .RequestedBlock )
323323 cacheValue := NewEnvelope (relayCacheSet .Response , relayCacheSet .BlockHash , relayCacheSet .Finalized , relayCacheSet .OptionalMetadata , latestKnownBlock , relayCacheSet .IsNodeError , relayCacheSet .StatusCode )
324- utils .LavaFormatDebug ("Got Cache Set" ,
324+ utils .FormatDebug ("Got Cache Set" ,
325325 utils.Attribute {Key : "cacheKey" , Value : cacheKey },
326326 utils.Attribute {Key : "finalized" , Value : relayCacheSet .Finalized },
327327 utils.Attribute {Key : "requested_block" , Value : relayCacheSet .RequestedBlock },
@@ -335,7 +335,7 @@ func (e *Engine) SetRelay(ctx context.Context, relayCacheSet *relaytypes.RelayCa
335335 ttl := e .Policy .ForRelayEntry (relayCacheSet .Finalized , relayCacheSet .IsNodeError , time .Duration (relayCacheSet .AverageBlockTime ), relayCacheSet .BlockHash )
336336 var storeErr error
337337 if err := e .Store .SetEntry (ctx , cacheKey , & cacheValue , ttl ); err != nil {
338- utils .LavaFormatWarning ("failed storing cache entry" , err , utils .LogAttr ("cacheKey" , cacheKey ))
338+ utils .FormatWarning ("failed storing cache entry" , err , utils .LogAttr ("cacheKey" , cacheKey ))
339339 storeErr = errors .Join (StoreError , err )
340340 }
341341
@@ -347,7 +347,7 @@ func (e *Engine) SetRelay(ctx context.Context, relayCacheSet *relaytypes.RelayCa
347347 // yields to any write (MAG-3755) it must not be allowed to replace a real one.
348348 if latestKnownBlock > 0 {
349349 if err := e .Store .SetChainTipIfGreaterOrEqualOrStale (ctx , ChainTipKey (chainId ), latestKnownBlock ); err != nil {
350- utils .LavaFormatWarning ("failed setting chain tip" , err , utils .LogAttr ("chainId" , relayCacheSet .ChainId ))
350+ utils .FormatWarning ("failed setting chain tip" , err , utils .LogAttr ("chainId" , relayCacheSet .ChainId ))
351351 }
352352 }
353353 e .setBlocksHashesToHeights (ctx , chainId , relayCacheSet .BlocksHashesToHeights )
0 commit comments