Skip to content

Commit 2d41454

Browse files
committed
apollo_gateway: expose l2_gas_price towards reject on insufficient gas price
1 parent 415c316 commit 2d41454

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

crates/apollo_gateway/src/gateway.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ impl ProcessTxBlockingTask {
203203
let mut validator = self
204204
.stateful_tx_validator
205205
.instantiate_validator(self.state_reader_factory.as_ref(), &self.chain_info)?;
206+
// TODO(Arni): Use the _l2_gas_price reject transactions that do not pass the gas price
207+
// threshold.
208+
// TODO(Arni): get next_l2_gas_price from the block header.
209+
let _l2_gas_price =
210+
validator.block_context().block_info().gas_prices.strk_gas_prices.l2_gas_price;
206211
let address = executable_tx.contract_address();
207212
let nonce = validator.get_nonce(address).map_err(|e| {
208213
error!("Failed to get nonce for sender address {}: {}", address, e);

crates/blockifier/src/blockifier/stateful_validator.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ impl<S: StateReader> StatefulValidator<S> {
7979
Ok(())
8080
}
8181

82+
pub fn block_context(&self) -> &BlockContext {
83+
self.tx_executor.block_context.as_ref()
84+
}
85+
8286
fn state(&mut self) -> &mut CachedState<S> {
8387
self.tx_executor.block_state.as_mut().expect(BLOCK_STATE_ACCESS_ERR)
8488
}

0 commit comments

Comments
 (0)