Replace new_state_merkle_root with state_id in UserDiff
This commit is contained in:
parent
7d0aa89387
commit
6d82333a49
@ -91,7 +91,7 @@ pub enum DiffStatus {
|
|||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub struct UserDiff {
|
pub struct UserDiff {
|
||||||
pub process_id: String,
|
pub process_id: String,
|
||||||
pub new_state_merkle_root: String, // TODO add a merkle proof that the new_value belongs to that state
|
pub state_id: String, // TODO add a merkle proof that the new_value belongs to that state
|
||||||
pub value_commitment: String,
|
pub value_commitment: String,
|
||||||
pub field: String,
|
pub field: String,
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
@ -734,7 +734,7 @@ fn create_diffs(process: &Process, new_state: &ProcessState) -> AnyhowResult<Vec
|
|||||||
let previous_value = clear_prev_state.get(field.as_str()).unwrap().clone();
|
let previous_value = clear_prev_state.get(field.as_str()).unwrap().clone();
|
||||||
diffs.push(UserDiff {
|
diffs.push(UserDiff {
|
||||||
process_id: process_id.clone(),
|
process_id: process_id.clone(),
|
||||||
new_state_merkle_root: new_state_root.to_owned(),
|
state_id: new_state_root.to_owned(),
|
||||||
value_commitment: new_hash.as_str().unwrap().to_string(),
|
value_commitment: new_hash.as_str().unwrap().to_string(),
|
||||||
field: field.to_owned(),
|
field: field.to_owned(),
|
||||||
description,
|
description,
|
||||||
@ -758,7 +758,7 @@ fn create_diffs(process: &Process, new_state: &ProcessState) -> AnyhowResult<Vec
|
|||||||
let need_validation = if (is_pairing && field.as_str() == "roles" && new_value != Value::Null) || fields_to_validate.contains(field) { true } else { false };
|
let need_validation = if (is_pairing && field.as_str() == "roles" && new_value != Value::Null) || fields_to_validate.contains(field) { true } else { false };
|
||||||
diffs.push(UserDiff {
|
diffs.push(UserDiff {
|
||||||
process_id: process_id.clone(),
|
process_id: process_id.clone(),
|
||||||
new_state_merkle_root: new_state_root.to_owned(),
|
state_id: new_state_root.to_owned(),
|
||||||
value_commitment: hash.as_str().unwrap().to_string(),
|
value_commitment: hash.as_str().unwrap().to_string(),
|
||||||
field: field.to_owned(),
|
field: field.to_owned(),
|
||||||
description,
|
description,
|
||||||
|
@ -188,7 +188,7 @@ fn test_pairing() {
|
|||||||
// Alice keeps track of the change she needs to validate
|
// Alice keeps track of the change she needs to validate
|
||||||
let create_process_diffs = updated_process.new_diffs;
|
let create_process_diffs = updated_process.new_diffs;
|
||||||
|
|
||||||
let new_state_id = &create_process_diffs.get(0).unwrap().new_state_merkle_root;
|
let new_state_id = &create_process_diffs.get(0).unwrap().state_id;
|
||||||
|
|
||||||
alice_diff_cache.extend(create_process_diffs.iter());
|
alice_diff_cache.extend(create_process_diffs.iter());
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ fn test_pairing() {
|
|||||||
let state = process.get_state_for_id(&new_state_id).unwrap();
|
let state = process.get_state_for_id(&new_state_id).unwrap();
|
||||||
|
|
||||||
let hash2values: Map<String, Value> = bob_diff_cache.iter()
|
let hash2values: Map<String, Value> = bob_diff_cache.iter()
|
||||||
.filter(|diff| diff.new_state_merkle_root == *new_state_id)
|
.filter(|diff| diff.state_id == *new_state_id)
|
||||||
.map(|diff| {
|
.map(|diff| {
|
||||||
let encrypted_value = state.encrypted_pcd.as_object().unwrap().get(&diff.field).unwrap();
|
let encrypted_value = state.encrypted_pcd.as_object().unwrap().get(&diff.field).unwrap();
|
||||||
(diff.value_commitment.clone(), encrypted_value.clone())
|
(diff.value_commitment.clone(), encrypted_value.clone())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user