Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

add a basic test pair contract #972

Merged
merged 1 commit into from
Oct 5, 2023
Merged

Conversation

zuphitf
Copy link
Contributor

@zuphitf zuphitf commented Oct 5, 2023

This change is Reviewable

@zuphitf zuphitf self-assigned this Oct 5, 2023
@zuphitf zuphitf force-pushed the zuphit/fee/add_pair_skeleton branch from 275f1a1 to 0e19c7f Compare October 5, 2023 09:19
@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2023

Codecov Report

Merging #972 (e679f5a) into main (2ced530) will not change coverage.
Report is 1 commits behind head on main.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #972   +/-   ##
=======================================
  Coverage   68.40%   68.40%           
=======================================
  Files          47       47           
  Lines        6024     6024           
  Branches     6024     6024           
=======================================
  Hits         4121     4121           
  Misses       1528     1528           
  Partials      375      375           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @zuphitf)


crates/blockifier/src/test_utils.rs line 294 at r1 (raw file):

        ((pair_address, reserve0_address), stark_felt!(RESERVE_0)),
        ((pair_address, reserve1_address), stark_felt!(RESERVE_1)),
    ]);

Please put this logic in a different state init function, it is not relevant for all tests... the address => class_hash mapping is fine, but this logic is a bit out of context here

pub fn deprecated_create_test_state_for_oracle_test() -> ... {
    let mut state = deprecated_create_test_state();
    ...
}

Code quote:

    // Override the pair's reserves data, since the constructor is not called.
    let pair_address = contract_address!(TEST_PAIR_SKELETON_CONTRACT_ADDRESS1);
    let reserve0_address = get_storage_var_address("_reserve0", &[]);
    let reserve1_address = get_storage_var_address("_reserve1", &[]);
    let storage_view = HashMap::from([
        ((pair_address, reserve0_address), stark_felt!(RESERVE_0)),
        ((pair_address, reserve1_address), stark_felt!(RESERVE_1)),
    ]);

@zuphitf zuphitf force-pushed the zuphit/fee/add_pair_skeleton branch from 0e19c7f to e679f5a Compare October 5, 2023 10:48
@zuphitf
Copy link
Contributor Author

zuphitf commented Oct 5, 2023

crates/blockifier/src/test_utils.rs line 294 at r1 (raw file):

Previously, dorimedini-starkware wrote…

Please put this logic in a different state init function, it is not relevant for all tests... the address => class_hash mapping is fine, but this logic is a bit out of context here

pub fn deprecated_create_test_state_for_oracle_test() -> ... {
    let mut state = deprecated_create_test_state();
    ...
}

Moved to subfunctions like we discussed

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

@zuphitf zuphitf merged commit 4db71ea into main Oct 5, 2023
7 checks passed
@zuphitf zuphitf deleted the zuphit/fee/add_pair_skeleton branch October 5, 2023 10:54
gswirski pushed a commit to reilabs/blockifier that referenced this pull request Jun 26, 2024
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.

3 participants