Skip to content

Commit

Permalink
Revert "Add extra 0 to end of Bool.toBits so that Scalar.fromBits is …
Browse files Browse the repository at this point in the history
…happy" as this is handled in Scalar now

This reverts commit c14178a.
  • Loading branch information
jackryanservia committed Mar 4, 2024
1 parent 8509bdc commit bcf9029
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/lib/nullifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Poseidon } from './hash.js';
import { MerkleMapWitness } from './merkle-map.js';
import { PrivateKey, PublicKey, scaleShifted } from './signature.js';
import { Provable } from './provable.js';
import { Bool } from './bool.js';

export { Nullifier };

Expand Down Expand Up @@ -71,10 +70,7 @@ class Nullifier extends Struct({

// shifted scalar see https://github.com/o1-labs/o1js/blob/5333817a62890c43ac1b9cb345748984df271b62/src/lib/signature.ts#L220
// pk^c
let pk_c = scaleShifted(
this.publicKey,
Scalar.fromBits(c.toBits().concat(new Bool(false)))
);
let pk_c = scaleShifted(this.publicKey, Scalar.fromBits(c.toBits()));

// g^r = g^s / pk^c
let g_r = G.scale(s).sub(pk_c);
Expand All @@ -84,10 +80,7 @@ class Nullifier extends Struct({

// h_m_pk_r = h(m,pk)^s / nullifier^c
let h_m_pk_s_div_nullifier_s = h_m_pk_s.sub(
scaleShifted(
nullifier,
Scalar.fromBits(c.toBits().concat(new Bool(false)))
)
scaleShifted(nullifier, Scalar.fromBits(c.toBits()))
);

// this is supposed to match the entries generated on "the other side" of the nullifier (mina-signer, in an wallet enclave)
Expand Down

0 comments on commit bcf9029

Please sign in to comment.