Skip to content

Commit

Permalink
Merge pull request privacy-scaling-explorations#117 from input-output…
Browse files Browse the repository at this point in the history
…-hk/dev-feature/transcript-read

Introduce `TranscriptRead` gadget and chip implementation
  • Loading branch information
b13decker authored Feb 21, 2024
2 parents c2cd90d + 722125a commit 0248a72
Show file tree
Hide file tree
Showing 9 changed files with 1,132 additions and 839 deletions.
11 changes: 7 additions & 4 deletions halo2_gadgets/src/ecc/chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,10 @@ where
/// An enumeration of the possible types of scalars used in variable-base
/// multiplication.
#[derive(Clone, Debug)]
pub enum ScalarVar {
pub enum ScalarVar<C: CurveAffine>
where
C::Scalar: ScalarOrBase<C>,
{
/// An element of the elliptic curve's base field, that is used as a scalar
/// in variable-base scalar mul.
///
Expand All @@ -457,9 +460,9 @@ pub enum ScalarVar {
/// [4.2.3 Orchard Key Components][orchardkeycomponents].)
///
/// [orchardkeycomponents]: https://zips.z.cash/protocol/protocol.pdf#orchardkeycomponents
BaseFieldElem(AssignedCell<pallas::Base, pallas::Base>),
BaseFieldElem(AssignedCell<C::Base, C::Base>),
/// A full-width scalar used for variable-base scalar multiplication.
FullWidth(EccScalarVarFullWidth<pallas::Affine>),
FullWidth(EccScalarVarFullWidth<C>),
}

impl<Fixed: FixedPoints<pallas::Affine>> EccInstructions<pallas::Affine> for EccChip<Fixed>
Expand All @@ -473,7 +476,7 @@ where
{
type ScalarFixed = EccScalarFixed;
type ScalarFixedShort = EccScalarFixedShort;
type ScalarVar = ScalarVar;
type ScalarVar = ScalarVar<pallas::Affine>;
type Point = EccPoint<pallas::Affine>;
type NonIdentityPoint = NonIdentityEccPoint<pallas::Affine>;
type X = AssignedCell<pallas::Base, pallas::Base>;
Expand Down
4 changes: 2 additions & 2 deletions halo2_gadgets/src/poseidon.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! The Poseidon algebraic hash function.

use std::convert::TryInto;
use std::fmt;
use std::marker::PhantomData;
use std::{convert::TryInto, fmt::Debug};

use ff::PrimeField;
use group::ff::Field;
Expand All @@ -28,7 +28,7 @@ pub enum PaddedWord<F: Field> {

/// The set of circuit instructions required to use the Poseidon permutation.
pub trait PoseidonInstructions<F: Field, S: Spec<F, T, RATE>, const T: usize, const RATE: usize>:
Chip<F>
Chip<F> + Debug
{
/// Variable representing the word over which the Poseidon permutation operates.
type Word: Clone + fmt::Debug + From<AssignedCell<F, F>> + Into<AssignedCell<F, F>>;
Expand Down
4 changes: 2 additions & 2 deletions halo2_gadgets/src/poseidon/duplex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ use halo2_proofs::{
circuit::{AssignedCell, Layouter},
plonk::Error,
};
use std::marker::PhantomData;
use std::{fmt::Debug, marker::PhantomData};

/// Instructions for a sponge duplex construction gadget
pub trait DuplexInstructions<F: Field>: Chip<F>
pub trait DuplexInstructions<F: Field>: Chip<F> + Debug
where
Self: Sized,
{
Expand Down
Loading

0 comments on commit 0248a72

Please sign in to comment.