Skip to content

Commit 10de3b5

Browse files
author
Solar Mithril
authored
Use original function with manual scaling (#96)
* Use original function with manual scaling * Added comment
1 parent fa22d5c commit 10de3b5

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

crates/op-rbuilder/src/builders/context.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,12 @@ impl OpPayloadBuilderCtx {
571571
// Create and sign the transaction
572572
let builder_tx =
573573
signed_builder_tx(db, builder_tx_gas, message, signer, base_fee, chain_id)?;
574-
Ok(op_alloy_flz::data_gas_fjord(
575-
builder_tx.encoded_2718().as_slice(),
576-
))
574+
Ok(
575+
op_alloy_flz::tx_estimated_size_fjord(builder_tx.encoded_2718().as_slice())
576+
// Downscaled by 1e6 to be compliant with op-geth estimate size function
577+
// https://github.com/ethereum-optimism/op-geth/blob/optimism/core/types/rollup_cost.go#L563
578+
.wrapping_div(1_000_000),
579+
)
577580
})
578581
.transpose()
579582
.unwrap_or_else(|err: PayloadBuilderError| {

crates/op-rbuilder/src/tests/vanilla/data_availability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async fn data_availability_block_fill() -> eyre::Result<()> {
7979
// Set block big enough so it could fit 3 transactions without tx size limit
8080
let call = harness
8181
.provider()?
82-
.raw_request::<(i32, i32), bool>("miner_setMaxDASize".into(), (0, 1600 * 3))
82+
.raw_request::<(i32, i32), bool>("miner_setMaxDASize".into(), (0, 100 * 3))
8383
.await?;
8484
assert!(call, "miner_setMaxDASize should be executed successfully");
8585

crates/op-rbuilder/src/tx.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ impl MaybeInteropTransaction for FBPooledTransaction {
221221

222222
impl DataAvailabilitySized for FBPooledTransaction {
223223
fn estimated_da_size(&self) -> u64 {
224-
op_alloy_flz::data_gas_fjord(self.inner.encoded_2718())
224+
// Downscaled by 1e6 to be compliant with op-geth estimate size function
225+
// https://github.com/ethereum-optimism/op-geth/blob/optimism/core/types/rollup_cost.go#L563
226+
op_alloy_flz::tx_estimated_size_fjord(self.inner.encoded_2718()).wrapping_div(1_000_000)
225227
}
226228
}
227229

0 commit comments

Comments
 (0)