diff --git a/src/ZkFold/Symbolic/Compiler/ArithmeticCircuit/Internal.hs b/src/ZkFold/Symbolic/Compiler/ArithmeticCircuit/Internal.hs index b0a8ee74e..5341e1122 100644 --- a/src/ZkFold/Symbolic/Compiler/ArithmeticCircuit/Internal.hs +++ b/src/ZkFold/Symbolic/Compiler/ArithmeticCircuit/Internal.hs @@ -207,7 +207,7 @@ toVar :: toVar witness = runHash @(Just (Order a)) $ witness $ \case SysVar (InVar inV) -> merkleHash inV SysVar (NewVar newV) -> M newV - ConstVar cV -> merkleHash cV + ConstVar cV -> fromConstant cV ----------------------------- Evaluation functions ----------------------------- diff --git a/src/ZkFold/Symbolic/Compiler/ArithmeticCircuit/MerkleHash.hs b/src/ZkFold/Symbolic/Compiler/ArithmeticCircuit/MerkleHash.hs index bb4021150..98b5709b4 100644 --- a/src/ZkFold/Symbolic/Compiler/ArithmeticCircuit/MerkleHash.hs +++ b/src/ZkFold/Symbolic/Compiler/ArithmeticCircuit/MerkleHash.hs @@ -17,7 +17,7 @@ import ZkFold.Base.Data.ByteString (toByteString) newtype MerkleHash (n :: Maybe Natural) = M { runHash :: ByteString } -data Prec = Add | Mul | Div | Mod | Exp deriving (Generic, Binary) +data Prec = Add | Mul | Div | Mod | Exp | Const deriving (Generic, Binary) merkleHash :: Binary a => a -> MerkleHash n merkleHash = M . hash . toByteString @@ -34,7 +34,7 @@ instance {-# OVERLAPPING #-} FromConstant (MerkleHash n) (MerkleHash n) instance {-# OVERLAPPING #-} Scale (MerkleHash n) (MerkleHash n) instance Binary a => FromConstant a (MerkleHash n) where - fromConstant = merkleHash + fromConstant x = merkleHash (Const, x) instance Binary a => Scale a (MerkleHash n)