-
Notifications
You must be signed in to change notification settings - Fork 26
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
chore(blockifier): a simple code cleanup in signature_length() #2108
chore(blockifier): a simple code cleanup in signature_length() #2108
Conversation
Artifacts upload triggered. View details here |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2108 +/- ##
===========================================
+ Coverage 40.10% 69.16% +29.05%
===========================================
Files 26 108 +82
Lines 1895 13866 +11971
Branches 1895 13866 +11971
===========================================
+ Hits 760 9590 +8830
- Misses 1100 3867 +2767
- Partials 35 409 +374 ☔ View full report in Codecov by Sentry. |
bb05e10
to
8706fa8
Compare
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
8706fa8
to
49829be
Compare
Artifacts upload triggered. View details here |
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: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @avivg-starkware)
crates/blockifier/src/transaction/account_transaction.rs
line 235 at r1 (raw file):
Transaction::Declare(tx) => tx.signature(), Transaction::DeployAccount(tx) => tx.signature(), Transaction::Invoke(tx) => tx.signature(),
Are we cloning the signature here?
Code quote:
let signature = match &self.tx {
Transaction::Declare(tx) => tx.signature(),
Transaction::DeployAccount(tx) => tx.signature(),
Transaction::Invoke(tx) => tx.signature(),
Previously, Yoni-Starkware (Yoni) wrote…
yes,
both through the blockifier and the Api, 'signature' is currently cloned. with the current implementation it is actually cloned twice, once by the transaction (tx field) and another by the executable transaction. Code snippet (i): implement_account_tx_inner_getters!(
(signature, TransactionSignature),
... Code snippet (ii): macro_rules! implement_account_tx_inner_getters {
($(($field:ident, $field_type:ty)),*) => {
$(pub fn $field(&self) -> $field_type {
match &self.tx {
// TODO(AvivG): Consider moving some of the logic to the Transaction enum.
Transaction::Declare(tx) => tx.tx.$field().clone(),
Transaction::DeployAccount(tx) => tx.tx.$field().clone(),
Transaction::Invoke(tx) => tx.tx.$field().clone(),
}
})*
};
} |
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: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @avivg-starkware)
crates/blockifier/src/transaction/account_transaction.rs
line 235 at r1 (raw file):
Previously, avivg-starkware wrote…
yes,
before the change by using the following macro.
and After with a slight change:
- In chore(blockifier): remove dupl tip() and resource_bounds() in AccountTx #2101, the macro is copied to starknet_api::executable_transaction (implementing other getters)
- and in chore(blockifier): slight diff impl for AccountTransaction getters #2102, the macro is removed from blockifier::account_transaction, and implemented for 'signature' as well
both through the blockifier and the Api, 'signature' is currently cloned.
with the current implementation it is actually cloned twice, once by the transaction (tx field) and another by the executable transaction.
I can try and change this but this might mean separating to another macro, as it might not be the case for the other implementations of the macro. Would you like me to try and check?
Maybe we should have one additional macro that returns a reference.
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: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @avivg-starkware)
crates/blockifier/src/transaction/account_transaction.rs
line 235 at r1 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Maybe we should have one additional macro that returns a reference.
Let's talk
49829be
to
8b701d7
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: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @Yoni-Starkware)
crates/blockifier/src/transaction/account_transaction.rs
line 235 at r1 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Let's talk
Added a TODO
Artifacts upload triggered. View details here |
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: complete! all files reviewed, all discussions resolved (waiting on @avivg-starkware)
No description provided.