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 replace_class cairo native syscall #1551

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

PearsonWhite
Copy link
Contributor

Implements thereplace_class syscall for native cairo syscall handler.

@PearsonWhite PearsonWhite added the native integration Related with the integration of Cairo Native into the Blockifier label Oct 24, 2024
@reviewable-StarkWare
Copy link

This change is Reviewable

@PearsonWhite PearsonWhite changed the base branch from main to rdr/update-testing-suite October 24, 2024 15:20
Copy link

Artifacts upload triggered. View details here

Copy link

Artifacts upload triggered. View details here

Copy link

Artifacts upload triggered. View details here

@PearsonWhite PearsonWhite marked this pull request as ready for review October 25, 2024 20:20
Copy link
Contributor

@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.

Please, rebase / change target branch to #1305

Reviewable status: 0 of 4 files reviewed, 3 unresolved discussions (waiting on @PearsonWhite)


crates/blockifier/src/execution/native/syscall_handler.rs line 180 at r3 (raw file):

            .state
            .get_compiled_contract_class(class_hash)
            .expect("Failed to get ContractClass from class hash: {class_hash}.");

Please, be consistent with VM implementation, return the runtime error here, not panic


crates/blockifier/src/execution/native/syscall_handler.rs line 186 at r3 (raw file):

                let err =
                    &SyscallExecutionError::ForbiddenClassReplacement { class_hash }.to_string();
                panic!("{err:?}");

Don't use panic here


crates/blockifier/src/execution/native/syscall_handler.rs line 191 at r3 (raw file):

                self.state
                    .set_class_hash_at(self.contract_address, class_hash)
                    .expect("Failed to set class hash for class hash: {class_hash}.");

And here

@rodrigo-pino rodrigo-pino force-pushed the rdr/update-testing-suite branch 2 times, most recently from a00994e to e2c9fe8 Compare October 28, 2024 15:36
@PearsonWhite PearsonWhite force-pushed the pwhite/replace_class branch 2 times, most recently from 12eb020 to 4a2d661 Compare October 28, 2024 18:44
@PearsonWhite PearsonWhite changed the base branch from rdr/update-testing-suite to rdr/add-syscall-counting October 28, 2024 18:45
Copy link

Artifacts upload triggered. View details here

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.04%. Comparing base (e3165c4) to head (8a2e742).
Report is 410 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1551       +/-   ##
===========================================
+ Coverage   40.10%   69.04%   +28.93%     
===========================================
  Files          26      105       +79     
  Lines        1895    13665    +11770     
  Branches     1895    13665    +11770     
===========================================
+ Hits          760     9435     +8675     
- Misses       1100     3827     +2727     
- Partials       35      403      +368     

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

Copy link
Contributor Author

@PearsonWhite PearsonWhite left a comment

Choose a reason for hiding this comment

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

I rebased it onto rdr/add-syscall-counting because it doesn't depend on rdr/native-storage-read.

Reviewable status: 0 of 5 files reviewed, 3 unresolved discussions (waiting on @varex83)


crates/blockifier/src/execution/native/syscall_handler.rs line 180 at r3 (raw file):

Previously, varex83 (Bohdan Ohorodnii) wrote…

Please, be consistent with VM implementation, return the runtime error here, not panic

Done.


crates/blockifier/src/execution/native/syscall_handler.rs line 186 at r3 (raw file):

Previously, varex83 (Bohdan Ohorodnii) wrote…

Don't use panic here

Done.


crates/blockifier/src/execution/native/syscall_handler.rs line 191 at r3 (raw file):

Previously, varex83 (Bohdan Ohorodnii) wrote…

And here

Done.

@rodrigo-pino rodrigo-pino force-pushed the rdr/add-syscall-counting branch 2 times, most recently from 147c1d3 to ded98cf Compare October 29, 2024 14:23
@varex83 varex83 force-pushed the pwhite/replace_class branch from 4a2d661 to 1fc159e Compare October 30, 2024 11:01
Copy link

Artifacts upload triggered. View details here

Copy link

Artifacts upload triggered. View details here

Copy link

Artifacts upload triggered. View details here

@rodrigo-pino rodrigo-pino force-pushed the rdr/add-syscall-counting branch from ded98cf to 6427073 Compare October 30, 2024 21:28
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 5 files at r4, 5 of 6 files at r5, all commit messages.
Reviewable status: 6 of 7 files reviewed, 3 unresolved discussions (waiting on @noaov1 and @varex83)

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

Copy link

Artifacts upload triggered. View details here

@rodrigo-pino rodrigo-pino changed the base branch from main to rdr/handle-syscall-error November 12, 2024 10:52
Copy link

Artifacts upload triggered. View details here

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

@rodrigo-pino rodrigo-pino force-pushed the rdr/handle-syscall-error branch 2 times, most recently from 5a001b3 to d90688f Compare November 12, 2024 15:00
@varex83 varex83 force-pushed the pwhite/replace_class branch from 6a12c44 to b7222f2 Compare November 13, 2024 11:04
Copy link

Artifacts upload triggered. View details here

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.

Reviewed 1 of 4 files at r10, 1 of 1 files at r11, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @noaov1 and @Yoni-Starkware)

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

@rodrigo-pino rodrigo-pino force-pushed the rdr/handle-syscall-error branch 2 times, most recently from 816c81b to b0fa3a9 Compare November 14, 2024 12:36
@varex83 varex83 changed the base branch from rdr/handle-syscall-error to main November 14, 2024 16:10
@varex83 varex83 force-pushed the pwhite/replace_class branch from b7222f2 to 8a2e742 Compare November 14, 2024 16:14
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 2 files at r12, all commit messages.
Reviewable status: 6 of 7 files reviewed, 1 unresolved discussion (waiting on @avi-starkware, @noaov1, @PearsonWhite, and @Yoni-Starkware)


crates/blockifier/src/execution/syscalls/syscall_tests/replace_class.rs line 60 at r12 (raw file):

#[cfg_attr(
    feature = "cairo_native",
    test_case(FeatureContract::TestContract(CairoVersion::Native), 13850; "Native")

The previous gas price was the right price. I believe it will be fixed after the update.

Code quote:

test_case(FeatureContract::TestContract(CairoVersion::Native), 13850; "Native")

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 2 files at r12.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noaov1, @PearsonWhite, 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.

:lgtm:

Reviewed 2 of 2 files at r12, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @noaov1 and @PearsonWhite)

@Yoni-Starkware Yoni-Starkware merged commit 3c69ac8 into main Nov 17, 2024
12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 18, 2024
@meship-starkware meship-starkware deleted the pwhite/replace_class branch November 19, 2024 08:49
@meship-starkware meship-starkware restored the pwhite/replace_class branch November 19, 2024 08:50
@meship-starkware meship-starkware deleted the pwhite/replace_class branch November 19, 2024 08:50
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.

6 participants