From b7ca8aceb4fae1330ef3e06230d0df44e27e3939 Mon Sep 17 00:00:00 2001 From: krlosMata Date: Fri, 28 Feb 2020 08:28:36 +0100 Subject: [PATCH] section size 8 bytes --- doc/r1cs_bin_format.md | 24 ++++++++++++------------ src/r1csfile.js | 38 ++++++++++++++++++++++++++++---------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/doc/r1cs_bin_format.md b/doc/r1cs_bin_format.md index fbe3ab0..1fd1593 100644 --- a/doc/r1cs_bin_format.md +++ b/doc/r1cs_bin_format.md @@ -507,9 +507,9 @@ The format will be: ┣━━━━━━━━━━━━━━┫ ┃ 03 00 00 00 ┃ nSections ┗━━━━━━━━━━━━━━┛ - ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ - ┃ 01 00 00 00 ┃ 49 00 00 00 ┃ SectionType: Header - ┗━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┛ + ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓ + ┃ 01 00 00 00 ┃ 49 00 00 00 00 00 00 00 ┃ SectionType: Header + ┗━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ ┃ 25 00 00 00 ┃ 10 00 00 00 ┃ FieldDefSize FieldDef ┣━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ @@ -531,9 +531,9 @@ The format will be: ┣━━━━━━━━━━━━━━┫ ┃ 03 00 00 00 ┃ # Constraints ┗━━━━━━━━━━━━━━┛ - ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ - ┃ 02 00 00 00 ┃ 8b 00 00 00 ┃ SectionType: Constraints - ┗━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┛ + ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┓ + ┃ 02 00 00 00 ┃ 8b 00 00 00 00 00 00 00 ┃ SectionType: Constraints + ┗━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┏━━━━━━━━━━━━━━┓ Constraint 0: (3w_5 + 8w_6) * (2w_0 + 20w_2 + 12w_3) - (5w_0 + 7w_2) = 0 ┃ 02 00 00 00 ┃ ┣━━━━━━━━━━━━━━╋━━━━━━━━┓ @@ -598,9 +598,9 @@ The format will be: ┃ 06 00 00 00 ┃ 02 58 02 ┃ ┗━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┛ - ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ - ┃ 03 00 00 00 ┃ 1c 00 00 00 ┃ Wire to Label Map - ┗━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┛ + ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┓ + ┃ 03 00 00 00 ┃ 1c 00 00 00 00 00 00 00 ┃ Wire to Label Map + ┗━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┏━━━━━━━━━━━━━━┓ ┃ 00 00 00 00 ┃ ┣━━━━━━━━━━━━━━┫ @@ -624,7 +624,7 @@ And the binary representation in Hex: 72 31 63 77 01 00 00 00 03 00 00 00 -01 00 00 00 49 00 00 00 +01 00 00 00 49 00 00 00 00 00 00 00 25 00 00 00 10 00 00 00 20 010000f0 93f5e143 9170b979 48e83328 5d588181 b64550b8 29a031e1 724e6430 00 00 00 00 @@ -635,7 +635,7 @@ And the binary representation in Hex: 03 00 00 00 e8 03 00 00 03 00 00 00 -02 00 00 00 8b 00 00 00 +02 00 00 00 8b 00 00 00 00 00 00 00 02 00 00 00 05 00 00 00 01 03 06 00 00 00 01 08 @@ -662,7 +662,7 @@ e8 03 00 00 03 00 00 00 01 05 01 00 00 00 06 00 00 00 02 58 02 -03 00 00 00 1c 00 00 00 +03 00 00 00 1c 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 0a 00 00 00 diff --git a/src/r1csfile.js b/src/r1csfile.js index b81d620..aae65af 100644 --- a/src/r1csfile.js +++ b/src/r1csfile.js @@ -31,7 +31,7 @@ async function loadR1cs(fileName, loadConstraints, loadMap) { let mapSize; for (let i=0; i