@@ -50,7 +50,7 @@ func (kpr *Keyper) maybeTriggerDecryption(ctx context.Context, slot uint64) erro
50
50
gnosisKeyperDB := gnosisdatabase .New (kpr .dbpool )
51
51
syncedUntil , err := gnosisKeyperDB .GetTransactionSubmittedEventsSyncedUntil (ctx )
52
52
if err != nil {
53
- return errors .Wrap (err , "failed to query synced until from db" )
53
+ return errors .Wrap (err , "failed to query transaction submitted sync status from db" )
54
54
}
55
55
if syncedUntil .Slot >= int64 (slot ) {
56
56
// If we already synced the block for slot n before this slot has started on our clock,
@@ -86,13 +86,14 @@ func (kpr *Keyper) maybeTriggerDecryption(ctx context.Context, slot uint64) erro
86
86
}
87
87
88
88
// don't trigger if the block proposer is not part of the validator registry
89
- isRegistered , err := kpr .isProposerRegistered (ctx , slot )
89
+ isRegistered , proposerIndex , err := kpr .isProposerRegistered (ctx , slot , uint64 ( nextBlock ) )
90
90
if err != nil {
91
91
return err
92
92
}
93
93
if ! isRegistered {
94
94
log .Debug ().
95
95
Uint64 ("slot" , slot ).
96
+ Uint64 ("proposer-index" , proposerIndex ).
96
97
Msg ("skipping slot as proposer is not registered" )
97
98
// Even if we don't trigger decryption, we still need to update the tx pointer or it will
98
99
// become outdated.
@@ -109,22 +110,22 @@ func (kpr *Keyper) maybeTriggerDecryption(ctx context.Context, slot uint64) erro
109
110
return kpr .triggerDecryption (ctx , slot , nextBlock , & keyperSet )
110
111
}
111
112
112
- func (kpr * Keyper ) isProposerRegistered (ctx context.Context , slot uint64 ) (bool , error ) {
113
+ func (kpr * Keyper ) isProposerRegistered (ctx context.Context , slot uint64 , block uint64 ) (bool , uint64 , error ) {
113
114
epoch := medley .SlotToEpoch (slot , kpr .config .Gnosis .SlotsPerEpoch )
114
115
proposerDuties , err := kpr .beaconAPIClient .GetProposerDutiesByEpoch (ctx , epoch )
115
116
if err != nil {
116
- return false , err
117
+ return false , 0 , err
117
118
}
118
119
if proposerDuties == nil {
119
- return false , errors .Errorf ("no proposer duties found for slot %d in epoch %d" , slot , epoch )
120
+ return false , 0 , errors .Errorf ("no proposer duties found for slot %d in epoch %d" , slot , epoch )
120
121
}
121
122
proposerDuty , err := proposerDuties .GetDutyForSlot (slot )
122
123
if err != nil {
123
- return false , err
124
+ return false , 0 , err
124
125
}
125
126
proposerIndex := proposerDuty .ValidatorIndex
126
127
if proposerIndex > math .MaxInt64 {
127
- return false , errors .New ("proposer index too big" )
128
+ return false , 0 , errors .New ("proposer index too big" )
128
129
}
129
130
130
131
db := gnosisdatabase .New (kpr .dbpool )
@@ -133,12 +134,12 @@ func (kpr *Keyper) isProposerRegistered(ctx context.Context, slot uint64) (bool,
133
134
BlockNumber : int64 (block ),
134
135
})
135
136
if err == pgx .ErrNoRows {
136
- return false , nil
137
+ return false , proposerIndex , nil
137
138
}
138
139
if err != nil {
139
- return false , errors .Wrapf (err , "failed to query registration status for validator %d" , proposerDuty .ValidatorIndex )
140
+ return false , 0 , errors .Wrapf (err , "failed to query registration status for validator %d" , proposerDuty .ValidatorIndex )
140
141
}
141
- return isRegistered , nil
142
+ return isRegistered , proposerDuty . ValidatorIndex , nil
142
143
}
143
144
144
145
func (kpr * Keyper ) getTxPointer (ctx context.Context , eon int64 , slot int64 , keyperConfigIndex int64 ) (int64 , error ) {
0 commit comments