check the last commit where we changed from type ShiftedT = BoundedInt<0,…
Jump to turn (8)
- 1check the last commit where we changed from type ShiftedT = BoundedInt ; // ...
- 2profile-verify /profile-verify
- 3Profile testverifypackedmatchesrust by steps using the benchmarking CLI, then vi
- 4confirm by total L2 gas the previous way cheaper (check the pb.gz of the last tw
- 5update relevant cairo skill with this information
- 6BoundedInt Optimization BoundedInt encodes value constraints in the type system,
- 7ok but verify actual costs, they're bullishit, use code snippets to benchmark th
- 8push the skill update in the relevant repo
- User
check the last commit where we changed from type ShiftedT = BoundedInt<0, 4612212885115823853836039849917814806>; // ... 512 times: let r: ShiftedT = (value + SHIFT).try_into().unwrap(); let (, r) = bounded_int_div_rem(r, NZ_Q); to #[inline(always)] fn felt252_as_u128(x: felt252) -> u128 { match u128s_from_felt252(x) { U128sFromFelt252Result::Narrow(low) => low, U128sFromFelt252Result::Wide((, low)) => low, } } // ... 512 times: let r: U128AsBounded = upcast(felt252_as_u128(value + SHIFT)); let (_, r) = bounded_int_div_rem(r, NZ_Q); , i want to change that by using the match pattern on the option returned by try_into() so that in case of OptionNone we return a constant bounded int (like 1)
Assistant
Let me look at the current code and the last commit to understand the exact pattern.
Assistant