-
Notifications
You must be signed in to change notification settings - Fork 65
starknet_os_flow_tests: add control for expected reverting txs #9480
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
starknet_os_flow_tests: add control for expected reverting txs #9480
Conversation
dorimedini-starkware
left a comment
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, all discussions resolved (waiting on @amosStarkware and @TzahiTaub)
crates/starknet_os_flow_tests/src/tests.rs line 273 at r1 (raw file):
sender_address: *FUNDED_ACCOUNT_ADDRESS, nonce: nonce_manager.next(*FUNDED_ACCOUNT_ADDRESS), calldata: create_calldata(test_contract_address, "write_and_revert", &[Felt::ONE, Felt::TWO]),
was previously reverted, but for the wrong reason (missing params)
Code quote:
&[Felt::ONE, Felt::TWO]0a931fa to
923885c
Compare
fc8c397 to
8611c44
Compare
923885c to
57fc21d
Compare
TzahiTaub
left a comment
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.
@TzahiTaub reviewed 1 of 1 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @amosStarkware)
crates/starknet_os_flow_tests/src/test_manager.rs line 94 at r3 (raw file):
tx: BlockifierTransaction, revert_reason: Option<String>, }
Just to ask, do you think the optional field is better than having an enum for the entire tx? With something like this pseudo?
Suggestion:
pub(crate) enum FlowTestTx {
succesful/accepted({tx: BlockifierTransaction})
reverted({
tx: BlockifierTransaction,
revert_reason: String}
}crates/starknet_os_flow_tests/src/test_manager.rs line 445 at r3 (raw file):
fn verify_execution_outputs( revert_reasons: &[Option<String>], execution_outputs: &[(TransactionExecutionInfo, StateMaps)],
Please verify that both slices are of the same length
Code quote:
revert_reasons: &[Option<String>],
execution_outputs: &[(TransactionExecutionInfo, StateMaps)],crates/starknet_os_flow_tests/src/test_manager.rs line 529 at r3 (raw file):
.into_iter() .map(|flow_test_tx| (flow_test_tx.tx, flow_test_tx.revert_reason)) .unzip();
Suggestion:
let (block_txs, revert_reasons): (Vec<_>, Vec<_>) = block_txs_with_reason
.into_iter()
.map(|flow_test_tx| (flow_test_tx.tx, flow_test_tx.revert_reason))
.unzip();
// Clone the block info for later use.8611c44 to
4991eb5
Compare
57fc21d to
1178d98
Compare
13fbf11 to
b40ab5c
Compare
b83b978 to
68f9b19
Compare
b40ab5c to
58caca8
Compare
68f9b19 to
f88053c
Compare
58caca8 to
9593ab0
Compare
f88053c to
d414c5c
Compare
AvivYossef-starkware
left a comment
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: 1 of 3 files reviewed, all discussions resolved (waiting on @amosStarkware and @TzahiTaub)
crates/starknet_os_flow_tests/src/test_manager.rs line 333 at r3 (raw file):
Previously, dorimedini-starkware wrote…
StarknetOsInputuses this type as the key for thedeprecated_compiled_classesmap, is this a bug?
since "class hash" refers to sierra hash and "compiled class hash" refers to casm hash, maybe "compiled class hash" is a better term for a cairo0 compiled contract hash. no?
What is this represent? The hash of what?
I see that in thin state_diff it saved by class_hash.
There is class_hash for deprecated contract class here
#[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)]
pub struct StateDiff {
pub deployed_contracts: IndexMap<ContractAddress, ClassHash>,
pub storage_diffs: IndexMap<ContractAddress, IndexMap<StorageKey, Felt>>,
pub declared_classes: IndexMap<ClassHash, (CompiledClassHash, SierraContractClass)>,
pub migrated_compiled_classes: IndexMap<ClassHash, CompiledClassHash>,
pub deprecated_declared_classes: IndexMap<ClassHash, DeprecatedContractClass>,
pub nonces: IndexMap<ContractAddress, Nonce>,
}
dorimedini-starkware
left a comment
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: 1 of 3 files reviewed, all discussions resolved (waiting on @amosStarkware and @TzahiTaub)
crates/starknet_os_flow_tests/src/test_manager.rs line 333 at r3 (raw file):
Previously, AvivYossef-starkware wrote…
What is this represent? The hash of what?
I see that in thin state_diff it saved byclass_hash.
There is class_hash for deprecated contract class here#[derive(Debug, Default, Clone, Eq, PartialEq, Deserialize, Serialize)] pub struct StateDiff { pub deployed_contracts: IndexMap<ContractAddress, ClassHash>, pub storage_diffs: IndexMap<ContractAddress, IndexMap<StorageKey, Felt>>, pub declared_classes: IndexMap<ClassHash, (CompiledClassHash, SierraContractClass)>, pub migrated_compiled_classes: IndexMap<ClassHash, CompiledClassHash>, pub deprecated_declared_classes: IndexMap<ClassHash, DeprecatedContractClass>, pub nonces: IndexMap<ContractAddress, Nonce>, }
this represents the hash of a cairo0 contract.
there is only one way to compute this hash (right?)
(unlike cairo1, where we have sierra/casm hashes)
in any case, since the issue is the type in the OS input struct, I would say this is out of scope... and not a blocker, because the underlying type is a Felt anyway
AvivYossef-starkware
left a comment
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: 1 of 3 files reviewed, all discussions resolved (waiting on @amosStarkware and @TzahiTaub)
crates/starknet_os_flow_tests/src/test_manager.rs line 333 at r3 (raw file):
Previously, dorimedini-starkware wrote…
this represents the hash of a cairo0 contract.
there is only one way to compute this hash (right?)
(unlike cairo1, where we have sierra/casm hashes)in any case, since the issue is the type in the OS input struct, I would say this is out of scope... and not a blocker, because the underlying type is a Felt anyway
Yes, it's definitely out of scope,
But we should change it in a different PR to be consistent
dorimedini-starkware
left a comment
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: 1 of 3 files reviewed, all discussions resolved (waiting on @amosStarkware and @TzahiTaub)
crates/starknet_os_flow_tests/src/test_manager.rs line 333 at r3 (raw file):
Previously, AvivYossef-starkware wrote…
Yes, it's definitely out of scope,
But we should change it in a different PR to be consistent
d414c5c to
4b5b4f7
Compare
4b5b4f7 to
6faf450
Compare
dorimedini-starkware
left a comment
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.
@dorimedini-starkware reviewed 1 of 1 files at r2, 2 of 2 files at r7, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @amosStarkware)

No description provided.