Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more info on crash #604

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions src/task_monitor/tasks/process_identities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,37 +183,37 @@
updates: &[AppliedTreeUpdate],
) -> AnyhowResult<()> {
// If the update is an insertion
if updates
.first()
.context("Updates should be > 1")?
.update
.element
!= Hash::ZERO
{
let prover = identity_manager
.get_suitable_insertion_prover(updates.len())
.await?;

info!(
"Sending timed-out insertion batch with {}/{} updates.",
updates.len(),
prover.batch_size()
);

insert_identities(database, identity_manager, batching_tree, updates, prover).await?;
} else {
let prover = identity_manager
.get_suitable_deletion_prover(updates.len())
.await?;

info!(
"Sending timed-out deletion batch with {}/{} updates.",
updates.len(),
prover.batch_size()
);

delete_identities(database, identity_manager, batching_tree, updates, prover).await?;
}

Check warning on line 216 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

unnecessary `!=` operation

warning: unnecessary `!=` operation --> src/task_monitor/tasks/process_identities.rs:186:5 | 186 | / if updates 187 | | .first() 188 | | .context("Updates should be > 1")? 189 | | .update ... | 215 | | delete_identities(database, identity_manager, batching_tree, updates, prover).await?; 216 | | } | |_____^ | = help: change to `==` and swap the blocks of the `if`/`else` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else = note: `#[warn(clippy::if_not_else)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 216 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

unnecessary `!=` operation

warning: unnecessary `!=` operation --> src/task_monitor/tasks/process_identities.rs:186:5 | 186 | / if updates 187 | | .first() 188 | | .context("Updates should be > 1")? 189 | | .update ... | 215 | | delete_identities(database, identity_manager, batching_tree, updates, prover).await?; 216 | | } | |_____^ | = help: change to `==` and swap the blocks of the `if`/`else` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else = note: `#[warn(clippy::if_not_else)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 216 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

unnecessary `!=` operation

warning: unnecessary `!=` operation --> src/task_monitor/tasks/process_identities.rs:186:5 | 186 | / if updates 187 | | .first() 188 | | .context("Updates should be > 1")? 189 | | .update ... | 215 | | delete_identities(database, identity_manager, batching_tree, updates, prover).await?; 216 | | } | |_____^ | = help: change to `==` and swap the blocks of the `if`/`else` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else = note: `#[warn(clippy::if_not_else)]` implied by `#[warn(clippy::pedantic)]`

Ok(())
}
Expand Down Expand Up @@ -242,11 +242,23 @@
.leaf_index;

for update in &updates[1..] {
assert_eq!(
last_index + 1,
update.update.leaf_index,
"Identities are not consecutive leaves in the tree."
);
if last_index + 1 != update.update.leaf_index {
let leaf_indexes = updates
.iter()
.map(|update| update.update.leaf_index)
.collect::<Vec<_>>();
let commitments = updates
.iter()
.map(|update| update.update.element)
.collect::<Vec<_>>();

panic!(
"Identities are not consecutive leaves in the tree (leaf_indexes = {:?}, \
commitments = {:?})",
leaf_indexes, commitments
);

Check warning on line 259 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string --> src/task_monitor/tasks/process_identities.rs:255:13 | 255 | / panic!( 256 | | "Identities are not consecutive leaves in the tree (leaf_indexes = {:?}, \ 257 | | commitments = {:?})", 258 | | leaf_indexes, commitments 259 | | ); | |_____________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args

Check warning on line 259 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string --> src/task_monitor/tasks/process_identities.rs:255:13 | 255 | / panic!( 256 | | "Identities are not consecutive leaves in the tree (leaf_indexes = {:?}, \ 257 | | commitments = {:?})", 258 | | leaf_indexes, commitments 259 | | ); | |_____________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args

Check warning on line 259 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string --> src/task_monitor/tasks/process_identities.rs:255:13 | 255 | / panic!( 256 | | "Identities are not consecutive leaves in the tree (leaf_indexes = {:?}, \ 257 | | commitments = {:?})", 258 | | leaf_indexes, commitments 259 | | ); | |_____________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
}

last_index = update.update.leaf_index;
}

Expand Down Expand Up @@ -392,28 +404,28 @@
Ok(())
}

