Skip to content

Conversation

@mattsse
Copy link
Contributor

@mattsse mattsse commented Nov 13, 2025

should close this one paradigmxyz/reth#19703

previously we were yeeting them from pre here:

// only keep accounts that are not created
change_type.get(addr).map(|ty| !ty.0.is_created()).unwrap_or(true)

@antoniolocascio
Copy link

I still have a question about the line:

// only keep accounts that are not created
change_type.get(addr).map(|ty| !ty.0.is_created()).unwrap_or(true)

A contract can be deployed at an address with non-zero balance. If that happens (and it doesn't selfdestruct), the pre section should contain the address with only balance. IIUC, this line would still filter it out. Basically, the rule should be to filter out from pre contracts that have been deployed on empty addresses. I don't have an example to test on geth at hand, but should be easy enough to find one.

@mattsse
Copy link
Contributor Author

mattsse commented Nov 13, 2025

right, I think this makes sense

need to write a new test case for this scenario and look at the geth impl again

@mattsse
Copy link
Contributor Author

mattsse commented Nov 28, 2025

superseded by #383

@mattsse mattsse closed this Nov 28, 2025
mattsse added a commit that referenced this pull request Nov 28, 2025
This aims at resolving issues mentioned in #382 , typically this one :
<img width="1818" height="694" alt="image"
src="https://github.com/user-attachments/assets/51b82944-c711-421b-8479-05095ae9bbce"
/>

To fix this , what i did was : 
- Keep track of addresses that are marked as Create and were truly empty
in the database snapshot. Only these addresses are filtered from the
prestate diff so prefunded contract deployments remain visible.

- Introduce account_was_empty helper to avoid re-computing the emptiness
check and add a regression test
(prestate_diff_keeps_prefunded_created_accounts) that covers a prefunded
creation vs. a true empty-address creation.

cc @mattsse  Please check it out if it resolves 

should close this one paradigmxyz/reth#19703

---------

Co-authored-by: Matthias Seitz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants