Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Conversation

@chiphamskymavis
Copy link
Contributor

@chiphamskymavis chiphamskymavis commented Jan 2, 2025

This patch is included these changes:

core/vm: reject contract creation if the storage is non-empty

Partially cherry-pick from: ethereum/go-ethereum#28912

core/state, tests: fix memory leak via fastcache

Cherry-pick from: ethereum/go-ethereum#28387

@chiphamskymavis chiphamskymavis changed the title core/vm: reject contract creation if the storage is non-empty tests: update tests to adapt with geth Jan 3, 2025
@chiphamskymavis
Copy link
Contributor Author

Current most of the test now passed, only the TestState/stPreCompiledContracts/idPrecomps failed on some cases

--- FAIL: TestState (0.82s)
    --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json (0.96s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/100/hash/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/100/hash/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/100/path/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/100/path/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/101/hash/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/101/hash/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/101/path/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/101/path/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/102/hash/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/102/hash/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/102/path/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/102/path/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/103/hash/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/103/hash/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/103/path/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/103/path/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/104/hash/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/104/hash/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/104/path/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/Berlin/104/path/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/100/hash/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/100/hash/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/100/path/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/100/path/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/101/hash/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/101/hash/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/101/path/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/101/path/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/102/hash/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/102/hash/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/102/path/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/102/path/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/103/hash/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/103/hash/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/103/path/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/103/path/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/104/hash/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/104/hash/snap (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/104/path/trie (0.00s)
        --- FAIL: TestState/stPreCompiledContracts/idPrecomps.json/London/104/path/snap (0.00s)

@chiphamskymavis chiphamskymavis marked this pull request as ready for review January 3, 2025 10:08
@chiphamskymavis
Copy link
Contributor Author

chiphamskymavis commented Jan 3, 2025

The remaining FAIL test maybe caused due to this
ethereum/go-ethereum#27720

Update: use the tests with the earlier version v13 and test seem good

@chiphamskymavis chiphamskymavis force-pushed the non-empty-storage branch 2 times, most recently from cddb226 to e7c942c Compare January 6, 2025 04:28
chiphamskymavis and others added 3 commits January 6, 2025 13:54
This change fixes a memory leak, when running either state-tests or blockchain-tests, we allocate a `1MB` fastcache during snapshot generation. `fastcache` is a bit special, and requires a `Reset()` (it has it's own memory allocator).

The `1MB` was hidden [here](https://github.com/ethereum/go-ethereum/blob/master/tests/state_test_util.go#L333) and [here](https://github.com/ethereum/go-ethereum/blob/master/tests/block_test_util.go#L146) respectively.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants