revm_interpreter/instructions/
tx_info.rs

1use crate::{
2    gas,
3    interpreter::Interpreter,
4    interpreter_types::{InterpreterTypes, LoopControl, RuntimeFlag, StackTr},
5    Host,
6};
7use primitives::U256;
8
9pub fn gasprice<WIRE: InterpreterTypes, H: Host + ?Sized>(
10    interpreter: &mut Interpreter<WIRE>,
11    host: &mut H,
12) {
13    gas!(interpreter, gas::BASE);
14    push!(interpreter, U256::from(host.effective_gas_price()));
15}
16
17pub fn origin<WIRE: InterpreterTypes, H: Host + ?Sized>(
18    interpreter: &mut Interpreter<WIRE>,
19    host: &mut H,
20) {
21    gas!(interpreter, gas::BASE);
22    push!(interpreter, host.caller().into_word().into());
23}
24
25// EIP-4844: Shard Blob Transactions
26pub fn blob_hash<WIRE: InterpreterTypes, H: Host + ?Sized>(
27    interpreter: &mut Interpreter<WIRE>,
28    host: &mut H,
29) {
30    check!(interpreter, CANCUN);
31    gas!(interpreter, gas::VERYLOW);
32    popn_top!([], index, interpreter);
33    let i = as_usize_saturated!(index);
34    *index = host.blob_hash(i).unwrap_or_default();
35}