mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
node/state: Add remaining errors for state transition.
This commit is contained in:
@@ -285,6 +285,9 @@ pub enum VerifyFailed {
|
||||
#[error("Invalid Merkle root for input {0}")]
|
||||
InvalidMerkle(usize),
|
||||
|
||||
#[error("Nullifier already exists for input {0}")]
|
||||
NullifierExists(usize),
|
||||
|
||||
#[error("Invalid signature for input {0}")]
|
||||
InputSignature(usize),
|
||||
|
||||
@@ -303,6 +306,9 @@ pub enum VerifyFailed {
|
||||
#[error("Burn proof verification failure for input {0}")]
|
||||
BurnProof(usize),
|
||||
|
||||
#[error("Failed verifying zk proofs: {0}")]
|
||||
ProofVerifyFailed(String),
|
||||
|
||||
#[error("Internal error: {0}")]
|
||||
InternalError(String),
|
||||
}
|
||||
|
||||
@@ -77,13 +77,17 @@ pub fn state_transition<S: ProgramState>(state: &S, tx: Transaction) -> VerifyRe
|
||||
if state.nullifier_exists(nullifier) {
|
||||
error!(target: "state_transition", "Duplicate nullifier found (input {})", i);
|
||||
debug!(target: "state_transition", "nullifier: {:?}", nullifier);
|
||||
return Err(VerifyFailed::NullifierExists(i))
|
||||
}
|
||||
}
|
||||
|
||||
debug!(target: "state_transition", "Verifying zk proofs");
|
||||
match tx.verify(state.mint_vk(), state.burn_vk()) {
|
||||
Ok(()) => debug!(target: "state_transition", "Verified successfully"),
|
||||
Err(e) => error!(target: "state_transition", "Failed verifying zk proofs: {}", e),
|
||||
Err(e) => {
|
||||
error!(target: "state_transition", "Failed verifying zk proofs: {}", e);
|
||||
return Err(VerifyFailed::ProofVerifyFailed(e.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
// Gather all the nullifiers
|
||||
|
||||
Reference in New Issue
Block a user