Skip to content

Commit ae79a28

Browse files
blockifier_test_utils: update test contract for revert test with meta tx
1 parent 6eae2f2 commit ae79a28

File tree

9 files changed

+12214
-11192
lines changed

9 files changed

+12214
-11192
lines changed

crates/blockifier/src/bouncer_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,11 +776,11 @@ fn class_hash_migration_data_from_state(
776776

777777
if should_migrate {
778778
expect![[r#"
779-
102995104
779+
104821282
780780
"#]]
781781
.assert_debug_eq(&migration_sierra_gas.0);
782782
expect![[r#"
783-
250765450
783+
255209630
784784
"#]]
785785
.assert_debug_eq(&migration_proving_gas.0);
786786
} else {

crates/blockifier/src/execution/syscalls/syscall_tests/call_contract.rs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,20 @@ fn test_call_contract_that_panics(runnable_version: RunnableCairo1) {
3232

3333
let new_class_hash = empty_contract.get_class_hash();
3434
let to_panic = true.into();
35+
let is_meta_tx = false.into();
3536
let outer_entry_point_selector = selector_from_name("test_call_contract_revert");
36-
let calldata = create_calldata(
37-
test_contract.get_instance_address(0),
38-
"test_revert_helper",
39-
&[new_class_hash.0, to_panic],
37+
let inner_calldata_args = &[new_class_hash.0, to_panic];
38+
let calldata = Calldata::from(
39+
[
40+
vec![
41+
**test_contract.get_instance_address(0),
42+
selector_from_name("test_revert_helper").0,
43+
inner_calldata_args.len().into(),
44+
],
45+
inner_calldata_args.to_vec(),
46+
vec![is_meta_tx],
47+
]
48+
.concat(),
4049
);
4150
let entry_point_call = CallEntryPoint {
4251
entry_point_selector: outer_entry_point_selector,
@@ -97,10 +106,18 @@ fn test_call_contract_and_than_revert(#[case] runnable_version: RunnableCairo1)
97106
);
98107

99108
// Calldata of contract A
100-
let calldata = create_calldata(
101-
test_contract.get_instance_address(0),
102-
"middle_revert_contract",
103-
&middle_call_data.0,
109+
let is_meta_tx = false.into();
110+
let calldata = Calldata::from(
111+
[
112+
vec![
113+
**test_contract.get_instance_address(0),
114+
selector_from_name("middle_revert_contract").0,
115+
middle_call_data.0.len().into(),
116+
],
117+
middle_call_data.0.to_vec(),
118+
vec![is_meta_tx],
119+
]
120+
.concat(),
104121
);
105122

106123
// Create the entry point call to contract A.

crates/blockifier/src/transaction/account_transactions_test.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,23 +2122,25 @@ fn test_call_contract_that_panics(
21222122

21232123
let new_class_hash = FeatureContract::TestContract(cairo_version).get_class_hash();
21242124
let to_panic = true.into();
2125+
let meta_tx = false.into();
21252126

21262127
let calldata = [
21272128
*contract_address.0.key(),
21282129
selector_from_name(inner_selector).0,
21292130
felt!(2_u8),
21302131
new_class_hash.0,
21312132
to_panic,
2133+
meta_tx,
21322134
];
21332135

21342136
// Invoke a function that changes the state and reverts.
21352137
let tx_args = invoke_tx_args! {
21362138
sender_address: account_address,
21372139
calldata: create_calldata(
21382140
contract_address,
2139-
"test_call_contract_revert",
2140-
&calldata
2141-
),
2141+
"test_call_contract_revert",
2142+
&calldata
2143+
),
21422144
nonce: nonce_manager.next(account_address)
21432145
};
21442146
let tx_execution_info = run_invoke_tx(

0 commit comments

Comments
 (0)