-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat(starknet_gateway): create transaction generator towards benchmarking #2911
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
a10fc80
to
b486bb3
Compare
456c83f
to
b6d6af6
Compare
21de3b5
to
3305dd6
Compare
b6d6af6
to
cdc7718
Compare
3305dd6
to
e4fac15
Compare
17f602a
to
165237b
Compare
e4fac15
to
a6f5f98
Compare
Benchmark movements: |
584ab22
to
e151662
Compare
a6f5f98
to
7ed8632
Compare
e151662
to
58b1254
Compare
7ed8632
to
ce1576d
Compare
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.
Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: all files reviewed, 11 unresolved discussions (waiting on @alonh5, @ArniStarkware, and @Yael-Starkware)
crates/starknet_gateway/src/gateway.rs
line 29 at r1 (raw file):
pub mod gateway_test; pub struct GatewayBusinessLogic {
Why not pub(crate)?
Code quote:
pub
crates/starknet_gateway/src/gateway.rs
line 79 at r1 (raw file):
pub struct Gateway { pub mempool_client: SharedMempoolClient, pub business_logic: GatewayBusinessLogic,
Why not pub(crate)?
Code quote:
pub
crates/starknet_gateway/bench/gateway_bench.rs
line 15 at r1 (raw file):
use starknet_gateway::bench_test_utils::{BenchTestSetup, BenchTestSetupConfig}; pub fn declare_benchmark(c: &mut Criterion) {
Can these functions not be pub?
Code quote:
pub
crates/starknet_gateway/bench/gateway_bench.rs
line 28 at r1 (raw file):
let test_setup = BenchTestSetup::new(tx_generator_config); c.bench_with_input(BenchmarkId::new("invoke", n_txs), &test_setup, |b, s| {
Can you give meaningful names?
Code quote:
b, s
crates/starknet_gateway/src/bench_test_utils.rs
line 49 at r1 (raw file):
sender_address: ContractAddress, test_contract_address: ContractAddress, }
Can we reuse AccountTransactionGenerator
from sn_api_test_utils?
Code quote:
struct TransactionGenerator {
nonce_manager: NonceManager,
sender_address: ContractAddress,
test_contract_address: ContractAddress,
}
crates/starknet_gateway/src/bench_test_utils.rs
line 71 at r1 (raw file):
} impl BenchTestSetup {
Move the impl closer to the struct
Code quote:
impl BenchTestSetup
crates/starknet_gateway/src/bench_test_utils.rs
line 73 at r1 (raw file):
impl BenchTestSetup { pub fn new(config: BenchTestSetupConfig) -> Self { let cairo_version = CairoVersion::Cairo0;
Why Cairo0?
Code quote:
Cairo0
crates/starknet_gateway/src/lib.rs
line 1 at r1 (raw file):
#[cfg(any(feature = "testing", test))]
Why testing?
Code quote:
#[cfg(any(feature = "testing", test))]
crates/starknet_gateway/src/lib.rs
line 2 at r1 (raw file):
#[cfg(any(feature = "testing", test))] pub mod bench_test_utils;
Why pub?
Code quote:
pub mod bench_test_utils;
crates/starknet_gateway/src/lib.rs
line 14 at r1 (raw file):
mod rpc_state_reader_test; pub mod state_reader; #[cfg(any(feature = "testing", test))]
Why testing?
Code quote:
#[cfg(any(feature = "testing", test))]
crates/starknet_gateway/Cargo.toml
line 58 at r1 (raw file):
name = "gateway_bench" path = "bench/gateway_bench.rs" required-features = ["testing"]
Why do we need this?
Code quote:
required-features = ["testing"]
58b1254
to
416c277
Compare
ce1576d
to
085ed84
Compare
c7fc216
to
ec3911a
Compare
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Yael-Starkware and @yair-starkware)
crates/starknet_gateway/src/lib.rs
line 12 at r7 (raw file):
Previously, alonh5 (Alon Haramati) wrote…
Instead of removing this can you add a "testing" feature and use it in the bench?
@yair-starkware - This is at odds with our discussions on the topic.
IIUC, the feature "testing" is about sharing utilities that other crates can use for testing. For example, starknet_api
has a test_utils
module in the "testing" feature so that the test utils can be used in the gateway's tests.
This is not the case here. Here are the utils used to test this specific crate.
Also, see this that indicates that the benchmark is not considered a test.
We can also create another feature, for example, "bench-testing." Or we can decide it is not an issue to have all this code in the "testing" feature - as, indeed, the bench is an external code that uses code from the module for testing purposes.
Previously, ArniStarkware (Arnon Hod) wrote…
Is it possible to make it an inner module of the bench test? |
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.
Reviewable status: 5 of 7 files reviewed, 1 unresolved discussion (waiting on @alonh5, @Yael-Starkware, and @yair-starkware)
crates/starknet_gateway/src/lib.rs
line 12 at r7 (raw file):
Previously, yair-starkware (Yair) wrote…
Is it possible to make it an inner module of the bench test?
It is possible to move the bench_test_utils
to be an inner module of the bench test. We still have to address the visibility of state_reader_test_utils
. This state reader is used for this bench.
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.
Reviewable status: 5 of 7 files reviewed, 1 unresolved discussion (waiting on @ArniStarkware, @Yael-Starkware, and @yair-starkware)
crates/starknet_gateway/src/lib.rs
line 12 at r7 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
It is possible to move the
bench_test_utils
to be an inner module of the bench test. We still have to address the visibility ofstate_reader_test_utils
. This state reader is used for this bench.
This is testing code, even if other crates currently don't use it. If it's possible please add the "testing" feature and use it in the bench.
ec3911a
to
9eb4575
Compare
Previously, alonh5 (Alon Haramati) wrote…
Done. |
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.
Reviewed 1 of 2 files at r8, 2 of 3 files at r9, 4 of 4 files at r10, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware and @yair-starkware)
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.
Reviewed 1 of 2 files at r8.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Yael-Starkware)
crates/starknet_gateway/src/lib.rs
line 12 at r7 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Done.
I don't want to be too pedantic, but benchmarking is not testing.
You can collect benchmark data and test for regressions.
9eb4575
to
392dca6
Compare
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.
Reviewable status: 3 of 9 files reviewed, 1 unresolved discussion (waiting on @alonh5, @ArniStarkware, and @Yael-Starkware)
crates/starknet_gateway/src/lib.rs
line 13 at r12 (raw file):
pub mod state_reader; #[cfg(any(feature = "testing", test))] pub mod state_reader_test_utils;
TODO: Move to mempool test utils.
Per our latest discussion.
We agreed this is non-blocking.
Code quote:
#[cfg(any(feature = "testing", test))]
pub mod state_reader_test_utils;
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.
Reviewed 3 of 5 files at r11, 1 of 6 files at r12.
Reviewable status: 4 of 9 files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @Yael-Starkware)
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.
Reviewed 1 of 6 files at r12, all commit messages.
Reviewable status: 5 of 9 files reviewed, 2 unresolved discussions (waiting on @ArniStarkware and @Yael-Starkware)
crates/starknet_gateway/bench/bench_lib.rs
line 1 at r12 (raw file):
//! Benchmark module for the starknet gateway crate. It provides functionalities to benchmark
Why do we need this module and not just have the utils in bench/
?
392dca6
to
9eb4575
Compare
Previously, alonh5 (Alon Haramati) wrote…
Reverted. |
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.
Dismissed @alonh5 from a discussion.
Reviewable status: 5 of 9 files reviewed, all discussions resolved (waiting on @alonh5 and @Yael-Starkware)
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.
Reviewed 1 of 2 files at r8, 2 of 6 files at r12, 3 of 4 files at r13, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @alonh5 and @Yael-Starkware)
No description provided.