Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

R1CS output flatbuffer #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

R1CS output flatbuffer #14

wants to merge 1 commit into from

Conversation

elefthei
Copy link
Collaborator

@elefthei elefthei commented Nov 3, 2020

#11

@elefthei elefthei changed the title Add an additional r1cs output option R1CS output flatbuffer Nov 3, 2020
Copy link
Collaborator

@alex-ozdemir alex-ozdemir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks for doing this.

I think that adding the output format to Cfg is a great idea. My one requested change is for you to continue to develop that idea by:

  • moving R1CS writing into the Cfg monad, and fetching the configuration from that monad.
  • adding an entry to the options list (and an appropriate new field to some record in the Cfg file).
  • ripping out the command-line argument based approach.

I left a few inline comments articulating these steps.

then ByteString.writeFile path $ encode r1cs
else writeFile path $ unlines $ map (unwords . map show) $ r1csAsLines r1cs
writeToR1csFile
:: (Show s, KnownNat n) => R1CSOutput -> R1CS s n -> FilePath -> IO ()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would lift this to the Cfg monad and get the output format from it.

@@ -42,6 +43,8 @@ data SmtOptCfg = SmtOptCfg { _allowSubBlowup :: Bool
, _benesThresh :: Int
} deriving (Show)

data R1CSOutput = Json | Legacy | FlatBuffer deriving (Show, Eq)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add this to the configuration system

Comment on lines +432 to +436
where
parseR1CSOutputFromArgs m | m `isPresent` longOption "json" = Cfg.Json
| m `isPresent` longOption "flatbuffer" = Cfg.FlatBuffer
| otherwise = Cfg.Legacy

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would drop this (and other asJson handling), in favor of a Cfg-based approach.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants