Skip to content

Commit 8b796a2

Browse files
committed
tmp
1 parent 56aac88 commit 8b796a2

File tree

10 files changed

+24
-23
lines changed

10 files changed

+24
-23
lines changed

node/common/src/service/block_producer/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ fn prover_loop(
130130
}
131131
}
132132
}
133+
// TODO: error must include the input
133134
let res = res.map_err(|err| err.to_string());
134135
let _ = event_sender.send(BlockProducerEvent::BlockProve(block_hash, res).into());
135136
}

node/common/src/service/service.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,14 @@ impl redux::TimeService for NodeService {
187187
}
188188
}
189189

190+
impl node::service::ErrorSinkService for NodeService {
191+
fn submit_error_report_data(&mut self, category: &str, data: Vec<u8>) {
192+
let _ = category;
193+
let _ = data;
194+
todo!()
195+
}
196+
}
197+
190198
impl node::service::EventSourceService for NodeService {
191199
fn next_event(&mut self) -> Option<Event> {
192200
self.event_receiver.try_next()

node/src/block_producer/block_producer_reducer.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ impl BlockProducerEnabled {
310310
dispatcher.push(BlockProducerEffectfulAction::BlockProveError {
311311
error: error.clone(),
312312
});
313+
dispatcher.push(BlockProducerAction::WonSlotDiscard {
314+
reason: super::BlockProducerWonSlotDiscardReason::BlockProofError,
315+
});
313316
}
314317
BlockProducerAction::BlockProduced => {
315318
let current_state = std::mem::take(&mut state.current);

node/src/block_producer/block_producer_state.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ pub enum BlockProducerWonSlotDiscardReason {
149149
BestTipStakingLedgerDifferent,
150150
BestTipGlobalSlotHigher,
151151
BestTipSuperior,
152+
BlockProofError,
152153
}
153154

154155
impl BlockProducerState {

node/src/block_producer_effectful/block_producer_effectful_effects.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,7 @@ pub fn block_producer_effects<S: crate::Service>(
216216
store.dispatch(BlockProducerAction::BlockProduced);
217217
}
218218
BlockProducerEffectfulAction::BlockProveError { error } => {
219-
if let Some(stats) = store.service.stats() {
220-
stats
221-
.block_producer()
222-
.proof_create_error(meta.time(), error.clone());
223-
}
224-
store.dispatch(BlockProducerAction::BlockProveError { error });
219+
store.service.submit_error_report("blockProofFailure", error);
225220
}
226221
BlockProducerEffectfulAction::WonSlotDiscard { reason } => {
227222
if let Some(stats) = store.service.stats() {

node/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub mod stats;
3535
pub mod block_producer;
3636
pub mod block_producer_effectful;
3737
pub mod daemon_json;
38+
pub mod error_sink;
3839
pub mod event_source;
3940
pub mod external_snark_worker;
4041
pub mod external_snark_worker_effectful;

node/src/service.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pub use crate::block_producer_effectful::vrf_evaluator_effectful::BlockProducerVrfEvaluatorService;
22
pub use crate::block_producer_effectful::BlockProducerService;
3+
pub use crate::error_sink::ErrorSinkService;
34
pub use crate::event_source::EventSourceService;
45
pub use crate::external_snark_worker_effectful::ExternalSnarkWorkerService;
56
pub use crate::ledger::LedgerService;
@@ -33,6 +34,7 @@ pub trait Service:
3334
+ ExternalSnarkWorkerService
3435
+ RpcService
3536
+ ArchiveService
37+
+ ErrorSinkService
3638
{
3739
fn queues(&mut self) -> Queues;
3840
fn stats(&mut self) -> Option<&mut Stats>;

node/src/stats/stats_block_producer.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ pub struct BlockProductionTimes {
4545
pub produced: Option<redux::Timestamp>,
4646
pub proof_create_start: Option<redux::Timestamp>,
4747
pub proof_create_end: Option<redux::Timestamp>,
48-
pub proof_create_error: Option<redux::Timestamp>,
4948
pub block_apply_start: Option<redux::Timestamp>,
5049
pub block_apply_end: Option<redux::Timestamp>,
5150
pub committed: Option<redux::Timestamp>,
@@ -61,9 +60,6 @@ pub enum BlockProductionStatus {
6160
Produced,
6261
ProofCreatePending,
6362
ProofCreateSuccess,
64-
ProofCreateError {
65-
error: String,
66-
},
6763
BlockApplyPending,
6864
BlockApplySuccess,
6965
Committed,
@@ -205,7 +201,6 @@ impl BlockProducerStats {
205201
produced: None,
206202
proof_create_start: None,
207203
proof_create_end: None,
208-
proof_create_error: None,
209204
block_apply_start: None,
210205
block_apply_end: None,
211206
committed: None,
@@ -282,17 +277,6 @@ impl BlockProducerStats {
282277
});
283278
}
284279

285-
pub fn proof_create_error(&mut self, time: redux::Timestamp, error: String) {
286-
self.update("proof_create_error", move |attempt| match attempt.status {
287-
BlockProductionStatus::ProofCreatePending => {
288-
attempt.status = BlockProductionStatus::ProofCreateError { error };
289-
attempt.times.proof_create_error = Some(time);
290-
true
291-
}
292-
_ => false,
293-
});
294-
}
295-
296280
pub fn block_apply_start(&mut self, time: redux::Timestamp, hash: &BlockHash) {
297281
if !self.is_our_just_produced_block(hash) {
298282
return;

node/testing/src/service/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,12 @@ impl redux::TimeService for NodeTestingService {
340340
}
341341
}
342342

343+
impl node::service::ErrorSinkService for NodeTestingService {
344+
fn submit_error_report_data(&mut self, _category: &str, _data: Vec<u8>) {
345+
// TODO: log or store on disk?
346+
}
347+
}
348+
343349
impl node::event_source::EventSourceService for NodeTestingService {
344350
fn next_event(&mut self) -> Option<Event> {
345351
None

tools/error-sink-service/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use actix_web::middleware::{DefaultHeaders, Logger};
22
use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer, Result};
33
use base64::{engine::general_purpose::STANDARD as BASE64, Engine as _};
44
use chrono::Utc;
5-
use log::{error, info, warn};
5+
use log::{error, info};
66
use serde::{Deserialize, Serialize};
77
use std::collections::HashSet;
88
use std::fs::{self, File};

0 commit comments

Comments
 (0)