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

chore: expose max bytecode size arg for the compile sierra to casm util #283

Merged

Conversation

ArniStarkware
Copy link
Contributor

@ArniStarkware ArniStarkware commented Aug 1, 2024

This is an imported version of the PR: starkware-libs/mempool#348.

Note the PRs are stacked in a different order in this REPO.


This change is Reviewable

Copy link

github-actions bot commented Aug 1, 2024

Benchmark movements:
tree_computation_flow performance regressed!
tree_computation_flow time: [34.165 ms 34.569 ms 35.011 ms]
change: [+2.1662% +3.3403% +4.9323%] (p = 0.00 < 0.05)
Performance has regressed.
Found 17 outliers among 100 measurements (17.00%)
8 (8.00%) high mild
9 (9.00%) high severe

Copy link

codecov bot commented Aug 1, 2024

Codecov Report

Attention: Patch coverage is 96.96970% with 1 line in your changes missing coverage. Please review.

Project coverage is 76.71%. Comparing base (3c24858) to head (59228b7).
Report is 13 commits behind head on main.

Files Patch % Lines
crates/starknet_sierra_compile/src/config.rs 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #283      +/-   ##
==========================================
- Coverage   76.72%   76.71%   -0.01%     
==========================================
  Files         319      320       +1     
  Lines       34642    34641       -1     
  Branches    34642    34641       -1     
==========================================
- Hits        26578    26575       -3     
- Misses       5775     5778       +3     
+ Partials     2289     2288       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/add_fixture_in_compile_test branch from 56b4de1 to 56c45e8 Compare August 4, 2024 10:13
@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from 92f1dc5 to f44f1cf Compare August 4, 2024 10:13
@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/add_fixture_in_compile_test branch from 56c45e8 to e47382b Compare August 4, 2024 10:44
@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from f44f1cf to f54a4f5 Compare August 4, 2024 10:44
@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/add_fixture_in_compile_test branch from e47382b to d52a40c Compare August 5, 2024 08:21
@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from f54a4f5 to b064637 Compare August 5, 2024 08:21
@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/add_fixture_in_compile_test branch from d52a40c to 0db4ea7 Compare August 5, 2024 08:27
@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from b064637 to db6c928 Compare August 5, 2024 08:27
@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/add_fixture_in_compile_test branch from 0db4ea7 to 6b8de0d Compare August 5, 2024 13:59
@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from db6c928 to bd04a7e Compare August 5, 2024 14:11
@ArniStarkware ArniStarkware changed the base branch from arni/declare/compilation/add_fixture_in_compile_test to main August 5, 2024 14:11
@ArniStarkware
Copy link
Contributor Author

This PR is very similar to: starkware-libs/mempool#348

@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from bd04a7e to c55f0be Compare August 6, 2024 11:22
Copy link

github-actions bot commented Aug 6, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [65.686 ms 65.760 ms 65.839 ms]
change: [-10.307% -7.4036% -4.8183%] (p = 0.00 < 0.05)
Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) high mild
1 (1.00%) high severe

@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from c55f0be to 79ec169 Compare August 6, 2024 12:08
Copy link

github-actions bot commented Aug 6, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [65.946 ms 66.018 ms 66.102 ms]
change: [-8.3825% -5.0837% -2.2733%] (p = 0.00 < 0.05)
Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
3 (3.00%) high mild
1 (1.00%) high severe

Copy link
Collaborator

@dafnamatsry dafnamatsry left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 15 files at r1, 4 of 6 files at r2, 3 of 3 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArniStarkware, @Yael-Starkware, and @yair-starkware)


crates/gateway/src/config.rs line 95 at r3 (raw file):

            max_calldata_length: 4000,
            max_signature_length: 4000,
            max_bytecode_size: MAX_BYTECODE_SIZE,

Do we need to keep this validation in the stateless validator?

Code quote:

max_bytecode_size: MAX_BYTECODE_SIZE,

crates/starknet_sierra_compile/Cargo.toml line 15 at r3 (raw file):

cairo-lang-starknet-classes.workspace = true
cairo-lang-utils.workspace = true
papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" }

Note that local crate deps have moved to the workspace.

Code quote:

papyrus_config = { path = "../papyrus_config", version = "0.4.0-rc.0" }

crates/starknet_sierra_compile/src/compile.rs line 18 at r3 (raw file):

