From 9fbb74fadba3dd3d9fa900e98af300f36597d93e Mon Sep 17 00:00:00 2001 From: Geoff Lamperd Date: Mon, 11 Dec 2023 15:37:17 +1000 Subject: [PATCH] fix: r1cs oiteration exit once s1 read --- packages/actions/src/helpers/utils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/actions/src/helpers/utils.ts b/packages/actions/src/helpers/utils.ts index fcde7ac6..4abaecd2 100644 --- a/packages/actions/src/helpers/utils.ts +++ b/packages/actions/src/helpers/utils.ts @@ -424,9 +424,10 @@ export const getR1CSInfo = (localR1CSFilePath: string): CircuitMetadata => { // Jump to first section. pointer = 12 + let found = false // For each section - for (let i = 0; i < numberOfSections; i++) { + for (let i = 0; i < numberOfSections && !found; i++) { // Read section type. const sectionType = ffUtils.leBuff2int(readBytesFromFile(localR1CSFilePath, 0, 4, pointer)) @@ -485,6 +486,8 @@ export const getR1CSInfo = (localR1CSFilePath: string): CircuitMetadata => { pointer += 8 constraints = Number(ffUtils.leBuff2int(readBytesFromFile(localR1CSFilePath, 0, 4, pointer))) + + found = true } pointer += 8 + Number(sectionSize)