secretflow / yacl

YACL (Yet Another Common crypto library) is a C++ library that contains cryptography, network and io modules which other SecretFlow code depends on.
Apache License 2.0
73 stars 61 forks source link

The enforcement in `bristol_fashion` is not precise #356

Closed maths644311798 closed 2 weeks ago

maths644311798 commented 1 month ago

In yacl/io/circuit/bristol_fashion.cc, ReadAllGates() YACL_ENFORCE(splits.size() >= circ_->gates[i].niw + circ_->gates[i].now + 2); The >= should be > .

And YACL_ENFORCE(circ_->gates[i].now == 1) is strange, for MAND gate could have many output wires.

maths644311798 commented 1 month ago

In circuit_executor_test.cc, ReverseBytes does not reverse bits, but reverses bytes. The annotation thus bit 0 becomes bit 127 etc is not precise.

Jamie-Cui commented 1 month ago

The >= should be >

Yes, this indeed should be >

And YACLENFORCE(circ->gates[i].now == 1) is strange, for MAND gate could have many output wires.

Yes, this is a known issue. And we're still working on proper ways to support the MAND gate. Also, since are not not using MAND gate in all pre-built-in circuits, it's okay for now.

In circuit_executor_test.cc, ReverseBytes does not reversie bits, but reverses bytes. The annotation thus bit 0 becomes bit 127 etc is not precise.

see: https://nigelsmart.github.io/MPC-Circuits/, that comment is a quote from this webpage.

Jamie-Cui commented 1 month ago

BTW. since there are indeed unfinished features, you could leave this issue open till it's fully resolved