Open katat opened 6 months ago
I think we might still want to keep it implemented for kimchi to at least be able to keep the tests we have running.
It seems the asm is a must to have feature for all the backends for debugging purposes. So we'd better to keep it as part of the backend interface. Related PR: https://github.com/zksecurity/noname/pull/62
On the other hand we could just require Backend: Display
The Backend: Display may look like this:
impl Display for R1csBls12_381 {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
let asm = self.asm(&crate::compiler::Sources::new(), true);
write!(f, "{}", asm)
}
}
impl R1csBls12_381 {
fn asm(&self, sources: &crate::compiler::Sources, debug: bool) -> String {
...
}
The problem is the sources
argument can't be passed in to the fmt
interface, unless sources
is a field of the backend struct.
Alternatively, we just add a ASM trait for the backend structs to implement if the goal is just to separate these asm related code to its own file.
We could also simply move the asm related to be within impl R1csBls12_381
for example, but that is less generic when it comes to using it.
wait why do we need sources? (oh for debug mode right... then nevermind ^^)
We may not really require
generate_asm
to be implemented for the backend interface. It is not a must have interface to have in order to get the whole system work.So we would just remove this backend interface.