Skip to content

Commit 2355c0c

Browse files
committed
Fix naming
1 parent 818a05e commit 2355c0c

File tree

7 files changed

+36
-31
lines changed

7 files changed

+36
-31
lines changed

crates/continuations/src/verifier/internal/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ pub struct InternalVmVerifierInput<SC: StarkGenericConfig> {
3030
}
3131
assert_impl_all!(InternalVmVerifierInput<BabyBearPoseidon2Config>: Serialize, DeserializeOwned);
3232

33-
/// The final output of the internal VM verifier.
33+
/// A proof which can prove OpenVM program execution.
3434
#[derive(Deserialize, Serialize, Derivative)]
3535
#[serde(bound = "")]
3636
#[derivative(Clone(bound = "Com<SC>: Clone"))]
37-
pub struct E2eStarkProof<SC: StarkGenericConfig> {
37+
pub struct VmStarkProof<SC: StarkGenericConfig> {
3838
pub proof: Proof<SC>,
3939
pub user_public_values: Vec<Val<SC>>,
4040
}
41-
assert_impl_all!(E2eStarkProof<BabyBearPoseidon2Config>: Serialize, DeserializeOwned);
41+
assert_impl_all!(VmStarkProof<BabyBearPoseidon2Config>: Serialize, DeserializeOwned);
4242

4343
/// Aggregated state of all segments
4444
#[derive(Debug, Clone, Copy, AlignedBorrow)]

crates/continuations/src/verifier/internal/vars.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use openvm_stark_sdk::openvm_stark_backend::proof::Proof;
66

77
use crate::{
88
verifier::{
9-
internal::types::{E2eStarkProof, InternalVmVerifierInput},
9+
internal::types::{InternalVmVerifierInput, VmStarkProof},
1010
utils::write_field_slice,
1111
},
1212
C, F, SC,
@@ -44,7 +44,7 @@ impl Hintable<C> for InternalVmVerifierInput<SC> {
4444
}
4545
}
4646

47-
impl Hintable<C> for E2eStarkProof<SC> {
47+
impl Hintable<C> for VmStarkProof<SC> {
4848
type HintVariable = E2eStarkProofVariable<C>;
4949

5050
fn read(builder: &mut Builder<C>) -> Self::HintVariable {

crates/sdk/src/codec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use openvm_circuit::{
44
arch::ContinuationVmProof, system::memory::tree::public_values::UserPublicValuesProof,
55
};
66
use openvm_continuations::verifier::{
7-
internal::types::E2eStarkProof, root::types::RootVmVerifierInput,
7+
internal::types::VmStarkProof, root::types::RootVmVerifierInput,
88
};
99
use openvm_native_compiler::ir::DIGEST_SIZE;
1010
use openvm_native_recursion::hints::{InnerBatchOpening, InnerFriProof, InnerQueryProof};
@@ -61,7 +61,7 @@ impl Encode for ContinuationVmProof<SC> {
6161
}
6262
}
6363

64-
impl Encode for E2eStarkProof<SC> {
64+
impl Encode for VmStarkProof<SC> {
6565
fn encode<W: Write>(&self, writer: &mut W) -> Result<()> {
6666
self.proof.encode(writer)?;
6767
encode_slice(&self.user_public_values, writer)
@@ -332,7 +332,7 @@ impl Decode for ContinuationVmProof<SC> {
332332
}
333333
}
334334

335-
impl Decode for E2eStarkProof<SC> {
335+
impl Decode for VmStarkProof<SC> {
336336
fn decode<R: Read>(reader: &mut R) -> Result<Self> {
337337
let proof = Proof::decode(reader)?;
338338
let user_public_values = decode_vec(reader)?;

crates/sdk/src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use openvm_circuit::{
2121
},
2222
};
2323
use openvm_continuations::verifier::{
24-
internal::types::E2eStarkProof,
24+
internal::types::VmStarkProof,
2525
root::{types::RootVmVerifierInput, RootVmVerifierConfig},
2626
};
2727
pub use openvm_continuations::{
@@ -61,7 +61,7 @@ pub mod prover;
6161
mod stdin;
6262
pub use stdin::*;
6363

64-
use crate::keygen::asm::program_to_asm;
64+
use crate::{config::AggStarkConfig, keygen::asm::program_to_asm};
6565

6666
pub mod fs;
6767
pub mod types;
@@ -256,6 +256,11 @@ impl<E: StarkFriEngine<SC>> GenericSdk<E> {
256256
Ok(agg_pk)
257257
}
258258

259+
pub fn agg_stark_keygen(&self, config: AggStarkConfig) -> Result<AggStarkProvingKey> {
260+
let agg_pk = AggStarkProvingKey::keygen(config);
261+
Ok(agg_pk)
262+
}
263+
259264
pub fn generate_root_verifier_asm(&self, agg_stark_pk: &AggStarkProvingKey) -> String {
260265
let kernel_asm = RootVmVerifierConfig {
261266
leaf_fri_params: agg_stark_pk.leaf_vm_pk.fri_params,
@@ -297,7 +302,7 @@ impl<E: StarkFriEngine<SC>> GenericSdk<E> {
297302
app_exe: Arc<NonRootCommittedExe>,
298303
agg_stark_pk: AggStarkProvingKey,
299304
inputs: StdIn,
300-
) -> Result<E2eStarkProof<SC>>
305+
) -> Result<VmStarkProof<SC>>
301306
where
302307
VC::Executor: Chip<SC>,
303308
VC::Periphery: Chip<SC>,

crates/sdk/src/prover/agg.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::sync::Arc;
22

33
use openvm_circuit::arch::ContinuationVmProof;
44
use openvm_continuations::verifier::{
5-
internal::types::{E2eStarkProof, InternalVmVerifierInput},
5+
internal::types::{InternalVmVerifierInput, VmStarkProof},
66
leaf::types::LeafVmVerifierInput,
77
root::types::RootVmVerifierInput,
88
};
@@ -79,8 +79,8 @@ impl<E: StarkFriEngine<SC>> AggStarkProver<E> {
7979
self
8080
}
8181

82-
/// Generate a proof to aggregate app proofs.
83-
pub fn generate_agg_proof(&self, app_proofs: ContinuationVmProof<SC>) -> Proof<RootSC> {
82+
/// Generate the root proof for outer recursion.
83+
pub fn generate_root_proof(&self, app_proofs: ContinuationVmProof<SC>) -> Proof<RootSC> {
8484
let root_verifier_input = self.generate_root_verifier_input(app_proofs);
8585
self.generate_root_proof_impl(root_verifier_input)
8686
}
@@ -96,15 +96,15 @@ impl<E: StarkFriEngine<SC>> AggStarkProver<E> {
9696
) -> RootVmVerifierInput<SC> {
9797
let leaf_proofs = self.generate_leaf_proofs(&app_proofs);
9898
let public_values = app_proofs.user_public_values.public_values;
99-
let e2e_stark_proof = self.generate_e2e_stark_proof(leaf_proofs, public_values);
99+
let e2e_stark_proof = self.aggregate_leaf_proofs(leaf_proofs, public_values);
100100
self.wrap_e2e_stark_proof(e2e_stark_proof)
101101
}
102102

103-
pub fn generate_e2e_stark_proof(
103+
pub fn aggregate_leaf_proofs(
104104
&self,
105105
leaf_proofs: Vec<Proof<SC>>,
106106
public_values: Vec<F>,
107-
) -> E2eStarkProof<SC> {
107+
) -> VmStarkProof<SC> {
108108
let mut internal_node_idx = -1;
109109
let mut internal_node_height = 0;
110110
let mut proofs = leaf_proofs;
@@ -140,7 +140,7 @@ impl<E: StarkFriEngine<SC>> AggStarkProver<E> {
140140
});
141141
internal_node_height += 1;
142142
}
143-
E2eStarkProof {
143+
VmStarkProof {
144144
proof: proofs.pop().unwrap(),
145145
user_public_values: public_values,
146146
}
@@ -149,7 +149,7 @@ impl<E: StarkFriEngine<SC>> AggStarkProver<E> {
149149
/// Wrap the e2e stark proof until its heights meet the requirements of the root verifier.
150150
pub fn wrap_e2e_stark_proof(
151151
&self,
152-
e2e_stark_proof: E2eStarkProof<SC>,
152+
e2e_stark_proof: VmStarkProof<SC>,
153153
) -> RootVmVerifierInput<SC> {
154154
let internal_commit = self
155155
.internal_prover
@@ -214,9 +214,9 @@ pub fn wrap_e2e_stark_proof<E: StarkFriEngine<SC>>(
214214
root_prover: &RootVerifierLocalProver,
215215
internal_commit: [F; DIGEST_SIZE],
216216
max_internal_wrapper_layers: usize,
217-
e2e_stark_proof: E2eStarkProof<SC>,
217+
e2e_stark_proof: VmStarkProof<SC>,
218218
) -> RootVmVerifierInput<SC> {
219-
let E2eStarkProof {
219+
let VmStarkProof {
220220
mut proof,
221221
user_public_values,
222222
} = e2e_stark_proof;

crates/sdk/src/prover/stark.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::sync::Arc;
22

33
use openvm_circuit::arch::VmConfig;
44
use openvm_continuations::verifier::{
5-
internal::types::E2eStarkProof, root::types::RootVmVerifierInput,
5+
internal::types::VmStarkProof, root::types::RootVmVerifierInput,
66
};
77
use openvm_stark_backend::{proof::Proof, Chip};
88
use openvm_stark_sdk::engine::StarkFriEngine;
@@ -58,7 +58,7 @@ impl<VC, E: StarkFriEngine<SC>> StarkProver<VC, E> {
5858
VC::Periphery: Chip<SC>,
5959
{
6060
let app_proof = self.app_prover.generate_app_proof(input);
61-
self.agg_prover.generate_agg_proof(app_proof)
61+
self.agg_prover.generate_root_proof(app_proof)
6262
}
6363

6464
pub fn generate_root_verifier_input(&self, input: StdIn) -> RootVmVerifierInput<SC>
@@ -71,7 +71,7 @@ impl<VC, E: StarkFriEngine<SC>> StarkProver<VC, E> {
7171
self.agg_prover.generate_root_verifier_input(app_proof)
7272
}
7373

74-
pub fn generate_e2e_stark_proof(&self, input: StdIn) -> E2eStarkProof<SC>
74+
pub fn generate_e2e_stark_proof(&self, input: StdIn) -> VmStarkProof<SC>
7575
where
7676
VC: VmConfig<F>,
7777
VC::Executor: Chip<SC>,
@@ -80,6 +80,6 @@ impl<VC, E: StarkFriEngine<SC>> StarkProver<VC, E> {
8080
let app_proof = self.app_prover.generate_app_proof(input);
8181
let leaf_proofs = self.agg_prover.generate_leaf_proofs(&app_proof);
8282
self.agg_prover
83-
.generate_e2e_stark_proof(leaf_proofs, app_proof.user_public_values.public_values)
83+
.aggregate_leaf_proofs(leaf_proofs, app_proof.user_public_values.public_values)
8484
}
8585
}

docs/specs/ISA.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,12 +429,12 @@ with user input-output.
429429

430430
The RV32IM extension defines the following phantom sub-instructions.
431431

432-
| Name | Discriminant | Operands | Description |
433-
|-------------------| ------------ | -------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
434-
| Rv32HintInput | 0x20 | `_` | Pops a vector `hint` of field elements from the input stream and resets the hint stream to equal the vector `[(hint.len() as u32).to_le_bytes()), hint].concat()`. |
435-
| Rv32PrintStr | 0x21 | `a,b,_` | Peeks at `[r32{0}(a)..r32{0}(a) + r32{0}(b)]_2`, tries to convert to byte array and then UTF-8 string and prints to host stdout. Prints error message if conversion fails. Does not change any VM state. |
436-
| Rv32HintRandom | 0x22 | `a,_,_` | Resets the hint stream to `4 * r32{0}(a)` random bytes. The source of randomness is the host operating system (`rand::rngs::OsRng`). Its result is not constrained in any way. |
437-
| Rv32HintLoadByKey | 0x23 | `a,b,_` | Look up the value by key `[r32{0}{a}:r32{0}{b}]_2` and prepend the value into `input_stream`. Users should use `openvm-rv32im-guest::hint_load_by_key_encode` to encode the value when constructing inputs. |
432+
| Name | Discriminant | Operands | Description |
433+
|-------------------| ------------ | -------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
434+
| Rv32HintInput | 0x20 | `_` | Pops a vector `hint` of field elements from the input stream and resets the hint stream to equal the vector `[(hint.len() as u32).to_le_bytes()), hint].concat()`. |
435+
| Rv32PrintStr | 0x21 | `a,b,_` | Peeks at `[r32{0}(a)..r32{0}(a) + r32{0}(b)]_2`, tries to convert to byte array and then UTF-8 string and prints to host stdout. Prints error message if conversion fails. Does not change any VM state. |
436+
| Rv32HintRandom | 0x22 | `a,_,_` | Resets the hint stream to `4 * r32{0}(a)` random bytes. The source of randomness is the host operating system (`rand::rngs::OsRng`). Its result is not constrained in any way. |
437+
| Rv32HintLoadByKey | 0x23 | `a,b,_` | Look up the value by key `[r32{0}{a}:r32{0}{b}]_2` and prepend the value into `input_stream`. The logical value is `Vec<Vec<F>>`. The serialization of `Vec` follows the format `[length, <content>]`. Both length and content encoded as little-endian bytes. |
438438
### Native Extension
439439

440440
The native extension operates over native field elements and has instructions tailored for STARK proof recursion. It

0 commit comments

Comments
 (0)