pub async fn delete_identities(
database: &Database,
identity_manager: &IdentityManager,
batching_tree: &TreeVersion<Intermediate>,
updates: &[AppliedTreeUpdate],
prover: ReadOnlyProver<'_, Prover>,
) -> AnyhowResult<()> {
TaskMonitor::log_identities_queues(database).await?;

if updates.is_empty() {
warn!("Identity commit requested with zero identities. Continuing.");
return Ok(());
}

debug!("Starting identity commit for {} identities.", updates.len());

// Grab the initial conditions before the updates are applied to the tree.
let pre_root: U256 = batching_tree.get_root().into();

let mut deletion_indices = updates
.iter()
.map(|f| f.update.leaf_index as u32)

Check warning on line 428 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers

warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers --> src/task_monitor/tasks/process_identities.rs:428:18 | 428 | .map(|f| f.update.leaf_index as u32) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation help: ... or use `try_from` and handle the error accordingly | 428 | .map(|f| u32::try_from(f.update.leaf_index)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 428 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers

warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers --> src/task_monitor/tasks/process_identities.rs:428:18 | 428 | .map(|f| f.update.leaf_index as u32) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation help: ... or use `try_from` and handle the error accordingly | 428 | .map(|f| u32::try_from(f.update.leaf_index)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 428 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers

warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers --> src/task_monitor/tasks/process_identities.rs:428:18 | 428 | .map(|f| f.update.leaf_index as u32) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation help: ... or use `try_from` and handle the error accordingly | 428 | .map(|f| u32::try_from(f.update.leaf_index)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.collect::<Vec<u32>>();

let commitments =
Expand Down Expand Up @@ -454,7 +466,7 @@
// ensure that our batches match that size. We do this by padding deletion
// indices with tree.depth() ^ 2. The deletion prover will skip the proof for
// any deletion with an index greater than the max tree depth
let pad_index = 2_u32.pow(latest_tree_from_updates.depth() as u32);

Check warning on line 469 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers

warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers --> src/task_monitor/tasks/process_identities.rs:469:31 | 469 | let pad_index = 2_u32.pow(latest_tree_from_updates.depth() as u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation help: ... or use `try_from` and handle the error accordingly | 469 | let pad_index = 2_u32.pow(u32::try_from(latest_tree_from_updates.depth())); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 469 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers

warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers --> src/task_monitor/tasks/process_identities.rs:469:31 | 469 | let pad_index = 2_u32.pow(latest_tree_from_updates.depth() as u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation help: ... or use `try_from` and handle the error accordingly | 469 | let pad_index = 2_u32.pow(u32::try_from(latest_tree_from_updates.depth())); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 469 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers

warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers --> src/task_monitor/tasks/process_identities.rs:469:31 | 469 | let pad_index = 2_u32.pow(latest_tree_from_updates.depth() as u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation help: ... or use `try_from` and handle the error accordingly | 469 | let pad_index = 2_u32.pow(u32::try_from(latest_tree_from_updates.depth())); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if commitment_count != batch_size {
let padding = batch_size - commitment_count;
Expand Down Expand Up @@ -517,7 +529,7 @@
let transaction_id = identity_manager
.delete_identities(
proof,
batch_size as u32,

Check warning on line 532 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers

warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers --> src/task_monitor/tasks/process_identities.rs:532:13 | 532 | batch_size as u32, | ^^^^^^^^^^^^^^^^^ | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation help: ... or use `try_from` and handle the error accordingly | 532 | u32::try_from(batch_size), | ~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 532 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers

warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers --> src/task_monitor/tasks/process_identities.rs:532:13 | 532 | batch_size as u32, | ^^^^^^^^^^^^^^^^^ | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation help: ... or use `try_from` and handle the error accordingly | 532 | u32::try_from(batch_size), | ~~~~~~~~~~~~~~~~~~~~~~~~~

Check warning on line 532 in src/task_monitor/tasks/process_identities.rs

View workflow job for this annotation

GitHub Actions / clippy

casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers

warning: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers --> src/task_monitor/tasks/process_identities.rs:532:13 | 532 | batch_size as u32, | ^^^^^^^^^^^^^^^^^ | = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ... = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation help: ... or use `try_from` and handle the error accordingly | 532 | u32::try_from(batch_size), | ~~~~~~~~~~~~~~~~~~~~~~~~~
packed_deletion_indices,
pre_root,
post_root,
Expand Down
Loading