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

feat(blockifier): add get_execution_info_v1 syscall #1735

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

varex83
Copy link
Contributor

@varex83 varex83 commented Nov 2, 2024

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@varex83 varex83 force-pushed the bohdan/get-execution-info branch from c58b28b to ecaf982 Compare November 2, 2024 22:42
Copy link

github-actions bot commented Nov 2, 2024

Artifacts upload triggered. View details here

@varex83 varex83 added the native integration Related with the integration of Cairo Native into the Blockifier label Nov 2, 2024
Copy link

codecov bot commented Nov 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.06%. Comparing base (e3165c4) to head (e75ea9a).
Report is 401 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1735       +/-   ##
===========================================
+ Coverage   40.10%   69.06%   +28.96%     
===========================================
  Files          26      105       +79     
  Lines        1895    13658    +11763     
  Branches     1895    13658    +11763     
===========================================
+ Hits          760     9433     +8673     
- Misses       1100     3822     +2722     
- Partials       35      403      +368     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@varex83 varex83 force-pushed the bohdan/get-execution-info branch from ecaf982 to c89a2d6 Compare November 2, 2024 22:52
Copy link

github-actions bot commented Nov 2, 2024

Artifacts upload triggered. View details here

@rodrigo-pino rodrigo-pino force-pushed the rdr/add-syscall-counting branch from 60e2392 to 538df34 Compare November 6, 2024 18:25
Copy link
Contributor

@meship-starkware meship-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 2 of 6 files at r1, all commit messages.
Reviewable status: 2 of 6 files reviewed, all discussions resolved (waiting on @noaov1)

Copy link
Contributor

@meship-starkware meship-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 4 of 6 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @noaov1 and @varex83)


crates/blockifier/src/execution/syscalls/syscall_tests/get_execution_info.rs line 267 at r1 (raw file):

    let word_in_hex: String =
        s.as_bytes().iter().fold(String::new(), |s, byte| s + (&format!("{:02x}", byte)));
    [prefix, &padding_zeros, &word_in_hex].into_iter().collect()

Why did you remove this test?

Code quote:

#[test]
fn test_gas_types_constants() {
    assert_eq!(str_to_32_bytes_in_hex("L1_GAS"), Resource::L1Gas.to_hex());
    assert_eq!(str_to_32_bytes_in_hex("L2_GAS"), Resource::L2Gas.to_hex());
    assert_eq!(str_to_32_bytes_in_hex("L1_DATA"), Resource::L1DataGas.to_hex());
}

