pub trait AdderGateTrait<F: Field> {
type IntegralType: Add<Output = Self::IntegralType>;
// Required methods
fn layout_adder_circuit(
circuit_builder: &mut CircuitBuilder<F>,
x_node: &NodeRef<F>,
y_node: &NodeRef<F>,
carry_layer: Option<InputLayerNodeRef<F>>,
) -> Self;
fn get_output(&self) -> NodeRef<F>;
fn perform_addition(
&self,
_circuit: &mut Circuit<F>,
x: Self::IntegralType,
y: Self::IntegralType,
) -> Self::IntegralType;
}Expand description
Trait that’s implemented by all SHA256 adders
Required Associated Types§
Sourcetype IntegralType: Add<Output = Self::IntegralType>
type IntegralType: Add<Output = Self::IntegralType>
Data type of actual elements such as u32 (in sha256) or u64 (in sha512)
Required Methods§
Sourcefn layout_adder_circuit(
circuit_builder: &mut CircuitBuilder<F>,
x_node: &NodeRef<F>,
y_node: &NodeRef<F>,
carry_layer: Option<InputLayerNodeRef<F>>,
) -> Self
fn layout_adder_circuit( circuit_builder: &mut CircuitBuilder<F>, x_node: &NodeRef<F>, y_node: &NodeRef<F>, carry_layer: Option<InputLayerNodeRef<F>>, ) -> Self
Build the layout of the adder circuit. The carry_layer
Auxiliary data is meant for passing in any additional layer or
circuit or wire information that can help the prover.
Sourcefn get_output(&self) -> NodeRef<F>
fn get_output(&self) -> NodeRef<F>
Returns a reference to the note that corresponds to the adder gate
Sourcefn perform_addition(
&self,
_circuit: &mut Circuit<F>,
x: Self::IntegralType,
y: Self::IntegralType,
) -> Self::IntegralType
fn perform_addition( &self, _circuit: &mut Circuit<F>, x: Self::IntegralType, y: Self::IntegralType, ) -> Self::IntegralType
Optional trait that compute the actual sum and create any possible commitments needed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.