NEWTON
Asked
4 months ago
8
views
0
Bumped into rc_bound today and was wondering: where/how is it defined and why is it much smaller than the field prime?
Newton
asked
4 months ago
0
the eternal question almost no one at starknet has been able to answer for months!
I have had eventually quite recently a definitive answer from Dan Carmon, copied here below:
it could have been possible to have the basic range_check call be for 250 bits, but that would have made it more expensive per call. If I'm not mistaken (which I may be), the actual basic range check is 16-bit, and a 128-bit range check is actually made of 8 16-bit range checks, already wrapped together by the builtin. To have a 250-bit range check you would need to use 16 16-bit range checks, which would mean that you could only fit half as many in the same number of steps. As Shahar said, you can simulate 250-bit range check with 3 128-bit ones, and 128-bit with 2 250-bit ones, so the decision of which is better depends mostly on what is more common. I believe our opinion was that in many use cases, 128 bits would be more than enough, and the cases where 250 bits are both necessary and sufficient would be relatively rarer, so using the slightly smaller range check would be better optimized for the common use case.
answered
4 months ago
0
idk if you already read this ? https://www.cairo-lang.org/docs/how_cairo_works/builtins.html#range-checks
answered
4 months ago
How to make math operation with Field Elements (felts) in Cairo lang?
ApeWorX: Why am I getting the error message "ArgumentsLengthError"?
Cairo: Using less than or greater than in conditional
Why does range_check_ptr chek for [0, 2^128) instead of [0, P/2)
Do you have any idea on how much is starknetJS request limit?
How to check for smaller Uints in Cairo?
What is the proxy pattern and how it can help make my smart contracts upgradable in Cairo Language?
Cairo: Getting function selector
How to create Structs in Cairo Lang for StarkNet?
How to generate a proof for a Cairo program and verify it?
How to get private key/mnemonic for account that been created using `deploy_account` [StarkNet]?
Does writing it to zero actually do something?
Are there situations in which we prefer declaring variables as `local` vs `tempvar`?
Cairo: How would I store negative numbers then retrieve them as negatives?