Skip to content

Commit 408a907

Browse files
Shashwat-NautiyalSamWilsn
authored andcommitted
added address after checks (#1129)
* address gets added only after checks * linting corrected * refactored as per geth impl
1 parent ce310e4 commit 408a907

File tree

8 files changed

+24
-16
lines changed

8 files changed

+24
-16
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1212
Implementations of the EVM system related instructions.
1313
"""
14+
1415
from ethereum_types.bytes import Bytes0
1516
from ethereum_types.numeric import U256, Uint
1617

@@ -75,8 +76,6 @@ def generic_create(
7576
evm.memory, memory_start_position, memory_size
7677
)
7778

78-
evm.accessed_addresses.add(contract_address)
79-
8079
create_message_gas = max_message_call_gas(Uint(evm.gas_left))
8180
evm.gas_left -= create_message_gas
8281
if evm.message.is_static:
@@ -95,6 +94,8 @@ def generic_create(
9594
push(evm.stack, U256(0))
9695
return
9796

97+
evm.accessed_addresses.add(contract_address)
98+
9899
if account_has_code_or_nonce(
99100
evm.message.block_env.state, contract_address
100101
) or account_has_storage(evm.message.block_env.state, contract_address):

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1212
Implementations of the EVM system related instructions.
1313
"""
14+
1415
from ethereum_types.bytes import Bytes0
1516
from ethereum_types.numeric import U256, Uint
1617

@@ -76,8 +77,6 @@ def generic_create(
7677
evm.memory, memory_start_position, memory_size
7778
)
7879

79-
evm.accessed_addresses.add(contract_address)
80-
8180
create_message_gas = max_message_call_gas(Uint(evm.gas_left))
8281
evm.gas_left -= create_message_gas
8382
if evm.message.is_static:
@@ -96,6 +95,8 @@ def generic_create(
9695
push(evm.stack, U256(0))
9796
return
9897

98+
evm.accessed_addresses.add(contract_address)
99+
99100
if account_has_code_or_nonce(
100101
evm.message.block_env.state, contract_address
101102
) or account_has_storage(evm.message.block_env.state, contract_address):

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1212
Implementations of the EVM system related instructions.
1313
"""
14+
1415
from ethereum_types.bytes import Bytes0
1516
from ethereum_types.numeric import U256, Uint
1617

@@ -84,8 +85,6 @@ def generic_create(
8485
if len(call_data) > 2 * MAX_CODE_SIZE:
8586
raise OutOfGasError
8687

87-
evm.accessed_addresses.add(contract_address)
88-
8988
create_message_gas = max_message_call_gas(Uint(evm.gas_left))
9089
evm.gas_left -= create_message_gas
9190
if evm.message.is_static:
@@ -104,6 +103,8 @@ def generic_create(
104103
push(evm.stack, U256(0))
105104
return
106105

106+
evm.accessed_addresses.add(contract_address)
107+
107108
if account_has_code_or_nonce(
108109
evm.message.block_env.state, contract_address
109110
) or account_has_storage(evm.message.block_env.state, contract_address):

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1212
Implementations of the EVM system related instructions.
1313
"""
14+
1415
from ethereum_types.bytes import Bytes0
1516
from ethereum_types.numeric import U256, Uint
1617

@@ -75,8 +76,6 @@ def generic_create(
7576
evm.memory, memory_start_position, memory_size
7677
)
7778

78-
evm.accessed_addresses.add(contract_address)
79-
8079
create_message_gas = max_message_call_gas(Uint(evm.gas_left))
8180
evm.gas_left -= create_message_gas
8281
if evm.message.is_static:
@@ -95,6 +94,8 @@ def generic_create(
9594
push(evm.stack, U256(0))
9695
return
9796

97+
evm.accessed_addresses.add(contract_address)
98+
9899
if account_has_code_or_nonce(
99100
evm.message.block_env.state, contract_address
100101
) or account_has_storage(evm.message.block_env.state, contract_address):

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1212
Implementations of the EVM system related instructions.
1313
"""
14+
1415
from ethereum_types.bytes import Bytes0
1516
from ethereum_types.numeric import U256, Uint
1617

@@ -75,8 +76,6 @@ def generic_create(
7576
evm.memory, memory_start_position, memory_size
7677
)
7778

78-
evm.accessed_addresses.add(contract_address)
79-
8079
create_message_gas = max_message_call_gas(Uint(evm.gas_left))
8180
evm.gas_left -= create_message_gas
8281
if evm.message.is_static:
@@ -95,6 +94,8 @@ def generic_create(
9594
push(evm.stack, U256(0))
9695
return
9796

97+
evm.accessed_addresses.add(contract_address)
98+
9899
if account_has_code_or_nonce(
99100
evm.message.block_env.state, contract_address
100101
) or account_has_storage(evm.message.block_env.state, contract_address):

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1212
Implementations of the EVM system related instructions.
1313
"""
14+
1415
from ethereum_types.bytes import Bytes0
1516
from ethereum_types.numeric import U256, Uint
1617

@@ -75,8 +76,6 @@ def generic_create(
7576
evm.memory, memory_start_position, memory_size
7677
)
7778

78-
evm.accessed_addresses.add(contract_address)
79-
8079
create_message_gas = max_message_call_gas(Uint(evm.gas_left))
8180
evm.gas_left -= create_message_gas
8281
if evm.message.is_static:
@@ -95,6 +94,8 @@ def generic_create(
9594
push(evm.stack, U256(0))
9695
return
9796

97+
evm.accessed_addresses.add(contract_address)
98+
9899
if account_has_code_or_nonce(
99100
evm.message.block_env.state, contract_address
100101
) or account_has_storage(evm.message.block_env.state, contract_address):

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1212
Implementations of the EVM system related instructions.
1313
"""
14+
1415
from ethereum_types.bytes import Bytes0
1516
from ethereum_types.numeric import U256, Uint
1617

@@ -85,8 +86,6 @@ def generic_create(
8586
if len(call_data) > 2 * MAX_CODE_SIZE:
8687
raise OutOfGasError
8788

88-
evm.accessed_addresses.add(contract_address)
89-
9089
create_message_gas = max_message_call_gas(Uint(evm.gas_left))
9190
evm.gas_left -= create_message_gas
9291
if evm.message.is_static:
@@ -105,6 +104,8 @@ def generic_create(
105104
push(evm.stack, U256(0))
106105
return
107106

107+
evm.accessed_addresses.add(contract_address)
108+
108109
if account_has_code_or_nonce(
109110
evm.message.block_env.state, contract_address
110111
) or account_has_storage(evm.message.block_env.state, contract_address):

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1212
Implementations of the EVM system related instructions.
1313
"""
14+
1415
from ethereum_types.bytes import Bytes0
1516
from ethereum_types.numeric import U256, Uint
1617

@@ -83,8 +84,6 @@ def generic_create(
8384
if len(call_data) > 2 * MAX_CODE_SIZE:
8485
raise OutOfGasError
8586

86-
evm.accessed_addresses.add(contract_address)
87-
8887
create_message_gas = max_message_call_gas(Uint(evm.gas_left))
8988
evm.gas_left -= create_message_gas
9089
if evm.message.is_static:
@@ -103,6 +102,8 @@ def generic_create(
103102
push(evm.stack, U256(0))
104103
return
105104

105+
evm.accessed_addresses.add(contract_address)
106+
106107
if account_has_code_or_nonce(
107108
evm.message.block_env.state, contract_address
108109
) or account_has_storage(evm.message.block_env.state, contract_address):

0 commit comments

Comments
 (0)