Replace commitment_tx with process_id
This commit is contained in:
parent
079156d86a
commit
4be53916b0
22
src/prd.rs
22
src/prd.rs
@ -57,7 +57,7 @@ impl AnkPrdHash {
|
|||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub struct Prd {
|
pub struct Prd {
|
||||||
pub prd_type: PrdType,
|
pub prd_type: PrdType,
|
||||||
pub root_commitment: String,
|
pub process_id: String,
|
||||||
pub sender: String,
|
pub sender: String,
|
||||||
pub keys: Map<String, Value>, // key is a key in pcd, value is the key to decrypt it
|
pub keys: Map<String, Value>, // key is a key in pcd, value is the key to decrypt it
|
||||||
pub pcd_commitments: Value,
|
pub pcd_commitments: Value,
|
||||||
@ -75,7 +75,7 @@ impl Prd {
|
|||||||
let validation_tokens = if let Some(proof) = previous_proof { vec![proof] } else { vec![] };
|
let validation_tokens = if let Some(proof) = previous_proof { vec![proof] } else { vec![] };
|
||||||
Self {
|
Self {
|
||||||
prd_type: PrdType::Connect,
|
prd_type: PrdType::Connect,
|
||||||
root_commitment: String::default(),
|
process_id: String::default(),
|
||||||
pcd_commitments: Value::Null,
|
pcd_commitments: Value::Null,
|
||||||
sender: serde_json::to_string(&sender).unwrap(),
|
sender: serde_json::to_string(&sender).unwrap(),
|
||||||
validation_tokens,
|
validation_tokens,
|
||||||
@ -86,7 +86,7 @@ impl Prd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_update(
|
pub fn new_update(
|
||||||
root_commitment: OutPoint,
|
process_id: OutPoint,
|
||||||
sender: Member,
|
sender: Member,
|
||||||
roles: HashMap<String, RoleDefinition>,
|
roles: HashMap<String, RoleDefinition>,
|
||||||
keys: Map<String, Value>,
|
keys: Map<String, Value>,
|
||||||
@ -94,7 +94,7 @@ impl Prd {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
prd_type: PrdType::Update,
|
prd_type: PrdType::Update,
|
||||||
root_commitment: root_commitment.to_string(),
|
process_id: process_id.to_string(),
|
||||||
sender: serde_json::to_string(&sender).unwrap(),
|
sender: serde_json::to_string(&sender).unwrap(),
|
||||||
validation_tokens: vec![],
|
validation_tokens: vec![],
|
||||||
keys,
|
keys,
|
||||||
@ -105,14 +105,14 @@ impl Prd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_response(
|
pub fn new_response(
|
||||||
root_commitment: OutPoint,
|
process_id: OutPoint,
|
||||||
sender: Member,
|
sender: Member,
|
||||||
validation_tokens: Vec<Proof>,
|
validation_tokens: Vec<Proof>,
|
||||||
pcd_commitments: Value,
|
pcd_commitments: Value,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
prd_type: PrdType::Response,
|
prd_type: PrdType::Response,
|
||||||
root_commitment: root_commitment.to_string(),
|
process_id: process_id.to_string(),
|
||||||
sender: serde_json::to_string(&sender).unwrap(),
|
sender: serde_json::to_string(&sender).unwrap(),
|
||||||
validation_tokens: validation_tokens,
|
validation_tokens: validation_tokens,
|
||||||
keys: Map::new(),
|
keys: Map::new(),
|
||||||
@ -123,13 +123,13 @@ impl Prd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_confirm(
|
pub fn new_confirm(
|
||||||
root_commitment: OutPoint,
|
process_id: OutPoint,
|
||||||
sender: Member,
|
sender: Member,
|
||||||
pcd_commitments: Value,
|
pcd_commitments: Value,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
prd_type: PrdType::Confirm,
|
prd_type: PrdType::Confirm,
|
||||||
root_commitment: root_commitment.to_string(),
|
process_id: process_id.to_string(),
|
||||||
pcd_commitments,
|
pcd_commitments,
|
||||||
sender: serde_json::to_string(&sender).unwrap(),
|
sender: serde_json::to_string(&sender).unwrap(),
|
||||||
validation_tokens: vec![],
|
validation_tokens: vec![],
|
||||||
@ -139,10 +139,10 @@ impl Prd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_request(root_commitment: OutPoint, sender: Member, state_ids: Vec<[u8; 32]>) -> Self {
|
pub fn new_request(process_id: OutPoint, sender: Member, state_ids: Vec<[u8; 32]>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
prd_type: PrdType::Request,
|
prd_type: PrdType::Request,
|
||||||
root_commitment: root_commitment.to_string(),
|
process_id: process_id.to_string(),
|
||||||
sender: serde_json::to_string(&sender).unwrap(),
|
sender: serde_json::to_string(&sender).unwrap(),
|
||||||
payload: serde_json::to_string(&state_ids).unwrap(),
|
payload: serde_json::to_string(&state_ids).unwrap(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -183,7 +183,7 @@ impl Prd {
|
|||||||
}
|
}
|
||||||
proof.verify()?;
|
proof.verify()?;
|
||||||
} else {
|
} else {
|
||||||
log::warn!("No proof for prd with root_commitment {}", prd.root_commitment);
|
log::warn!("No proof for prd with process_id {}", prd.process_id);
|
||||||
}
|
}
|
||||||
Ok(prd)
|
Ok(prd)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user