nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType > Class Template Reference

#include <compliance_predicate.hpp>

+ Collaboration diagram for nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >:

Public Member Functions

bool has_equal_input_and_output_lengths () const
 
bool has_equal_input_lengths () const
 
bool is_satisfied (const std::shared_ptr< r1cs_pcd_message< FieldType >> &outgoing_message, const std::vector< std::shared_ptr< r1cs_pcd_message< FieldType >>> &incoming_messages, const std::shared_ptr< r1cs_pcd_local_data< FieldType >> &local_data, const r1cs_pcd_witness< FieldType > &witness) const
 
bool is_well_formed () const
 
r1cs_pcd_compliance_predicate< FieldType > & operator= (const r1cs_pcd_compliance_predicate< FieldType > &other)=default
 
bool operator== (const r1cs_pcd_compliance_predicate< FieldType > &other) const
 
 r1cs_pcd_compliance_predicate ()=default
 
 r1cs_pcd_compliance_predicate (const r1cs_pcd_compliance_predicate< FieldType > &other)=default
 
 r1cs_pcd_compliance_predicate (r1cs_pcd_compliance_predicate< FieldType > &&other)=default
 
 r1cs_pcd_compliance_predicate (std::size_t name, std::size_t type, const r1cs_constraint_system< FieldType > &constraint_system, std::size_t outgoing_message_payload_length, std::size_t max_arity, const std::vector< std::size_t > &incoming_message_payload_lengths, std::size_t local_data_length, std::size_t witness_length, bool relies_on_same_type_inputs, const std::set< std::size_t > &accepted_input_types=std::set< std::size_t >())
 

Public Attributes

std::set< std::size_t > accepted_input_types
 
r1cs_constraint_system< FieldType > constraint_system
 
std::vector< std::size_t > incoming_message_payload_lengths
 
std::size_t local_data_length
 
std::size_t max_arity
 
std::size_t name
 
std::size_t outgoing_message_payload_length
 
bool relies_on_same_type_inputs
 
std::size_t type
 
std::size_t witness_length
 

Detailed Description

template<typename FieldType>
class nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >

A compliance predicate for R1CS PCD.

It is a wrapper around R1CS that also specifies how to parse a variable assignment as:

  • output message (the input)
  • some number of input messages (part of the witness)
  • local data (also part of the witness)
  • auxiliary information (the remaining variables of the witness)

A compliance predicate also has a type, allegedly the same as the type of the output message.

The input wires of R1CS appear in the following order:

  • (1 + outgoing_message_payload_length) wires for outgoing message
  • 1 wire for arity (allegedly, 0 <= arity <= max_arity)
  • for i = 0, ..., max_arity-1:
  • (1 + incoming_message_payload_lengths[i]) wires for i-th message of the input (in the array that's padded to max_arity messages)
  • local_data_length wires for local data

The rest witness_length wires of the R1CS constitute the witness.

To allow for optimizations, the compliance predicate also specififies a flag, called relies_on_same_type_inputs, denoting whether the predicate works under the assumption that all input messages have the same type. In such case a member accepted_input_types lists all types accepted by the predicate (accepted_input_types has no meaning if relies_on_same_type_inputs=false).

Constructor & Destructor Documentation

◆ r1cs_pcd_compliance_predicate() [1/4]

template<typename FieldType >
nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::r1cs_pcd_compliance_predicate ( )
default

◆ r1cs_pcd_compliance_predicate() [2/4]

template<typename FieldType >
nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::r1cs_pcd_compliance_predicate ( r1cs_pcd_compliance_predicate< FieldType > &&  other)
default

◆ r1cs_pcd_compliance_predicate() [3/4]

template<typename FieldType >
nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::r1cs_pcd_compliance_predicate ( const r1cs_pcd_compliance_predicate< FieldType > &  other)
default

◆ r1cs_pcd_compliance_predicate() [4/4]

template<typename FieldType >
nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::r1cs_pcd_compliance_predicate ( std::size_t  name,
std::size_t  type,
const r1cs_constraint_system< FieldType > &  constraint_system,
std::size_t  outgoing_message_payload_length,
std::size_t  max_arity,
const std::vector< std::size_t > &  incoming_message_payload_lengths,
std::size_t  local_data_length,
std::size_t  witness_length,
bool  relies_on_same_type_inputs,
const std::set< std::size_t > &  accepted_input_types = std::set<std::size_t>() 
)

Member Function Documentation

◆ has_equal_input_and_output_lengths()

template<typename FieldType >
bool nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::has_equal_input_and_output_lengths

◆ has_equal_input_lengths()

template<typename FieldType >
bool nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::has_equal_input_lengths

◆ is_satisfied()

template<typename FieldType >
bool nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::is_satisfied ( const std::shared_ptr< r1cs_pcd_message< FieldType >> &  outgoing_message,
const std::vector< std::shared_ptr< r1cs_pcd_message< FieldType >>> &  incoming_messages,
const std::shared_ptr< r1cs_pcd_local_data< FieldType >> &  local_data,
const r1cs_pcd_witness< FieldType > &  witness 
) const

◆ is_well_formed()

template<typename FieldType >
bool nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::is_well_formed

◆ operator=()

template<typename FieldType >
r1cs_pcd_compliance_predicate<FieldType>& nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::operator= ( const r1cs_pcd_compliance_predicate< FieldType > &  other)
default

◆ operator==()

template<typename FieldType >
bool nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::operator== ( const r1cs_pcd_compliance_predicate< FieldType > &  other) const

Member Data Documentation

◆ accepted_input_types

template<typename FieldType >
std::set<std::size_t> nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::accepted_input_types

◆ constraint_system

template<typename FieldType >
r1cs_constraint_system<FieldType> nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::constraint_system

◆ incoming_message_payload_lengths

template<typename FieldType >
std::vector<std::size_t> nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::incoming_message_payload_lengths

◆ local_data_length

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::local_data_length

◆ max_arity

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::max_arity

◆ name

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::name

◆ outgoing_message_payload_length

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::outgoing_message_payload_length

◆ relies_on_same_type_inputs

template<typename FieldType >
bool nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::relies_on_same_type_inputs

◆ type

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::type

◆ witness_length

template<typename FieldType >
std::size_t nil::crypto3::zk::snark::r1cs_pcd_compliance_predicate< FieldType >::witness_length

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