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

refactor: share benchmark code with simple flow test #1917

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

avi-starkware
Copy link
Collaborator

@avi-starkware avi-starkware commented May 23, 2024

This change is Reviewable

@avi-starkware
Copy link
Collaborator Author

crates/blockifier/Cargo.toml line 57 at r1 (raw file):

glob.workspace = true
pretty_assertions.workspace = true
rand.workspace = true

I wanted to keep it here, but rust doesn't let me. Are test utils not considered "dev" for the purpose of dependencies?

Code quote:

rand.workspace = true

@codecov-commenter
Copy link

codecov-commenter commented May 23, 2024

Codecov Report

Attention: Patch coverage is 93.05556% with 5 lines in your changes missing coverage. Please review.

Project coverage is 78.18%. Comparing base (0abafd7) to head (a6fff18).

Files Patch % Lines
...s/blockifier/src/test_utils/transfers_generator.rs 93.05% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1917      +/-   ##
==========================================
+ Coverage   78.02%   78.18%   +0.15%     
==========================================
  Files          61       62       +1     
  Lines        8756     8828      +72     
  Branches     8756     8828      +72     
==========================================
+ Hits         6832     6902      +70     
- Misses       1484     1486       +2     
  Partials      440      440              

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

@avi-starkware
Copy link
Collaborator Author

+reviewer:@OriStarkware

Copy link
Contributor

@OriStarkware OriStarkware left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: 0 of 6 files reviewed, 2 unresolved discussions (waiting on @avi-starkware, @noaov1, and @Yoni-Starkware)

a discussion (no related file):
Can you split this into a code-moving PR and a code-changing PR?


@avi-starkware avi-starkware force-pushed the avi/concurrency/add-transfers-flow-test branch from 7d30fc1 to d5cf583 Compare May 26, 2024 14:21
@avi-starkware avi-starkware changed the base branch from main to avi/refactor-benchmark May 26, 2024 14:27
@avi-starkware
Copy link
Collaborator Author

Previously, OriStarkware wrote…

Can you split this into a code-moving PR and a code-changing PR?

Done.

The code change happens in a preliminary PR: #1919 .
The current PR moves the code, and introduces the file transfers_flow_test.rs.

Copy link
Contributor

@OriStarkware OriStarkware 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 6 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: 5 of 6 files reviewed, 2 unresolved discussions (waiting on @avi-starkware, @noaov1, and @Yoni-Starkware)


crates/blockifier/Cargo.toml line 57 at r1 (raw file):

Previously, avi-starkware wrote…

I wanted to keep it here, but rust doesn't let me. Are test utils not considered "dev" for the purpose of dependencies?

Please check that


crates/blockifier/src/blockifier/transfers_flow_test.rs line 5 at r2 (raw file):

#[test]
pub fn transfers_flow_test() {
    let n_chunks = 100;

Why do we need so many chunks?

@avi-starkware avi-starkware force-pushed the avi/concurrency/add-transfers-flow-test branch from f1e9882 to f0c8abe Compare May 27, 2024 07:28
@avi-starkware
Copy link
Collaborator Author

crates/blockifier/src/blockifier/transfers_flow_test.rs line 5 at r2 (raw file):

Previously, OriStarkware wrote…

Why do we need so many chunks?

This is just an arbitrary number. i'll reduce it to 10.

@avi-starkware avi-starkware force-pushed the avi/concurrency/add-transfers-flow-test branch from f0c8abe to 41feedd Compare May 27, 2024 11:59
Copy link
Contributor

@OriStarkware OriStarkware 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 r3, all commit messages.
Reviewable status: 5 of 6 files reviewed, 1 unresolved discussion (waiting on @avi-starkware, @noaov1, and @Yoni-Starkware)

Copy link
Contributor

@OriStarkware OriStarkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 5 of 6 files reviewed, all discussions resolved (waiting on @noaov1 and @Yoni-Starkware)

Copy link
Contributor

@OriStarkware OriStarkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 6 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1 and @Yoni-Starkware)

Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 6 files at r1, 1 of 1 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @avi-starkware and @Yoni-Starkware)