impl SierraToCasmCompiler {
    pub fn compile_sierra_to_casm(

Now that the struct name is SierraToCasmCompiler...

Suggestion:

compile

Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 11 of 16 files reviewed, 3 unresolved discussions (waiting on @dafnamatsry, @Yael-Starkware, and @yair-starkware)


crates/gateway/src/config.rs line 95 at r3 (raw file):

Previously, dafnamatsry wrote…

Do we need to keep this validation in the stateless validator?

Yes. The stateless validator validates the size of the Sierra program.

The compilation validates the size of the Casm program.


crates/starknet_sierra_compile/Cargo.toml line 15 at r3 (raw file):

Previously, dafnamatsry wrote…

Note that local crate deps have moved to the workspace.

Done.


crates/starknet_sierra_compile/src/compile.rs line 18 at r3 (raw file):

Previously, dafnamatsry wrote…

Now that the struct name is SierraToCasmCompiler...

Done.

Copy link

github-actions bot commented Aug 6, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [66.108 ms 66.211 ms 66.336 ms]
change: [-8.2005% -5.0017% -2.2690%] (p = 0.00 < 0.05)
Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
4 (4.00%) high mild
2 (2.00%) high severe

@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from 8bf1bdf to 98c3439 Compare August 6, 2024 14:36
@ArniStarkware
Copy link
Contributor Author

crates/gateway/src/config.rs line 95 at r3 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

Yes. The stateless validator validates the size of the Sierra program.

The compilation validates the size of the Casm program.

Sorry - I am mistaken. This PR indeed handles the max_bytecode_size flag for the compiler which is relevant for the size of the Sierra.

I still would like to have this validation in the lightweight - stateless validator, as early as possible.
I will add a comment documenting this.

Copy link

github-actions bot commented Aug 6, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [65.287 ms 65.408 ms 65.593 ms]
change: [-2.7647% -1.9100% -1.1462%] (p = 0.00 < 0.05)
Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
2 (2.00%) high mild
4 (4.00%) high severe

@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from 98c3439 to 74dd64e Compare August 7, 2024 05:14
Copy link

github-actions bot commented Aug 7, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [65.320 ms 65.372 ms 65.436 ms]
change: [-2.4788% -1.7604% -1.0837%] (p = 0.00 < 0.05)
Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) high mild
1 (1.00%) high severe

@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from 74dd64e to a0d234f Compare August 7, 2024 07:02
Copy link

github-actions bot commented Aug 7, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [65.797 ms 65.885 ms 65.981 ms]
change: [-10.082% -6.7427% -3.7244%] (p = 0.00 < 0.05)
Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
3 (3.00%) high mild
1 (1.00%) high severe

@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from a0d234f to 734a4b7 Compare August 7, 2024 07:06
Copy link

github-actions bot commented Aug 7, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [65.846 ms 65.948 ms 66.079 ms]
change: [-8.4360% -5.0406% -2.1243%] (p = 0.00 < 0.05)
Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
3 (3.00%) high mild
3 (3.00%) high severe

Copy link
Collaborator

@dafnamatsry dafnamatsry left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 6 files at r4.
Reviewable status: 15 of 17 files reviewed, 1 unresolved discussion (waiting on @ArniStarkware, @Yael-Starkware, and @yair-starkware)


crates/gateway/src/config.rs line 95 at r3 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

Sorry - I am mistaken. This PR indeed handles the max_bytecode_size flag for the compiler which is relevant for the size of the Sierra.

I still would like to have this validation in the lightweight - stateless validator, as early as possible.
I will add a comment documenting this.

Discussed f2f. I think we can remove this from the stateless validator.

@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from 734a4b7 to ae56362 Compare August 7, 2024 10:29
Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 13 of 19 files reviewed, 1 unresolved discussion (waiting on @dafnamatsry, @Yael-Starkware, and @yair-starkware)


crates/gateway/src/config.rs line 95 at r3 (raw file):

Previously, dafnamatsry wrote…

Discussed f2f. I think we can remove this from the stateless validator.

Done.

Copy link

github-actions bot commented Aug 7, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [65.514 ms 65.590 ms 65.680 ms]
change: [-7.3815% -3.9510% -1.1167%] (p = 0.01 < 0.05)
Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
1 (1.00%) high mild
4 (4.00%) high severe

Copy link

github-actions bot commented Aug 7, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [65.825 ms 65.928 ms 66.042 ms]
change: [-10.343% -6.5067% -3.0301%] (p = 0.00 < 0.05)
Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
2 (2.00%) high mild
4 (4.00%) high severe

@ArniStarkware ArniStarkware force-pushed the arni/declare/compilation/expose_compilation_args branch from cb4fef6 to 59228b7 Compare August 7, 2024 12:52
Copy link

github-actions bot commented Aug 7, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [65.800 ms 66.042 ms 66.400 ms]
change: [-9.9604% -6.6434% -3.6512%] (p = 0.00 < 0.05)
Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
5 (5.00%) high mild
5 (5.00%) high severe

Copy link
Collaborator

@dafnamatsry dafnamatsry left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r5, 7 of 7 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware and @yair-starkware)

Copy link
Contributor Author

ArniStarkware commented Aug 8, 2024

Merge activity

@ArniStarkware ArniStarkware merged commit 07571a1 into main Aug 8, 2024
27 checks passed
@ArniStarkware ArniStarkware mentioned this pull request Aug 8, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 11, 2024
@ArniStarkware ArniStarkware deleted the arni/declare/compilation/expose_compilation_args branch August 13, 2024 07:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants