-
Notifications
You must be signed in to change notification settings - Fork 107
Added a test for the scenario when a non deployed user invokes a transaction #971
Added a test for the scenario when a non deployed user invokes a transaction #971
Conversation
Codecov Report
@@ Coverage Diff @@
## main #971 +/- ##
==========================================
+ Coverage 68.79% 70.03% +1.23%
==========================================
Files 47 47
Lines 5987 6384 +397
Branches 5987 6384 +397
==========================================
+ Hits 4119 4471 +352
- Misses 1493 1544 +51
+ Partials 375 369 -6 see 7 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @nimrod-starkware)
crates/blockifier/src/transaction/account_transactions_test.rs
line 235 at r1 (raw file):
#[case(TransactionVersion::ZERO)] #[case(TransactionVersion::ONE)]
remove newline between the #[case]
and the TODO
crates/blockifier/src/transaction/account_transactions_test.rs
line 271 at r1 (raw file):
); match tx_result { Ok(info) => assert!(info.revert_error.is_some()),
as with the Err
case, need to explicitly check for the expected error.
The error is a string in this case, so just assert that some indicative string is a substring of the error (maybe "is not deployed"? not sure if it's the same text).
If it's the same text you're searching for, please put it in a variable
Code quote:
revert_error.is_some()
crates/blockifier/src/transaction/account_transactions_test.rs
line 274 at r1 (raw file):
Err(err) => { assert!(matches!(err, TransactionExecutionError::ExecutionError(e) if matches!(&e, EntryPointExecutionError::VirtualMachineExecutionErrorWithTrace { trace, .. } if trace.contains("is not deployed.")))); // make sure the error is because the account wasn't deployed
I think this is better, if possible; full destructuring instead of two if
s
Suggestion:
assert!(matches!(err, TransactionExecutionError::ExecutionError(
EntryPointExecutionError::VirtualMachineExecutionErrorWithTrace { trace, .. }
if trace.contains("is not deployed.")
)));
crates/blockifier/src/transaction/account_transactions_test.rs
line 275 at r1 (raw file):
assert!(matches!(err, TransactionExecutionError::ExecutionError(e) if matches!(&e, EntryPointExecutionError::VirtualMachineExecutionErrorWithTrace { trace, .. } if trace.contains("is not deployed.")))); // make sure the error is because the account wasn't deployed assert!(matches!(tx_version, TransactionVersion::ZERO)); // we excpect to get an error only when tx_version is 0, on other versions to revert
@nimrod-starkware we start comments with capital letters and end with periods.
Also, they should be on the line above the line of code.
@giladchase shouldn't the formatter have failed this PR? Maybe your recent change did something...? These lines are over 100 chars long
Suggestion:
// Make sure the error is because the account wasn't deployed.
matches!(&e, EntryPointExecutionError::VirtualMachineExecutionErrorWithTrace { trace, .. } if trace.contains("is not deployed."))));
// We excpect to get an error only when tx_version is 0, on other versions to revert.
assert!(matches!(tx_version, TransactionVersion::ZERO));
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: all files reviewed, 4 unresolved discussions (waiting on @nimrod-starkware)
crates/blockifier/src/transaction/account_transactions_test.rs
line 275 at r1 (raw file):
@giladchase shouldn't the formatter have failed this PR? Maybe your recent change did something...? These lines are over 100 chars long
rustfmt doesn't work for items that include macros: rust-lang/rustfmt#8
What recent change?
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: all files reviewed, 4 unresolved discussions (waiting on @nimrod-starkware)
crates/blockifier/src/transaction/account_transactions_test.rs
line 275 at r1 (raw file):
Previously, giladchase wrote…
@giladchase shouldn't the formatter have failed this PR? Maybe your recent change did something...? These lines are over 100 chars long
rustfmt doesn't work for items that include macros: rust-lang/rustfmt#8
What recent change?
ah... nevermind then... damn
@nimrod-starkware please ensure no line is over 100 chars
(recent change was in SN-API repo.. my bad)
6da1f7d
to
93261a4
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 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @nimrod-starkware)
crates/blockifier/src/transaction/account_transactions_test.rs
line 276 at r2 (raw file):
Ok(info) => { // Make sure the error is because the account wasn't deployed. assert!(info.revert_error.is_some_and(|err_str| err_str.contains("is not deployed.")));
please add let expected_error = "is not deployed"
before the match, and use it twice
Code quote:
"is not deployed."
crates/blockifier/src/transaction/account_transactions_test.rs
line 284 at r2 (raw file):
if trace.contains("is not deployed.") )); // We excpect to get an error only when tx_version is 0, on other versions to revert.
typo
Code quote:
excpect
30abc37
to
28b6f91
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 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @nimrod-starkware)
28b6f91
to
2fb206c
Compare
2fb206c
to
131240d
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 1 of 1 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @nimrod-starkware)
tests the same scenario as test_internal_invoke_tx_failure in the Python tests
This change is