crates/blockifier/Cargo.toml line 57 at r1 (raw file):

Previously, OriStarkware wrote…

Please check that

Can you please explain?


crates/blockifier/src/blockifier/transfers_flow_test.rs line 5 at r3 (raw file):

#[test]
pub fn transfers_flow_test() {
    let n_chunks = 10;

Given the new implantation of execute_txs (execute a stream of transactions and divides it to chunks) consider running it one time.

Code quote:

    let n_chunks = 10;

crates/blockifier/src/test_utils/transfers_simulator.rs line 25 at r3 (raw file):

const CHUNK_SIZE: usize = 10;
const RANDOMIZATION_SEED: u64 = 0;
const CHARGE_FEE: bool = false;

Can you please remind me why it's off? In the flow test we might want to charge fee.

Code quote:

const CHARGE_FEE: bool = false;

crates/blockifier/src/test_utils/transfers_simulator.rs line 26 at r3 (raw file):

const RANDOMIZATION_SEED: u64 = 0;
const CHARGE_FEE: bool = false;
const TRANSACTION_VERSION: TransactionVersion = TransactionVersion(StarkFelt::ONE);

Suggestion:

const TRANSACTION_VERSION: TransactionVersion = TransactionVersion(StarkFelt::THREE);

@avi-starkware avi-starkware force-pushed the avi/concurrency/add-transfers-flow-test branch from 41feedd to 9e34750 Compare May 29, 2024 09:07
@avi-starkware
Copy link
Collaborator Author

crates/blockifier/Cargo.toml line 57 at r1 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Can you please explain?

Test code is compiled when the create is built, so it is not considered a dev-dependency when we use it in test-utils as opposed to when we use it in the benchmark.

@avi-starkware avi-starkware force-pushed the avi/concurrency/add-transfers-flow-test branch 2 times, most recently from 5420735 to 3edb7a7 Compare May 29, 2024 14:56
Copy link
Collaborator Author

@avi-starkware avi-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: 2 of 6 files reviewed, 3 unresolved discussions (waiting on @noaov1, @OriStarkware, and @Yoni-Starkware)


crates/blockifier/src/blockifier/transfers_flow_test.rs line 5 at r3 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Given the new implantation of execute_txs (execute a stream of transactions and divides it to chunks) consider running it one time.

Done.


crates/blockifier/src/test_utils/transfers_simulator.rs line 25 at r3 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Can you please remind me why it's off? In the flow test we might want to charge fee.

This is a block of code I moved from elsewhere. I suggest not changing anything in this file in this PR, and doing it in the next PR: #1921.

If I make changes here, anything changed in the previous PR will mess everything up in this PR.


crates/blockifier/src/test_utils/transfers_simulator.rs line 26 at r3 (raw file):

const RANDOMIZATION_SEED: u64 = 0;
const CHARGE_FEE: bool = false;
const TRANSACTION_VERSION: TransactionVersion = TransactionVersion(StarkFelt::ONE);

See previous comment.

Copy link
Collaborator Author

@avi-starkware avi-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: 2 of 6 files reviewed, 2 unresolved discussions (waiting on @noaov1, @OriStarkware, and @Yoni-Starkware)


crates/blockifier/src/test_utils/transfers_simulator.rs line 25 at r3 (raw file):

Previously, avi-starkware wrote…

This is a block of code I moved from elsewhere. I suggest not changing anything in this file in this PR, and doing it in the next PR: #1921.

If I make changes here, anything changed in the previous PR will mess everything up in this PR.

I changed it to true in #1921.


crates/blockifier/src/test_utils/transfers_simulator.rs line 26 at r3 (raw file):

Previously, avi-starkware wrote…

See previous comment.

Done in #1921.

Copy link
Contributor

@OriStarkware OriStarkware 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 4 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noaov1 and @Yoni-Starkware)

noaov1
noaov1 previously approved these changes May 31, 2024
Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 4 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yoni-Starkware)


crates/blockifier/Cargo.toml line 57 at r1 (raw file):

Previously, avi-starkware wrote…

