blockifier_test_utils,blockifier: add minimal add and mul circuit entry points - #15124
avi-starkware wants to merge 1 commit into
Conversation
|
Artifacts upload workflows: |
bf12ae8 to
536ac89
Compare
…ry points Two minimal circuit entry points in the Cairo1 test contract: `test_add_mod` (one add gate; writes add_mod instances and, because circuit inputs are reduced through mul gates, mul_mod instances too) and `test_mul_mod` (one mul gate; writes only mul_mod instances). They let proving tests exercise each mod builtin as narrowly as the compiler allows. The contract grew, so the two migration-gas expectations in bouncer_test moved accordingly. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
536ac89 to
371661a
Compare
PR SummaryLow Risk Overview
Because the compiled test contract is larger, the CASM hash migration gas snapshots in Reviewed by Cursor Bugbot for commit 371661a. 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 1 comment.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on avi-starkware).
crates/blockifier_test_utils/resources/feature_contracts/cairo1/test_contract.cairo line 1270 at r1 (raw file):
/// used because every circuit input is reduced modulo the modulus through a mul gate. #[external(v0)] fn test_add_mod(ref self: ContractState) {
Make sure this is not duplicated
What
Two minimal circuit entry points in the Cairo1 feature test contract, next to
test_circuit:test_add_mod: one add gate over modulus 7 (3 + 6 = 2). Writesadd_modinstances and alsomul_modinstances, because every circuit input is reduced modulo the modulus through a mul gate before any add gate can run.test_mul_mod: one mul gate over modulus 7 (3 * 6 = 4). Writes onlymul_modinstances. The entry point still declaresadd_modbecauseeval_circuittakes both builtins as implicits, but with no add gates theadd_modpointer is never advanced, so its PIE instance count is 0.They exist so proving tests can exercise each mod builtin as narrowly as the compiler allows (the stacked PR above uses them).
Fallout
The contract grew, so the two migration-gas
expect!values incrates/blockifier/src/bouncer_test.rsmoved (111447819 → 114653623,241056552 → 248313469). The compiled-class-hash estimation margin test did not move.Verification
cargo test -p blockifier_test_utils --test feature_contracts_compatibility_test: 3 passedcargo test -p blockifier bouncer::test: 30 passedcargo test -p starknet_os compiled_class_test: 20 passedtest_mul_mod→add_mod: 0, mul_mod: 3;test_add_mod→add_mod: 1, mul_mod: 2.🤖 Generated with Claude Code