-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separating kernel circuit public inputs
- Loading branch information
Showing
8 changed files
with
158 additions
and
118 deletions.
There are no files selected for viewing
134 changes: 16 additions & 118 deletions
134
...projects/noir-protocol-circuits/src/crates/types/src/abis/kernel_circuit_public_inputs.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...pes/src/abis/kernel_circuit_public_inputs/private_kernel_circuit_public_inputs_builder.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...types/src/abis/kernel_circuit_public_inputs/private_kernel_inner_circuit_public_inputs.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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? | ||
} |
16 changes: 16 additions & 0 deletions
16
.../types/src/abis/kernel_circuit_public_inputs/private_kernel_tail_circuit_public_inputs.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
16 changes: 16 additions & 0 deletions
16
...crates/types/src/abis/kernel_circuit_public_inputs/public_kernel_circuit_public_inputs.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
30 changes: 30 additions & 0 deletions
30
...ypes/src/abis/kernel_circuit_public_inputs/public_kernel_circuit_public_inputs_builder.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...crates/types/src/abis/kernel_circuit_public_inputs/rollup_kernel_circuit_public_inputs.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
18 changes: 18 additions & 0 deletions
18
...ypes/src/abis/kernel_circuit_public_inputs/rollup_kernel_circuit_public_inputs_builder.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } | ||
} | ||
} |