Rename `RangeConstrained::subset_of` to `bitrange_of`

This commit is contained in:
Jack Grigg 2022-05-04 23:54:16 +00:00
parent 3ca8c662a4
commit 8c7bb5b95d
3 changed files with 20 additions and 20 deletions

View File

@ -82,6 +82,6 @@ debug = true
debug = true debug = true
[patch.crates-io] [patch.crates-io]
halo2_gadgets = { git = "https://github.com/zcash/halo2.git", rev = "97864d714e33c5258b4ca3f25c9ddc1624e240dd" } halo2_gadgets = { git = "https://github.com/zcash/halo2.git", rev = "3800de59188a73b4e04f689c8bcc855a2fc7fdcf" }
halo2_proofs = { git = "https://github.com/zcash/halo2.git", rev = "97864d714e33c5258b4ca3f25c9ddc1624e240dd" } halo2_proofs = { git = "https://github.com/zcash/halo2.git", rev = "3800de59188a73b4e04f689c8bcc855a2fc7fdcf" }
incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree.git", rev = "f23e3d89507849a24543121839eea6f40b141aff" } incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree.git", rev = "f23e3d89507849a24543121839eea6f40b141aff" }

View File

@ -262,7 +262,7 @@ pub(in crate::circuit) mod gadgets {
let a = MessagePiece::from_subpieces( let a = MessagePiece::from_subpieces(
sinsemilla_chip.clone(), sinsemilla_chip.clone(),
layouter.namespace(|| "a"), layouter.namespace(|| "a"),
[RangeConstrained::subset_of(ak.value(), 0..250)], [RangeConstrained::bitrange_of(ak.value(), 0..250)],
)?; )?;
// `b = b_0||b_1||b_2` // `b = b_0||b_1||b_2`
@ -276,7 +276,7 @@ pub(in crate::circuit) mod gadgets {
250..254, 250..254,
)?; )?;
// b_1 will be boolean-constrained in the custom gate. // b_1 will be boolean-constrained in the custom gate.
let b_1 = RangeConstrained::subset_of(ak.value(), 254..255); let b_1 = RangeConstrained::bitrange_of(ak.value(), 254..255);
// Constrain b_2 to be 5 bits. // Constrain b_2 to be 5 bits.
let b_2 = RangeConstrained::witness_short( let b_2 = RangeConstrained::witness_short(
&lookup_config, &lookup_config,
@ -298,7 +298,7 @@ pub(in crate::circuit) mod gadgets {
let c = MessagePiece::from_subpieces( let c = MessagePiece::from_subpieces(
sinsemilla_chip.clone(), sinsemilla_chip.clone(),
layouter.namespace(|| "c"), layouter.namespace(|| "c"),
[RangeConstrained::subset_of(nk.value(), 5..245)], [RangeConstrained::bitrange_of(nk.value(), 5..245)],
)?; )?;
// `d = d_0||d_1` = (bits 245..=253 of `nk`) || (bit 254 of `nk`) // `d = d_0||d_1` = (bits 245..=253 of `nk`) || (bit 254 of `nk`)
@ -311,7 +311,7 @@ pub(in crate::circuit) mod gadgets {
245..254, 245..254,
)?; )?;
// d_1 will be boolean-constrained in the custom gate. // d_1 will be boolean-constrained in the custom gate.
let d_1 = RangeConstrained::subset_of(nk.value(), 254..255); let d_1 = RangeConstrained::bitrange_of(nk.value(), 254..255);
let d = MessagePiece::from_subpieces( let d = MessagePiece::from_subpieces(
sinsemilla_chip.clone(), sinsemilla_chip.clone(),

View File

@ -143,8 +143,8 @@ impl DecomposeB {
)?; )?;
// b_1, b_2 will be boolean-constrained in the gate. // b_1, b_2 will be boolean-constrained in the gate.
let b_1 = RangeConstrained::subset_of(gd_x.value(), 254..255); let b_1 = RangeConstrained::bitrange_of(gd_x.value(), 254..255);
let b_2 = RangeConstrained::subset_of(gd_y.value(), 0..1); let b_2 = RangeConstrained::bitrange_of(gd_y.value(), 0..1);
// Constrain b_3 to be 4 bits // Constrain b_3 to be 4 bits
let b_3 = RangeConstrained::witness_short( let b_3 = RangeConstrained::witness_short(
@ -282,8 +282,8 @@ impl DecomposeD {
let value_val = value.value().map(|v| pallas::Base::from(v.inner())); let value_val = value.value().map(|v| pallas::Base::from(v.inner()));
// d_0, d_1 will be boolean-constrained in the gate. // d_0, d_1 will be boolean-constrained in the gate.
let d_0 = RangeConstrained::subset_of(pk_d.x().value(), 254..255); let d_0 = RangeConstrained::bitrange_of(pk_d.x().value(), 254..255);
let d_1 = RangeConstrained::subset_of(pk_d.y().value(), 0..1); let d_1 = RangeConstrained::bitrange_of(pk_d.y().value(), 0..1);
// Constrain d_2 to be 8 bits // Constrain d_2 to be 8 bits
let d_2 = RangeConstrained::witness_short( let d_2 = RangeConstrained::witness_short(
@ -294,7 +294,7 @@ impl DecomposeD {
)?; )?;
// d_3 = z1_d from the SinsemillaHash(d) running sum output. // d_3 = z1_d from the SinsemillaHash(d) running sum output.
let d_3 = RangeConstrained::subset_of(value_val.as_ref(), 8..58); let d_3 = RangeConstrained::bitrange_of(value_val.as_ref(), 8..58);
let d = MessagePiece::from_subpieces( let d = MessagePiece::from_subpieces(
chip, chip,
@ -527,7 +527,7 @@ impl DecomposeG {
Error, Error,
> { > {
// g_0 will be boolean-constrained in the gate. // g_0 will be boolean-constrained in the gate.
let g_0 = RangeConstrained::subset_of(rho.value(), 254..255); let g_0 = RangeConstrained::bitrange_of(rho.value(), 254..255);
// Constrain g_1 to be 9 bits. // Constrain g_1 to be 9 bits.
let g_1 = RangeConstrained::witness_short( let g_1 = RangeConstrained::witness_short(
@ -538,7 +538,7 @@ impl DecomposeG {
)?; )?;
// g_2 = z1_g from the SinsemillaHash(g) running sum output. // g_2 = z1_g from the SinsemillaHash(g) running sum output.
let g_2 = RangeConstrained::subset_of(psi.value(), 9..249); let g_2 = RangeConstrained::bitrange_of(psi.value(), 9..249);
let g = MessagePiece::from_subpieces( let g = MessagePiece::from_subpieces(
chip, chip,
@ -659,7 +659,7 @@ impl DecomposeH {
)?; )?;
// h_1 will be boolean-constrained in the gate. // h_1 will be boolean-constrained in the gate.
let h_1 = RangeConstrained::subset_of(psi.value(), 254..255); let h_1 = RangeConstrained::bitrange_of(psi.value(), 254..255);
let h = MessagePiece::from_subpieces( let h = MessagePiece::from_subpieces(
chip, chip,
@ -667,7 +667,7 @@ impl DecomposeH {
[ [
h_0.value(), h_0.value(),
h_1, h_1,
RangeConstrained::subset_of(Some(&pallas::Base::zero()), 0..4), RangeConstrained::bitrange_of(Some(&pallas::Base::zero()), 0..4),
], ],
)?; )?;
@ -1589,7 +1589,7 @@ pub(in crate::circuit) mod gadgets {
let a = MessagePiece::from_subpieces( let a = MessagePiece::from_subpieces(
chip.clone(), chip.clone(),
layouter.namespace(|| "a"), layouter.namespace(|| "a"),
[RangeConstrained::subset_of(g_d.x().value(), 0..250)], [RangeConstrained::bitrange_of(g_d.x().value(), 0..250)],
)?; )?;
// b = b_0 || b_1 || b_2 || b_3 // b = b_0 || b_1 || b_2 || b_3
@ -1601,7 +1601,7 @@ pub(in crate::circuit) mod gadgets {
let c = MessagePiece::from_subpieces( let c = MessagePiece::from_subpieces(
chip.clone(), chip.clone(),
layouter.namespace(|| "c"), layouter.namespace(|| "c"),
[RangeConstrained::subset_of(pk_d.x().value(), 4..254)], [RangeConstrained::bitrange_of(pk_d.x().value(), 4..254)],
)?; )?;
// d = d_0 || d_1 || d_2 || d_3 // d = d_0 || d_1 || d_2 || d_3
@ -1617,7 +1617,7 @@ pub(in crate::circuit) mod gadgets {
let f = MessagePiece::from_subpieces( let f = MessagePiece::from_subpieces(
chip.clone(), chip.clone(),
layouter.namespace(|| "f"), layouter.namespace(|| "f"),
[RangeConstrained::subset_of(rho.value(), 4..254)], [RangeConstrained::bitrange_of(rho.value(), 4..254)],
)?; )?;
// g = g_0 || g_1 || g_2 // g = g_0 || g_1 || g_2
@ -1943,7 +1943,7 @@ pub(in crate::circuit) mod gadgets {
)?; )?;
// k_1 will be constrained by the decomposition of j. // k_1 will be constrained by the decomposition of j.
let k_1 = RangeConstrained::subset_of(y.value(), 10..250); let k_1 = RangeConstrained::bitrange_of(y.value(), 10..250);
// Range-constrain k_2 to be 4 bits. // Range-constrain k_2 to be 4 bits.
let k_2 = RangeConstrained::witness_short( let k_2 = RangeConstrained::witness_short(
@ -1954,7 +1954,7 @@ pub(in crate::circuit) mod gadgets {
)?; )?;
// k_3 will be boolean-constrained in the gate. // k_3 will be boolean-constrained in the gate.
let k_3 = RangeConstrained::subset_of(y.value(), 254..255); let k_3 = RangeConstrained::bitrange_of(y.value(), 254..255);
// Decompose j = LSB + (2)k_0 + (2^10)k_1 using 25 ten-bit lookups. // Decompose j = LSB + (2)k_0 + (2^10)k_1 using 25 ten-bit lookups.
let (j, z1_j, z13_j) = { let (j, z1_j, z13_j) = {