Skip to content

Commit 92ac60d

Browse files
roynalnarutolispcnoel2004
authored
Support Galileo (#214)
* chore: add galileo fork and update pi * chore: bump sbv * fix: bump sbv and fix compilation * add witness data * test: sbv update * try dbg * chore: bump sbv * fix: compilation post sbv update * test: remove witness for block xxx156 * test: update testdata * commitments * test data updated devnet3 * update test data * update first block witness (testdata galileo) * chore: bump reth + sbv * chore: commitments * chore: bump sbv+reth * commitments * chore: bump all * fix: version in blob is da-codec * fix: onchain batch header version is stf-version * fix(tests): pi-hash for e2e * tests: reduce proofgen time by changing e2e wit * commitments * chore: bump version * chore: commitments for 0.7.0-rc.1 * fix: blob's version is also stf-version * v0.7.0-rc.2 ok * chore: commitments * Galileo refactor header (#225) * refactor header to avoid duplicate variants * codec v8 no longer needed as it is identical with v7 * chore: commitments * chore: more refactoring, remove pi_hash_by_fork * chore: commitments --------- Co-authored-by: Zhuo Zhang <mycinbrin@gmail.com> * Re-introduce `ReferenceHeader::V8` for backwards compatibility with `0.5.2` (#226) * fix: re-introduce ReferenceHeader::V8 for backwards compatibility * for automatically set is_openvm_v13 flag in verifier, also recognize 0.5.6 release files * chore: fmt * chore: commitments --------- Co-authored-by: Ho <fan@scroll.io> Co-authored-by: Zhuo Zhang <mycinbrin@gmail.com> --------- Co-authored-by: Zhuo Zhang <mycinbrin@gmail.com> Co-authored-by: Ho <fan@scroll.io>
1 parent 7cbfbe4 commit 92ac60d

File tree

32 files changed

+941
-472
lines changed

32 files changed

+941
-472
lines changed

Cargo.lock

Lines changed: 641 additions & 249 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ edition = "2021"
2323
homepage = "https://github.com/scroll-tech/zkvm-prover"
2424
readme = "README.md"
2525
repository = "https://github.com/scroll-tech/zkvm-prover"
26-
version = "0.6.0"
26+
version = "0.7.0"
2727

2828
[workspace.dependencies]
2929
# openvm guest libs
@@ -70,17 +70,17 @@ openvm-transpiler = { git = "https://github.com/openvm-org/openvm.git", tag = "v
7070
# more openvm related libs
7171
openvm-stark-sdk = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.1" }
7272

73-
sbv-core = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "master" }
74-
sbv-helpers = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "master" }
75-
sbv-primitives = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "master" }
76-
sbv-utils = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "master" }
77-
sbv-trie = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "master" }
73+
sbv-core = { git = "https://github.com/scroll-tech/stateless-block-verifier", tag = "scroll-v91" }
74+
sbv-helpers = { git = "https://github.com/scroll-tech/stateless-block-verifier", tag = "scroll-v91", features = ["dev"] }
75+
sbv-primitives = { git = "https://github.com/scroll-tech/stateless-block-verifier", tag = "scroll-v91" }
76+
sbv-utils = { git = "https://github.com/scroll-tech/stateless-block-verifier", tag = "scroll-v91" }
77+
sbv-trie = { git = "https://github.com/scroll-tech/stateless-block-verifier", tag = "scroll-v91" }
7878

