From d4e9939d56978bb0825d7ef4876e2d83502076f7 Mon Sep 17 00:00:00 2001 From: Ivan Schasny Date: Wed, 29 Nov 2023 14:48:36 +0000 Subject: [PATCH 1/2] fix: better formatting for error messages --- lib/mpoolmonitor/mpoolmonitor.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/mpoolmonitor/mpoolmonitor.go b/lib/mpoolmonitor/mpoolmonitor.go index a087c8cf1..1c4f6e027 100644 --- a/lib/mpoolmonitor/mpoolmonitor.go +++ b/lib/mpoolmonitor/mpoolmonitor.go @@ -188,11 +188,17 @@ func (mm *MpoolMonitor) MsgExecElapsedEpochs(ctx context.Context, msgCid cid.Cid x, err := mm.fullNode.StateSearchMsg(ctx, types.EmptyTSK, msgCid, abi.ChainEpoch(20), true) // check for nil is required as the StateSearchMsg / ChainHead sometimes return a nil pointer // without an error (TODO: investigate) that has caused panics in boost - if x == nil || err != nil { + if x == nil { + return found, 0, fmt.Errorf("searching message is nil") + } + if err != nil { return found, 0, fmt.Errorf("searching message: %w", err) } c, err := mm.fullNode.ChainHead(ctx) - if c == nil || err != nil { + if c == nil { + return found, 0, fmt.Errorf("chain head is nil") + } + if err != nil { return found, 0, fmt.Errorf("getting chain head: %w", err) } return found, c.Height() - x.Height, nil From 2a9fd0a5010f1dcd9c87172a1d4c00a7e089483c Mon Sep 17 00:00:00 2001 From: Ivan Schasny <31857042+ischasny@users.noreply.github.com> Date: Wed, 29 Nov 2023 15:44:43 +0000 Subject: [PATCH 2/2] Update mpoolmonitor.go Co-authored-by: LexLuthr <88259624+LexLuthr@users.noreply.github.com> --- lib/mpoolmonitor/mpoolmonitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mpoolmonitor/mpoolmonitor.go b/lib/mpoolmonitor/mpoolmonitor.go index 1c4f6e027..9d07f00ce 100644 --- a/lib/mpoolmonitor/mpoolmonitor.go +++ b/lib/mpoolmonitor/mpoolmonitor.go @@ -189,7 +189,7 @@ func (mm *MpoolMonitor) MsgExecElapsedEpochs(ctx context.Context, msgCid cid.Cid // check for nil is required as the StateSearchMsg / ChainHead sometimes return a nil pointer // without an error (TODO: investigate) that has caused panics in boost if x == nil { - return found, 0, fmt.Errorf("searching message is nil") + return found, 0, fmt.Errorf("Message not yet found in state store") } if err != nil { return found, 0, fmt.Errorf("searching message: %w", err)