Skip to content

Commit 928db02

Browse files
authored
Merge pull request #4648 from ethereum/fix-circom-parsing
Fix parsing bug when typing an array value as witness input.
2 parents d939f49 + 5fc450e commit 928db02

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

apps/circuit-compiler/src/app/components/witness.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,20 @@ export function WitnessSection ({ plugin, signalInputs, status }: {plugin: Circo
1212
const handleSignalInput = (e: any) => {
1313
let value = e.target.value
1414

15-
try {
16-
value = remixLib.execution.txFormat.parseFunctionParams(value)
17-
} catch (e) {
15+
if (value.startsWith('[') && value.endsWith(']')) {
16+
try {
17+
value = remixLib.execution.txFormat.parseFunctionParams(value)
18+
} catch (e) {
1819
// do nothing
20+
}
21+
} else if (value.startsWith('[') && !value.endsWith(']')) {
22+
// do nothing
23+
} else {
24+
try {
25+
value = remixLib.execution.txFormat.parseFunctionParams(value)
26+
} catch (e) {
27+
// do nothing
28+
}
1929
}
2030
setWitnessValues({
2131
...witnessValues,

0 commit comments

Comments
 (0)