Skip to content

Conversation

@weiihann
Copy link
Contributor

When iterating over a map with value types in Go, the loop variable is a copy. In markCodeExistence, assigning to code.exists modified only the local copy, not the actual map entry, causing the existence flag to always remain false.

This resulted in overcounting contract codes in state size statistics, as codes that already existed in the database were incorrectly counted as new.

Fix by changing codes from map[common.Address]contractCode to map[common.Address]*contractCode, so mutations apply directly to the struct.

@rjl493456442 rjl493456442 added this to the 1.16.8 milestone Dec 15, 2025
@rjl493456442 rjl493456442 merged commit 15f52a2 into ethereum:master Dec 15, 2025
7 of 8 checks passed
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.

2 participants