diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs.nr index 69228663954..4ea6274011e 100644 --- a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs.nr +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs.nr @@ -1,119 +1,17 @@ -use crate::abis::{ - accumulated_data::{ - combined_accumulated_data::CombinedAccumulatedData, - private_accumulated_revertible_data::PrivateAccumulatedRevertibleData, - private_accumulated_non_revertible_data::PrivateAccumulatedNonRevertibleData, - combined_accumulated_data_builder::CombinedAccumulatedDataBuilder, - public_accumulated_non_revertible_data::PublicAccumulatedNonRevertibleData, - public_accumulated_revertible_data::PublicAccumulatedRevertibleData, - accumulated_non_revertible_data_builder::AccumulatedNonRevertibleDataBuilder, - accumulated_revertible_data_builder::AccumulatedRevertibleDataBuilder -}, - combined_constant_data::CombinedConstantData +mod private_kernel_circuit_public_inputs_builder; +mod private_kernel_inner_circuit_public_inputs; +mod private_kernel_tail_circuit_public_inputs; +mod public_kernel_circuit_public_inputs; +mod public_kernel_circuit_public_inputs_builder; +mod rollup_kernel_circuit_public_inputs; +mod rollup_kernel_circuit_public_inputs_builder; + +use crate::abis::kernel_circuit_public_inputs::{ + private_kernel_circuit_public_inputs_builder::PrivateKernelCircuitPublicInputsBuilder, + private_kernel_inner_circuit_public_inputs::PrivateKernelInnerCircuitPublicInputs, + private_kernel_tail_circuit_public_inputs::PrivateKernelTailCircuitPublicInputs, + public_kernel_circuit_public_inputs::PublicKernelCircuitPublicInputs, + public_kernel_circuit_public_inputs_builder::PublicKernelCircuitPublicInputsBuilder, + rollup_kernel_circuit_public_inputs::RollupKernelCircuitPublicInputs, + rollup_kernel_circuit_public_inputs_builder::RollupKernelCircuitPublicInputsBuilder }; -use dep::std::{unsafe}; -use crate::constants::{MAX_NEW_COMMITMENTS_PER_TX, MAX_NEW_NULLIFIERS_PER_TX, MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX}; - -use crate::mocked::AggregationObject; - -struct PrivateKernelInnerCircuitPublicInputs { - aggregation_object: AggregationObject, - min_revertible_side_effect_counter: u32, - end: CombinedAccumulatedData, - constants: CombinedConstantData, - is_private: bool, // TODO can we remove this? -} - -struct PrivateKernelTailCircuitPublicInputs { - aggregation_object: AggregationObject, - end_non_revertible: PrivateAccumulatedNonRevertibleData, - end: PrivateAccumulatedRevertibleData, - constants: CombinedConstantData, - needs_setup: bool, - needs_app_logic: bool, - needs_teardown: bool, -} - -struct PublicKernelCircuitPublicInputs { - aggregation_object: AggregationObject, - end_non_revertible: PublicAccumulatedNonRevertibleData, - end: PublicAccumulatedRevertibleData, - constants: CombinedConstantData, - needs_setup: bool, - needs_app_logic: bool, - needs_teardown: bool, -} - -struct RollupKernelCircuitPublicInputs { - aggregation_object: AggregationObject, - end: CombinedAccumulatedData, - constants: CombinedConstantData, -} - -struct RollupKernelCircuitPublicInputsBuilder { - aggregation_object: AggregationObject, - end: CombinedAccumulatedDataBuilder, - constants: CombinedConstantData, -} - -impl RollupKernelCircuitPublicInputsBuilder { - pub fn finish(self) -> RollupKernelCircuitPublicInputs { - RollupKernelCircuitPublicInputs { aggregation_object: self.aggregation_object, end: self.end.finish(), constants: self.constants } - } -} - -struct PrivateKernelCircuitPublicInputsBuilder { - aggregation_object: AggregationObject, - min_revertible_side_effect_counter: u32, - end: CombinedAccumulatedDataBuilder, - constants: CombinedConstantData, - is_private: bool, -} - -impl PrivateKernelCircuitPublicInputsBuilder { - pub fn to_inner(self) -> PrivateKernelInnerCircuitPublicInputs { - PrivateKernelInnerCircuitPublicInputs { - aggregation_object: self.aggregation_object, - min_revertible_side_effect_counter: self.min_revertible_side_effect_counter, - end: self.end.finish(), - constants: self.constants, - is_private: self.is_private - } - } - - pub fn to_tail(self) -> PrivateKernelTailCircuitPublicInputs { - let (end_non_revertible, end) = self.end.split(self.min_revertible_side_effect_counter); - PrivateKernelTailCircuitPublicInputs { - aggregation_object: self.aggregation_object, - end_non_revertible, - end, - constants: self.constants, - needs_setup: end_non_revertible.needs_setup(), - needs_app_logic: end.needs_app_logic(), - needs_teardown: end_non_revertible.needs_teardown() - } - } -} - -struct PublicKernelCircuitPublicInputsBuilder { - aggregation_object: AggregationObject, - end_non_revertible: AccumulatedNonRevertibleDataBuilder, - end: AccumulatedRevertibleDataBuilder, - constants: CombinedConstantData, -} - -impl PublicKernelCircuitPublicInputsBuilder { - pub fn to_inner(self) -> PublicKernelCircuitPublicInputs { - let end_non_revertible = self.end_non_revertible.to_public(); - let end = self.end.to_public(); - PublicKernelCircuitPublicInputs { - aggregation_object: self.aggregation_object, - end_non_revertible, - end, - constants: self.constants, - needs_setup: end_non_revertible.needs_setup(), - needs_app_logic: end.needs_app_logic(), - needs_teardown: end_non_revertible.needs_teardown() - } - } -} diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs_builder.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs_builder.nr new file mode 100644 index 00000000000..39817c4e6c2 --- /dev/null +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs_builder.nr @@ -0,0 +1,42 @@ +use crate::abis::{ + accumulated_data::CombinedAccumulatedDataBuilder, combined_constant_data::CombinedConstantData, + kernel_circuit_public_inputs::{ + private_kernel_inner_circuit_public_inputs::PrivateKernelInnerCircuitPublicInputs, + private_kernel_tail_circuit_public_inputs::PrivateKernelTailCircuitPublicInputs +} +}; + +use crate::mocked::AggregationObject; + +struct PrivateKernelCircuitPublicInputsBuilder { + aggregation_object: AggregationObject, + min_revertible_side_effect_counter: u32, + end: CombinedAccumulatedDataBuilder, + constants: CombinedConstantData, + is_private: bool, +} + +impl PrivateKernelCircuitPublicInputsBuilder { + pub fn to_inner(self) -> PrivateKernelInnerCircuitPublicInputs { + PrivateKernelInnerCircuitPublicInputs { + aggregation_object: self.aggregation_object, + min_revertible_side_effect_counter: self.min_revertible_side_effect_counter, + end: self.end.finish(), + constants: self.constants, + is_private: self.is_private + } + } + + pub fn to_tail(self) -> PrivateKernelTailCircuitPublicInputs { + let (end_non_revertible, end) = self.end.split(self.min_revertible_side_effect_counter); + PrivateKernelTailCircuitPublicInputs { + aggregation_object: self.aggregation_object, + end_non_revertible, + end, + constants: self.constants, + needs_setup: end_non_revertible.needs_setup(), + needs_app_logic: end.needs_app_logic(), + needs_teardown: end_non_revertible.needs_teardown() + } + } +} diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_inner_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_inner_circuit_public_inputs.nr new file mode 100644 index 00000000000..ce7eb302a4f --- /dev/null +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_inner_circuit_public_inputs.nr @@ -0,0 +1,11 @@ +use crate::abis::{accumulated_data::CombinedAccumulatedData, combined_constant_data::CombinedConstantData}; + +use crate::mocked::AggregationObject; + +struct PrivateKernelInnerCircuitPublicInputs { + aggregation_object: AggregationObject, + min_revertible_side_effect_counter: u32, + end: CombinedAccumulatedData, + constants: CombinedConstantData, + is_private: bool, // TODO can we remove this? +} diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_tail_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_tail_circuit_public_inputs.nr new file mode 100644 index 00000000000..e1f11f18baa --- /dev/null +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/private_kernel_tail_circuit_public_inputs.nr @@ -0,0 +1,16 @@ +use crate::abis::{ + accumulated_data::{PrivateAccumulatedNonRevertibleData, PrivateAccumulatedRevertibleData}, + combined_constant_data::CombinedConstantData +}; + +use crate::mocked::AggregationObject; + +struct PrivateKernelTailCircuitPublicInputs { + aggregation_object: AggregationObject, + end_non_revertible: PrivateAccumulatedNonRevertibleData, + end: PrivateAccumulatedRevertibleData, + constants: CombinedConstantData, + needs_setup: bool, + needs_app_logic: bool, + needs_teardown: bool, +} diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/public_kernel_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/public_kernel_circuit_public_inputs.nr new file mode 100644 index 00000000000..a581a992d19 --- /dev/null +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/public_kernel_circuit_public_inputs.nr @@ -0,0 +1,16 @@ +use crate::abis::{ + accumulated_data::{PublicAccumulatedNonRevertibleData, PublicAccumulatedRevertibleData}, + combined_constant_data::CombinedConstantData +}; + +use crate::mocked::AggregationObject; + +struct PublicKernelCircuitPublicInputs { + aggregation_object: AggregationObject, + end_non_revertible: PublicAccumulatedNonRevertibleData, + end: PublicAccumulatedRevertibleData, + constants: CombinedConstantData, + needs_setup: bool, + needs_app_logic: bool, + needs_teardown: bool, +} diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/public_kernel_circuit_public_inputs_builder.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/public_kernel_circuit_public_inputs_builder.nr new file mode 100644 index 00000000000..022d7bf7fc2 --- /dev/null +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/public_kernel_circuit_public_inputs_builder.nr @@ -0,0 +1,30 @@ +use crate::abis::{ + accumulated_data::{AccumulatedNonRevertibleDataBuilder, AccumulatedRevertibleDataBuilder}, + combined_constant_data::CombinedConstantData, + kernel_circuit_public_inputs::public_kernel_circuit_public_inputs::PublicKernelCircuitPublicInputs +}; + +use crate::mocked::AggregationObject; + +struct PublicKernelCircuitPublicInputsBuilder { + aggregation_object: AggregationObject, + end_non_revertible: AccumulatedNonRevertibleDataBuilder, + end: AccumulatedRevertibleDataBuilder, + constants: CombinedConstantData, +} + +impl PublicKernelCircuitPublicInputsBuilder { + pub fn to_inner(self) -> PublicKernelCircuitPublicInputs { + let end_non_revertible = self.end_non_revertible.to_public(); + let end = self.end.to_public(); + PublicKernelCircuitPublicInputs { + aggregation_object: self.aggregation_object, + end_non_revertible, + end, + constants: self.constants, + needs_setup: end_non_revertible.needs_setup(), + needs_app_logic: end.needs_app_logic(), + needs_teardown: end_non_revertible.needs_teardown() + } + } +} diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/rollup_kernel_circuit_public_inputs.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/rollup_kernel_circuit_public_inputs.nr new file mode 100644 index 00000000000..1e7711fc43e --- /dev/null +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/rollup_kernel_circuit_public_inputs.nr @@ -0,0 +1,9 @@ +use crate::abis::{accumulated_data::CombinedAccumulatedData, combined_constant_data::CombinedConstantData}; + +use crate::mocked::AggregationObject; + +struct RollupKernelCircuitPublicInputs { + aggregation_object: AggregationObject, + end: CombinedAccumulatedData, + constants: CombinedConstantData, +} diff --git a/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/rollup_kernel_circuit_public_inputs_builder.nr b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/rollup_kernel_circuit_public_inputs_builder.nr new file mode 100644 index 00000000000..9e5bd581700 --- /dev/null +++ b/noir-projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs/rollup_kernel_circuit_public_inputs_builder.nr @@ -0,0 +1,18 @@ +use crate::abis::{ + accumulated_data::CombinedAccumulatedDataBuilder, combined_constant_data::CombinedConstantData, + kernel_circuit_public_inputs::rollup_kernel_circuit_public_inputs::RollupKernelCircuitPublicInputs +}; + +use crate::mocked::AggregationObject; + +struct RollupKernelCircuitPublicInputsBuilder { + aggregation_object: AggregationObject, + end: CombinedAccumulatedDataBuilder, + constants: CombinedConstantData, +} + +impl RollupKernelCircuitPublicInputsBuilder { + pub fn finish(self) -> RollupKernelCircuitPublicInputs { + RollupKernelCircuitPublicInputs { aggregation_object: self.aggregation_object, end: self.end.finish(), constants: self.constants } + } +}