fn str_to_32_bytes_in_hex(s: &str) -> String {
    if s.len() > 32 {
        panic!("Unsupported input of length > 32.")
    }
    let prefix = "0x";
    let padding_zeros = "0".repeat(64 - s.len() * 2); // Each string char is 2 chars in hex.
    let word_in_hex: String =
        s.as_bytes().iter().fold(String::new(), |s, byte| s + (&format!("{:02x}", byte)));
    [prefix, &padding_zeros, &word_in_hex].into_iter().collect()

crates/blockifier/src/transaction/objects.rs line 92 at r1 (raw file):

    pub fn max_fee(&self) -> TransactionFeeResult<Fee> {
        match self {
            Self::Current(_context) => Ok(Fee(0)),

Suggestion:

Self::Current(_) => Ok(Fee(0)),

Copy link
Contributor

@meship-starkware meship-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: all files reviewed, 3 unresolved discussions (waiting on @noaov1 and @varex83)


crates/blockifier/src/transaction/objects.rs line 90 at r1 (raw file):

    }

    pub fn max_fee(&self) -> TransactionFeeResult<Fee> {

Why are you returning a result? Where can it fail?

Code quote:

TransactionFeeResult

@varex83 varex83 force-pushed the bohdan/get-execution-info branch from c89a2d6 to 2efef80 Compare November 7, 2024 10:57
Copy link

github-actions bot commented Nov 7, 2024

Artifacts upload triggered. View details here

@varex83 varex83 force-pushed the bohdan/get-execution-info branch from 2efef80 to 70aaed6 Compare November 7, 2024 11:03
Copy link

github-actions bot commented Nov 7, 2024

Artifacts upload triggered. View details here

Copy link
Contributor Author

@varex83 varex83 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: 2 of 6 files reviewed, 1 unresolved discussion (waiting on @meship-starkware and @noaov1)


crates/blockifier/src/execution/syscalls/syscall_tests/get_execution_info.rs line 267 at r1 (raw file):

Previously, meship-starkware (Meshi Peled) wrote…

Why did you remove this test?

Done

Most likely some rebasing problems 👀


crates/blockifier/src/transaction/objects.rs line 90 at r1 (raw file):

Previously, meship-starkware (Meshi Peled) wrote…

Why are you returning a result? Where can it fail?

Done


crates/blockifier/src/transaction/objects.rs line 92 at r1 (raw file):

    pub fn max_fee(&self) -> TransactionFeeResult<Fee> {
        match self {
            Self::Current(_context) => Ok(Fee(0)),

Done

Copy link
Contributor

@meship-starkware meship-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 1 of 4 files at r2.
Reviewable status: 3 of 6 files reviewed, all discussions resolved (waiting on @noaov1)

Copy link
Contributor

@meship-starkware meship-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 3 of 4 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1)

@rodrigo-pino rodrigo-pino force-pushed the rdr/add-syscall-counting branch from 538df34 to 861b3c2 Compare November 7, 2024 15:32
@varex83 varex83 force-pushed the bohdan/get-execution-info branch 2 times, most recently from 5af9c72 to 82c7715 Compare November 8, 2024 12:26
Copy link

github-actions bot commented Nov 8, 2024

Artifacts upload triggered. View details here

@rodrigo-pino rodrigo-pino force-pushed the rdr/add-syscall-counting branch from 861b3c2 to ffba45f Compare November 9, 2024 10:48
Copy link
Contributor

@meship-starkware meship-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 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1)

@rodrigo-pino rodrigo-pino force-pushed the rdr/add-syscall-counting branch 4 times, most recently from 139d79d to 3d4ab3d Compare November 10, 2024 11:48
Copy link
Contributor

@meship-starkware meship-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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @avi-starkware, @noaov1, and @Yoni-Starkware)

@varex83 varex83 force-pushed the bohdan/get-execution-info branch 2 times, most recently from 1d5dd26 to ffd093d Compare November 13, 2024 13:57
Copy link

Artifacts upload triggered. View details here

@varex83 varex83 force-pushed the bohdan/get-execution-info branch from ffd093d to f3a504e Compare November 13, 2024 14:18
Copy link

Artifacts upload triggered. View details here

Copy link
Contributor

@meship-starkware meship-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 1 of 1 files at r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @avi-starkware, @noaov1, and @Yoni-Starkware)

Copy link
Contributor

@avi-starkware avi-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 r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1 and @Yoni-Starkware)

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 1 of 6 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noaov1 and @varex83)