7979
alloy-consensus = "1.0"
8080
alloy-provider = "1.0"
8181
alloy-rpc-client = "1.0"
8282
alloy-transport = "1.0"
83-
alloy-primitives = { version = "1.3", default-features = false, features = [
83+
alloy-primitives = { version = "1.4.1", default-features = false, features = [
8484
"std",
8585
"map-hashbrown",
8686
"map-fxhash",
@@ -126,14 +126,14 @@ snark-verifier-sdk = { version = "=0.2.1", default-features = false, features =
126126
tiny-keccak = "2.0"
127127
thiserror = "2"
128128
tracing = "0.1"
129-
vm-zstd = { git = "https://github.com/scroll-tech/rust-zstd-decompressor.git", branch = "master" }
129+
vm-zstd = { git = "https://github.com/scroll-tech/rust-zstd-decompressor.git", rev = "b027327" }
130130
toml = "0.8.14"
131131
tracing-subscriber = "0.3"
132132
sysinfo = { version = "0.35", default-features = false }
133133
bytesize = "2.0.1"
134134
url = "2.5.4"
135135
tokio = "1"
136-
axiom-sdk = { git = "https://github.com/axiom-crypto/axiom-api-cli.git", branch = "feat/upload-exe-raw" }
136+
axiom-sdk = { git = "https://github.com/axiom-crypto/axiom-api-cli.git", rev = "a460528" }
137137
dotenvy = "0.15"
138138
jiff = "0.2"
139139

@@ -148,20 +148,18 @@ scroll-zkvm-prover = { path = "crates/prover" }
148148
scroll-zkvm-verifier = { path = "crates/verifier" }
149149

150150
[patch.crates-io]
151-
revm = { git = "https://github.com/scroll-tech/revm" }
152-
revm-bytecode = { git = "https://github.com/scroll-tech/revm" }
153-
revm-context = { git = "https://github.com/scroll-tech/revm" }
154-
revm-context-interface = { git = "https://github.com/scroll-tech/revm" }
155-
revm-database = { git = "https://github.com/scroll-tech/revm" }
156-
revm-database-interface = { git = "https://github.com/scroll-tech/revm" }
157-
revm-handler = { git = "https://github.com/scroll-tech/revm" }
158-
revm-inspector = { git = "https://github.com/scroll-tech/revm" }
159-
revm-interpreter = { git = "https://github.com/scroll-tech/revm" }
160-
revm-precompile = { git = "https://github.com/scroll-tech/revm" }
161-
revm-primitives = { git = "https://github.com/scroll-tech/revm" }
162-
revm-state = { git = "https://github.com/scroll-tech/revm" }
163-
164-
alloy-primitives = { git = "https://github.com/scroll-tech/alloy-core", branch = "feat/rkyv" }
151+
revm = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
152+
revm-bytecode = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
153+
revm-context = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
154+
revm-context-interface = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
155+
revm-database = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
156+
revm-database-interface = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
157+
revm-handler = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
158+
revm-inspector = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
159+
revm-interpreter = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
160+
revm-precompile = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
161+
revm-primitives = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
162+
revm-state = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
165163

166164
## FIXME: when openvm fixes https://github.com/openvm-org/openvm/pull/1937
167165
#[patch.'https://github.com/openvm-org/openvm.git']
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] = [169613029, 1512041042, 1908768371, 1004859199, 1983914774, 43222473, 909835658, 1213866356];
4+
pub const COMMIT: [u32; 8] = [1322080380, 1651942255, 463083856, 1076384953, 571197325, 1702971627, 375491115, 829280832];
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] = [1143263794, 1642021020, 1910803054, 330372631, 762840128, 1706047354, 1086014054, 673751013];
4+
pub const COMMIT: [u32; 8] = [1144920578, 672155974, 440997509, 565686465, 150547879, 714324919, 1665603288, 907252136];
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] = [72552249, 89910939, 1705051041, 1391470268, 810063640, 1213504996, 1356511642, 617368080];
4+
pub const COMMIT: [u32; 8] = [138721596, 243535334, 930392534, 379324085, 299238093, 1781158367, 1939995032, 1490622633];

crates/integration/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ const ENV_OUTPUT_DIR: &str = "OUTPUT_DIR";
4444

4545
/// Enviroment settings for test: fork
4646
pub fn testing_hardfork() -> ForkName {
47-
ForkName::Feynman
47+
testing_version().fork
4848
}
4949

5050
/// Test settings (version).
5151
pub fn testing_version() -> Version {
52-
Version::feynman()
52+
Version::galileo()
5353
}
5454

5555
pub fn testing_version_validium() -> Version {

crates/integration/src/testers/batch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ impl PartialProvingTask for BatchWitness {
1616
fn identifier(&self) -> String {
1717
let header_hash = match &self.reference_header {
1818
ReferenceHeader::V6(h) => h.batch_hash(),
19-
ReferenceHeader::V7(h) => h.batch_hash(),
20-
ReferenceHeader::V8(h) => h.batch_hash(),
19+
ReferenceHeader::V7_V8_V9(h) => h.batch_hash(),
20+
ReferenceHeader::V8(_) => unreachable!("Unexpected ReferenceHeader::V8 0.7.0 onwards"),
2121
ReferenceHeader::Validium(h) => h.batch_hash(),
2222
};
2323
header_hash.to_string()

crates/integration/src/testers/chunk.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ pub fn preset_chunk() -> ChunkTaskGenerator {
219219
ForkName::EuclidV1 => (Version::euclid_v1(), 12508460u64..=12508463u64),
220220
ForkName::EuclidV2 => (Version::euclid_v2(), 1u64..=4u64),
221221
ForkName::Feynman => (Version::feynman(), 16525000u64..=16525003u64),
222+
ForkName::Galileo => (Version::galileo(), 20239156..=20239235),
222223
};
223224

224225
ChunkTaskGenerator {
@@ -280,6 +281,14 @@ pub fn preset_chunk_multiple() -> Vec<ChunkTaskGenerator> {
280281
],
281282
Version::feynman(),
282283
),
284+
ForkName::Galileo => (
285+
vec![
286+
20239220..=20239220,
287+
20239221..=20239221,
288+
20239222..=20239222,
289+
],
290+
Version::galileo(),
291+
),
283292
};
284293
create_canonical_tasks(version, block_range.into_iter())
285294
.expect("must success for preset collections")

crates/integration/src/utils/mod.rs

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use bytesize::ByteSize;
33
use sbv_core::BlockWitness;
44
use sbv_primitives::types::consensus::ScrollTransaction;
55
use sbv_primitives::{B256, types::eips::Encodable2718};
6-
use scroll_zkvm_types::batch::build_point_eval_witness;
6+
use scroll_zkvm_types::batch::{N_BLOB_BYTES, build_point_eval_witness};
77
use scroll_zkvm_types::{
88
batch::{
99
BatchHeader, BatchHeaderV6, BatchHeaderV7, BatchHeaderValidium, BatchHeaderValidiumV1,
@@ -53,10 +53,9 @@ impl Default for LastHeader {
5353
// create a default LastHeader according to the dummy value
5454
// being set in the e2e test in scroll-prover:
5555
// https://github.com/scroll-tech/scroll-prover/blob/82f8ed3fabee5c3001b0b900cda1608413e621f8/integration/tests/e2e_tests.rs#L203C1-L207C8
56-
5756
Self {
5857
batch_index: 123,
59-
version: testing_hardfork().to_protocol_version(),
58+
version: testing_version().as_version_byte(),
6059
batch_hash: B256::new([
6160
0xab, 0xac, 0xad, 0xae, 0xaf, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6261
0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -70,8 +69,10 @@ impl From<&ReferenceHeader> for LastHeader {
7069
fn from(value: &ReferenceHeader) -> Self {
7170
match value {
7271
ReferenceHeader::V6(h) => h.into(),
73-
ReferenceHeader::V7(h) => h.into(),
74-
ReferenceHeader::V8(h) => h.into(),
72+
ReferenceHeader::V7_V8_V9(h) => h.into(),
73+
ReferenceHeader::V8(_) => {
74+
unreachable!("Unexpected ReferenceHeader::V8 from 0.7.0 onwards")
75+
}
7576
ReferenceHeader::Validium(h) => h.into(),
7677
}
7778
}
@@ -202,9 +203,17 @@ pub fn build_batch_witnesses(
202203
// compress ...
203204
let compressed_payload = zstd_encode(&payload);
204205

205-
let heading = compressed_payload.len() as u32 + ((version.as_version_byte() as u32) << 24);
206+
// 5 bytes are utilised by version (1), compressed_len (3) and is_encoded (1).
207+
if compressed_payload.len() > N_BLOB_BYTES - 5 {
208+
return Err(eyre::eyre!(
209+
"compression payload of batch too big: len={}",
210+
compressed_payload.len()
211+
));
212+
}
213+
214+
let heading = compressed_payload.len() as u32 + ((version.stf_version as u32) << 24);
206215

207-
let blob_bytes = if testing_hardfork() >= ForkName::EuclidV2 {
216+
let blob_bytes = if version.fork >= ForkName::EuclidV2 {
208217
let mut blob_bytes = Vec::from(heading.to_be_bytes());
209218
blob_bytes.push(1u8); // compressed flag
210219
blob_bytes.extend(compressed_payload);
@@ -289,20 +298,9 @@ pub fn build_batch_witnesses(
289298
blob_data_proof: point_evaluations.map(|u| B256::new(u.to_be_bytes())),
290299
})
291300
}
292-
ForkName::EuclidV2 => {
301+
ForkName::EuclidV2 | ForkName::Feynman | ForkName::Galileo => {
293302
use scroll_zkvm_types::batch::BatchHeaderV7;
294-
let _ = x + z;
295-
ReferenceHeader::V7(BatchHeaderV7 {
296-
version: last_header.version,
297-
batch_index: last_header.batch_index + 1,
298-
parent_batch_hash: last_header.batch_hash,
299-
blob_versioned_hash,
300-
})
301-
}
302-
ForkName::Feynman => {
303-
use scroll_zkvm_types::batch::BatchHeaderV8;
304-
let _ = x + z;
305-
ReferenceHeader::V8(BatchHeaderV8 {
303+
ReferenceHeader::V7_V8_V9(BatchHeaderV7 {
306304
version: last_header.version,
307305
batch_index: last_header.batch_index + 1,
308306
parent_batch_hash: last_header.batch_hash,
@@ -429,6 +427,10 @@ fn test_build_and_parse_batch_task() -> eyre::Result<()> {
429427
block_range: (16525000..=16525003).collect(),
430428
..Default::default()
431429
},
430+
ForkName::Galileo => ChunkTaskGenerator {
431+
block_range: (20239156..=20239192).collect(),
432+
..Default::default()
433+
},
432434
}
433435
.get_or_build_witness()?;
434436

@@ -447,14 +449,11 @@ fn test_build_and_parse_batch_task() -> eyre::Result<()> {
447449
let enveloped = batch::EnvelopeV6::from_slice(&task_wit.blob_bytes);
448450
<batch::PayloadV6 as Payload>::from_envelope(&enveloped).validate(h, infos);
449451
}
450-
ReferenceHeader::V7(h) => {
452+
ReferenceHeader::V7_V8_V9(h) => {
451453
let enveloped = batch::EnvelopeV7::from_slice(&task_wit.blob_bytes);
452454
<batch::PayloadV7 as Payload>::from_envelope(&enveloped).validate(h, infos);
453455
}
454-
ReferenceHeader::V8(h) => {
455-
let enveloped = batch::EnvelopeV8::from_slice(&task_wit.blob_bytes);
456-
<batch::PayloadV8 as Payload>::from_envelope(&enveloped).validate(h, infos);
457-
}
456+
ReferenceHeader::V8(_) => unreachable!("Unexpected ReferenceHeader::V8 from 0.7.0 onwards"),
458457
ReferenceHeader::Validium(_h) => {
459458
todo!()
460459
}

crates/integration/tests/batch_circuit.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ fn verify_batch_hash_invariant() -> eyre::Result<()> {
108108
16525003u64..=16525003u64,
109109
],
110110
),
111+
ForkName::Galileo => (
112+
Version::galileo(),
113+
vec![
114+
20239156..=20239162,
115+
20239163..=20239175,
116+
20239176..=20239192,
117+
],
118+
),
111119
};
112120
let outcome_2 = create_canonical_tasks(version, block_range.into_iter())?;
113121

0 commit comments

Comments
 (0)