Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix: Repeated Instantiations of Contract Should Overwrite Addresses #6

Merged
merged 2 commits into from
Jul 28, 2024

Conversation

dowlandaiello
Copy link
Contributor

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 is HashMap<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 using contract_addrs.

This PR makes contract_addrs entries store only a single address, thus allowing use cases such as:

  • Multiple tests with the same TestContext, but "clean" astroport factories, for example

@dowlandaiello dowlandaiello added the bug Something isn't working label Jul 28, 2024
@dowlandaiello dowlandaiello requested a review from keyleu July 28, 2024 16:43
@dowlandaiello dowlandaiello self-assigned this Jul 28, 2024
src/utils/test_context.rs Outdated Show resolved Hide resolved
@keyleu
Copy link
Contributor

keyleu commented Jul 28, 2024

LGTM!

@dowlandaiello dowlandaiello merged commit 6272c78 into main Jul 28, 2024
3 checks passed
@dowlandaiello dowlandaiello deleted the dowlandaiello/bugfix-contractaddrs branch July 28, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants