From c77a9e063953a9cd976b2f72cba5a34a687d37d8 Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Thu, 11 Jul 2024 16:26:15 +0100 Subject: [PATCH] remove public parameters from custom inputs in orchestration (because they are already input anyway) --- .../javascript/raw/toOrchestration.ts | 20 +------------------ .../visitors/toOrchestrationVisitor.ts | 5 ++--- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/boilerplate/orchestration/javascript/raw/toOrchestration.ts b/src/boilerplate/orchestration/javascript/raw/toOrchestration.ts index c6878de0..59925a05 100644 --- a/src/boilerplate/orchestration/javascript/raw/toOrchestration.ts +++ b/src/boilerplate/orchestration/javascript/raw/toOrchestration.ts @@ -894,28 +894,10 @@ export const OrchestrationCodeBoilerPlate: any = (node: any) => { lines.push(`${input.name}.hex(20)`); } else { - lines.push(`${input.name}.integer`); + lines.push(`${input}.integer`); } }); } - if (node.publicInputs[0]) { - node.publicInputs.forEach((input: any) => { - if (input.inCircuit){ - if (input.properties) { - returnInputs.push(`[${input.properties.map(p => p.type === 'bool' ? `(${input.name}${input.isConstantArray ? '.all' : ''}.${p.name}.integer === "1")` : `${input.name}${input.isConstantArray ? '.all' : ''}.${p.name}.integer`).join(',')}]`); - } else if (input.isConstantArray) { - returnInputs.push(`${input.name}.all.integer`); - } else if(input.isBool) { - returnInputs.push(`parseInt(${input.name}.integer, 10)`); - } else if(input.isAddress) { - returnInputs.push(`${input.name}.hex(20)`); - } - else { - returnInputs.push(`${input.name}.integer`); - } - } - }); - } if(node.returnInputs[0]) { node.returnInputs.forEach((input: any) => { diff --git a/src/transformers/visitors/toOrchestrationVisitor.ts b/src/transformers/visitors/toOrchestrationVisitor.ts index cf47c652..21808f41 100644 --- a/src/transformers/visitors/toOrchestrationVisitor.ts +++ b/src/transformers/visitors/toOrchestrationVisitor.ts @@ -863,16 +863,15 @@ const visitor = { // this adds other values we need in the tx for (const param of node.parameters.parameters) { if (!param.isSecret) { - //if (path.isStructDeclaration(param) || path.isConstantArray(param) ||( param.typeName && param.typeName.name === 'bool') || ( param.typeName && param.typeName.name === 'address')) { + if (path.isStructDeclaration(param) || path.isConstantArray(param) ||( param.typeName && param.typeName.name === 'bool') || ( param.typeName && param.typeName.name === 'address')) { let newParam: any = {}; newParam.name = param.name; - if (param._newASTPointer.interactsWithSecret) newParam.inCircuit = true; if (path.isStructDeclaration(param)) newParam.properties = param._newASTPointer.typeName.properties.map(p => ({"name" : p.name, "type" : p.type })); if (path.isConstantArray(param)) newParam.isConstantArray = true; if (param.typeName?.name === 'bool') newParam.isBool = true; if (param.typeName?.name === 'address') newParam.isAddress = true; newNodes.sendTransactionNode.publicInputs.push(newParam); - //} else newNodes.sendTransactionNode.publicInputs.push(param.name); + } else newNodes.sendTransactionNode.publicInputs.push(param.name); } } // this adds the return parameters which are marked as secret in the tx