11use crate :: batcher_metrics:: BatchExecutionStage ;
22use crate :: batcher_model:: { FriProof , SignedBatchEnvelope } ;
33use crate :: commands:: SendToL1 ;
4- use alloy:: primitives:: { Bytes , FixedBytes , U256 } ;
4+ use alloy:: primitives:: { Bytes , U256 } ;
55use alloy:: sol_types:: { SolCall , SolValue } ;
66use std:: fmt:: Display ;
77use zksync_os_contract_interface:: models:: PriorityOpsBatchInfo ;
@@ -33,12 +33,12 @@ impl SendToL1 for ExecuteCommand {
3333
3434 const PASSTHROUGH_STAGE : BatchExecutionStage = BatchExecutionStage :: ExecuteL1Passthrough ;
3535
36- fn solidity_call ( & self ) -> Bytes {
36+ fn solidity_call ( & self , gateway : bool ) -> Bytes {
3737 IExecutor :: executeBatchesSharedBridgeCall:: new ( (
3838 self . batches . first ( ) . unwrap ( ) . batch . batch_info . chain_address ,
3939 U256 :: from ( self . batches . first ( ) . unwrap ( ) . batch_number ( ) ) ,
4040 U256 :: from ( self . batches . last ( ) . unwrap ( ) . batch_number ( ) ) ,
41- self . to_calldata_suffix ( ) . into ( ) ,
41+ self . to_calldata_suffix ( gateway ) . into ( ) ,
4242 ) )
4343 . abi_encode ( )
4444 . into ( )
@@ -76,7 +76,7 @@ impl Display for ExecuteCommand {
7676}
7777
7878impl ExecuteCommand {
79- fn to_calldata_suffix ( & self ) -> Vec < u8 > {
79+ fn to_calldata_suffix ( & self , gateway : bool ) -> Vec < u8 > {
8080 let stored_batch_infos = self
8181 . batches
8282 . iter ( )
@@ -102,19 +102,41 @@ impl ExecuteCommand {
102102 {
103103 29 | 30 => ( stored_batch_infos, priority_ops, interop_roots) . abi_encode_params ( ) ,
104104 31 | 32 => {
105- // For now, these are not validated, so they can be empty.
106- // IMPORTANT: the struct is not correct, it only works while the array is empty
107- let logs: Vec < u8 > = Default :: default ( ) ;
108- let messages: Vec < Vec < u8 > > = Default :: default ( ) ;
109- let message_roots: Vec < FixedBytes < 32 > > = Default :: default ( ) ;
110-
105+ let mut logs = Vec :: new ( ) ;
106+ let mut messages = Vec :: new ( ) ;
107+ let mut multichain_batch_roots = Vec :: new ( ) ;
108+ if gateway {
109+ logs = self
110+ . batches
111+ . iter ( )
112+ . map ( |batch| {
113+ batch
114+ . batch
115+ . logs
116+ . iter ( )
117+ . cloned ( )
118+ . map ( IExecutor :: L2Log :: from)
119+ . collect :: < Vec < _ > > ( )
120+ } )
121+ . collect :: < Vec < _ > > ( ) ;
122+ messages = self
123+ . batches
124+ . iter ( )
125+ . map ( |batch| batch. batch . messages . clone ( ) )
126+ . collect :: < Vec < _ > > ( ) ;
127+ multichain_batch_roots = self
128+ . batches
129+ . iter ( )
130+ . map ( |batch| batch. batch . multichain_batch_root )
131+ . collect :: < Vec < _ > > ( ) ;
132+ }
111133 (
112134 stored_batch_infos,
113135 priority_ops,
114136 interop_roots,
115137 logs,
116138 messages,
117- message_roots ,
139+ multichain_batch_roots ,
118140 )
119141 . abi_encode_params ( )
120142 }
0 commit comments