From 3dab6ef2d60edec298f84c90fe8dff7f086cc5f6 Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Sun, 12 Jan 2025 19:07:42 +0100 Subject: [PATCH] [bug] when updating state with values, hash check would have failed if not all values updated --- src/api.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api.rs b/src/api.rs index 7ae5ce0..1700656 100644 --- a/src/api.rs +++ b/src/api.rs @@ -1008,7 +1008,11 @@ pub fn update_process_state(init_commitment: String, state_id: String, hash2valu return Err(ApiError::new("State already existing".to_owned())); } let state_commitments = state.pcd_commitment.to_value_object()?; - let mut new_encrypted_pcd: Map = Map::with_capacity(hash2values_map.len()); + let mut new_encrypted_pcd: Map = state_commitments.iter() + .map(|(field, _)| { + (field.clone(), Value::Null) + }) + .collect(); for (hash, value) in hash2values_map { // Check the hash in pcd_commitment, get the corresponding field name