Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
CycleGroupBase< Builder >::ExecutionHandler Class Reference

This class implements the execution of cycle group with an oracle to detect discrepancies. More...

#include <cycle_group.fuzzer.hpp>

Public Member Functions

 ExecutionHandler ()=default
 
 ExecutionHandler (ScalarField s, GroupElement g, cycle_group_t w_g)
 
ExecutionHandler operator_add (Builder *builder, const ExecutionHandler &other)
 
ExecutionHandler operator_sub (Builder *builder, const ExecutionHandler &other)
 Subtract two ExecutionHandlers, exploring different code paths for edge cases.
 
ExecutionHandler mul (Builder *builder, const ScalarField &multiplier)
 
ExecutionHandler operator- ()
 
ExecutionHandler dbl ()
 
ExecutionHandler conditional_assign (Builder *builder, ExecutionHandler &other, const bool predicate)
 
void assert_equal (Builder *builder, ExecutionHandler &other)
 
ExecutionHandler set (Builder *builder)
 

Static Public Member Functions

static ExecutionHandler batch_mul (Builder *builder, const std::vector< ExecutionHandler > &to_add, const std::vector< ScalarField > &to_mul)
 
static size_t execute_CONSTANT (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the constant instruction (push constant cycle group to the stack)
 
static size_t execute_WITNESS (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the witness instruction (push witness cycle group to the stack)
 
static size_t execute_CONSTANT_WITNESS (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the constant_witness instruction (push a safeuint witness equal to the constant to the stack)
 
static size_t execute_DBL (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the DBL instruction.
 
static size_t execute_NEG (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the NEG instruction.
 
static size_t execute_ASSERT_EQUAL (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the ASSERT_EQUAL instruction.
 
static size_t execute_SET (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the SET instruction.
 
static size_t execute_ADD (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the addition operator instruction.
 
static size_t execute_SUBTRACT (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the subtraction operator instruction.
 
static size_t execute_COND_ASSIGN (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the COND_ASSIGN instruction.
 
static size_t execute_MULTIPLY (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the multiply instruction.
 
static size_t execute_BATCH_MUL (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the BATCH_MUL instruction.
 
static size_t execute_RANDOMSEED (Builder *builder, std::vector< ExecutionHandler > &stack, Instruction &instruction)
 Execute the RANDOMSEED instruction.
 

Public Attributes

ScalarField base_scalar
 
GroupElement base
 
cycle_group_t cycle_group
 

Private Member Functions

cycle_group_t cg () const
 
ExecutionHandler handle_add_doubling_case (Builder *builder, const ExecutionHandler &other, const ScalarField &base_scalar_res, const GroupElement &base_res)
 Handle addition when points are equal (requires doubling)
 
ExecutionHandler handle_add_infinity_case (const ExecutionHandler &other, const ScalarField &base_scalar_res, const GroupElement &base_res)
 Handle addition when points are negations (result is point at infinity)
 
ExecutionHandler handle_add_normal_case (const ExecutionHandler &other, const ScalarField &base_scalar_res, const GroupElement &base_res)
 Handle normal addition (no special edge cases)
 
ExecutionHandler handle_sub_doubling_case (Builder *builder, const ExecutionHandler &other, const ScalarField &base_scalar_res, const GroupElement &base_res)
 Handle subtraction when points are negations: x - (-x) = 2x (doubling case)
 
ExecutionHandler handle_sub_infinity_case (const ExecutionHandler &other, const ScalarField &base_scalar_res, const GroupElement &base_res)
 Handle subtraction when points are equal: x - x = 0 (point at infinity)
 
ExecutionHandler handle_sub_normal_case (const ExecutionHandler &other, const ScalarField &base_scalar_res, const GroupElement &base_res)
 Handle normal subtraction case (no special edge cases)
 

Static Private Member Functions

static bool_t construct_predicate (Builder *builder, const bool predicate)
 

Detailed Description

template<typename Builder>
class CycleGroupBase< Builder >::ExecutionHandler

This class implements the execution of cycle group with an oracle to detect discrepancies.

Definition at line 787 of file cycle_group.fuzzer.hpp.

Constructor & Destructor Documentation

◆ ExecutionHandler() [1/2]

template<typename Builder >
CycleGroupBase< Builder >::ExecutionHandler::ExecutionHandler ( )
default

◆ ExecutionHandler() [2/2]

template<typename Builder >
CycleGroupBase< Builder >::ExecutionHandler::ExecutionHandler ( ScalarField  s,
GroupElement  g,
cycle_group_t  w_g 
)
inline

Definition at line 820 of file cycle_group.fuzzer.hpp.

Member Function Documentation

◆ assert_equal()

template<typename Builder >
void CycleGroupBase< Builder >::ExecutionHandler::assert_equal ( Builder builder,
ExecutionHandler other 
)
inline

Definition at line 1087 of file cycle_group.fuzzer.hpp.

◆ batch_mul()

template<typename Builder >
static ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::batch_mul ( Builder builder,
const std::vector< ExecutionHandler > &  to_add,
const std::vector< ScalarField > &  to_mul 
)
inlinestatic

Definition at line 1024 of file cycle_group.fuzzer.hpp.

◆ cg()

template<typename Builder >
cycle_group_t CycleGroupBase< Builder >::ExecutionHandler::cg ( ) const
inlineprivate

Definition at line 805 of file cycle_group.fuzzer.hpp.

◆ conditional_assign()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::conditional_assign ( Builder builder,
ExecutionHandler other,
const bool  predicate 
)
inline

Definition at line 1078 of file cycle_group.fuzzer.hpp.

◆ construct_predicate()

template<typename Builder >
static bool_t CycleGroupBase< Builder >::ExecutionHandler::construct_predicate ( Builder builder,
const bool  predicate 
)
inlinestaticprivate

Definition at line 789 of file cycle_group.fuzzer.hpp.

◆ dbl()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::dbl ( )
inline

Definition at line 1073 of file cycle_group.fuzzer.hpp.

◆ execute_ADD()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_ADD ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the addition operator instruction.

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1350 of file cycle_group.fuzzer.hpp.

◆ execute_ASSERT_EQUAL()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_ASSERT_EQUAL ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the ASSERT_EQUAL instruction.

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1286 of file cycle_group.fuzzer.hpp.

◆ execute_BATCH_MUL()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_BATCH_MUL ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the BATCH_MUL instruction.

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1493 of file cycle_group.fuzzer.hpp.

◆ execute_COND_ASSIGN()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_COND_ASSIGN ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the COND_ASSIGN instruction.

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1418 of file cycle_group.fuzzer.hpp.

◆ execute_CONSTANT()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_CONSTANT ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the constant instruction (push constant cycle group to the stack)

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1148 of file cycle_group.fuzzer.hpp.

◆ execute_CONSTANT_WITNESS()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_CONSTANT_WITNESS ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the constant_witness instruction (push a safeuint witness equal to the constant to the stack)

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1195 of file cycle_group.fuzzer.hpp.

◆ execute_DBL()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_DBL ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the DBL instruction.

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1220 of file cycle_group.fuzzer.hpp.

◆ execute_MULTIPLY()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_MULTIPLY ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the multiply instruction.

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1459 of file cycle_group.fuzzer.hpp.

◆ execute_NEG()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_NEG ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the NEG instruction.

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1253 of file cycle_group.fuzzer.hpp.

◆ execute_RANDOMSEED()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_RANDOMSEED ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the RANDOMSEED instruction.

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1547 of file cycle_group.fuzzer.hpp.

◆ execute_SET()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_SET ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the SET instruction.

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1312 of file cycle_group.fuzzer.hpp.

◆ execute_SUBTRACT()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_SUBTRACT ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the subtraction operator instruction.

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1384 of file cycle_group.fuzzer.hpp.

◆ execute_WITNESS()

template<typename Builder >
static size_t CycleGroupBase< Builder >::ExecutionHandler::execute_WITNESS ( Builder builder,
std::vector< ExecutionHandler > &  stack,
Instruction instruction 
)
inlinestatic

Execute the witness instruction (push witness cycle group to the stack)

Parameters
builder
stack
instruction
Returns
0 to continue, 1 to stop

Definition at line 1170 of file cycle_group.fuzzer.hpp.

◆ handle_add_doubling_case()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::handle_add_doubling_case ( Builder builder,
const ExecutionHandler other,
const ScalarField base_scalar_res,
const GroupElement base_res 
)
inlineprivate

Handle addition when points are equal (requires doubling)

Parameters
builderCircuit builder
otherThe other execution handler
base_scalar_resResult scalar for native computation
base_resResult point for native computation
Returns
ExecutionHandler with doubled point via various code paths

Definition at line 835 of file cycle_group.fuzzer.hpp.

◆ handle_add_infinity_case()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::handle_add_infinity_case ( const ExecutionHandler other,
const ScalarField base_scalar_res,
const GroupElement base_res 
)
inlineprivate

Handle addition when points are negations (result is point at infinity)

Parameters
builderCircuit builder
otherThe other execution handler
base_scalar_resResult scalar for native computation
base_resResult point for native computation
Returns
ExecutionHandler with point at infinity via various code paths

Definition at line 864 of file cycle_group.fuzzer.hpp.

◆ handle_add_normal_case()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::handle_add_normal_case ( const ExecutionHandler other,
const ScalarField base_scalar_res,
const GroupElement base_res 
)
inlineprivate

Handle normal addition (no special edge cases)

Parameters
otherThe other execution handler
base_scalar_resResult scalar for native computation
base_resResult point for native computation
Returns
ExecutionHandler with addition via various code paths

Definition at line 886 of file cycle_group.fuzzer.hpp.

◆ handle_sub_doubling_case()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::handle_sub_doubling_case ( Builder builder,
const ExecutionHandler other,
const ScalarField base_scalar_res,
const GroupElement base_res 
)
inlineprivate

Handle subtraction when points are negations: x - (-x) = 2x (doubling case)

Definition at line 939 of file cycle_group.fuzzer.hpp.

◆ handle_sub_infinity_case()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::handle_sub_infinity_case ( const ExecutionHandler other,
const ScalarField base_scalar_res,
const GroupElement base_res 
)
inlineprivate

Handle subtraction when points are equal: x - x = 0 (point at infinity)

Definition at line 962 of file cycle_group.fuzzer.hpp.

◆ handle_sub_normal_case()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::handle_sub_normal_case ( const ExecutionHandler other,
const ScalarField base_scalar_res,
const GroupElement base_res 
)
inlineprivate

Handle normal subtraction case (no special edge cases)

Definition at line 972 of file cycle_group.fuzzer.hpp.

◆ mul()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::mul ( Builder builder,
const ScalarField multiplier 
)
inline

Definition at line 1012 of file cycle_group.fuzzer.hpp.

◆ operator-()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::operator- ( )
inline

Definition at line 1066 of file cycle_group.fuzzer.hpp.

◆ operator_add()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::operator_add ( Builder builder,
const ExecutionHandler other 
)
inline

Definition at line 916 of file cycle_group.fuzzer.hpp.

◆ operator_sub()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::operator_sub ( Builder builder,
const ExecutionHandler other 
)
inline

Subtract two ExecutionHandlers, exploring different code paths for edge cases.

Definition at line 998 of file cycle_group.fuzzer.hpp.

◆ set()

template<typename Builder >
ExecutionHandler CycleGroupBase< Builder >::ExecutionHandler::set ( Builder builder)
inline

Definition at line 1101 of file cycle_group.fuzzer.hpp.

Member Data Documentation

◆ base

template<typename Builder >
GroupElement CycleGroupBase< Builder >::ExecutionHandler::base

Definition at line 816 of file cycle_group.fuzzer.hpp.

◆ base_scalar

template<typename Builder >
ScalarField CycleGroupBase< Builder >::ExecutionHandler::base_scalar

Definition at line 815 of file cycle_group.fuzzer.hpp.

◆ cycle_group

template<typename Builder >
cycle_group_t CycleGroupBase< Builder >::ExecutionHandler::cycle_group

Definition at line 817 of file cycle_group.fuzzer.hpp.


The documentation for this class was generated from the following file: