@@ -3,12 +3,12 @@ use eyre::Result;
33use sbv_primitives:: { B256 , U256 } ;
44use scroll_zkvm_types:: {
55 batch:: {
6- build_point_eval_witness, BatchHeader , BatchHeaderV6 , BatchHeaderV7 , BatchHeaderV8 ,
7- BatchHeaderValidium , BatchInfo , BatchWitness , Envelope , EnvelopeV6 , EnvelopeV7 , EnvelopeV8 ,
8- LegacyBatchWitness , ReferenceHeader , N_BLOB_BYTES ,
6+ build_point_eval_witness, BatchHeader , BatchHeaderV6 , BatchHeaderV7 , BatchHeaderValidium ,
7+ BatchInfo , BatchWitness , Envelope , EnvelopeV6 , EnvelopeV7 , LegacyBatchWitness ,
8+ ReferenceHeader , N_BLOB_BYTES ,
99 } ,
1010 chunk:: ChunkInfo ,
11- public_inputs:: { ForkName , Version , MultiVersionPublicInputs } ,
11+ public_inputs:: { ForkName , MultiVersionPublicInputs , Version } ,
1212 task:: ProvingTask ,
1313 utils:: { to_rkyv_bytes, RancorError } ,
1414 version:: { Codec , Domain , STFVersion } ,
@@ -34,6 +34,7 @@ pub struct BatchHeaderValidiumWithHash {
3434/// defination, i.e. v6- v8 (current), and validium
3535#[ derive( Clone , serde:: Deserialize , serde:: Serialize ) ]
3636#[ serde( untagged) ]
37+ #[ allow( non_camel_case_types) ]
3738pub enum BatchHeaderV {
3839 /// Header for validium mode.
3940 Validium ( BatchHeaderValidiumWithHash ) ,
@@ -43,14 +44,14 @@ pub enum BatchHeaderV {
4344 ///
4445 /// Since the codec essentially is unchanged for the above STF versions, we do not define new
4546 /// variants, instead re-using the [`BatchHeaderV7`] variant.
46- V7_8_9 ( BatchHeaderV7 ) ,
47+ V7_V8_V9 ( BatchHeaderV7 ) ,
4748}
4849
4950impl core:: fmt:: Display for BatchHeaderV {
5051 fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
5152 match self {
5253 BatchHeaderV :: V6 ( _) => write ! ( f, "V6" ) ,
53- BatchHeaderV :: V7_8_9 ( _) => write ! ( f, "V7_8_9 " ) ,
54+ BatchHeaderV :: V7_V8_V9 ( _) => write ! ( f, "V7_V8_V9 " ) ,
5455 BatchHeaderV :: Validium ( _) => write ! ( f, "Validium" ) ,
5556 }
5657 }
@@ -60,7 +61,7 @@ impl BatchHeaderV {
6061 pub fn batch_hash ( & self ) -> B256 {
6162 match self {
6263 BatchHeaderV :: V6 ( h) => h. batch_hash ( ) ,
63- BatchHeaderV :: V7_8_9 ( h) => h. batch_hash ( ) ,
64+ BatchHeaderV :: V7_V8_V9 ( h) => h. batch_hash ( ) ,
6465 BatchHeaderV :: Validium ( h) => h. header . batch_hash ( ) ,
6566 }
6667 }
@@ -72,17 +73,10 @@ impl BatchHeaderV {
7273 }
7374 }
7475
75- pub fn must_v7_header ( & self ) -> & BatchHeaderV7 {
76+ pub fn must_v7_v8_v9_header ( & self ) -> & BatchHeaderV7 {
7677 match self {
77- BatchHeaderV :: V7_8_9 ( h) => h,
78- _ => unreachable ! ( "A header of {} is considered to be v7" , self ) ,
79- }
80- }
81-
82- pub fn must_v8_header ( & self ) -> & BatchHeaderV8 {
83- match self {
84- BatchHeaderV :: V7_8_9 ( h) => h,
85- _ => unreachable ! ( "A header of {} is considered to be v8" , self ) ,
78+ BatchHeaderV :: V7_V8_V9 ( h) => h,
79+ _ => unreachable ! ( "A header of {} is considered to be in [v7, v8, v9]" , self ) ,
8680 }
8781 }
8882
@@ -162,10 +156,8 @@ impl BatchProvingTask {
162156 version. fork,
163157 ForkName :: EuclidV1 ,
164158 ) ,
165- BatchHeaderV :: V7_8_9 ( _) => assert ! (
166- version. fork == ForkName :: EuclidV2 ||
167- version. fork == ForkName :: Feynman ||
168- version. fork == ForkName :: Galileo ,
159+ BatchHeaderV :: V7_V8_V9 ( _) => assert ! (
160+ matches!( version. fork, ForkName :: EuclidV2 | ForkName :: Feynman | ForkName :: Galileo ) ,
169161 "hardfork mismatch for da-codec@v7/8/9 header: found={}, expected={:?}" ,
170162 version. fork,
171163 [ ForkName :: EuclidV2 , ForkName :: Feynman , ForkName :: Galileo ] ,
@@ -192,8 +184,6 @@ impl BatchProvingTask {
192184 }
193185 Codec :: V7 => <EnvelopeV7 as Envelope >:: from_slice ( padded_blob_bytes. as_slice ( ) )
194186 . challenge_digest ( versioned_hash) ,
195- Codec :: V8 => <EnvelopeV8 as Envelope >:: from_slice ( padded_blob_bytes. as_slice ( ) )
196- . challenge_digest ( versioned_hash) ,
197187 } ;
198188 let ( proof, _) = point_eval:: get_kzg_proof ( & blob, challenge_digest) ;
199189
@@ -242,9 +232,6 @@ impl BatchProvingTask {
242232 ( Domain :: Scroll , STFVersion :: V6 ) => {
243233 ReferenceHeader :: V6 ( * self . batch_header . must_v6_header ( ) )
244234 }
245- ( Domain :: Scroll , STFVersion :: V7 ) => {
246- ReferenceHeader :: V7 ( * self . batch_header . must_v7_header ( ) )
247- }
248235 // The da-codec for STF versions v7, v8, v9 is identical. In zkvm-prover we do not
249236 // create additional variants to indicate the identical behaviour of codec. Instead we
250237 // add a separate variant for the STF version.
@@ -255,8 +242,8 @@ impl BatchProvingTask {
255242 // hard-fork (feynman or galileo) and the codec from the version byte.
256243 //
257244 // Refer [`scroll_zkvm_types::public_inputs::Version`].
258- ( Domain :: Scroll , STFVersion :: V8 ) | ( Domain :: Scroll , STFVersion :: V9 ) => {
259- ReferenceHeader :: V8 ( * self . batch_header . must_v8_header ( ) )
245+ ( Domain :: Scroll , STFVersion :: V7 | STFVersion :: V8 | STFVersion :: V9 ) => {
246+ ReferenceHeader :: V7_V8_V9 ( * self . batch_header . must_v7_v8_v9_header ( ) )
260247 }
261248 ( Domain :: Validium , STFVersion :: V1 ) => {
262249 ReferenceHeader :: Validium ( * self . batch_header . must_validium_header ( ) )
0 commit comments