@@ -3,7 +3,7 @@ import { assert, type AsyncOrSync } from "ts-essentials";
33import { type PoolERC20 } from "../typechain-types" ;
44import { NoteInputStruct } from "../typechain-types/contracts/PoolERC20" ;
55import { MpcProverService , type Side } from "./mpc/MpcNetworkService.js" ;
6- import { splitInput , splitInput2 } from "./mpc/utils.js" ;
6+ import { splitInput } from "./mpc/utils.js" ;
77import { type ITreesService } from "./RemoteTreesService.js" ;
88import {
99 CompleteWaAddress ,
@@ -13,6 +13,7 @@ import {
1313 type NoirAndBackend ,
1414 type PoolErc20Service ,
1515} from "./RollupService.js" ;
16+ import { prove } from "./utils.js" ;
1617
1718export class LobService {
1819 constructor (
@@ -69,19 +70,15 @@ export class LobService {
6970 randomness : buyerRandomness ,
7071 } ;
7172
72- const inputPublic = {
73+ const input = {
7374 tree_roots : await this . trees . getTreeRoots ( ) ,
74- } ;
75- const input0 = {
7675 seller_secret_key : params . sellerSecretKey ,
7776 seller_note : await this . poolErc20 . toNoteConsumptionInputs (
7877 params . sellerSecretKey ,
7978 params . sellerNote ,
8079 ) ,
8180 seller_order,
8281 seller_randomness : sellerRandomness ,
83- } ;
84- const input1 = {
8582 buyer_secret_key : params . buyerSecretKey ,
8683 buyer_note : await this . poolErc20 . toNoteConsumptionInputs (
8784 params . buyerSecretKey ,
@@ -90,19 +87,7 @@ export class LobService {
9087 buyer_order,
9188 buyer_randomness : buyerRandomness ,
9289 } ;
93- const inputs0Shared = await splitInput ( swapCircuit . circuit , {
94- // merge public inputs into first input because it does not matter how public inputs are passed
95- ...input0 ,
96- ...inputPublic ,
97- } ) ;
98- const inputs1Shared = await splitInput ( swapCircuit . circuit , input1 ) ;
99- // const { proof } = await prove("swap", swapCircuit, input);
100- const { proof } = await this . mpcProver . prove ( {
101- circuit : swapCircuit . circuit ,
102- inputs0Shared,
103- inputs1Shared,
104- numPublicInputs : 8 ,
105- } ) ;
90+ const { proof } = await prove ( "swap" , swapCircuit , input ) ;
10691 const noteInputs : [
10792 NoteInputStruct ,
10893 NoteInputStruct ,
@@ -176,7 +161,7 @@ export class LobService {
176161 tree_roots : await this . trees . getTreeRoots ( ) ,
177162 }
178163 : undefined ;
179- const inputsShared = await splitInput2 ( swapCircuit . circuit , {
164+ const inputsShared = await splitInput ( swapCircuit . circuit , {
180165 // merge public inputs into first input because it does not matter how public inputs are passed
181166 ...input ,
182167 ...inputPublic ,
@@ -194,7 +179,6 @@ export class LobService {
194179 } ) ;
195180 } ) ,
196181 ) ;
197- console . log ( "got proofs" , proofs . length ) ;
198182 assert ( uniq ( proofs ) . length === 1 , "proofs mismatch" ) ;
199183 const proof = proofs [ 0 ] ! ;
200184 return {
0 commit comments