gnark icon indicating copy to clipboard operation
gnark copied to clipboard

feat: add printf support for circuit debugging

Open crStiv opened this issue 10 months ago • 1 comments

Description

Adds Printf functionality to the frontend.API interface with format specifiers support for better circuit debugging capabilities. This allows developers to debug circuit variables with formatted output similar to fmt.Printf.

Fixes #1239

Type of change

  • [x] New feature (non-breaking change which adds functionality)

How has this been tested?

  • [x] Unit tests in examples/printf_example_test.go verify basic functionality
  • [x] Example circuit in examples/printf_example.go demonstrates all format specifiers (%d, %x, %b, %v)
  • [x] Tests verify circuit compilation and execution with Printf statements

How has this been benchmarked?

Not applicable - this is a debugging feature that is not used in production circuits.

Checklist:

  • [x] I have performed a self-review of my code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] I did not modify files generated from templates
  • [x] New and existing unit tests pass locally with my changes

crStiv avatar Feb 26 '25 21:02 crStiv

hi @ivokub, made some changes and fixed tests and ci errors, could you please review it when you'll have a chance and tell me if its ok or if I need to change something :)

crStiv avatar Apr 05 '25 17:04 crStiv