Skip to content

Commit e1e467b

Browse files
committed
improve readability of calculations
1 parent 69b1c58 commit e1e467b

File tree

13 files changed

+39
-65
lines changed

13 files changed

+39
-65
lines changed

src/ethereum/arrow_glacier/vm/instructions/system.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,9 @@ def call(evm: Evm) -> None:
353353

354354
code_address = to
355355

356-
create_gas_cost = (
357-
Uint(0)
358-
if is_account_alive(evm.message.block_env.state, to) or value == 0
359-
else GAS_NEW_ACCOUNT
360-
)
356+
create_gas_cost = GAS_NEW_ACCOUNT
357+
if value == 0 or is_account_alive(evm.message.block_env.state, to):
358+
create_gas_cost = Uint(0)
361359
transfer_gas_cost = Uint(0) if value == 0 else GAS_CALL_VALUE
362360
message_call_gas = calculate_message_call_gas(
363361
value,

src/ethereum/berlin/vm/instructions/system.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,9 @@ def call(evm: Evm) -> None:
354354

355355
code_address = to
356356

357-
create_gas_cost = (
358-
Uint(0)
359-
if is_account_alive(evm.message.block_env.state, to) or value == 0
360-
else GAS_NEW_ACCOUNT
361-
)
357+
create_gas_cost = GAS_NEW_ACCOUNT
358+
if value == 0 or is_account_alive(evm.message.block_env.state, to):
359+
create_gas_cost = Uint(0)
362360
transfer_gas_cost = Uint(0) if value == 0 else GAS_CALL_VALUE
363361
message_call_gas = calculate_message_call_gas(
364362
value,

src/ethereum/byzantium/vm/instructions/system.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,9 @@ def call(evm: Evm) -> None:
274274

275275
code_address = to
276276

277-
create_gas_cost = (
278-
Uint(0)
279-
if is_account_alive(evm.message.block_env.state, to) or value == 0
280-
else GAS_NEW_ACCOUNT
281-
)
277+
create_gas_cost = GAS_NEW_ACCOUNT
278+
if value == 0 or is_account_alive(evm.message.block_env.state, to):
279+
create_gas_cost = Uint(0)
282280
transfer_gas_cost = Uint(0) if value == 0 else GAS_CALL_VALUE
283281
message_call_gas = calculate_message_call_gas(
284282
value,

src/ethereum/cancun/vm/instructions/system.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,9 @@ def call(evm: Evm) -> None:
373373

374374
code_address = to
375375

376-
create_gas_cost = (
377-
Uint(0)
378-
if is_account_alive(evm.message.block_env.state, to) or value == 0
379-
else GAS_NEW_ACCOUNT
380-
)
376+
create_gas_cost = GAS_NEW_ACCOUNT
377+
if value == 0 or is_account_alive(evm.message.block_env.state, to):
378+
create_gas_cost = Uint(0)
381379
transfer_gas_cost = Uint(0) if value == 0 else GAS_CALL_VALUE
382380
message_call_gas = calculate_message_call_gas(
383381
value,

src/ethereum/constantinople/vm/instructions/system.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,9 @@ def call(evm: Evm) -> None:
344344

345345
code_address = to
346346

347-
create_gas_cost = (
348-
Uint(0)
349-
if is_account_alive(evm.message.block_env.state, to) or value == 0
350-
else GAS_NEW_ACCOUNT
351-
)
347+
create_gas_cost = GAS_NEW_ACCOUNT
348+
if value == 0 or is_account_alive(evm.message.block_env.state, to):
349+
create_gas_cost = Uint(0)
352350
transfer_gas_cost = Uint(0) if value == 0 else GAS_CALL_VALUE
353351
message_call_gas = calculate_message_call_gas(
354352
value,

src/ethereum/gray_glacier/vm/instructions/system.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,9 @@ def call(evm: Evm) -> None:
353353

354354
code_address = to
355355

356-
create_gas_cost = (
357-
Uint(0)
358-
if is_account_alive(evm.message.block_env.state, to) or value == 0
359-
else GAS_NEW_ACCOUNT
360-
)
356+
create_gas_cost = GAS_NEW_ACCOUNT
357+
if value == 0 or is_account_alive(evm.message.block_env.state, to):
358+
create_gas_cost = Uint(0)
361359
transfer_gas_cost = Uint(0) if value == 0 else GAS_CALL_VALUE
362360
message_call_gas = calculate_message_call_gas(
363361
value,

src/ethereum/istanbul/vm/instructions/system.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,9 @@ def call(evm: Evm) -> None:
344344

345345
code_address = to
346346

347-
create_gas_cost = (
348-
Uint(0)
349-
if is_account_alive(evm.message.block_env.state, to) or value == 0
350-
else GAS_NEW_ACCOUNT
351-
)
347+
create_gas_cost = GAS_NEW_ACCOUNT
348+
if value == 0 or is_account_alive(evm.message.block_env.state, to):
349+
create_gas_cost = Uint(0)
352350
transfer_gas_cost = Uint(0) if value == 0 else GAS_CALL_VALUE
353351
message_call_gas = calculate_message_call_gas(
354352
value,

src/ethereum/london/vm/instructions/system.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,9 @@ def call(evm: Evm) -> None:
353353

354354
code_address = to
355355

356-
create_gas_cost = (
357-
Uint(0)
358-
if is_account_alive(evm.message.block_env.state, to) or value == 0
359-
else GAS_NEW_ACCOUNT
360-
)
356+
create_gas_cost = GAS_NEW_ACCOUNT
357+
if value == 0 or is_account_alive(evm.message.block_env.state, to):
358+
create_gas_cost = Uint(0)
361359
transfer_gas_cost = Uint(0) if value == 0 else GAS_CALL_VALUE
362360
message_call_gas = calculate_message_call_gas(
363361
value,

src/ethereum/muir_glacier/vm/instructions/system.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,9 @@ def call(evm: Evm) -> None:
344344

345345
code_address = to
346346

347-
create_gas_cost = (
348-
Uint(0)
349-
if is_account_alive(evm.message.block_env.state, to) or value == 0
350-
else GAS_NEW_ACCOUNT
351-
)
347+
create_gas_cost = GAS_NEW_ACCOUNT
348+
if value == 0 or is_account_alive(evm.message.block_env.state, to):
349+
create_gas_cost = Uint(0)
352350
transfer_gas_cost = Uint(0) if value == 0 else GAS_CALL_VALUE
353351
message_call_gas = calculate_message_call_gas(
354352
value,

src/ethereum/paris/vm/instructions/system.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,9 @@ def call(evm: Evm) -> None:
352352

353353
code_address = to
354354

355-
create_gas_cost = (
356-
Uint(0)
357-
if is_account_alive(evm.message.block_env.state, to) or value == 0
358-
else GAS_NEW_ACCOUNT
359-
)
355+
create_gas_cost = GAS_NEW_ACCOUNT
356+
if value == 0 or is_account_alive(evm.message.block_env.state, to):
357+
create_gas_cost = Uint(0)
360358
transfer_gas_cost = Uint(0) if value == 0 else GAS_CALL_VALUE
361359
message_call_gas = calculate_message_call_gas(
362360
value,

0 commit comments

Comments
 (0)