@@ -43,7 +43,7 @@ use beacon_processor::work_reprocessing_queue::{QueuedUnaggregate, ReprocessQueu
43
43
use eth2:: types:: Failure ;
44
44
use lighthouse_network:: PubsubMessage ;
45
45
use network:: NetworkMessage ;
46
- use slog:: { debug, error, Logger } ;
46
+ use slog:: { debug, error, warn , Logger } ;
47
47
use std:: sync:: Arc ;
48
48
use std:: time:: Duration ;
49
49
use tokio:: sync:: {
@@ -75,6 +75,7 @@ fn verify_and_publish_attestation<T: BeaconChainTypes>(
75
75
attestation : & Attestation < T :: EthSpec > ,
76
76
seen_timestamp : Duration ,
77
77
network_tx : & UnboundedSender < NetworkMessage < T :: EthSpec > > ,
78
+ log : & Logger ,
78
79
) -> Result < ( ) , Error > {
79
80
let attestation = chain
80
81
. verify_unaggregated_attestation_for_gossip ( attestation, None )
@@ -103,6 +104,21 @@ fn verify_and_publish_attestation<T: BeaconChainTypes>(
103
104
let fc_result = chain. apply_attestation_to_fork_choice ( & attestation) ;
104
105
let naive_aggregation_result = chain. add_to_naive_aggregation_pool ( & attestation) ;
105
106
107
+ if let Err ( e) = & fc_result {
108
+ warn ! (
109
+ log,
110
+ "Attestation invalid for fork choice" ;
111
+ "err" => ?e,
112
+ ) ;
113
+ }
114
+ if let Err ( e) = & naive_aggregation_result {
115
+ warn ! (
116
+ log,
117
+ "Attestation invalid for aggregation" ;
118
+ "err" => ?e
119
+ ) ;
120
+ }
121
+
106
122
if let Err ( e) = fc_result {
107
123
Err ( Error :: ForkChoice ( e) )
108
124
} else if let Err ( e) = naive_aggregation_result {
@@ -129,6 +145,7 @@ pub async fn publish_attestations<T: BeaconChainTypes>(
129
145
130
146
// Gossip validate and publish attestations that can be immediately processed.
131
147
let seen_timestamp = timestamp_now ( ) ;
148
+ let inner_log = log. clone ( ) ;
132
149
let mut prelim_results = task_spawner
133
150
. blocking_task ( Priority :: P0 , move || {
134
151
Ok ( attestations
@@ -139,6 +156,7 @@ pub async fn publish_attestations<T: BeaconChainTypes>(
139
156
& attestation,
140
157
seen_timestamp,
141
158
& network_tx,
159
+ & inner_log,
142
160
) {
143
161
Ok ( ( ) ) => PublishAttestationResult :: Success ,
144
162
Err ( Error :: Validation ( AttestationError :: UnknownHeadBlock {
@@ -151,12 +169,14 @@ pub async fn publish_attestations<T: BeaconChainTypes>(
151
169
let ( tx, rx) = oneshot:: channel ( ) ;
152
170
let reprocess_chain = chain. clone ( ) ;
153
171
let reprocess_network_tx = network_tx. clone ( ) ;
172
+ let reprocess_log = inner_log. clone ( ) ;
154
173
let reprocess_fn = move || {
155
174
let result = verify_and_publish_attestation (
156
175
& reprocess_chain,
157
176
& attestation,
158
177
seen_timestamp,
159
178
& reprocess_network_tx,
179
+ & reprocess_log,
160
180
) ;
161
181
// Ignore failure on the oneshot that reports the result. This
162
182
// shouldn't happen unless some catastrophe befalls the waiting
@@ -208,6 +228,12 @@ pub async fn publish_attestations<T: BeaconChainTypes>(
208
228
// This part should be quick so we just stay in the Tokio executor's async task.
209
229
for ( i, reprocess_result) in reprocess_indices. into_iter ( ) . zip ( reprocess_results) {
210
230
let Some ( result_entry) = prelim_results. get_mut ( i) else {
231
+ error ! (
232
+ log,
233
+ "Unreachable case in attestation publishing" ;
234
+ "case" => "prelim out of bounds" ,
235
+ "request_index" => i,
236
+ ) ;
211
237
continue ;
212
238
} ;
213
239
* result_entry = Some ( match reprocess_result {
0 commit comments