Skip to content

Commit fddce69

Browse files
fselmocarver
authored andcommitted
reset return data on contract collision
1 parent 4420efd commit fddce69

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

eth/vm/logic/system.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,15 @@ def __call__(self, computation: ComputationAPI) -> None:
163163
computation.stack_push_int(0)
164164
computation.return_data = b''
165165
if insufficient_funds:
166-
err_msg = f"Insufficient Funds: {storage_address_balance} < {stack_data.endowment}"
166+
self.logger.debug2(
167+
"%s failure: %s",
168+
self.mnemonic,
169+
f"Insufficient Funds: {storage_address_balance} < {stack_data.endowment}"
170+
)
167171
elif stack_too_deep:
168-
err_msg = "Stack limit reached"
169-
self.logger.debug2("%s failure: %s", self.mnemonic, err_msg,)
172+
self.logger.debug2("%s failure: %s", self.mnemonic, "Stack limit reached")
173+
else:
174+
raise RuntimeError("Invariant: error must be insufficient funds or stack too deep")
170175
return
171176

172177
call_data = computation.memory_read_bytes(
@@ -183,11 +188,12 @@ def __call__(self, computation: ComputationAPI) -> None:
183188
is_collision = computation.state.has_code_or_nonce(contract_address)
184189

185190
if is_collision:
191+
computation.stack_push_int(0)
192+
computation.return_data = b''
186193
self.logger.debug2(
187194
"Address collision while creating contract: %s",
188195
encode_hex(contract_address),
189196
)
190-
computation.stack_push_int(0)
191197
return
192198

193199
child_msg = computation.prepare_child_message(

0 commit comments

Comments
 (0)