-
Notifications
You must be signed in to change notification settings - Fork 28
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
chore(blockifier): test negative consumed gas #3005
chore(blockifier): test negative consumed gas #3005
Conversation
1b51909
to
9d3f004
Compare
bdd0ae2
to
46b555b
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 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @avivg-starkware and @meship-starkware)
crates/blockifier/src/transaction/transactions_test.rs
line 2889 at r1 (raw file):
#[case(RunnableCairo1::Casm)] #[cfg_attr(feature = "cairo_native", case(RunnableCairo1::Native))] fn test_empty_function_flow(#[case] runnable: RunnableCairo1) {
Maybe it's better to move this test to the call_contract.rs file.
WDYT?
Code quote:
fn test_empty_function_flow(#[case] runnable: RunnableCairo1) {
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 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @avivg-starkware)
crates/blockifier/src/transaction/transactions_test.rs
line 2902 at r1 (raw file):
let calldata = create_calldata( test_contract_address, "empty_function",
Can you add it as a constant EMPTY_FUNCTION_SELECTOR
Code quote:
"empty_function",
crates/blockifier/src/transaction/transactions_test.rs
line 2912 at r1 (raw file):
let execution_info = invoke_tx.execute(state, block_context).unwrap(); println!("{:?}", execution_info);
Remove
Code quote:
println!("{:?}", execution_info);
46b555b
to
d888817
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 5 files reviewed, 3 unresolved discussions (waiting on @meship-starkware and @noaov1)
crates/blockifier/src/transaction/transactions_test.rs
line 2889 at r1 (raw file):
Previously, noaov1 (Noa Oved) wrote…
Maybe it's better to move this test to the call_contract.rs file.
WDYT?
Sounds good, Done
crates/blockifier/src/transaction/transactions_test.rs
line 2902 at r1 (raw file):
Previously, meship-starkware (Meshi Peled) wrote…
Can you add it as a constant EMPTY_FUNCTION_SELECTOR
not sure where to take this from.
I only found 2 mentions to this, but no definition. in both it's accessed through:
SecurityTestContract.EMPTY_FUNCTION_SELECTOR,
which is defined in a cairo file: security_test_contract.cairo
could you clarify your intention?
crates/blockifier/src/transaction/transactions_test.rs
line 2912 at r1 (raw file):
Previously, meship-starkware (Meshi Peled) wrote…
Remove
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 1 of 2 files at r2.
Reviewable status: 4 of 5 files reviewed, 2 unresolved discussions (waiting on @avivg-starkware and @noaov1)
crates/blockifier/src/transaction/transactions_test.rs
line 2902 at r1 (raw file):
Previously, avivg-starkware wrote…
not sure where to take this from.
I only found 2 mentions to this, but no definition. in both it's accessed through:
SecurityTestContract.EMPTY_FUNCTION_SELECTOR,which is defined in a cairo file: security_test_contract.cairo
could you clarify your intention?
I meant to add a constant with the name EMPTY_FUNCTION_SELECTOR. If the transaction has a test utils, I would drop it there. If not, then just on top of the test file.
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 2 files at r2.
Reviewable status: all files reviewed (commit messages unreviewed), 2 unresolved discussions (waiting on @avivg-starkware and @noaov1)
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, 2 unresolved discussions (waiting on @avivg-starkware and @noaov1)
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 r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @avivg-starkware)
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 406 at r2 (raw file):
let execution_info = invoke_tx.execute(state, block_context).unwrap(); assert!(!execution_info.is_reverted());
No need the account transaction for this test.
Suggestion:
let test_contract = FeatureContract::TestContract(CairoVersion::Cairo1(runnable));
let chain_info = &ChainInfo::create_for_testing();
let state = &mut test_state(chain_info, BALANCE, &[(account_contract, 1), (test_contract, 1)]);
let test_contract_address = test_contract.get_instance_address(0);
let calldata = create_calldata(
test_contract_address,
"empty_function",
&[], // Calldata.
);
let outer_entry_point_selector = selector_from_name("test_call_contract");
let entry_point_call = CallEntryPoint {
entry_point_selector: outer_entry_point_selector,
calldata,
..trivial_external_entry_point_new(outer_contract)
};
assert_eq!(
!entry_point_call.execute_directly(&mut state).unwrap().execution.failed,
);
bf92faa
to
2c3b034
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 5 files reviewed, 1 unresolved discussion (waiting on @meship-starkware and @noaov1)
crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs
line 406 at r2 (raw file):
Previously, noaov1 (Noa Oved) wrote…
No need the account transaction for this test.
Done.
2c3b034
to
7a0aa5c
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 2 of 2 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @avivg-starkware)
7a0aa5c
to
22b3112
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 4 files at r1, 1 of 2 files at r3, 4 of 4 files at r4, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @avivg-starkware)
No description provided.