Skip to content

Commit a18ffd9

Browse files
committed
Merge branch 'master' into feat/galileo
2 parents f30db47 + 0d964cd commit a18ffd9

File tree

7 files changed

+75
-17
lines changed

7 files changed

+75
-17
lines changed

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#![cfg_attr(rustfmt, rustfmt_skip)]
22
//! Generated by crates/build-guest. DO NOT EDIT!
33
4-
pub const COMMIT: [u32; 8] = [1869611773, 1247170897, 378997350, 1626925707, 51022202, 1885217756, 994126060, 367287951];
4+
pub const COMMIT: [u32; 8] = [1649793006, 453918448, 700472053, 1708688727, 1956651385, 1452705656, 611459631, 1820274171];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#![cfg_attr(rustfmt, rustfmt_skip)]
22
//! Generated by crates/build-guest. DO NOT EDIT!
33
4-
pub const COMMIT: [u32; 8] = [1289401053, 749703688, 860681877, 492591804, 495756180, 98854923, 410751013, 1460515955];
4+
pub const COMMIT: [u32; 8] = [2012351307, 1390891344, 349217220, 1980321794, 92671869, 1673212720, 1290433404, 1552447571];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#![cfg_attr(rustfmt, rustfmt_skip)]
22
//! Generated by crates/build-guest. DO NOT EDIT!
33
4-
pub const COMMIT: [u32; 8] = [1096015076, 1198291774, 641106194, 1394738744, 869777519, 1181640357, 1080205349, 850775029];
4+
pub const COMMIT: [u32; 8] = [534218310, 1811212981, 1016259372, 652600422, 1802874675, 1341042917, 594473376, 479497145];

crates/integration/src/testers/chunk.rs

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
use crate::{
2+
PartialProvingTask, ProverTester, guest_version, prove_verify, testdata_fork_directory,
3+
tester_execute, testers::PATH_TESTDATA, testing_hardfork, testing_version,
4+
utils::metadata_from_chunk_witnesses,
5+
};
6+
use openvm_sdk::StdIn;
17
use rayon::iter::{IntoParallelIterator, ParallelIterator};
28
use sbv_core::BlockWitness;
39
use sbv_primitives::{B256, types::consensus::TxL1Message};
410
use scroll_zkvm_prover::utils::vm::ExecutionResult;
511
use scroll_zkvm_prover::{Prover, utils::read_json};
12+
use scroll_zkvm_types::chunk::ChunkWitnessUpgradeCompact;
613
use scroll_zkvm_types::{
714
chunk::{ChunkInfo, ChunkWitness, LegacyChunkWitness, SecretKey},
815
proof::ProofEnum,
@@ -13,12 +20,6 @@ use std::{
1320
path::{Path, PathBuf},
1421
};
1522

16-
use crate::{
17-
PartialProvingTask, ProverTester, prove_verify, testdata_fork_directory, tester_execute,
18-
testers::PATH_TESTDATA, testing_hardfork, testing_version,
19-
utils::metadata_from_chunk_witnesses,
20-
};
21-
2223
/// Load a file <block_n>.json in the <PATH_BLOCK_WITNESS> directory.
2324
pub fn read_block_witness_from_testdata(block_n: usize) -> eyre::Result<BlockWitness> {
2425
read_block_witness(
@@ -67,6 +68,28 @@ impl PartialProvingTask for ChunkWitness {
6768
Ok(bytes.to_vec())
6869
}
6970

71+
fn write_guest_input(&self, stdin: &mut StdIn) -> eyre::Result<()>
72+
where
73+
Self: Sized,
74+
{
75+
let bytes: Vec<u8> = match guest_version().as_str() {
76+
"0.5.2" => self.legacy_rkyv_archive()?,
77+
"0.6.0-rc.6" => {
78+
let config = bincode::config::standard();
79+
bincode::serde::encode_to_vec(
80+
ChunkWitnessUpgradeCompact::from(self.clone()),
81+
config,
82+
)?
83+
}
84+
_ => {
85+
let config = bincode::config::standard();
86+
bincode::serde::encode_to_vec(self, config)?
87+
}
88+
};
89+
stdin.write_bytes(&bytes);
90+
Ok(())
91+
}
92+
7093
fn fork_name(&self) -> ForkName {
7194
ForkName::from(self.fork_name.as_str())
7295
}

crates/types/chunk/src/scroll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ mod execute;
55
pub use execute::execute;
66

77
mod witness;
8-
pub use witness::{ChunkWitness, LegacyChunkWitness, ValidiumInputs};
8+
pub use witness::{ChunkWitness, ChunkWitnessUpgradeCompact, LegacyChunkWitness, ValidiumInputs};

crates/types/chunk/src/scroll/witness.rs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ pub struct ValidiumInputs {
3434
pub secret_key: Box<[u8]>,
3535
}
3636

37+
/// The witness type accepted by last version chunk-circuit.
38+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
39+
pub struct ChunkWitnessUpgradeCompact {
40+
/// Version byte as per [version][types_base::version].
41+
pub version: u8,
42+
/// The block witness for each block in the chunk.
43+
pub blocks: Vec<BlockWitness>,
44+
/// The on-chain rolling L1 message queue hash before enqueueing any L1 msg tx from the chunk.
45+
pub prev_msg_queue_hash: B256,
46+
/// The code version specify the chain spec
47+
pub fork_name: ForkName,
48+
/// The compression ratios for each block in the chunk.
49+
pub compression_ratios: Vec<Vec<U256>>,
50+
/// Validium encrypted txs and secret key if this is a validium chain.
51+
pub validium: Option<ValidiumInputs>,
52+
}
53+
3754
/// The witness type accepted by the chunk-circuit.
3855
#[derive(
3956
Clone,
@@ -130,6 +147,7 @@ impl ChunkWitness {
130147
.collect(),
131148
})
132149
.collect();
150+
133151
let compression_infos = blocks
134152
.iter()
135153
.map(|block| block.compression_infos())
@@ -186,10 +204,27 @@ impl From<ChunkWitness> for LegacyChunkWitness {
186204
fork_name: value.fork_name,
187205
compression_ratios: value
188206
.compression_infos
189-
.into_iter()
190-
.map(|infos| infos.into_iter().map(|info| info.0).collect())
207+
.iter()
208+
.map(|compression_infos| compression_infos.iter().map(|v| v.0).collect())
191209
.collect(),
192210
state_commit_mode: StateCommitMode::Auto,
193211
}
194212
}
195213
}
214+
215+
impl From<ChunkWitness> for ChunkWitnessUpgradeCompact {
216+
fn from(value: ChunkWitness) -> Self {
217+
ChunkWitnessUpgradeCompact {
218+
version: value.version,
219+
blocks: value.blocks,
220+
prev_msg_queue_hash: value.prev_msg_queue_hash,
221+
fork_name: value.fork_name,
222+
compression_ratios: value
223+
.compression_infos
224+
.iter()
225+
.map(|compression_infos| compression_infos.iter().map(|v| v.0).collect())
226+
.collect(),
227+
validium: value.validium,
228+
}
229+
}
230+
}

0 commit comments

Comments
 (0)