Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

test_setChainParams incorrectly initializes precompiles #5819

Closed
gumb0 opened this issue Nov 13, 2019 · 0 comments · Fixed by #5821
Closed

test_setChainParams incorrectly initializes precompiles #5819

gumb0 opened this issue Nov 13, 2019 · 0 comments · Fixed by #5821
Assignees
Labels

Comments

@gumb0
Copy link
Member

gumb0 commented Nov 13, 2019

It calls ClientTest::setChainParams which calls ChainParams::loadConfig which first creates a copy of current params then applies values from json on top of it. This includes a call to jsonToAccountMap, which uses std::unordered_map::insert to initialize precompiled contracts. insert doesn't overwrite previous precompiles, when the key already exists.

This way setChainParams keeps the precompiles that were defined in the first used chain params forever.

I think loadConfig should better initialize params starting from default values (including empty precompile map) instead of starting from currently stored values.

This affects running tests via retesteth (possibly should fix at least some of the currently failing ones).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant