Bug Fix: Repeated Instantiations of Contract Should Overwrite Addresses #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the test context has a
contract_addrs
field, which stores deployed contract addresses for contracts by their name. However, the type of the field isHashMap<String, Vec<String>>
, allowing it to store multiple instantiations of a single contract. This could be considered a footgun, as localic-utils always takes the first result of this vec anyway, meaning, if a contract is created twice, only the first version will be considered in any operations usingcontract_addrs
.This PR makes
contract_addrs
entries store only a single address, thus allowing use cases such as:TestContext
, but "clean" astroport factories, for example