fix #442: use reflectwalk to walk through circuit structures without building a Schema#444
fix #442: use reflectwalk to walk through circuit structures without building a Schema#444
reflectwalk to walk through circuit structures without building a Schema#444Conversation
ivokub
left a comment
There was a problem hiding this comment.
Seems to be OK.
I understand the change introduces a new way for walking the circuit struct to call some handler on the leafs (for initialising the variables). We do not otherwise change the behaviour (e.g. for compile we still walk several times to first get counts of variables and then build variables separately)? I think it is OK as walking for counting is quite fast.
There is now ParseDeprecated and LeafHandlerDeprecated. I didn't understand fully why they are still necessary, are they for marshalling/unmarshalling? Do we plan to fully deprecate or rewrite?
I do like that the visibility handling became simpler. Seems that it covers all the cases. At some point I fixed some problem when name was set but visibility not and then the parser assumed Secret visibility instead of inhereting, but it seems this is also now covered.
|
Yes behavior is unchanged, we may have some perf issues with very large complex circuits (with multi dimension slices and structs) at compile time, but nothing urgent to fix for now.
|
Closes #442 #433 #390.
Description
Introduces
schema.Walkwhich behaves similarly toschema.Parseexcept it doesn't build aSchema, just visit the leaves.Known issues:
schema.Parseto handlejsonwitnesses (play.gnark.io), and it won't handle all circuit structures wellschema.Walkdoesn't like it if the leaf we are looking for is areflect.Ptr. Only happens in...witnesswhere we want to identify zero values injsonwill probably revisit when it's warranted.Benchmark
Old (parse full schema) vs new (walk):