@@ -294,9 +294,15 @@ impl GasAdjuster {
294294 ( self . estimate_effective_gas_price ( ) * L1_GAS_PER_PUBDATA_BYTE as u64 ) as f64 ,
295295 ) ,
296296 PubdataSendingMode :: Custom => {
297- // Fix this when we have a better understanding of dynamic pricing for custom DA layers.
297+ // For Validium/Custom DA, we need to return a minimum gas per pubdata price
298+ // to ensure that transactions settling on this gateway can calculate a valid
299+ // gas_per_pubdata value. Without this, chains trying to settle on a Validium
300+ // gateway will fail with "gas per pub data limit is zero" error.
301+ // We use REQUIRED_L2_GAS_PRICE_PER_PUBDATA (800) as the minimum.
302+ // TODO: We still need to have a better understanding of dynamic pricing for custom DA layers.
298303 // GitHub issue: https://github.com/matter-labs/zksync-era/issues/2105
299- 0
304+ const MIN_PUBDATA_PRICE_FOR_VALIDIUM : u64 = 800 ; // Same as REQUIRED_L2_GAS_PRICE_PER_PUBDATA
305+ MIN_PUBDATA_PRICE_FOR_VALIDIUM
300306 }
301307 PubdataSendingMode :: RelayedL2Calldata => {
302308 self . cap_pubdata_fee ( self . l2_pubdata_price_statistics . median ( ) . as_u64 ( ) as f64 )
@@ -308,7 +314,17 @@ impl GasAdjuster {
308314 // We will treat the max blob base fee as the maximal fee that we can take for each byte of pubdata.
309315 let max_blob_base_fee = self . config . max_blob_base_fee ;
310316 match self . commitment_mode {
311- L1BatchCommitmentMode :: Validium => 0 ,
317+ L1BatchCommitmentMode :: Validium => {
318+ // For Validium mode, we still need to return the pubdata fee
319+ // to ensure chains settling on this gateway can function properly.
320+ // We don't cap it to 0 as that would break settlement transactions.
321+ // We apply the same max fee cap as for Rollup mode.
322+ if pubdata_fee > max_blob_base_fee as f64 {
323+ tracing:: warn!( "Pubdata fee for Validium is high: {pubdata_fee}, using max allowed: {max_blob_base_fee}" ) ;
324+ return max_blob_base_fee;
325+ }
326+ pubdata_fee as u64
327+ }
312328 L1BatchCommitmentMode :: Rollup => {
313329 if pubdata_fee > max_blob_base_fee as f64 {
314330 tracing:: error!( "Blob base fee is too high: {pubdata_fee}, using max allowed: {max_blob_base_fee}" ) ;
0 commit comments