mirror of
https://github.com/tornadocash/websnark.git
synced 2025-01-15 15:38:28 +01:00
change fromSolidityInput and toSolidityInput so single array proof format
This commit is contained in:
parent
ed6a4d8a6f
commit
966eafc47d
15
src/utils.js
15
src/utils.js
@ -67,9 +67,12 @@ function convertWitness(witness) {
|
|||||||
|
|
||||||
function toSolidityInput(proof) {
|
function toSolidityInput(proof) {
|
||||||
const result = {
|
const result = {
|
||||||
pi_a: [proof.pi_a[0], proof.pi_a[1]],
|
proof: [
|
||||||
pi_b: [[proof.pi_b[0][1], proof.pi_b[0][0]], [proof.pi_b[1][1], proof.pi_b[1][0]]],
|
proof.pi_a[0], proof.pi_a[1],
|
||||||
pi_c: [proof.pi_c[0], proof.pi_c[1]],
|
proof.pi_b[0][1], proof.pi_b[0][0],
|
||||||
|
proof.pi_b[1][1], proof.pi_b[1][0],
|
||||||
|
proof.pi_c[0], proof.pi_c[1],
|
||||||
|
]
|
||||||
};
|
};
|
||||||
if (proof.publicSignals) {
|
if (proof.publicSignals) {
|
||||||
result.publicSignals = proof.publicSignals;
|
result.publicSignals = proof.publicSignals;
|
||||||
@ -80,9 +83,9 @@ function toSolidityInput(proof) {
|
|||||||
function fromSolidityInput(proof) {
|
function fromSolidityInput(proof) {
|
||||||
proof = unhexifyBigInts(proof);
|
proof = unhexifyBigInts(proof);
|
||||||
const result = {
|
const result = {
|
||||||
pi_a: [proof.pi_a[0], proof.pi_a[1], bigInt(1)],
|
pi_a: [proof.proof[0], proof.proof[1], bigInt(1)],
|
||||||
pi_b: [[proof.pi_b[0][1], proof.pi_b[0][0]], [proof.pi_b[1][1], proof.pi_b[1][0]], [bigInt(1), bigInt(0)]],
|
pi_b: [[proof.proof[3], proof.proof[2]], [proof.proof[5], proof.proof[4]], [bigInt(1), bigInt(0)]],
|
||||||
pi_c: [proof.pi_c[0], proof.pi_c[1], bigInt(1)]
|
pi_c: [proof.proof[6], proof.proof[7], bigInt(1)]
|
||||||
};
|
};
|
||||||
if (proof.publicSignals) {
|
if (proof.publicSignals) {
|
||||||
result.publicSignals = proof.publicSignals;
|
result.publicSignals = proof.publicSignals;
|
||||||
|
Loading…
Reference in New Issue
Block a user