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

Support native stdlib #201

Merged
merged 37 commits into from
Oct 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
fbfa222
fix: avoid re-instantiate functions/methods
katat Sep 27, 2024
4eaed5b
fix: monomorphized expr shouldn't override existing nodes
katat Oct 5, 2024
10432c3
fmt
katat Oct 9, 2024
0221102
support unsafe/hint attributes
katat Oct 9, 2024
5353d42
fmt
katat Oct 9, 2024
253f4b5
fix: always check the resolved qualified name
katat Oct 10, 2024
64f1758
incorporate native stdlib for testing
katat Sep 27, 2024
be66e55
add int module
katat Sep 27, 2024
6f26d5b
add comparator stdlib
katat Sep 27, 2024
b283046
native bits stdlib
katat Sep 27, 2024
00d230b
move init_stdlib_dep to stdlib
katat Oct 11, 2024
1d2cba7
add bits stdlib
katat Oct 11, 2024
9b94dfb
remove bits builtin
katat Oct 11, 2024
64c2352
download stdlib
katat Oct 11, 2024
3c0b022
add comparator methods for uint8
katat Oct 11, 2024
f54a53c
fmt
katat Oct 11, 2024
5c8918e
remove unused import
katat Oct 11, 2024
18825a3
Fix: Allow struct fields to propagate constants (#204)
katat Oct 22, 2024
ca35175
add uint16/32/64
katat Oct 18, 2024
55f441a
update tests
katat Oct 18, 2024
2b47a8d
fix: remove bit_len from uints
katat Oct 24, 2024
8ef0993
simplify to_bits
katat Oct 24, 2024
1f8826a
add const var STDLIB_DIRECTORY
katat Oct 24, 2024
8834fff
move native stdlib to their own folder
katat Oct 24, 2024
a822a1b
fmt
katat Oct 24, 2024
3f91646
Add u16/32/64 (#206)
katat Oct 24, 2024
c2c78c9
remove deadcode
katat Oct 24, 2024
328ffbf
point to zksecurity repo
katat Oct 24, 2024
7befb6b
Merge remote-tracking branch 'origin/main' into feat/init-stdlib
katat Oct 24, 2024
42a520a
remove deadcode
katat Oct 25, 2024
be8127d
doc bits
katat Oct 25, 2024
665ef2e
use main branch as the release branch for downloading
katat Oct 25, 2024
ab75d85
clean up
katat Oct 25, 2024
34cf5c4
ci: init stdlib from the latest code in pr
katat Oct 25, 2024
4cfb0c5
add docs to stdlib
katat Oct 25, 2024
eb1def1
Support multiplexer (#207)
katat Oct 28, 2024
83e3491
Add MIMC stdlib (#208)
katat Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/stdlib/native/int.no
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use std::bits;

struct Uint8 {
// todo: maybe add a const attribute to Field to forbid reassignment
Copy link
Contributor

Choose a reason for hiding this comment

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

imo if we do this we should do it the other way around: mark fields that can be mutated without going through the API (through the pub keyword like in rust)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh yeah, using pub keyword makes more sense, as it is about whether it is accessible publicly.

Copy link
Contributor

Choose a reason for hiding this comment

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

btw generally in security you want to have a whitelist rather than a blacklist

inner: Field,
bit_len: Field,
}

fn Uint8.new(val: Field) -> Uint8 {
// range check
let ignore_ = bits::to_bits(8, val);

return Uint8 {
inner: val,
bit_len: 8
};
}