Skip to content

Commit c4b9075

Browse files
committed
Move London-specific gas price code to LondonState
1 parent b24b597 commit c4b9075

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

eth/vm/forks/london/state.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@ class LondonState(BerlinState):
147147
computation_class = LondonComputation
148148
transaction_executor_class: Type[TransactionExecutorAPI] = LondonTransactionExecutor
149149

150+
def get_tip(self, transaction: SignedTransactionAPI) -> int:
151+
return min(
152+
transaction.max_fee_per_gas - self.execution_context.base_fee_per_gas,
153+
transaction.max_priority_fee_per_gas,
154+
)
155+
156+
def get_gas_price(self, transaction: SignedTransactionAPI) -> int:
157+
return min(
158+
transaction.max_fee_per_gas,
159+
transaction.max_priority_fee_per_gas + self.execution_context.base_fee_per_gas,
160+
)
161+
150162
def validate_transaction(
151163
self,
152164
transaction: SignedTransactionAPI

eth/vm/state.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,11 @@ def difficulty(self) -> int:
8888
def gas_limit(self) -> int:
8989
return self.execution_context.gas_limit
9090

91-
def _get_burn_price(self) -> int:
92-
"""
93-
How much of the gas price will be burned?
94-
"""
95-
execution_context = self.execution_context
96-
try:
97-
return execution_context.base_fee_per_gas
98-
except AttributeError:
99-
return 0
100-
10191
def get_tip(self, transaction: SignedTransactionAPI) -> int:
102-
return min(
103-
transaction.max_fee_per_gas - self._get_burn_price(),
104-
transaction.max_priority_fee_per_gas,
105-
)
92+
return transaction.gas_price
10693

10794
def get_gas_price(self, transaction: SignedTransactionAPI) -> int:
108-
return min(
109-
transaction.max_fee_per_gas,
110-
transaction.max_priority_fee_per_gas + self._get_burn_price(),
111-
)
95+
return transaction.gas_price
11296

11397
#
11498
# Access to account db

0 commit comments

Comments
 (0)