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

test_setChainParams incorrectly initializes precompiles #5819

@gumb0

Description

@gumb0

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).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions