-
Notifications
You must be signed in to change notification settings - Fork 27
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
refactor: add casm contract class struct compatible for executable transaction #357
refactor: add casm contract class struct compatible for executable transaction #357
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @ArniStarkware and the rest of your teammates on Graphite |
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 3 files at r1, 1 of 2 files at r2, 2 of 4 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArniStarkware)
crates/blockifier/src/transaction/transactions.rs
line 177 at r4 (raw file):
} pub fn create_from_executable_tx(
Do we need both this and TryFrom
?
You can either implement only TryFrom
or make this method private.
Code quote:
pub fn create_from_executable_tx(
crates/blockifier/src/transaction/transactions.rs
line 185 at r4 (raw file):
let class_info: ClassInfo = class_info.try_into()?; // Assert that the ContractClass matches the TransactionVersion, and return the result.
Do you mean the ContractClassVersionMismatch
error?
Self::create
can also return other errors.
Also, I'm not sure what do you mean by "In this flow"?
crates/starknet_api/src/contract_class.rs
line 1 at r4 (raw file):
use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass;
Please add documentation for all of the new types.
fc926d3
to
5c954f4
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: 3 of 6 files reviewed, 3 unresolved discussions (waiting on @dafnamatsry)
crates/blockifier/src/transaction/transactions.rs
line 177 at r4 (raw file):
Previously, dafnamatsry wrote…
Do we need both this and
TryFrom
?
You can either implement onlyTryFrom
or make this method private.
Done.
(This fix assumes we are never going to call create_from_executable_tx
with only_query = true.
The only_query
flow is deprecated anyway IIUC).
crates/blockifier/src/transaction/transactions.rs
line 185 at r4 (raw file):
Previously, dafnamatsry wrote…
Do you mean the
ContractClassVersionMismatch
error?
Self::create
can also return other errors.Also, I'm not sure what do you mean by "In this flow"?
Removed. I was mistaken.
The PR is now comprised of 3 commits only.
(For the record: I do mean the ContractClassVersionMismatch
error.
IIUC, Self::create
can return only this error. The only possible fail is on verify_contract_class_version
, which can only fail on ContractClassVersionMismatch
- or am I missing something?
The issue is - that this method can indeed fail in "In this flow". There are inputs for this function that may cause it to fail.)
crates/starknet_api/src/contract_class.rs
line 1 at r4 (raw file):
Previously, dafnamatsry wrote…
Please add documentation for all of the new types.
Done.
5c954f4
to
19f98a9
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 3 of 3 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArniStarkware)
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: all files reviewed, 3 unresolved discussions (waiting on @ArniStarkware and @dafnamatsry)
crates/blockifier/src/execution/contract_class.rs
line 504 at r5 (raw file):
type Error = ProgramError; fn try_from(value: starknet_api::contract_class::ClassInfo) -> Result<Self, Self::Error> {
Suggestion:
class_info
crates/blockifier/src/transaction/transactions.rs
line 142 at r5 (raw file):
fn try_from( value: starknet_api::executable_transaction::DeclareTransaction,
Suggestion:
declare_tx
19f98a9
to
fdd1323
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: 4 of 6 files reviewed, 1 unresolved discussion (waiting on @dafnamatsry)
crates/blockifier/src/execution/contract_class.rs
line 504 at r5 (raw file):
type Error = ProgramError; fn try_from(value: starknet_api::contract_class::ClassInfo) -> Result<Self, Self::Error> {
Done.
crates/blockifier/src/transaction/transactions.rs
line 142 at r5 (raw file):
fn try_from( value: starknet_api::executable_transaction::DeclareTransaction,
Done.
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 r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ArniStarkware)
This is a draft. A PR composed of multiple commits, which show the process handled one step at a time.
refactor: add casm contract class struct compatible for executable transaction
refactor: use casm contract class for executable transaction
refactor: add try from executable declare tx to account tx
chore: remove handle of impossible scenarios
This change is