File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { SegmentValue } from 'primitives/segmentValue';
22
33import { outputHandler } from './output' ;
44import { CELLS_PER_PEDERSEN , pedersenHandler } from './pedersen' ;
5- import { rangeCheckHandler } from './rangeCheck' ;
5+ import { rangeCheckHandler , RC_BITS , RC_BITS_96 } from './rangeCheck' ;
66import { CELLS_PER_ECDSA , ecdsaHandler } from './ecdsa' ;
77import { bitwiseHandler , CELLS_PER_BITWISE } from './bitwise' ;
88import { CELLS_PER_EC_OP , ecOpHandler } from './ecop' ;
@@ -30,13 +30,13 @@ const BUILTIN_HANDLER: {
3030} = {
3131 output : outputHandler ,
3232 pedersen : pedersenHandler ,
33- range_check : rangeCheckHandler ( 128n ) ,
33+ range_check : rangeCheckHandler ( RC_BITS ) ,
3434 ecdsa : ecdsaHandler ,
3535 bitwise : bitwiseHandler ,
3636 ec_op : ecOpHandler ,
3737 keccak : keccakHandler ,
3838 poseidon : poseidonHandler ,
39- range_check96 : rangeCheckHandler ( 96n ) ,
39+ range_check96 : rangeCheckHandler ( RC_BITS_96 ) ,
4040 segment_arena : segmentArenaHandler ,
4141} ;
4242
Original file line number Diff line number Diff line change @@ -3,6 +3,18 @@ import { BuiltinHandler } from './builtin';
33import { isFelt } from 'primitives/segmentValue' ;
44import { ExpectedFelt } from 'errors/primitives' ;
55
6+ export const INNER_RC_BOUND_SHIFT = 16 ;
7+ export const INNER_RC_BOUND_MASK = 0xffffn ;
8+
9+ export const RC_N_PARTS = 8 ;
10+ export const RC_N_PARTS_96 = 6 ;
11+
12+ /** Bound exponent of the range_check builtin, `128`. */
13+ export const RC_BITS = BigInt ( INNER_RC_BOUND_SHIFT * RC_N_PARTS ) ;
14+
15+ /** Bound exponent of the range_check96 builtin, `96`. */
16+ export const RC_BITS_96 = BigInt ( INNER_RC_BOUND_SHIFT * RC_N_PARTS_96 ) ;
17+
618export const rangeCheckHandler = ( boundExponent : bigint ) : BuiltinHandler => {
719 return {
820 set ( target , prop , newValue ) : boolean {
You can’t perform that action at this time.
0 commit comments