Skip to content

Commit c74cd72

Browse files
authored
fix(executor): map L2 gas correctly (#160)
1 parent 672b217 commit c74cd72

File tree

1 file changed

+8
-6
lines changed
  • crates/executor/src/implementation/blockifier

1 file changed

+8
-6
lines changed

crates/executor/src/implementation/blockifier/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,16 @@ impl<'a> StarknetVMProcessor<'a> {
145145
let number = BlockNumber(header.number);
146146
let timestamp = BlockTimestamp(header.timestamp);
147147

148-
// TODO: should we enforce the gas price to not be 0,
149-
// as there's a flag to disable gas uasge instead?
148+
let eth_l2_gas_price = NonzeroGasPrice::new(header.l2_gas_prices.eth.get().into())
149+
.unwrap_or(NonzeroGasPrice::MIN);
150+
let strk_l2_gas_price = NonzeroGasPrice::new(header.l2_gas_prices.strk.get().into())
151+
.unwrap_or(NonzeroGasPrice::MIN);
152+
150153
let eth_l1_gas_price = NonzeroGasPrice::new(header.l1_gas_prices.eth.get().into())
151154
.unwrap_or(NonzeroGasPrice::MIN);
152155
let strk_l1_gas_price = NonzeroGasPrice::new(header.l1_gas_prices.strk.get().into())
153156
.unwrap_or(NonzeroGasPrice::MIN);
157+
154158
let eth_l1_data_gas_price =
155159
NonzeroGasPrice::new(header.l1_data_gas_prices.eth.get().into())
156160
.unwrap_or(NonzeroGasPrice::MIN);
@@ -169,16 +173,14 @@ impl<'a> StarknetVMProcessor<'a> {
169173
sequencer_address: utils::to_blk_address(header.sequencer_address),
170174
gas_prices: GasPrices {
171175
eth_gas_prices: GasPriceVector {
176+
l2_gas_price: eth_l2_gas_price,
172177
l1_gas_price: eth_l1_gas_price,
173178
l1_data_gas_price: eth_l1_data_gas_price,
174-
// TODO: update to use the correct value
175-
l2_gas_price: eth_l1_gas_price,
176179
},
177180
strk_gas_prices: GasPriceVector {
181+
l2_gas_price: strk_l2_gas_price,
178182
l1_gas_price: strk_l1_gas_price,
179183
l1_data_gas_price: strk_l1_data_gas_price,
180-
// TODO: update to use the correct value
181-
l2_gas_price: strk_l1_gas_price,
182184
},
183185
},
184186
use_kzg_da: false,

0 commit comments

Comments
 (0)