@@ -3,6 +3,7 @@ package epochkghandler
3
3
import (
4
4
"bytes"
5
5
"context"
6
+ "strconv"
6
7
7
8
"github.com/jackc/pgx/v4"
8
9
"github.com/jackc/pgx/v4/pgxpool"
@@ -14,6 +15,7 @@ import (
14
15
"github.com/shutter-network/shutter/shlib/shcrypto"
15
16
16
17
"github.com/shutter-network/rolling-shutter/rolling-shutter/keyper/database"
18
+ "github.com/shutter-network/rolling-shutter/rolling-shutter/keyper/keypermetrics"
17
19
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley"
18
20
"github.com/shutter-network/rolling-shutter/rolling-shutter/p2p"
19
21
"github.com/shutter-network/rolling-shutter/rolling-shutter/p2pmsg"
@@ -52,25 +54,31 @@ func (handler *DecryptionKeyHandler) ValidateMessage(ctx context.Context, msg p2
52
54
return pubsub .ValidationReject , err
53
55
}
54
56
if ! isKeyper {
57
+ keypermetrics .MetricsKeyperIsKeyper .WithLabelValues (strconv .FormatInt (eon , 10 )).Set (0 )
55
58
log .Debug ().Int64 ("eon" , eon ).Msg ("Ignoring decryptionKey for eon; we're not a Keyper" )
56
59
return pubsub .ValidationReject , nil
57
60
}
61
+ keypermetrics .MetricsKeyperIsKeyper .WithLabelValues (strconv .FormatInt (eon , 10 )).Set (1 )
58
62
59
63
dkgResultDB , err := queries .GetDKGResultForKeyperConfigIndex (ctx , eon )
60
64
if errors .Is (err , pgx .ErrNoRows ) {
65
+ keypermetrics .MetricsKeyperSuccessfullDKG .WithLabelValues (strconv .FormatInt (eon , 10 )).Set (0 )
61
66
return pubsub .ValidationReject , errors .Errorf ("no DKG result found for eon %d" , eon )
62
67
}
63
68
if err != nil {
69
+ keypermetrics .MetricsKeyperSuccessfullDKG .WithLabelValues (strconv .FormatInt (eon , 10 )).Set (0 )
64
70
return pubsub .ValidationReject , errors .Wrapf (err , "failed to get dkg result for eon %d from db" , eon )
65
71
}
66
72
if ! dkgResultDB .Success {
73
+ keypermetrics .MetricsKeyperSuccessfullDKG .WithLabelValues (strconv .FormatInt (eon , 10 )).Set (0 )
67
74
return pubsub .ValidationReject , errors .Errorf ("no successful DKG result found for eon %d" , eon )
68
75
}
69
76
pureDKGResult , err := shdb .DecodePureDKGResult (dkgResultDB .PureResult )
70
77
if err != nil {
71
78
return pubsub .ValidationReject , errors .Wrapf (err , "error while decoding pure DKG result for eon %d" , eon )
72
79
}
73
80
81
+ keypermetrics .MetricsKeyperSuccessfullDKG .WithLabelValues (strconv .FormatInt (eon , 10 )).Set (1 )
74
82
if len (decryptionKeys .Keys ) == 0 {
75
83
return pubsub .ValidationReject , errors .New ("no keys in message" )
76
84
}
0 commit comments