Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
gas_tracker.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
barretenberg/vm2/common/aztec_types.hpp
"
4
#include "
barretenberg/vm2/common/instruction_spec.hpp
"
5
#include "
barretenberg/vm2/simulation/events/gas_event.hpp
"
6
#include "
barretenberg/vm2/simulation/interfaces/context.hpp
"
7
#include "
barretenberg/vm2/simulation/interfaces/gas_tracker.hpp
"
8
#include "
barretenberg/vm2/simulation/interfaces/gt.hpp
"
9
#include "
barretenberg/vm2/simulation/lib/instruction_info.hpp
"
10
#include "
barretenberg/vm2/simulation/lib/serialization.hpp
"
11
12
namespace
bb::avm2::simulation
{
13
14
class
GasTracker
final :
public
GasTrackerInterface
{
15
public
:
16
GasTracker
(
GasEvent
&
gas_event
,
17
const
Instruction
&
instruction
,
18
const
InstructionInfoDBInterface
&
instruction_info_db
,
19
ContextInterface
&
context
,
20
GreaterThanInterface
&
greater_than
);
21
22
void
consume_gas
(
const
Gas
& dynamic_gas_factor = { 0, 0 })
override
;
23
Gas
compute_gas_limit_for_call
(
const
Gas
& allocated_gas)
override
;
24
25
private
:
26
ContextInterface
&
context
;
27
const
ExecInstructionSpec
&
spec
;
28
GreaterThanInterface
&
greater_than
;
29
GasEvent
&
gas_event
;
30
};
31
32
}
// namespace bb::avm2::simulation
aztec_types.hpp
bb::avm2::context
Definition
context.hpp:37
bb::avm2::simulation::ContextInterface
Definition
context.hpp:20
bb::avm2::simulation::GasTracker
Definition
gas_tracker.hpp:14
bb::avm2::simulation::GasTracker::compute_gas_limit_for_call
Gas compute_gas_limit_for_call(const Gas &allocated_gas) override
Computes the gas limit for a call (CALL and STATICCALL opcodes) as the minimum between the gas alloca...
Definition
gas_tracker.cpp:112
bb::avm2::simulation::GasTracker::gas_event
GasEvent & gas_event
Definition
gas_tracker.hpp:29
bb::avm2::simulation::GasTracker::greater_than
GreaterThanInterface & greater_than
Definition
gas_tracker.hpp:28
bb::avm2::simulation::GasTracker::spec
const ExecInstructionSpec & spec
Definition
gas_tracker.hpp:27
bb::avm2::simulation::GasTracker::consume_gas
void consume_gas(const Gas &dynamic_gas_factor={ 0, 0 }) override
Consumes gas for the current instruction.
Definition
gas_tracker.cpp:65
bb::avm2::simulation::GasTracker::context
ContextInterface & context
Definition
gas_tracker.hpp:26
bb::avm2::simulation::GasTrackerInterface
Definition
gas_tracker.hpp:7
bb::avm2::simulation::GreaterThanInterface
Definition
gt.hpp:9
bb::avm2::simulation::InstructionInfoDBInterface
Definition
instruction_info.hpp:11
instruction_spec.hpp
gas_event.hpp
instruction_info_db
InstructionInfoDB instruction_info_db
Definition
gas_tracker.test.cpp:30
instruction
Instruction instruction
Definition
gas_tracker.test.cpp:33
instruction_info.hpp
gas_tracker.hpp
bb::avm2::simulation
Definition
address_derivation_event.hpp:6
serialization.hpp
context.hpp
gt.hpp
bb::avm2::ExecInstructionSpec
Definition
instruction_spec.hpp:22
bb::avm2::Gas
Definition
aztec_types.hpp:317
bb::avm2::simulation::GasEvent
Definition
gas_event.hpp:17
bb::avm2::simulation::Instruction
Definition
serialization.hpp:32
src
barretenberg
vm2
simulation
gadgets
gas_tracker.hpp
Generated by
1.9.8