libSTARK icon indicating copy to clipboard operation
libSTARK copied to clipboard

Fix typos in ALU.cpp and add missing opcodes

Open jimouris opened this issue 7 years ago • 2 comments

As stated in #15 UMOD seems to be broken.

There has been a typo in ALU.cpp and it was

components_[Opcode::UMOD] = ALU_UDIV_Gadget::create(pb_, inputVariables_, resultVariables_);

instead of

components_[Opcode::UMOD] = ALU_UMOD_Gadget::create(pb_, inputVariables_, resultVariables_);

That was probably a problem with UMOD, however it still seems to be broken.

jimouris avatar Dec 06 '18 14:12 jimouris

There seems to be another typo in ALU.cpp: enforceBooleanity(witnessRemainder_[i], Opcode::UMOD) in ALU_UDIV_Gadget::generateConstraints()

I think that the unit test of UMOD should pass just fine, but yes it will still be broken when used in a TinyRAM program because it's absent from the switch statements of tinyram/stark-tinyram/src/TinyRAMtoBair/RamToContraintSystem/traceConsistency.cpp (it's easy to add the missing opcodes there, and then create a TinyRAM program to test it).

iddo333 avatar Dec 06 '18 23:12 iddo333

Thanks @iddo333 , I have changed the second UMOD typo and added the missing opcodes (UDIV and others were also missing). Seems ok now.

jimouris avatar Dec 07 '18 10:12 jimouris