Test code is compiled when the create is built, so it is not considered a dev-dependency when we use it in test-utils as opposed to when we use it in the benchmark.

Does it have some negative affect?

OriStarkware
OriStarkware previously approved these changes Jun 3, 2024
Copy link
Contributor

@OriStarkware OriStarkware 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yoni-Starkware)

Base automatically changed from avi/refactor-benchmark to main June 5, 2024 08:43
@avi-starkware avi-starkware dismissed stale reviews from OriStarkware and noaov1 June 5, 2024 08:43

The base branch was changed.

@avi-starkware avi-starkware force-pushed the avi/concurrency/add-transfers-flow-test branch 2 times, most recently from 68ed4d1 to 7b61429 Compare June 5, 2024 09:01
@avi-starkware
Copy link
Collaborator Author

crates/blockifier/Cargo.toml line 57 at r1 (raw file):

Previously, noaov1 (Noa Oved) wrote…

Does it have some negative affect?

I changed it to be the same as rstest:

  1. set optional = true.
  2. add rand to the feature testing.
  3. add rand to dev-dependencies.

This ensures that rand is available for cargo test and cargo bench, but is not included in the production build.

@avi-starkware avi-starkware force-pushed the avi/concurrency/add-transfers-flow-test branch from 7b61429 to 9cd4260 Compare June 5, 2024 10:27
noaov1
noaov1 previously approved these changes Jun 5, 2024
Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yoni-Starkware)


crates/blockifier/Cargo.toml line 57 at r1 (raw file):

Previously, avi-starkware wrote…

I changed it to be the same as rstest:

  1. set optional = true.
  2. add rand to the feature testing.
  3. add rand to dev-dependencies.

This ensures that rand is available for cargo test and cargo bench, but is not included in the production build.

Nice!

Copy link
Collaborator

@noaov1 noaov1 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Yoni-Starkware)

@avi-starkware avi-starkware merged commit e2cfead into main Jun 5, 2024
9 checks passed
@avi-starkware avi-starkware deleted the avi/concurrency/add-transfers-flow-test branch June 5, 2024 11:43
gswirski pushed a commit to reilabs/blockifier that referenced this pull request Jun 26, 2024
* proof scheduler

* cleared leftovers

* feature fix

* Deserialization and tests fix

* uncommented apply diffs logic

* genesis block fix

* fetching last block

* moved fetching to separate function

* process_block no async

* Adding traces and infos for async functions

* made dojo core work with merger program

* minor logs adjustments in saya

* final world contract

* preparation for http prover

* proving example data by

* serializing arguments

* debug print

* only one program in verifier

* preparing args for prover

* batch size arg

* moved extraction of data from proof to separate module

* minor cleanup

* updated bin/scheduler

* laziness fix and update prover sdk

* half done

* cairo 1 behind flag

* added cairo 0 differ and merger

* support for 2 programs in `upgrade_state`

* end 2 end saya readme

* data extraction from proof

* saya working with cairo 0

* updated prover and readme

* added a clause about keygen

* updated port in readme

* clippy and formatting

* ignored heavy tests

* moved readme to bin

* updated stone prover image

* made tests pass

* removed unneeded files and fixed compilation

* formatting after rebase

* better fetch parallelization

* fixed valid ignoring of not l1_handler

* fixed most tests and made compiled programs one line

* cairo import formatting

* using recursive layout

* changed docker images to latest

* Update examples/spawn-and-move/Scarb.toml

Co-authored-by: glihm <[email protected]>

* most of pr comments

* keeping track of nonce to avoid sleep

* rest of PR comments

* made changes to fix the tests

* formatting

* fixed all the tests

* final formatting

* rebuilt artifacts

* fix: typo in README

* fixed duplicated proving state update

* fix: remove cargo warning for dual license source

* fix: reword some commands + fix options for saya

* fix: update README

* fix: ensure model get fails if no key is provided

* fix: use --bin instead of -p

---------

Co-authored-by: Mateusz Zając <[email protected]>
Co-authored-by: Mateusz <[email protected]>
Co-authored-by: Mateusz Zając <[email protected]>
Co-authored-by: glihm <[email protected]>
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.

4 participants