mirror of https://github.com/zcash/halo2.git
Add `OrchardFixedBasesFull::{generator, u}` methods
Using these in `OrchardFixedBases::{generator, u}` instead of the `impl From<OrchardFixedBasesFull> for OrchardFixedBase` means we avoid computing the Lagrange coefficients for the generator (which were then immediately dropped). This decreases proving time in the Action circuit by 53%.
This commit is contained in:
parent
09b4da197d
commit
b15343f6f7
|
@ -48,20 +48,14 @@ impl OrchardFixedBases {
|
|||
pub fn generator(self) -> pallas::Affine {
|
||||
match self {
|
||||
Self::ValueCommitV => constants::value_commit_v::generator(),
|
||||
Self::Full(base) => {
|
||||
let base: OrchardFixedBase = base.into();
|
||||
base.generator
|
||||
}
|
||||
Self::Full(base) => base.generator(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn u(self) -> Vec<WindowUs> {
|
||||
match self {
|
||||
Self::ValueCommitV => ValueCommitV::get().u_short.0.as_ref().to_vec(),
|
||||
Self::Full(base) => {
|
||||
let base: OrchardFixedBase = base.into();
|
||||
base.u.0.as_ref().to_vec()
|
||||
}
|
||||
Self::Full(base) => base.u().0.as_ref().to_vec(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,28 @@ pub enum OrchardFixedBasesFull {
|
|||
SpendAuthG,
|
||||
}
|
||||
|
||||
impl OrchardFixedBasesFull {
|
||||
pub fn generator(&self) -> pallas::Affine {
|
||||
match self {
|
||||
OrchardFixedBasesFull::CommitIvkR => super::commit_ivk_r::generator(),
|
||||
OrchardFixedBasesFull::NoteCommitR => super::note_commit_r::generator(),
|
||||
OrchardFixedBasesFull::NullifierK => super::nullifier_k::generator(),
|
||||
OrchardFixedBasesFull::ValueCommitR => super::value_commit_r::generator(),
|
||||
OrchardFixedBasesFull::SpendAuthG => super::spend_auth_g::generator(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn u(&self) -> U {
|
||||
match self {
|
||||
OrchardFixedBasesFull::CommitIvkR => super::commit_ivk_r::U.into(),
|
||||
OrchardFixedBasesFull::NoteCommitR => super::note_commit_r::U.into(),
|
||||
OrchardFixedBasesFull::NullifierK => super::nullifier_k::U.into(),
|
||||
OrchardFixedBasesFull::ValueCommitR => super::value_commit_r::U.into(),
|
||||
OrchardFixedBasesFull::SpendAuthG => super::spend_auth_g::U.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A fixed base to be used in scalar multiplication with a full-width scalar.
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct OrchardFixedBase {
|
||||
|
|
Loading…
Reference in New Issue