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

Serialization with modes #145

Closed
weikengchen opened this issue Dec 17, 2020 · 1 comment · Fixed by #463
Closed

Serialization with modes #145

weikengchen opened this issue Dec 17, 2020 · 1 comment · Fixed by #463

Comments

@weikengchen
Copy link
Member

weikengchen commented Dec 17, 2020

When I was implementing serialization for certain data structures (manually), there appears to be a lot of repeated code that just calls the underlying function differently (e.g., deserialize vs deserialize_uncompressed).

This is similar to what has happened to AllocVar (https://github.com/arkworks-rs/r1cs-std/blob/master/src/alloc.rs#L9), which we eventually introduce modes:

/// Describes the mode that a variable should be allocated in within
/// a `ConstraintSystem`.
#[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Copy, Clone)]
pub enum AllocationMode {
    /// Indicate to the `ConstraintSystem` that the high-level variable should
    /// be allocated as a constant. That is, no `Variable`s should be
    /// generated.
    Constant = 0,

    /// Indicate to the `ConstraintSystem` that the high-level variable should
    /// be allocated as a public input to the `ConstraintSystem`.
    Input = 1,

    /// Indicate to the `ConstraintSystem` that the high-level variable should
    /// be allocated as a private witness to the `ConstraintSystem`.
    Witness = 2,
}
@Pratyush
Copy link
Member

See also the discussion here: #130 (comment)

@Pratyush Pratyush closed this as completed Sep 2, 2022
@Pratyush Pratyush linked a pull request Sep 2, 2022 that will close this issue
6 tasks
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 a pull request may close this issue.

2 participants