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

Create trait for builtins #227

Open
mimoo opened this issue Nov 10, 2024 · 0 comments
Open

Create trait for builtins #227

mimoo opened this issue Nov 10, 2024 · 0 comments
Labels

Comments

@mimoo
Copy link
Contributor

mimoo commented Nov 10, 2024

we should standardize how we write builtins by using some trait that looks like this or something:

trait Builtin {
    const sig: &'static str;

    const no_typecheck: bool;

    fn typecheck(
        generics: &GenericParameters,
        vars: &[VarInfo<F, LinearCombination<F>>],
        span: Span,
    ) -> Result<()>;

    fn builtin(
        compiler: &mut CircuitWriter<R1CS<F>>,
        _generics: &GenericParameters,
        vars: &[VarInfo<F, LinearCombination<F>>],
        span: Span,
    ) -> Result<Option<Var<F, LinearCombination<F>>>>;
}

and the typecheck() function could contain all of the actual checks that need to be done.

@mimoo mimoo added the easy label Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant