@@ -28,7 +28,6 @@ import Keelung.Syntax.Counters
28
28
import Keelung.CircuitFormat hiding (WtnsBinHeader (.. ))
29
29
import Keelung (FieldType (.. ))
30
30
import Data.Int (Int64 )
31
- import GHC.Num (integerLogBase )
32
31
import Debug.Trace
33
32
34
33
-- | IMPORTANT: Make sure major, minor and patch versions are updated
@@ -68,8 +67,11 @@ serializeInputAndWitnessToBin p witnessVec =
68
67
toLazyByteString $
69
68
int32LE (fromIntegral (primeLen p))
70
69
<> lazyByteString primeBS
71
- <> int32LE (fromIntegral $ length witnesses)
72
- wtnses = toLazyByteString $ mconcat (fitPrimeSize p 1 : map (fitPrimeSize p . mod p . fromIntegral ) witnesses)
70
+ <> int32LE (fromIntegral $ length witnesses + 1 )
71
+ wtnses = toLazyByteString $ mconcat (fitPrimeSize p 1 : map (fitPrimeSize p . toInteger ) witnesses)
72
+ -- "wtns, version 2, 2 sections"
73
+ meta :: ByteString
74
+ meta = BS. pack [0x77 , 0x74 , 0x6e , 0x73 , 0x02 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 ]
73
75
in meta
74
76
<> BS. pack [0x01 , 0x00 , 0x00 , 0x00 ]
75
77
<> secLength header
@@ -79,9 +81,6 @@ serializeInputAndWitnessToBin p witnessVec =
79
81
<> wtnses
80
82
where
81
83
secLength = toLazyByteString . word64LE . fromIntegral . BS. length
82
- -- "wtns, version 2, 2 sections"
83
- meta :: ByteString
84
- meta = BS. pack [0x77 , 0x74 , 0x6e , 0x73 , 0x02 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 ]
85
84
--------------------------------------------------------------------------------
86
85
87
86
-- | Encodes a R1CS in the JSON Lines text file format
0 commit comments