starknet_os_flow_tests: extract test contract constructor calldata helpers#14099
Conversation
PR SummaryLow Risk Overview Replaces many inline Reviewed by Cursor Bugbot for commit fbe3ce8. Bugbot is set up for automated code reviews on this repo. Configure here. |
Yoni-Starkware
left a comment
There was a problem hiding this comment.
@Yoni-Starkware reviewed 1 file and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on AvivYossef-starkware).
crates/starknet_os_flow_tests/src/tests.rs line 285 at r1 (raw file):
let (mut test_builder, [test_contract_address]) = TestBuilder::create_standard_with_config( [(test_contract, test_contract_constructor_calldata(Felt::ONE, Felt::TWO))],
Since it's either 0,0 or 1,2, I'd add another function for the 1,2 case. nontrivial_constructor_calldata
Code quote:
[(test_contract, test_contract_constructor_calldata(Felt::ONE, Felt::TWO))],
Summary
crates/starknet_os_flow_tests/src/tests.rs:test_contract_constructor_calldata(my_storage_var_addend_1, my_storage_var_addend_2)— named constructor builder. Doc comment notes thatTestContract::constructorwritesarg1 + arg2tomy_storage_var.default_test_contract_constructor_calldata()— calls the above with(Felt::ZERO, Felt::ZERO).calldataeverywhere) withdefault_test_contract_constructor_calldata().calldata![Felt::ONE, Felt::TWO]withtest_contract_constructor_calldata(Felt::ONE, Felt::TWO).Addresses the review comment on #14042 (reviewable thread) —
calldata![Felt::ZERO, Felt::ZERO]was opaque at the call site; the named helpers make the role of the felts (constructor args summed intomy_storage_var) obvious without digging into the Cairo source.Stacked on top of #14042 — only this one commit is new.
Test plan
cargo check -p starknet_os_flow_tests --tests✅scripts/rust_fmt.sh✅