diff --git a/Cargo.toml b/Cargo.toml index 3ad6adfb9..a0929100c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,6 +62,8 @@ zcash_note_encryption = { version = "0.4", features = ["pre-zip-212"] } incrementalmerkletree = { version = "0.4", features = ["test-dependencies"] } [target.'cfg(unix)'.dev-dependencies] +hashbrown = ">= 0.12, <0.13" +dashmap = ">= 5.4, <5.5" inferno = ">= 0.11, < 0.11.15" pprof = { version = "0.9", features = ["criterion", "flamegraph"] } # MSRV 1.56 diff --git a/src/circuit.rs b/src/circuit.rs index a8164c7bc..9d550e5d2 100644 --- a/src/circuit.rs +++ b/src/circuit.rs @@ -224,7 +224,7 @@ impl plonk::Circuit for Circuit { // Constrain split_flag to be boolean // Constrain v_old * (1 - split_flag) - v_new = magnitude * sign (https://p.z.cash/ZKS:action-cv-net-integrity?partial). - // Constrain (v_old = 0 and split_flag = 0) or (calculated root = anchor) (https://p.z.cash/ZKS:action-merkle-path-validity?partial). + // Constrain (v_old = 0 and is_native_asset = 1) or (calculated root = anchor) (https://p.z.cash/ZKS:action-merkle-path-validity?partial). // Constrain v_old = 0 or enable_spends = 1 (https://p.z.cash/ZKS:action-enable-spend). // Constrain v_new = 0 or enable_outputs = 1 (https://p.z.cash/ZKS:action-enable-output). // Constrain is_native_asset to be boolean @@ -278,12 +278,12 @@ impl plonk::Circuit for Circuit { - magnitude * sign, ), // We already checked that - // * split_flag is boolean (just above), and - // * v_old is a 64 bit integer (in the note commitment evaluation). - // So, split_flag + v_old = 0 only when (split_flag = 0 and v_old = 0), no overflow can occur. + // * is_native_asset is boolean (just below), and + // * v_old is a 64 bit unsigned integer (in the note commitment evaluation). + // So, 1 - is_native_asset + v_old = 0 only when (is_native_asset = 1 and v_old = 0), no overflow can occur. ( - "(v_old = 0 and split_flag = 0) or (root = anchor)", - (v_old.clone() + split_flag.clone()) * (root - anchor), + "(v_old = 0 and is_native_asset = 1) or (root = anchor)", + (v_old.clone() + one.clone() - is_native_asset.clone()) * (root - anchor), ), ( "v_old = 0 or enable_spends = 1", diff --git a/src/circuit_description b/src/circuit_description index 863c4e1e2..7a9d35f07 100644 --- a/src/circuit_description +++ b/src/circuit_description @@ -261,20 +261,27 @@ PinnedVerificationKey { ), Product( Sum( - Advice { - query_index: 0, - column_index: 0, - rotation: Rotation( - 0, - ), - }, - Advice { - query_index: 8, - column_index: 8, - rotation: Rotation( - 0, + Sum( + Advice { + query_index: 0, + column_index: 0, + rotation: Rotation( + 0, + ), + }, + Constant( + 0x0000000000000000000000000000000000000000000000000000000000000001, ), - }, + ), + Negated( + Advice { + query_index: 9, + column_index: 9, + rotation: Rotation( + 0, + ), + }, + ), ), Sum( Advice { diff --git a/src/circuit_proof_test_case.bin b/src/circuit_proof_test_case.bin index 5a8711554..9005e06bc 100644 Binary files a/src/circuit_proof_test_case.bin and b/src/circuit_proof_test_case.bin differ