Integrate recursion into MainPod (#243)
* calculate MainPod id in a dynamic-friendly way The MainPod id is now calculated with front padding and a fixed size independent of max_public_statements so that introduction gadgets can be verified by a MainPod while paying only for the number of statements they use. This is because with front padding of none-statements we can precompute the poseidon state corresponding to absorbing all the padding statements and only pay constraints for the non-padding statements. The id is calculated as follows: `id = hash(serialize(reverse(statements || none-statements)))` * add time feature and disable timing by default * apply suggestions from @arnaucube * link issues in todos
This commit is contained in:
parent
d3fef8392e
commit
88a75986b8
23 changed files with 1405 additions and 729 deletions
|
|
@ -1,5 +1,6 @@
|
|||
pub mod basetypes;
|
||||
pub mod circuits;
|
||||
pub mod emptypod;
|
||||
mod error;
|
||||
pub mod mainpod;
|
||||
pub mod mock;
|
||||
|
|
@ -7,4 +8,32 @@ pub mod primitives;
|
|||
pub mod recursion;
|
||||
pub mod signedpod;
|
||||
|
||||
use std::sync::LazyLock;
|
||||
|
||||
pub use error::*;
|
||||
|
||||
use crate::{
|
||||
backends::plonky2::{
|
||||
basetypes::CircuitData,
|
||||
circuits::mainpod::{MainPodVerifyTarget, NUM_PUBLIC_INPUTS},
|
||||
recursion::RecursiveCircuit,
|
||||
},
|
||||
middleware::Params,
|
||||
timed,
|
||||
};
|
||||
|
||||
pub static DEFAULT_PARAMS: LazyLock<Params> = LazyLock::new(Params::default);
|
||||
|
||||
pub static STANDARD_REC_MAIN_POD_CIRCUIT_DATA: LazyLock<CircuitData> = LazyLock::new(|| {
|
||||
let params = &*DEFAULT_PARAMS;
|
||||
timed!(
|
||||
"recursive MainPod circuit_data",
|
||||
RecursiveCircuit::<MainPodVerifyTarget>::target_and_circuit_data(
|
||||
params.max_input_recursive_pods,
|
||||
NUM_PUBLIC_INPUTS,
|
||||
params
|
||||
)
|
||||
.expect("calculate circuit_data")
|
||||
.1
|
||||
)
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue