@@ -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