-
Notifications
You must be signed in to change notification settings - Fork 28
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): remove dupl tip() and resource_bounds() in AccountTx #2101
chore(blockifier): remove dupl tip() and resource_bounds() in AccountTx #2101
Conversation
20f4544
to
ca92528
Compare
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2101 +/- ##
===========================================
+ Coverage 40.10% 74.43% +34.33%
===========================================
Files 26 129 +103
Lines 1895 14904 +13009
Branches 1895 14904 +13009
===========================================
+ Hits 760 11094 +10334
- Misses 1100 3327 +2227
- Partials 35 483 +448 ☔ View full report in Codecov by Sentry. |
ca92528
to
fae60a0
Compare
Artifacts upload triggered. View details here |
fae60a0
to
b436fef
Compare
Artifacts upload triggered. View details here |
Artifacts upload triggered. View details here |
Benchmark movements: |
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 3 files reviewed, 1 unresolved discussion
crates/starknet_api/src/executable_transaction.rs
line 113 at r1 (raw file):
_ => None, }, }
looks like this is already being handled as part of the implementation of tx.tx.resource_bounds() (same for tip)
Code snippet (i):
implement_v3_tx_getters!(
(resource_bounds, ValidResourceBounds),
Code snippet (ii):
macro_rules! implement_v3_tx_getters {
($(($field:ident, $field_type:ty)),*) => {
$(pub fn $field(&self) -> $field_type {
match self {
Self::V3(tx) => tx.$field.clone(),
_ => panic!("{:?} do not support the field {}; they are only available for V3 transactions.", self.version(), stringify!($field)),
}
})*
};
}
bb05e10
to
8706fa8
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 3 files reviewed, 2 unresolved discussions (waiting on @avivg-starkware)
crates/starknet_api/src/executable_transaction.rs
line 113 at r1 (raw file):
Previously, avivg-starkware wrote…
looks like this is already being handled as part of the implementation of tx.tx.resource_bounds() (same for tip)
What does it mean?
crates/blockifier/src/transaction/account_transaction.rs
line 113 at r1 (raw file):
})* }; }
Is this still needed?
Code quote:
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(),
}
})*
};
}
Previously, Yoni-Starkware (Yoni) wrote…
in both funcs above we're making sure that the field 'tx' of the enum AccountTransaction is of version v3. However, for each of those, there is a func resource_bounds() which implements the above macro, and thus panicking if version != v3 there was a duplication, as the blockifier's AccountTransaction implementation didn't actually use the api's AccountTransaction's implementation of those funcs, but rather accessed 'directly' the implementation of the starknet_api::transaction. With that said, the key difference between the 2 implementations I see are: the use of panic vs except (w Option) and clone() vs passing a ref. Perhaps better to leave things as they were? |
Previously, Yoni-Starkware (Yoni) wrote…
Yes as all the below funcs are not implemented by 'Transaction' (= starknet_api::executable_transaction::AccountTransaction) Code snippet: (signature, TransactionSignature),
(nonce, Nonce),
(nonce_data_availability_mode, DataAvailabilityMode),
(fee_data_availability_mode, DataAvailabilityMode),
(paymaster_data, PaymasterData) |
8706fa8
to
49829be
Compare
b436fef
to
17fc2be
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 1 of 3 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @avivg-starkware)
crates/blockifier/src/transaction/account_transaction.rs
line 113 at r1 (raw file):
Previously, avivg-starkware wrote…
Yes as all the below funcs are not implemented by 'Transaction' (= starknet_api::executable_transaction::AccountTransaction)
Can you use implement_tx_getter_calls!
instead of implement_account_tx_inner_getters!
now?
crates/starknet_api/src/executable_transaction.rs
line 113 at r1 (raw file):
Previously, avivg-starkware wrote…
in both funcs above we're making sure that the field 'tx' of the enum AccountTransaction is of version v3.
This 'tx' is either
starknet_api::transaction::InvokeTransaction or
starknet_api::transaction::DeployAccountTransaction or
starknet_api::transaction::DeclareTransactionHowever, for each of those, there is a func resource_bounds() which implements the above macro, and thus panicking if version != v3
there was a duplication, as the blockifier's AccountTransaction implementation didn't actually use the api's AccountTransaction's implementation of those funcs, but rather accessed 'directly' the implementation of the starknet_api::transaction.
With that said, the key difference between the 2 implementations I see are: the use of panic vs except (w Option) and clone() vs passing a ref.
Perhaps better to leave things as they were?
Thanks!
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: 2 of 3 files reviewed, all discussions resolved
crates/blockifier/src/transaction/account_transaction.rs
line 113 at r1 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Can you use
implement_tx_getter_calls!
instead ofimplement_account_tx_inner_getters!
now?
Oh you are doing it in a later PR, so LGTM as long as that future PR gets in :)
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: 2 of 3 files reviewed, all discussions resolved
crates/blockifier/src/transaction/account_transaction.rs
line 113 at r1 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Oh you are doing it in a later PR, so LGTM as long as that future PR gets in :)
(Should have been part of this PR)
Previously, Yoni-Starkware (Yoni) wrote…
I see, will know for the next :) |
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 3 files at r1.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @avivg-starkware)
49829be
to
8b701d7
Compare
17fc2be
to
ec2e90c
Compare
Artifacts upload triggered. View details here |
ec2e90c
to
1a73e85
Compare
8b701d7
to
cc87eaf
Compare
1a73e85
to
eb22856
Compare
1a73e85
to
855ade9
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 r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @avivg-starkware)
No description provided.