Skip to content

Commit 2936da0

Browse files
committed
Drop an unneeded London transaction instance check
1 parent bc3d6fd commit 2936da0

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

eth/vm/forks/london/state.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
)
3636

3737
from .computation import LondonComputation
38-
from .transactions import LondonTypedTransaction
3938
from .validation import validate_london_normalized_transaction
4039

4140

@@ -180,18 +179,18 @@ def get_transaction_context(self: StateAPI,
180179
London-specific transaction context creation,
181180
where gas_price includes the block base fee
182181
"""
183-
if isinstance(transaction, LondonTypedTransaction): # TODO probably do this somewhere else
184-
priority_fee_per_gas = min(
185-
transaction.max_priority_fee_per_gas,
186-
transaction.max_fee_per_gas - self.execution_context.base_fee_per_gas
187-
)
188-
else:
189-
priority_fee_per_gas = min(
190-
transaction.gas_price,
191-
transaction.gas_price - self.execution_context.base_fee_per_gas
192-
)
182+
effective_gas_price = min(
183+
transaction.max_priority_fee_per_gas + self.execution_context.base_fee_per_gas,
184+
transaction.max_fee_per_gas,
185+
)
186+
# See how this reduces in a pre-1559 transaction:
187+
# 1. effective_gas_price = min(
188+
# transaction.gas_price + self.execution_context.base_fee_per_gas,
189+
# transaction.gas_price,
190+
# )
191+
# base_fee_per_gas is non-negative, so:
192+
# 2. effective_gas_price = transaction.gas_price
193193

194-
effective_gas_price = self.execution_context.base_fee_per_gas + priority_fee_per_gas
195194
return self.get_transaction_context_class()(
196195
gas_price=effective_gas_price,
197196
origin=transaction.sender

0 commit comments

Comments
 (0)