feat(starknet_batcher): state reader get compiled classes from class manager#3676
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
ShahakShama
left a comment
There was a problem hiding this comment.
@alonh5 or someone else from your team, please review this :)
Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noamsp-starkware)
crates/papyrus_state_reader/src/papyrus_state_wrapper.rs line 15 at r1 (raw file):
use crate::papyrus_state::PapyrusReader; pub struct PapyrusReaderWrapper {
Rename to PapyrusReaderWithClassManager
crates/papyrus_state_reader/src/lib.rs line 2 at r1 (raw file):
pub mod papyrus_state; pub mod papyrus_state_wrapper;
Move this file to the batcher
6152f9b to
cae6c3b
Compare
ShahakShama
left a comment
There was a problem hiding this comment.
Reviewed 8 of 8 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noamsp-starkware)
crates/starknet_batcher/src/papyrus_state_wrapper.rs line 15 at r2 (raw file):
use starknet_types_core::felt::Felt; pub struct PapyrusReaderWithClassManager { papyrus_reader: PapyrusReader,
Change this into a generic StateReader and in the tests use MockStateReader. Rename the struct to ReaderWithClassManager and rename the file accordingly
cae6c3b to
653d6e9
Compare
noamsp-starkware
left a comment
There was a problem hiding this comment.
Reviewable status: 4 of 11 files reviewed, 1 unresolved discussion (waiting on @ShahakShama)
crates/starknet_batcher/src/papyrus_state_wrapper.rs line 15 at r2 (raw file):
Previously, ShahakShama wrote…
Change this into a generic StateReader and in the tests use MockStateReader. Rename the struct to ReaderWithClassManager and rename the file accordingly
Done.
ShahakShama
left a comment
There was a problem hiding this comment.
Reviewed 7 of 7 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noamsp-starkware)
crates/blockifier/src/state/state_api.rs line 24 at r3 (raw file):
/// The `self` argument is mutable for flexibility during reads (for example, caching reads), /// and to allow for the `State` trait below to also be considered a `StateReader`. #[cfg_attr(feature = "testing", automock)]
@dorimedini-starkware please approve this change
crates/starknet_batcher/src/reader_with_class_manager_test.rs line 14 at r3 (raw file):
#[tokio::test] async fn test_get_compiled_class() {
In a different PR, create a test for each of the other methods to make sure that you pass the call to the inner state reader
dorimedini-starkware
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noamsp-starkware and @ShahakShama)
crates/blockifier/src/state/state_api.rs line 24 at r3 (raw file):
Previously, ShahakShama wrote…
@dorimedini-starkware please approve this change
- what is automock?
- consider using
mockall::automockso you don't need the extra gateduseat the top - if you gate code behind
feature = "testing"and nottest, then that means your crate tests do not use this and it is only a test util for external use (we will be disallowing crates depending on self with the testing feature activated - we want no dependency cycles). If it is also used for internal testing please use#[cfg_attr(any(test, feature = "testing"), automock)]
ShahakShama
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noamsp-starkware)
crates/blockifier/src/state/state_api.rs line 24 at r3 (raw file):
Previously, dorimedini-starkware wrote…
- what is automock?
- consider using
mockall::automockso you don't need the extra gateduseat the top- if you gate code behind
feature = "testing"and nottest, then that means your crate tests do not use this and it is only a test util for external use (we will be disallowing crates depending on self with the testing feature activated - we want no dependency cycles). If it is also used for internal testing please use#[cfg_attr(any(test, feature = "testing"), automock)]
- It creates a struct called Mock* where * is name of trait that for each function in the trait annotated as foo it has a function called expect_foo that tells what to return when someone calls foo
- Good idea
- I agree. @noamsp-starkware please make this change
653d6e9 to
8c85c60
Compare
noamsp-starkware
left a comment
There was a problem hiding this comment.
Reviewable status: 5 of 12 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware and @ShahakShama)
crates/starknet_batcher/src/reader_with_class_manager_test.rs line 14 at r3 (raw file):
Previously, ShahakShama wrote…
In a different PR, create a test for each of the other methods to make sure that you pass the call to the inner state reader
Added a TODO for this.
ShahakShama
left a comment
There was a problem hiding this comment.
Reviewed 7 of 7 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @noamsp-starkware)

No description provided.