Skip to content

Conversation

CertiK-Geth
Copy link

Description

Previously the panic callback was created but never invoked, so recovered panics were not logged.
Invoke the returned function to ensure the recovered error and stack trace are logged for observability.

Changes

// ...existing code...
func panicCatchingEpochHook(ctx sdk.Context, hookFn func(sdk.Context, Epoch), epoch Epoch) {
-	defer utils.PanicHandler(func(r any) {
-		utils.LogPanicCallback(ctx, r)
-	})()
+	defer utils.PanicHandler(func(r any) {
+		// LogPanicCallback returns a func(any); invoke it so the panic is actually logged.
+		utils.LogPanicCallback(ctx, r)(r)
+	})()
 
     // cache the context and only write if no panic (which is caught above)
     cacheCtx, write := ctx.CacheContext()
     hookFn(cacheCtx, epoch)
     write()
 }
 // ...existing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant