Skip to content

chore: use bool for ValidationFlag fields #77

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jialinli98
Copy link
Contributor

@jialinli98 jialinli98 commented Aug 7, 2025

Description

Problem*

use bool for push_layer, push_layer_type_of_root, and pop_layer.

closes #57

Summary*

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@jialinli98 jialinli98 force-pushed the jl/token_validation_in_bool branch from 15b7da2 to c7661ba Compare August 7, 2025 02:17
@jialinli98 jialinli98 changed the title chore: use bool for token validation fields chore: use bool for ValidationFlag fields Aug 7, 2025
@jialinli98 jialinli98 requested a review from TomAFrench August 7, 2025 02:51
@TomAFrench
Copy link
Member

It seems like there's three options for the layer type however:

pub(crate) mod Layer {
pub(crate) global OBJECT_LAYER: u32 = 0;
pub(crate) global ARRAY_LAYER: u32 = 1;
pub(crate) global SINGLE_VALUE_LAYER: u32 = 2;
}

Looks like this needs more investigation.

@jialinli98
Copy link
Contributor Author

jialinli98 commented Aug 7, 2025

assert(r.push_layer_type_of_root * r.push_layer_type_of_root == r.push_layer_type_of_root);
single_value_layer isn't used in the implementation, as standalone values are not supported by this library. Previously, we also checked that this value was a boolean.

@TomAFrench
Copy link
Member

Ok, can you remove this from the enum in that case?

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

ACIR Opcodes

Benchmark suite Current: 0eda9c6 Previous: 33bf554 Ratio
get_array_JSON16kb_Bench.json/main 42557 acir_opcodes 42557 acir_opcodes 1
get_array_JSON512b_Bench.json/main 2365 acir_opcodes 2365 acir_opcodes 1
get_keys_at_root_JSON16kb_Bench.json/main 3349896 acir_opcodes 3349896 acir_opcodes 1
get_keys_at_root_JSON512b_Bench.json/main 3334024 acir_opcodes 3334024 acir_opcodes 1
get_literal_JSON16kb_Bench.json/main 17711 acir_opcodes 17711 acir_opcodes 1
get_literal_JSON512b_Bench.json/main 1839 acir_opcodes 1839 acir_opcodes 1
get_number_JSON16kb_Bench.json/main 17838 acir_opcodes 17838 acir_opcodes 1
get_number_JSON512b_Bench.json/main 1966 acir_opcodes 1966 acir_opcodes 1
get_object_JSON16kb_Bench.json/main 42557 acir_opcodes 42557 acir_opcodes 1
get_object_JSON512b_Bench.json/main 2365 acir_opcodes 2365 acir_opcodes 1
get_string_JSON16kb_Bench.json/main 42695 acir_opcodes 42695 acir_opcodes 1
get_string_JSON512b_Bench.json/main 26823 acir_opcodes 26823 acir_opcodes 1
get_value_JSON16kb_Bench.json/main 20188 acir_opcodes 20188 acir_opcodes 1
get_value_JSON512b_Bench.json/main 4316 acir_opcodes 4316 acir_opcodes 1
key_exists_JSON16kb_Bench.json/main 18077 acir_opcodes 18077 acir_opcodes 1
key_exists_JSON512b_Bench.json/main 2205 acir_opcodes 2205 acir_opcodes 1
parse_json_from_string_JSON16kb_Bench.json/main 1100715 acir_opcodes 1098668 acir_opcodes 1.00
parse_json_from_string_JSON512b_Bench.json/main 38242 acir_opcodes 38179 acir_opcodes 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Circuit Size

Benchmark suite Current: 0eda9c6 Previous: 33bf554 Ratio
get_array_JSON16kb_Bench.json/main 54968 circuit_size 54968 circuit_size 1
get_array_JSON512b_Bench.json/main 5848 circuit_size 5848 circuit_size 1
get_keys_at_root_JSON16kb_Bench.json/main 3380422 circuit_size 3380422 circuit_size 1
get_keys_at_root_JSON512b_Bench.json/main 3354628 circuit_size 3354628 circuit_size 1
get_literal_JSON16kb_Bench.json/main 32183 circuit_size 32183 circuit_size 1
get_literal_JSON512b_Bench.json/main 6389 circuit_size 6389 circuit_size 1
get_number_JSON16kb_Bench.json/main 32612 circuit_size 32612 circuit_size 1
get_number_JSON512b_Bench.json/main 6883 circuit_size 6883 circuit_size 1
get_object_JSON16kb_Bench.json/main 54968 circuit_size 54968 circuit_size 1
get_object_JSON512b_Bench.json/main 5848 circuit_size 5848 circuit_size 1
get_string_JSON16kb_Bench.json/main 252831 circuit_size 252831 circuit_size 1
get_string_JSON512b_Bench.json/main 227999 circuit_size 227999 circuit_size 1
get_value_JSON16kb_Bench.json/main 35344 circuit_size 35344 circuit_size 1
get_value_JSON512b_Bench.json/main 9550 circuit_size 9550 circuit_size 1
key_exists_JSON16kb_Bench.json/main 31277 circuit_size 31277 circuit_size 1
key_exists_JSON512b_Bench.json/main 9452 circuit_size 9452 circuit_size 1
parse_json_from_string_JSON16kb_Bench.json/main 1475537 circuit_size 1473490 circuit_size 1.00
parse_json_from_string_JSON512b_Bench.json/main 68826 circuit_size 68763 circuit_size 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Brillig Bytecode Size

Benchmark suite Current: 0eda9c6 Previous: 33bf554 Ratio
get_array_JSON16kb_Bench 18479 opcodes 18479 opcodes 1
get_array_JSON512b_Bench 2607 opcodes 2607 opcodes 1
get_keys_at_root_JSON16kb_Bench 43657 opcodes 43657 opcodes 1
get_keys_at_root_JSON512b_Bench 27784 opcodes 27784 opcodes 1
get_literal_JSON16kb_Bench 22319 opcodes 22319 opcodes 1
get_literal_JSON512b_Bench 6446 opcodes 6446 opcodes 1
get_number_JSON16kb_Bench 22628 opcodes 22628 opcodes 1
get_number_JSON512b_Bench 6755 opcodes 6755 opcodes 1
get_object_JSON16kb_Bench 18479 opcodes 18479 opcodes 1
get_object_JSON512b_Bench 2607 opcodes 2607 opcodes 1
get_string_JSON16kb_Bench 24434 opcodes 24434 opcodes 1
get_string_JSON512b_Bench 8561 opcodes 8561 opcodes 1
get_value_JSON16kb_Bench 23483 opcodes 23483 opcodes 1
get_value_JSON512b_Bench 7610 opcodes 7610 opcodes 1
key_exists_JSON16kb_Bench 18129 opcodes 18129 opcodes 1
key_exists_JSON512b_Bench 2257 opcodes 2257 opcodes 1
parse_json_from_string_JSON16kb_Bench 16909 opcodes 16913 opcodes 1.00
parse_json_from_string_JSON512b_Bench 16899 opcodes 16903 opcodes 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 To Triage
Development

Successfully merging this pull request may close these issues.

use boolean for Validation flags
2 participants