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

Add Builtin trait and refactor all builtin functions to use it #244

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

zedar
Copy link
Contributor

@zedar zedar commented Dec 11, 2024

Addresses this issue #227.
Already merged with #238.

@zedar zedar force-pushed the feat/builtins_trait branch from f180506 to 2740b1a Compare December 11, 2024 10:52
@katat
Copy link
Collaborator

katat commented Jan 6, 2025

Looks good, thanks!
I left a couple of comments and there is a branch conflict to resolve.

Robert Zakrzewski added 2 commits January 13, 2025 15:19
Add Builtin trait and refactor all builtin functions to use it

Refactor builtin function to Builtin trait

Fix
@zedar zedar force-pushed the feat/builtins_trait branch from 2740b1a to 116839a Compare January 13, 2025 14:57
@zedar
Copy link
Contributor Author

zedar commented Jan 13, 2025

@katat
Resolved all conflicts.
Added support for missing TyKind::String(String) in assert_eq_values() function.

Copy link
Collaborator

@katat katat left a comment

Choose a reason for hiding this comment

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

Awesome, thanks again!

(ASSERT_FN, assert_fn, false),
(ASSERT_EQ_FN, assert_eq_fn, false),
(AssertEqFn::SIGNATURE, AssertEqFn::builtin, false),
(AssertFn::SIGNATURE, AssertFn::builtin, false),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be better to just return an array of structs with Builtin trait?

Error::new(
pub trait Builtin {
const SIGNATURE: &'static str;

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can add a constant property SKIP_TYPE_CHECK: bool to indicate whether to type check this builtin signature and avoid the need to specify them within the get_fns function.

@katat katat merged commit 2d76977 into zksecurity:main Jan 14, 2025
1 check passed
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