-
Notifications
You must be signed in to change notification settings - Fork 240
Display gas report table #3842
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
ddoktorski
wants to merge
4
commits into
share-contracts-data-store
Choose a base branch
from
3660-gas-report
base: share-contracts-data-store
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+273
−8
Open
Display gas report table #3842
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| use crate::e2e::common::runner::{setup_package, test_runner}; | ||
| use indoc::indoc; | ||
| use shared::test_utils::output_assert::assert_stdout_contains; | ||
|
|
||
| #[test] | ||
| fn basic() { | ||
| let temp = setup_package("simple_package"); | ||
| let output = test_runner(&temp) | ||
| .arg("--gas-report") | ||
| .arg("call_and_invoke") | ||
| .assert() | ||
| .code(0); | ||
|
|
||
| assert_stdout_contains( | ||
| output, | ||
| indoc! {r" | ||
| [..]Compiling[..] | ||
| [..]Finished[..] | ||
|
|
||
|
|
||
| Collected 1 test(s) from simple_package package | ||
| Running 0 test(s) from src/ | ||
| Running 1 test(s) from tests/ | ||
| [PASS] simple_package_integrationtest::contract::call_and_invoke (l1_gas: ~0, l1_data_gas: ~[..], l2_gas: ~[..]) | ||
| ╭------------------------+-------+-------+-------+---------+---------╮ | ||
| | HelloStarknet Contract | | | | | | | ||
| +====================================================================+ | ||
| | Function Name | Min | Max | Avg | Std Dev | # Calls | | ||
| |------------------------+-------+-------+-------+---------+---------| | ||
| | get_balance | 13340 | 13340 | 13340 | 0 | 2 | | ||
| |------------------------+-------+-------+-------+---------+---------| | ||
| | increase_balance | 24940 | 24940 | 24940 | 0 | 1 | | ||
| ╰------------------------+-------+-------+-------+---------+---------╯ | ||
|
|
||
| Tests: 1 passed, 0 failed, 0 ignored, [..] filtered out | ||
franciszekjob marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "}, | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn recursive_calls() { | ||
| let temp = setup_package("debugging"); | ||
|
|
||
| let output = test_runner(&temp) | ||
| .arg("test_debugging_trace_success") | ||
| .arg("--gas-report") | ||
| .assert() | ||
| .code(0); | ||
|
|
||
| assert_stdout_contains( | ||
| output, | ||
| indoc! {r" | ||
| [..]Compiling[..] | ||
| [..]Finished[..] | ||
|
|
||
|
|
||
| Collected 1 test(s) from debugging package | ||
| Running 0 test(s) from src/ | ||
| Running 1 test(s) from tests/ | ||
| [PASS] debugging_integrationtest::test_trace::test_debugging_trace_success (l1_gas: ~0, l1_data_gas: ~[..], l2_gas: ~[..]) | ||
| ╭-------------------------+-------+--------+--------+---------+---------╮ | ||
| | SimpleContract Contract | | | | | | | ||
| +=======================================================================+ | ||
| | Function Name | Min | Max | Avg | Std Dev | # Calls | | ||
| |-------------------------+-------+--------+--------+---------+---------| | ||
| | execute_calls | 11680 | 609080 | 183924 | 235859 | 5 | | ||
| |-------------------------+-------+--------+--------+---------+---------| | ||
| | fail | 17950 | 17950 | 17950 | 0 | 1 | | ||
| ╰-------------------------+-------+--------+--------+---------+---------╯ | ||
|
|
||
| Tests: 1 passed, 0 failed, 0 ignored, [..] filtered out | ||
| "}, | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn multiple_contracts_and_constructor() { | ||
| let temp = setup_package("simple_package_with_cheats"); | ||
| let output = test_runner(&temp) | ||
| .arg("--gas-report") | ||
| .arg("call_and_invoke_proxy") | ||
| .assert() | ||
| .code(0); | ||
|
|
||
| assert_stdout_contains( | ||
| output, | ||
| indoc! {r" | ||
| [..]Compiling[..] | ||
| [..]Finished[..] | ||
|
|
||
|
|
||
| Collected 1 test(s) from simple_package_with_cheats package | ||
| Running 0 test(s) from src/ | ||
| Running 1 test(s) from tests/ | ||
| [PASS] simple_package_with_cheats_integrationtest::contract::call_and_invoke_proxy (l1_gas: ~0, l1_data_gas: ~[..], l2_gas: ~[..]) | ||
| ╭------------------------+-------+-------+-------+---------+---------╮ | ||
| | HelloStarknet Contract | | | | | | | ||
| +====================================================================+ | ||
| | Function Name | Min | Max | Avg | Std Dev | # Calls | | ||
| |------------------------+-------+-------+-------+---------+---------| | ||
| | get_block_number | 15780 | 15780 | 15780 | 0 | 2 | | ||
| ╰------------------------+-------+-------+-------+---------+---------╯ | ||
|
|
||
| ╭-----------------------------+--------+--------+--------+---------+---------╮ | ||
| | HelloStarknetProxy Contract | | | | | | | ||
| +============================================================================+ | ||
| | Function Name | Min | Max | Avg | Std Dev | # Calls | | ||
| |-----------------------------+--------+--------+--------+---------+---------| | ||
| | constructor | 14650 | 14650 | 14650 | 0 | 1 | | ||
| |-----------------------------+--------+--------+--------+---------+---------| | ||
| | get_block_number | 125280 | 125280 | 125280 | 0 | 2 | | ||
| ╰-----------------------------+--------+--------+--------+---------+---------╯ | ||
|
|
||
| Tests: 1 passed, 0 failed, 0 ignored, [..] filtered out | ||
| "}, | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn no_transactions() { | ||
| let temp = setup_package("simple_package"); | ||
| let output = test_runner(&temp) | ||
| .arg("--gas-report") | ||
| .arg("test_fib") | ||
| .assert() | ||
| .code(0); | ||
|
|
||
| assert_stdout_contains( | ||
| output, | ||
| indoc! {r" | ||
| [..]Compiling[..] | ||
| [..]Finished[..] | ||
|
|
||
|
|
||
| Collected 1 test(s) from simple_package package | ||
| Running 1 test(s) from src/ | ||
| [PASS] simple_package::tests::test_fib (l1_gas: ~0, l1_data_gas: ~0, l2_gas: ~[..]) | ||
| No contract gas usage data to display. Make sure your test include transactions. | ||
|
|
||
| Running 0 test(s) from tests/ | ||
| Tests: 1 passed, 0 failed, 0 ignored, [..] filtered out | ||
| "}, | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a panic for this would make more sense if it cannot occur at all, or an unrachable block.
Unless we are afraid it might happen somehow?