Skip to content

Commit

Permalink
Remove disable_proof_verification configuration.
Browse files Browse the repository at this point in the history
Since `disable_proof_verification` description is misleading and only
use of this parameter is to disable proof verification during the
confidence check, we can remove this parameter.
  • Loading branch information
aterentic-ethernal committed Nov 22, 2023
1 parent ec3330e commit f925448
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 31 deletions.
49 changes: 23 additions & 26 deletions src/light_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,34 +223,31 @@ pub async fn process_block(
return Ok(None);
}

let mut confidence = None;
if !cfg.disable_proof_verification {
let (verified, unverified) =
proof::verify(block_number, dimensions, &cells, &commitments, pp)?;
let count = verified.len().saturating_sub(unverified.len());
info!(
block_number,
elapsed = ?begin.elapsed(),
"Completed {count} verification rounds",
);
let (verified, unverified) = proof::verify(block_number, dimensions, &cells, &commitments, pp)?;
let count = verified.len().saturating_sub(unverified.len());
info!(
block_number,
elapsed = ?begin.elapsed(),
"Completed {count} verification rounds",
);

// write confidence factor into on-disk database
light_client
.store_confidence_in_db(verified.len() as u32, block_number)
.context("Failed to store confidence in DB")?;
// write confidence factor into on-disk database
light_client
.store_confidence_in_db(verified.len() as u32, block_number)
.context("Failed to store confidence in DB")?;

state.lock().unwrap().confidence_achieved.set(block_number);
state.lock().unwrap().confidence_achieved.set(block_number);

let conf = calculate_confidence(verified.len() as u32);
info!(
block_number,
"confidence" = conf,
"Confidence factor: {}",
conf
);
metrics.record(MetricValue::BlockConfidence(conf)).await?;
confidence = Some(conf);
}
let confidence = calculate_confidence(verified.len() as u32);
info!(
block_number,
"confidence" = confidence,
"Confidence factor: {}",
confidence
);
metrics
.record(MetricValue::BlockConfidence(confidence))
.await?;

// push latest mined block's header into column family specified
// for keeping block headers, to be used
Expand Down Expand Up @@ -404,7 +401,7 @@ pub async fn process_block(

metrics.record(MetricValue::HealthCheck()).await?;

Ok(confidence)
Ok(Some(confidence))
}

pub struct Channels {
Expand Down
5 changes: 0 additions & 5 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,6 @@ pub struct RuntimeConfig {
pub ot_collector_endpoint: String,
/// Disables fetching of cells from RPC, set to true if client expects cells to be available in DHT (default: false).
pub disable_rpc: bool,
/// Disables proof verification in general, if set to true, otherwise proof verification is performed. (default: false).
pub disable_proof_verification: bool,
/// Maximum number of parallel tasks spawned for GET and PUT operations on DHT (default: 20).
pub dht_parallelization_limit: usize,
/// Number of records to be inserted into DHT simultaneously (default: 1000)
Expand Down Expand Up @@ -327,7 +325,6 @@ pub struct LightClientConfig {
pub query_proof_rpc_parallel_tasks: usize,
pub block_processing_delay: Delay,
pub block_matrix_partition: Option<Partition>,
pub disable_proof_verification: bool,
pub max_cells_per_rpc: usize,
pub ttl: u64,
}
Expand All @@ -354,7 +351,6 @@ impl From<&RuntimeConfig> for LightClientConfig {
query_proof_rpc_parallel_tasks: val.query_proof_rpc_parallel_tasks,
block_processing_delay: Delay(block_processing_delay),
block_matrix_partition: val.block_matrix_partition,
disable_proof_verification: val.disable_proof_verification,
max_cells_per_rpc: val.max_cells_per_rpc.unwrap_or(30),
ttl: val.kad_record_ttl,
}
Expand Down Expand Up @@ -518,7 +514,6 @@ impl Default for RuntimeConfig {
log_format_json: false,
ot_collector_endpoint: "http://127.0.0.1:4317".to_string(),
disable_rpc: false,
disable_proof_verification: false,
dht_parallelization_limit: 20,
put_batch_size: 1000,
query_proof_rpc_parallel_tasks: 8,
Expand Down

0 comments on commit f925448

Please sign in to comment.