Skip to content

Commit e555f10

Browse files
committed
Fix estimation on non legacy chains for scripts
1 parent c427960 commit e555f10

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

crates/script/src/broadcast.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,26 @@ impl BundledState {
348348
}),
349349
),
350350
(false, _, _) => {
351-
let mut fees = provider.estimate_eip1559_fees(None).await.wrap_err("Failed to estimate EIP1559 fees. This chain might not support EIP1559, try adding --legacy to your command.")?;
351+
if self.script_config.config.zksync.run_in_zk_mode() {
352+
// NOTE(zk): We need to avoid estimating eip1559 fees for zk transactions
353+
// as the fee is estimated later. This branch is for non legacy chains (zkchains).
354+
(Some(provider.get_gas_price().await?), None)
355+
} else {
356+
let mut fees = provider
357+
.estimate_eip1559_fees(None)
358+
.await
359+
.wrap_err("Failed to estimate EIP1559 fees. This chain might not support EIP1559, try adding --legacy to your command.")?;
352360

353-
if let Some(gas_price) = self.args.with_gas_price {
354-
fees.max_fee_per_gas = gas_price.to();
355-
}
361+
if let Some(gas_price) = self.args.with_gas_price {
362+
fees.max_fee_per_gas = gas_price.to();
363+
}
356364

357-
if let Some(priority_gas_price) = self.args.priority_gas_price {
358-
fees.max_priority_fee_per_gas = priority_gas_price.to();
359-
}
365+
if let Some(priority_gas_price) = self.args.priority_gas_price {
366+
fees.max_priority_fee_per_gas = priority_gas_price.to();
367+
}
360368

361-
(None, Some(fees))
369+
(None, Some(fees))
370+
}
362371
}
363372
};
364373

0 commit comments

Comments
 (0)