crates/blockifier/src/transaction/objects.rs line 101 at r7 (raw file):

    }

    pub fn max_fee(&self) -> Fee {

Please remove max_fee_for_execution_info and use this one

Suggestion:

max_fee_for_execution_info_syscall

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: all files reviewed, 2 unresolved discussions (waiting on @noaov1 and @varex83)


crates/blockifier/src/test_utils/contracts.rs line 118 at r7 (raw file):

            Self::LegacyTestContract | Self::CairoStepsTestContract => CairoVersion::Cairo1,
            #[cfg(feature = "cairo_native")]
            Self::SierraExecutionInfoV1Contract => CairoVersion::Native,

Why can't you use the existing contract?

Copy link
Contributor

@meship-starkware meship-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: all files reviewed, 2 unresolved discussions (waiting on @noaov1, @varex83, and @Yoni-Starkware)


crates/blockifier/src/test_utils/contracts.rs line 118 at r7 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Why can't you use the existing contract?

This is how the contract in the test utils is defined. For now, native has its directory for both contracts and compiled contracts. This PR should fix this #1455

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: all files reviewed, 1 unresolved discussion (waiting on @noaov1 and @varex83)


crates/blockifier/src/test_utils/contracts.rs line 118 at r7 (raw file):

Previously, meship-starkware (Meshi Peled) wrote…

This is how the contract in the test utils is defined. For now, native has its directory for both contracts and compiled contracts. This PR should fix this #1455

Cool

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: all files reviewed, 2 unresolved discussions (waiting on @meship-starkware, @noaov1, and @varex83)


crates/blockifier/src/test_utils/contracts.rs line 118 at r7 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Cool

Can we move forward with this PR?

Copy link
Contributor Author

@varex83 varex83 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: all files reviewed, 2 unresolved discussions (waiting on @meship-starkware, @noaov1, and @Yoni-Starkware)


crates/blockifier/src/transaction/objects.rs line 101 at r7 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Please remove max_fee_for_execution_info and use this one

Do you mean to remove this max_fee function, and use max_fee_for_execution_info instead?

Copy link
Contributor Author

@varex83 varex83 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: all files reviewed, 2 unresolved discussions (waiting on @meship-starkware, @noaov1, and @Yoni-Starkware)


crates/blockifier/src/test_utils/contracts.rs line 118 at r7 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Can we move forward with this PR?

One main reason we use SierraExecutionInfoV1Contract is to test get_execution_info_v1 using the same tests we use for get_execution_info_v2. The difference is in the imports, for v2 we use starknet::get_execution_info, and for v1 - starknet::syscalls::get_execution_info_syscall.

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 1 of 6 files at r1, 1 of 3 files at r5, 1 of 1 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noaov1 and @varex83)


crates/blockifier/src/transaction/objects.rs line 101 at r7 (raw file):

Previously, varex83 (Bohdan Ohorodnii) wrote…

Do you mean to remove this max_fee function, and use max_fee_for_execution_info instead?

Rename max_fee -> max_fee_for_execution_info_syscall, delete max_fee_for_execution_info
and use your function instead

@varex83 varex83 force-pushed the bohdan/get-execution-info branch from f3a504e to 7f6d275 Compare November 14, 2024 11:36
Copy link

Artifacts upload triggered. View details here

Copy link
Contributor Author

@varex83 varex83 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: 4 of 9 files reviewed, 1 unresolved discussion (waiting on @avi-starkware, @meship-starkware, @noaov1, and @Yoni-Starkware)


crates/blockifier/src/transaction/objects.rs line 101 at r7 (raw file):

Previously, Yoni-Starkware (Yoni) wrote…

Rename max_fee -> max_fee_for_execution_info_syscall, delete max_fee_for_execution_info
and use your function instead

Done.

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 3 files at r4, 5 of 5 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1)

Copy link
Contributor

@meship-starkware meship-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 5 of 5 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1)

Copy link
Contributor

@meship-starkware meship-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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1)

@varex83 varex83 force-pushed the bohdan/get-execution-info branch from 7f6d275 to e75ea9a Compare November 14, 2024 13:37
Copy link

Artifacts upload triggered. View details here

Copy link
Contributor

@meship-starkware meship-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 3 of 3 files at r9.
Reviewable status: all files reviewed (commit messages unreviewed), all discussions resolved (waiting on @noaov1)

Copy link
Contributor

@meship-starkware meship-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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1)

@meship-starkware meship-starkware merged commit 564ad89 into main Nov 14, 2024
13 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2024
@meship-starkware meship-starkware deleted the bohdan/get-execution-info branch November 19, 2024 08:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
native integration Related with the integration of Cairo Native into the Blockifier
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants