pub enum CoreHint {
Show 30 variants
AllocSegment {
dst: CellRef,
},
TestLessThan {
lhs: ResOperand,
rhs: ResOperand,
dst: CellRef,
},
TestLessThanOrEqual {
lhs: ResOperand,
rhs: ResOperand,
dst: CellRef,
},
TestLessThanOrEqualAddress {
lhs: ResOperand,
rhs: ResOperand,
dst: CellRef,
},
WideMul128 {
lhs: ResOperand,
rhs: ResOperand,
high: CellRef,
low: CellRef,
},
DivMod {
lhs: ResOperand,
rhs: ResOperand,
quotient: CellRef,
remainder: CellRef,
},
Uint256DivMod {
dividend0: ResOperand,
dividend1: ResOperand,
divisor0: ResOperand,
divisor1: ResOperand,
quotient0: CellRef,
quotient1: CellRef,
remainder0: CellRef,
remainder1: CellRef,
},
Uint512DivModByUint256 {
dividend0: ResOperand,
dividend1: ResOperand,
dividend2: ResOperand,
dividend3: ResOperand,
divisor0: ResOperand,
divisor1: ResOperand,
quotient0: CellRef,
quotient1: CellRef,
quotient2: CellRef,
quotient3: CellRef,
remainder0: CellRef,
remainder1: CellRef,
},
SquareRoot {
value: ResOperand,
dst: CellRef,
},
Uint256SquareRoot {
value_low: ResOperand,
value_high: ResOperand,
sqrt0: CellRef,
sqrt1: CellRef,
remainder_low: CellRef,
remainder_high: CellRef,
sqrt_mul_2_minus_remainder_ge_u128: CellRef,
},
LinearSplit {
value: ResOperand,
scalar: ResOperand,
max_x: ResOperand,
x: CellRef,
y: CellRef,
},
AllocFelt252Dict {
segment_arena_ptr: ResOperand,
},
Felt252DictEntryInit {
dict_ptr: ResOperand,
key: ResOperand,
},
Felt252DictEntryUpdate {
dict_ptr: ResOperand,
value: ResOperand,
},
GetSegmentArenaIndex {
dict_end_ptr: ResOperand,
dict_index: CellRef,
},
InitSquashData {
dict_accesses: ResOperand,
ptr_diff: ResOperand,
n_accesses: ResOperand,
big_keys: CellRef,
first_key: CellRef,
},
GetCurrentAccessIndex {
range_check_ptr: ResOperand,
},
ShouldSkipSquashLoop {
should_skip_loop: CellRef,
},
GetCurrentAccessDelta {
index_delta_minus1: CellRef,
},
ShouldContinueSquashLoop {
should_continue: CellRef,
},
GetNextDictKey {
next_key: CellRef,
},
AssertLeFindSmallArcs {
range_check_ptr: ResOperand,
a: ResOperand,
b: ResOperand,
},
AssertLeIsFirstArcExcluded {
skip_exclude_a_flag: CellRef,
},
AssertLeIsSecondArcExcluded {
skip_exclude_b_minus_a: CellRef,
},
RandomEcPoint {
x: CellRef,
y: CellRef,
},
FieldSqrt {
val: ResOperand,
sqrt: CellRef,
},
DebugPrint {
start: ResOperand,
end: ResOperand,
},
AllocConstantSize {
size: ResOperand,
dst: CellRef,
},
U256InvModN {
b0: ResOperand,
b1: ResOperand,
n0: ResOperand,
n1: ResOperand,
g0_or_no_inv: CellRef,
g1_option: CellRef,
s_or_r0: CellRef,
s_or_r1: CellRef,
t_or_k0: CellRef,
t_or_k1: CellRef,
},
EvalCircuit {
n_add_mods: ResOperand,
add_mod_builtin: ResOperand,
n_mul_mods: ResOperand,
mul_mod_builtin: ResOperand,
},
}
Variants§
AllocSegment
TestLessThan
TestLessThanOrEqual
TestLessThanOrEqualAddress
Variant of TestLessThanOrEqual that compares addresses.
WideMul128
Multiplies two 128-bit integers and returns two 128-bit integers: the high and low parts of the product.
DivMod
Computes lhs/rhs and returns the quotient and remainder.
Note: the hint may be used to write an already assigned memory cell.
Uint256DivMod
Divides dividend (represented by 2 128bit limbs) by divisor (represented by 2 128bit
limbs). Returns the quotient (represented by 2 128bit limbs) and remainder (represented by
2 128bit limbs). In all cases - name
0 is the least significant limb.
Uint512DivModByUint256
Divides dividend (represented by 4 128bit limbs) by divisor (represented by 2 128bit
limbs). Returns the quotient (represented by 4 128bit limbs) and remainder (represented
by 2 128bit limbs).
In all cases - name
0 is the least significant limb.
Fields
dividend0: ResOperand
dividend1: ResOperand
dividend2: ResOperand
dividend3: ResOperand
divisor0: ResOperand
divisor1: ResOperand
SquareRoot
Uint256SquareRoot
Computes the square root of value_low<<128+value_high, stores the 64bit limbs of the result
in sqrt0 and sqrt1 as well as the 128bit limbs of the remainder in remainder_low and
remainder_high. The remainder is defined as value - sqrt**2
.
Lastly it checks weather 2*sqrt - remainder >= 2**128
.
LinearSplit
Finds some x
and y
such that x * scalar + y = value
and x <= max_x
.
AllocFelt252Dict
Allocates a new dict segment, and write its start address into the dict_infos segment.
Fields
segment_arena_ptr: ResOperand
Felt252DictEntryInit
Fetch the previous value of a key in a dict, and write it in a new dict access.
Felt252DictEntryUpdate
Similar to Felt252DictWrite, but updates an existing entry and does not write the previous value to the stack.
GetSegmentArenaIndex
Retrieves the index of the given dict in the dict_infos segment.
InitSquashData
Initialized the lists of accesses of each key of a dict as a preparation of squash_dict.
GetCurrentAccessIndex
Retrieves the current index of a dict access to process.
Fields
range_check_ptr: ResOperand
ShouldSkipSquashLoop
Writes if the squash_dict loop should be skipped.
GetCurrentAccessDelta
Writes the delta from the current access index to the next one.
ShouldContinueSquashLoop
Writes if the squash_dict loop should be continued.
GetNextDictKey
Writes the next dict key to process.
AssertLeFindSmallArcs
Finds the two small arcs from within [(0,a),(a,b),(b,PRIME)] and writes it to the range_check segment.
AssertLeIsFirstArcExcluded
Writes if the arc (0,a) was excluded.
AssertLeIsSecondArcExcluded
Writes if the arc (a,b) was excluded.
RandomEcPoint
Samples a random point on the EC.
FieldSqrt
Computes the square root of val
, if val
is a quadratic residue, and of 3 * val
otherwise.
Since 3 is not a quadratic residue, exactly one of val
and 3 * val
is a quadratic
residue (unless val
is 0). This allows proving that val
is not a quadratic residue.
DebugPrint
Prints the values from start to end. Both must be pointers.
AllocConstantSize
Returns an address with size
free locations afterwards.
U256InvModN
Provides the inverse of b (represented by 2 128-bit limbs) modulo n (represented by 2 128-bit limbs), or a proof that b has no inverse.
In case b has an inverse: Returns r
and k
such that:
r = 1 / b (mod n)
k = (r * b - 1) / n
g0_or_no_inv = 0
In case b has no inverse: Returns g
, s
, and t
, such that:
g > 1
g == 2 || g % 2 == 1
(in particular, g0_or_no_inv = g0 != 0
)
g * s = b
g * t = n
The case n == 1
is considered “no-inverse” (special case).
In this case: Returns g == 1
, s == b
and t == 1
.
All no-inverse requirements are satisfied, except for g > 1
.
In all cases - name
0 is the least significant limb.
EvalCircuit
Fields
n_add_mods: ResOperand
add_mod_builtin: ResOperand
n_mul_mods: ResOperand
mul_mod_builtin: ResOperand
Trait Implementations§
source§impl From<CoreHint> for CoreHintBase
impl From<CoreHint> for CoreHintBase
source§impl PythonicHint for CoreHint
impl PythonicHint for CoreHint
fn get_pythonic_hint(&self) -> String
impl Eq for CoreHint
impl StructuralPartialEq for CoreHint
Auto Trait Implementations§
impl Freeze for CoreHint
impl RefUnwindSafe for CoreHint
impl Send for CoreHint
impl Sync for CoreHint
impl Unpin for CoreHint
impl UnwindSafe for CoreHint
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more