Skip to content

Conversation

@MKowalski8
Copy link
Member

@MKowalski8 MKowalski8 commented Dec 23, 2025

Closes #4031

Introduced changes

  • Change test that it uses range_check as most costly factor again, not cairo_steps

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added relevant tests
  • Performed self-review of the code
  • Added changes to CHANGELOG.md

@MKowalski8 MKowalski8 requested a review from a team as a code owner December 23, 2025 16:07
let _x: ContractAddress = 1234.try_into().unwrap();
let _x: ContractAddress = 1234.try_into().unwrap();
let _x: ContractAddress = 1234.try_into().unwrap();
for _ in 0..1000_u16 {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: the smallest value that meets the conditions is around 250. I added more so that it wouldn't have to be updated with minor optimizations. I haven't noticed that it would have any real impact on execution time.

// 96 = cost of deploy (see snforge_std_deploy_cost test)
// 6 = cost of 2344 cairo steps (because int(0.0025 * 2344) = 6)
// 0 l1_gas + 96 l1_data_gas + 6 * (100 / 0.0025) l2 gas
// 43 = cost of 1052 range check builtins (because int(0.04 * 1052) = 43)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 1052 if there are 1000 iterations? The 52 rest are coming from other parts of the execution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make range check most costly factor in contract_range_check_cost_cairo_steps

3 participants