-
Notifications
You must be signed in to change notification settings - Fork 107
refactor(execution): make the block state of TransactionExecutor an O… #1947
refactor(execution): make the block state of TransactionExecutor an O… #1947
Conversation
20479a4
to
b8da0b4
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1947 +/- ##
==========================================
- Coverage 78.18% 78.17% -0.02%
==========================================
Files 62 62
Lines 8820 8842 +22
Branches 8820 8842 +22
==========================================
+ Hits 6896 6912 +16
- Misses 1486 1492 +6
Partials 438 438 ☔ View full report in Codecov by Sentry. |
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 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @avi-starkware, @barak-b-starkware, and @Yoni-Starkware)
crates/blockifier/src/blockifier/stateful_validator.rs
line 113 at r1 (raw file):
let charge_fee = true; tx.perform_pre_validation_stage( self.tx_executor.block_state.as_mut().expect("The block state should be `Some`."),
Consider defining a getter:
(you may also need a non-mutable reference)
Code quote (i):
self.tx_executor.block_state.as_mut().expect("The block state should be `Some`."),
Code snippet (ii):
pub fn mutable_block_state<'a>(&'a mut self) -> &'a mut CachedState<S> {
self.block_state.as_mut().expect("The block state should be `Some`.")
}
crates/blockifier/src/blockifier/transaction_executor.rs
line 50 at r1 (raw file):
// The transaction executor operates at the block level. It moves the block's state when // operating at the chunk level and gets it back after the chunk is committed, so it needs to // be wrapped with an Option<_>.
Suggestion:
// The transaction executor operates at the block level. In the concurrent mpode, it moves the
// block's state when operating at the chunk level and gets it back after the chunk is committed,
// so it needs to be wrapped with an Option<_>.
Suggestion: // The transaction executor operates at the block level. In concurrency mode, it moves the block state to the worker executor
// - operating at the chunk level - and gets it back after committing the chunk. The block state is
// wrapped with an Option<_> to allow setting it to `None` while it is moved to the worker executor. |
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 all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @barak-b-starkware and @Yoni-Starkware)
crates/blockifier/src/blockifier/transaction_executor.rs
line 177 at r1 (raw file):
self.block_state .as_mut() .expect("The block state should be `Some`.")
Define a const
with this error message. (Unless you define a getter as Noa suggested above.
Code quote:
"The block state should be `Some`."
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, 3 unresolved discussions (waiting on @avi-starkware, @MohammadNassar1, @OriStarkware, and @Yoni-Starkware)
crates/blockifier/src/blockifier/transaction_executor.rs
line 50 at r1 (raw file):
// The transaction executor operates at the block level. It moves the block's state when // operating at the chunk level and gets it back after the chunk is committed, so it needs to // be wrapped with an Option<_>.
Done.
crates/blockifier/src/blockifier/transaction_executor.rs
line 50 at r1 (raw file):
// The transaction executor operates at the block level. It moves the block's state when // operating at the chunk level and gets it back after the chunk is committed, so it needs to // be wrapped with an Option<_>.
Done. Took @avi-starkware 's suggestion that expands yours a little bit.
b8da0b4
to
2433081
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 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @barak-b-starkware, @MohammadNassar1, @OriStarkware, and @Yoni-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 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @barak-b-starkware, @MohammadNassar1, @OriStarkware, and @Yoni-Starkware)
2433081
to
124d1a2
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 @avi-starkware, @MohammadNassar1, @OriStarkware, and @Yoni-Starkware)
crates/blockifier/src/blockifier/stateful_validator.rs
line 113 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Consider defining a getter:
(you may also need a non-mutable reference)
Done. @avi-starkware 's suggestion.
crates/blockifier/src/blockifier/transaction_executor.rs
line 177 at r1 (raw file):
Previously, avi-starkware wrote…
Define a
const
with this error message. (Unless you define a getter as Noa suggested above.
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 4 of 4 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @MohammadNassar1, @OriStarkware, and @Yoni-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 4 of 4 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @MohammadNassar1, @OriStarkware, and @Yoni-Starkware)
124d1a2
to
d90e9b9
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: complete! all files reviewed, all discussions resolved (waiting on @MohammadNassar1 and @OriStarkware)
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 4 of 4 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @MohammadNassar1)
274dcfe
d90e9b9
to
274dcfe
Compare
…n to allow moving it to chunks
274dcfe
to
e275fb3
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 2 of 2 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @MohammadNassar1)
…StateProvider::nonce()` of forked provider (starkware-libs#1947) # Description <!-- A description of what this PR is solving. --> ## Related issue <!-- Please link related issues: Fixes #<issue_number> More info: https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword --> ## Tests <!-- Please refer to the CONTRIBUTING.md file to know more about the testing process. Ensure you've tested at least the package you're modifying if running all the tests consumes too much memory on your system. --> - [ ] Yes - [ ] No, because they aren't needed - [ ] No, because I need help ## Added to documentation? <!-- If the changes are small, code comments are enough, otherwise, the documentation is needed. It may be a README.md file added to your module/package, a DojoBook PR or both. --> - [ ] README.md - [ ] [Dojo Book](https://github.com/dojoengine/book) - [ ] No documentation needed ## Checklist - [ ] I've formatted my code (`scripts/prettier.sh`, `scripts/rust_fmt.sh`, `scripts/cairo_fmt.sh`) - [ ] I've linted my code (`scripts/clippy.sh`, `scripts/docs.sh`) - [ ] I've commented my code - [ ] I've requested a review after addressing the comments
…ption to allow moving it to chunks
This change is