Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle epsilon transitions #88

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

shreyas-londhe
Copy link
Member

Fix uninitialized AND gate in email regex circuit

Bug

The email regex circuit was failing due to uninitialized AND gates caused by epsilon transitions (empty character set transitions) in the DFA. These epsilon transitions were created from optional patterns (?) and zero-or-more quantifiers (*) in the regex.

Fix

Added remove_epsilon_transitions function to clean the DFA graph by removing transitions with empty character sets before circuit generation. This ensures all AND gates in the resulting circuit have proper inputs.

Testing

  • Added comprehensive test cases for the email regex pattern in dfa_tests.json
  • Tests cover various email formats including:
    • Basic email addresses
    • Display names with angle brackets
    • Multiple-part local segments
    • Both \r\n and ^ anchors

Impact

This fix makes the email regex circuit more reliable by eliminating uninitialized gates while maintaining the same matching behavior.

Copy link

socket-security bot commented Feb 12, 2025

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher

🚮 Removed packages: npm/[email protected], npm/[email protected]

View full report↗︎

@shreyas-londhe shreyas-londhe changed the title Fix/epsilon transitions fix: epsilon transitions Feb 12, 2025
@shreyas-londhe shreyas-londhe changed the title fix: epsilon transitions fix: handle epsilon transitions Feb 12, 2025
@shreyas-londhe shreyas-londhe force-pushed the fix/epsilon-transitions branch from 1b9d429 to 318f90c Compare February 12, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants