Skip to content
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

Merged

Conversation

avivg-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link

Artifacts upload triggered. View details here

Copy link

codecov bot commented Nov 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.16%. Comparing base (e3165c4) to head (8b701d7).
Report is 594 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@avivg-starkware avivg-starkware force-pushed the avivg/blockifier/signature_length_simple_code_cleanup branch from bb05e10 to 8706fa8 Compare November 17, 2024 13:07
@avivg-starkware avivg-starkware changed the title chore(blockifier): a simple code cleanup in sugnature_length() chore(blockifier): a simple code cleanup in signature_length() Nov 17, 2024
Copy link

Artifacts upload triggered. View details here

Copy link

Artifacts upload triggered. View details here

@avivg-starkware avivg-starkware force-pushed the avivg/blockifier/signature_length_simple_code_cleanup branch from 8706fa8 to 49829be Compare November 17, 2024 13:53
Copy link

Artifacts upload triggered. View details here

Copy link
Collaborator

@Yoni-Starkware Yoni-Starkware left a 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(),

@avivg-starkware
Copy link
Contributor Author

crates/blockifier/src/transaction/account_transaction.rs line 235 at r1 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Are we cloning the signature here?

yes,
before the change by using the following macro.
and After with a slight change:

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?

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(),
            }
        })*
    };
}

Copy link
Collaborator

@Yoni-Starkware Yoni-Starkware left a 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:

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.

Copy link
Collaborator

@Yoni-Starkware Yoni-Starkware left a 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

@avivg-starkware avivg-starkware force-pushed the avivg/blockifier/signature_length_simple_code_cleanup branch from 49829be to 8b701d7 Compare November 20, 2024 16:03
Copy link
Contributor Author

@avivg-starkware avivg-starkware left a 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

Copy link

Artifacts upload triggered. View details here

Copy link
Collaborator

@Yoni-Starkware Yoni-Starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @avivg-starkware)

@avivg-starkware avivg-starkware merged commit cc87eaf into main Nov 27, 2024
12 checks passed
@avivg-starkware avivg-starkware deleted the avivg/blockifier/signature_length_simple_code_cleanup branch November 27, 2024 12:43
@github-actions github-actions bot locked and limited conversation to collaborators Nov 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants