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

build: impl mock test utils #314

Merged
merged 2 commits into from
Jul 17, 2024
Merged

build: impl mock test utils #314

merged 2 commits into from
Jul 17, 2024

Conversation

AvivYossef-starkware
Copy link
Collaborator

@AvivYossef-starkware AvivYossef-starkware commented Jul 17, 2024

This change is Reviewable

@codecov-commenter
Copy link

codecov-commenter commented Jul 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.54%. Comparing base (0b1ec9d) to head (6d9b95d).

Additional details and impacted files
@@                     Coverage Diff                     @@
##           aviv/create_mock_test_leaf     #314   +/-   ##
===========================================================
  Coverage                       70.54%   70.54%           
===========================================================
  Files                              38       38           
  Lines                            2091     2091           
  Branches                         2091     2091           
===========================================================
  Hits                             1475     1475           
  Misses                            546      546           
  Partials                           70       70           

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

@AvivYossef-starkware AvivYossef-starkware changed the title Aviv/impl mock leaf build: impl mock test utils Jul 17, 2024
@AvivYossef-starkware AvivYossef-starkware changed the base branch from aviv/create_mock_test_leaf to main July 17, 2024 09:47
@AvivYossef-starkware AvivYossef-starkware changed the base branch from main to aviv/create_mock_test_leaf July 17, 2024 10:56
@AvivYossef-starkware AvivYossef-starkware changed the base branch from aviv/create_mock_test_leaf to main July 17, 2024 10:57
@AvivYossef-starkware AvivYossef-starkware changed the base branch from main to aviv/create_mock_test_leaf July 17, 2024 10:58
Copy link

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [33.451 ms 33.471 ms 33.492 ms]
change: [-4.7591% -3.4131% -2.2431%] (p = 0.00 < 0.05)
Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
4 (4.00%) high mild

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r2, 7 of 7 files at r3, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @AvivYossef-starkware)


crates/committer/src/patricia_merkle_tree/internal_test_utils.rs line 26 at r3 (raw file):

use rstest::{fixture, rstest};
#[derive(Debug, PartialEq, Clone, Copy, Default, Eq)]
pub(crate) struct MockLeaf(pub(crate) Felt);

newline after uses

Suggestion:

use rstest::{fixture, rstest};

#[derive(Debug, PartialEq, Clone, Copy, Default, Eq)]
pub(crate) struct MockLeaf(pub(crate) Felt);

crates/committer/src/patricia_merkle_tree/internal_test_utils.rs line 32 at r3 (raw file):

        StorageValue(self.0.to_bytes_be().to_vec())
    }
    fn get_prefix(&self) -> Vec<u8> {

newline between function impls

Suggestion:

    }

    fn get_prefix(&self) -> Vec<u8> {

crates/committer/src/patricia_merkle_tree/internal_test_utils.rs line 70 at r3 (raw file):

            .0;
        Ok(Self(leaf_val))
    }

how does this differ from the default implementation?
if it doesn't, you should be able to just delete this

Code quote:

    fn from_modifications(
        index: &NodeIndex,
        leaf_modifications: Arc<LeafModifications<Self>>,
    ) -> LeafResult<Self> {
        let leaf_val = leaf_modifications
            .get(index)
            .expect("Leaf not found in modifications")
            .0;
        Ok(Self(leaf_val))
    }

crates/committer/src/patricia_merkle_tree/internal_test_utils.rs line 75 at r3 (raw file):

generate_trie_config!(OriginalSkeletonMockTrieConfig, MockLeaf);

struct MockHash;

it's not a hash, it's a hash function

Suggestion:

MockHashFunction

build: mock hash
Copy link
Collaborator Author

@AvivYossef-starkware AvivYossef-starkware 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: 4 of 9 files reviewed, 4 unresolved discussions (waiting on @dorimedini-starkware)


crates/committer/src/patricia_merkle_tree/internal_test_utils.rs line 26 at r3 (raw file):

Previously, dorimedini-starkware wrote…

newline after uses

Done.


crates/committer/src/patricia_merkle_tree/internal_test_utils.rs line 32 at r3 (raw file):

Previously, dorimedini-starkware wrote…

newline between function impls

Done.


crates/committer/src/patricia_merkle_tree/internal_test_utils.rs line 70 at r3 (raw file):

Previously, dorimedini-starkware wrote…

how does this differ from the default implementation?
if it doesn't, you should be able to just delete this

I haven't noticed that we have one.


crates/committer/src/patricia_merkle_tree/internal_test_utils.rs line 75 at r3 (raw file):

Previously, dorimedini-starkware wrote…

it's not a hash, it's a hash function

Done.

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware 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 5 of 5 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @AvivYossef-starkware)

@AvivYossef-starkware AvivYossef-starkware changed the base branch from aviv/create_mock_test_leaf to main July 17, 2024 16:53
@AvivYossef-starkware AvivYossef-starkware added this pull request to the merge queue Jul 17, 2024
Merged via the queue into main with commit ce54665 Jul 17, 2024
25 checks 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.

3 participants