Consensys / corset

8 stars 12 forks source link

Typing `Instrinsic::Mul` #174

Open DavePearce opened 3 months ago

DavePearce commented 3 months ago

(see also #171)

The typing for Intrinsic::Mul seems off to me. Currently it is defined in common.rs like so:

 pub fn typing(&self, argtype: &[Type]) -> Result<Type> {
        ...
            Intrinsic::Mul => argtype.iter().max().cloned().unwrap_or(Type::INFIMUM),

However, this implies that e.g. x * y has type i128 when x and y have type i128. That does not follow for me.

At this stage, I'm not sure this is causing any actual problems.

delehef commented 3 months ago

This is right. This was written this way under the assumption that the constraint system is written in such a way that multiplication overflow would never deliberately occur, but that may not be valid anymore.