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: move transaction creator test util to starknet api #661

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

ArniStarkware
Copy link
Contributor

@ArniStarkware ArniStarkware commented Aug 29, 2024

This is a step towards addressing the issue in: #519.

This change is Reviewable

Copy link
Contributor Author

ArniStarkware commented Aug 29, 2024

@ArniStarkware ArniStarkware marked this pull request as ready for review August 29, 2024 14:14
Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 95.80838% with 7 lines in your changes missing coverage. Please review.

Project coverage is 75.89%. Comparing base (c65f0b9) to head (6b965ef).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/starknet_api/src/test_utils/invoke.rs 89.36% 5 Missing ⚠️
crates/starknet_api/src/test_utils/declare.rs 98.36% 1 Missing ⚠️
...ates/starknet_api/src/test_utils/deploy_account.rs 97.82% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #661      +/-   ##
==========================================
+ Coverage   75.83%   75.89%   +0.05%     
==========================================
  Files         352       88     -264     
  Lines       37423    10935   -26488     
  Branches    37423    10935   -26488     
==========================================
- Hits        28381     8299   -20082     
+ Misses       6726     2227    -4499     
+ Partials     2316      409    -1907     

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

@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/split_inner_function branch from c065019 to ce2991d Compare August 29, 2024 15:10
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/move_to_snapi branch from eb8f791 to e4ee8b9 Compare August 29, 2024 15:10
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/split_inner_function branch from ce2991d to aa4e955 Compare September 1, 2024 10:33
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/move_to_snapi branch from e4ee8b9 to c275fa8 Compare September 1, 2024 10:33
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/split_inner_function branch from aa4e955 to 3999ccf Compare September 1, 2024 14:44
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/move_to_snapi branch from c275fa8 to 4cc1b61 Compare September 1, 2024 14:44
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/split_inner_function branch from 3999ccf to a605f67 Compare September 2, 2024 10:57
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/move_to_snapi branch from 4cc1b61 to dc513ca Compare September 2, 2024 10:57
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/split_inner_function branch from a605f67 to d801238 Compare September 3, 2024 15:34
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/move_to_snapi branch from dc513ca to e8fedb6 Compare September 3, 2024 15:34
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/split_inner_function branch from d801238 to 8d55175 Compare September 3, 2024 16:17
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/move_to_snapi branch from e8fedb6 to 62b383e Compare September 3, 2024 16:17
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/split_inner_function branch from 8d55175 to 53ca21d Compare September 5, 2024 10:50
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/move_to_snapi branch from 62b383e to 2230b5b Compare September 5, 2024 10:50
Copy link
Contributor

@MohammadNassar1 MohammadNassar1 left a comment

Choose a reason for hiding this comment

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

Reviewed 7 of 24 files at r1, 17 of 17 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArniStarkware and @dafnamatsry)


crates/blockifier/src/test_utils/declare.rs line 23 at r3 (raw file):

#[derive(Clone)]
pub struct DeclareTxArgs {

I assume no code changes.
You're only moving the code, right?

Code quote:

pub struct DeclareTxArgs {

crates/blockifier/src/test_utils/invoke.rs line 11 at r3 (raw file):

    let only_query = invoke_args.only_query;
    // TODO: Make TransactionVersion an enum and use match here.
    let invoke_tx = if invoke_args.version == TransactionVersion::ZERO {

Could you please explain why you kept this code here instead of moving it to sn-api and simply calling the create function from there?


crates/starknet_api/src/test_utils.rs line 8 at r3 (raw file):

// TODO: Default testing bounds should probably be AllResourceBounds variant.
pub fn default_testing_resource_bounds() -> ValidResourceBounds {

Maybe it can be in the same file of ValidResourceBound struct.

Code quote:

default_testing_resource_bounds(

@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/split_inner_function branch from 53ca21d to b725862 Compare September 5, 2024 13:50
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/move_to_snapi branch from 2230b5b to f186001 Compare September 5, 2024 14:19
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: 15 of 25 files reviewed, 2 unresolved discussions (waiting on @dafnamatsry and @MohammadNassar1)


crates/blockifier/src/test_utils/declare.rs line 23 at r3 (raw file):

Previously, MohammadNassar1 (mohammad-starkware) wrote…

I assume no code changes.
You're only moving the code, right?

Indeed.


crates/blockifier/src/test_utils/invoke.rs line 11 at r3 (raw file):

Previously, MohammadNassar1 (mohammad-starkware) wrote…

Could you please explain why you kept this code here instead of moving it to sn-api and simply calling the create function from there?

Explanation: The function selector_from_name is from the blockifier crate.
I did not look much into moving it into the shared test util.
(note - selector_from_name(EXECUTE_ENTRY_POINT_NAME) is just a constant number).

On the other hand, v0 will be deleted anyway - so I did not want to work hard to support it.


crates/starknet_api/src/test_utils.rs line 8 at r3 (raw file):

Previously, MohammadNassar1 (mohammad-starkware) wrote…

Maybe it can be in the same file of ValidResourceBound struct.

Done.

Copy link

github-actions bot commented Sep 5, 2024

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [65.695 ms 66.184 ms 67.085 ms]
change: [-7.9872% -4.7144% -1.5721%] (p = 0.00 < 0.05)
Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
4 (4.00%) high mild
3 (3.00%) high severe

@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/split_inner_function branch from b725862 to 4da7b0c Compare September 5, 2024 14:47
@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/move_to_snapi branch from f186001 to 24a0fc8 Compare September 5, 2024 14:47
Copy link

github-actions bot commented Sep 5, 2024

Benchmark movements:
tree_computation_flow performance regressed!
tree_computation_flow time: [66.962 ms 69.344 ms 72.460 ms]
change: [+1.4713% +4.1654% +9.9926%] (p = 0.04 < 0.05)
Performance has regressed.
Found 10 outliers among 100 measurements (10.00%)
2 (2.00%) high mild
8 (8.00%) high severe

Copy link
Contributor

@MohammadNassar1 MohammadNassar1 left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 10 files at r4, 5 of 5 files at r5, all commit messages.
Reviewable status: 24 of 25 files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @dafnamatsry)


crates/starknet_api/src/test_utils.rs line 3 at r5 (raw file):

pub mod declare;
pub mod deploy_account;
pub mod invoke;

Why you define the modules here, and not in lib file?

Code quote:

pub mod declare;
pub mod deploy_account;
pub mod invoke;

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: 24 of 25 files reviewed, 1 unresolved discussion (waiting on @dafnamatsry and @MohammadNassar1)


crates/starknet_api/src/test_utils.rs line 3 at r5 (raw file):

Previously, MohammadNassar1 (mohammad-starkware) wrote…

Why you define the modules here, and not in lib file?

I copied the folder/file structure from blockifier's test utils.

It is nice that the lib file points to the public-facing test_utils.rs, and here - it points to the inner workings of the util. also we don't have to decorate everything with: #[cfg(any(feature = "testing", test))] - but only once.

@ArniStarkware ArniStarkware force-pushed the arni/test_utils/tx_creator/move_to_snapi branch 2 times, most recently from 123df51 to 77656be Compare September 6, 2024 14:00
Copy link
Contributor

@MohammadNassar1 MohammadNassar1 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 10 files at r4, 1 of 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry)

Copy link
Contributor Author

ArniStarkware commented Sep 8, 2024

Merge activity

@ArniStarkware ArniStarkware changed the base branch from arni/test_utils/tx_creator/split_inner_function to graphite-base/661 September 8, 2024 07:01
@ArniStarkware ArniStarkware changed the base branch from graphite-base/661 to main September 8, 2024 07:01
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