Skip to content

Commit fb1892b

Browse files
committed
Run formatter
1 parent b912261 commit fb1892b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/ethereum/prague/fork.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@
4949
state_root,
5050
)
5151
from .transactions import (
52+
COST_FLOOR_PER_CALLDATA_TOKEN,
53+
LEGACY_CALLDATA_TOKEN_COST,
5254
TX_ACCESS_LIST_ADDRESS_COST,
5355
TX_ACCESS_LIST_STORAGE_KEY_COST,
5456
TX_BASE_COST,
5557
TX_CREATE_COST,
56-
LEGACY_CALLDATA_TOKEN_COST,
57-
COST_FLOOR_PER_CALLDATA_TOKEN,
5858
AccessListTransaction,
5959
BlobTransaction,
6060
FeeMarketTransaction,
@@ -877,17 +877,19 @@ def process_transaction(
877877
)
878878

879879
output = process_message_call(message, env)
880-
881-
floor = Uint(tokens_in_calldata * COST_FLOOR_PER_CALLDATA_TOKEN + TX_BASE_COST)
882-
880+
881+
floor = Uint(
882+
tokens_in_calldata * COST_FLOOR_PER_CALLDATA_TOKEN + TX_BASE_COST
883+
)
884+
883885
legacy_cost = Uint(gas_used + tokens_in_calldata * LEGACY_TOKEN_COST)
884-
886+
885887
if legacy_cost < floor:
886888
output.gas_left -= floor - gas_used
887889
gas_used = floor
888890
else:
889891
gas_used = tx.gas - output.gas_left
890-
892+
891893
gas_refund = min(gas_used // 5, output.refund_counter)
892894
gas_refund_amount = (output.gas_left + gas_refund) * env.gas_price
893895

@@ -950,14 +952,14 @@ def calculate_intrinsic_cost(tx: Transaction) -> Tuple[Uint, Uint]:
950952
The eip-7623 calldata tokens used by the transaction.
951953
"""
952954
data_cost = 0
953-
955+
954956
zerobytes = 0
955957
for byte in tx.data:
956958
if byte == 0:
957959
zerobytes += 1
958960

959961
tokens_in_calldata = zerobytes + (len(tx.data) - zerobytes) * 4
960-
962+
961963
data_cost = tokens_in_calldata * COST_FLOOR_PER_CALLDATA_TOKEN
962964

963965
if tx.to == Bytes0(b""):
@@ -973,9 +975,10 @@ def calculate_intrinsic_cost(tx: Transaction) -> Tuple[Uint, Uint]:
973975
access_list_cost += TX_ACCESS_LIST_ADDRESS_COST
974976
access_list_cost += len(keys) * TX_ACCESS_LIST_STORAGE_KEY_COST
975977

976-
return Uint(TX_BASE_COST +
977-
data_cost +
978-
create_cost + access_list_cost), tokens_in_calldata
978+
return (
979+
Uint(TX_BASE_COST + data_cost + create_cost + access_list_cost),
980+
tokens_in_calldata,
981+
)
979982

980983

981984
def recover_sender(chain_id: U64, tx: Transaction) -> Address:

0 commit comments

Comments
 (0)